Wednesday 30 June 2010

Powershell reference

http://ss64.com/ps/

Find by file name in Bash

Easy but useful command:
To find a file by name, use 'find' command. It will search all assigned path including its sub-folders
  • find 
    • 1st argument: the path to find
    • -name: file by name
    • -i: case insensitive

Monday 28 June 2010

Bash scripting

Start doing a bit bash scripting now....

this is some thing that fairly simple but took me a few minutes to figure out how...


  • You can't use alias by default unless you turn on some kind of options
  • to run a variable as a command, there are three commands that you can use
    • eval, exec, source 
  • Variable should be upper case!

Reload File in Emacs

I can't remember how I deal with this situation.... I just realized that Emacs doesn't reload a file, if it has been modified outside emacs......

To reload a file, this is the command you need to run...M-x revert-buffer

Saturday 26 June 2010

Some simple bash hints

  • Command
    • ls - list files
      • --color=auto: Display files with different colors base on their types
      • -C: Display files by column
    • set - showing all environment variables
    • du - show file size
      • -s: summary
      • -h: human readable
    • cd
      • -: go to the previous directory
    • history - show command history
      • use '!' rerun the command. e.g. !4
      • '!!' will run last command
      • '!-2' will run the second last command
      • use 'export HISTCONTROL=ignoredups' to get rid of duplications
    • basename - show the name of a file. (remove directory path)
      • can also be used to remove suffixes by add a 2nd argument with the suffixes
    • dirname - show the directory of a file 

    SQL join basic

    In SQL, Join is a powerful and useful operation. It can be used to return data from multiple tables.

    There are different types of joins (that I know)

    • Inner Join (Default in some DBs): Select only the matched rows from two tables
    • Left(Right) Outer Join: select all rows from Left(Right) table and matched rows from the second table
    • Cross Join: return all rows from both table. Even there are 'NULL' values in its column

    Setting Up Emacs for Windows

    Here is a good .el to help emacs recognize cygwin path style
    http://www.emacswiki.org/cgi-bin/wiki/download/cygwin-mount.el

    to enable
    (require 'cygwin-mount)

    (cygwin-mount-activate)
    There is a problem with the PS1 variable of bash. Emacs doesn't recognize the escape characters for colours. The solution is to add a condition to the bash profile:
    if [ $TERM = emacs] ; then
    PS1='\u@\h:\W\n$'
    fi

    A Useful Emacs 4 Windows documentation

    This could help me setting up my emacs in Windows!

    ps: Here is how to set the font for Emacs
     M-x set-default-font 
    ref: http://www.cs.huji.ac.il/~osigor/emacs/font.html#8

    Friday 25 June 2010

    Using quotes in Bash

    This is probably incomplete, the quote in bash has the following usage:

    • Single Quotes (') -  preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.
      • e.g. echo '\"This Text is writing between two single quotes! $User' will return the original sentence: \"This Text is writing between two single quotes! $User
    • Double Quotes (") - preserves the literal value of all characters within the quotes, with the exception of `$'``', and `\'.
      • e.g. echo '\"This Text is writing between two single quotes! $User' will return the sentence: "This Text is writing between two single quotes! Yi


    A good Bash scripting tutorial, I need to come back and read it!

    Thursday 24 June 2010

    A good place where you can get e-books!

    Not sure if this is legal. I find this website really useful when I want to learn some new programming stuff.
    Download all kind of e-resources for FREE!

    Missing the life back in Uni...where I can borrow real books for free.....

    New Release!

    Not sure exactly how many blogs I have had...Hope I can use this for long...........

    The main purpose of this blog is to help me organize my notes and share my ideas, experiences & knowledge with people.

    Thanks for reading this.

    Have fun...