Why learn a second language ??

Well, I actually asked this question myself a little too late.
It was too late because, by that time I had was already speaking a bunch of languages.
While there are myriad read reasons as to why someone should be learning a language, ranging from Social interaction benefits to adding a skill to your Resume, I have made an attempt to pen down a few of them which are reasonable.

1. Adaptable in Business/work/study

If you are emigrating to a country or a region due to work/studies knowing local language would help you to communicate with the people around and learn there culture, way of thinking and experience there ways.

2. Socializing with Family/Friends/Relatives

Or if your partner comes from another country/language, it helpy you understand your inlaws, relatives and friends and hence helps you socialize better and have a healthy relationship.

3. Traveling

If you are one of those who love to travel, and feel the Itch very summer to travel to another country or region, then learning the language of the region you travel makes the difference in your travelling experience. It also helps you greatly in making your holidays more comfortable and enjoying the locality.

4.Religion

Interestingly there is also a spiritual reason to learning languages :) . Most of the times, the religion we follow are written in a language which we dont speak  like Arabic, Hebrew, Sanskrit. What could be more cherishing than understanding your own religion in its own language, rather than reading the translated texts, which are unclear and altered to convey the closest meaning at best.

5. Improve cognitive skills

6. Better/New way of thinking,  speaking and writing

“A language that doesn’t affect the way you think about programming, is not worth knowing”.

7. Challenging yourself

For those who love taking a challenge, there couldnt be a better challenge than taking a language to learn.

And the reward stays forever!. Learning a language is a challenge, it takes time, determination, motivation and ability along with lot of mental energy. During the process, you understand yourself better in terms of ability to learn, memorize things, makes you disciplined (if you have structure the learning plan in a certain time) . At the end of it, you come stronger and with a great sense of achievement, which you can boast for rest of your life.

8. To understand Love, Music, History or Art

Every language has its own beauty. While some language are strict with rules (German), others are fun to speak and sing (Spanish).

Language also show how people think and behave. If you love music of a region, or like History of a region, or interested in the Art popular in a region, there can not be greater motivation to learn that language.

9. Better opportunities

Learning a language clearly increase the opportunity to get employed in that geaographical region. Especially if your job has to do something with Public relation, the better you know the language, the greater your opportunities to land up in a lucrative job are.

10. Fun

While majority of people are objective and question the worth of learning a language, there are people out there, who first

plunge into it and have fun with it, without worrying about how they could reap the benefits out of it.

 

Happy learning !

Leave a Comment

Filed under Uncategorized

A sneak peek into the latest edition of Oxford Dictionary

With FIFA world cup rocking the world, summits on climate change, the economic downturn and the current trendz in the internet, so called the social media, people of the world have given birth to many more english worlds.

I have made an attempt to compile few of them here, these are picked from sources like Guardian, trak.in and wiktionary among others.
If you find any more interesting please put in the comment ll be glad to add it up here

vuvuzela – A trumpet-shaped horn, now usually plastic, that produces a loud buzzing sound.

staycation – A holiday spent in one’s home country

bargainous – Costing less than usual , reflets the hot topic of bet-tighting among consumers during downturn

defriend – Remove from a list of friends or contacts on social networking stire

tweetup – Meeting organised via posts on twitter

bromance – Close but not sexual relationship between two men.

buzzkill – 1.Something or someone that spoils an otherwise enjoyable event.
2.A person who attends a social event and occupies his or her time with other activities than those offered at the event

cheeseball – Someone or something lacking taste, style or originality

chillax – Blend of chill out and relax

frenemy – Someone who pretends to be your friend, but is really your enemy.

interweb – Blend of internet and web

wardrobe malfunction – 1. (euphemism) An accidental instance of indecent exposure caused by a fault in someone’s clothing (especially that of a performer) or by an error made while changing this costume.

climate change – the process of trapping and storing carbon dioxide produced by burning fossil fuels

toxic-debt – a debt that has a high default risk, and the rather less snappy quantitative easing: the introduction of new money into the national supply by a central bank.

dictionary attack – An attempt to gain illicit access to a computer system by using an enormous set of words to generate potential passwords

national treasure – someone or something regarded as emblematic of a nation’s cultural heritage

hikikomori – The Japanese word for the acute social withdrawal that occurs in some teenage boys.

paywall – Something that blocks access to a website so that restricted content can be viewed only by paid-up subscribers.

furgling – Act of fumbling in your pocket for key

wurfing – Surfing the web at work

earworm – a catchy tune that frequently gets stuck in your head

nonversation – A worthless conversation among millions of other words.

Leave a Comment

Filed under Uncategorized

OAuth with cakephp Oauth consumer component

OAuth is an open standard for cross site authorization and authentication, what it means is you can authorize a site(consumer of service) to access your profile data in another site (an OAuth service provider) without giving away the login name/email and password.
There is one comprehensive tutorial at hueuniverse

Here is how it works, below is the diagram that illustrate the flow between the consumer site and the service provider.

A service provider is the site with whom you are registered. Yahoo, twitter and google are great examples.
The consumer sites, uses these service to integrate or fetch in you profile from these sites.

The oauth_consumer cakephp component provides you with the essential classes required.
Thanks to Daniel Hofstetter for coming up with this helpful component.
You can download it from here.

oauth_consumer
This class acts like a facade for all the communication between you and the oauth service provider.

For this exercise let us build an application for twitter which tweets on behalf of the user.
You first have to login to twitter and create a new application.
At the end of creating a new application with twitter, you get a key and secret for your application.

To initiate the oauth authorization process,

$consumer  = new oauth_consumer(key, secret);

Second step is to retrieve a request token from the service, step A in the diagram.
you do this by invoking

$request_token = $consumer->getRequestToken(request_token_rul);

you need this request token for requesting the authentication.

Third step is to redirect the user to the twitter and request the authorization, for this you need to redirect the user to twitter with the request token you just acquired

$this->redirect(twitter_oauth);

Ater this step, user sees a login page of the twitter if he has not already logged in, or is asked with a question whether twitter should allow this application to access you personal data.

Once the user authorizes on twitter, twitter redirects the user to the consumer callback url, with the same request token and request_verified id.

At this point, application has the authorization to acces the user’s data, this data is specific to each service provider.

Fourth step is to access the data, you need an access token composed of a key and the secret.
You need the access token for all your requests to access the user data.

$access_token = $consumer->requestAccessToken(access_url, $request_token);

Fifth step is to actually access the twitter data or modify it, depending on the kind of application you have.
In this exercise, let us tweet on behalf of user

$consumer->update($access_token, "hey, just registered with #XYZ applicaiton, this is koool");

The above message will soon appear in your and your followers time line, with the tweet source as XYZ .

Leave a Comment

Filed under Uncategorized

Editing json in linux

Edit json is an amazing package that lets you browse and edit json as though, you are traversing it as folders in an explorer.
There is also prettify_json tools that is packaged into it. With prettify acts as a filter, taking a valid json file and giving yo a well formatted json string.

To install edit_json in Debian based linux distros, just run this

apt-get install edit-json

or if needed
sudo apt-get install edit-json

happy JSONing

Leave a Comment

Filed under Ubuntu, Uncategorized

Continuous Progress bar in GXT

GXT as is the case with all toolkits, has a good collection of UI components.
But these components cannot to used out of the box to solve your problems.
One such is the progress bar in the GXT, when I felt a need to use the progress bar to indicate the progress of the operation being performed,
I quickly googled and found some interesting examples . But it involved calculating the amount of work remaining/done to update the progress.
So I wrote this little extension of the progress bar, which I call Continuos Progress bar, it works pretty much like the Windows Vista progress indicator (unlike Ubuntu’s).
Code is small and self explanatory, so I dont want to bother myself explaining the code, and rather save myself time to catch some sleep :)

Code included here is distributed under Apache v2.0 license, so you can freely modifiy, distribute or make commercial use of the code.

class ContinousProgressBar extends ProgressBar {

 private boolean stopProgress = true;
 private Timer timer;

 public ContinousProgressBar() {
 setBounds(10, 10, 200, Style.DEFAULT);
 timer = new Timer() {
 int counter = 0;

 @Override
 public void run() {
 if (stopProgress) {
 updateProgress(10.0, "");
 return;
 }

 if (counter == 10) {
 counter = 0;
 }

 counter++;
 updateProgress(counter / 10.0, "");
 this.schedule(100);
 }
 };

 }

 public void start() {
 if (stopProgress) {
 timer.schedule(100);
 stopProgress = false;
 }
 }

 public void stop() {
 stopProgress = true;
 }

}

This is how it can be used with start/stop button. Below is a sample EntryPoint for the GWT demonstrating the thing.

public class ContinousProgressDemo implements EntryPoint {

 private boolean stopProgress = true;

 public void onModuleLoad2() {

 ContentPanel cp = new ContentPanel();
 cp.setSize(200, 100);

 final ProgressBar bar = new ProgressBar();
 bar.setBounds(10, 10, 200, Style.DEFAULT);
 final Timer timer = new Timer() {
 int val = 0;

 @Override
 public void run() {
 if (stopProgress) {
 bar.updateProgress(10.0, "");
 return;
 }

 if (val == 10) {
 val = 0;
 }

 val++;
 bar.updateProgress(val / 10.0, "");
 this.schedule(100);
 }
 };
 cp.add(bar);

 final ToggleButton toggle = new ToggleButton("Start/Stop");
 toggle.addListener(Events.Toggle, new Listener<ButtonEvent>() {
 @Override
 public void handleEvent(ButtonEvent be) {

 boolean oldState = stopProgress;
 stopProgress = !toggle.isPressed();
 if (oldState && !stopProgress) {
 timer.schedule(100);
 }
 }

 });
 toggle.toggle(false);
 cp.getButtonBar().add(toggle);
 RootPanel.get().add(cp);
 }

 @Override
 public void onModuleLoad() {

 final ContinousProgressBar contProgress = new ContinousProgressBar();

 final ToggleButton toggle = new ToggleButton("Start");
 toggle.addListener(Events.Toggle, new Listener<ButtonEvent>() {
 @Override
 public void handleEvent(ButtonEvent be) {

 if (toggle.isPressed()) {
 toggle.setText("Stop");
 contProgress.start();
 } else {
 toggle.setText("Start");
 contProgress.stop();
 }
 }

 });
 toggle.toggle(false);

 ContentPanel cp = new ContentPanel();
 cp.setHeading("Continuos progressbar");
 cp.setSize(200, 100);
 cp.setFrame(true);
 cp.add(contProgress);
 cp.getButtonBar().add(toggle);

 RootPanel.get().add(cp);
 }
}

Leave a Comment

Filed under GWT, GXT

Connect your wordpress blog with twitter and yahoo …

I came across one publicize plugin in  wordpress, that helps you promote your blog.

With this you can connect your wordpress account to twitter and yahoo, and once you authorize wordpress to connect to twitter and  yahoo, it automatically tweets your new post in the wordpress.

Needless to say, saving you the time it takes to  punch in even those 140 char !

Happy tweeting the blogging ..

Leave a Comment

Filed under Uncategorized

Installing the 32 bit JDK on Ubuntu AMD64

Few days ago I ran into this problem when trying to run GWT hosted mode browser on the AMD 64 version of Ubuntu 9.0.4.

Here is the problem:

1.GWT Hosted browser doesnt run on 64 bit JAVA, so have JAVA_HOME point to 32-bit JRE.

2.To install a 32 bit jre, run :  sudo apt-get install  ia32-sun-java6-bin

3. This does not solve the problem completely, coz maven and sometime eclipse tries to download tools.jar from sun !

And this tools.jar exists in JDK, what it means is that you have to install the 32 bit JDK on your 64 bit Linux.

No, you dont have any deb package for 32 bit Jdk on 64bit linux, you have to manually download the 32 bit jdk, compile it to a .deb package and isntall it.

In rest of the post I will show you how I have spent half of my day solving this problem.

Follow below steps to install 32 bit JDK for 64 bit linux Ubunutu AMD 64 distro:
1. Download the 32 bit version for linux from sun.java.com, I downloaded the version update 17, and file name is jdk-6u17-linux-i586.bin .
2. We need java-package to create a .deb debian package  from the binary, if you dont have java-package already installed on your machine, download java-package with:
sudo apt-get install java-package

3.Next, create the 32 bit debian package for JDk with the command:
DEB_BUILD_GNU_TYPE=i486-linux-gnu DEB_BUILD_ARCH=i386 fakeroot make-jpkg jdk-6u17-linux-i586.bin

where:

make-jpkg – is the command to create a debian java package,
fakeroot  – run the make-jpkg command as root
make-jpkg generates a .deb package installable on debian base linux distros.
In our case it generates sun-j2sdk1.6_1.6.0+update17_amd64.deb

4. Now is when you can install the 32bit JDK you want with
sudo dpkg -i sun-j2sdk1.6_1.6.0+update17_amd64.deb

5. After this, if you run java from shell, you should be able to see:
amjed@amjed-laptop:/usr/share/man$ java -version
java version “1.6.0_17″
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) Server VM (build 14.3-b01, mixed mode)

6. To select a different version, and to see where the new jdk is installed use update-alternatives ( this needs sudo access):

amjed@amjed-laptop:/usr/share/man$ sudo update-alternatives –config java

As you can see, there are 3 alternatives which provide `java’.

Selection    Alternative
———————————————–
1    /usr/lib/jvm/java-6-sun/jre/bin/java
2    /usr/lib/jvm/ia32-java-6-sun/jre/bin/java
*+        3    /usr/lib/j2sdk1.6-sun/bin/java

Press enter to keep the default[*], or type selection number:

You can anytime switch between the jdk in you machine.

Leave a Comment

Filed under Uncategorized