GNU Cheat sheets

Development June 30th, 2006

This is a digest page for all the cheat sheets for Free Softwares.

VIM
VIM cheat sheet

Anybody could print it to T-shirt?

EMACS
TODO

GDB
TODO

Pitfalls on porting FORTRAN 90 to C

Development June 29th, 2006

I am porting a 3000-line Fortran 90 source code to ANSI C in these days, and I would like to mark the pitfalls in this adventure:

  • Use 1-index Don’t try to act professional to use 0-index, that would confuse yourself in a few minutes, use 1-index, we can afford the one element waste.
  • Be careful of for loop FORTRAN support for loop with increment/decrement, while C does not.
  • ABS != abs Surprising? abs in C return integer, not double. I am quite annoyed to find the compiler ( gcc-4.1) does not even issue a warning for the implicit conversion. Use fabs instead
  • Prepare your debugger if you have a 300 line function, and messed global variables, taking some time to learn gdb is definitely worthy, — Intel FORTRAN, idb also supports gdb mode.

Alert: Never overlook warning

Development June 28th, 2006

I hate to search the “real error message” in the overwelming warning message when compiling the C code, since most of warning come from the type conversion. Today, I paid my price, 30 minutes debugging session.

The bug is in

double min_val( double* data, int size )

I test this code first, then put it into the main.c, later I refactor the code, move it to utilities.c. Everything seems fine, compiles, run. Oops, it is not fine, the result is totally wrong. I launched gdb, insert serveal breakpoints, inspect variables, eventually, I find the return value of callee side, i.e min_value is right, but the value in the caller side is wrong. It is kind weired…

Then, I realize that I might not declare min_val, and the compiler regards the return value is integer, instead of double. Then I rebuild the whole project with -Wall flag, yes, the warning message shows that there are “implicit conversion”, that is the source of bug!

I would put -Wall in the CFLAGS since then.

Looking for a new host …

Web June 27th, 2006

The one year plan on DreamHost ends on this summer. I need a new ISP to host kunxi.org. Here are some simple requirement:

  • Support PHP, MySQL, SSH access if possible
  • Not blocked by GFW
  • Quota > 200M, Monthly traffic > 1G
  • Yearly cost < $40

If you happen to know some ISP, or you would like to share the host space. Please leave a comment here, or drop me a message here.

UPDATE: Precision Effect’s starter package seems quite neat for more requirement. I might google for more reviews before I jumped into it.

Scratched Creative Zen Micro

Misc June 27th, 2006

An eBay seller introduces her scratched Creative Zen Micro:

Seriously, it’s a bit scratched because we never put a protective skin on it. I guess that’s why we have six kids.