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 :

http://sourceforge.net/projects/flexformatter/

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."



QFT,

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) { Assert.fail("failed to access setter method: " + method.toString() + " - " + e.getMessage()); } catch (InvocationTargetException e) { Assert.fail("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) {
Assert.fail("failed to access getter method: " + getterName + " - " + e.getMessage());
} catch (InvocationTargetException e) {
Assert.fail("failed to invoke getter method: " + getterName + " - " + e.getMessage());
}
}



basic JUnit test:

@Test
public void testSetterGetter() {
Cat cat = new Cat();
MutatorAccessorInvoker invoker = new MutatorAccessorInvoker(cat);
invoker.invokeSettersAndGetters();
}


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

@Test
public void setAndGetAll() {
MutatorAccessorInvoker mutatorAccessorInvoker = new MutatorAccessorInvoker(new MyGuess());
mutatorAccessorInvoker.invokeSettersAndGetters();
}




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 :

http://www.mediafire.com/?gme9tgtyttz
http://www.mediafire.com/?t1y1tzo3zcm
http://www.mediafire.com/?ugg0hmycgcf
http://www.mediafire.com/?xovz2x1n0wm
http://www.mediafire.com/?wx9mbtmfomg
http://www.mediafire.com/?2gtbheelyau
http://www.mediafire.com/?zynv4jdxyym
http://www.mediafire.com/?mw1obhzmtky
http://www.mediafire.com/?lyzbly0syrl
http://www.mediafire.com/?dnn11m2r2ke
http://www.mediafire.com/?mnkymd9pwfm
http://www.mediafire.com/?k3y240jxngn
http://www.mediafire.com/?kwdgemmx4mm
http://www.mediafire.com/?nf2fmde9zmp
http://www.mediafire.com/?m0hnmymzjrw
http://www.mediafire.com/?jm3m2y3wily
http://www.mediafire.com/?xnscysmmzbm


Mirror:

http://www.adrive.com/public/eebc6d67f5f41b225e22ae26cfbe14044dd2fbce9e50e62b56c86a5736eadc94.html
http://www.adrive.com/public/6a892301907e9a9604289e9dc39e304ef7932e5340e24f57f30f1670936c6b7a.html
http://www.adrive.com/public/af7c3c712b07af12581156445ee3145e3544bdf1b830c9da3e0a9d81f5d7beb7.html
http://www.adrive.com/public/f3d21fb5cfb9ca0a2f8b817a03cfd237c5a9ec49764d77a688bc496b97717e7e.html
http://www.adrive.com/public/272fc5bf56f86f758d391f5a8aff4fb756edf02cddd81db306ae2f31c4eb05c1.html
http://www.adrive.com/public/aa399b353659d62a371c2cb24239828d97b3472bbfd4e7f6ab2c4bccfbf8661a.html
http://www.adrive.com/public/7b1b91da3e2bac6f57817c380a4cd9a6000843f11964fc9fa8a2fce5ac696fb2.html
http://www.adrive.com/public/1c75d1c3ed7401789ec4b73b9e8a882e0d9ca6aa0c4e702503b7a197444eabbc.html
http://www.adrive.com/public/3ed3877ff7210661a6c6e244ad309a864154e08921b631064bc0f6961e933f09.html
http://www.adrive.com/public/69ad9df24493ecf48e8de0a69993fed072b308e289738f37be9dc2a5e70c7823.html
http://www.adrive.com/public/eafc4f6927d8e70a27d850c219bf7c56e1ccbb38928aa8e5e26c23b34a6b41e1.html
http://www.adrive.com/public/7ea9dfc164db0776ad58a7c3dae145f8629ccb435d53e52eac831f41c6d2b041.html
http://www.adrive.com/public/c12e3a1a5fa492d539eb03112ba2126d2ae740010bfcda6c3e81611d08f1246a.html
http://www.adrive.com/public/5653d968b8dc6d8c04e13ac444e14d136400bad4273465e4f87a89517050dab0.html
http://www.adrive.com/public/ce93f7afc7d9d4b414566bbe0ae30e7011191b1d338eff2e4f9b1d434029230a.html
http://www.adrive.com/public/ca2ad64261bf802a48bb30372c514759c78e01d1d0aa8931acc148b6e9f64dec.html
http://www.adrive.com/public/411be0801872549d82132ccd3bcf6332fedec4b2d65f4bf4ff8bfd5d9b850e88.html


Mirror 2:

http://www.mediafire.com/?gxzjaeggvos
http://www.mediafire.com/?1odw3omydoi
http://www.mediafire.com/?mybbnhhoncx
http://www.mediafire.com/?tvfeobyvvny
http://www.mediafire.com/?lvmwinrzwnv
http://www.mediafire.com/?kpmdutjl6nv
http://www.mediafire.com/?wwymtmhptbs
http://www.mediafire.com/?i0vlsxmzsz3
http://www.mediafire.com/?bmtxybxpim1
http://www.mediafire.com/?wrirfuhdjrd
http://www.mediafire.com/?wvrt2mynmbz
http://www.mediafire.com/?zzbbbydjocz
http://www.mediafire.com/?zerbnfubfyh
http://www.mediafire.com/?pmfrlx3ztiq
http://www.mediafire.com/?xyvgbnoyh0y
http://www.mediafire.com/?w4zr6m0eaiw
http://www.mediafire.com/?0gnwqcm5zqm


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 ?