Blogs
I am attempting to blog through desktop client for Ubuntu called BloGTK.
The install was a breeze through the Synaptic Package Manager of Ubuntu. Activating the BlogAPI module in Drupal was as simple as checking one box to turn it on, and then selecting the list of contents I should be able to post through the Desktop client.
It took me a bit of search to find out the exact URL to be put in the account settings (server address + xmlrpc.php), but once done it is pretty straight forward.
One notable limitation of using BloGTK is that I am not able to choose multiple categories. I use categories extensively and attach the same post to multiple applicable categories. Not sure if I am missing any settings. I even tried Drivel Journal Editor (search for "drivel" in Ubuntu's package manager) and that too seems to have the same limitation.
I came across this article by Matt Hartley: Closed Source vs. Open Source in Desktop Linux, and it got me thinking.
For the past couple of months, during which I have adopted Linux (Ubuntu) even further and rarely dual boot into Windows, I have faced some challenges in corner cases. For one, I wished Apple would be more open towards open source, in terms of iTunes. Now that I think about it, I do not even want them to open source their iTunes software. As long as they keep it supported for Linux, I don't mind using it.
And further, I was having a chat with one of my friends, and when I mentioned about the game companies not releasing their games in Linux, he said that 'the open source requirement could be a problem for them to do that'. In spite of him knowing that you are not required to open source your software while selling it for Linux environment, that was the first thought that came to his mind. A prejudice where we assume it must be open sourced to be in Linux.
What is wrong with having closed source software?
When posed with a similar question, one of my Twitter buddy, rmdrao said:
Would open source users be in a position to better manufacturers at writing drivers. I doubt that. Codecs is still a shot.
I think, at time, part of us forgets what Open Source software is all about. It is about freedom to choose. When something is a basic necessity, when it is a basic commodity, like operating systems or codecs, it is better for the community to embrace Open Source. But when it comes to integral part of products, especially hardware - like the NVIDIA graphic cards, it is harming to the open source projects when we take a snobbish attitude of asking them to open source their software. They are offering a end product, which we can do without and we are free to choose it or not. Moreover, when they are providing support to Linux, I don't see a reason we should twist their arm to get the source code out.
Same is the case with games, in my opinion. When the product they are giving is not a basic essential, and for most part is a luxury - for the community to thrive it is fine for them to release their games as closed source. Because, games are, for most part art expressed as code.
We should never force someone to open their code. We are free to choose their product or not. They are free to choose for open source or closed source. The most we should ask for is support for Linux on the same level as Windows and MacOS. For that to happen, our aim would be to increase the userbase of Linux.
Need to get a particular field from a pipe delimited string in Java?
Say you have a string like "alpha|beta|gamma|delta" and want the third token. Here is how you do it in Java.
Code
public class StringSplit {
public static void main(String[] args) {
String inputString = "alpha|beta|gamma|delta";
System.out.println("Input String: \n" + inputString);
System.out.println("Splitting...");
// Here is the core - replace the regex with
// whatever delimiter you have. Since '|' is
// a special character in regular expression,
// we need to escape it.
String tokens[] = inputString.split("\\|");
int numTokens = tokens.length;
System.out.println("Number of tokens: " + numTokens);
for (int i = 0; i < numTokens; i++) {
System.out.println("[" + i + "] " + tokens[i]);
}
// 3rd field?
System.out.println("Third field: " + tokens[2]);
System.out.println("...done!");
}
}
Output
Input String:
alpha|beta|gamma|delta
Splitting...
Number of tokens: 4
[0] alpha
[1] beta
[2] gamma
[3] delta
Third field: gamma
...done!
The delimiter in this example is the pipe (|) character. It can be any character or set of characters - just pass it to the String.split() method as a regular expression.