Quotes .....

There never was, there never will be, a man who is always praised, or a man who is always blamed....

Saturday, October 3, 2015

The History of Administration of Criminal Justice of Sri Lanka

Can be examine under five distinct periods.
  1. Period before the European Powers Occupied the Island. [6th B.C. - 15th A.D.]
  2. Period during the Portuguese Occupation. [1505 A.D. - 1656 A.D.]
  3. Period during the Dutch Occupation. [1656 A.D. - 1796 A.D.]
  4. Period during the British Occupation. [1796 A.D. - 1948 A.D.]
  5. Period after Independence and up to the present time. [1948 A.D. - ]
To be continued....

Thursday, April 10, 2014

Why Do You Write?

Why Do You Write?
This question is posed not only for professional and popular writers but also for amateurs.

Various writers give various answers to this question. For some its merely a hobby. For some people it’s the mission of their lives. But I often wander do we need to have a reason to do writing. How justifiable this question, “Why do you write?”.

Saturday, November 9, 2013

MVC Ajax Search Form - Code First Migrations

1. Create an ASP.NET MVC 4 Web Application.

2. Select Basic Project Template, Razor View engine and leave ‘create a unit test project’ tick box blank.

3. Add a Model Class name it as Address.cs.

Shortcut: Ctrl+. To find references required
4. Add reference to jquery.

5. Create a connection string in the Web.config file.
<add name="AddressDBContext" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=PostCode;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\PostCode.mdf" providerName="System.Data.SqlClient" />
6. Build the solution (Ctrl+Shift+B).
7. Add a Controller named AddressController.

8. Add a View by right click in the AjaxSearch method in the AddressController.

9. Create a partial view ‘_PostCodesList’ in the View/Address folder. Click the Create as a partial view tick box.

10. Enable code first migrations.

At the PM> prompt enter the following command:
enable-migrations -contexttypename AddressDBContext

The Configuration class includes a Seed method that is called when the database is created and every time it is updated after a data model change.
namespace MvcSearchSite.Migrations
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;
    using MvcSearchSite.Models;
    using System.Collections.Generic;

    internal sealed class Configuration : DbMigrationsConfigurationAddressDBContext>
        public Configuration()
            AutomaticMigrationsEnabled = false;

        protected override void Seed(MvcSearchSite.Models.AddressDBContext context)
            var postcode = new List<Address>
                new Address { ID=1, PostCode = "AB101AB",   Street1 = "Alexander",
                    Street2 = "",Address1="Address1",Address2="",Town="Derby",County="Derbyshire" }
            postcode.ForEach(s => context.Addresses.AddOrUpdate(p => p.ID, s));
Build the project.
In the Package Manager Console window, enter the following commands: 
add-migration InitialCreate
A SQL Server database has now been created for your data model

In Database Explorer db is visible, sql commands can be executed.

If you need to add more data to the table, change the Seed method and run the ‘update-database’ command.

11. Set the default starting page in ‘App_Start/RouteConfig.cs’.

12. Run the application (F5)

Friday, April 12, 2013

Fight or Flee
By Surangi Tissera.

Chintha and Manori were seated in the spacious hall of the Road Moto Vehicle office or known as RMV; with hundreds of other people from all walks of life. They all are anticipating this one cause of getting their Moto-vehicle driving license. It is a very noisy hall. Small talks of each ones have made the sound of thundering. Sometimes sounds are getting high pitched when they scold for the authorities for taking long to release their permits.
The hall had two fully erected walls; one side is opened to the outside garden and the opposite side had two glass covered doors which are opened to the adjacent office building. Through the glass doors, one can see peons clad with blue uniforms walking here and there with stacks of papers on their hands. The air, in the hall is getting warmer due to the asbestoses sheet shelter without a sealing. The two fans, hanging from the bare roof are rotating in full speed. But it couldn’t help to cool the environment inside the hall; as it is near the noon of this tropical summer day.
Except some, all of them were in the ripe of their youth. Also few school boys with their school uniforms were seen among the crowd too. Most of the men have applied for heavy vehicle category and they are planning to go Middle East countries in search of jobs as drivers. Their faces show the weary of searching jobs and their cloths reveal the poorness and village looks. On the other hand all most all ladies were in posh looks and wearing latest fashioned cloths. They were talking in English and showing off with their luxury mobile phones and accessories. They must be the lucky people who are going to drive their own vehicles.
Chintha and Manori were sharing some milk cookies cursing for the delay. It is almost their lunch time at office. They both work in an UK based BPO company as software engineers. Over the past six months they were chatting and most of the time dreaming about what they will do with the driving license.
The unmarried girl, Chintha asked her friend Manori who is newly married and the husband is working in abroad.
“You know what? Yesterday I drove our family car a bit.”
“How was it? I bet it is not easy as driving the mini-car we drove today for this test”, Manori interrupted while taking another milk cookie out of the pack.
“Who said it’s easy. It is Terrible!” they both laughed in unison to the Chintha’s remark and she continued. ”We can’t drive those old modeled huge vehicles in these narrow roads full of daredevil three wheelers”, Manori nodded in agreement.
“We better try to buy those mini model auto geared cars. But they cost a hell of lot of money, you know”, Manori continued her munching.
Chintha looks around and see the middle aged woman two rows back to them.
“Do you see that lady in the corner with heavy make-ups? She is an international school teacher“, she whispered to Manori’s ear pointing to the back rows.
“How do you know?” Manori asked surprisingly.
“Oh, she was in the same vehicle where I was. In fact she went just before me in taking the practical test. I heard the driving learners’ school representatives were talking about her. They were so much upset as they couldn’t get bribery from her like they took from us”, Chintha went on.
“She is either smart or too foolish, I guess”, Manori interrupted her friend.
“No, you silly, she has said the examiner who is going to conduct the test is one of the parent of her class student and she personally knows the examiner and passing the test is not an issue”, Chintha went on.
“There you go… she is smart, we could have also told some kind of story to Learners’ school representatives. Who knows whether she is personally know the examiner or not”, Manori heaved a sigh.
“Do you think it’s that easy to get away from them? They are thug like people. Even all those examiners take bribes and keep close connections with them”, Chintha warned.
“Here everything is corrupted and without a bribery or close connection nothing is possible”, Manori nodded in agreement to the Chintha’s statement.
For a minute or two they both said nothing and went on eating the milk cookies.
Manori broke the silence.
“Did you hear the news about Yasanghi?”
“O yes about her resignation after the marriage. That’s a bit old one. Isn’t it?” Chintha went on while searching for the water bottle inside her handbag.
“I bet you haven’t heard about the migration. Her husband has got the PR in Australia”, Manori said moving her chin bit upper and rolling the left corner of her mouth proudly for knowing the latest news which her friend doesn’t.
“How come I haven’t heard it first? Even she came to me to write her resignation letter”, Chintha said in displeasure pouting here lower lip on the upper.
“It’s true she is not clever in documentation”, Manori when on agreeing to her friend. ”She came to our room yesterday afternoon when you had left from office, to get help in writing another letter. She was looking for you. Since you were gone and she was in rush, she asked help from me. You know I am not as good as you in writing. But I managed to write her a letter requesting a service letter”, with that Manori put her hand in to biscuit pack only to find it’s empty.
“But service letters are normally given when you give your request for it in the resignation letter along. I think she has already got one”, Chintha went on still in doubt.
“Yea… she got one yesterday afternoon. But the letter given is not in details. She had to request for a detailed service letter. She needs it because she must find a job in Australia even before she migrates to that country. You know on those countries everyone need to earn their bread and butter themselves. Specially people migrating from third world countries have to do several jobs at once to meet their both ends. One of my cousins who went there for higher studies said he works whenever he gets free times from his studies. And he told me most of the Sri Lankans living there work around the clock. You know unlike here, day time and night time works are not treated differently”, Manori said wisely.
“But people migrate to developed countries to have a better living, right? What is the use if they have to keep on working around the clock? Here we can manage with one job”, Chintha went on.
“There is a different, Chintha, They earn and pay government taxes, which in return give them better living standard. It is at the beginning one has to work hard to establish the life in an alien country, afterward it is much easy. Now compare that to here. Of course we do one job and manage our lives. But till we die what we all do other than managing our things with barely sufficient salary. We pay tax and in return what we get? We have to pay higher prices for everything. We earn in Rupees but required to spend in Dollars”, Manori said with quick paced anguish tone.
“There is a point in your talk. If we also given the chance to work more than one job and earn our living we also can reach to that living standard. But the structure needs to be created first to change the attitude. Even education structure needs to be change to suite the current job opportunities available. Remember how difficult it was to find qualified people to work in night shift in that latest USA project at office?”, Chintha reminded.
“Correct. That is why people go to other developed countries even in illegal ways. I think in this year along more than thousand people were caught trying to migrate to Australia in fishing boats”, Manori looked at her wrist-watch and knew it an hour passed her normal lunch time.
“Look Chintha, I think the officers are also taken their lunch breaks. Shall we also go to the canteen and take our lunch”, Manori suggested as the hunger is unbearable to her.
“I too feel feeble. Those cookies can’t help since I took the breakfast very early today morning to arrive on time to the test. But you see they instructed us to wait here. If they call our names while we were away then that will be a mess again”, Chintha reminded.
“I saw some of the candidates go out and come. We should have the right to eat our lunch. They can’t deprive that. This is intolerable. Come on. It won’t take more than ten minutes”, Manori pressed her friend in agreeing to her. Chintha agreed.
“O.k. then let’s go quickly”, Chintha stood from her seat.
The canteen is not noisy like the waiting hall and it is more spacious and air conditioned. A well known restaurant chain is there to serve food and it is maintained in excellence conditions. As quality is high so does the price of the food. The prices are nearly three to four times higher than the normal price.
At first the two friends thought of eating rice and curry. But the thought didn’t last more than ten seconds when they saw the prices. They had quick chat and decided to quench their hunger by fish-buns and milk packets for the moment and to take late lunch in a Tamil Vegetarian restaurants known as ‘Syvar Kade’ in roadside. Manori paid for buns while Chintha bought milk packets.
When Chintha came to her seat in the table Manori had already started eating. Chintha knows well about her friend’s inability to wait when food served. Therefore no issues of table etiquette took place. She put one of the milk packs she brought to Manori’s side of the table and started to eat her bun. By then Manori has eaten half of her bun and telling the food is so tasty comparative to other places.
“It should be high taste than the outside shops like the price of it. No wonder these examiners had to take unsolicited fees from us to eat their daily meals from this star hotel”, Chintha said looking seriously and chuckled at the end.
Manori winked while eating the last portion of the bun.
“If we go to one of the roadside ‘Syvar Kade’ we could have eaten a full meal with desert to this cost”, Manori said while sipping her milk packet.
They both finished their quick snack and rush to the waiting hall. Still candidates are waiting in that scorching place for authorities to release their driving licenses.
The both wanted to go to the wash room too. So as the time permits they decided to take leave again. There were two rows outside the washrooms, one for males and the other one for females.
They both stood in the female row and were able to reach to the front in a few minutes time. It was then that they understood they have to pay first in order to go to these toilets. Pay money before going to the toilet isn’t a new concept in some areas of the world. But these two girls haven’t experienced it anywhere before and they both were laughing about it afterward on their return to the seats in the waiting hall.
After another impatient ten minutes all of the examiners who conducted the practical tests that morning came with the bundles of temporary permit letters. The hall went silence at once. In a split second again the noise started at full length. But there was a difference. Now the examiners all at once started to call the candidates name to handover the letters. They had to repeat the same candidate name several time as the audience couldn’t grasp what they are telling. But then without any further instructions candidates knew how to cope with the situation. Individual candidates started to move toward each examiner seated location by identifying their correct examiner. Since Manori and Chintha were belong to two different Examiners they too also parted from each other.
Now the next hurdle, they have to be in all ears and stay standing with the crowd.
“Mudiyanselage Jagath Bandara”, Examiner let a loud cry by holding the letter. From the back of the crowd where Chintha stand, emerged a skinny, brownish man with red eyes. When he walked up to the examiner’s table, he is given a paper to sign by the examiner. Then only he found out he doesn’t own a pen. Examiner frowns and looked at him in a split second before starting to scold in high pitch.
“So you came without a pen ha!”, Looking at the crowd he continued in sarcastic tone, “Everyone needs to know when coming here you must bring a pen with the relevant documents and a vehicle to drive at the exam.”
Then again he looked at the candidate standing at his desk and demand. ”Go and get a pen yourself without standing here like this.”
By then a fellow in the crowd passed a pen to him and it settled the matter. Everyone searched for pens and people who don’t have one, searched for a pen owner who can lend it to them.
Now it’s time for the next candidate. He is a boy at his twenties and wearing a t-shirt with a denim trouser and deck shoes of the latest fashion. He is having a pen in his hand and showing it to the frowning examiner. But this time examiner is looking at his deck shoes. He pointed his left hand toward the shoes and asked him to remove it. Everyone is looking at his legs now. From his eyes it is obvious his shyness but obeyed the instruction by removing the shoes. Then he is advised to remove the socks. He looked at the crowd who are watching all eyes and some with mouth agape. Chintha noticed that one of the socks is having a big hole in the sole. The candidate started to remove the pair of socks while both the crowd and the examiner are watching.
“Is he hiding something?” Chintha thought to herself. If Manori was nearby she could have something to say about this. She thought and turned her head to the direction where Manori is standing. But Manori is looking in the other direction.
When Chintha returned her gaze back to the scene the boy’s fate has been decided. He is slowly rolling his denim trouser legs to the knee height without looking at the crowd anymore. Examiner is quite unhappy about his slowness and opened his mouth again.
“Have I asked you to rip your trouser down? You are embracing like you are doing a sin. Do it hurry and show me your two legs together”.
Some were laughing but when examiner turned his head toward the crowd everybody stand still in silence.
“Oh! My gosh! What is he doing?” Chintha thought to herself. The person next to her saw her facial expression. It was that international school teacher.
“Don’t worry…” she said with a consoling touch to her shoulder.
“It is checked to see if both legs exist. You can take medical certificates for money like everything, you know”, she smiled.
“But he is not checking it in everyone”, Chintha said still in disbelief.
“If you applied under heavy vehicle category and wore shoes and cover both legs, then he’ll do the double checking”, she reassured.
Later Chintha found out what she had said was true.
It was almost late in the afternoon when the two girls left the RMV office situated in off the city of Colombo. Are they happy with the driving permits? By looking at the faces one could figure out that they are feeling tiresome. But if it is possible to penetrate their thoughts, one could clearly observe that happiness was nowhere to find.
Without telling to each other they forget the late lunch they were planning at the lunch time. The cheerfulness they had in the morning when coming to the RMV premises has been ripped off from them. They get into a bus routed to Colombo city. While on the bus they called the office and extend the half a day leave they both applied into a full day leave. Then each one called home to assure and soothe worried mothers at home that everything is alright. Of course they were pleased to catch a less crowded and fast travelling bus, not like the one they travelled in the morning.
In a thirty minutes travel of the bus took them to the heart of Colombo city. From there they departed from each other and got into different routed buses as they both lived in suburb of the city in the opposite direction. While at the bus Chintha thought about the unpreparedness of her in the situation compared to the International school teacher she met at the RMV office. With an education up to a university degree and twenty-five years of living experience in town, knowing how harsh and corrupted the society is; she had to let herself be the victim ultimately.
It was in that night, Chintha wrote a new blog post called “Riyaduru Perahara (The procession of drivers)” criticizing the work conducted at RMV office, giving instruction of what should be known by anyone who is going to that place. Furthermore, asking general public to stand against these wrongs. Her personal blog which she has originally dedicated for IT related articles and sharing new trends in the IT field, henceforth started to talk about the corruptions of the society and how innocents are suffered. What the world didn’t know at that night was, it is the sacred night that gave birth to a fighter who will over the years start eradication of corruption in the society and save innocents.
It was this same night Manori could make her husband agreed reaching him through a voice call over the Internet to apply for a Permanent Resident in Australia immediately.

Sunday, December 30, 2012

31st of December 2012

It has become an habit for me to post a new article on my blog on the 31st December every year. Lets think about how to organizing the year 2013 - the New year resolution .

Making new year resolution is good while stick to it throughout the year is the best. I am not the first person to admit it and I don't expect anyone to achieve it hundred percent the way one imagined at jotting down the list on 1st of January.

It is about managing your time worthy and in a productive way. It is also about the feeling you get in the 31st December about yourself. If you are feeling like someone who wasted 365 days or 8760 hours or 525600 seconds from your life, then obviously it's time to save the rest of your precious time ahead since you have already wasted an year.

Remember you are full of energy to achieve what ever you decided. 

Adios 2012!

Sunday, September 23, 2012

Mentoring Effectively

I had the opportunity to follow an a e-learning course on the topic "Mentoring Effectively", below is an extraction from it.

Mentoring Effectively

Where did the word “mentor” come from? In Homer’s epic poem “Odyssey,” Mentor looked after
Telemachus, the son of Odysseus, while Odysseus was away. Mentor has since come to mean a
wise and trusted guide or teacher

Today many people have earned the title “mentor” by acting as wise and trusted guides or teachers
to less experienced colleagues in their organizations or professions. Mentoring may be an ancient
idea, but it’s becoming more and more vital to career development. Although being a mentor
requires a substantial investment of your time and effort, it also has many rewards.

Proteges gain most of the benefits in mentoring relationships.”- This is false. Benefit
everyone involved, including mentors, protégés and their organizations.

Aspects of effective mentoring- Why it’s important, the various roles of mentors, how to use
effective communication skills in mentoring relationships, how to manage the mentoring relationship.

The Importance of Mentoring
Have you ever guided someone through unfamiliar terrain? Did you think about how important your
guidance was in that situation?

Career development is one of the most significant issues facing organizations today. Many
companies are looking to mentoring programs to help develop their employees. A mentor provides
guidance at crucial times in a protégé’s career. Whether a mentor is inducting a new recruit or
grooming a rising star for an executive position, the mentoring relationship has great importance.

Although mentoring relationships are as varied as the situations that produce them, they all are
designed to propel professional development to new heights at greater speeds.

Thursday, August 9, 2012

LoadFile() Method of the object AxAcroPDFLib.AxAcroPDF can't use to load already open PDF files

The Question:

I have made a Windows desktop application(in C#) where I use the AxAcroPDF control to display a pdf-file on a form when user give the path of the pdf and click a button. Pdf-file is located in one network shared file folder where multiple users can access it.
(I use the LoadFile() Method of the object AxAcroPDFLib.AxAcroPDF)

This is working fine. But when the same pdf file which my applications try to open is already opened using Adobe Reader then my application can’t open the same pdf file.

If the PC my application installed has Adobe reader 7 then application throw the error message as "System.ApplicationException Failed Loading PDF Template" and application freeze.

And if the application running PC’s having Adobe Reader X installed then no error will appear but the loading screen appears for ever.

But opening the same pdf simultaneously in two or more PC using my application works perfect.

The Answer:

Solution01 - Not recommended (this sometimes not work)

After desperate search on forums I couldn't find a proper solution as I was expecting to find. But to avoid the program get crash, I put a check before loading the pdf.

bool PDFAvailable = axAcroPDF1.LoadFile(PDFPath.ToString());

If the Boolean variable 'PDFAvailable' return true I'll load the PDF like below. Else a proper message is thrown.
bool PDFAvailable = axAcroPDF1.LoadFile(PDFPath.ToString());                                                if (PDFAvailable == true)                        {                            axAcroPDF1.LoadFile(PDFPath.ToString());                            axAcroPDF1.setShowToolbar(false); //disable pdf toolbar.                            axAcroPDF1.Enabled = true;                                                    }                        else                        {                            MessageBox.Show("Selected PDF Template Is Locked By Another Application.", ""Test Application"", MessageBoxButtons.OK, MessageBoxIcon.Information);                                                    }
Solution02 - Recommended (Work fine for Adobe Acrobat Reader X)

I found a workaround in this
Rather than LoadFile() we can use the "src" property of the control.
The drawback is Adobe acrobat Reader 7 doesn't support src property.

Solution03 - Recommended for any version

Copy the pdf file to client PC temp folder and then read :-)