Monday, June 16, 2014

Tar + Gzip tooltip

Tar is used to combine the files together and Gzip is used to compress and uncompress the files.

Here is an example of its usage:

To create a tar file we can use the below lines:
$tar -cvf test.tar filesToBeCombined

To compress the tar ball we can use :
$gzip filesToBeCombined.tar

Thursday, July 25, 2013

Spring 3 + Quartz 1.8.6 scheduler example


This is a very concise and simple example of implementing Quartz Jobs via Spring. Thanks !

http://www.mkyong.com/spring/spring-quartz-scheduler-example/

Tuesday, June 11, 2013

21 tips for productivity (Worth to try!)



1. Check emails in the afternoon. Use the morning for important work when you have more energy!
2. Stop waiting for perfect conditions
3. Big brave goals release energy
4. Mess creates stress
5. Sell your TV
6. Say goodbye to energy sapping vampires. Avoid negative people!
7. Make good habits such as when you do sports
8. Get up early
9. Don't do so many meetings
10. Don't say yes to every request
11. Outsource everything at which you're not the best in the world
12. Stop multi tasking
13. Get fit
14. Work out twice a day. 2 energy boosters!
15. Drink more water
16. Work in 90 minute blocks
17. Write a stop doing list
18. Use your commute time
19. Be contrarian
20. Right first time
21. Get lost! Have zero interruption focus time

Thursday, February 28, 2013

How to set root password on Amazon EC2 instance

The default Amazon Linux EC2 instance does not allow root user login.
Use this first:
-sudo !!

or the traditional way
-sudo passwd root
and set the root password, then su - to get to root.

Monday, September 3, 2012

How to add xml resources in package using maven

By default maven does not include any files from "src/main/java" (${sourceDirectory} variable). You have two possibilities (choose one of them):
  • put all your resource files (different than java files) to "src/main/resources" - recomended
http://stackoverflow.com/questions/9798955/with-maven-clean-package-xml-source-files-are-not-included-in-classpath

Wednesday, May 30, 2012

String pool management summary

package testPackage;
class Test {
public static void main(String[] args) {
String hello = "Hello", lo = "lo";
System.out.print((hello == "Hello") + " ");
System.out.print((Other.hello == hello) + " ");
System.out.print((other.Other.hello == hello) + " ");
System.out.print((hello == ("Hel"+"lo")) + " ");
System.out.print((hello == ("Hel"+lo)) + " ");
System.out.println(hello == ("Hel"+lo).intern());
}
}
class Other { static String hello = "Hello"; }

and the compilation unit:

package other;
public class Other { static String hello = "Hello"; }

produces the output:

true true true true false true

This example illustrates six points:

  • Literal strings within the same class in the same package represent references to the same String object.
  • Literal strings within different classes in the same package represent references to the same String object.
  • Literal strings within different classes in different packages likewise represent references to the same String object.
  • Strings computed by constant expressions are computed at compile time and then treated as if they were literals.
  • Strings computed by concatenation at run time are newly created and therefore distinct.

Wednesday, April 11, 2012

Ant reset property value

Ant works with "first setter wins principle"  Ant properties accept the FIRST setting of the property as the definitive one. Thereafter, future attempts to set the property will be ignored. Properties therefore are not variables, but more like manifest constant definitions.