Avoiding memory leaks in POSIX thread programming

POSIX thread programming defines a standard set of C programming language types, functions, and constants—and pthreads provide a powerful tool for thread management. To use pthreads to the fullest, you’ll want to avoid the common mistakes. One common mistake is forgetting to join joinable threads, which can create memory leaks and cause extra work. In this tips-oriented article, learn the basics of POSIX threads, see how to identify and detect thread memory leaks, and get solid advice for avoiding them.

read the whole story here

Install ATI graphic card on Debian Linux

ati_logo_game

There are at least two methods that can be used to install the fglrx driver in Debian. The first, and recommended way is to use the native Debian packages directly from the non-free repository.

Get the packages updates:
sudo aptitude update

Install your kernel headers:
sudo aptitude install linux-headers-`uname -r`

Continue reading

How to enable mod_rewrite in apache2 (debian/ubuntu)

apache_display

First install the apache with this command:

apt-get install apache2

Now use locate to find if the mod_rewrite.so is availble on your server:

updatedb
locate mod_rewrite.so

it will found in “/usr/lib/apache2/modules”

New apache follow some folders to enable and disable mods so now do this:

cd /etc/apache2/mods-enabled
touch rewrite.load
vim rewrite.load (you may use any editor to edit this file)
Continue reading

Debian – PHP, MySQL, Apache2

computer-server
This article is a walkthrough on installing PHP environment – PHP, Apache, MySQL and xDebug on Debian.

When it comes to database servers, there are several free database server applications available. The intended use of the database server will have some impact on which database package you choose. MySQL is the most widely used free database server. However, it’s use is primarily to act as a back end database for Web site applications written in embedded scripting languages like PHP because it doesn’t support things like triggers, stored procedures, and replication (yet).

Open a terminal. You will need to install all the parts as root, so… suit up!

Install Apache web server

apt-get install apache2

Install MySQL server

apt-get install mysql-server

Continue reading

Using Screen for Session Management

terminal-icon_128x128Lost your shell connection? Need multiple shell sessions?
You are logged into your remote server via SSH and happily plucking along at your keyboard and then it happens. Suddenly, the characters stop moving and then you get the dreaded “Connection Closed” message. You have just lost your session. You were halfway through some task and now you have to start over. Ugh. Well you can prevent this from happening by using screen. Screen can not only save you from disconnection disasters, but it also can increase your productivity by using multiple windows within one SSH session. Use Screen for Session Management!

What is Screen?
As the man page states, “Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells).” This can be a life saver when working on your dedicated server. Screen has a several great features for helping you administer your server more productively and safely. I am going to discuss the three features (multiple windows, logging, sessions) that I use the most but be sure to see the man page for full details.

$ sudo apt-get install screen

Using Screen
Screen is started from the command line just like any other command:

$ screen

Continue reading

Simulation of Evolution by Natural Selection

Uma coisa doce que nos foi mostrada numa aula de inteligência artificial
O motor fisico assim como todo o ambiente foi criado pelos programadores, as espécies em si desenvolveram-se por si próprias através de inteligência artificial orientada por algorítmos genéticos.

This video shows results from a research project involving simulated Darwinian evolutions of virtual block creatures. A population of several hundred creatures is created within a supercomputer, and each creature is tested for their ability to perform a given task, such the ability to swim in a simulated water environment. Those that are most successful survive, and their virtual genes containing coded instructions for their growth, are copied, combined, and mutated to make offspring for a new population. The new creatures are again tested, and some may be improvements on their parents. As this cycle of variation and selection continues, creatures with more and more successful behaviors can emerge.

The creatures shown are results from many independent simulations in which they were selected for swimming, walking, jumping, following, and competing for control of a green cube.

Interview with Karl Sims, the creator of this program:
http://www.youtube.com/watch?v=b1rHS3R0llU