<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mahbubur Rahman - jQuery, PHP, JavaScript, Codeigniter, CSS</title>
	<atom:link href="http://www.mahbubblog.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mahbubblog.com</link>
	<description>PHP, JQUERY, JAVASCRIPT fun</description>
	<lastBuildDate>Thu, 03 Jun 2010 07:23:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to clear CYGWIN screen in Windows ?</title>
		<link>http://www.mahbubblog.com/miscellaneous/how-to-clear-cygwin-screen-in-windows/</link>
		<comments>http://www.mahbubblog.com/miscellaneous/how-to-clear-cygwin-screen-in-windows/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 07:23:20 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[clearscreen]]></category>
		<category><![CDATA[cygwin]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/miscellaneous/how-to-clear-cygwin-screen-in-windows/</guid>
		<description><![CDATA[This is just a small tip. A lot of us use CYGWIN as a port of *nix apps in windows to do various things. And we use different types of terminal like CMD on windows, Git-Bash or Konsole. Now the problem is, CYGWIN default (or even advanced) installation option doesn&#8217;t have &#8216;clear&#8217; command like we [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a small tip. A lot of us use CYGWIN as a port of *nix apps in windows to do various things. And we use different types of terminal like CMD on windows, Git-Bash or Konsole. Now the problem is, CYGWIN default (or even advanced) installation option doesn&#8217;t have &#8216;clear&#8217; command like we have it in Linux. And it&#8217;s annoying esp. when we try a ls -l command and it fills up the screen. The undocumented feature of CYGWIN console is that it clears up the screen when you press CTRL+L.</p>
<p>So, use it when u need it <img src='http://www.mahbubblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/miscellaneous/how-to-clear-cygwin-screen-in-windows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Make your Family Tree with Google Visualization API</title>
		<link>http://www.mahbubblog.com/javascript/make-your-family-tree-with-google-visualization-api/</link>
		<comments>http://www.mahbubblog.com/javascript/make-your-family-tree-with-google-visualization-api/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 06:58:21 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[family tree]]></category>
		<category><![CDATA[google chart api]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=243</guid>
		<description><![CDATA[Ever wanted to build your family tree ? Hell I did, cuz I have records of last 10 generations (Yes, I’m not kidding). The list was maintained by my Grandfather who handed to my father some 15 years ago. Sounds filmy, huh ? Anyways, as we had that in pen and paper, i wanted to [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wanted to build your family tree ? Hell I did, cuz I have records of last 10 generations (Yes, I’m not kidding). The list was maintained by my Grandfather who handed to my father some 15 years ago. Sounds filmy, huh ? Anyways, as we had that in pen and paper, i wanted to make program that generates it. I started JavaScript in late 1998 and in 2002 I wrote a script [only for IE <img src='http://www.mahbubblog.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  at that time ] which shows a family tree and the DB is easily updated from the source. You can run the script downloading from <a title="Family Tree" href="http://www.mahbubblog.com/wp-content/uploads/2010/04/Family_tree.zip">here</a>. I just checked it in IE and it seems to be working still after 8 years.</p>
<p>Yesterday, I was just browsing Google charts and visualization libraries to see if there’s any new thing since I saw them last time. And I saw this organization chart which can be used to build the family tree. So i just wanted to see how our 10 generations’ family looks like when putting them in Google’s visualization library. And it came out a really big horizontal one as you can see below.<br />
<a href="http://www.mahbubblog.com/wp-content/uploads/2010/04/family_tree_mahbub.png"><img class="size-full wp-image-244" title="Family Tree" src="http://www.mahbubblog.com/wp-content/uploads/2010/04/family_tree_mahbub.png" alt="Mahbub - Family Tree " width="600" /></a></p>
<p>Now, you can simply make your family tree using this API. It’s dead simple. Just see the couple of lines of code which is pretty self explanatory. I’m putting a little light here for easy understanding. So go and have fun creating your family tree and show it to your elderly persons, they might be happy seeing it.</p>
<p>To get started, just start with the sample code Google is providing here . http://code.google.com/apis/visualization/documentation/gallery/orgchart.html#Example</p>
<p>And if you look at how the database is being constructed, it&#8217;s very simple. For my BIG table i had the staring point like this</p>
<p><strong>data.addRows([<br />
['Kalu Khan','','1570'],<br />
['Ahsan Khan', 'Kalu Khan', ''],<br />
['Jharu Khan', 'Kalu Khan', ''],<br />
['Ajmat', 'Ahsan Khan', ''],</strong></p>
<p><strong>]);</strong></p>
<p>It means Kalu Khan is the root. The second Parameter is left blank which means it doesn&#8217;t have parent. Next you have to add Children node to it. The first parameter is the Children Name and second one is the Parent Name.</p>
<p>['Ahsan Khan', 'Kalu Khan', '']        &#8212;&#8212;&#8211;    Here Ahsan Khan is the Children and &#8216;Kalu Khan&#8217; is the parent. So just make the list for your family and save for next generations <img src='http://www.mahbubblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Oh, there&#8217;re some other options there as well like collapse / un-collapse and styling those nodes. Keep discovering..</p>
<p>And you can also see my 10 generations family db &#8212; <a href="http://www.mahbubblog.com/wp-content/uploads/2010/04/mahbub-family-tree.html">mahbub-family-tree</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/javascript/make-your-family-tree-with-google-visualization-api/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Designing a prescription pad for my friend</title>
		<link>http://www.mahbubblog.com/design/designing-a-prescription-pad-for-my-friend/</link>
		<comments>http://www.mahbubblog.com/design/designing-a-prescription-pad-for-my-friend/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 00:47:12 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[design]]></category>
		<category><![CDATA[prescription pad]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=219</guid>
		<description><![CDATA[It&#8217;s been quite a long time since i designed for some print materials. One of my best friends from elementary &#38; high school (&#38; still is) requested me to design his prescription pad for him because his current one looks horrible. He&#8217;s a general physician and a very good orthopaedic surgeon.  So i thought i&#8217;d [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been quite a long time since i designed for some print materials. One of my best friends from elementary &amp; high school (&amp; still is) requested me to design his prescription pad for him because his current one looks horrible. He&#8217;s a general physician and a very good orthopaedic surgeon.  So i thought i&#8217;d give a try for my friend&#8217;s prescription and this came up after a 2 hr effort.</p>
<p><a href="http://www.mahbubblog.com/wp-content/uploads/2010/02/prescription_pad.jpg"><img class="alignnone size-full wp-image-220" title="prescription" src="http://www.mahbubblog.com/wp-content/uploads/2010/02/prescription.jpg" alt="prescription pad " width="600" height="600" /></a></p>
<p>I used two of my favorite fonts called &#8220;Square 721 BT&#8221; and Titillium. Google it if you want to download them. And it&#8217;s the first composition with Adobe Illustrator CS4 after doing anything with CS2.</p>
<p>Leave me a comment if you want the source AI or EPS file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/design/designing-a-prescription-pad-for-my-friend/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Auto Resize Large Images in Blog Post</title>
		<link>http://www.mahbubblog.com/css/auto-resize-large-images-in-blog-post/</link>
		<comments>http://www.mahbubblog.com/css/auto-resize-large-images-in-blog-post/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 06:52:55 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[autoresize]]></category>
		<category><![CDATA[image resize]]></category>
		<category><![CDATA[large image]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=216</guid>
		<description><![CDATA[I ran into this problem recently and found a good fix. As we make custom CMS, blogs as parts of websites, we frequently use some WYSIWYG editors like TINYMCE. Now when you enable people to post contents along with image urls, people may enter an image url which possibly is much larger than the available [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into this problem recently and found a good fix. As we make custom CMS, blogs as parts of websites, we frequently use some WYSIWYG editors like TINYMCE. Now when you enable people to post contents along with image urls, people may enter an image url which possibly is much larger than the available width we have in the page layout. Perhaps most of the images may become larger as we would only get around 650px of width when we are using 960px standard layout with some sort of sidebars.</p>
<p>So the user&#8217;s posted image in the blog post may overflow the layout. What to do then ??</p>
<p>1. We want to keep the image within the available width (may be 600px).</p>
<p>2. We also want to keep the aspect ratio intact so that the dimension doesn&#8217;t get messed up.</p>
<p>After googling in some pages I had to combine the CSS solution which works for most of the modern browsers (certainly not IE6).</p>
<p>So here&#8217;s the neat solution totally in CSS.</p>
<p><span style="font-family: courier new,courier;">#post_view img {</span></p>
<p>max-width: 620px;</p>
<p>height: auto !important;</p>
<p>width: expression(this.width &gt; 620 ? 620: true);</p>
<p>}</p>
<p>The above snippet assumes that your ID for the container (i.e DIV) is post_view. I&#8217;d discourage using class here because ID has a higher order of preference when it comes to override CSS rules.</p>
<p>So, all the image who exceeds the width of 620px will be automatically resized to 620px. Images below 620px will not be affected at all. The height: auto !important; will keep the aspect ratio of the image to the original ratio.</p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong>Compatibility: </strong></p>
<p>Firefox 3</p>
<p>Opera 10</p>
<p>IE 7 (I don&#8217;t care if it works in IE 6 or not)</p>
<p>Chrome</p>
<p>Safari 4 (win) [ Don't know about Mac cuz i don't have any <img src='http://www.mahbubblog.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  ]</p>
<h2><strong>EXAMPLE :</strong></h2>
<div id="post_view"><img title="429917" src="/wp-content/uploads/2010/02/429917.jpg" alt="example image" /></div>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/css/auto-resize-large-images-in-blog-post/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Interview for PHP programmer</title>
		<link>http://www.mahbubblog.com/php/interview-for-php-programmer/</link>
		<comments>http://www.mahbubblog.com/php/interview-for-php-programmer/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 13:01:03 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Career]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[php programmers]]></category>
		<category><![CDATA[recruitment]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=213</guid>
		<description><![CDATA[So, in Blueliner Bangladesh, we needed some PHP programmers in the coming months. I almost took over 20  interviews from screened out CVs and found some good candidates. There&#8217;s some points we&#8217;d like the programmers of this country to be concerned about. Here are some of my observations and recommendations. You have to learn yourself. [...]]]></description>
			<content:encoded><![CDATA[<p>So, in Blueliner Bangladesh, we needed some PHP programmers in the coming months. I almost took over 20  interviews from screened out CVs and found some good candidates. There&#8217;s some points we&#8217;d like the programmers of this country to be concerned about. Here are some of my observations and recommendations.</p>
<p><strong>You have to learn yourself. Company may not give the opportunity!</strong></p>
<p>This is one of the most common pitfalls i found in this recruitment drive. Most people complain that they don&#8217;t get enough time to learn about the latest tools and technologies. But the thing is, It&#8217;s your career! the companies will always try to get the best out of you within shortest possible budget and time. And at the same time you have to enrich yourself not only through the projects you get but also with some voluntary open source projects. What most companies don&#8217;t realize that, if the programmers are not given some room to do R&amp;D, it&#8217;s eventually the organization who will lose by compromising with the standards of the programmer against budget. And the programmers are not updates with the latest tools technologies. So, guys! you have to take some personal effort to play with the newer things. Even if you don&#8217;t get a minute in the workplace, find some time at home to do some R&amp;D. It will pay off inshAllah.</p>
<p><strong>Ability to do things VS Ability to do things with Art</strong>.</p>
<p>There are hell lot of renowned Javascript programmers but how many do we know? John Resig, Jack Slocum, Remy Sharp and so on. Why do we know them ? Because they did something which others didn&#8217;t. They did things with Art for which we know them. So all the promising programmers, please concentrate on doing thing with Art. If you know jQuery, learn how it works, who&#8217;re the people behind it, follow them on twitter, read their blogs. Let alone <a href="http://ejohn.org/">John Resig&#8217;s Blog</a> can give you a very good insight what&#8217;s being cooked for the next generation javascripts. BE detail oriented about things you play everyday with. You&#8217;ll always be appreciated for things you want to do not &#8220;things you had to do&#8221;.</p>
<p><strong>Object Oriented Programming</strong></p>
<p>PHP had been very lose in standards and conventions when it comes to Object Oriented Programming. The recent releases of PHP are much more matured that it used to be in the past. I started in 2000. We can do lot of things without even following the standard way. But dear PHP programmers, better companies or promising companies will take you because you&#8217;ll make some magical changes, add some new dimensions in the organization. So please be very clear and efficient about Object Oriented Concepts and way of doing those things in PHP. There&#8217;s a difference between a programmer who declares a class &#8220;abstract&#8221; knowing when it&#8217;s needed and a programmer who knows OOP but doesn&#8217;t want to declare the class abstract. PHP is not at the pick of it&#8217;s maturity. So try to discover which things are absent in OO PHP which are there in other languages (C++,Java, Ruby).</p>
<p><strong>Have some publishing activities</strong></p>
<p>To present yourself as a passionate programmer, you gotta have a blog or some sort of publishing which is visible on the WWW. If you have a blog and you write about things you play with, problems, time saving solutions, it will help you a lot getting the attention as a good, focused and passionate programmers. So start your blog now if you don&#8217;t have one. It takes a little time to get used to with some writing habit.</p>
<p><strong>Care more on the CV</strong></p>
<p>May people simply flooded of with bunch of tools and technologies. Many of cv looked like they are Jack of All trades. But hardly anyone was proficient in all they mentioned. So please, do not put items on which you don&#8217;t have substantial hold of and just for the sake of filling up CV. If you write you are good at Javascript, expect advanced level questions from JS. If you write &#8220;Good in OOP&#8221; , expect higher level questions from OOP.  Make the CV withing 3 pages maximum. It irritates the interviewer when people have long descriptions about each project you have worked on.</p>
<p>There are other points i wanted to write but the post will become longer than the comfortable or acceptable length. So i&#8217;ll share some more next hopefully.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/php/interview-for-php-programmer/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Sorting table columns in mysql by adminer</title>
		<link>http://www.mahbubblog.com/php/sorting-table-columns-in-mysql-by-adminer/</link>
		<comments>http://www.mahbubblog.com/php/sorting-table-columns-in-mysql-by-adminer/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 05:16:13 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=207</guid>
		<description><![CDATA[Sorting columns in a mysql table has always been a nasty way to deal with. It can be done some sql commands of course but this is not what we do more often. Even the most popular DB admin package &#8211; phpmyadmin doesn&#8217;t provide such utility to sort or re-arrange fields in mysql. It occurred [...]]]></description>
			<content:encoded><![CDATA[<p>Sorting columns in a mysql table has always been a nasty way to deal with. It can be done some sql commands of course but this is not what we do more often. Even the most popular DB admin package &#8211; phpmyadmin doesn&#8217;t provide such utility to sort or re-arrange fields in mysql. It occurred to me a lot of times that i had to bring some filed to a different position for convenience after i first created it. But i had to run some queries which i never liked, to do this task.</p>
<p>So ADMINER (formerly phpminadmin) comes up with a nifty utility in their one file standalone package.</p>
<p>If you haven&#8217;t heard of Adminer yet (you must have missed a great tool),  download from http://www.adminer.org/en/</p>
<p>And run it from your web server from any location. After entering credentials and selecting database, just select a table from the left which appears like this.</p>
<p><a href="http://www.mahbubblog.com/wp-content/uploads/2009/09/adminer_table_select.jpg"><img class="alignnone size-medium wp-image-208" title="adminer_table_select" src="http://www.mahbubblog.com/wp-content/uploads/2009/09/adminer_table_select-300x157.jpg" alt="adminer_table_select" width="300" height="157" /></a></p>
<p>Now you get some options like &#8211; Alter table   |   Default values  |   Select table  |  New item</p>
<p>Select Alter Table and you get a screen like this</p>
<p><a style="text-decoration: none; color: #cc6600; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.mahbubblog.com/wp-content/uploads/2009/09/adminer.jpg"><img style="text-align: center; padding: 0px; margin: 0px; border: 0px none initial;" title="adminer" src="http://www.mahbubblog.com/wp-content/uploads/2009/09/adminer-300x117.jpg" alt="adminer" width="300" height="117" /></a></p>
<p>Alright, you pretty know what to do with those up and down arrows now. Don&#8217;t forget to save the changes <img src='http://www.mahbubblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/php/sorting-table-columns-in-mysql-by-adminer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Killing session on browser close in Codeigniter</title>
		<link>http://www.mahbubblog.com/php/killing-session-on-browser-close-in-codeigniter/</link>
		<comments>http://www.mahbubblog.com/php/killing-session-on-browser-close-in-codeigniter/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 02:41:06 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[browser close]]></category>
		<category><![CDATA[codeigniter session]]></category>
		<category><![CDATA[session killing]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=203</guid>
		<description><![CDATA[It may be well known to some people how to kill sessions on browser close but the default config in codeigniter doesn&#8217;t provide so. In lot of application which has admin interface, we don&#8217;t want browser to store the session. So it needs to kill the session when browser is closed. Example behavior can be [...]]]></description>
			<content:encoded><![CDATA[<p>It may be well known to some people how to kill sessions on browser close but the default config in codeigniter doesn&#8217;t provide so. In lot of application which has admin interface, we don&#8217;t want browser to store the session. So it needs to kill the session when browser is closed. Example behavior can be found in yahoo email page.</p>
<p>So how do we do that in Codeigniter ? It&#8217;s simple, although this feature is not well commented or documented. Ok, now open system/application/config/config.php file</p>
<p>And find the settings called<strong> $config['sess_expiration'] </strong>unde<strong>r </strong>the section <strong>Session Variables </strong>and put the value like this</p>
<pre class="brush: php">

$config[&#039;sess_expiration&#039;]        = -1;
</pre>
<p>That&#8217;s it. Now your session will be killed in the event of browser closing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/php/killing-session-on-browser-close-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Form Validation Callbacks in HMVC in Codeigniter</title>
		<link>http://www.mahbubblog.com/php/form-validation-callbacks-in-hmvc-in-codeigniter/</link>
		<comments>http://www.mahbubblog.com/php/form-validation-callbacks-in-hmvc-in-codeigniter/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 09:13:57 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[callbacks]]></category>
		<category><![CDATA[form validation]]></category>
		<category><![CDATA[hmvc]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=190</guid>
		<description><![CDATA[Many of us are using the HMVC extension (Hierarchical Model View Controller) in codeigniter which is available. http://codeigniter.com/wiki/Modular_Extensions_-_HMVC HMVC helps developing modular apps in a very convenient way. All the things work simply fine just like a clean CI installation. There&#8217;re 1 or two exceptions which i have found. One is the callback of Form_validation [...]]]></description>
			<content:encoded><![CDATA[<p>Many of us are using the HMVC extension (Hierarchical Model View Controller) in codeigniter which is available. http://codeigniter.com/wiki/Modular_Extensions_-_HMVC</p>
<p>HMVC helps developing modular apps in a very convenient way. All the things work simply fine just like a clean CI installation. There&#8217;re 1 or two exceptions which i have found. One is the callback of Form_validation class. If we are making some forms like registration we check emails and usernames and we do it in the form validation class using callbacks. If we look at the basic callback structure when validating forms from CI documentation, it appears like.</p>
<pre class="brush: php">

&lt; ?php

class Form extends Controller
{

 function index()
 {
 $this-&gt;load-&gt;helper( array (

 &#039;form&#039;,
 &#039;url&#039;
 ) );

 $this-&gt;load-&gt;library( &#039;form_validation&#039; );

 $this-&gt;form_validation-&gt;set_rules( &#039;username&#039;, &#039;Username&#039;, &#039;callback_username_check&#039; );
 $this-&gt;form_validation-&gt;set_rules( &#039;password&#039;, &#039;Password&#039;, &#039;required&#039; );
 $this-&gt;form_validation-&gt;set_rules( &#039;passconf&#039;, &#039;Password Confirmation&#039;, &#039;required&#039; );
 $this-&gt;form_validation-&gt;set_rules( &#039;email&#039;, &#039;Email&#039;, &#039;required&#039; );

 if ($this-&gt;form_validation-&gt;run() == FALSE)
 {
 $this-&gt;load-&gt;view( &#039;myform&#039; );
 }
 else
 {
 $this-&gt;load-&gt;view( &#039;formsuccess&#039; );
 }
 }

 function username_check($str)
 {
 if ($str == &#039;test&#039;)
 {
 $this-&gt;form_validation-&gt;set_message( &#039;username_check&#039;, &#039;The %s field can not be the word &quot;test&quot;&#039; );
 return FALSE;
 }
 else
 {
 return TRUE;
 }
 }

}
?&gt;
</pre>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><span style="color: #143270; white-space: pre-wrap;">But this callback will not simply work. Some of my precious hours went why it was not working. Then i navigated the Form_validation.php in /system/libraries folder around line 580 which looks like </span></span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><span style="color: #143270; white-space: pre-wrap;"><br />
</span></span></span></p>
<p><span style="color: #143270; font-family: 'Lucida Grande'; font-size: 14px; white-space: pre-wrap;"> </span></p>
<pre class="brush: php">
if ($callback === TRUE)
 {
 if ( ! method_exists($this-&gt;CI, $rule))
 {
 continue;
 }
</pre>
<p><span style="font-size: small;"><span style="color: #143270; font-family: 'Lucida Grande'; white-space: pre-wrap;"><span style="font-family: verdana,geneva;">The function &#8211; <strong>method_exists</strong> returns false even if the callback function is there in the Controller and after all in the CI loader object. So it came out from the forum that you have to do a little extension to Form Validation class which is </span></span></span></p>
<pre class="brush: php">
&lt; ?php if (!defined(&#039;BASEPATH&#039;)) exit(&#039;No direct script access allowed&#039;);

class MY_Form_validation extends CI_Form_validation
{
 function run($module = &#039;&#039;, $group = &#039;&#039;) {
 (is_object($module)) AND $this-&gt;CI =&amp; $module;
 return parent::run($group);
 }
}
/* End of file MY_Form_validation.php */
/* Location: ./application/libraries/MY_Form_validation.php */
</pre>
<p>And when running the validation like in earlier code</p>
<pre class="php"> if ($this-&gt;form_validation-&gt;run() == FALSE)</pre>
<p>you have to provide an addition $this as a parameter to run method. which will look like</p>
<pre class="php"> if ($this-&gt;form_validation-&gt;run(<strong>$this</strong>) == FALSE)</pre>
<p>Now, you validation callbacks will work perfectly.</p>
<p>Another note, if you&#8217;re trying to access a public variable of a controller via the get_instance() in hooks , you&#8217;ll have to write in your controller like this.</p>
<p>CI::instance()-&gt;var_name = &#8220;Some Value&#8221;;</p>
<p>May be there are some other required adjustments when using HMVC, but i came across this two time killing adjustments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/php/form-validation-callbacks-in-hmvc-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Python for Codeigniter developers</title>
		<link>http://www.mahbubblog.com/codeigniter/python-for-codeigniter-developers/</link>
		<comments>http://www.mahbubblog.com/codeigniter/python-for-codeigniter-developers/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 07:00:15 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[web2py]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=178</guid>
		<description><![CDATA[So, you use codeigniter and  want to develop something in python ? And you have following things in mind : 1. An MVC framework which has almost zero installation. 2. A framework that behaves quite in the same fashion like Codeigniter. 3. Small footprint 4. Has Similar or even easier libraries than codeigniter. 5. And [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.python.org/images/python-logo.gif" alt="" width="211" height="71" /></p>
<p>So, you use codeigniter and  want to develop something in python ? And you have following things in mind :</p>
<p>1. An MVC framework which has almost zero installation.</p>
<p>2. A framework that behaves quite in the same fashion like Codeigniter.</p>
<p>3. Small footprint</p>
<p>4. Has Similar or even easier libraries than codeigniter.</p>
<p>5. And you want something which works both in Windows/mac/Linux.</p>
<p>You have probably heard of developing web apps using python and python frameworks like django. But the installation on your windows machine or linux machine along with apache is a big headache. You want something short and sweet, something works out of the box.</p>
<p>OKKEYS, the name is <a href="http://www.web2py.com/">web2py </a>- an enterprise web development framework &#8211; entirely written in python. If i start to write all good things about it, the post might become really big. So let&#8217;s jump into the installing of this framework and see some actions.</p>
<h2>Things needed</h2>
<p><a href="http://www.python.org/download/releases/2.5.2/">Python 2.5.2</a></p>
<p><a href="http://www.web2py.com/examples/static/web2py_src.zip">web2py Framework</a></p>
<h2>Steps :</h2>
<p><strong>1.</strong> For windows XP, install python 2.5.2 &#8211; the .msi package. It&#8217;ll probably install in your c:/Python25 directory. Now you have to add 2 environment variables.  Right click &#8220;My Computer&#8221; -&gt; Properties -&gt;Advanced -&gt; Environment Variables (at the bottom).  Under the &#8220;System Variables&#8221; double click &#8220;Path&#8221; and put ;C:\python25;C:\python25\scripts at end of the Variable Value.  For windows users, a restart is sometimes necessary to propagat</p>
<p>For Ubuntu, if you have already installed python latest version which is 3.X, you have to install python 2.5.2. They can run simultanously. So in terminal,</p>
<p>sudo apt-get install python2.5</p>
<p><strong>2.</strong> Unzip the folder from you have downloaded http://www.web2py.com/examples/static/web2py_src.zip to some place. May be c:/web2py or in Ubuntu /home/username/web2py [or anything you like ]</p>
<p><strong>3.</strong> Now it&#8217;s assumed that python runs from command prompt or terminal. To verify type python in command prompt in windows (not in CYGWIN or any Bash Shell) or in terminal in linux. If you get something like this</p>
<p><span style="font-family: courier new,courier;">Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on<br />
win32<br />
Type &#8220;help&#8221;, &#8220;copyright&#8221;, &#8220;credits&#8221; or &#8220;license&#8221; for more information.<br />
&gt;&gt;&gt;</span></p>
<p><span style="font-family: courier new,courier;"><span style="font-family: georgia,palatino;">It means you have successfully installed python. Now from the command prompt go to your web2py directory using <strong>cd web2py</strong></span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-family: georgia,palatino;"><strong>4.</strong><span style="font-family: verdana,geneva;"> TIME FOR ACTION!!! Now that you&#8217;re into the web2py directory,<strong> </strong>simply<strong> </strong>type </span></span></span></p>
<p><span style="font-family: courier new,courier;">python web2py.py</span></p>
<p><span style="font-family: courier new,courier;"><span style="font-family: georgia,palatino;">You&#8217;ll get a greeting screen and the a screen like this both in windows and linux.<br />
</span></span></p>
<p><span style="font-family: courier new,courier;"><span style="font-family: georgia,palatino;"><br />
</span></span></p>
<p><a href="http://www.mahbubblog.com/wp-content/uploads/2009/07/web2py_server.jpg"><img class="alignnone size-medium wp-image-180" title="web2py_server" src="http://www.mahbubblog.com/wp-content/uploads/2009/07/web2py_server-300x220.jpg" alt="web2py_server" width="300" height="220" /></a></p>
<p>It asks for an admin password. Choose anything simple for the time being and hit &#8220;Start Server&#8221;. That&#8217;s it. A window will open with the web2py admin panel like this.</p>
<p><a href="http://www.mahbubblog.com/wp-content/uploads/2009/07/welcome_1247640873997.png"><img class="alignnone size-medium wp-image-181" title="welcome_1247640873997" src="http://www.mahbubblog.com/wp-content/uploads/2009/07/welcome_1247640873997-300x114.png" alt="welcome_1247640873997" width="300" height="114" /></a></p>
<p>Alright, from this point, i think you can start playing with the links and most of the options are self explanatory. Click the links, go deeper and have fun with an easy MVC framwork in Python.</p>
<p>Keep discovering!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/codeigniter/python-for-codeigniter-developers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Michael Jackson died !</title>
		<link>http://www.mahbubblog.com/miscellaneous/michael-jackson-died/</link>
		<comments>http://www.mahbubblog.com/miscellaneous/michael-jackson-died/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 19:17:44 +0000</pubDate>
		<dc:creator>Mahbub</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[michael jackson]]></category>

		<guid isPermaLink="false">http://www.mahbubblog.com/?p=171</guid>
		<description><![CDATA[So, nobody lasts longer! I watched the news all day long about MJ. I&#8217;m kinda deeply shock at his death at the age of 50.  He was the music hero for almost all of us. It&#8217;s not only normal people but also to Gods of Rock &#8211; Metallica, i remember they suddenly started playing riff [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mahbubblog.com/wp-content/uploads/2009/06/michael_jackson_king_of_pop.jpg"><img class="alignnone size-full wp-image-172" title="michael_jackson_king_of_pop" src="http://www.mahbubblog.com/wp-content/uploads/2009/06/michael_jackson_king_of_pop.jpg" alt="michael_jackson_king_of_pop" width="353" height="355" /></a></p>
<p>So, nobody lasts longer! I watched the news all day long about MJ. I&#8217;m kinda deeply shock at his death at the age of 50.  He was the music hero for almost all of us. It&#8217;s not only normal people but also to Gods of Rock &#8211; Metallica, i remember they suddenly started playing riff of &#8220;BEAT IT&#8221; in one of videos. There would hardly be any party/ celebrations in my childhood without some of MJ&#8217;s music. I still play the riff of &#8220;BEAT IT&#8221; in my acoustic guitar. It just refreshes.</p>
<p>This morning when i just saw &#8220;Breaking News&#8221; in CNN, it was unbelivable. I had to make sure in other channels and websites whether it really was. And it really was! The king of pop died of cardiac arrest at his home in LA and later in UCLA. A legend is gone!</p>
<p>I don&#8217;t have to write stories about him &#8211; we all know much. Just &#8220;Thank you&#8221; to Michael Jackson for his music, style, dance, love for people.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mahbubblog.com/miscellaneous/michael-jackson-died/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
