Insert code in wordpress posts

Follow this link to insert code in your wordpress blogs which is hosted on the wordpress.com. This is for those who blog on wordpress.com itself.

http://en.support.wordpress.com/code/posting-source-code/

Enabling execution of cgi scripts on linux (debian)

This is how to enable the execution of cgi scripts on linux. Add the following code the /etc/apache2/httpd.conf file.

ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin/">
    Options ExecCGI
    AllowOverride All
    Order allow, deny
    Allow from all
</Directory>

Remember to make the files that are put there executable by the doing the following.

% chmod +x file.cgi

Lastly you should have had the cgi module loaded in apache.

Setting Up libcdio for Ruby on Debian Lenny

I am on the verge of a writing a program to read a list of tracks from an audio CD in C but since i also program Ruby i am playing around with it using an already existing library. This is how to set it up on a debian machine.

% apt-get install libcdio

% apt-get install libcdio-dev

% apt-get install libcdio-cdda-dev

% apt-get install iso9660-dev

% gem install rbcdio

% apt-get install libcddb-dev

% irb

%

irb(main):001:0> require ‘rubygems’

irb(main):002:0> require ‘cdio’

And that is that.

Restarting supertux

If you have been wondering how to set your supertux installation so that you can play the whole game as if you just installed it then issue this command on your system.

% rm -r ~/.supertux

That is it.

The tee command

If you are looking for a very good tutorial to the tee command look no further.

http://en.wikipedia.org/wiki/Tee_(command)

Using xargs

For sometime now i have been trying to use the xargs command but it sometimes proves somewhat hard for me to understand but now i think i have got the hang of it. Here is a sample code to demonstrate how easy it really is.

% find . -maxdepth 1 -name ‘filesys*’ -print0 | xargs -0 -Ifil mv fil “thefile”

The various parts of the command are :

  • .   : Represents the current directory.
  • -maxdepth : Tells the find command to which depth should it recursively look for the search term. In this case its 1.
  • -name : The name of the search term or item.
  • -print0 : Note its “Zero” not O. This prints out the file matching the name. The 0 handles file names that have whitespaces in them. I think its always good to have them on.
  • -0 : It also handles white space characters for you.
  • -I : Temporarily store the currently matched file in the variable “fil”.
  • mv : Rename the file represented by fil to ;
  • the file. You can do without the double quotes.

Hope that helped.

How to set your date on a linux machine

I have been skimming through a lot of linux books and yet not even one was able to tell me how to set the time. I mean the popular books online. I later found out that the way to set the date is by the following way:

% date -s  “11:58″

By the way you have to be root or else use sudo

Europe is not so beautiful after all. Ask any Ghanaian.

The recent increase in toll prices have given a view as to how Ghanaians think about Europe. Everyone in this country hopes to live or work in a more developed country because its conditions there are good. Good roads, constant supply of electricity and water, good internet connectivity, a sound environment and a free society. Everything is tracked in Europe. Phone numbers and calls, recent crime committed, the book one is currently reading and so on.

But do we know all this comes at a price? Do we know that for a country to be as clean as the ones we see on tv requires a huge amount of money being sunk into it without any political undertones? I guess not.  We think the people in Europe woke up one day to find all these things there. They paid no taxes, no fines, no charges, no bills. All these things came into being without a conscious effort.

A little* increase in the toll price in Ghana and every body is crying foul. Its like the money is going to end up in someones pocket. Even if that is the case, a large part will go into the repair and maintenance of the road. There is nothing like free lunch. If people want Ghana to build roads with good quality lighting, road demarcation,  enough security on the  road at night, then we should welcome the increase. We all have to know that if our dream of Ghana being like what we see on tv is going to materialize then it calls for us to be devoid of politiking everything even when its in the best interest of the country. When the announcement was made people were quick to point in all political directions. Tell me , which government in Ghana has never benefited from being in power ? They are all the same.

In the end, if Ghanaians were to be shown all the money (taxes) that went into the building of first world countries, we would say we wanted Ghana just as it is, dirty, filthy and unplanned. Some how, it also seems that we do not like to live by the law (constitution). We set our standards as to what the law says about things.  Probably its not so much of our fault. If the state wants people to live by the law, then the state should provide the very basic needs of the society.

Some linux basics, not all. #1

With the ls command being one of the simplest commands to use, it lists files and folders/directories. Used alone it only displays visible files and folders. To display all files visible and not visible append -a to the ls command so that it looks like this.

user@ubuntu:$ ls -a

To see the directory in which you are issue the pwd command. This prints the current working directory. This command is really useful when you have no idea as to where you are in a file system. For example when you are logged unto remote server.

Changing the directory in which you are is very simple. The cd command changes the directory in which you are. cd alone takes you to the users home directory, (/home/user/). To change to another directory change directory use the cd command and the directory you wish to enter like this.

user@ubuntu:$ cd /etc

The directory is changed to the /etc directory.
Note : The trick about the cd command is that cd .. takes you back to the immediate parent directory.

Starting from where i left of.

This is yet another attempt to begin doing something that i think i have put on the shelves for a long time now. Just as it may come natural or normal for some people to blog all day with quality information, i can’t say that for my self. With the frustration of getting access to the internet, coupled with so much commuting about, blogging is not one of the things that easily come to mind, at least from where i stand. But what has to be done has to be done and done well. No room for laziness, reluctance and a pool of excuses. I am resolved and blogging shall i do come rain or shine.

Follow

Get every new post delivered to your Inbox.