Wednesday, March 30, 2011

perl!


Perl

interactive shell in vim

:sh
exit
--
Ctrl-z
fg
--
Bang!
:! wc %
:! php5 -l %
:r textfile
:r ! ls -1 /home/user/directory
:r ! w3m http://en.wikipedia.org/wiki/Vi -dump

Monday, March 28, 2011

Sunday, March 27, 2011

TextTrimming ToolTip in WPF

<TextBlock Text="{Binding State}" TextTrimming="CharacterEllipsis" Foreground="#6D6D6D"
                                                           ToolTip="{Binding Text, RelativeSource={RelativeSource Mode=Self}}"/>

Wednesday, March 23, 2011

Change ubuntu default shell to bash

Found out that the C-style for loop does not work in ubuntu shell. After a few google search, answer is at below:
C-style for loop on works In bash (since version 2.04)
The sh command in /bin/sh is a symbolic link to /bin/dash:


steven@steven-laptop:/bin$ ls -l sh
lrwxrwxrwx 1 root root 4 2010-05-03 06:48 sh -> dash

Use 
$sudo ln -sf /bin/bash /bin/sh
to replace
To change the login shell, use the command $chsh

Tuesday, March 22, 2011

Conditional Operations


Let's look at the if/then/else construct in a Bash shell script and see how to control the flow of a script with conditional logic. The general form of if/then/else is shown here, with the actual syntax shown in boldface and the parts you must supply in normal type:
if [ condition is true ]
then

execute these commands

else

execute those commands

VIM set tab key == 4 spaces


in your .vimrc:
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab