Dot language

Command to generate image with dot

dot -Tpng -o Output.png

Frequently used attributes

digraph G {
  graph [
    label="Show general attributes\n that can be used",
    labelloc=t,    //t=top, b=bottom
    labeljust=r,   //r=right justified, l=left justified
    rankdir=TB,   // Orientation: TB=Top to Bottom, LR=Left to right
    URL="G.html",  // Need to generate as ismap to be clickable

Debian - Info about your CPU

cat /proc/cpuinfo

DOS - Escape percent symbol

REM To escape the percent symbol, add another percent symbol
convert inputfilena.jpg -threshold 50%% outputfilename.jpg

Java - Manipulate directory and file path in portable way

 * Show how to manipulate directory and file path in portable way. 
 * @author Xuan Ngo
public class DirFileHandling
  public static void main(String[] args)
    // Get current directory path
    File oFile = new File(".");
    String sCurrDirPath = "";
      sCurrDirPath = oFile.getCanonicalPath();
    catch(IOException ex)

Debian - Softwares used

aptitude -y install x-window-system wmaker mplayer iceweasel gkrellm scite gftp gqview k3b epiphany-browser sun-java6-jdk sun-java6-jre tree dia tidy gawk lxsplit 

Selenium - Get the lastest developement version of Selenium

Softwares requirements

  • Subversion client
  • Maven

Get the lastest developement version of Selenium

  1. Get the latest code from SVN repository.
    svn export
  2. Go to the directory where pom.xml is located and build everything.
    cd trunk
    mvn install
  3. selenium-server-*-SNAPSHOT-standalone.jar is located at trunk\selenium-server\target\.

DOS - View memory usage of a running process

PING -n 1 -w 60000 >NUL

ImageMagick - Take screenshot from command line on an X server

import is part of ImageMagick package.

Bash - Check the internet connection

# Description: Check every 5 minutes whether it is connected to the internet or not
#  and store the result into a file.
mkdir ${iconnectionDir}
let SecondsInOneDay=60*60*24
# Predefined startup variables.
TimeInSeconds=`date +%s`
CurrentDate=`date +%Y-%m-%d_%H.%M.%S`
# Infinite loop
while( true )
  sleep 5m

Debian - Confusing architecture naming convention

I just bought a new laptop. It has a 64-bit 2 GHz Intel dual-core processor. I want to install a 64-bit Debian on that laptop. Therefore, I headed to this download page. It showed the following available architectures: alpha, amd64, arm, armel, hppa, i386, ia64, mips, mipsel, powerpc, sparc, s390, source and multi-arch. I'm stocked and confused as I don't know which architecture to download. By deduction, I only have 3 choices: amd64, i386 and ia64. I wasted an hour reading the how-to of the 3 architectures to no avail.


Subscribe to RSS