Python vs Lua, data structure

June 28th, 2008 mysurface

In python, we have various type of data structure, such as list, set, tuple, dictionary etc, but in Lua, we only have table. Table in Lua can be used as array, list, dictionary or object. Let see how you we construct list from Lua table. t = { ‘a’,'b’,'c’,'d’,'e’,'f’ } To print out the whole [...]

Posted in Developer, Lua, python | Hits: 80044 | 5 Comments »

How to list shared library dependencies used by an application

June 15th, 2008 mysurface

Almost every application in Linux uses shared library, even the one compiled by yourself with gcc. You may have realized that application compiled with gcc 4.1 in Fedora or Ubuntu does not able to run under Red Hat ES3 or ES4. Or some other new applications does not able to run at legacy Linux, it [...]

Posted in Developer, ldd | Hits: 163437 | 9 Comments »

How to embed Lua 5.1 in C++

June 7th, 2008 mysurface

Lua, is a scripting language providing dynamic data structures, maths, io and string manipulations just like any interprete language such as Bash, Python, Ruby etc. What is so special about Lua? Lua is Fast, Light-weight and Embeddable. Lua can be embedded into c and c++ programs and Lua core are statically complied with your c++ [...]

Posted in Developer, Lua | Hits: 59155 | 2 Comments »

Python: Generating graphs with matplotlib

June 5th, 2008 mysurface

Matplotlib is a python 2D plotting library that can produce dots lines, histograms, power spectra, bar charts, pie charts, scatterplots, etc. With few lines of codes, you can generate quality graphs into various image format such as eps, jpeg, pdf, png, ps, svg. You may want to check out the screenshots includes with sample codes. [...]

Posted in ipython, python | Hits: 67142 | 4 Comments »

vim with ctags for multi-level directory hierarchy

April 24th, 2008 mysurface

I have wrote a post regarding vim with ctags, introduces how ctags allows you to travel across source codes, searching for function, objects, variables definition. To jump from function call to function definition, I usually do ctrl+] in vim. It should works fine as it should have already configured by default from most of the [...]

Posted in ctags, Developer, Text Manipulation, vi, vim | Hits: 64145 | 8 Comments »

Python: Threading Callback Timer

March 27th, 2008 mysurface

It is very common that we need to run certain routines periodically, thats why in *nix environment we have cron and in windows OS we have task scheduler. But there comes a time, we may need to execute certain routines finite times within our scripts. Under certain circumtances routines may need to run at background, [...]

Posted in Developer, python | Hits: 72295 | 5 Comments »

gcore: Obtain core dump of current running application

March 24th, 2008 mysurface

Core dump is always developer’s friends and can be admin user’s nightmare. Developer’s can always get some clue of what’s going wrong through the core files, given that the apps is compiled with -g. In order to get core dump generated, we must enable the core through ulimit. Generate coredumps to help developer for debugging [...]

Posted in Admin, Developer, gcore, gdb, pgrep | Hits: 68517 | 5 Comments »

Experiencing with iPython

March 5th, 2008 mysurface

What is iPython? Is it something to do with Apple Macintosh? as stylish products like ipod and iphone? If you are enjoy coding python like me, yes ipython is a stylish and very interactive python interpreter. Auto Complete ipython support auto complete, which is the very first reason I use it. With auto complete features, [...]

Posted in Developer, ipython, python | Hits: 61213 | 3 Comments »

Python: How to run a command line within python?

March 4th, 2008 mysurface

I always got this question in my mind. How to run a command line within python, get the output and manipulates it. Before I learn python, I was doing bash scripts all the while to helps me manipulates text which I get it from log files, or pipes out from some certain command line. To [...]

Posted in Developer, python | Hits: 192574 | 15 Comments »

python: convey the exception traceback into log file

February 27th, 2008 mysurface

Python is the interpreter language, you do not need to compile your code, and also you have no ways to check for your syntax error until you run your python script. Either syntax error or runtime error will be throw to standard output through python exception handler by default. Python throw the exception with traceback [...]

Posted in Developer, python | Hits: 47072 | 6 Comments »