Sunday 25 July 2010

Visual studio 2010 keyboard shortcut poster

Download from MS:http://www.microsoft.com/downloads/details.aspx?FamilyID=92CED922-D505-457A-8C9C-84036160639F&displaylang=en#filelist

Friday 16 July 2010

Visual Studio 2010 shortcuts

Default Keyboard shortcuts

http://msdn.microsoft.com/en-us/library/da5kh0wa.aspx

C# Performance

Little notes on C# performance
  • For loop > Foreach
  • TryGetValue > if(variable.Contains(key)) variable[key]

Friday 9 July 2010

Monday 5 July 2010

Difference between softlink & hardlink

soft or symbolic is more of a short cut to the original file....if you delete the original the shortcut fails and if you only delete the short cut nothing happens to the original.

hard link is more of a mirror copy....do something to file1 and it appears in file 2
deleting one still keeps the other ok

Saturday 3 July 2010

Little bash scripting learning

Variables:

  • $? -- the exit status of last command
    • 0 = success
    • fail otherwise
  • $# -- No. of arguments
  • $@  -- All the arguments

Build project using msbuild at command line

Recently, I have been writing some sample scripts to help me re-compile and start up services in order.
However, I failed to compile those csproj files because that I couldn't provide variables that are needed by post-build-event.

After trying to provide all the variables one by one....I gave up....there were too many dependencies and I simply cannot provide them each time I add a new solution to my script.

After analysing those post-build-event, I realized that those events were used to maintain a master library and to keep the lib folder up-to-date ---- nothing to do with my script.

At the end, I solve the problem by simply adding a new property switch '/p:PostBuildEvent='. which ignores all those post build events......

Thursday 1 July 2010

List file full path in Bash

$PWD contains the full path of the current directory.
To output the full path of a file, you can simply do
echo "$PWD/filename"

Easy and useful!

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...