Monday, March 09, 2009

From No Limbs to No Limits

Today, I happened to see a Youtube video of one of an international inspirational speaker, posted on Facebook. He was 23 years old, an hell yeah the video was totally inspiring. But there was something else... he had no limbs.

This is Nick Vujicic that I'm talking about, a 23 years old guy born with no limbs but will. It's sure that the day that Nick was born, his Mom, his Dad must felt the unspeakable happiness of having a baby. But the same time they must have worried about Nick because they knew that he wouldn't even be able to dress himself, feed himself or move himself. They would never have imagined that one day their son would become an inspirational speaker who speaks to millions of people, who builds schools in third world countries and help children to study. They would never have thought that Nick would go from No Limbs to No LIMITS! Yeah, he says this all.

Once, I wrote a blog post in this blog about chasing goals titled "a goal". Yeah, you probably remember it so I'm not gonna put the link ;) . In one of his clips there was something about chasing goals and achieving targets in our lives. If we have a target to make a superior movie but we have no camera crew, it's coming. If we have no script and have no money to make it, still it's coming. He says, if we wanna make a phone call we need to go to the phone. It's not gonna something like in Heroes that we can move objects using our mind and make the phone comes to us. Same theory can be applied to the goals and targets in one's life. It's coming, it's coming; if we continue move forward towards it. For that we should reach to our fullest potential.

I know for someone, it might be bit awkward to read a post like this. But I hope this will add something to my last blog post about goals and targets. That's right I mentioned it previously ;) .

I have set of goals, and sometimes I get tired of chasing them. Sometimes I overrun them. But remember not to finish strong, never, ever. :)

Monday, February 02, 2009

diGIT

I hope you might have already heard about the first ever Sinhala mobile game, "Colomo Ride (Colomba Wate)", developed and released by GTS. As a stepping stone for another contribution towards Sri Lanka's IT improvement, GTS has launched the newest online IT magazine today (1st FEB 09'), named "diGIT".

I'm really glad to be one of a contributer among the whole bunch of contributors of diGIT who made the premiere issue a grand success with 122 pages. :)

diGIT contains vast range of articles included-in different sections. You can browse the magazine online as they have released an HTML version and a FLASH version of it. Further you can download the PDF version to read it from your desktop. Most importantly it is free! :)

Btw, I heard that the guys at GTS are going to launch the next version of "Colombo Ride" mobile game on the Independence Day, 4th of FEB. So don't forget to check that out, too. ;)








-Lahiru.

Saturday, December 20, 2008

Winter Holiday Gadgets

Google Desktop Community has created several holiday-themed gadgets in the past recent years. And now its become a tradition.

In this Winter, there are five more new holiday-themed gadgets to dress-up your Desktop. Read up the special blog post by Google Desktop team.

And the memories of the past holidays should never have been left out. ( 2007 & 2006 ).

Hope you'll enjoy the gadgets. :)

Happy Holidays!

Monday, November 03, 2008

Finger Tracking - Step 1

I'm just getting things ready for my final year project. Well if I make it quick... the project is based on multi-touch surfaces.

In order to achieve the project goals some considerable work on the hardware prototype is necessary, and as well as the software.

Still I'm having some issues finding the ideal hardware equipments (IR illuminators, IR cams, Projector etc..). So I decided to get more familiar with the image processing library "openCV" which I'm planing to use for the base system; while setting-up the hardware prototype.

This is my first attempt to track fingers using a regular webcam.

The images are captured form my Logitech Quickcam Pro 9000 and processed using "openCV". In the original image the dark background helps to create a huge contrast difference.

I just iterated through the grayscaled image and binarized it with a threshold value. So far it's good but have to make it better.

After all it's just the beginning. :)


Monday, October 27, 2008

My MTmini

Several days back I got a chance to build my own MTmini. It's a very low cost multi touch pad, which can be built within couple of minutes!


It cost me 130Rs (1.3$) for a 18"x14" plain glass and some white papers. My Logitech Quickcam and an old cardboard box were the other stuff that I needed.

All I had to do was putting things together and installing "tbeta". :)


Well it doesn't look perfect, but it works damn well.

Checkout the video on utube. :) Sorry about the poor video quality.



---
Music: Sonic Blue - Room 7 (released under CC).

Saturday, October 25, 2008

Its been exactly 2 years !

Yeah! Its been exactly two years... :)

Back in 2006, on 24th of October, I wrote my first ever blog post which was about the Firefox launch. Just read that post and find out how I put my self on the blogosphere.

Things have changed a lot..

Uhmm.., well it seems like a pebble is blocking my stream of words or that stream might have drained. :P

Anyway lot to write but can't find words. Final year project is the only thing which is visible at the moment, everything just feel like multi touch screens. ;) [ will write more about it sometime later ].

I want to thank all of you who made comments on my posts, who added my rss feed and let their feed readers to fill up with my craps, and specially you! who read this Blog at least once. :) THANKS!

So Happy Birthday 'Sound of Code-Blog' !!! You are a big boy now.

Emoticons on GMail - For Emails

Time to break the hiatus !

Just noticed the newset emoticons on GMail. This ones are for emails, not the emoticons that we used in GMail-chat. ;)


---

Thursday, September 04, 2008

Charity : Water


The September Campaign Trailer from charity: water on Vimeo.

Friday, August 01, 2008

Facebook style pagination

Facebook provides a great API for application developers. An API which helps developers to make their applications more facebook-fit.

There are many things that a developer can do using FBML (Facebook Markup Language), but pagination. Recently I was looking for a way to add Facebook style pagination for one of the Facebook applications being developed. Though there's no relevant FBML tag, we could have something which works out of the box. :)

I found this solution on the Facebook developers forum which looks promising. :) It's a nice php function and anyone can use it to have a exact same Facebook style pagination on their Facebook applications.

The code itself provides many functionalities including mockajax. I could use the original source code with mockajax straight away, but I had to modify it a little bit in-order to add a loading indicator. :)

Here I'll post the modified php code, with mockajax support + a loading indicator, but all credits must go to the developer of the original source code. :)

How to use :


$ajax_top = array('rewriteurl' => $targetpage, 'rewriteid' => 'mypagination', 'rewriteform' => 'mypagination_form', 'loadingimg' => 'spinner');


"'loadingimg' => 'spinner'" will do the trick. You must put an <img> tag with the correspondent id. (here it's 'spinner'). And the image must put inside the 'rewriteid' (div).


<img src="<?=$callback_url?>/loading.gif" id="spinner" style="display:none;"/>


Modified code with the loading indicator :

/**
* Facebook style paginator
*
* @param page the page number (1-based)
* @param total_items the total amount of items
* @param limit the amount of items to show per page
* @param ajax an array with each of clickrewrite[url|id|form]
* @param url the url the links point to
* @param query_string the string to be appended to url
* @param item name the name of items shown in summary
* @param position whether paginator is on top or bottom of page
* @return pagination string to be placed in html code
*/
function get_pagination_string(
$page = 1,
$total_items,
$limit = 8,
$ajax='',
$target_page = '',
$page_string = '?page=',
$summary_name = 'items',
$placement = 'summary'
)
{
// DEFAULTS
$adjacents = 5;

// HTML
$div_bar = '<div class="bar clearfix %s_bar">';
$display = '<div class="summary">Displaying %d-%d of %d %s.</div>';
$ul = '<ul id="pag_nav_links" class="pagerpro">';
$link = '<li><a href="%s%s%s">%s</a></li>';
$current_link = '<li class="current"><a href="%s%s%s">%s</a></li>';
$ajax_link = '<li><a href="#" clickrewriteurl="%s&page=%s" clickrewriteid="%s" clickrewriteform="%s" clicktoshow="%s">%s</a></li>';
$current_ajax_link = '<li class="current"><a href="#" clickrewriteurl="%s&page=%s" clickrewriteid="%s" clickrewriteform="%s" clicktoshow="%s">%s</a></li>';
$ul_close = '</ul>';
$div_close = '</div>';
$div_font = '<div style="font-size:11px;">%s</div>';


// VARS
if(substr($page_string, 0, 1) != '?')
$page_string = '?' . $page_string;
if(substr($page_string, strlen($page_string) - 5) != 'page=')
$page_string .= '&page=';
$prev = $page - 1;
$next = $page + 1;
$firstpage = 1;
$lastpage = ceil($total_items / $limit);
$fiop = ($limit * $page) - $limit + 1;
$liop = min($limit * $page, $total_items);

// DRAW PAGINATOR

// the footer paginator has no summary and the current page has a different gfx
$type = ($placement == 'summary') ? 'summary' : 'footer';

$pagination = sprintf($div_bar, $type);

// Draw summary
if($placement == 'summary')
$pagination .= sprintf($display, $fiop, $liop, $total_items, $summary_name);

if($lastpage > 1)
{
$pagination .= $ul;

// First page selector
if ($page > 2)
{
if(!empty($ajax))
{
$pagination .= sprintf(
$ajax_link,
$ajax['rewriteurl'],
$firstpage,
$ajax['rewriteid'],
$ajax['rewriteform'],
$ajax['loadingimg'],
'First');
}
else
{
$pagination .= sprintf(
$link,
$target_page,
$page_string,
$firstpage,
'First');
}
}

// Previous page selector
if ($page > 1)
{
if(!empty($ajax))
{
$pagination .= sprintf(
$ajax_link,
$ajax['rewriteurl'],
$firstpage,
$ajax['rewriteid'],
$ajax['rewriteform'],
$ajax['loadingimg'],
'Prev');
}
else
{
$pagination .= sprintf(
$link,
$target_page,
$page_string,
$firstpage,
'Prev');
}
}

// Page selectors
if ($page < 4)
{
for ($counter = 1; $counter <= min(5, $lastpage); $counter++)
{
if ($counter == $page)
{
if(!empty($ajax))
{
$pagination .= sprintf(
$current_ajax_link,
$ajax['rewriteurl'],
$counter,
$ajax['rewriteid'],
$ajax['rewriteform'],
$ajax['loadingimg'],
$counter);
}
else
{
$pagination .= sprintf(
$current_link,
$target_page,
$page_string,
$counter,
$counter);
}
}
else
{
if(!empty($ajax))
{
$pagination .= sprintf(
$ajax_link,
$ajax['rewriteurl'],
$counter,
$ajax['rewriteid'],
$ajax['rewriteform'],
$ajax['loadingimg'],
$counter);
}
else
{
$pagination .= sprintf(
$link,
$target_page,
$page_string,
$counter,
$counter);
}
}
}
}
elseif ($page > $lastpage - 3)
{
for($counter = $lastpage - min(5, $lastpage);
$counter <= $lastpage;
$counter++)
{
if ($counter == $page)
{
if(!empty($ajax))
{
$pagination .= sprintf(
$current_ajax_link,
$ajax['rewriteurl'],
$counter,
$ajax['rewriteid'],
$ajax['rewriteform'],
$ajax['loadingimg'],
$counter);
}
else
{
$pagination .= sprintf(
$current_link,
$target_page,
$page_string,
$counter,
$counter);
}
}
else
{
if(!empty($ajax))
{
$pagination .= sprintf(
$ajax_link,
$ajax['rewriteurl'],
$counter,
$ajax['rewriteid'],
$ajax['rewriteform'],
$ajax['loadingimg'],
$counter);
}
else
{
$pagination .= sprintf(
$link,
$target_page,
$page_string,
$counter,
$counter);
}
}
}
}
else
{
for($counter = $page - 2; $counter <= $page + 2; $counter++)
{
if ($counter == $page)
{
if(!empty($ajax))
{
$pagination .= sprintf(
$current_ajax_link,
$ajax['rewriteurl'],
$counter,
$ajax['rewriteid'],
$ajax['rewriteform'],
$ajax['loadingimg'],
$counter);
}
else
{
$pagination .= sprintf(
$current_link,
$target_page,
$page_string,
$counter,
$counter);
}
}
else
{
if(!empty($ajax))
{
$pagination .= sprintf(
$ajax_link,
$ajax['rewriteurl'],
$counter,
$ajax['rewriteid'],
$ajax['rewriteform'],
$ajax['loadingimg'],
$counter);
}
else
{
$pagination .= sprintf(
$link,
$target_page,
$page_string,
$counter,
$counter);
}
}
}
}

//next button
if ($page < $lastpage)
{

if(!empty($ajax))
{
$pagination .= sprintf(
$ajax_link,
$ajax['rewriteurl'],
$next,
$ajax['rewriteid'],
$ajax['rewriteform'],
$ajax['loadingimg'],
'Next');
}
else
{
$pagination .= sprintf(
$link,
$target_page,
$page_string,
$next,
'Next');
}

}

//last button
if ($page < $lastpage - 1)
{
if(!empty($ajax))
{
$pagination .= sprintf(
$ajax_link,
$ajax['rewriteurl'],
$lastpage,
$ajax['rewriteid'],
$ajax['rewriteform'],
$ajax['loadingimg'],
'Last');
}
else
{
$pagination .= sprintf(
$link,
$target_page,
$page_string,
$lastpage,
'Last');
}
}
$pagination .= $ul_close;
}

$pagination .= $div_close;
$pagination = sprintf($div_font, $pagination);

return $pagination;
}


Again, all credits go to the developer of the original source code. Thanks a lot for sharing.

Thursday, July 31, 2008

missing something...

I think I'm exhausted... but hey, I'm still trying to write a blog post. It is the matter of perspective; If someone thinks that an exhausted person can't write a blog post because he is exhausted; then fine, that is their perspective.

According to my current perspective I'm exhausted.

Most of the time I spend the day in front of my computer. Trying to learn things, trying to make things better, and I do all these things with a passion..! then why am I getting exhausted ? Definitely I'm missing something.

Recently a stranger asked me what the best day of my life was. I really couldn't give a straight answer to that question. The question itself made me uncomfortable because it was the first time someone asked me that kind of a question. Besides I might not really have an answer. :P

So my weirdness made the stranger to react, this time it was an explanation to my silence though I expected another question. ;) "You might haven't had any close friends for a long time", the stranger sounded.

Ahem... I do have friends :P but are they suppose to ask me questions like that.? If so, don't try to ask me the same question again.. try something new. lol.. The point is I never asked that question from someone else either.

No doubt, technically I'm missing something. Not the carrot, not the iPod, not the porn.

--------------------------------------------------------------------------------
   "So do all who live to see such times. But that is not for them to decide.
   All we have to decide is what to do with the time that is given to us."
						- Gandalf. ~Lord of the rings.
--------------------------------------------------------------------------------