Wednesday, December 8, 2010

Einstein’s Riddle

It's a riddle created by Albert Einstein. But the beauty of this riddle is that it doesn't involve physics. You have to just apply your logic.

But he had declared that
"98% of the world population would not be able to solve it"

So do you have guts to try it?

The Riddle:
  1. In a town, there are five houses, each painted with a different color.
  2. In every house lives a person of different nationality.
  3. Each homeowner drink a different beverage, smokes a different brand of cigar, and owns a different type of pet.

The Question:
Who owns the fishes?

  1. The Brit lives in a red house.
  2. The Swede keeps dogs as pets.
  3. The Dane drinks tea.
  4. The Green house is next to, and on the left of the White house.
  5. The owner of the Green house drinks coffee.
  6. The person who smokes Pall Mall rears birds.
  7. The owner of the Yellow house smokes Dunhill.
  8. The man living in the center house drinks milk.
  9. The Norwegian lives in the first house.
  10. The man who smokes Blends lives next to the one who keeps cats.
  11. The man who keeps horses lives next to the man who smokes Dunhill.
  12. The man who smokes Blue Master drinks beer.
  13. The German smokes Prince.
  14. The Norwegian lives next to the blue house.
  15. The man who smokes Blends has a neighbor who drinks water.

Note: I did it just by using ms-excel.


Wednesday, November 17, 2010

Batch File - Bulk Renamer

Below is the batch-file code to systematically rename all the files present in the folder according to the given condition.

.: C.O.D.E :.

@echo off&set /a cnt=0
for %%a in (*.jpeg) do call :PROCESS "%%a"
goto :EOF
rename %1 "IMG_%cnt%.jpg"
set /a cnt+=1

.: S.T.E.P.S :.

Step-1: Open a Notepad.
Step-2: Copy the above code and paste it in Notepad.
Step-3: Save the file as "bulk_renamer.bat".
Step-4: Put the bulk_renamer.bat file inside the folder that is having the files which needs to be renamed.
Step-5: Run the bulk_renamer.bat file by double clicking on it.

Note: This batch-file should be present inside the folder where rest of the files that needs to be renamed are present.
Remark: Modify the script and condition as per your requirement.

Tuesday, October 19, 2010

Naming Conventions for common Team's File

Earlier, I'd posted an article Naming Conventions for Flash Designers. In continuation of that idea, here is another efficient way of doing the say job.

According to this method of naming convention, let us first understand how to make a tag.

The tag can be created as <name-intials><number-of-times>. Here name-initials contains the initials of the user's name and number-of-times contains the number of times the user has worked on that file. For example, AK1 for Abhishek Kumar worked for first time, DC5 for Dulani Chandni worked for fifth time, etc.

Now the creater first creates a file and name it as per the tag creation rule. Then another person works over the same file and he'd suffix his tag in the name of that file. Again the creater re-works over that file. This time creater would increment the number-of-times part in his tag-initials. Similarly any other person who'll work on this file will suffix his tag in the filename. So, the filename would have changed like AK1 > AK1DC1 > AK2DC1 > ...

Hence, this method is suitable to handle team's work over the top of another and keep track of latest version.

Code of Ethics from Superstitious Beliefs!

Have you ever wondered how normal events turn into superstition or moral codes?

Here is a short story by Paramahamsa Nithyananda.

In an ashram in India, its master used to hold his puja worship every morning. Now, the master had a pet cat. The cat was very curious and used to jump and play around. It got in the way of the master and his disciples during the daily worship. It never allowed them to finish their worship peacefully.

Gradually the cat, in all its playfulness, became a big nuisance. The master had grown quite fond of the cat and did not want to get rid of it. Since he did not want his daily worship disturbed, he asked his disciples to cover the cat with a basket before he began the worship.

That day, the worship was peaceful. The master asked his disciples to continue the same way next day. Covering the cat with a basket during their daily worship soon became a part of their routine.

Unexpectedly one day the master died. The disciples continued the tradition established by their master. They began their daily worship by covering the cat with a basket. Soon after, the cat too died. Now, the disciples faced a big dilemma. How could their worship be complete without covering the cat with a basket? They got another cat and subjected it to the same treatment.

After a few days, the cat escaped. The disciples now had another job of catching cats for the ashram. Soon, all cats in neighbourhood moved away. The disciples found it harder and harder to get a cat to cover with a basket for their worship. How to worship without a cat? It was sacrilegious even to think of this! Gradually they stopped the worship because there was no cat!

This is how a practice becomes a superstition, and superstitious beliefs takes on its own life to become a binding rule (Code of ethics).

Societal and religious commandments are similar rules. They are like superstitions that have taken lives of their own. When we have no understanding about the roots of the rules that have formed the moral commandments, we will also behave like the disciples in search of a cat.

Be clear. As long as morality is served as a rule as a moral code, we rebel. When morality is enforced, we create two things in our mind. First, we try our best to escape from it. When we cannot, we give in reluctantly. We create a deep guilt in our system when we ignore the rules every time and regret when we comply. Guilt and regret are the worst sins we can commit. When we understand how rules (code of ethics) we created, we create an awareness to either follow or break them, without guilt and fear.

AS3: Override in Actionscript 3

To understand the working of override keyword in Actionscript 3, follow the article.

Create a blank .fla file and name it Main.fla. Then fill in Document class input box, by typing Main in it. This will connect the file with the Main.fla file.

  import flash.display.MovieClip;
   * ...
   * @author Abhishek Kumar
  public class main extends MovieClip
    public function main()
      var oBase:CBase = new CBase();

      var oChild:CChild = new CChild();

      var oClone:CBase = oChild as CBase;

  public class CBase
    public function CBase()
    public function method():void
      trace("CBase -> method");

  public class CChild extends CBase
    public function CChild()
    public override function method():void
      trace("CChild -> method");


CBase -> method
CChild -> method
CChild -> method

Hence, you have seen how the override keyword works in Actionscript 3.

Sunday, August 29, 2010

Long trip over a bike

My younger cousin brother is crazy about bikes. Few weeks back he told me about his plan to visit his hometown. I said "Ok! What's the big deal?". Then he told me "over a bike". Since he is staying in Gurgaon while his hometown is Madhubani, which is around 1250 km from Gurgaon. So after listening this I was like "Oh My God! Are you sure?".

He was quite determined, so I asked about how he'll be going to execute this. But as I guessed he had no plan. Though his excitement was visible over Facebook, as he was asking for suggestions on his wall. Since nobody else has ever did this before, he wouldn't got much suggestion though everyone wished him luck.

Finally he included his friend in his trip. And I sighed as two can better care themselves.

As per their plan, in fact, no-plan they were gone over a trip and to my expectation they finished it well. As he called me about his exciting journey of 2 days. Though I knew they'll do it even though their was some fear like "What if ... ". So it was a big relief to listen the news of reaching safely.

Today I got his complete journey route with the exact time of arrival and departure. I thought it would be good to put it in a blog for reference.

So let's see how did he managed to achieve it.

He has TVS Apache bike.
So finally, 2 people and 1 bike. Quite fair!
They started their journey from Gurgaon at 1:00 pm, by filling Rs.600/- petrol in it.

At 5:00 pm they reached Mathura (140km). The bike was punctured there.
At 6:30 pm he reached Agra (200km). They did their bike servicing over there.

At 8:00 pm they left Agra and after filled petrol of Rs.600/-. Tank full!
At 8:30 pm they reached Tundla.
At 9:30 pm they reached Firozabad.
At 11:10 pm they had dinner at some dhaba in between.
At 3:45 am they reached Itawa.
At 4:45 am they reached Araiya.
At 8:15 am they reached Kanpur. They stayed there.
At 12:00 pm they reached Lucknow. Distance from Kanpur to Lucknow is 70km.
At 6:50 pm they reached Ayodhya. They bathed at Saryu ghat.
At 8:40 pm they reached Haraisa. They had to change their bike tube.
At 10:00 pm they reached dhaba in mid-way. They had dinner there.
At 11:30 pm they left that dhaba.

Until there they had traveled 800 km and reached some basti.
At 1:45 am they reached Gorakhpur (880 km). They stayed for 2 hours.

After 985 km they entered Bihar via Gopalganj.
At 9:00 am they reached Motihari (1080 km).
At 10:15 am they reached Kanti (1135km).
At 10:40 am they reached Muzaffarpur.
At 12:30 am they reached Darbhanga (1208km).
At 2:15 pm they reached MADHUBANI, their destination.

The total distance was 1248 km.
The total petrol cost Rs.1800/-.

Well, I personally think that it would be quite useful blue-print for others.
Anyway, I would like to have comments specially from the riders of long journeys.
So don't forget to put your comments or link of your blog of similar expedition.

Tuesday, July 13, 2010

App Inventor Versus Scratch

Google has launched it's latest innovative solution for mobile applications.

Now you may think what so special about it?

Well, it is special because now it is not required to be a programmer to develop a mobile application for Android operating system.

With the help of this latest App Inventor, any non-programmer can develop a mobile application.

The idea is quite innovative, as it uses blocks instead of textual code to create an application. Though this idea is not so unique, since another language named Scratch, that is meant for kids, was launched in Dec, 2007 by Lifelong Kindergarten Group at the MIT Media Lab.

Scratch has been developed keeping kids in mind. So it was made to teach programming language to kids in a very simple way. And to make it so, all the complexity have been removed. Hence, the result were blocks of hidden wrapped codes.

It seems that Google has taken this idea further and made it more general purpose. In fact, it looks more useful, if it can be used by non-programmers.

Friday, May 21, 2010

AS3: Function to resize an image

* Function to resize an image
function resizeImage (id, ReqWidth, ReqHeight)
  id.scaleX = 1;
  id.scaleY = 1;
  var OriginalW:Number = id.width;
  var OriginalH:Number = id.height;
  var new_width:Number = 0;
  var new_height:Number = 0;
  if (OriginalW<=ReqWidth && OriginalH<=ReqHeight)
    new_width = OriginalW;
    new_height = OriginalH;
    if (OriginalW>ReqWidth)
      new_width = ReqWidth;
      new_height = Math.floor(OriginalH * (ReqWidth / OriginalW));// 149*(119.30/149) = 83.51
      if (new_height > ReqHeight)
        new_width = Math.floor(new_width*(ReqHeight/new_height));
        new_height = ReqHeight;
    else if (OriginalH>ReqHeight)
      new_width = Math.floor(OriginalW*(ReqHeight/OriginalH));
      new_height = ReqHeight;
      if (new_width>ReqWidth)
        new_width = ReqWidth;
        new_height = Math.floor(new_height*(ReqWidth/new_width));
  id.width = new_width;
  id.height = new_height;


Tuesday, March 2, 2010

About Aloe Vera ...

Top 10 reasons to drink aloe vera gel

  • Dental health and hygiene
  • Provides rapid soothing
  • Aids in healthy digestion
  • Immune support and function
  • Regulates weight and energy levels
  • Collagen and elastin repair
  • Daily dose of minerals
  • Daily dose of vitamins
  • Anti-inflammatory properties
  • Body “building blocks”


What does aloe vera do?

  • Supports internal cleansing and digestive health
  • Soothes the digestive system
  • Boosts the immune system
  • Dispose toxins from the body
  • Facilitate digestion
  • Activate blood & lymphatic circulation
  • Helps to remove toxins accumulated in the body
  • Alleviates arthritic and rheumatic pains


Different uses of aloe vera

  • Burns, irradiation, sunburns, minor wounds
  • Liver infections
  • Stomach and intestines
  • Arthritis, rheumatism, back-pain
  • Dermatology
  • Allergies
  • Hygiene and cosmetics
  • Skin care
  • Scalp and hair care
  • Mouth and teeth care


13 ways aloe vera can help you

  • Helps heal wounds
  • Supports surgical recovery
  • Soothes burns
  • Minimizes frostbite damage
  • Screens out radiation
  • Heals psoriasis lesions
  • Eases intestinal problems
  • Reduces blood sugar in diabetes
  • Reduces arthritic swelling
  • Curtailing HIV infection
  • Nutritional support for HIV patient
  • Stimulates immune response against cancer
  • Benefits lung cancer


Principal characteristics of aloe vera

  • Pain inhibitor
  • Anti-inflammatory, anti-allergenic
  • Healing action
  • Keratolic action
  • Antibiotic action
  • Anti-microbial activity
  • Anti-viral activity
  • Anti-fungal activity
  • Cell regeneration (skin cancer)
  • Energizer and no side effects
  • Digestive
  • Dentistry
  • Beauty care
  • Detoxification = elimination + regeneration + assimilation
  • Rehydration of the skin
  • Nutritional
  • Natural cleanser
  • Fights irritations
  • Dilates vessels
  • Great vehicle of transportation


Properties of aloe vera

  • Adaptogen
  • You don’t have to be ill to take it
  • Anti-ageing
  • Anti-inflammatory
  • Anti-microbial
  • Anti-oxidant
  • Cancer and the immune system
  • Detoxifying agent – not a purgative
  • Digestive function
  • Healing agent
  • Heart conditions
  • Moisturizer and cohesive agent


Aloe vera improves the quality of life

  • Aloe vera = nutrition + energy + detoxification
  • Detoxification = elimination + regeneration + assimilation

My first self-review of my performance & work in my first job

Below is my email that I'd emailed to my Boss before my first performance review and it was before I got permanent in the G-Cube Solution. It was my first survey of my performance & work to show it to my Boss on 24th May 2007. After reading this email my boss was surprised because nobody (no employee) had ever done this type of work in his life. My boss Kapil Sir with another director Ankit Jain (Hr head) talked to me about this email and many other things with that. The reaction I'd got was just amazing. Have a look at my email that is given below:

I’ve asked people about the cases when someone out of their colleagues got promotion or salary hike then what happened, what type of problems they faced, what was the reaction of their colleagues, etc., before I’d joined the company. And on the basis of those cases, I have analysed this.


Possible problems arise when someone (an employee, say A) gets promotion or salary hike and if their colleagues do not accept that:-


  • colleagues behaviour changes towards A
  • politics gets a root to grow against A


Probable reason behind these problems:-


  • colleagues have doubt on A’s capability
  • colleagues think that they are more capable than A
  • colleagues think that they are equally capable but haven’t get the chance to show their capability
  • colleagues have done an incomplete calculation about A’s ability/performance on their side


Probable solutions for these problems:-


  • they should know, on what basis A’s got this
  • ask them for their views regarding A’s performance if they know anything regarding this


So, I’ve done a survey.


I showed them (my colleagues) my work and asked for their views and few more questions like:-


  • How was this work?
  • What should be its difficulty level in your view?
  • Can you be able to do this in the same time span?
  • What should I expect in return of this from the company?
  • What would you’ve done if you would be my senior/head?


Their replies can be shown via this table:-






Type of work

Good work

Good work

Excellent work

Difficulty level

I don’t know



Can they be able

I’m not sure

I can

I can’t


You know better

Good hike

Good hike


It can also be shown via this diagram:-

  1. I don’t know
  2. I can but don’t want to devote so much time on R&D
  3. I can’t


So by doing this I’ve made them understand my work and they’ve accepted it too.

As per what you had told me yesterday, I think that the problem is now solved at least for my case.

Algorithm of Luck

Luck = Preparation + Opportunity.

IF (Preparation = NIL) 
   Opportunity = NO USE.

IF (Opportunity KNOCK Your_Door) 
   IF ((You = Hesitate) OR (You != Confident)) 
      You = LOSE
      You = WIN
      You KNOCK Opportunity's_Door.

      IF (Opportunity's_Door = OPEN)
         You ENTER Inside.
         You GRAB Opportunity.
         You BANG Opportunity's_Door
   } WHILE(Opportunity's_Door != OPEN)

There is a new SOS/SOSG code out for chatters

There is a new code out ... just like "lol" or "brb". 

This one is a little different. Plz take a look. It can help u.


You all know how it feels when your talking to someone online and someone is standing behind you lookin at everything you type, especially MOM or DAD. 


To solve this problem, now online chatters have deviced the "code SOS" system.

According to this system,

SOS = Someone Over Shoulder
SOSG = Someone Over Shoulder Gone


Simply type "SOS" when someone is watching over ur shoulder. 

change ur Mode of Talking, 

That way, the other person will know what ur talkin about and start talkin about homework or something irrelevant. 

When they leave, type "SOSG".

change ur Mode of Talking, 

That is, u can now go back to ur normal conversation again. 



Orkut is deleting profiles - Myth busted

Hey you all orkut users, as I've came across many messages that says 'Orkut is deleting profiles' or something like that. So I thought to clarify this problem. As many of the users are afraid of this.


Orkut couldn't delete any of the profile without prior notifications. 

I suggest you to see the link given below:-

This link will show you ' Terms of Service'. As per our habbits, we generally ignore to read these things while registering or opening our account. So now give it a look.

In the 'term and termination' section, 

"... We may terminate your membership immediately at any time, for any reason. ..."

is stated. But they can delete the profile "... who does not receive this scrap ..." is ridiculous. 

If they want to see who are using/not using their account then why don't they look the record. In which it is stated that when a user has last login or have done last scrap/msg.


More over do you think that google will go out of resource...

I don't think so!

But yes, ofcourse they can delete profiles that are not in use for a long time. But under 'term and termination' there is no such statement present. So you can guess what does that mean.

Can a virus attacks via orkut

Guys, r u (orkut users) also getting sick of recieving mails that says "...don't add this particular id to ur frnd list ... it is a VIRUS..." or something like this. 

Then there is a good news for u all. 
Orkut is quite a safe place. 
And there is no way to introduce virus via anybody's profile.

How this Virus Myth came into existence?

Generally, when two guys involve in a feud, then atleast one of them definitely tries to hurt the other one by one or the other way. And guess what's that way? U r right. They broadcast messages like this in their bulletin board. And in orkut they send these types of messages to all of their friends. Sometimes this is not good enough to relief their feudal tension. So they attach a Keyword that is considered like terrorist of the Virtual World ... VIRUS or WORM. And attach a sentence to forward this msg to ur good ones.

Can a virus attacks via orkut?

NO, i.e., a big No. There is no way through which virus can be uploaded in an orkut profile. As there is only attachment service provided is for image and that also support only .jpg, .gif & .png formats with a maximum size limit of 500KB. That also checks if the uploaded file is really an image or any virus is mimicking the image formats. That way u r completely safe. Even now if u r afraid of virus then just do not download any image.

So now u know the reason ... don't be afraid of adding anybody.