Sri Lanka, a new future ?

Last week was a very memorable one for all Sri Lankans, in whatever way you look at it. End of a 30 year old conflict is not something you forget that easily IMO. Younger generation today (me included) hadn’t seen a day without a war. Each month (some times every week) there were bomb blasts going on…people dying here and there… so it’s not a great wonder to feel relief after such a devastating conflict.

But I can’t really enjoy it either.

The cost of ending this brutal war has been massive. The war has brought so much grief to most families in north..family members dead .. closer to 300,000 displaced in camps…more than 6000 army soldiers have sacrificed their lives (in last 3 years of war alone, according to recent stats)…most people have lost whatever they had..so it’s not a party time either.

At most it’s bitter sweet.

But due to all these sacrifices from Sri Lankans, it has brought a new chance to look at the future in a new light. But it should be remembered specially the tri-forces who had put their life at risk and some who have laid lives, secretary of defence for his unwavering goal to finish the war and president for supporting it. They have done what four Sri Lankan presidents, eight governments, and 6 cease-fires could not. No matter whatever blunders the government has done, I don’t think any one can really blame government for going at active war…because they have tried everything possible through peace processes to come to a solution. Specially previous government through its MoU and even President Chandrika Bandaranayaka earlier with her willingness to give north to LTTE for 10 years without an election shows the desperation Sri Lanka wanted to have a peaceful solution. It’s no wonder because with the ongoing war country was basically at a stalemate when it came to the economy and growth. Prabhakaran never gave a compromise (even backing down a notch) from what he wanted and there was a limit the government could promise, which was a federal solution..which he despised. So when one party is not willing for a compromise, it’s a fact that there’s a conflict or a war in this case whether you like it or not.

But here we are…so what should be done ?

To where ?

First and foremost, there are about 300,000 displaced people in the north that are in very hard conditions. Also according to stats, it takes around Rs 3 crore per day and around 1 billion Rs per month to maintain these camps. Without a doubt they have to be resettled back asap and hopefully within 6 months as suggested by the government. But not only resettling them, rest of the country have to provide all the help they can to bring back these destroyed cities and villages to normalcy as much as they can be. Also it’s required to have a rapid development plan in these areas to bring them to the level of rest of the country.

But the real rock and hard place will be to bring peace through some political solution that’s acceptable to everyone.

Peace and a new future ?

As many believe Prabhakaran may have been a very skilful military leader…but that’s the only thing that can be said about him. If he had an iota of political sense most of this destruction could have been avoided through any of 6 peace processes underwent. Then what about all lives he took of intellectuals (specially that of Tamil leaders that didn’t go well with his ideology, or terror) ? That will take many years to fill that gap.

Through terror he shut down most of powerful moderate Tamil voices and except for a handful all were fearful of raising their voices. Personally, I feel there’s a lot of resemblance between the character Lord Voldemort of Harry Potter series and Prabhakaran in many ways. Both were megalomaniacs who thought they were like deities and made people even fearful of uttering their names much less voicing different opinions.

So now with the end of the war, the bottleneck is gone and Tamils have the freedom to express their opinions without a hindrance.  Also it’s government’s responsibility to let the freedom go to people.

People should use this to send representatives (preferably not idiots like some of those who are now in Parliament) who really care about them. Then use them to bring their grievances to discussion table and resolve it politically and peacefully.

The responsibility of the government is to use this golden opportunity provided by sacrificing thousands of lives by soldiers to bring all parties together (mainly UNP, as they have suggested their agreement to support the government in a political solution to get necessary votes in the parliament) instead of watering its self image (it may be justifiable to a certain extent because this is politics after all, but extreme is always ugly).

Also general public should think in terms of their contribution to the country. If a soldier can put their lives at risk and work 24 * 7 without a holiday, shouldn’t the rest at least work their 8 hour work load per day dutifully ? What right do we have to talk about soldiers if we can’t even do that ? [“Even after increasing it from 116,000 to 200,000, a soldier still cannot get seven days leave a month, he pointed out.”]

So we are at a cross road…I really hope it leads to somewhere better than past three decades.

My best 7 free JS modal boxes

I have been working on a new iteration of HOT (follow @hotelotravel for more info) for last few weeks and thought of changing the existing JQuery UI Dialog box for something bit fancy and solid (on other hand I may have just wanted to get a break from usual PHP stuff and to play with JQuery a bit after some time). I did have some popular JS modal box names such as Lightbox, Facebox and Thickbox that I wanted to test and found some few new names on the way.Certainly there will be many more modal boxes out there that I’ve missed and not to mention my requirement will be different from yours, but here is the gist of each modal box in my opinion of those I’ve tested so it may help someone to pick the right one at the right moment.

JQuery UI Dialog

JQUery UI in Hotelotravel

JQUery UI in Hotelotravel

This is the dialog box that I’ve used in most cases and of course it’s great. Few years back when I started working with it I noticed few issues when closing the dialog and such but by now they have all been fixed. Also it’s continuously maintained by JQuery community so you can be sure it is solid. What I like mostly about it is its simplicity as well as customization power through various callbacks when you need more action (you can define what to do when a drag starts, drag stops, box shows up, box closes. etc) through various option settings.

This is all you have to do to get a simple dialog box if you have a div with the id of “myDialog”.

$("div#myDialog").dialog();

Another perk of this modal box is its file size, which is quite small (about 10KB and minimized version is about 6KB) and when doing a complex site with numerous CSS and JS scripts, size of each file becomes crucial to maintain a small load size to reduce the load time as well as save server bandwidth. Only seemingly downside of this box is that it doesn’t come with any fancy preloaded stuff (themes, effects, preload-images.etc) but for someone interested (and with a bit of JS and CSS knowledge) can customize them.

LightBox

Light box

Light box

This is focused mainly on presenting pictures and does a good job at it. If you are interested in creating something like a picture gallery without touching much JS, this could be the ideal JQuery plugin for you. Also it has a relatively low size with a size around 19KB and packed version is about 6KB. But since I was looking for something more with raw customization power, this wasn’t the choice for me.

FaceBox

Facebox

Facebox

Another popular choice for a modal boxes and it deserves the name. It has a very small file size and a simple code. It also comes with a default theme and can be a convenient choice for hasty tasks or people :P But the downside I noticed is that it gives very small customizing power to the user through JQuery code (which is the case with Light box also btw).

It’s simple to a fault and you just have to name the class name of the link you are going to pop the box as “facebox”. It could have had few more options such as to define the basepath of the project as I couldn’t find a way to define it for pre-loading images without hacking the code nor a way to give width and height manually or pass callbacks. Also this project seems to have been abandoned for a while now and if you are considering adapting this box for your whole site check it thoroughly.

ThickBox

ThickBox 3.1

ThickBox 3.1

ThickBox is really a cool JS box. It’s simplicity and extremely small file size makes it very adorable. This modal box gives some customizing power but still focuses mainly on simplicity and link naming as “thickbox” which is its magic word. However as mentioned earlier this has a better customizing power through JS than FaceBox or LightBox so it’s more flexible. With some hacking you can also give your own callbacks and options as you like.

LightWindow

LightWindow

LightWindow

This is an all purpose, very fancy looking modal box done using script.aculo.us and prototype libraries. It can host all kind of media types and even flash clips which is really impressive. But the obvious downside is its huge file size of about 60KB which is a huge amount when considering this will be just a small part of Hotelotravel.com and for general use it’s not tolerable IMHO. It is not compressed or packed by default so you can manually minimize it using something like YUI compresser to bring it to somewhere around 30KB but even then it’s too large for me. But this is ideal for a site that has tons of ajax stuff and in need of a very customizable modal box with lot of options and callbacks that can be used throughout the site.

SimpleModal

SimpleModal

SimpleModal

This is the smallest JQuery modal box I’ve seen and if you need to customize your modal box to the extreme I’d suggest this. Downside is that you will have to write a lot to get something done through this modal box but extreme small size complements that.

NyroModal

NyroModal

NyroModal

This is also a very good looking JQuery based modal box with a reasonable file size(about 14KB for packed version) and gives considerable customizing power to the user. Also it comes with a packed theme and all that so you can use it easily without much coding which is a plus. In fact, I had some trouble deciding whether to use this one or JQuery UI for my task but finally settled on using JQuery UI because my familiarity with it and community backing. So I guess in my case JQuery UI is the rightful winner :)
[digg=http://digg.com/programming/Best_7_free_JS_model_boxes]

Tagged , ,

Drupal with Dreamweaver

I had to migrate and setup the whole workspace at my old desktop machine last week after the breakdown of my HP notebook. So while setting it up I thought this little piece of trick could help someone who is fond of Dreamweaver and looking for an IDE to code Drupal.

As a side note, one could accuse me of promoting unethical software and in fact I don’t refute it (even though it is not my intention). I also know there are many great open source editors for coding PHP like Eclipse-PDT and even Gedit which could be transformed to a very helpful IDE. But on other hand I’m kind of addicted to DW after long years of working with it and if someone who already has DW looking for a way to use it for coding Drupal this could be helpful.

The most frustrating thing when coding Drupal modules or themes with DW is that it doesn’t recognize it as a PHP script and doesn’t give any validation or auto completion features like it usually does for php scripts. To fix this there’s little configuration to be done.

First find the installed directory of DW (if it’s Windows it most probably in ~/Program Files or if it’s Linux+wine it should be in your virtual windows environment) and go to Configuration->DocumentTypes. There should be a xml file called MMDocumentTypes that holds configurations regarding which language should be used for a given file format.

Find the line that says,
‘<documenttype id=”PHP_MySQL” servermodel=”PHP MySQL”….’
and depending on weather you are using windows or mac, append ‘,module,install,theme,inc’ to existing winfileextension or macfileextension values.

So for windows it should look like this.

<documenttype id=”PHP_MySQL” servermodel=”PHP MySQL” internaltype=”Dynamic” winfileextension=”php,php3,php4,php5,module,install,theme,inc” />

Now restart DW and open your module or theme file. Ta da!..it should now work as a normal php script.

Hope this will be helpful to someone looking for a way to convert Dreamweaver to a more Drupal friendly place.

Tagged , ,

PHP + Large files

I was working on the project Hotelotravel for last few months and as usual in many cases it involved working with large database files because when you consider all hotels, locations and images all over the world it means a lot. But if we want to do large file uploads or database updates with PHP there are few configurations to be done to default settings and I’m putting this as a note to myself (I’m always keep forgetting this) as well as to any one who may find this useful like when importing a large backup file through phpMyAdmin.

In your php.ini check for these settings and change them as you need.

  • post_max_size (The maximum size of post data you can send in one submission)
  • upload_max_filesize (Maximum size of file that can be uploaded)
  • memory_limit (Maximum memory limit that can be allocated for a script execution)
  • max_execution_time (Maximum time limit for a script execution)

As a side note, if you trying to import large files (backups.etc) through phpMyAdmin and it refuses, you may need to edit config.inc.php file and change these settings to 0 which means no limit.

  • $cfg[‘ExecTimeLimit’]
  • $cfg[‘MemoryLimit’]

As a final note, these settings are there for a purpose. So my advice is change them in whatever manner  you want in a development environment but be very careful when setting them in a production environment because an endless execution of a script can cause your servers to waste bandwidth and even crash.  So I guess this is my disclaimer ;)

Tagged ,

Back to politics

It has been a very long time since I’ve had any interest in politics whether it’s local or world.

I was damn disappointed and angry with local politics because frankly there’s no party to support IMHO. There’s no one with a clear vision, all leaping from one party to other in a blink of an eye just for political or personal gains, democracy has become a joke with some ministers, Police has become just a tool of the government to control the opposition, people looking at television while live crimes being telecast…so the list goes on.

I was throughly fed up with international politics also mainly because of activities of Bush administration in US. Whether we like or not U.S. always had a say in where the world was heading in recent history and world seemed to be going on the wrong trail with Bush leading the way to the gates of hell. Invading other countries and later saying “Oops sorry, it was a mistake. Our evidences were bunch of lies“, hell-bent on trying to destroy the environment like it was Bin Laden, torture camps and secret prisons, possibility of a war with Iran..and this list also goes on.

So it was refreshing to see some new movements in politics and of course I’m talking about the intense US election that came to an end in last week. I was somewhat intrigued by this Obama guy when I heard about his ideas and his background at the beginning of this year. At that time he was in tough primaries with Sen. Hilary Clinton  who most believed is the de facto for 2008 nominations from Democratic party (of course I’m talking from what I saw from news), but that seemed the general consensus. So it was a great surprise to see him winning primaries and hearing him talking at Democratic convention in last August accepting the nomination.

But the bump in polling (I usually follow Gallup) that followed after the Democratic convention was soon ended with the Republican convention in the coming week and McCain seemed to be winning. I thought this will be a repetition of 2004 or 2000 where Democratics were ahead in days before the election and losing it at the end. Talking about McCain, he seemed to be a traditional politician, talking to people like children, going after slogans, changing positions all time, doing a rash choice for a running mate and continuing same Bush policies in almost every aspect, saying things like “bomb, bomb, bomb Iran”…which clearly didn’t give any good feeling about the guy (Btw, I had had enough of hearing the word ‘Maverick’ in last few weeks).

On the other hand the position Obama took clearly impressed me. First and foremost his ideology about Iraq war (he opposed it since its beginning), his idea for a more peaceful world, getting away from ‘Shoot first ask second” system, more understanding with Muslim countries…so IMO he was the better choice for the future of the world.

Also the way he ran his campaign really impressed me and gave a good indication that he can handle tough situations well (with the global economic crisis it certainly won’t be a walk in the park. Although I don’t believe Obama nor any other single person will be able to solve this mess). I have never seen a politician using the power of web to such an extreme level to get to the voters like done by Obama’s campaign.  Since he had been campaigning for nearly 2 years, he had a massive user base around his web site and he used that very effectively for almost everything ranging from organizing community activities, canvasing, fighting smears, carrying his message globally, GOTV campaigns and what not.  Also he had realized the importance of viral marketing and used all popular social networks and micro blogging services like Twitter to their fullest limits. According to recent numbers he had more than 100K followers in Twitter and about a million users in Facebook.

So finally when election results started coming in last Wednesday morning it seemed all projected Toss-up states like Virginia, Indiana and Florida which he had been leading in polls going the other way around. But within few minutes results of PA came and a bit after that Ohio came and the game was set. Then after some time I watched the historical acceptance speech by U.S. president-elect Barack Obama and it was truly a beautiful sight.

We have been reading about legends of Mahatma Gandhi and  Civil right movements of Martin Luther King, Jr in world history and how it changed the world. To me the last US election could be seen as another changing moment in the history after 100 years later or become just another lost chance. According to Arthur C. Clarke (I’m taking from his 3001-space odyssey) as human civilization evolves there should be less violence because of greater understanding and increased intelligence. I truly hope this new “Change” will be a turning point of the world in to a global peaceful environment even though at the moment it’s looking pretty gloomy.

[youtube=http://www.youtube.com/watch?v=6qiRwCuQmZA]

Btw, I thought of writing how US election can relate to Sri Lankan context also (there are many similarities, differences and a thing or two that we can try to adapt) but it will be insanely long  if it added up to this already elongated post so I’ll post that later separately.

Tagged , ,