Sunday, September 26, 2010

One Way to Negotiate Salaries.

There are different ways salaries are negotiated. Some companies give you salaries based on the salary at the previous company. Some people can negotiate salaries pretty much independently of their salary history. They go by market; if the market is hot and their demand is high the will ask for a big salary. If they cannot get their base salary high enough they will try to get a big bonus or some other perks such as stock options. But few people negotiate their salaries the following way. It can definitely earn them more, so try it. I definitely will at the next job offer I get.

The idea is to ask for a very low salary in the beginning, lets say just 1 c. Then take double that in the next month, 2 c. This will make HR people very happy although a bit surprised. They are not technical people so they will not dig deeper. So your paycheck will look like :

  1. 1 c First month
  2. 2 c Second month
  3. 4 c Third month
  4. 8 c Fourth month
  5. 16 c Fifth month
  6. 32 c Sixth month
  7. 64 c Seventh month
  8. $1.28 Eighth month
  9. $2.56 Ninth month
  10. $5 Tenth month (Rounding up)
  11. $10 Elventh month (Rounding up)
  12. $20 Twelfth month
So at the end of one year you will be getting a $20 paycheck. But it will be quite different in another year, you will make pretty fat paycheck at the level with the company's CEO, and in another year you will sitting on pretty good fortune and may not have to work anymore. You probably cannot work there anyway as that company will most likely be bankrupt.

Saturday, June 5, 2010

New Way to Write Equals.

This is typical way to write the important equals method in java :

@Override
public boolean equals(final Object object) {
       if (this == object) {
              return true;
       }
       if (!(object instanceof MyClass)) {
              return false;
       }

       // now comes the real comparison of fields, foo, bar, etc.
       }

My idea is to refactor the later part of the comparison to another method :

public boolean equals(final MyClass myClass) {
       // Do the real comparison of fields, foo, bar, here.
}

So the original equals method becomes :

@Override
public boolean equals(final Object object) {
       if (this == object) {
              return true;
       }
       if (!(object instanceof MyClass)) {
              return false;
       }
       return equals((MyClass) object);
}

Benefit of having two equals is obvious, it keeps it simple and clear. In most cases equals will be only called with the object of same class only. In that case, it comes directly to the specific method, so it might be tiny bit faster as the instanceof is not being checked. Also first six lines of the method could be refactored into another method so the equals method
becomes even more compact.

Thursday, April 22, 2010

Do Not Keep Same Password For All System



Recently google was subject of hacker attack. Actually, one friend of mine had it gmail account hacked. He not only lost access to his emails, fraudulent emails were sent to his contacts asking for money. It said he is stuck somewhere in Europe and needs money. I got one of those emails, but I knew it was phishing email and his email was hacked.

It is very usual to have many emails e.g. yahoo, gmail, aol, etc etc these days. It seems convenient also to keep same password for all system as it makes it easy to keep track of. But it can be very dangerous as well. If a hacker gets to know one password, he can gain access to all your emails and you have no way to reset as your backup email will not work either.

So although convenient, it is mandatory to keep different password for different systems. Also it is recommended to change the password every so often.

Friday, April 16, 2010

Uses of Breadcrumbs in Eclipse


Bookmark and Share

   


Eclipse has the breadcrumb feature for a while. It is immensely useful. One can turn it off or on by pressing Alt-Shift-B. It's main purpose is, of course, easy navigation. It makes it easy to navigate to different packages, classes or project without opening the package explorer view which takes up valuable space. But that is not the only use. Other uses are :
  1. Quickly go to the beginning of a class. If you are in the middle of a long class and you want to go to the beginning of the class. To do this, just type Alt-Shift-B and which will put the focus on the breadcrumb and use the left arrow key to highlight the class names and hit enter.
  2. Quickly go to other methods in a class. If you are in the middle of long class which has many methods and you want to go to some other method. One way to do it will be to use Ctrl-Shift-Up/Down which will take you to the next of previous method. One can also use Ctrl-O which will show all the methods. Yet another way is to type Alt-Shift-B and use the up/down arrow key to go to the desired method.
  3. Quickly delete a method or the whole class. Before there was breadcrumb one had to go to the package explorer view or the outline view. Not anymore. One can just go to the breadcrumb and hit the delete key now.