Adding Mongo DB driver to XAMPP

Like many developers I use XAMPP for PHP development. But adding PHP extensions in xampp to does not seem to have a direct procedure . So when I wanted mongodb drivers I was on my own to figure out how to get it working . Here is the knowledge I gained .

I am using Ubuntu oneiric ocelot machine so this procedure is similar for all *NIX machines  (Sorry windows users but the procedure must similar).

  1. First download and install Mongo db from mongodb.org/downloads
  2. Secondly download the PHP MongoDB driver source from github.com/mongodb/mongo-php-driver
  3. Now to compile the code
    1. You need phpize to compile the source code, so install php5-devpackage by running `sudo apt-get install php5-dev`
    2. Navigate into the mongo-php-driver directory and run `phpize` on the terminal
    3. Then run `./configure` to check for dependencies
    4. Run `make` to build the package
  4. Assuming XAMPP is installed at `/opt/lampp/` copy `mongo.so` and `mongo.la` from `modules` directory inside mongo-php-driver directory to `/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/` directory
  5. Add the line `extension=mongo.so` to  `/opt/lampp/etc/php.ini`
  6. Start mongodb and xampp servers and run the program test program from php.net/manual/en/mongo.tutorial.php to check if it is working

 


Short term memory loss !!

An arch Linux box that I was running on my laptop just ran out of memory

Serves me right for allocating only 128MB RAM for it.

I was not even running a GUI , there was only a ssh server and the network services running. I was installing a few JRuby gems via a ssh session when this suddenly happens.

This highlights a very valid point in today’s world of computing, I feel that today’s software aren’t really very efficiently built.

We are taking the amount of memory that is available, for granted and not writing very efficient software .


Limit the CPU usage of a process (Linux).

There have been times when I wished that I could limit the cpu usage of a process even though it might run slower , There is a simple way to do it on Linux .

Just type the following in terminal.

 cd /tmp
 wget 'http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz'
 tar -zxvf cpulimit-1.1.tar.gz
 cd cpulimit-1.1
 make
 cp cpulimit /usr/local/sbin/
 rm -rf cpulimit*

If you are a debain/Ubuntu user you can also do the following in terminal.


$ sudo apt-get install cpulimit

After installation to limit the cpu usage of a process :

cpulimit -p  -l

Happy cpu reduction !!


extraire avec unrar sous (Extract with unrar on) linux

Ever since I switched over to Linux extracting files from win-rar archives was never a pleasant experience especially broken archives  .

Then I recently I discovered the power of Command line and suddenly I realised things got much easier .

So how do we go about Extracting win-rar archives ?

Well there are three methods

  1. Use Ubuntu’s inbuilt archive manager (File roller) , Personally I hate this program.
  2. Use Winrar itself on Wine , Ok but it doesn’t work as good as it does on Windows.
  3. Use unrar from terminal , Pure Brilliance !!

So lets Un-RAR the RARs

Open terminal and navigate to the folder where the archive is and  type

unrar e [filename].[rar]

replace [filename].[rar] with which ever archive you want to extract .

Add -kb switch to extract non-complete / broken archives

So for example to Extract Foo.rar

unrar e Foo.rar -kb

Some may consider this method as too long or not as easy as using a GUI , but once you get the hand of the command line This is the fastest method.

Please feel free to Post your comments and suggestions below

PS: If you are asking why the French title , well the answer is “Simply because I was in the mood to use Google translate” .


Firing up Ubuntu with the 4th Fox

Firefox 4 (stable) was released yesterday (March 22 , 2011), So I decided to write an article on how to install firefox 4 on Ubuntu the easy way.

Now if you goto mozilla.com to download the latest version on linux you prompted to download a file called  firefox-4.0.tar.bz2

but many people don’t know how install this file , well the easier method is to download the latest version from Firefox stable PPA

but before you do this make sure to uninstall any beta versions.

Open terminal and type the following commands
First thing to do is add the Firefox stable PPA

sudo add-apt-repository ppa:mozillateam/firefox-stable

then before we can install firefox we need to update the PPA

sudo apt-get update

Finally we can install Firefox

sudo apt-get install firefox

And thats it , firefox will now download and install itself , Simple and Easy !


Natty Narwhal

The Latest Upcoming Distro of Ubuntu is 11.04 (Natty Narwhal)  , and here is a nice counter from a German blog .

The Latest release comes with the totally redesigned Unity interface .

Lets wait and see how it turns out !!

Ubuntu 11.04 days to go


I am Officially Human !!

96 Hours :

Its been exactly been 96 hours since Ubuntu Linux 10.10 (Maverick Meerkat ) was installed in a dual boot Setup on my Laptop ,

and I am proud to say that I have booted into windows only twice in that time and that too only temporarily. I have been using a Microsoft OS as my Primary Operating System form 1998-99 , that was when I convinced my dad to bring Home his old Office Computer so I could Use it

The last time I installed Ubuntu was way back in its Gutsy Gibbon(7.10) days , back then I had Windows xp on one Hard disk and Ubuntu on another Hard disk  so each time I wanted to switch OS I had to change the Hard disks , OK Enough History  now Lets Get Down To business .

The Awesomeness that followed :

Not much has changed really ,I still use firefox and chrome for browsing , VLC for videos …. etc .

But wait the waiting time has decreased , I mean the boot time has some how magically dropped , well may be thats because I am using a newly installed OS .

Then there is the part about having a Cooler looking Desktop !!

I was surprised  when I found out that I had almost all the features of Windows 7 Aero Interface (Including transparent Window borders ) Though they  function a bit differently in Ubuntu and as usual you do need a Capable Graphics card to handle it , but if you don’t you can just as easily turn them off .

What about applications I asked myself , I knew that there were open source alternatives to many windows applications or I could count on WINE to run my apps  , Well my Knowledge turned out to be true . Even the occasional Counter Strike game that I play , works Fine on WINE .

I forgot to mention the standard procedure everyone performs immediately  after installing Windows  , Installing Drivers , then Installing an Anti-Virus Program  , well as you have probably guessed by now I did skip those parts because there weren’t needed . I did Have to Download Updates though .

The Not-So Awesomeness that Followed :

The first thing tried to do after installing Ubuntu was Play a movie  , but due to some lame ethical and copyright reasons it refused to play Mp3 , AVI (Divx , Xvid)  , MKV (H.264 , X264 ) , Mp4 , Flv … and the other commonly  used formats .

Youtube was also on the list as Flash Player was also not present Out of the Box .

But the solution was really simple , install ubuntu-restricted-extras .

The AWESOME desktop that you see above doesn’t come out of the box  , though the default desktop still looks good .

Finally :

In the past 96 hours I have not missed Windows one bit , but lets see how Ubuntu holds up in the coming months .