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

 

Advertisements

How to Create a Twitter Like Retweet Links

Twitter is one of the most visited social networking sites , and one of the factors in their success is the intuitiveness of  the user interface .

In this tutorial We are going to learn how to create a twitter like mouse over effect for retweet , favorite links

Twitter mouse over effect

To achieve this effect we are going to be using HTML, CSS and jQuery .

First the HTML :

<body></pre>
<div class="<span class=">TweetContainer"></div>
<pre>
        		<div class="Tweet">
        			<span class="TweetAuthor">
        				<p><strong>JamesBond007</strong>:-</p>
        			</span>
        			<span class="TweetText">
        				I am #Bond, #James Bond ! @JamesBond007
        			</span>
        		</div></pre>
<div class="<span class=">TweetActions"></div>
<pre>

        			<em>Favorite</em>&nbsp;
        			&perp;
        			<em>Retweet</em>&nbsp;
        		</div>
        	</div>
</body>

We create a Container DIV and 2 separate DIVs one for the Tweet and another for the TweetActions. The actual Tweet content is put inside the Tweet DIV and TweetActions contains Favorite and ReTweet .

Next The Styling

<style>
                	.TweetContainer
                	{
                		margin: 15 auto;
                		width: 500px;
                		height: 70px;
                		background: #C7EEFE;
                		padding: 30px;
                		border-radius: 15px;
                		font-family:  Arial,sans-serif
                		border-color: #B7EEFE;
                		border-width:medium;
                	}
                	.TweetActions
                	{
                		position: relative;
                		left: 300px;
                		cursor: pointer
                	}
</style>

And now comes the jQuery Code

                <script>
                        $(document).ready(function(){
                        	//Hide the Favorite and Retweet Buttons
                        	$('.TweetContainer').find('.TweetActions').hide();
                        	//Trigger the Mouse over action
                        	$('.TweetContainer').mouseenter(function(){
                        		/*
                        		 * Show the Retweet and Favorite buttons for the Current
                        		 * Tweet
                        		*/
                        		$(this).find('.TweetActions').show();
                        		//Highlight the Current Tweet by changing the background Color
                        		$(this).css({
                        			'background':'#C7FFFE',
                        		});
                        	});

                        	//Trigger the mouse leave action
                        	$('.TweetContainer').mouseleave(function(){
                        		/*
                        		 * Hide the Retweet and Favorite buttons for the Current
                        		 * Tweet
                        		 */
                        		$(this).find('.TweetActions').hide();
                        		//Change the background color of the Current Tweet to normal
                        		$(this).css({
                        			'background':'#C7EEFE',
                        		});
                        	});
                        });
                </script>

Putting it all together we get

Live DEMO

To get the full Source code just save the Demo Page as html and open it with a text editor .

As always comments and Suggestions are welcome .
Please Post your comments below


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” .


Typing தமிழ் (Tamil) on Ubuntu Linux

To type a indic language on Linux you need to do some work before you get it working and before we start I am assuming that you are using ubuntu Linux 10.04 or higher .

The first thing you need is to install ibus 

so to install ibus open terminal and type

sudo apt-get install ibus


sudo apt-get install ibus-m17n

after installing ibus and m17n go to System->Administration->Language Support in the Gnome menu

Select keyboard input system as ibus

Click on Install/Remove Languages -> Select Tamil -> Select all the Components ->Apply the changes.

Then go to System->Preferences->Keyboard Input Methods 

Goto Input Method Tab , Select an Input method and then choose Tamil -> Tamil-phonetic and click Add

Enable Show icon on System tray 

then your preferred shortcut keys .

Choose Tamil from the keyboard icon in the notification area

and now you can type தமிழ் (Tamil) !!

நண்றி வணக்கம் !

 

Post you comments and Suggestions in the section below .


Serving Servlets !

When staring web developement now a days many people  start with PHP , Ruby on Rails , or something like that , but there was a Time when Servlets were King .

Servlets are still very Prominent and are also very powerful, and sometimes better than any other web development platform.

To get started with servlets using just Tomcat is very easy , but using Eclipse along with it Required a small bit of effort .

I spent 20 minutes on learning how to configure Eclipse to work with Tomcat 7

So here is a Tutorial for the same .

So Lets get Started…..

The Downloads

2 Things have to be downloaded

  1.  Eclipse IDE for Java EE Developers
  2. Apache Tomcat 7

The Process

I am writing this tutorial for Linux but the concept is the same for Windows and Mac .

After Downloading

Extract Eclipse and tomcat into a folder

After Extracting Eclipse ,

Run Eclipse

open Window->Preferences 

Choose Server->Runtime Environments

Click Add 

Choose Apache Tomcat v7.0

Click Next

Choose the location where Tomcat was extracted 

Click Finish

Now the Server has been successfully added .

The Project

Create a new Dynamic Web Project

After Creating the project

Right click on the project  select New->Servlet

Now you can create your Servlet and run it in eclipse with Tomcat ,  so what are you waiting for  get coding!!


Things to do after installing Python ~ on the Fly tutorial

After installing Python on windows you may be wondering what to do next .

Well the first thing you should do is find a way to edit .py souce code files , you can use notepad or wordpad already present in windows , but i highly recommend Notepad++ because it offers some very good features like Syntax highlight and also has a vast library of Auto Completion prompts for Python , and you can also add your own .

The next thing that is to be done is Read the documentation , You can do that here: http://www.python.org/doc/ or it is found in the Python install folder under Doc.


How-To Create A Cool Html Page to link to Web Apps in 10 minutes

image

When Google Chrome Rolled out it added the new feature of creating application shortcuts , but you had to have

different shortcuts for different apps like Gmail, Calendar , Facebook … etc . So I created a HTML page using which I can Link to other Apps.

Creating just a HTML Page is very easy ,but I wanted more than Just 4 links that I can click, I needed Animated effects and Icons , so I made it using JQuery .

Click Here to check out the Demo .

Read the rest of this entry »