Archive for the ‘Software Engineering’ Category

Bitwise Operators and Binary Tricks for System Programming

Bitwise operators in most of the programming languages are common and inherited from the C (e.g.: &, |, ^, >>, …). These operations are critical in the low-level programming (for instance for writing drivers). In the beginning of this post I’ll just briefly pass over them and present some tricks using them. As a programming [...]

PHP IPv6 address to Decimal Format Conversion

Storing IP addresses in database as decimal have several advantages on storing as a string (storing, efficiency, processing… etc). But my goal was to be able to easily query if an IP address is in a block or between a given IP range. The following two functions are often handy for converting a string IPV6 [...]

Traverse Files In the Source Folder for C++ Lint

Google has an awesome C++ coding style guideline and they have done a very good job on creating a very handy C++ lint based on that guideline. I have downloaded it renamed that script to cpplint, chmod to executable and move to /usr/bin to use. (Also changed the shebang to /us/bin/env python, because default shebang [...]

Writing your own toy OS kernel

Every young programmer/computer scientist (at least the ones I know) has at least one time in their life dreamed about writing their own OS. Because it is one of the most complex computer program that you can write and there is a great challenge plus chance to hack in front of you. I fell in [...]

A Few Interesting Articles from LWN

Neil Brown has written very nice and helpful series of articles about the design patterns used in linux kernel: Linux Kernel Design Patterns Part 1 Linux Kernel Design Patterns Part 2 Linux Kernel Design Patterns Part 3 But recently he has written a great analysis and criticism on the design of UNIX: Ghosts of Unix [...]

Auto expanding vectors in C

One or two years ago while writing a C program, I need  Java’s arraylist like generic data-structure for C and wrote the code below. Hope that it will be useful for someone: autoexpandvector.c’s code is as above and you can get the header file,  grab the test code and compilation script from the github repository. [...]

Standard C library Functions That You Should Avoid Using Because of Security

OpenSolaris Project has  a very good reference about the security considerations for the standard C library functions. But here I compiled a list of the most used ones. Also refer to the ACM’s C library Reference page about the functionalities of these functions. gets: This function can cause buffer overflows, because it is impossible to [...]

Solving CUDA Compiler Version Problem in Linux

CUDA’s default SDK(version 3) and compiler uses an older version of gcc (gcc-4.3); and if the gcc installed on your computer doesn’t match with CUDA’s version, it will fail installing. But there are ways to bypass this problem without removing your current compiler. To compile a CUDA code with a specific version of a compiler: [...]

A Very Nice Reference for Software Design Patterns

A few days ago I found Sourcemaking’s design patterns reference page. It is a really good reference for fundemental Object Oriented Design Patterns and I recommend it anyone who wants to dive into Design Patterns. Although I usually find Head First series very basic and childish but their design patterns book Head First Design Patterns [...]

A Brief Guide to Socket Programming in C

This brief guide is prepared for the people who knows C and have some knowledge about computer networks and protocols. This guide is mainly a summary of several resources indicated in the resources part. For the folks who want to get more information related to some fundemental knowledge related to essentials of computer networks. Please [...]