Friday, December 11, 2009

War Heroes - Then and Now

This was drawn by the artist on 9th October 2009. Much before any SF-Presidential election story. Should appreciate his futuristic view.

However I’m pretty sure that couple of more notices (even after the one in front) are still missing. But don’t worry, we will soon see them….in TV, Radio and Roads.

The Sri Lankan people surely know how to do 'Kelaguna Salakeema'. It's in our blood man!

Just think about the sheer effort, resources and money put in to the huge campaign of the government. The propaganda units of the Nazis would learn a few things from this. Who pays for all these?

I was no fan of war anyways but the way treat someone who had saved the government asses so far which hasn't done anything positive beside the war (i.e in the minds of majority Sinhalese at least) is shameful. If they treat someone like SF this way, what do you expect they'll do with someone like Lasantha.

I thought Sri Lanka was only going in circles. Now I think we are just a turning our selves to a well functioning time machine, only thing is this goes back in time in record speeds.

Monday, November 30, 2009

SVN Patch

I recently come across the 'Patch' feature of SVN and found it to be a very useful tool in several development scenarios. SVN patch feature is basically exporting the changes you have made to your source code in to a zip/patch file. It will contain all SVN meta data in addition to the files and you can apply the patch from a different place/machine to the same source code base. Some of the situations I feel a patch is useful are;

1. As a mean of code review / Collaborative Development

Code reviews don't necessarily have to happen as a meeting. The reviewee can pack his changes as a svn patch and email it to the reviewer who can check it in the context of the current code base and do necessary adjustments and commit it. This is more suited when the reviewer is someone from the same team and most probably a senior person in the team.

I've heard that lot of open source projects use this feature to make sure that the commits coming from all around the world are in line with the quality of the code base.

2. When working on top of another developers code base

Many consultants and senior team members have to work on other developer code bases (and machines) sometimes. This is specially true for consultants. Sometime a fix or a change has to be done on top of a an already uncommited changes in the code base. Then the best thing to do is to create a patch from the changes you just did and then revert the changes in the code base. Then you can just apply the patch only. That way you are not altering the external developer code base but still can get u'r local changes in to SVN.

The same scenario is useful when u need to get in a quick fix on top of a not so solid code base which is under serious change.

Saturday, November 28, 2009

Are you getting enough sleep

I recently got an email from a friend about a leading Indian CEO 'Ranjan Das' being killed by a stroke. He was a very active, fit man who took active part in sports (He's a marathon runner). He had good eating habits as well.
According to the article the primary reason for the stroke was lack of sleep. Most of us in the competitive world (Specially so in Software field) go through a lot of nights without sleep. The most dis-heartning thing is that most of us tend to be proud about ones ability to go on without sleep. 'I worked for 20 continuous hours man...WOW'. That's just not right!

Try this test to figure out whether you get enough sleep. It's called 'Epworth Sleepiness Scale'.


Sunday, October 25, 2009

You Tube Pickups

The best way to overcome the laziness to blog is to pick interesting stuff you come across in Internet directly to your blog. Call it stealing, cheap writing or whatever...that's what I'm gonna do right now!

1. An inspirational talk by Maldivian president at the U.N. This is a good lesson to Sri Lankan
'මහ ජනතාව' (General Public) who are used to highly emotional yet out of context roller-coaster 'Ego Rides' caused by our leaders talking to international audiences. This guy looks in to the future while we keep going backwards in search of our 2500 year old holy-land.


2. Although not directly relevant to SriLanka, the discussions on Universal Health Care in US is a good source of learning. At SriLanka we should be in good hands since our Health Care is basically a Universal Health Care system, but lack of application and discipline has made it a mess. All capable people are relying on private hospitals for their well being while lots of innocent go ill-treated by public health system day by day.

Saturday, September 19, 2009

Irena Sendler - War Hero

Have you heard of 'Irena Sendler'. I'm pretty sure most of us haven't. She's no superstar, great politician, a sportsperson or a media personality, besides she's not even among us now. She's dead for more than an year now. Why her story caught my attention was because she's known as a 'War Hero'. 'War Hero' - a term we heard so frequently and still continue to hear. She's a war-hero for the same reasons that could cast her as a 'traitor' in different times and circumstances...only time will tell.

Irena was a Polish aid-worker, activist during World War II in German occupied Warsaw, Porland. She had lead the smuggling of small children from the 'Ghetto' - Huge Jewish Villages (In reality those were high wall camps keeping Jews before they were taken for concentration camps for group execution). She got the chance to visit the Ghetto as a health worker and risked her life escaping children out. She together with her colleagues forged documents and planned escapes one after the other. Usually smuggling children after sedating them and putting them inside coffins, bags or helping them to crawl through sewers to reach outside world. It is said that she had a dog who traveled with her and trained it to bark at Gestapo. The barking sounds of the dog sometimes helped her to keep sounds of children unheard.

She was ultimately caught and was severely tortured and was given death sentence. Her hands and legs were broken. She somehow manage to escape on her way to death sentence by bribing the soldiers as they left her in the middle of a jungle. But she survived and lived and operated in hiding till the war was over.

She kept a jar full of names/details of all the children she rescued, hoping that someday she could reunite them with their parents. But it was later found that no one was able to find their parents as they were either killed or lost.

She was nominated to the Nobel along side Al-Gore (How much have we heard of Al-Gore and yet how Irena evaded us? Amazing isn't it?). All of us know that Al-Gore won it for creating a slide shore on global warming :).

Since we as Sri Lankas have also come across a long and dirty war there should be Sri Lankan 'Irena' personalities. But the media doesn't seem to be interested yet. They will be interested in 10-20 years time...I hope. (It took almost 50 years for the world to really know the heroics of Irena). But every time you come across a War-Hero or Freedom-Fighter who is so called since he's good at killing enemies don't forget to remind your self that there should be 'Irena's as well. It would be a great reminder of humanity left in us, however scarce that may be these days.

Friday, September 11, 2009

Passing Parameters to Silverlight 3 Components

When you go one level up from the typical test projects, you come in to a situation where you need to tweak the Silverlight client app based on some sever side logic. For this to work silverlight supports the concept of InitParams. InitParms allows a hosting aspx page to pass parameters to a Silverlight client application. All over the web this process is well explained, except for one little glitch. i.e It's explained for Silverlight 2, not for the latest Silverlight 3. This gap is critical, since a lot has changed from SL2 to SL3. Specifically the removal of <asp:silverlight ../>, <asp:mediaplayer ../> is pretty significant because most of variable passing information in web is related to <asp:silverlight> markup.

In SL 3 instead of <asp:silverlight> an object tag is used


<object data="data:application/x-silverlight-2," type="application/x-silverlight-2"width="100%"
height="100%">

<param name="source" value="{XAP_FILE}"/>

<param name="onerror" value="onSilverlightError"/>

<param name="background" value="white"/>

<param name="InitParams" value="showall=true"/>.....


Now the question is how to set InitParms dynamically. See here for InitParam explanations. The previous links discuss InitParam in detail, but fail to provide how it can be passed dynamically (by hosting aspx page). But I found a close to working solution here but it didn't work for some odd reason. Ultimately a link to a document from Silverlight team on specific changes due to <asp:silverlight> component been missing provided me with the working solution.

The solution is to use a Literal control as value and set the Literal text in the server side aspx code.

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">

<param name="source" value="{XAP_FILE}"/>

<param name="onerror" value="onSilverlightError"/>

<param name="background" value='<asp:Literal id="Color" runat="server"/>' />

<param name="InitParams" value="'<asp:Literal id="InitParams" runat="server"/>'"/>...

In the hosting aspx pages page load method we do the following;
protected void Page_Load(object sender, EventArgs e)
{
Color.Text = "White"; //You can call any server side code here
InitParams.Text = GetUrl(); //Implement any business logic to get url and return it according to InitParam standard, i.e url=urlvalue
}


Now that the InitParam is set you can use it in your silverlight application by initializing them during Application_Start of SL.
private void Application_Startup(object sender, StartupEventArgs e)
{
string broadcastUrl = e.InitParams["bcUrl"];
this.RootVisual = new MainPage(broadcastUrl );

}

Now you can use this dynamically generated value for any logic within the SL application.
eg: Set the source of media element control, suppose you have a media element with id=mplayer
mPlayer.Source = new Uri(broadcastUrl ); //BroadcastUrl variable should be passed somehow to SL app. (May be via constructor as above)

Sunday, August 30, 2009

හර්දය සාක්ෂිය












තල් වැට එපිට උන්ගේ
මරනයේ හර්දය සාක්ෂිය
දකුනේ වීදි පුරා
ගොඩනැගි ලිප්ගල් මැද
පිලිස්සි යාමෙන්
ඉක්බිතිව

ෂේෂ වූ අගුරු කැටයකින්
දකුන ලියයි...
සියතින්ම මරා දැමු
ස්වකීය හර්දය සාක්ෂියේ
නව්ය නොවූ පරිඡ්ඡෙදය
මෙලසින්

පැහැරගැනීම්...
වධදීම්...
මරදැමීම්...
නවත්වව්.


-සුසිත විජේමුණි

රාවය පුවත් පතෙන් උපුටා ගත්තෙමි.