export http_proxy="http://localhost:8118"
Tuesday, November 27, 2012
python program behind proxy
All about pip
I was stucked in pip. Just found out that pip is called "pip-python" in RHEL.
What's more, pip cannot auto detect system proxy settings, manual specify:
sudo pip sudo pip-python install virtualenv --proxy localhost:8118
What's more, pip cannot auto detect system proxy settings, manual specify:
sudo pip sudo pip-python install virtualenv --proxy localhost:8118
Sunday, November 11, 2012
command sort on last column
As you know, the linux sort command is agile, which can sort on column using -k.
However, if we gonna sort on the last column and each row has different number of columns, we can still achieve that with the help of sed.
However, if we gonna sort on the last column and each row has different number of columns, we can still achieve that with the help of sed.
sed 's/^\(.\+\s\+\)\([0-9]\+ *\)$/\2 \1/'
Thursday, November 8, 2012
Online bood recommened
A page list downloadable book:
http://cfajohnson.com/computers/pdflinks.shtml
I'm gonna go through the following:
The GNU/Linux Advanced Administration
http://www.tldp.org/LDP/Bash-Beginners-Guide/Bash-Beginners-Guide.pdf
http://www.tldp.org/LDP/abs/abs-guide.pdf
http://www.greenteapress.com/thinkpython/thinkpython.pdf
http://cfajohnson.com/computers/pdflinks.shtml
I'm gonna go through the following:
The GNU/Linux Advanced Administration
http://www.tldp.org/LDP/Bash-Beginners-Guide/Bash-Beginners-Guide.pdf
http://www.tldp.org/LDP/abs/abs-guide.pdf
http://www.greenteapress.com/thinkpython/thinkpython.pdf
Tuesday, October 2, 2012
zsh cd tab completion slow
It is quite annoing that zsh seems stuck when completion using tab in a huge directory.
To speed up the zsh completion, append the following lines to ~/.zshrc
# Speed up the zsh completion
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
Sometimes, the directory auto completion works slow under git and svn directories.The solution is to disable it from getting git info and svn info:
For GIT, add following to .zshrc:
For SVN, append this line to .zshrc:
To speed up the zsh completion, append the following lines to ~/.zshrc
# Speed up the zsh completion
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
Sometimes, the directory auto completion works slow under git and svn directories.The solution is to disable it from getting git info and svn info:
For GIT, add following to .zshrc:
__git_files () {
_wanted files expl 'local files' _files
}
For SVN, append this line to .zshrc:
compdef -d svn
Friday, August 3, 2012
Make GridColumns align in two different Grids in WPF XAML
In XAML UI, some times we want to make GridColumn Width synchronized with other GridColumns in other Grids.
WPF provided a property called SharedSizeGroup which allows sizing properties shared between ColumnDefinition or RowDefinition.
And remeber to set Grid.IsSharedSizeScope="True".
However , when we want one column take up all the available space, like the example above. You will find out that even you write Width="*" still doesn't work as SharedSizeGroup will make it as short as possible.
My solution is , Shared all the columns size except the one contain TextBox.
<Grid Grid.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid Name="Grid1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" SharedSizeGroup="a" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" SharedSizeGroup="c"/>
<ColumnDefinition Width="auto" SharedSizeGroup="d"/>
WPF provided a property called SharedSizeGroup which allows sizing properties shared between ColumnDefinition or RowDefinition.
And remeber to set Grid.IsSharedSizeScope="True".
However , when we want one column take up all the available space, like the example above. You will find out that even you write Width="*" still doesn't work as SharedSizeGroup will make it as short as possible.
My solution is , Shared all the columns size except the one contain TextBox.
<Grid Grid.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid Name="Grid1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" SharedSizeGroup="a" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" SharedSizeGroup="c"/>
<ColumnDefinition Width="auto" SharedSizeGroup="d"/>
</Grid.ColumnDefinitions>
....
</Grid>
<Grid Name="Grid2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" SharedSizeGroup="a" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" SharedSizeGroup="c"/>
<ColumnDefinition Width="auto" SharedSizeGroup="d"/>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" SharedSizeGroup="a" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" SharedSizeGroup="c"/>
<ColumnDefinition Width="auto" SharedSizeGroup="d"/>
</Grid.ColumnDefinitions>
.........
</Grid>
Thursday, August 2, 2012
WPF XAML GridSplitter Style
<Style x:Key="gridSplitterStyle" TargetType="{x:Type GridSplitter}">
<Setter Property="FrameworkElement.Height" Value="6"/>
<Setter Property="TextElement.Foreground" Value="#FF204D89" />
<Setter Property="Border.BorderThickness" Value="0,0,0,0" />
<Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
<Setter Property="UIElement.Focusable" Value="False" />
<Setter Property="FrameworkElement.Cursor" Value="SizeNS" />
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Border BorderThickness="0,0,0,0" >
<Canvas Width="19" Height="3">
<Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="0" Canvas.Top="0" />
<Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="4" Canvas.Top="0" />
<Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="8" Canvas.Top="0" />
<Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="12" Canvas.Top="0" />
<Rectangle Fill="{TemplateBinding TextElement.Foreground}" Width="2" Height="2" Canvas.Left="16" Canvas.Top="0" />
</Canvas>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Subscribe to:
Posts (Atom)