Friday, February 27, 2009

Career Promotion faster

Some working experience to learn:

1. How you appear is more important than how you perform in your job! Remember to create a professional image all the time; learn what's going on in your industry; speak them up whenever you can.

2. How you communicate is more important than how you do the job.

3. Any job will become a routine, mundane job after some time. You need to stretch yourself to make it interesting. If you can't do it, then quit.

4. Always have some ideas up your sleeve to tell your manager on how to improve things.

5. Take responsibilities when offered, they are the pathway to move up the career ladder.

6. Come at least 5 minutes earlier than the office start time. You can go home on the dot.

7. Be nice with your receptionist / administrative assistants. They run the company.

8. Bad people. They will be everywhere. Know how to handle them.

9. Don't do the works allotted to your colleagues. You tell them how to do and let them do it.

10. Compliment people; Give credits to others. Nice employees leave company not because of less salary, but for the lack of recognition.

Thursday, February 26, 2009

Ubuntu APT deb

for Ubuntu and other Debian-family:

APT = Advanced_Packaging_Tool

sudo apt-get update

sudo apt-get upgrade

sudo apt-get dist-upgrage

sudo apt-get install envyng

sudo apt-cache search envyng

The deb files are stored at /var/cache/apt/archives

sudo dpkg -i xvnkb-0.2.9a-utf_i386.deb

man dpkg

Saturday, February 14, 2009

Eclipse Flex formatting

FlexBuilder cheapest license is around 500$ , and it does not support auto-formatting or Refactoring ?!!

OK, Adobe guys should improve those features fast, since Eclipse community begins to pay attention to Flex and Spring/BlazedDS integration :

Finally found ! No longer pain refactoring with stupid FlexBuilder stuff...

Wednesday, February 11, 2009

Quote for developers

According to Kent Beck, Agile expert and also the creator of Extreme Programming methodology :

"Your organization is going to spend a lot more on somebody - you or somebody else - reading what you're writing right now than they are ever going to spend on you writing it,"

"You're going to read that code yourself 10 to 100 times for every time you write it, so it's worth taking the trouble to make it readable. You're going to modify it five times after you write it the first time, so it makes sense to make it easy to change. And because you can't predict the future, it doesn't make any sense to build a lot of stuff you don't need right away. These are unchanging principles of software development, and nothing about applying the words 'scripting' or 'model driven' or whatever the programming metaphor du jour happens to be changes any of that."


Monday, February 09, 2009

JUnit auto SetGet

Using reflection and generics in Java, you can now automatically test Getters and Setters (accessors and mutators) of your class with JUnit/TestNG.

Of course normally many developers do not bother testing setters and getters, but if your customer insists on high test coverage you will find this auto one is useful to avoid boilerplate code :-) .
And maybe it can help to avoid some nasty bugs (I myself feel ashamed when reading my "sleepy" code, too) !

Some fragments :

public void invokeSettersAndGetters() {
Classextends Object> targetClass = testTarget.getClass();
Method[] methods = targetClass.getMethods();
for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().startsWith("set")) { Class[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length == 1) { Object testValue = testValueFactory.createValue(parameterTypes[0]); try { method.invoke(testTarget, testValue); if (testValue instanceof Boolean) { invokeGetter(targetClass, testValue, "is" + method.getName().substring(3)); } else { invokeGetter(targetClass, testValue, "get" + method.getName().substring(3)); } } catch (IllegalAccessException e) {"failed to access setter method: " + method.toString() + " - " + e.getMessage()); } catch (InvocationTargetException e) {"failed to invoke setter method: " + method.toString() + " - " + e.getMessage()); } } } } }

private void invokeGetter(Class targetClass, Object expectedValue, String getterName) {
try {
Method getterMethod = targetClass.getMethod(getterName);
if (log.isDebugEnabled()) {
log.debug("invoke get method: " + getterMethod.toString());
Object retrievedValue = getterMethod.invoke(testTarget);
Class returnType = getterMethod.getReturnType();
if (returnType.isPrimitive()) {
Assert.assertEquals("return value of " + getterName + " incorrect", expectedValue, retrievedValue);
} else {
Assert.assertSame("return value of " + getterName + " incorrect", expectedValue, retrievedValue);
} catch (NoSuchMethodException ignore) {
// ignore if getter does not exist
if (log.isDebugEnabled()) {
log.debug("getter does not exist: " + getterName);
} catch (IllegalAccessException e) {"failed to access getter method: " + getterName + " - " + e.getMessage());
} catch (InvocationTargetException e) {"failed to invoke getter method: " + getterName + " - " + e.getMessage());

basic JUnit test:

public void testSetterGetter() {
Cat cat = new Cat();
MutatorAccessorInvoker invoker = new MutatorAccessorInvoker(cat);

Full credit of this invoker should belong to Koert Zeilstra , however you should see that his class can be improved ;-) .

public void setAndGetAll() {
MutatorAccessorInvoker mutatorAccessorInvoker = new MutatorAccessorInvoker(new MyGuess());

Have fun,

Friday, February 06, 2009

Aptech VN books

Dưới đây là link tải bộ ACCP 7.1 , tài liệu chính mới nhất của các học viện Aptech VN, được chia thành 17 phần :


Mirror 2:

Enjoy !

Wednesday, February 04, 2009

Payment negotiation tips

=== Before negotiation===

- Delay salary negotiations for as long as possible in the hiring process

- Find out who really has the authority to negotiate salaries in the company

- Know exactly what your salary requirements are

- Do your homework (preparation) before negotiating the job offer: know your competitive market value, know your company-value (current market salary data, your performance evaluations and letters of recommendation, ...)

=== Negotiation ===

- Start the actual negotiations by thanking the employer for the job offer and restating your interest in the position and company.

- Stay positive and remember that a negotiation is about listening to each other and respecting the needs of both parties.

- Start with negotiating your basic salary first and then move on to the benefits, one element at a time.

- Begin at the TOP of your pre-determined salary range (Research often shows a strong link between people's aspirations and the outcome of the negotiations)

- Structure your salary negotiations around the value you bring to the position and company and AVOID mentioning what you need or feel you deserve to be paid.

- Weigh the financial value of the benefits offered as part of your gross income (may add up to 30% of the total compensation).

- Be aware when the final offer has been reached: Get the final offer in writing. (A legitimate offer should be given in writing and if the employer is reluctant to do this it is a major red flag that there is something wrong)

=== After negotiation ===

- As after speciality interview and looking for offer letter, just prepare and get ready for other opportunities, don't wait! And if the employer does not respond after 2 weeks, you should apply others and forget that employer (even when they offer your expected income later) .

- Prepare your job offer acceptance letter: thank the employer, state the full job title, formally accept the job offer, clarify your employment conditions, highlight your appreciation and enthusiasm for the opportunity .

- Polish your skills and prepare essential things (scripts, directory structure, libraries, pen-box, cup, bag, etc...) so that you will set up your environment in new workplace quickly.

Good luck :-) ,

Sunday, February 01, 2009

JUnit mock frameworks

The main reason for using mock objects to write unit tests is so that they are unit tests. Without mock implementations, unit tests quickly become integration tests, which are much more costly and time-consuming.

Here is my ranking list for Java mock frameworks (supporting JUnit, TestNG) :

1/ PowerMock

2/ EasyMock

3/ Mockito

4/ FEST-mocks

5/ jMock

Which is the best mock framework to you ?