Read_file_bytes

Yesterday, I needed a tool for reading files as bytes. Hexdump programs generally do some formatting and stuff. I did not want that. I wanted to have a straight forward, simple sweet tool, that simply reads a file and prints it's bytes. Time required for searching such a tool is indeed greater than the amount … Continue reading Read_file_bytes

PostgreSQL as Object Database

This is a live blog (i.e. I'd be updating this post time by time. I am starting to use PostgreSQL as Object Database, mainly as a part of my course project. Object oriented extension of SQL is quite interesting - I, kinda, am loving it. However, all object oriented extensions are not yet implemented by … Continue reading PostgreSQL as Object Database

glut in MS Visual Studio 2010 (MSVS10)

One of my earlier blogs, OpenGL and glut in C++ with MS Visual Studio 2008 (MSVS9) described how to set up your Visual Studio and Computer to work with glut, as well as OpenGL. Now with the new edition, Microsoft Visual Studio 2010, as the version shifted from v6.0A to v7.0A, we need to change some … Continue reading glut in MS Visual Studio 2010 (MSVS10)

OpenGL, Tree as a fractal, trigonometric Approach

Our goal is to, Draw a tree using fractals with recursion Take user input for: Depth of tree/sub-trees Angle between leftmost and rightmost branch in same depth Fractals are useful way of approaching to infinity and for drawing some real life like objects where same pattern recurs. To do so, we are drawing single line … Continue reading OpenGL, Tree as a fractal, trigonometric Approach

Randomizing the C++ Random function

In programming, we often need to use the random number generator. C++ also provide us with one function for the purpose, the rand(). Alright, it functions properly, I have nothing to blame it about, but one thing you might have noticed, it always generates the same sequence of random numbers, i.e. these are not really … Continue reading Randomizing the C++ Random function

List in Prolog

It is important for any programming tool to have some functionality of handling collections like array, list or something else. Prolog use lists for the very purpose and I must warn C/C++ programmers (or even Java, C# or any other C-like language fan) that lists are not arrays but similar to it. A list must … Continue reading List in Prolog

Prolog program to find GCDs and LCMs

The least common multiple (LCM) of two integers a, b is the smallest positive integer that is a multiple of both a and b. Despite of the fact, there exist several formulas to calculate the LCM of two integers, most popular formula, especially to the programmers, is by using GCD of the two: LCM(a, b) … Continue reading Prolog program to find GCDs and LCMs

Prolog program to Calculate factorial of N

We know the formula for calculating n! (factorial of n)  is: n! = n * (n-1)! We can interpret this simple mathematical equation into a Prolog program. To do so, we must determine the basis of the recursion, 0! = 1 We will use two predicates here, factorial predicate with one argument N, that will … Continue reading Prolog program to Calculate factorial of N

Beginning Device-independent Graphics Programming with OpenGL (using GL, GLU & GLUT)

We have already set up GLUT and OpenGL [↗]. Now we can start writing codes from the ground up. Create an Empty C++ Win32 Console application and add a C++ source file. Add necessary library headers as follow: #include <stdlib.h> #include <GL/glut.h> ‾ Note» alteration of order will cause generation of error message. Now let … Continue reading Beginning Device-independent Graphics Programming with OpenGL (using GL, GLU & GLUT)

OpenGL and glut in C++ with MS Visual Studio 2008 (MSVS9)

OpenGL support come with many IDEs, programming  environments and compilers. Likewise MSVS9 comes with built in support for OpenGL so that you can use all features of gl and glu libraries simply. To use glut support we need to download and add the glut support. Let us do both one by one. OpenGL (gl and … Continue reading OpenGL and glut in C++ with MS Visual Studio 2008 (MSVS9)