Wednesday, August 31, 2011

Oracle time/date format

Date or time in Oracle are not always displayed in the format you want.
In order to change this:


ALTER SESSION SET NLS_DATE_FORMAT = 'DD/MON/YYYY HH24:MI:SS';
select sysdate from dual;

From then, your session will display the date in the desired format.
For more details on the format syntax:


Here's an example of select dealing with Date format, for select with from and to date


select * from OPBI.prodapp_gen_machine_stats where 
hostname = 'sew3'  and collection_timestamp between to_date('2011/10/02 08:00:00' ,'yyyy/mm/dd hh24:mi:ss') and to_date('2011/10/05 20:00:00','yyyy/mm/dd hh24:mi:ss') order by collection_timestamp


Sunday, November 7, 2010

Adding XML to Javadoc comments

Copied from http://blog.smartkey.co.uk/2008/08/adding-xml-to-javadoc-comments/


Problems with adding comments

Inserting code snippets into Javadoc comments that read well in both the source code and the HTML files produced by Javadoc can be a very fiddly process. Inserting XML snippets into your documentation can make this trickier still. Read on to discover a simple technique that works equally well with both Java and XML code snippets in your Javadocs.


....

/**
* <p>This class should be used as follows:</p>
* <pre>
* {@code
* <bean>
* <property name="propName" value="propValue"/>
* </bean>
* }
* </pre>
*/
public class MockObject {
...

}

Wednesday, January 13, 2010

Very good tutorial introduction to GridGain

Good introduction to Cloud Computing using GridGain.
Very clean, clear ...

From Nikita Ivanov:

"Grid Application in 15 Minutes"
- GridGain - Cloud Development Platform > Screencasts (wyƛwietl w Google Sidewiki)

Wednesday, July 11, 2007

autoexec.bat example

Instead of defining those variables in the MyComputer/Properties/Advanced/EnvironmentVariable menu, just define them in the C:/autoexec.bat file .


set JAVA_HOME=c:\sdk\jdk_1.6.0
set CYGWIN_HOME=C:\dev\frag\bin\win32\cygwin\
REM set CYGWIN_HOME=C:\sdk\cygwin\
set HOME=c:/home/michaelz
set ANT_HOME=c:\sdk\apache-ant-1.6.5\

REM for some reason, I could split this line in several lines ...
REM set PATH=%CYGWIN_HOME%\bin;%PATH%
REM set PATH=%YOUR_KIT%;%PATH%
Publish Post
PATH=%JAVA_HOME%\bin;c:\sdk\cmd;%CYGWIN_HOME%\bin;%ANT_HOME%\bin

Tuesday, July 3, 2007

Read User Input

Here's a simple way to read user input from the standard input (stdin) console:


/**
* Display the given prompt and return the text types by the user (after his first Enter)

* @param prompt text to write in the stdout. Generaly used for asking the user to type something.
* @return userInput - text given by user in the console (stdout)
*/
public static String readUserInput(String prompt) {
System.out.println(prompt + " ( Type to confirm.) ");

BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
String userInput = "";
try {
userInput = bufferedReader.readLine();
if(log.isInfoEnabled()) {
log.info("Thanks ! ");
}
} catch (IOException ioe) {
log.error("Unable to read user input, Exception : " + ioe.getMessage());
}
return userInput;
}

JVM arguments

  1. JConsole
    Enable jconsole by adding the following:
    -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7091 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

    The main argument is
    -Dcom.sun.management.jmxremote. It's not required anymore in JDK 1.6 . The other arguments are used for specifying explicitely the port number (7091). Useful for monitoring a JVM from a remote computer.
  2. YourKit
    For enabling YourKIT Java profiler, add
    -agentlib:yjpagent to your JVM argument.
    In addition, the YourKit/bin directory should be added to the path
  3. Remote debug
    For enabling remote debugger, add the following argument to the JVM:
    -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044
  4. JPS for getting all the monitoreable JVM

Wednesday, June 13, 2007

Working Environment

Here's a description of my working environment: my IDE, my plugins, my hacks etc

  • Eclipse
  • Cygwin
  • XEmacs for Windows
  • YourKit - wonderful java profiler
  • WinMerge - for comparing text files
  • Total Commander - FTP utility
  • junction link magic - creating shortcut (links just like in unix) in windows
  • notepad++ or textpad
  • Xsession (XconnectPro) for enabling Xwindows from a simple remote console window.
  • SAP Java Memory Analyzer

  • Eclipse plugins
    • checkstyle
    • PMD ( never really used it. Use it together with checkstyle)
    • Quickmark (like jump to register in emacs)
    • EcSplorer - get explorer from eclipse. I didnt really use it.
    • Easy Explorer - same as above. If I remember, I use it for opening a Windows Explorer directly from my eclipse
    • AspectJ
    • logFileTools - utility for tailing file - nice but I preferred the cygwin for such kind of things.