categories

C: Linux Socket Programming, TCP, a simple HTTP client

Linux provide a high level socket API that will allow programmer to easily connect to any TCP or UDP services.

In this tutorial, we will see how this works by implementing a simple HTTP client which will get request a web page given the hostname and the page name, then read the server answer and output the HTML content of the reply.

Python GTK: How to customize the size of a button in a notebook tab label

In the previous post, I showed how to customize your gtk.Notebook Tab Label by adding a close button to the tab.
Depending on the theme used by the user, the tab might get pretty big once a gtk.Button is added.

In this tutorial I will explain how to override the theme behaviour by creating a custom style for our widget.

Python GTK: How to set up gtk.Notebook tab with custom widget

gtk.Notebook is a great feature as it help keep your application footprint on the desktop occupation low. I personnally would not even think of using a web brower without a tab feature as it would take me a help of a time to go from one application to another.

A gtk.Notebook page is composed of a child widget and a label gtk.Widget. From there on, we can fit anything we like in a tab label such as an icon on the side representing the content, a title and a handy close button on the right side a bit like firefox's tabs.

This tutorial will detail how to customize the content of a Notebook tab label but really is a kickstart to any plausible gui arrangement.

Python GTK: Treeview with rows of different colors

With a simple example, I am going to illustrated how to build a ListStore TreeView in pygtk (python's gtk binding).

Building a standard ListStore in pygtk is pretty straightforward, however, it can get a bit more difficult to set up a custom TreeView where the rows and columns that are displayed can have different colors.

This tutorial will show how-to create and set up a TreeView, its TreeViewColumn and finally, the CellRenderer.

Python: [socket] A simple TCP client

This article will show how to connect to a remove TCP server using python's socket module.

In this tutorial, we are going to connect to a server, send some data and then read from the socket.

Python: Embedding a Virtual Terminal in a GTK widget with python vte library

python-vte bindings allow you to embed a simplistic virtual terminal in any of your GTK apps real easy.
This tutorial will show how you can add a terminal to a widget in less than 30 lines, 4 lines only being necessary to set a the terminal session.

How To trim a string in perl

trimming a string from whitespaces does not come out of the box in perl. Like for many other operations, we need to use regexes.

This tutorial will show how to trim, ltrim and rtrim a string in Perl.

How-To: Serializing variables in perl

Serialization is used to store data and objects into a file for instance. The serie of bytes that is generated can then be re-used to generate an object that will be identical (a clone) to the stored object.

In Perl this can be achieved through the Storable module.

This tutorial will quickly show how to store and retrieve such objects.

Perl: Calculate the md5 sum of a file

This code sample shows how one could compute the md5sum of a file using Perl's Digest::MD5 module.

Perl: checking if a value is a float

While some languages offer an is_float function, Perl seems to only rely on regex.
This tutorial will show how to find if a variable contains an integer or not.