Jun 10, 2014
TechnologySince company has upgrade the IM tools from office communicator into Lync, thus I have to upgrade the pidgin’s plugins for using lynx. Folloing is the tips:
Upgrade SIPE
Sipe is installed via yaourt:
# yaourt -S pidgin-sipe
Edit the existing account via: Edit->Preference->Advanced.
The connection type is auto, the authentication scheme is TLS-DSK.
In the “User Agent”, insert following:
UCCAPI/15.0.4481.1000 OC/15.0.4481.1000
The detailed “User Agent” descriptions could be refered to following links:
http://sourceforge.net/p/sipe/wiki/Frequently%20Asked%20Questions/#connection-refused-with-error-messagewzxhzdk10you-are-currently-not-using-the-recommended-version-of-the-clientwzxhzdk11you-have-been-rejected-by-the-server-httpsportalmicrosoftonlinecomdownloadlyncaspx
Re-enable the account then you can use lync now.
May 26, 2014
TechnologyKernel
As for i686 only support 4GB at most memory, we have to change the existing memory into a new one. PAE based kernel will support up to 64GB memory, so we upgrade our kernel to this one:
yaourt -S linux-pae
Building will take for a while, two tips is:
- Change the building directory from
TMPDIR="/tmp" to TMPDIR=/real_file_system, this configuration file is /etc/makepkg.conf. - Add the
MAKEFLAGS="-j6", this will speed-up the building procedure.
FCITX
We have to set following variables, in /etc/locale.conf:
# Enable UTF-8 with Australian settings.
LANG="en_US.UTF-8"
# Keep the default sort order (e.g. files starting with a '.'
# should appear at the start of a directory listing.)
LC_COLLATE="C"
# Set the short date to YYYY-MM-DD (test with "date +%c")
LC_TIME="en_US.UTF-8"
Then we install the googlepinyin input method via:
sudo pacman -S fcitx-googlepinyin
Now hit CTRL+SPACE you can call the goolgepinyin out.
Install strace for tracing the program:
sudo pacman -S strace
flash-plugins:
sudo pacman -S flashplugin
quazilla, another browser:
sudo pacman -S qupzilla
When writing octopress based blogs, you will face .rvmrc cannot executed, then enable the terminal emulator’s setting, change it as run as login shell.
Some more tips will be added later.
May 24, 2014
Technology问题
在txt里面打印1-10里面随机的9个数。
思路
如何生成随机数?
Google “generate random python” , 结果如下:

挨个看,马上你会发现下面这个网页有答案:
http://stackoverflow.com/questions/5555712/generate-a-random-number-in-python
启动终端试验之:
$ python
Python 2.7.6 (default, Feb 26 2014, 12:07:17)
[GCC 4.8.2 20140206 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from random import randint
>>> randint(2,9)
3
>>> randint(1,10)
9
>>> randint(1,10)
4
如何循环打印
照样Google, 搜索关键字” python loop times”,结果如下:

随便点点看, 发现python自己的文档里就已经有很详细的关于loop的例子了:
https://wiki.python.org/moin/ForLoop
试验之:
>>> for x in range(0,3):
... print "hello"
...
hello
hello
hello
综合,得出答案
用for的实现:
>>> for x in range(0,9):
... print random.randrange(1,10)
...
2
5
3
7
9
4
7
3
1
发散到用while的实现(原代码见上面的wiki网页)
>>> x = 1
>>> while x < 10:
... print random.randrange(1,10)
... x += 1
...
4
4
4
5
1
9
1
8
2
当然你还可以反着弄while:
>>> x = 10
>>> while x > 0:
等等等等,不提示了
May 24, 2014
TechnologyFont Customization
Install following fonts:
$ sudo pacman -S wqy-bitmapfont wqy-zenhei ttf-arphic-ukai ttf-arphic-uming ttf-fireflysung
And then for more beautiful font, refer to:
http://kkkttt.github.io/blog/2013/12/25/archlinuxzhong-wen-hua-wen-ti/
VIM Customization
Vim is my favorite editor, so maintain a configuration file is necessary for deploying it on various machines.
$ sudo pacman -S ctags
Then copy the default vimrc file from /usr/share/vim74/vimrc_example to your own directory, named it into .vimrc.
Add folllowing lines into .vimrc file:
" Customization Start
set nu
set cursorline
set cursorcolumn
"Enable syntax
syntax enable
syntax on
" colorscheme solarized
autocmd BufNewFile,BufReadPost *.ino,*.pde set filetype=cpp
"进行Tlist的设置
""TlistUpdate可以更新tags
map <F3> :silent! Tlist<CR>
"按下F3就可以呼出了
let Tlist_Ctags_Cmd='ctags' "因为我们放在环境变量里,所以可以直接执行
let Tlist_Use_Right_Window=1 "让窗口显示在右边,0的话就是显示在左边
let Tlist_Show_One_File=0 "让taglist可以同时展示多个文件的函数列表,如果想只有1个,设置为1
let Tlist_File_Fold_Auto_Close=1 "非当前文件,函数列表折叠隐藏
let Tlist_Exit_OnlyWindow=1 "当taglist是最后一个分割窗口时,自动推出vim
let Tlist_Process_File_Always=0 "是否一直处理tags.1:处理;0:不处理。不是一直实时更新tags,因为没有必要
let Tlist_Inc_Winwidth=0
set fileencodings=utf8,cp936,gb18030,big5
"In visual mode, you can simply press ,x and Vim will filter your content
"through tidy.
:vmap ,x :%!tidy -q -i --show-errors 0<CR> "Auto command for clear the html files
:command Thtml :%!tidy -q -i --show-errors 0
:command Txml :%!tidy -q -i --show-errors 0 -xml
" Setting up Vundle - the vim plugin bundler
let iCanHazVundle=1
let vundle_readme=expand('~/.vim/bundle/vundle/README.md')
if !filereadable(vundle_readme)
echo "Installing Vundle.."
echo ""
silent !mkdir -p ~/.vim/bundle
silent !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle
let iCanHazVundle=0
endif
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-fugitive'
Bundle 'taglist.vim'
" Bundle 'molokai'
"Add your bundles here
"Bundle 'Syntastic' "uber awesome syntax and errors highlighter
Bundle 'altercation/vim-colors-solarized'
Bundle 'https://github.com/tomasr/molokai.git'
"T-H-E colorscheme
"Bundle 'https://github.com/tpope/vim-fugitive' "So awesome, it should be illegal
"...All your other bundles...
if iCanHazVundle == 0
echo "Installing Bundles, please ignore key map error messages"
echo ""
:BundleInstall
endif
" Setting up Vundle - the vim plugin bundler end
colorscheme molokai
set guifont=YaHei\ Consolas\ Hybrid\ 11.5
Then everything I want is OK.
Command for configurating vbundle:
BundleInstall
BundleSearch
Tree tool has been installed, for view the complex directory structure :
$ sudo pacman -S tree
Install arduino from yaourt.
$ yaourt -S arduino
This will also install avr-gcc.
NodeJS
Install via yaourt:
$ yaourt -S nodejs
Basic Tutorial:
http://localhost2/blog/2014/05/14/node-dot-js-quick-start/
Later I will add the “Chat-like” Terminal-emulator series, so this part could be enhanced.
Tools which used for writing articles.
$ sudo pacman -S blender dia inkscape scribus
$ yaourt yed
$ yaourt sublime
$ sudo pacman -S gedit
$ sudo pacman -S imagemagick
Awesome Configuration
Dmenu which used for run applications:
$ sudo pacman -S dmenu
Screen shot:
$ sudo pacman -S scrot
Edit the /usr/bin/mycapscr
[Trusty@~]$ cat /usr/bin/mycapscr
scrot -s '%Y_%m_%d_%H_%M_%S_$wx$h.jpg' -e 'mv $f ~/capscr/'
Tcpdump for capturing packets.
$ sudo pacman -S tcpdump
Whatpulse for recording key click times:
$ sudo yaourt -S whatpulse
$ sudo gpasswd -a Trusty input
Remote Desktop:
$ pacman -S rdesktop
Conky and Conky configuration file.
$ pacman -S conky
hex tool:
$ pacman -S ghex
Calculator:
$ pacman -S bc
$ pacman -S gnome-calculator
Nautlus:
$ pacman -S nautilus
rar:
$ pacman -S rar
autossh:
$ pacman -S autossh
cmake:
$ pacman -S cmake
cronie:
$ pacman -S connie
elinks:
$ pacman -S elinks
eog:
$ pacman -S eog
ethtool
$ pacman -S ethtool
expect:
$ pacman -S expect
feh:
$ pacman -S feh
gparted:
$ pacman -S gparted
ipython2:
$ pacman -S ipython2
ntfs-3g:
$ pacman -S ntfs-3g
sakura lilyterm:
$ pacman -S sakura lilyterm
tmux:
$ pacman -S tmux
w3m,lynx:
$ pacman -S w3m lynx
xclip:
$ pacman -S xclip
xlockmore:
$ pacman -S xlockmore
XPdf:
$ pacman -S xpdf
calibre:
$ pacman -S calibre
Rstudio:
$ yaourt rstudio-desktop-bin
pandoc(Problem!):
$ yaourt pandoc
# Notice, you have to add curl -k in /etc/makepkg.conf
briss(For cutting pdf into 6 inch):
$ yaourt briss
coolreader(For reading epub):
$ yaourt -S coolreader
May 23, 2014
TechnologyWriting Blog
I use octopress for writing blog, so this time in USB system I also want to enable it.
Edit the /etc/hostname and name my computer into “USBArch”, because we want to setup the id_rsa.pub in next step.
$ ssh-keygen
$ cat ~/.ssh/id_rsa.pub
Copy the content and add it into the “https://github.com/settings/ssh”,
Then use command ssh -T git@github.com to verify if you can successfully be authenticated.
$ git clone git@github.com:kkkttt/debian_octopress.git
$ git clone git@github.com:kkkttt/herokublog.git
Now the repository is OK, but the ruby environment should be set.
$ curl -L https://get.rvm.io | bash -s stable
$ rvm use 1.9.3
# log out the terminal and log in again
$ rvm rubygems latest
$ cdheroku
# Choose yes, trust the .rvmrc
$ gem install bundler
$ bundle install
Test the rake command:
$ rake generate && rake deploy
OK, Then we can octopress for writing blogs.
WebServer
We will use xampp for webserver, because it’s very convinient to configure. Login as root, then:
# yaourt xampp
The detailed configuration steps could be viewed at:
http://kkkttt.github.io/blog/2014/04/23/deploy-xampp-on-archlinux/
In fact here I met a very strange problem, it seems if I put the whole blog under /home/Trusty/code, then the browser will complains that 403, so here I make a trick in rakefile(Which is used for generating the static website), add following line in rake generate
desc "Generate jekyll site"
task :generate do
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
puts "## Generating Site with Jekyll"
system "compass compile --css-dir #{source_dir}/stylesheets"
system "jekyll"
system "sudo cp -ar ./public/ /opt/ && sudo chown -R nobody /opt/public/ && sudo chgrp -R nobody /opt/public/ && sudo chmod 755 -R /opt/public/"
end
I don’t find another method, because xampp is too complex for configuring, we needn’t spend much more time on it.
Tomorrow I will setup the other language development environment.