Giannis Kanellopoulos

About Giannis Kanellopoulos

Biography to be completed

Posts by Giannis Kanellopoulos:

Tips for beginners: How to align text & content with html & css

Html-cssQuick Example: How to align text & content in CSS

In this post we show how to vertically align your text even if the text is changing its font size dynmically and also how to

align horizontally content (aka divs – otherwise you can do it with span tags) using the old fashioned floats. At the end you can find 

the code in jsFiddle for further practice.


Git: How to merge your branch

gitIn this post I will show you four ways to merge your branch with the main branch, which we will call develop, of the project.

1. Merging on develop

git checkout develop

git pull origin develop

git merge yourBranch

This method is the most frequently used. It uses the recursive automatic merging method of Git to merge the changes of your branch upon the main develop branch.

2. Merging with rebase

git checkout yourBranch

git rebase develop

In this method you are applying the develop branch upon yourBranch. If there is a conflict in the process of merging the process stops and you must fix your conflicts manually which may be an advantage some developers. Moreover it does not produce a merge commit message, so it helps to keep the commit history clean.

3. Merging with pull on your branch

git checkout yourBranch

git pull origin yourBranch

git pull origin develop


How to Build a Simple Game using OpenGL in C

“OpenGL (Open Graphics Library) is a cross-language, multi-platform applicaion
programming interface for rendering2D and 3D vector graphics. The API is typically used to interact with a graphics processor unit (GPU), to achieve hardware accelarated rendering.”

So OpenGL is an open library that let us a draw graphics. In this post we will show how a rookie can build a OpenGLsimple game with OpenGL in a C environment. Specifically this game will feature a spacecraft and we will design and implement each part of it using the primitive types of  OpenGL . Moreover we will build the environment which includes  space, stars , a sun and some planets with the same way. Then we will introduce the way that we can add an animation movement. Finally we will load an asteroid from an object file that will have an orbit towards our spacecraft and the goal will be to avoid the asteroid. More

Build a Server – Client Application in C that executes concurrently Terminal Commands

In this post we will build a server – client application that will get our hands dirty with signals, fork, named pipes and the exec command. This application has a very simple concept:

“Client creates, with a new process, the Server and sends to him terminal commands using as interprocess communication a named pipe (aka fifo pipe)”

Moreover this model must executes terminal commands concurrently and we accomplish that using a signal handler. To be more specific when a client sends through the named pipe a command, the server wakes up because the signal handler  receives the SIGCONT signal and changes the wake up variable from 1 to 0. This wake up variable is being used in the server to keep him in sleep mode and not busy waiting. Let’s see a simple example with just the mechanism of it:

Create a Word Auto-Completer in C using the Trie Data Structure

So first of all a few words about our basic structure, the trie…

In computer science, a trie, also called digital tree and sometimes radix tree or prefix tree (as they can be searched by prefixes), is an ordered tree data structure that is used to store a dynamic set or associative array where the keys are usually strings. Unlike a binary search tree, no node in the tree stores the key associated with that node; instead, its position in the tree defines the key with which it is associated. All the descendants of a node have a common prefix of the string associated with that node, and the root is associated with the empty string. Values are normally not associated with every node, only with leaves and some inner nodes that correspond to keys of interest.

For example, in our case, our project involves alphabets with every inner node of the trie data structure representing a letter which means that each node has a unique path from the root (can have up to 26 children as the number of the Latin alphabet) that symbolizes a word.


In our project, in order to create our fancy auto-completer we will need three structures. Firstly we need the structure of the

inner nodes that store a character that represents the letter of this node, an array of 26 letters that will navigate through the next letter. Moreover to make our program more accurate we will use an array that stores the top leafs (top words) under this inner node and a leaf pointer that is going to show us that the path from the root until this inner node reflects a word. The leaf structure contains the frequency of this word (which is the parent of the leaf) and a pointer to the last letter of the word.