Powered By Blogger

Sunday, November 27, 2011

SQL Basic Syntax

SELECT:
1. SELECT col1, col2, col3 FROM tablename 
2. SELECT DISTINCT col FROM tablename
3. SELECT COUNT(col) FROM tablename
4. SELECT col FROM tablename WHERE col = value
5. SELECT col FROM tablename WHERE col1 = value1 AND col2 = value2
6. SELECT col FROM tablename WHERE IN (value1 AND value2)
7. SELECT col FROM tablename WHERE BETWEEN (value1 AND value2)
8. SELECT col FROM tablename WHERE col LIKE '%value%'
9. SELECT col FROM tablename ORDER BY col

UPDATE:
1. UPDATE tablename SET col value2 WHERE col value1

DELETE:
1. DELETE tablename WHERE col = value

Thursday, November 24, 2011

Get the Current Time

import java.util.Calendar;
import java.util.Date;




public class GetTheCurrentTime {
  public static void main( String[] args ) {
    // one way
    long currentTimeInMillis = System.currentTimeMillis();
    Date today = new Date( currentTimeInMillis );
    System.out.println( today );


    // another way
    Calendar cal = Calendar.getInstance();
    today = cal.getTime();
    System.out.println( today );
  }
}

Wednesday, November 23, 2011

Eclipse SVN Plug-in

If you're using Eclipse 3.6, just use the following link for installing new software.
http://subclipse.tigris.org/update


But If you're using 3.7 Indigo version, use the other one then.
http://subclipse.tigris.org/update_1.6.x

Tuesday, November 22, 2011

m2e Compiler J2SE-1.5 Warning Message

I got the warning message as below while developing m2e project:


"Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment."


Simple way to solve this problem is to add JRE System library in Java build path.
Preferences->Java->Installed JREs->Add


Or go  Preferences->Java->Compiler
to change JDK Compliance to 1.6
However, this will all back to 1.5 if execute maven -update project configuration. Therefore, the best way is to modify the file "maven-compiler-plugin.pom", that is located in
C:\Documents and Settings\xxx\.m2\repository\org\apache\maven\plugins\maven-compiler-plugin\2.3.2


  <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.1</version>
          <configuration>
            <source>1.6</source>
            <target>1.6</target>
          </configuration>
  </plugin>
Then, the warning message should be fixed!