Gnu Global, the programmer’s friend

May 25th, 2010 mysurface

GNU Global (gtags) is a source code tagging system similar to ctags but more than that. I always use vim as my c/c++ source code editor, and using ctags to helps me travels from function call to function definition. I do write a post indicates how does ctags works with vim. The reason I shifted […]

Posted in Developer, global, gtags, gvim, vi, vim | Hits: 325417 | 11 Comments »

Compile and execute 32 bits application in 64 bits operating system

October 1st, 2009 mysurface

The world is going towards 64 bits machines and operating system for personal computer, but there are still some libs and software only support 32 bits. Therefore in this transition period, there is a needs to support both 64 bits and 32 bits applications. Lately I been using x86_64 Fedora Linux. There are requirements for […]

Posted in Developer, gcc, Misc | Hits: 235397 | 3 Comments »

Serialize INI configuration to python dictionary

August 30th, 2009 mysurface

A lots of configuration file is in the format of INI, if we manage to serialize INI configuration to python dictionary, we can write python scripts to analyse and generate back to INI files. Below is the sample of INI configuration: config.ini # # GENERAL section contains generic configuration # [GENERAL] IP= Port=2143 # # […]

Posted in Developer, python | Hits: 255840 | 20 Comments »

Does scons outperforms autoconf and makefiles?

May 28th, 2009 mysurface

SCons is a software construction tool (build tool, or make tool) implemented in Python, that uses Python scripts as “configuration files” for software builds. Based on the design that won the Software Carpentry build tool competition, SCons solves a number of problems associated with other build tools, especially including the classic and ubiquitous Make itself. […]

Posted in python | Hits: 200325 | 3 Comments »

python: simple http server for file sharing

May 15th, 2009 mysurface

You do not need to setup apache server just to hosting your file for sharing. If you have python 2.5 and above, you can do this at the targeted directory to share. python -m SimpleHTTPServer 9914 9914 is the port number I choose to host my web, assume my IP is, in firefox you […]

Posted in python | Hits: 244540 | 13 Comments »

Bit shifting can be done in python just like in c

April 1st, 2009 mysurface

It was amazing to discover that I can do bit shifting in python just like in c, the syntax makes no different at all. Let us look at how easy I can do a bit shifting. I write an example loop by shifting the bit leftwards. for i in range(0,10): print “0x0001 << %d = […]

Posted in Developer, python | Hits: 223574 | 4 Comments »

How can I avoid running a python script multiple times? Implement file locking.

March 13th, 2009 mysurface

Sometimes we just need a single instance of the python script to run at a time. Meaning, the python script itself should detects whether any instances of himself are still running and act accordingly. Well, how to do it? The idea is simple, the first instance of the python script will open a file, and […]

Posted in Developer, python | Hits: 248573 | 11 Comments »

Plot your graphs with command line gnuplot

February 12th, 2009 mysurface

gnuplot is a command line driven graph plotter tools for us to generate graphs. The common graphs that we are looking forward to present the resource performance per seconds, hours, days, weeks or months are usually plot graphs, which it consist of lines and dots. gnuplot allows us to read the data from text files […]

Posted in Developer, gnuplot | Hits: 413401 | 23 Comments »

Python: Manipulate string or binary bytes with StringIO

November 25th, 2008 mysurface

Sometimes it is not convenient to construct string using equal (=) like this: str = “Hello, ” … str = str + “my name is ” … str = str + Name print str In python, we have string stream (StringIO) that will behave like file stream, you can construct your string like this: str=StringIO() […]

Posted in Developer, python | Hits: 217595 | 9 Comments »

python: writing binary file

November 20th, 2008 mysurface

Python is the best scripting language which I found it out perform Bash script as well as Lua. I like python’s scripting syntax, which is make sense and very convenient in string manipulations. Its now come to binary format manipulation, how convenient is python? I have carry out some research on python into writing binary […]

Posted in python | Hits: 320828 | 62 Comments »