Friday, February 5, 2016

Moved to a new Site.

Hi all,

I have moved my blog to shelan.org. wanted to explore something new therefore, I changed my site to a static site with the help of hugo.

New blog is at :




Thursday, April 9, 2015

How to make your presentation effective - 10/20/30 rule




 Have you ever presented yourself in front of an audience ? Then you may have use slides for your talk to make it better.

But did it really improve or destroy your talk?

 Lets find out few facts that may be things you will not like to see if you are in an audience. Because that is the best place to give a verdict about a presentation.

Here are few common errors that i have observed in the presentations which you should avoid. 

1) Too much text in the presentation

How often have we seen the entire wikipedia or at least close to that in slides? Slides are not meant to be read. Believe me if you let the audience read slides you loose attention. You loose some of the audience. Once they are out of your story it is not easy to grab them back.  Maximum 10 words would be ideal. If you can find a single picture which gives the idea at once fantastic use that..

2) Too much slides in the presentation

Do not try to overload the presentation. Usually if have lots of slides then you are at the risk of going out of your time limits.  Be careful not to give lots of ideas in your presentation. Usually i follow a rule of 3. Which means pitch 3 key ideas to the audience and make sure they remember that 3 even after the presentation.

3) Slide formatting.

If you have letters in the slides the text size and the text formatting matters a lot. Text should look great in the presentation screen and not only on your laptop/desktop screen. Use bigger fonts as possible and make sure everyone can see without any effort. Use a proper standard font which looks neat ,well spaced and easy on eyes.

Following video describes a better way to optimize your slides or a good framework. Using 10/20/30 rule.

1) 10 -  slides
2) 20 - minutes
3) 30 - minimum font size.

Just watch this short video and you will understand it better.









Thursday, April 2, 2015

What you should know if you travel in Paris

 I had  a dream to visit Paris , City of love with a breeze of Romance. It is a lovely city to explore lots of things. But if you are a traveller knowing few things i have experience will make your journey much nicer :).


1) If you arrive in Beauvais airport and you need to find a way to go to Paris city center you can get Bus tickets from here. Because Ryan air which is most of the time cheaper will land only in this airport. Most of the people suggest other airports which is near to Paris but if you can spend one extra hour you can land in Beauvais and come to city center by bus. Because it (flight + bus) may be cheaper than some flight options.
2) Paris city metro is little bit complicated but it covers almost all the areas. It may be cheaper to get Paris 10 tickets options which will give you 10 tickets at once at a discounted price.

http://parisbytrain.com/paris-metro-tickets/

3) Get a metro map and correctly identify zones and lanes. Because there are some connecting lanes which can be confusing a bit. And also make sure you are not going through an exit when changing lanes or metros, Because once you do you ticket become void and have to use another ticket. Some routes combine rail and metro and may be cumbersome to find them. So to make things easier i opted only to use metro even though the ticket is valid for both to make my journeys hassle free.

3) You should visit paris by night which is more beautiful than the day time. I am posting few pics below and you can decide :)

4) Louvre is an amazing place to visit. But it takes time to explore since it is massive. Plan to spend at least  5 to 6 hours of the day there. Make sure you check the timetable as they closes the Museum on time
http://www.louvre.fr/en/hours-admission










Monday, March 30, 2015

How does the confidence look like?



"John Carpenter (born c. 1968)[1] became the first millionaire on the United States version of the game show Who Wants to Be a Millionaire on November 19, 1999" [1].


The most important part of the show is the last question where he attempted to claim the final prize. Watch the following video which is too good for being a contestant at his final question for 1 million dollars.



[1] http://en.wikipedia.org/wiki/John_Carpenter_(game_show_contestant)

Sunday, March 29, 2015

How to build Open JDK 9 on Mac OSX Yosemite

I have been struggling lately to find good resources to compile and change OpenJDK. There is a problem with Mac OS Yosemite as it uses Clang as the compiler. But Open JDK 9 builds without a problem. I am adding useful resources here just incase someone finds it useful.

How to build it

1) hg clone http://hg.openjdk.java.net/jdk9/jdk9 jdk9

2) cd ./jdk9

3) bash ./get_source.sh (This will take sometime to download the sources so be patient. May be few hours sometimes)

4) when you try to issue command ./configure you will get the following issue.

configure: error: Could not find freetype! configure exiting with result code 1

5) You need install Xquartz to eliminate the above issue.

6) type make all to build the system. In the make file you can see different options to build the system.

7) Built image will be available usually at at build/macosx-x86_64-normal-server-release/jdk/

If you are trying on Mavericks i could find the following resource which seems to be useful but did not verify whether it actually works 100%


Friday, March 20, 2015

What should you do when your mobile phone is lost?





Have you ever lost your mobile phone in your life? I have lost twice and yes it is not a great position to be. But these two incidents had two different implications. When i lost my first phone it was a nokia phone (N71 to be exact) which was quite a smart phone at that time around 2007. Yes i wanted to find the phone but could not the story was over and life went on. But...  Second time i lost a Nexus 4 which is android.

So what is the big deal?

"Oh my gmail account"

When i sensed for the first time that i have lost my mobile phone the first thing that came to my mind was "oh gosh all my accounts are there". But fortunately i have thought about this topic before i lost this phone so the next steps to be done was obvious to me. I think you might be interesting and you may have better suggestions as well. :)

Three important things

1) Android phone has your email account , If you use gmail as the primary account then you might use gmail for most of other online accounts as well. (Facebook , twitter, ebay so on...)

So if anyone can get hold of it then you are doomed, Because anyone can use forgot my username or password reset features to take control of other account.

2) Android phone has all your data :). In this what google does not back up. I think only your life which cannot be backed up restore later.

3) If your phone is not pin protected or not protected with any other mechanism then you are at the highest level of vulnerability.

So what I should do?

1) Change your email address password immediately. This is very crucial and the most important step

You can check login history here. If there is a recent login just after you
https://security.google.com/settings/security/activity?pli=1

2) You should visit https://www.google.com/android/devicemanager. Using this you can erase your mobile phone data (or in other words do a remote wipe out of data).

This will only happen if the device is online.

If you need to locate the device you need to do it before the wipe out using the same above link.

3) You may register a police complaint at last.

Finding the phone is more important. But for someone who needs to protect data, other accounts and also privacy above mentioned steps becomes vital.

If you have other suggestions please do share in comments :)







Wednesday, February 25, 2015

When should you give up ?


 When should i give up something?



 So you should never give up something until you find something you really want. Yes... Until you find it.. :). We usually draw the give up line on what society believe, Not what we really believe. We often create boundaries on what society believes achievable. Until someone who really believe him or herself step in expand the limits.

We never thought someone could fly until wright brothers flew, We never imagined a world speaking with someone thousand of miles away until Alexander Graham Bell invented the first practical telephone. We may be prisoners of the society unless we brave enough to reach outside.

So When should we give up on something? We should give up on the day we win the game. It seems so simple, obvious but senseless.

Watch the following video if you need to breath a life into what i mentioned.

"It's Not OVER Until You Win! Your Dream is Possible - Les Brown"


Tuesday, February 17, 2015

How to use python BOTO framework to connect to Amazon EC2


 Python Boto framework is an excellent tool to automate things with Amazon. You have almost everything to automate Amazon EC2 using this comprehensive library.

A quick guide on how to use it in your project

1) Configure your EC2 credentials to be used by your application using one of the followings.

  • /etc/boto.cfg - for site-wide settings that all users on this machine will use
  • ~/.boto - for user-specific settings
  • ~/.aws/credentials - for credentials shared between SDKs 

http://boto.readthedocs.org/en/latest/boto_config_tut.html

2) Refer the API and choose what you need to do.

http://boto.readthedocs.org/en/latest/#currently-supported-services

3) Sample code for a simple autoscaler written using Boto framework. You may reuse the code in your projects quickly. This autoscaler spawn new instances based on the spike pattern of the load.

https://gist.github.com/shelan/b4a3f3ed0ccf9b4777e5

Tuesday, February 3, 2015

Perfect Memory.. A Skill developed or a gifted super natural ?

 In the previous post i discussed about the importance of developing a most important gift a human has inside his brain.... the memory.

In this world we have externalized most of the important stuff to external digital world. In a way it has made things evolving faster. We are gathering much more knowledge than earlier. Wait.. Is it knowledge or knowledge pointers?

The most suitable word is knowledge pointers using which we can retrieve knowledge easily. Imagine a world without internet or any other form of knowledge reference. How far can we survive.? We are loosing our capability of retaining information in our brains day by day and making the external storages cost effective at an similar pace.

I am striving to regain that capability if i have lost and see how far i can succeed. Because following video will be one of your eye openers if you are one of the crazy people how would like to travel back to history and master one of the key aspects of a perfect Human being.

This is a Ted talk which you will be fascinated to watch.

"There are people who can quickly memorize lists of thousands of numbers, the order of all the cards in a deck (or ten!), and much more. Science writer Joshua Foer describes the technique — called the memory palace — and shows off its most remarkable feature: anyone can learn how to use it, including him"


Monday, February 2, 2015

Do we need to master memory in Google's Era ?


 If you need any information you just type Google. Simple is n't it? So do we have to bother about memorizing anything this world? Is there a pay back for what you memorize? Can we rely on internet and only just learn how to search and can we be successful?

 I am sure most of the people have forgotten the importance of memorizing things in this information age. But the people who master memorizing things excel more often than people who do not. The simple reason is you can apply only what you know.

As a Software Engineer and as a Masters student in computer science we often think for any problem we can just Google and find answers. But how fast? You may say within seconds you may have thousands of results before you.

But... You need to type go to the first answer and if you are lucky you have a hit.. If not repeat until you find the correct answer. Imagine you have things in memory.... It will not take fractions of a second to retrieve. It will be simply comparing to a cache retrieval to a Hard disk access.

People often think there are lots of information how can we memorize all these things? Yes it is true that in this digital world content is being produced super faster. But you have to be super smart to filter out what is important to you and memorize those things. We often underestimate the capability of retaining information in our brain and lazily forget techniques to master memory.

If you have not read following book is a great source of encouragement as well as a learning tool by a
Memory Champ Kevin Horsley.

Following video is one of his world record breaking videos [Successful World Record attempt in Pi matrix memorization]


Thursday, January 29, 2015

Learning Math and Science - Genius Mind


 Do you think learning math and science is something alien from outer universe ? Do you struggle to solve complex mathematics or science problems? If you keep on adding questions there will be a lot to add on. Because even i have some of those problems in my mind.

I excelled in college and was able to get into the top engineering University in Sri Lanka. At present i am reading for my Masters Degree in Distributed computing in Europe which involve Science and Mathematics heavily.

If you read my post Want to Learn anythin faster was a spark to ignite my habit of learning. Often i was comfortable at Theoretical subjects which needed rote memorization or comprehension. I wanted to understand the reasons so anyone who suffers the same can be benefit of it.  Further there is a common misunderstanding that maths is hard and complex even before attempting to realize the beauty of it.

As Human beings we are computing machines. We can do lot of maths in our head to survive in this world. To measure the distance by contrasting with other objects, Cross a road safely without being hit by a vehicle and the list is endless..So then why we cannot do it in the class room?

I often find the way we approach math and science is wrong. There are several observations that i have made why we think maths is complex.

1) If we relate a story to a problem and try to solve it will be easier than denoting it with x,y or any other mathematical notation. When we have a story we have solid mapping of the problems in our mind so understanding a problem and working towards a solution makes more realistic. Good mathematicians or scientists create problems more vivid in their minds. They live in it as real worlds. Symbols are just notation to express what they understood in common language.

2) In classroom or tests we try to rote memorize concepts. Maths and science is super easy when you understand the fundamentals about it. You need to feel or live with the concepts to solve problems. learning an equation will not give you the ability to solve problems unless it is just a substitution.
If you clearly observe an equation, it is a complete story. It is a story of how incidents of left side will come to a common agreement on your right hand side.

3) Connect what you learn with what you know. Our brain is structured as a web. If you do not want to lose newly learnt concepts you have to link and bind with what you know to avoid loosing them. Isolated memory islands disappears soon. Try to relate to whatever the concept you have really understood and try to construct on top of that. If you find anything hard at once try it repeatably in different ways but always have a break. Our brain needs to digest and it takes time to assimilate.

I am still researching and try to apply those concepts in practice to see how they work in real world. But it has been producing interesting results so far. I find myself learning more complex math or science problem than before as i changed the approach.

I am currently reading this book which is an excellent resource for who wants to develop a "mind for numbers". Happy learning.




Tuesday, November 11, 2014

Handy Mac OSX shortcuts to work with Terminal


Clean up the line: You can use Ctrl+U to clear up to the beginning.

Clean up the line: Ctrl+A Ctrl+K to wipe the current line in the terminal 

Cancel the current command/line: Ctrl+C.

Recall the deleted command: Ctrl+Y

Go at the beginning of the line: Ctrl+A

Go at the end of the line: Ctrl+E

Remove the forward words for example, if you are middle of the command: Ctrl+K

Remove characters on the left, until the beginning of the word: Ctrl+W

To clear your entire command prompt: Ctrl + L

Toggle between the start of line and current cursor position: Ctrl + XX

Source : http://stackoverflow.com/questions/9679776/how-do-i-clear-delete-the-current-line-in-terminal

Sunday, November 9, 2014

How to Remote Debug Standalone Hadoop


  When you run your map reduce applications you may have hiccups here and there and may need to have a look inside. If you need to remote debug rather going through logs and figuring out what went wrong following is the procedure.

I am using Intellij Idea as the IDE but for other IDE's process is similar.

1) In Intellij Idea go to Run > Edit Configuration and then click on "+" . And then add Remote for "Remote Debugging"



2) You will have following window after clicking on Remote. You can change the port you are using for remote debugging in this panel.



3) Open your Hadoop Root folder and navigate to etc/hadoop-env.sh in your editor. At the bottom of the file add the following line. (Make sure to have the port you given for IDE configuration as the address)

export HADOOP_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"


Now you can start hadoop in standalone mode and it will wait until you attach your IDE to debug process to resume.


Saturday, October 25, 2014

How to correct "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)" on Mac OS X


I tried to install mysql using home-brew. Everything was successful But could not connect to the server. Obviously server have not started.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Sigh..

Following command rescued me..

mysqld stop
mysql.server start
I found it in this stack overflow answer.

Saturday, October 11, 2014

How to install Hadoop Standalone / Pseudo Distributed mode 2.X.X on Mac with OS X Mavericks


                                                          Image source: http://www.javacodegeeks.com/2011/05/hadoop-soft-introduction.html

I was searching for a complete tutorial on installing Hadoop on Mac and play around with it. There are resources on installing Hadoop with "HomeBrew" which is the missing package manager in Mac ;). But i do not want to offload all the configuration burden to it as i need to learn this from top to bottom. I played with some and here are the configuration steps i followed.

1) You need to download and extract Hadoop Binary. I used Hadoop 2.5.1 which is the latest at the moment.

http://www.apache.org/dyn/closer.cgi/hadoop/common/

2) Extract the binary and lets called the location as HADOOP_HOME

eg: /Users/user1/software/hadoop-2.5.1

3) Add HADOOP_HOME and JAVA_HOME  as path variables to your system. You can add them to
bashrc or bash_profile.

You can add them by issuing following commands.


$vim ~/.bash_profile

Add following entries and change paths according to your machine's configurations. 


export JAVA_HOME=$(/usr/libexec/java_home)
export HADOOP_HOME=/Users/user1/software/hadoop-2.5.1
export PATH=$PATH:$HADOOP_HOME

and then reload the configurations.


$source ~/.bash_profile
(Follow these steps if you need to run in Pseudo Distributed mode. If you do continue you will have to add input files to the HDFS and then download output files from the HDFS too.)

4) Navigate to HADOOP_HOME and change following files as below.

etc/hadoop/core-site.xml:
<configuration>
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://localhost:9000</value>
    </property>
</configuration>
etc/hadoop/hdfs-site.xml:
<configuration>
    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>
</configuration>

5) Setup passphraseless ssh

Now check that you can ssh to the localhost without a passphrase:
$ ssh localhost

If you cannot ssh to localhost without a passphrase, execute the following commands:

$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
 $ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

(You may need to enable remote-login in system preferences --> sharing if you have not enabled it later to login through ssh.)
6) Starting the Hadoop in Standalone mode.
 
Navigate to $HADOOP_HOME

Format the filesystem:

 $ bin/hdfs namenode -format


Start NameNode daemon and DataNode daemon:

$ sbin/start-dfs.sh



The hadoop daemon log output is written to the $HADOOP_LOG_DIR directory (defaults to $HADOOP_HOME/logs).
Browse the web interface for the NameNode; by default it is available at:

So good luck with all your map reduce jobs. :)

Friday, October 3, 2014

Castle of the Moors(Castelo dos Mouros) - Hill top Medieval Castle

This is another weekend trip as last one. It seems there are plenty of places to be covered in Portugal which is an amazing country with lots of beautiful people and places.

 http://blog.shelan.org/2014/09/cabo-da-roca-western-most-cape-of.html

So all the EMDC students got together for a weekend out. We decided to pay a visit to Sintra without knowing what exactly we would we be going to explore or it would offer. We knew that it had lots of attractions and that was all what we needed to know.

 You can reach there using viva gem card which is valid for Metro and train (My previous blog post explains about it) . We travelled from Alameda to Rossio Metro station and then changed into the train to Sintra. It took around 1 hour to reach there and it was a different city with mountains all around and more green sights. You can see lots of tourists visiting there too.

We thought of going to the Castle of the Moors and then visit other places after that. But we had marginal time even to return. That place was amazing and a worth place to kill your time in the weekend. It took around 2 hours or more to go to the top. We hiked on our own and if you are bit lazy
you can get a Hop on Hop off bus. To be frank we thought that option better too had we known that earlier :). But you will burn some calories (a lot i would say while enjoying the nature) so it is okay if you are settled for it.

There are two castles on the top and one of them was closed (It closes around 4.30 pm after summer) so we had to choose Castle of the Moors which closes at 8.00pm. You need to pay Euro 7.50 per person for the entry ticket. This place was amazing and well maintained. Below pics will proof that to you for sure. You can enjoy a breath taking view from top of the Castle. And this castle was a Medieval Castle which built couple of centuries ago during 8th/9th Century. So it was pretty old one which poses a great historical value too.

On our way back six of us got into two groups due to bad timing and three of us almost lost on the way. Luckily we had Google maps and found a way to Sintra Train station. Luckily
That path was much shorter but steeper than the path we climbed. Ask Google the path he will tell you obviously :).

Enjoy my pics.









Friday, September 19, 2014

Want to learn anything faster ?

 We are in a world with lot of learning opportunities. But how many stuff do we really learn ? What holds us back in learning new things faster?

Learning how to learn is the greatest learning of all. I happened to read interesting reading from this blog [1] which had an amazing link mentioning about a guy who learned MIT 4 year course within 1 year.

It starts with

"My friend Scott Young recently finished an astounding feat: he completed all 33 courses in MIT’s fabled computer science curriculum, from Linear Algebra to Theory of Computation, in less than one year. More importantly, he did it all on his own, watching the lectures online and evaluating himself using the actual exams. (See Scott’s FAQ page for the details of how he ran this challenge.)"

http://calnewport.com/blog/2012/10/26/mastering-linear-algebra-in-10-days-astounding-experiments-in-ultra-learning/

When i was going little bit deeper in the subject i found another useful resource in one of the ted talks about the time it takes to learn a new thing. Amazingly it is only twenty hours :). Yes it is less than a day to acquire a new skill.

But...

You need to do it in four steps. Four simple steps to rapid knowledge acquire.

1) Deconstruct the new skill.

     divide and conquer small chunks of skill in new skill. Because most of the big skills are set of smaller skills

2) Learn enough to self correct.

 He depicts the most common error we do in learning which is trying to learn everything and start practicing later. But Ideally what you should do is to learn the essential or more obvious things so you
can self correct your self.

3) Remove practice barriers.

The most common barrier i can think of is "Facebook" ;)

4) Practice atleast 20 hours.

"The major barrier to learn new thing is not intellectual it is emotional"

So start practicing what you love to acquire..!!!




[1] http://kkpradeeban.blogspot.pt/2012/11/optimism-is-selection-of-nature.html

Wednesday, September 17, 2014

Cabo Da Roca - Western Most Cape of Europe


 It is a new country for me and it is full of new places to travel. Luckily we have one friend at the apartment who knows the area pretty well. So we did not have much trouble in locating the places to visit but if you travel by public transport following information would be useful for you.

  If you are near IST you need to travel from Alameda Metro station to Cais do Sodré station which is at the end of Green line. Then you need to get the Train from Cais do Sodré station to Cascais. To travel up to Cascais you can obtain a travel card from Metro station which covers all 4 forms of transportation including Bus, Metro, Train and Ferry. You have different options but it is better to buy  a viva via gem card if you are a non frequent traveller. It is reusable and reloadable card.


source :http://www.metrolisboa.pt/eng/customer-info/viva-viagem-card

Loading this card with 10 Euros would be enough as we experienced and you can top up it from train stations or metro stations conviniently. It is advisable to keep 5,10 Euro notes as sometimes it will issue receipt for balance which you should claim at train stations if you try to recharge from a train station. Believe me it is a hassle :(.

 You should spend some time at Cascais as it is a beautiful area with lots of tourist and local activities. We stayed there before moving to Cabo da Roca.



                  This was truly a beautiful beach...


From Cascais you need to get 403 bus operated by scottrub. It is usually has one hour frequency. It will go via Cabo da Roca to Sentra and you have to get down from the Cabo da Roca on the way. These buses does not have display boards for the stops but Cabo da Roca is a special stop and you know once you arrive there and just enjoy the breathtaking views out side on the way from the bus. (Believe me it is a special stop ;) )

Cabo da Roca is the western most point of the Europe mainland. You will be surely amazed how picturesque the view is. You will lost in your thoughts for a moment when you reach the top. But make sure not to fall out from the top to Atlantic ocean while taking selfies.. Cos' it is a shame that you cannot tell how magnificent it was to you friends :P












New window just opened ...!

  It has been a week since i have became a student once more in my life. I like the experience of recreating the feelings that i had when i was a student ago two years back. Since now this blog is full of technical content and i did not have much time to blog much about my other experiences. But now this is a new life so thought of doing the same to my blog. Lets see how the new story unfolds...

I am an EMDC ( European Masters in Distributed Computing) student at IST (Instituto Superior Técnico) and KTH (Royal Institute of Technology) in Sweden. This offering is great not only because of the content it offers but the cultural experience you will gain. It is a bonus..

During the first week I was fortunate to visit some of the very beautiful places in Lisbon. I should say the coastal area is really fantastic even though i am coming from a place with full of beaches covering my beautiful island Sri Lanka. I will post more about that place in another post with more details.. and of course with pictures. Till then Just relax with the view out of my apartment...