Archive for the ‘Programming’ Category

Basic Concepts in Functional Programming Part 1

In a series of posts I’ll try to summarize (only briefly) the basic concepts of functional programming. Functional Programming According to wikipedia the definition of functional programming is: In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the [...]

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 [...]

Learn you a haskell for Math! – Part 1

It has been for some time since I’ve used haskell for programming (in fact for my personal and work related projects I don’t use haskell. because I still feel so novice at it), so I thought that implementing some basic mathematical functions might be a good exercise. I’m planning to write 3 series, in the [...]

Matlab Commands in NumPy and R

There is a very nice pdf prepared by V. B. Gunderson for the correspondents of Matlab commands in numpy and R. You can access the pdf version of document by clicking here. Take note this site, one day you may need it . Related Posts:No Related Posts

Esoteric Algorithms and Esoteric Programming Languages

I’ve recently gained interest in esoteric algorithms and languages. They are fun to read and write. The most famous one of them is quantum bogosort that I describe below, Quantum bogosort: Assume that you have a deck of cards. If you you have a quantum computer one of the most efficient sorting algorithm will probably [...]

A simple shell for git

gitsh is a simple git shell for interactive git commands. With the help of gitsh, you can run git commands without adding git before it. I know, it is not such a big innovation(at least you can’t stop global warming with this); but it is very useful if you write many git commands consecutively. You [...]

Importance Sampling

Importance sampling is probably one of the easiest sampling algorithm and one of the most fundamental one as well. The main purpose of it is to  estimate the properties of a particular distribution, while only having samples generated from a different distribution rather than the distribution of interest. Depending on the application, the term may [...]

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 [...]