Weekend Carpentry: Monitor Stand
I’ve been wanting a monitor stand for sometime now as the Dell monitor that I am having doesn’t have an adjustable stand. Apparently, these stands cost around $30-40 and it didn’t seem worth the money.
So I ended up building one out of some old furniture parts I had. In the end it turned out to be better than I expected :). In fact comparable to what you can buy online http://www.amazon.com/OFC-Express-Monitor-Stand-Black/dp/B0020LB28Q/ref=sr_1_9?s=office-products&ie=UTF8&qid=1345923737&sr=1-9&keywords=monitor+stand.
Here are some photos.
| Finished product | It has enough space underneath to store my files |
| Top view | Bottom view |
| Just before I cleaned up the place
| My old monitor stand; just a cardboard box from Amazon :) |
Lexus Aux/IPod Input: iSimple Gateway
I’ve been wanting to use an auxiliary input with our 2006 Lexus ES for sometime and found this very neat solution from iSimple http://isimplesolutions.com/product.aspx?zpid=416. After doing some research on other available products on the market I decided to go with this one as it can control an IPod (or any other I* music device) right from the car stereo controls.
Setting up is pretty easy and sound quality is very well indeed! Here are the things you will need and steps to follow.
Equipment
- A socket wrench and 10mm socket. It’s helpful if you have an extension as well.
- [Optional] A plastic pry bar like the one on below (left). I simply used the one on right and trust me it’s very nice and does no harm to the leather.
Steps
- Shift gear to park position and push-on emergency brakes.
- Remove the plastic panel around the gear. Here’s a nice pictorial guide on doing this plus removing CD changer (http://www.clublexus.com/forums/es300-and-es330/505772-please-help-advice-i-need-to-replace-my-cup-holder.html)
- Then remove the AC control panel. This has no screws just pulling it out would do. If you need you could use the plastic pry bar.
- Next remove the four 10mm bolts and pull out the car stereo. Here’s a nice video guide for this and previous step (http://www.youtube.com/watch?v=w-0ESCWyz4w)
- To access the back of your stereo you may need to remove wires going for the clock and hazard light switch.
- From this point forward steps are straight forward to follow using the manual provided in the iSimple Gateway at http://www.pac-audio.com/PacProductData/PGHTY1/1_Instructions/pghty1_instructions_020910.pdf.
- A nice set of video demos are at http://www.pac-audio.com/videos.aspx
Tips
- You may need to think where to run your cables. I ran them to the center console box and with some effort managed to make nice installation without any drilling. Just post a comment if you need more information. I wish I took some pictures.
- I used Velcro tape to keep the device attached to the car behind AC control panel.
Recursion is Natural
“Yay! I can see my bu** !! … wait, it’s not my bu**, it’s myself !”
If you can come to the last realization that you are seeing yourself then you already understand recursion is natural. If not, the following few examples may help.
Example 1: Is Even?
Zero is even. Any integer N > 0 is even if N-1 is not even.
Example 2: Factorial
Factorial of zero is 1. Factorial of any integer N > 0 is N times factorial of N-1.
Example 2: Length of a List
An empty list has a length zero. Any other list has one head element and a sub list called the tail. So length is 1 more than the length of the tail.
Example 3: Map f() to List S
If S is empty then nothing to do just return an empty list. If not map f() to the tail and get a mapped list. Then add f(head) to the front of that list.
P.S. Many thanks to Dan Friedman (https://www.cs.indiana.edu/~dfried/) for his great class of B521 (cs.indiana.edu/classes/b521) at IU, 2009.
----------
About the image; it’s an InkScape sketching of the image I found at http://contortionistsunite.ning.com/profiles/blogs/day-1-3
Taming Wild Horses: Chapel Asynchronous Tasks
Chapel supports nesting data parallel and task parallel code arbitrary as desired. This allows you, for example, to spawn asynchronous tasks inside a forall loop. The code snippet below shows code for a case like this where a forall is run on an array of 3 elements. The work to be done for second element is time consuming, hence a new task is spawned to run the timeeater(). Seems straightforward isn’t it? What if timeeater() takes more time than the forall loop? You’d expect forall to wait till all the dynamically spawned tasks to complete, but unfortunately it’s not the case. So if you want everything to be done when you exit forall loop use the construct sync to synchronize.
Try running the code with and without sync and observe the value of result, which should be 500500 if forall exit only after all the tasks have completed.
var d : domain(1) = [1..3];
var a : [d] int = d;
var result : int;
sync forall i in a{
writeln(i);
if (i == 2) then {
begin result = timeeater();
}
}
writeln("end of forall");
writeln("result ", result);
proc timeeater(){
var tmp : int = 0;
for i in 1 .. 1000{
tmp = tmp + i;
if (i%25 == 0) then {
writeln("eating time ", i);
}
}
return tmp;
}
Chapel is Sweet
It has been a little while since I started playing around Chapel (http://chapel.cray.com/) language, but could not run anything fun and large until recently. As part of the B524 – Parallelism in Programming Languages and Systems class from Prof. Lumsdaine (http://osl.iu.edu/~lums/), we had to implement Single Source Shortest Path (SSSP) of Graph500 (http://www.cc.gatech.edu/~jriedy/tmp/graph500/) specification. Only then I could realize the easiness of many of the high-level abstractions provided in Chapel compared to other parallel languages or paradigms. Honestly, I did not expect it to work in the first run across a set of machines, but surprisingly it did!
Download a Set of URLs with GNU Wget
I had a list of URLs that I wanted to download and it was a pain to do it manually. So end up writing a simple shell script and downloading all of them using GNU Wget. Here’s the shell script (modified the one at http://www.linuxquestions.org/questions/programming-9/shell-script-that-read-each-line-separatly-364259/).
#!/bin/bash
# Set the field seperator to a newline
IFS="
"
# Loop through the file
for line in `cat file.txt`;do
wget $line
done
Blogging: Images in Comments
Finally, an awesome solution to a problem that I’ve been searching for quite a while: how to add an image in a comment to blog post?
Look no further, just visit Spice Up Your Blog on this at http://www.spiceupyourblog.com/2010/12/images-colored-text-blogger-comments.html
Apparently it has just more than adding images like colored text and scrolling text.
See the test comments I made for fun
Windows Live Writer: Life Made Easy for Blogging
Few places to note if you are having trouble connecting to Blogger with Live Writer as I did.
- Blog URL: Don’t forget to use https instead of http
- Username: Remember to add @gmail.com to your user id
- Password: As mentioned above, if you are using a two step verification with Google you need to generate application specific password to connect (see http://support.google.com/accounts/bin/answer.py?hl=en&answer=185833)
A Small Contribution: Substitution in The World of Lambda
Thank you Professor Matthias Felleisen for posting it and Professor Amr Sabry at Indiana University for the inspiring course on B522 - Foundations in Programming Languages, which made this possible.
SugarSync Public Link: Direct Download
May be it was done with good intentions, but it broke all the image links we had in our Web site. Anyway, it seems there's a way around to get images working back in your Web pages without much hassle.
The solution is just add the following to the end of each image link (I know it's bit work too, but way better than having copy images to a local folder and linking them again manually).
old-link?directDownload=true
Update 3/27/2012:
I tried the same trick to put an image to a blog post using a SugarSync public link, but it wasn’t successful. As it seems Blogger’s image retrieving service couldn’t handle the directDownload=true.
Copy Path to Clipboard : Another Life Saver
Note. It works fine with Windows 7 as well.
ReSharper: Life Saver for Visual Studio Users
Unfortunately it's not free, but if you are doing open source development they give you it for free. Anyway, the cost isn't sky-high to purchase as well.
It's Cold Again
à¶‘à¶½ිය à¶±ුà¶¹ේ à¶±ැà¶ි à·€ුà¶±ා ද
à·ƒීà¶ à¶…à·„à·ƒෙ රජ à·€ුà¶±ා ද
à¶±ුà¶¹ ආයෙà¶් à·ƒැà¶Ÿ à·€ුà¶±ා ද
2/22/11
(C) Saliya Ekanayake
Subscript and Superscript with MS Word 2007 Equations
If you want to type e1 with 1 as subscript just type e_1. The moment you hit space it will become what you want. To make 1 superscript type e^1 and space. Enjoy!
Open Cubicles and Work
Honestly, I really really don't like this setting. I wonder who came up with this idea of having people sit nearby in the open and work. May be people are thinking that having open cubicles give more freedom to people because they are not physically constrained by walls or doors. But have they ever thought the effect on mind? Does physical boundaries affect the same way to mind? In fact, I think it's totally the other way around. You cannot think effectively when you are in open with others. Essentially what happens is that you are physically free, but mentally constrained.
The truth with everyone, no matter how much they don't like to show it, is that they have unique ways of working optimally. This may include things like clapping and rubbing the hands when your code works and say "Oh! Sh*t" when it doesn't. Not to mention the luxury of thinking silently. How much of these can you do when you are in a professional setting surrounded by others? Also, how much actions of others can you tolerate. Here's one of my personal experience. A person who sat next to me used to sip his coffee so loud and end each sip with the sound "aah". I understand that it's how he likes to enjoy his coffee. That's perfectly fine, but for me that sipping was annoying and disturbing.
So in my view, if you want to work effectively specially when you have to think, open cubicles are nothing but jail to your mind. If you think I am crazy, think of theses (http://www.guardian.co.uk/books/2009/sep/19/books-written-in-prison). These guys were in prison physically, but they had all the "space" in mind to think. No I am not suggesting to go to prison to work :D.
Anyway, another good video on "Why work doesn't happen at work", by Jason Fried from one the TED talks can be found from here (http://www.ted.com/talks/jason_fried_why_work_doesn_t_happen_at_work.html).
Great Feedback: MapReduce In Simple Terms
WCF Hosting with IIS7
So I was clueless for a while, but luckily found this great article in WCF Tools team's blog, which mentioned that it may be because I installed Visual Studio prior to installing IIS. I did the simple command mentioned there and wow! it worked.
I will post a step-by-step guide in a later post on how to deploy your WCF Service in IIS7.
Hadoop: Writing Byte Output
public void reduce(Text text, Iterator<byteswritable> itr, OutputCollector<text,> output, Reporter reporter)
In the main method I used SequenceFileOutputFormat as the output format. But it turned out that this way I get output as a SequenceFile, which I cannot later read by a separate Java program to extract out the values. May be I am wrong here, but as far as my searching went on, I couldn't find a way to easily do this.
After being fed up with searching I thought of writing a custom FileOutputFormat just to suit my job. So I wrote this ByteOutputFormat class, which simply writes the value bytes as a binary file. So later I can read it using a normal (non Hadoop aware) Java program to extract the bytes.
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.hadoop.io.compress.DefaultCodec;
import org.apache.hadoop.mapred.FileOutputFormat;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.RecordWriter;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.util.Progressable;
import org.apache.hadoop.util.ReflectionUtils;
import java.io.DataOutputStream;
import java.io.IOException;
/**
* @author Saliya Ekanayake
*/
public class ByteOutputFormat<K, V> extends FileOutputFormat {
protected static class ByteRecordWriter<K, V> implements RecordWriter<K, V> {
private DataOutputStream out;
public ByteRecordWriter(DataOutputStream out) {
this.out = out;
}
public void write(K key, V value) throws IOException {
boolean nullValue = value == null || value instanceof NullWritable;
if (!nullValue) {
BytesWritable bw = (BytesWritable) value;
out.write(bw.get(), 0, bw.getSize());
}
}
public synchronized void close(Reporter reporter) throws IOException {
out.close();
}
}
@Override
public RecordWriter<K, V> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress)
throws IOException {
if (!getCompressOutput(job)) {
Path file = FileOutputFormat.getTaskOutputPath(job, name);
FileSystem fs = file.getFileSystem(job);
FSDataOutputStream fileOut = fs.create(file, progress);
return new ByteRecordWriter<K, V>(fileOut);
} else {
Class codecClass = getOutputCompressorClass(job, DefaultCodec.class);
CompressionCodec codec = (CompressionCodec) ReflectionUtils.newInstance(codecClass, job);
Path file = FileOutputFormat.getTaskOutputPath(job, name + codec.getDefaultExtension());
FileSystem fs = file.getFileSystem(job);
FSDataOutputStream fileOut = fs.create(file, progress);
return new ByteRecordWriter<K, V>(new DataOutputStream(codec.createOutputStream(fileOut)));
}
}
}
Hope this would be helpful for you as well.
MapReduce: Explained Simply as The Story of Sam
Command Line: Relaxing Colors
Background Color: #3A4237 (in RGB this is 58,66,55)
Text Color: White
It will give you this feeling of a good old chalk board. Here's a screen capture of how it looks.
Sinhala Poems by My Wife
I am waiting to see the poem written for me :D
Synergy: Share Keyboard and Mouse
1. Install Synergy on both machines.
2. Setup one machine as the server.
3. Add the machines left, right, top, and bottom of the server (if any).
4. Start synergy as client on those other machines.
That's it and it's working. Only thing is that all machines should be in the same network.
One cool thing is that clipboards of all machines are shared. So copy from one machine and paste in the other is possible. Also it enables you to activate screen saver on all machines at once.
Split View in Firefox
Split View in Eclipse
http://addisu.taddese.com/blog/split-windowview-using-eclipse/
Here's a screenshot of how it looks.

FireFox Keyboard Shortcuts
http://support.mozilla.com/en-US/kb/Keyboard+shortcuts
Internet Speed: Isn't this nice?
Windows7: Desktop Icons: CTRL + Wheel
Windows7 and Ubuntu 9.10
Unlike in the previous experience with Windows, the Windows 7 performs really well. Regarding Ubuntu, it's better than 9.04 (I was happy with 9.04 as well). The only funny thing is that I had to find drivers and manually install my ATI Raedon X1300 VGA for Windows7. Earlier I used to do this for Ubuntu installations :)
For the moment, these two OSs seems to be a great combination if you are planning to get the best of both worlds.
Pidgin: Unable to Connect to Yahoo
Then I wanted to install a latest version of pidgin on my Ubuntu 9.04. I tried the "how to" given in the official pidgin site (http://www.pidgin.im/download/ubuntu/), but it was unsuccessful. Then I came across these debs (http://linux.softpedia.com/progDownload/Pidgin-Download-6.html) which solved the issue.
Just a quick how-to:
1. Download the i386 (or amd 64) debs
2. Download the two DEB ALL debs
3. Use dpkg -i to install the debs. Start with libpurple-bin_2.6.3-1~getdeb1_all.deb.
Then libpurple0_2.6.3-1~getdeb1_i386.deb (or amd 64 one).
Now move ahead with pidgin-data_2.6.3-1~getdeb1_all.deb.
Next pidgin_2.6.3-1~getdeb1_i386.deb (or amd 64 one)
That's it! no more troubles with Yahoo ;)
Design Defect: Dell E1505
Functional Vs Relational
It took me some time to adjust my brain to accept the difference. Finally, I told myself
"Going to the grocer and paying for what you got is functional programming, but going to the grocer and handing over 10$ asking to give whatever that fits is logic programming"
Just a thought :)
Identify Ports: Weird Holes in Your Laptop
Internet Explorer 8: Replacement for Chrome
Jython Web Service Framework
Record Scheme Sessions: Transcript
Running Matlab Remotely: ssh -X
After bit of a search I found the solution. You have to set the X11 forwarding in you ssh configuration file. Here's how to do it.
1. cd /etc/ssh
2. sudo vi ssh_config
3. uncomment the lines "ForwardAgent" and "ForwardX11". Set their values to "yes"
4. sudo vi sshd_config
5. uncomment "X11Forwarding" and set it value to "yes" as well.
that's it and you are good to go.
Type ssh -X username@domain
To test if everything works fine try running xclock once you log in. It should open up a graphical clock window.
Funny Infinite Loop with C#
public class Person
{
private String name;
public String Name
{
set
{
System.Console.WriteLine("assigning wow");
Name = value;
}
}
}
public class Hello
{
static void Main()
{
Person person = new Person();
person.Name = "wow";
}
}
Scheme Way: Eclipse Plug-in
Ubuntu 9.04: Way better than 8.10
Here's a list of things I felt really cool with 9.04.
1. No configuration necessary for the ATI drivers. Yea I had a really fun time configuring stuff with 8.04, 7.10, and 6.10 (Um, I can't remember what I did with 6.04).
2. External display detection is really awesome. It can even arrange the displays in any order I like (e.g. external one on top of default one).
3. Intel wireless card works like a charm.
4. Easy configurations for printers; hmm, I should really admire this.
5. Reliable (so far). Didn't crash, didn't reboot with errors, and most interestingly hibernate seems to work better than in previous versions.
6. Improved graphics.
In summary, I am beginning to like x.04 s as well :)
Scheme: Trace Functions
Say you have define a function named func. Now if you want to trace how it works when you invoke it, just type this.
> (trace func)
The next time you invoke func you will see the trace of function calls.
GSoC and UoM: Who let the "sharks" out
Wow! am I not happy to see this line in the Internet? I truly am. As a former student of University of Moratuwa, Sri Lanka, I am really happy to see the continuous achievement of its student in Google Summer of Code. To think of the fact that I too was a contributor to this success, makes me happy even more.
Keep up the good work "sharks"
Running Scheme on Ubuntu 8.04
Here's the solution in brief:
sudo sysctl -w vm.mmap_min_addr=0
Now run scheme
Last Day at WSO2
Ubuntu: Resizing Partitions
I booted my machine using an Ubuntu CD and ran gparted. I was very much pleased with its graphical view and was done with my problem in just minutes. Initially my paritions were like,
|------------home----------|--------------/ (root)---------------------------------------------|
After resizing it looked like,
|----------------home----------------------------------------|----------------/ (root)---------|
I was pretty happy with this little tool since it saved me from one hell of a trouble.
11 Year Old to Shake the Floor: Aiden Davis
Second Independence: A Day to Remember
It is of great pleasure to hear that SL forces have put an end to all this terror by killing the leader of LTTE, the coward Velupillai Prabhakaran. This is the second independence day that we should celebrate.
All the blessings and thanks should go to the brave soldiers and the leader, the President Mahinda Rajapakha for giving hope which eventually became the reality.
Label Cloud
Deploying WSO2 ESB in JBoss 5.0 GA
WSO2 in Wikimapia
IntelliJIDEA: A Feature I Like to See
The IDEA enables you to put debug points. These debug points may serve in creating a virtual path to traverse through the code. Thus, you are able to quickly jump to the next important point of code by just hitting F9. All this works really well for your debugging scenario. Now, what if you want to debug a different scenario, yet do not want to remove the older debug points? Then you have no option other than to add any new break points for the new scenario along with the older break points. This works okay, but makes the life bit hard since F9 will jump to points which are useless for the new scenario.
So what I suggest is to have a mechanism to define break points separately for each debugging scenario. So when you place a break point you can give it a scenario ID and inform the debugger to follow the break points for the relevant ID. It will be like layers that you find in Adobe Photoshop. You can on/off layers. Similarly we can deactivate a set of debug points based on their ID.
I wonder what JetBrains would think about this :)
Huawei E160 on Ubuntu 8.04
E160 has two modes of operation. It can act as a GSM modem and a data storage. So when you plug it in under Ubuntu it will attach it under one of these modes. If your network manager is older than version 0.97 then you it will normally get attached as a data storage device. You can see info on this by reading the kernel ring buffer with dmesg -c command (you will need root privileges, i.e. sudo dmesg -c). If it get attached as an storage device use usb_modeswitch to change its mode to a GSM modem.
If everything went well then the rest is pretty easy. You will need to install wvdial (i.e. sudo apt-get install wvdial). Then edit the /etc/wvdial.conf file to include the following settings. Note: these are valid only with Mobitel M3 service in Sri Lanka. You may have to change some settings depending on your service prvoider.
[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 3600000
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2
Init3 =
Area Code =
Phone = *99#
Username = ppp
Password = ppp
Ask Password = 0
Dial Command = ATDT
Stupid Mode = 1
Compuserve = 0
Force Address =
Idle Seconds = 0
DialMessage1 =
DialMessage2 =
ISDN = 0
Auto DNS = 1
Now execute sudo wvdial and that's it. You are ready to go online with E160 :D
Unlock Toyota Corolla 141
New Year Drink: Mango
3G Experience with Mobitel M3: Huawei E 160
WSO2 Carbon: Feature Packs
Java Regex: Check for non word characters
Version1: regular expression
"\\p{Alnum}*[~!@#$%^&*()\\+=\\-:;<>\\s?\\[\\]{},/\\\\\"]+\\p{Alnum}*"
Version2: regular expression
"\\p{Alnum}*\\W+\\p{Alnum}*"
Here's a nice guide (http://java.sun.com/docs/books/tutorial/essential/regex/index.html) to start with Java regular expressions
Batch Resize Images
Step1: install ImageMagick
$ sudo apt-get install imagemagick
Step2: go to the images folder and type
$ mogrify -sample 1280 x 800 *.JPG
Here 1280 x 800 is the final size you want and *.JPG is the file set.
To get more info on command options, visit http://linuxuser32.wordpress.com/2007/06/16/batch-image-convert-scale-thumbnail-jpegs-pdf/
Playing with BlueProximity
1. Install blueproximity:
$ sudo apt-get install blueproximity
2. Pair up your computer with your phone using Bluetooth. You can use System -> Preferences -> Bluetooth to do so.
3. start blueproximity:
$ blueproximity &
You will see the blueproximity icon appearing on your system panel.
4. Configure blueproximity to suit your likings, i.e. the distance after which your screen will get locked, time duration, etc.
That's it.
Anyway it is not kicking unless I can write my own code :D
Lectures at UoM
Build Your Own SOA Middleware
Access Vista from Ubuntu
For this example say your Vista user account is vista-pc and password is vista-pw. Also say the IP is 192.168.1.2
----Do the following in your Vista machine----
1. Start/Run secpol.msc
2. Open Local Policies/Security Options, find "Network Security: LAN Manager"
3. Change it to "Send LM & NTLM"
4. share the folder that you want (say movies)
---Do the following in your Ubuntu machine---
1. sudo apt-get install smbfs
2. sudo apt-get install smbclient
3. sudo mkdir /mnt/hd
4. sudo mount -t smbfs -o username=vista-pc,password=vista-pw //192.168.1.2/movies /mnt/hd
That's it :) You can now access the shared Vista folder from /mnt/hd
NBQSA Merit Award for Rampart2
Hard Times
I broke my spectacles and got a new pair from George Gooneratne Optometrists. Guess what? They have taken wrong measurements and I had to visit them again to replace the glasses with correct measurements. After spending about two hours at their lab I finally got my sparkling shiny spectacles.
The day after I was playing basket ball at WSO2 when I got hit by the ball right on my face at a most unexpected time. I was actually catching my breath and I look up only to see something crashing on to me. The shiny new spectacles were broken into pieces and my nose got wounded. The wounds were not that serious and I was lucky not to bleed internally. I found the broken frame of my spectacles and thought, hey that's not too bad because I still have the frame to which I can get a pair of glasses fixed. I put all the pieces into my bag and came home. The next day I was getting ready to go and get new glasses fixed. I collected broken frame and believe me, one side arm was missing. What the hell? I told myself. I searched every possible place I could look into but came up with nothing. Hmm, that's life, I thought and went to optometrist and get a new spectacle fixed.
The next day I was happy with my new spectacles and spent the day peacefully at WSO2. The entire day I was in a meeting and later in the evening I and the others were invited to dinner at an Indian restaurant. The food was okay, but it didn't sound right for me. The next morning I woke up to find that I am suffering from a very bad stomach ache. I spent the entire day at home unable to do anything. The medication came to effect only in the evening. Today is the second day of the very unpleasant "Digesting Error", and there is yet another day to go to end the week. I am expecting what next :)
Google Chrome - Fast and Elegant
Java Strings: literal.equals(param) OR param.equals(literal)
1. helloStr.equals("hello")
2. "hello".equals(helloStr)
Both will do fine, but which is the better one? I've been using the second form but never thought of the difference (hmm, that's bad ;) anyway people do remember certain things bit later). In one of the code reviews at WSO2 it was revealed. The first form can lead to a Null pointer exception in the case when the helloStr is null. The second option will save you from this since the literal "hello" is not null always and you are invoking a method of a not null object. In this case even if the helloStr is actually null it doesn't matter because it'll only cause the program to check "hello" against null which results false.
If you are checking two String references then you have no option, but always try to invoke the equals() from the most probably not null reference.
Little things do matter :)
Setup Browser in Pidgin
Fixing this issue, however, was pretty much easy ;) Open Pidgin, go to Tools --> Preferences --> Network. Then you can find a button saying Configure Browser. You'll get a tool window where you can set the command you want to execute in order to open up the browser. In my case FF2 can be started by issuing firefox-2 %s
Just that. It works fine :)
Apache TCP Monitor - How To?
The following blog posts too give an insight into this tool.
http://charithaka.blogspot.com/2008/08/how-to-use-tcpmon-inside-eclipse.html
http://www.keith-chapman.org/2008/07/using-tcp-monitor-to-debug-web-service.html
Internet in Two Machines
Anyway if you want to know about how to setup IP forwarding see the following links.
http://www.ducea.com/2006/08/01/how-to-enable-ip-forwarding-in-linux/
http://www.linuxforums.org/forum/linux-networking/64083-simple-ip-forwarding.html
Default Browser Settings in Thunderbird
The solution was to tell Thunderbird the path of the browser to open. You need to create user.js file inside your ~/.mozilla-thunderbird/xxx.default/ (the xxx means any weird set of letters and numbers, e.g. 20art4c7). Type (or edit the path as to suit your browser) the following lines into that file and save it.
user_pref("network.protocol-handler.app.ftp","/usr/bin/firefox-2");
user_pref("network.protocol-handler.app.http","/usr/bin/firefox-2");
user_pref("network.protocol-handler.app.https","/usr/bin/firefox-2");
That's it :)
XPath with Axiom
The tricky part is, how to work with Namespaces? To get an idea on to the matter consider the following XML document.

The following code fragment will retrieve the ns1:c1 element and the two ns2:color attributes of each element.
// root is the document
OMElement root = builder.getDocumentElement();
AXIOMXPath xpath = new AXIOMXPath("//a:c1");
xpath.addNamespace("a", "http://namespace1.com");
OMElement c1 = (OMElement)xpath.selectSingleNode(root);
System.out.println(c1);
xpath = new AXIOMXPath("//@b:color");
xpath.addNamespace("b", "http://namespace2.com");
List
System.out.println(colors.get(0).getAttributeValue());
System.out.println(colors.get(1).getAttributeValue());
The important line in this code is the xpath.addNamespace(prefix, uri) method. This prefix doesn't have to be the exact prefix used in the actual document (which in fact is not known in most cases).
That's it, have fun with Axiom :)
ATI X1300 with Ubuntu 8.04 (Hardy)
So I tried with the Unofficial ATI Wiki and it worked just as expected. Try method 2 mentioned here.
The great news is hibernation works with it :)
Convert ByteArrayInputStream to String
ByteArrayInputStream bais = // get your ByteArrayInputStream instance
int length = bais.available();
byte [] buff = new byte[length];
bais.read(buff);
That's it!!
@ WSO2, Inc.
I joined WSO2 Inc. on 12th May and it has been few busy days until today :). I am waiting for some build to complete and thought to jump in and blog on this.
I feel life has changed a bit compared with the life at the university, yet it is the same old me sitting in front of the computer :)
Repair Sony VAIO VGN FE855E Keyboard
I searched for keyboard replacements and found that they are expensive (Sony service require 169$ to replace a keyboard). There are refurbished keyboards available in e-bay for prices around 70$, but I couldn't get one since I live in Sri Lanka. The price and tax is too much if I deliver something from US. So I gave a go by myself. Bottom line is I fixed all the keys for a price just around 1$ (one dollar :)
I thought of giving the steps I followed in case if some one else is in trouble like me.
Step 1: Identify the not working keys.
You can simply use a text pad to type the keys and identify the ones that doesn't work. To test function keys you can do many things. The easiest thing I did was to run a program in command line and then to press function keys in the same shell (note you should not run the particular program you chose as a background process). There each time you press a function key some kind of symbols appear. So you can see if it works or not. See this is a very primitive way but it works.
Step 2: Removing the plastic plate of the key
In notebook keyboards the plastic key plate is clipped to an underlying plastic support mechanism. See the following picture (the bad key in this case is F11)
Use a small flat screw driver to lift the plastic plate from top left corner and bottom left corner. Note: If you are trying to remove normal keys (like A, B, etc.) then you need to lift from bottom left and bottom right corners of the key plate. Once removed you can see it as follows.
Step 3: Removing the plastic hinges
You can use the same screw driver to remove the white plastic hinges. See IraqiGeek's blog to see more information. One advice is that don't force too much on these small plastic items as they tend to break easily. Once removed you will see something similar to the pictures given below.
Step 4: Peeling off the rubber button
The next step is removing the rubber button. It is little bit hard and needs lots of patience. The rubber button is fixed to the same plastic sheet which contains the touch points. So it is virtually irreplaceable :). The option I selected was to cut off the rubber button. You need a sharp blade to do this. I used a razor blade. Once again, be careful when you cut because a single mistake could damage the underlying carbon contact lines, leaving no option other than to replace the entire keyboard. Once you cut it off you can see it as follows (the second image shows another bad key, i.e. Esc key).
Step 5: Finding a replacement rubber button
If you can get away with this step then you are basically done with repairing. If you see the two images above you can clearly see the carbon touch plats (see the thin white "s" shape in the place where the rubber button is taken off. That is the margin separating the two carbon plates). The keyboard simply works if you can somehow find a button which will contact these two plates when pressed. There are numerous solutions you can find in day to day stuff which can be used as a replacement. The one I found was a simple push button. You can easily find a similar type of thing any electronic parts seller. See the images given below.
The first image shows the small switch I found and the next one shows the rubber button of it removed. You can remove it simply by pulling off gently from the sides of the rubber button (Note: be careful not to tear it off). The third one shows the underside of the rubber button and you can clearly see the carbon dot in it. This is the one which get pressed on to the carbon plates of the keyboard. The side view of this button is given below (in fact this is the same side view of the original notebook's rubber button as well).
The replacement button I found had this problem that the distance of pressing is smaller than that is of the original button. So when you fix the key plate it acts much like a touch button. I didn't like that feeling. So I simply shorten the rubber cylinder by removing a part of it and gluing the two parts. This is though seems simple requires a lot of patience. So drink lot of water before you do this :D and take a deep breath. Ah! one thing I forgot to tell was that not all type of glues can be used to bond rubber. So better to find a super glue which can bond rubber. In my case I found a cheap Indian made super glue (I think the name was Evlico or something like that).
Once you adjust the pressing distance and the button is ready to go you need to one more thing. The rubber button used here acts as a vacuum when pressed and sticks to the key board's plastic sheet. So I made two tiny holes symmetrically. That way it becomes very easy to press and feels much like the original button. See the images given below. I think you can see the tiny holes.
Step 6: Replacing the key plate
First replace the plastic hinges. I think you can do it by yourself. The advice here is don't push too much if the thing isn't attaching. You may probably trying to fit it wrongly. Then place the key plate on top of the rubber button and gently push from four corners (you can hear the "tick" sound as you press which indicates the correct fitting of the plate).
This completes the repair and following is a list of additional rubber button replacements you can use.
1. The calculator touch pads have a nice a rubber membrane with touch switches similar to the one I used.
2. TV / VCR remote controllers too have nice rubber buttons inside.
3. There are various types of rubber push buttons available in the market. So better to find a similar one that suits your machine.
If you have any doubt on the matter just drop a reply to this post.
How to Access Linux (Ext2) Partitions from Windows OS
My Woodwork
Google Pages
This is some nice fact I've noticed but it may not mean anything. Have you seen a diagram of the brain from side view? I guess you probably have. Now try to keep your fingers in the right hand as if you are going for a fight (fisted). Then see your fist from side view. You will see a similar shape to that of brain. Isn't that interesting?
ATI x1300 with Ubuntu Gusty (7.10)
So here goes the answer
Good luck and have fun :)





