Thursday, August 25, 2011

Calling Android Resources Dynamically by passing String names

Suppose you have 3 types of resources (String, Drawable and Raw) for 50 kinds of animals like the following:

And suppose you want just 3 resources (String, Drawable and Raw) to be loaded for the ONE specific animal which the user will choose ONE at a time - that's gonna be like 50 if-else conditional statements with 3 resource definitions each = 150 lines of code.

With the following example, you can reduce it down to just about 36 lines of code to do exactly that.

Wednesday, August 24, 2011

Calling Java methods dynamically by passing a String of the method name

Imagine you have 99 distinct methods:
  • method1()
  • method2()
  • method3()
  • method4()
  • ...
  • ...
  • ...
  • method99()
and each of these methods are distinct methods with distinct functionality which will be executed for the 99 distinct return values of your getID() method.

So typically you would have to write 99 if-else condition statements. What if you could simply do the same thing in one line instead of defining 99 if-else condition statements.
call_method ("method" + getID());
The following code snippet is a simple tutorial of how to use STRING parameters for calling methods dynamically in java.

Friday, August 19, 2011

Enable Icons, "Open in Terminal", "Open as Administrator" in ubuntu context menus

This article describes how to add some useful extensions to your context menu on Linux ubuntu...


Usually in ubuntu, you don't get to see "icons in the context menu items" like the following.
To enable this in the context menu like above, execute the following in terminal:
gconftool-2 --type bool --set /desktop/gnome/interface/menus_have_icons true


Monday, August 1, 2011

10 for women to be safe in the society

and this landed into my inbox from my dear friend 
Tasfia Rahman


In daylight hours, refresh yourself

of these things to do in an emergency situation...

This is for you, and for you to share with your wife,

your children, & everyone you know.

After reading these 9 crucial tips,

forward them to someone you care about.

It never hurts to be careful in this crazy world we live in.

1.Tip from Tae Kwon Do :

The elbowis the strongest point

on your body.

If you are close enough to use it, do!

2. Learned this from a tourist guide.

If a robber asks for your wallet and/or purse,

DO NOT HAND IT TO HIM

Toss it away from you....

Chances are that he is more interested

in your wallet and/or purse than you,

and he will go for the wallet/purse.

RUN LIKE MAD IN THE OTHER DIRECTION!

Thursday, July 28, 2011

Thank GOD some one finally thought about it! :))

Thank GOD some one finally thought about  it! :)) 
- Yet another forward mail that landed in my inbox
DISCLAIMER: pictures used in this post are NOT my Intellectual Property; these are pictures which this forward mail came with.
========================================

I think everyone might have read about Mom's, Wife's and Girl's... 
 
Its time to learn something abt Men...
 
Who is a boy / man ?
 
 A boy/man  is one of the most beautiful creations of God.
 

 
He starts compromising at very tender age. He sacrifices his chocolates for his sister.
 
     
 
 
 
Later he sacrifices his love for just a smile on his parents face. He sacrifices his love for his wife and children by working late nights.
 
 

 
 
He builds their future by taking loans from banks and then repaying them for the life time. Thus he sacrifices full youth for his wife and children without any complain.
 
 
   
 
Believe me he struggles a lot but still has to hear the music (scolding) of Mother, wife and his boss. Yet every mother, wife and boss tries to have control over him.
 
 
 
                                       
 
 
Finally his life ends up by compromising for others happiness. He is that creature of God who no one can compete with.
 
 
   
 
Respect every boy/man in your life. You will never know what he has sacrificed for you.
 
 
 
 
 
Just extend your hand when he needs it and you shall receive twice love from him.
 

 
 
Enough Of Girls /women / Wife Emotional Mails Now…  Boys also Have Emotions and respect it.  PEACE  
 
If you are a man be proud and if you are a girl kindly forward to the men/women so that they can understand what you have understood J