Category Archives: Programming Languages

Learning by Doing: Programming Razz Simulator

Posted in kerneltrap.org on February 5, 2010 – 9:54am As a final assignment in my Languages for Scientific Computing class, I develop a Razz Simulator. Basically Razz is the inverse of Poker in which you try to come up with … Continue reading

Posted in C, Learning Experience, Programming Languages, Software Engineering | Tagged | 1 Comment

The Difference between LEA and MOV OFFSET

Posted in kerneltrap.org on January 24, 2010 – 12:33am The other day a friend of mine asked me to code a decimal-to-hex-converter in MASM using DOS ISRs (Interrupt Service Routine) for I/O. Well, I just gave her the equivalent C … Continue reading

Posted in Assembly, Programming Languages | Tagged | Leave a comment

Android ListView Selection Problem

Posted in kerneltrap.org on January 1, 2010 – 5:55am About some weeks ago I got the chance to fiddle with Android that is used in mobile service discovery research in Mobile Communication System Engineering Lab. The assignment was to create … Continue reading

Posted in Android SDK, Java, Programming Languages | Tagged | 1 Comment

How to Get the Length of a UDP Datagram/Packet

Posted in kerneltrap.org on September 3, 2009 – 12:33pm While developing the logger for GNU/Linux Anywhere USB Controller, I needed to know the length of the UDP packet to be read so that I could do `malloc()’ with the appropriate … Continue reading

Posted in C, Programming Languages | Tagged | Leave a comment

Getting the File Name from a File Descriptor (fd) or a File Pointer (FILE *)

Posted in kerneltrap.org on September 3, 2009 – 11:51am While developing the logger for GNU/Linux Anywhere USB Controller, I created the following function that will store a `FILE *’ into a global table for a later retrieval: static int save_open_file … Continue reading

Posted in C, Programming Languages | Tagged | Leave a comment

Crafting Function: With or Without Buffer Length Parameter?

Posted in kerneltrap.org on August 4, 2009 – 2:07pm Developing a C API that deals with writing to external provided buffers, I was wondering whether or not I should include parameter buffer length when the length of the data to … Continue reading

Posted in C, Programming Languages | Tagged | 2 Comments

Should a header file includes another header file?

Posted in kerneltrap.org on July 10, 2009 – 5:12pm Now that I’d got another chance to develop a C application, whenever I crafted a header file, I always wondered whether the header file needed to include another header file such … Continue reading

Posted in C, Programming Languages | Tagged , , | 4 Comments

PHP5 fsockopen(localhost, …) doesn’t work in MS Windows Vista

Posted in kerneltrap.org on February 3, 2009 – 10:44am I have a PHP script that uses `fsockopen(localhost, …)’ to open a socket connection to another server residing in the same machine. It works beautifully in GNU+Linux hosts but not in … Continue reading

Posted in PHP, Programming Languages | Tagged , , , , | 2 Comments

How to differentiate between EOF and a character whose ASCII code is 255

Posted in kerneltrap.org on June 1, 2008 – 10:05pm A call to fgetc() or getchar() will return EOF if the end-of-file has been reached. As far as I know, GNU C Library defines EOF to be (-1). Those who are … Continue reading

Posted in C, GNU C Library, Programming Languages | Tagged , , | 2 Comments

Printing size_t or ssize_t variable

Posted in kerneltrap.org on May 18, 2008 – 10:28pm Looking at the man page of printf (man 3 printf), in the length modifier section, it is written: z       A following integer conversion corresponds to a size_t or ssize_t argument. (Linux libc5 … Continue reading

Posted in C, GNU C Library, Programming Languages | Tagged , | Leave a comment