Monthly Archives: June 2010

Three of My Posts are on Sunday Leader Web!

June 25, 2010 by Rakhitha | 1 Comment | Filed in Me, Myself & I

After moving my blog to its new home I spent some time to figure out a way to improve search engine ranking of the new URL over the old URL. In the process I did some searches for term ‘rakasunivers’ on Google, hoping to find out places that are referring to my blog. And I found a pleasant surprise.

Three of my posts are re-posted on Sunday Leader website. Of course they did not get my permission or tell me about it. But they at least put my name as the author. For me that is good enough. I think it’s nothing big because they post lots of posts from other blogs too. But there is nothing wrong with taking a little pride of having a post there with my name on it.


Tags: , ,

Moving from to Own Hosting – Getting It Up and Running

June 25, 2010 by Rakhitha | 5 Comments | Filed in Me, Myself & I, Tech

I just moved this blog to domain from a free blog at When I moved the domain I also moved to own hosting. Reasons for this is not 100% clear even for me. I was a bit frustrated about not being able to install my own plug-ins, not being able to write java script code, and lots of other things that I find fun and interesting as a hobby programmer. I know I can do pretty much all that on blogger. That’s why I said it’s not 100% clear.

Setting up WordPress on own hosting is not that easy. That’s what I read in most other blogs. It may be so for a non technical person if you are setting it up full manual. But based on WordPress installation guide it’s not that complicated. Even with the manual steps you just need to upload WordPress files, set up a database and configure WordPress using wp-config.php file. But if you use Fantastico you just need to do few clicks and it’s done.

In this post I am trying to share my experience of moving to self hosting probably with some pointers for any one who is planing to do the same.


Tags: , , , , , , , , ,

Worshiping Sun God at Galle Face Green

June 21, 2010 by Rakhitha | 1 Comment | Filed in Environment, Me, Myself & I, Photography, Sri Lanka, Travel

I captured this image with my mobile phone sometimes back (18-April-2010) when I was at Galle Face Green. I was just trying to capture the evening sky. I could not do a good job on it as the lighting was little low for my phone to handle and I was pointing the cam directly at Sun.

I realized what it looked like only after I viewed the image on my computer after coming home.  By than it was obviously too late to go back and take few more (better) shots 🙁

I wish I had a better camera with  me than just a mobile phone at that time!


Tags: , , , , , ,

New Domain, New Host, New WordPress…!

June 20, 2010 by Rakhitha | 3 Comments | Filed in Me, Myself & I

Well, couple of days ago I felt like moving my blog off the free hosting. I did not have a real need of it, but I just felt bit restricted by all the restrictions there. Not that I could not live with those restrictions, but my mind just hit some kind of a critical point at which it made me go and by a domain + hosting.

I found this place called They had a pretty attractive hosting package which included 10Gb of Storage, 100Gb/month of transfer, and pretty much everything else I needed\ for just LKR 1500/= (Aprox 15 USD) per year. So I went for it. Also As soon as I set things up here I noticed that new WordPress 3.0 is out. I am not the kind of guy who installs shining new software. I normally wait until it prove itself to be stable. But for some strange reason I installed it right away even without doing a very basic reading about it. So far nothing is broken. I am hoping for the best. Otherwise I will have to find a way to revert everything back.


Tags: , , , ,

Through The Wormhole with Morgan Freeman on Discovery Science Channel

June 16, 2010 by Rakhitha | 1 Comment | Filed in TV

Are the wonders of our universe are cosmic accident or the results of intelligent design?
For centuries religion and science were bitter foes. Now science actively searches for our creator. Some physicists think he is hidden in the math. Neurologists think she might be in our brains. Computer coders believe God is one of them, and our world is nothing more than his simulation…!.

That’s how Morgan Freeman start the latest science documentary “Through The Wormhole” on Discovery Science Channel. It explores deep question such as “What are we made of? What was there before the beginning? Are we really alone? Is there a creator?”. Based on episode one it looks very promising.

First episode talks about the question of “Is there a Creator?”. Unlike most other science documentaries this one do not try to educate us on a specific leading hypothesis at the time. Instead it tries to present you all the different sides of it from all different sources such as science, religion,  biology, computing…. However in one of the interviews given Morgan Freeman has mentioned that some religious believers who interpret Bible literally might not like this.

I just watched the first episode. It was quite good. I did not exactly experience “quite the ride” that Morgan Freeman promised at the beginning, but it was good and different. Any way who am I to judge a series by its first episode :).

If you are in to science, stars, galaxies, universe, wormholes, and meaning of life stuff you might like this series. Check it out.


Tags: , , , , , , , , , , , , , , , , , ,

Fun with Java Reflections: Access Private Member Fields/Methods of other Classes

June 12, 2010 by Rakhitha | No Comments | Filed in Java Stuff

This is a follow-up to my earlier post on Java Reflections.  In the earlier post I just showed how to invoke methods of an object dynamically using reflection. Here I am going to talk about accessing attributes of another object using reflection, with a little twist.

Just like my earlier post I’ll start this with an exercise.

Write a class with a private member variable only. No get/set methods. But add a toString() method to output the content of that private variable.

Like Following….

Now write another class. It should create an instance of above class, and set your name as the value of ‘name’ attribute in that object.


Tags: , , , , , , , , , , , ,

Java Core API: Introduction to Java Reflections

June 12, 2010 by Rakhitha | 6 Comments | Filed in Java Stuff

Here is an exercise for you!

Write a java program that take two or more command line arguments. 1st argument is a class name. 2nd argument is a method name. Rest of the arguments are string values to be passed in to that method.

Your program has to load the class specified in first argument (this class may not be available at compile time). Create an instance of that class. Then invoke the method given in the 2nd argument on that object passing the values given in rest of the arguments as parameters to that function. To simplify things lets say all parameters are string.

The answer is reflections. To give you a very simplified description, Reflections allow you to access members of a class/object dynamically in run time without having to hard-code things in the source code. This is slower than hard-coding. But it is very useful when the class/methods/fields that you need to access are not known or not available at compile time. Also in some cases you can do cool things like accessing private members.


Tags: , , , , , , , ,

Java Zip API: How to Read a Zip File Using Java

June 11, 2010 by Rakhitha | 3 Comments | Filed in Java Stuff

Java API give a very simple set of classes to deal with zip files in its package. I am just going to show how to access the content of a zip file using these classes. Basically in java point of view a zip file is a collection of zip entries. you just select the zip entry that you like to read and extract its content using an InputStream. However this API do not support handling of password protected zip files.


Tags: , , , ,

Me, My Self and Java

June 11, 2010 by Rakhitha | No Comments | Filed in Java Stuff, Me, Myself & I, Tech

Programming is my main hobby. I wrote my first computer program when I was 11 years old. Then I was using GW BBASIC. Since then I have learned QBASIC, Pascal, Visual Basic, Perl, Java, PLSQL, C++,  PHP, C#, bit of Python and many other things over time. I screwed up  my A/L for it but fortunately managed to get in to a career in Software Development. When I was a school kid I built some web sites using ASP and Perl but they were never published. And I spent a great deal of time learning regular expressions. Graphics Design was not my thing. So I ended up as an applications programmer.


Tags: , , , , , , , , , , , , , , , , , , ,