Dot language

Command to generate image with dot

dot -Tpng -o Output.png Input.dot

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
    overlap=false, 
    center=true, 
    bgcolor=green, 
    fontcolor=red, 
    fontsize=24, 
    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
 */
import java.io.File;
import java.io.IOException;
 
public class DirFileHandling
{
  public static void main(String[] args)
  {
    // Get current directory path
    File oFile = new File(".");
    String sCurrDirPath = "";
    try
    {
      sCurrDirPath = oFile.getCanonicalPath();
      System.out.println(sCurrDirPath);
    }
    catch(IOException ex)
    {
      System.out.println(ex.getMessage());
    }
 

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 http://svn.openqa.org/svn/selenium-rc/trunk
     
  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

@ECHO OFF
:INFINITE_LOOP
 
PING 1.1.1.1 -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

#!/bin/bash
# Description: Check every 5 minutes whether it is connected to the internet or not
#  and store the result into a file.
 
iconnectionDir=/root/iconnection
mkdir ${iconnectionDir}
 
let SecondsInOneDay=60*60*24
 
# Predefined startup variables.
TimeInSeconds=`date +%s`
CurrentDate=`date +%Y-%m-%d_%H.%M.%S`
InternetConnectionTest="InternetConnectionTest_"$CurrentDate".txt"
 
# Infinite loop
while( true )
do
  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.

Pages

Subscribe to OpenWritings.net RSS