Monthly Archives: July 2010

Automatically Add Name Attribute for Google Syntax Highlighter

July 12, 2010 by Rakhitha | 7 Comments | Filed in JavaScript, Tech

If you write programming related posts in your blog, you are most probably using Google Syntax Highlighter to highlight your code snippets. In case if you don’t, it’s a set of javascripts that allows you to add syntax highlighting for source code that you post on your blog. It supports a large number of programming languages. After installing “Google Syntax Highlighter for WordPress” plugin (If you are using WordPress of course), all you got to do is to enclose your code inside “pre” tags, add a name attribute with value ‘code’ and then set the language of programming code in class attribute.


<pre name="code" class="java"> .... </pre>

But there is a slight problem. When you use it with WordPress WYSIWYG post editor all the name attributes get removed. Therefore every time you change the post using WYSIWYG editor you have to go back to HTML view and add name attributes again. Which is really a pain if your post is a large one with lots of text and code snippets.


Tags: , , , , , , , , ,

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

July 11, 2010 by Rakhitha | 5 Comments | Filed in Java Stuff, Tech

This is a follow-up to my earlier post “Java Zip API: How to Read a Zip File Using Java“. This time it’s about how to create a zip file using Java. This is even simpler than reading a zip file.

Following is a very simple example which create a zip file named Inside that zip file we will create a directory named MyDirectory and inside that, we will have a file named MyFile.txt. That text file will contain the text “Java Zip API: How to Create a Zip File Using Java”. In the example we will be using following classes from Java API.

Tags: , , , , ,

YouTube: Wavin’ Flag – Bradby Mix – At Royal Parade 2010, Street Party

July 7, 2010 by Rakhitha | No Comments | Filed in Royal College, Sri Lanka

Royal College Orchestra put up a brilliant show at Royal Parade Street Party 2010. This was my favorite part of Street Party. Just felt like sharing!

Viraga Perera & Sanchita Wickremesooriya backed by the Royal College Orchestra performs their version of the Wavin’ Flag (originally by K’Naan) to celebrate Royal College 175th Anniversary at the Street Party following the Royal Parade on July 3rd 2010.


Tags: , , ,

ASP.Net: Reduce Page Size, and Make Pages Load Faster by Storing View State on Server

July 6, 2010 by Rakhitha | 3 Comments | Filed in .Net Stuff, Tech

View state is a mechanism which allow storing data related to the view of the web applications. That includes all data in your controls which is not yet saved to database. But the problem is this can get quite large and take  big bite out of your bandwidth and performance.

When to Use View State & How it Work

Imagine that you have a control that allows you to edit a specific object (Lets say a very complex user information form like  a table). Every time you change/click something on your control, something about that object is changed. But only if you click save it should update things in your database. Where do you keep your data object in between changes until the last submit is received from save button?

You may use session variables, but then the data object is not local to your control/page. It’s there in the session. If user close the browser or navigate to another page at some point it is still in the session. With complex objects that takes up memory this can be problematic. Specially if you want your application to be scalable, you don’t want to put unnecessary things in to session. And you don’t want to keep things longer than you need in memory. How would you deal with this? Very often you will find yourself keeping track of things using hidden fields in HTML forms.


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

Royal Parade 2010 & Street Party – Photos & Afterthoughts

July 5, 2010 by Rakhitha | 1 Comment | Filed in Me, Myself & I, Photography, Royal College, Sri Lanka

Royal Parade 2010 and Street Party was held on 3rd July 2010 as a part of 175th anniversary celebrations of Royal College. It was a grand event by any definition. Probably the festive atmosphere was even bigger than IIFA. And I am glad that I did not miss it.

It was very interesting to see other schools participating in the walk. If I remember right there was Kingswood and Trinity from Kandy too. It was nice of them to come all the way from there. There was College band, junior band, eastern band, and number of bands from nearby schools, and a quit a number of papara bands. I was bit surprised to see Mahanama College after seeing what some of their guys are doing on facebook. But it’s great that they came. I guess in every school there is a small bunch of guys who gives a wrong impression.

There were people from all the walks of life. Young Royalists with their parents, Royalists, Old Royalists, Really Old Royalists, teachers, past teachers, elephants, old fashion double decker buses, fancy cars, clowns, Ninja Turtles, Asterix, Obelix, and what the name of his crush?, she was there too. And I think I saw about 50 out of 300 Spartans minus King Leonidas. May be that’s what was left after the war with Persians :). There were lots more fun stuff but this is all I can remember. Best part was meeting up with old pals after years and having a chat with them. I met many friends and classmates that I haven’t seen since I left school in 2002.

Parade was great and the Party was even better. Great DJ, food and the live band. Even the  FIFA fans were able to catch the action on big screen. For me, the best part at the party was live performance of Royal SaGa guys. Their talent was amassing and they pulled off a brilliant show.


Tags: , , , , ,

FM Royal 2010 – 175th Anniversary Celebrations Broadcast is Now “On Air”

July 2, 2010 by Rakhitha | No Comments | Filed in Royal College, Sri Lanka

Royal College, Radio Club is broadcasting “FM Royal” radio channel parallel to Royal Parade 2010 and “Party On The Street” as a part of Royal College 175th Anniversary Celebrations.

It will be on air from 1st of July through 3rd July 2010 on 96.1 MHz FM. Apart from Colombo broadcast there are two relay broadcasts from Kandy and Galle. You can also listen in its webcast and podcast from FM Royal website.


FM Royal Website

FM Royal 2010 Webcast

FM Royal 2010 Podcast

Royal College

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


July 1, 2010 by Rakhitha | No Comments | Filed in Education, Royal College, Sri Lanka

Royal College which started in year 1835 is celebrating its 175th anniversary in year 2010. Need not to say that this is a massive milestone and time to celebrate service rendered by Royal College to its past and present students, and to this country.

Royal Parade 2010 and “Party on the Street” will be happening on 3rd July 2010 as a part of 175th Anniversary Celebrations. This is a once in a life time event all the Royalists and Old Royalists can take part with their friends and families. If you a Royalist or an Old Royalist this is not an event to miss.

Parade is expected to start at 3:oo pm from Royal College Junior Gate.  Hopefully you have already received information about the event. If not, following are few information extracted from the e-mail sent out by organizers.


Tags: , , , , , , , ,