Stress testing and profiling tools for web application

Hi there,

Recently I came across some cool new tools along with some of my old favorites and thought this calls for a quick post -

Front End Profiling Tool:

FireBug: Firebug is pretty handy to find out how long it is taking your website to load and render as well as how many header calls are made to fetch external java-script and css files. It also packs lots of useful tools and a must have for any serious web application developer.

YSlow:YSlow sort of gives your an easy to understand report on your web pages flaws and how to overcome them.

Web Server Stress Testing Tool:

Siege: Siege is a command line tool that you can install and simulate concurrent hits to any particular URL.

Example:

siege -c 10 -r 10 http://www.mydomain.com/

Above code pings the URL concurrently with 10 connections repeating 10 times making 100 hits to the URL.

MySQL database Profiling Tool:

Jet Profiler:Jet profiler Shows the real time activity of the connected mysql database once its hooked up. It is pretty useful when used together with the siege tool and see how concurrent hits affect the database.


Naturally these are not all that is out there so any new inputs from the readers will be most welcomed :)





thanks,

faisal ahmed

web application developer
web: http://www.faisalbd.com/
email: thephpx(at)gmail(dot)com

Share

Linux Mint: Fixing Tray icon issue

Hi all,

Soon after installing mint 11 I started facing the issue where some applications when closed did not minimized to tray but was still running. Skype, Pidgin are the two that I have faced this issue.

The solution is two-folds, first ensure you have notification area added to your system tray. Then goto System > Administration > Compiz Fusion Icon

A new icon should now show up for the Compiz Fusion, right click and then select -
Select Window Manager > Metacity

After some screen flickers everything started working fine for me hope it does the same for you too :)

take care,

faisal ahmed

web application developer
web: http://www.faisalbd.com/
email: thephpx(at)gmail(dot)com

Share

Linux: Bash script for dynamic symbolic link creation

Hello everyone,

I just created this simple but useful bash script to create symbolic link. It lets me avoid going into my local server root located at /var/www/ and instead symbolic link of a folder located at /home/public/ is created at /var/www/ so anything that you put inside /home/public/project1 or project2 or whatever the folder name is it also gets reflected and thus can be accessed via link http://localhost/project1 or http://localhost/project2 and so on.

STEP 1: create a file named symlink at /home/public/ or anywhere you like. Then copy the following code inside it and save it.

  1. #! /bin/bash
  2. sudo mkdir -m 777 $1
  3. sudo ln -s /home/default/Public/$1 /var/www
  4. echo $1 symbolic link created


STEP 2: To use the script to create a folder and create a symbolic link at the server root located at /var/www/ you have to type in the following code and press enter.

  1. sh symlink faisal


On the above code sh is the prefix required to run the bash script named symlink and faisal is the name of the folder i want to create and link to /var/www/

Hope the above snippet was useful.



thanks,

faisal ahmed

web application developer
web: http://www.faisalbd.com/
email: thephpx(at)gmail(dot)com

Share

google +1 button onClick event

Hello there,

I was recently working with google +1 feature and came about this trick to trace if someone clicked the button or not.

CODE :

  1.  
  2. <html>
  3. <head>
  4.     <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
  5.     <script type="text/javascript">
  6.        function testme(){
  7.           alert(‘test’);
  8.        }
  9.     </script>
  10. </head>
  11. <body>
  12.     <g:plusone callback="testme" href="http://www.faisalbd.com/"></g:plusone>
  13. </body>
  14. </html>
  15.  



Hope it helped someone :)


thanks,

faisal ahmed

web application developer
web: http://www.faisalbd.com/
email: thephpx(at)gmail(dot)com

Share

Dummies guide to LAMP setup on linux :)

Hello everyone,


Recently I came across several nifty apt-get commands that quite handy and if used properly can be a life saver while setting up LAMP stack on your system.


Step 1 : One line LAMP setup on linux -

  1. sudo apt-get install lamp-server^



Step 2 : Setup phpMyadmin to manage your mysql databases -

  1. sudo apt-get install phpmyadmin



Step 3 : Setup xdebug and integrate with php5 installation -

  1. sudo apt-get install php5-xdebug



Step 4 : Setup cURL -

  1. sudo apt-get install php5-curl



After the above command finishes installing curl do the following -

  1. cd /etc/php5/conf.d/
  2. sudo gedit xdebug.ini



After opening the file in gedit, add the following lines at the end of the file then save and close it.

  1. xdebug.remote_enable=On
  2. xdebug.remote_host="localhost"
  3. xdebug.remote_port=9000
  4. xdebug.remote_handler="dbgp"



The following step is helpful for those who later want to integrate andorid SDK, because only Sun JDK is supported when running the android SDK app, is handy if you use it.


Step 5 : Setup sun -

  1. sudo apt-get install sun-java6



Step 6 : Enable Rewrite Module for PHP -

  1. a2enmod rewrite





The above will do a smooth install of a functioning LAMP server on the system :D , comments and queries are always welcomed.


thanks,

faisal ahmed

web application developer
web: http://www.faisalbd.com/
email: thephpx(at)gmail(dot)com

Share

Google Oauth2 library for CodeIgniter framework

Hello everyone,

I am back with google oauth2 integration library this time. Before you use the google oauth2 library you must have a google application registered so that you have access to api client id and client key which you will need to use it.

Also the redirect url must match your application location. Otherwise google does not provide access to the api. So, best way to test the code is to test it on a live site.

I am not going to go through the code here as I have commented the code well enough for you to understand :)

For any extra query feel free to comment.

DOWNLOAD THE LIBRARY

thanks,

faisal ahmed

web application developer
web: http://www.faisalbd.com/
email: thephpx(at)gmail(dot)com

Share

Codeigniter: Helper for template library dynamic view partial loading

Hello everyone,

I have recently been in quick-fire blogging mode. After playing with the superb template library developed by Phil Sturgeon.

The following template helper is the outcome of tweaking that makes life easier while setting up view partials and calling them inside the layout dynamically. The helper also has an add-on use which gives user the option to use region specific partial loading.

Controller:

welcome.php

$partial_list[]['region'] = 'left';
$partial_list[]['name'] = 'category';
$partial_list[]['view'] = 'partial_category';
$partial_list[]['region'] = 'right';
$partial_list[]['name'] = 'login_box';
$partial_list[]['view'] = 'partial_login';

/* following functionautomatically sets the partials
* based on the above array and also passes $partial_list
* variable to the view.
*/

/*
* make sure the pareser helper is loaded before
* calling this function
*/

setup_partials($partial_list);

$this->template->set_layout('home_layout');
$this->template->build('home_view');


Layout:

home_view.php

<html>
<head>
	<title><?php echo $template['title'];?></title>
</head>
<body>
	<div class="left">
		/* Will show only partials with region set as left */
		<?php show_partials('list', 'left', $partial_list, $template); ?>
	</div>
	<div class="mid"><?php echo $template['body'];?></div>
	<div class="right">
		/* Will show only partials with region set as right */
		<?php show_partials('list', 'right', $partial_list, $template);?>
	</div>
</body>
</html>

Detail about the usage can be found in the actual helper file, also feel free to comment here and I will try my best to help out.

Download Helper:

DOWNLOAD PARSER HELPER

thanks,

faisal ahmed

web application developer
web: http://www.faisalbd.com/
email: thephpx(at)gmail(dot)com

Share

Internet explorer compatibility test with expression web super preview

In the recent past I was involved in couple of UI development and cross browser integration and its during this time I came across “expression web super preview” , which comes from Microsoft for FREE :P

This application can be called an AIO (all in one) IE test suit in terms of UI consistency checks. It allows you to compare different version of the same site in 2 different version of the internet explorer side by side. It also has the option to view the site in various screen resolutions.

I felt it was too nice a product to be shared online and hope it remains free till something else comes up :) only downside is I can use it only on windows systems only.

To download the application click here.

thanks,

thephpx

Share

[SOLVED] Citycell Zoom: DNS issue

Hello everyone,

Recently I have been trying to use citycell zoom on my ubuntu 10.10 but was facing a weird problem. My modem was connecting properly to the service but I was unable to browse using any of my browser.

After lot of trail and error it came to be an issue regarding DNS servers not being automatically resolved. In my KPP connection configuration I just manually setup the following to DNS server IP’s -

Primary DNS: 117.18.224.146

Secondary DNS: 117.18.224.147

After adding the following DNS IP’s the connection seems to be working like a charm :P

Hope this post cuts down the search time for many fellow users, also if anyone of you happen to come across any method to resolve this automatically do post a comment.

thanks,

thephpx

Share

Google translate helper for codeigniter

Hello everyone,

I am back with a tiny contribution. Today I have created a nifty helper for codeigniter which uses the google translate api (v2).

In order to use the function you will require a google translation api key which you can get for free the google api console (https://code.google.com/apis/console).

After you have your key it has to be passed to the function along-with the text to be translated, the language from which it is being translated from and to the language it is translated to. The function returns the translated text which can be used to do further processing or can be also be echoed.

CODE:

  1. <?php
  2.  
  3. /* Develeoped by: faisal ahmed <thephpx(at)gmail.com–> */
  4.  
  5.         function google_translate($api_key, $text, $from_lang, $to_lang){
  6.                 $link = ‘https://www.googleapis.com/language/translate/v2?key=’.$api_key.‘&amp;source=’.$from_lang.‘&amp;target=’.$to_lang.‘&amp;q=’.$text;
  7.                 $response = file_get_contents($link);
  8.                 $array = json_decode($response);
  9.                 return $array->data->translations[0]->translatedText;
  10.         }
  11.  
  12. ?>

Hope to be back with another snippet soon, till then keep in touch :)

thanks,

thephpx

Share