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

Tuesday, March 8, 2011

ListView ObservableCollection Selection

I have ListView with GridView inside (in order to divide ListView for some columns). I bind ObservableCollection of some objects with that ListView.DataContext when main UserControl is loaded. Items show up but when i create two objects which fields have same values (and put them to observable collection), that new items show up in ListView. Problem is that, when user clicks and select one of the new item - both select.

When value of one of mentioned objects changes (and is different) problem doesn't exist, ListView treat them as it should.

Friday, March 4, 2011

The filter

head t.txt; echo ... tail t.txt

%sort -r +1-2 t1_data.txt
%sort -r -n -k2 t1_data.txt
%grep ' [6-9]' t1_data.txt