Saliya's Blogs

Mostly technical stuff with some interesting moments of life

Access Vista from Ubuntu

2 comments
Ever tried accessing a shared folder in Vista from Ubuntu? Here are the simple step I followed.

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

2 comments :

Post a Comment

Increase Java Heap Memory for Maven

3 comments
If you ever encounter an error saying Java heap is not enough, while building a project using Maven, the following content will help to get out of it. Thanks Charitha for finding this.

Set the MAVEN_OPTS system property,

e.g. MAVEN_OPTS=-Xmx1024m  will give you 1024 Mb heap

3 comments :

Post a Comment

NBQSA Merit Award for Rampart2

1 comment
Sameera, Kalani, Isuru and I developed a Web services security module for the well known Apache Axi2 middleware. The existing security module, Rampart, has issues concerning performance. Therefore, our solution mainly focused on high performance. We used the code name Rampart2 to refer our project, though it is not part of Apache yet. The performance comparison of Rampart and Rampart2 can be found here.

BCSLanka organizes a competition named National Best Quality Software each year. Rampart2 got selected and was given a merit award in this year's competition. 

We are happy with our achievement and are waiting for more good news on Rampart2.

1 comment :

Post a Comment

Hard Times

2 comments

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 :)

2 comments :

Post a Comment

Google Chrome - Fast and Elegant

2 comments
I had couple of issues with IE and FF3 in Windows and I decided to give it a try with the Buzz: Google Chrome. Amazingly, it's pretty fast than I expected. The next thing I like about chrome is it's simplicity, no stupid buttons hanging all over your browser :). 

I like the concept of having processes for each tab. I am wondering that browser technology is going to be much like the OSs. I mean the comic book is filled with many OS concepts I have learnt :). 

Kudos to Chrome !!

2 comments :

Post a Comment

Java Strings: literal.equals(param) OR param.equals(literal)

6 comments
Comparing strings is bit tricky :) Say for an example you want to test a String reference against the literal "hello". In simple terms you have a String (say helloStr) and you want to see if the content of that is equals to "hello". You have two choices here,

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 :)

6 comments :

Post a Comment

Setup Browser in Pidgin

4 comments
After installing FF2 because I was fed up with FF3 I had to setup the default browser in Thunderbird (see my previous post). I was happy after that but today I found that I cannot open any links from Pidgin messenger as well. Argh! I was unhappy again :-/

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 :)

4 comments :

Post a Comment

Apache TCP Monitor - How To?

4 comments
If you are searching for a tool to monitor messages that are exchanged between a client and a server, then Apache TCPMon is one of the best easy-to-use utilities available at zero cost. You can download three different flavors of this utility, i.e. standalone, IntelliJIDEA plug-in, and Eclipse plug-in. To get an in depth knowledge on how to use this nice tool see my blog post at wso2.org.

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

4 comments :

Post a Comment

Internet in Two Machines

1 comment
I wanted to get the Internet connection to my notebook. The Internet facility is given by a CDMA service. So it's one machine only thing. That's bad because I need it to be given to two machines. Luckily I found this nice way of doing it from Dr. Sanjiva's blog. I'll try to find a pocket router similar to the one he has used and give it a go soon.

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

1 comment :

Post a Comment

Default Browser Settings in Thunderbird

No comments
I wanted to remove FF3 (Firefox 3) and install FF2 in Ubuntu because some of the web applications didn't work well in FF3. After doing a apt-get remove for FF3 and an apt-get install for FF2 I noticed that in Thunderbird when clicked on a link in a mail, will not open up a browser tab. So the hunt began :)

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 :)

No comments :

Post a Comment

XPath with Axiom

6 comments
Apache Axiom, which is the popular open source StAX based XML infoset model, supports XPath out of the box. If you ever want to know how to use this feature, WSO2 Oxygentank has a very nice tutorial.

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 colors = xpath.selectNodes(root);
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 :)

6 comments :

Post a Comment

ATI X1300 with Ubuntu 8.04 (Hardy)

No comments
In one of my previous posts I mentioned how to setup ATI X1300 graphics card in Ubuntu Gusty. Recently I installed Ubuntu Hardy because Gusty came up with couple of bugs. Unfortunately I had to set up my graphics card again :(

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 :)

No comments :

Post a Comment

Convert ByteArrayInputStream to String

1 comment
Recently one of my friends wanted to get the string contained in a ByteArrayInputStream in Java. The method do this was bit tricky and I thought it'd be nice to share it.

ByteArrayInputStream bais = // get your ByteArrayInputStream instance

int length = bais.available();
byte [] buff = new byte[length];
bais.read(buff);

That's it!!

1 comment :

Post a Comment

@ WSO2, Inc.

1 comment
The university life ended last Wednesday (7th May) and it was time to move into my first job in life :)

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 :)

1 comment :

Post a Comment

Repair Sony VAIO VGN FE855E Keyboard

15 comments
My girlfriend's notebook was "attacked" by ants recently. This is the famous attack of eating the rubber membrane of the keyboard. They have eaten the contact material of the rubber button and several keys were not working after that. The following picture gives you the model number of the notebook.




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.






15 comments :

Post a Comment

How to Access Linux (Ext2) Partitions from Windows OS

No comments
I've been using Explore2fs for sometime to access my Linux partition from Windows OS. But it was very boring to copy files from Ext2 partition all the time when I wanted to access them. So I decided to search for a better option. So here it is, Ext2 installable file system. It's very cool. You can even write to Ext2 partition. Here is the good article where I found these stuff.

No comments :

Post a Comment

No comments
60th Independence Day

Today is the 60th independence day of Sri Lanka.

No comments :

Post a Comment

My Woodwork

No comments
I wanted to add an extension to my desk so that I can keep my laptop on that. The laptop when put on the desk forms a very bad position. It's basically not ergonomic. So I decided to do bit of carpentry and the result was amazing. I really like it. The finished work is shown in the picture.

No comments :

Post a Comment

Google Pages

No comments
Google always come up with cool ideas. This is not boasting but they really do. I recently came across this idea of Google pages. I was searching for a place to share some of my files with others. It's then I found this and it was more than a place to share files. I gave it a try and here is my hOme up and running :)

No comments :

Post a Comment