GUO Jian's Technical Blog
Sunday, November 28, 2010
Configure gtalk in pidgin
Protocol: xmpp
Username ; username_only (no need for @gmail)
Domain: gmail.com
Resource: Home
Password: Your_GMAIL_ Password
Advance tab
Force old (port 5223) SSL: Checked
Allow plaintext auth over unencrypted streams: Un-Checked
Connect Port: 443
Connect Server: talk.google.com
File Transfer For Proxies: Leave blank or proxy.jabber.org
Proxy type
Use Global Proxy Settings
Tuesday, November 23, 2010
create shared C library
- write your library code, say sum.c with header file sum.h, and save them in your library folder, say ~/local/lib for the source, and ~/local/include for the header file.
- compile it using gcc
gcc -I ~/local/include -c sum.c
This will produce a object file sum.o - create a static library named "hash", do
ar rcs libhash.a sum.o
More than one *.o files can be included in single library - you are ready to use it by :
- include the "sum.h"
- compile it using gcc -I ~/local/include -L ~/local/lib -lhash ...
# for header files
export C_INCLUDE_PATH=~/local/include:$C_INCLUDE_PATH
# for linking library
exprot LD_LIBRARY_PATH=~/local/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=~/local/lib:$LIBRARY_PATH - include the "sum.h"
Thursday, November 18, 2010
Timing in C
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
typedef uint64_t u64;
static inline u64 T2L()
{
struct timeval tv;
gettimeofday(&tv, NULL);
return 1000000ULL * tv.tv_sec + tv.tv_usec;
}
static u64 _t_start_;
u64 tstart()
{
_t_start_ = T2L();
return _t_start_;
}
u64 tdiff()
{
return T2L() - _t_start_;
}
void ptdiff()
{
u64 d = T2L() - _t_start_;
printf("%lu sec %lu usec\n", d/1000000, d%1000000);
}
Monday, July 12, 2010
My Experience with Latex
- To include images with different formats:
- PDF, one can use pdflatex to compile
- ps, eps, use latex
convert
- To draw and include pictures, as I mentioned in previous posts, I use JPicEdt for editing to pst files, and then include them by
\include{picture.pst}However, when pst format is used for Latex, one has to use three steps to compile:
latex -> dvi2ps -> ps2pdfin order to get the PDF file.
Monday, May 31, 2010
reinstalled ubuntu 9.10
- sudo apt-get update
- Chinese Support:
sudo apt-get install ibus ibus-qt4 ibus-pinyin
im-switch -s ibus - vim: my favorite editor and copy my customized .vimrc file
sudo apt-get install vim - To add me to sudoer list, and enable the nopasswd function to avoid keep keying in the password. see: /etc/sudoers
- Customize my firefox:
- enable the add-on Xmarks, and greasemonkey for downloading google PDF documents
- sudo aptitude install ubuntu-restricted-extras (flashplayer)
- sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts(jre)
- enable the add-on Xmarks, and greasemonkey for downloading google PDF documents
- IM - pidgin with integrated skype
- sudo apt-get install pidgin
- download http://www.skype.com/go/getskype-linux-beta-ubuntu-32
- http://eion.robbmob.com/skype4pidgin.deb
- sudo dpkg -i *.deb
- workspace: kile, latex, etc
- sudo apt-get install kile jabref rapidsvn meld okular
- configure rapidsvn to use kile and meld
- download and install: http://downloads.sourceforge.net/jpicedt/jpicedt-install_1_4_1_03_20071021.jar?download
- add llncs.cls to /usr/share/texmf/tex/latex/guojian/; sudo texhash
- Eclipse with C/C++
- sudo apt-get install eclipse
- Help >> Install New Software, select "Galileo Update Site - http://download.eclipse.org/releases/galileo/", and choose "Eclipse C/C++ Development Tools"
- Lastly, copy my customized .bashrc, download from: here
Saturday, November 7, 2009
Install Chinese input method
sudo apt-get install ibus ibus-qt4 ibus-pinyin
im-switch -s ibus
Saturday, October 24, 2009
clone ubuntu to new disk
"I always make this, booting from Ubuntu live cd and using dd to make a copy from older disk to newer disk
Assuming /dev/hda size is <>
Open a terminal and type:
sudo -i
fdisk -l
dd if=/dev/hda of=/dev/hdb
Replace /dev/hda with your Ubuntu Drive
Replace /dev/hdb with the drive you wish to copy TO!
check & double check the fdisk -l output
Unplug the older disk and keep it as secure backup of your current installation for a while and plug the new hard disk as primary and boot your pc.
After you can put your old disk as secondary on the same pc or use it on a different pc (it usually works, you might need to reconfigure graphics layer) .
Then booting from Ubuntu live cd and using System → Administration → Partition editor, increase the just copied partitition size to fill new disk size (bigger than previous disk).
This is my usual Ubuntu cloning method...
Hope this helps"