A web developer's blog. PHP, MySQL, CakePHP, Zend Framework, Wordpress, Code Igniter, Django, Python, CSS, Javascript, jQuery, Knockout.js, and other web development topics.

Monthly Archives: March 2009

Simple Tooltip for jQuery (w/ image preview!)

This is the simplest jQuery Tooltip plugin I could find. It is literally plug-and-play. Very simple. Just click on the links found below to view the different examples. A simple tooltip A simple image preview Tooltip + Image Note that … Continue reading

Posted in General | Tagged , , | Leave a comment

MySQL: Get difference between 2 dates

Fairly simple and I’m sure this would come in handy in the future. This is one of those functions that I thought did not exist. I should RTFM more… SELECT DATEDIFF(’2009-03-31 23:59:59′,’2009-03-29′); /*would output: 2*/   /*Another usage would be … Continue reading

Posted in General | Tagged , | Leave a comment

Geodata Stuff

Well, these came up in Hacker News and thought it would be great to store the URLs in the comments. http://chir.ag/projects/geoiploc/ http://www.maxmind.com/app/geoip_country http://www.geonames.org/ http://blogama.org/node/58 (This link is what they are talking about in this thread.) UPDATE (this one is very … Continue reading

Posted in General | Tagged , , | 1 Comment

Repost: UTF-8, PHP and MySQL

This is a repost from Akrabat.com The Problem:Get a £ (that is the pound sign) character stored to MySQL, retrieved and then displayed without any weird characters in front of it using UTF8. //for the browser//header("Content-type: text/html; charset=utf-8");//OR////then for MySQLmysql_set_charset(‘utf8′);//ormysqli_set_charset(‘utf8′);//or … Continue reading

Posted in General | Tagged , , | Leave a comment

jQuery: remove and object after fading out

Another re-post from stackoverflow. $("#id_of_object_to_remove").click(function() { $(this).fadeOut(500, function() { $(this).remove(); }); });

Posted in General | Tagged , | Leave a comment

jQuery: children() VS. find() – which is faster?

This is from stackoverflow and I am re-posting it here on my blog for record purposes. There is so much useful information there that in the days to come I will probably doing a bunch of re-posts from stackoverflow.com //For … Continue reading

Posted in General | Tagged , | 1 Comment

Zend Framework: Connecting to 2 databases

I was in a situation that I need to connect to 2 different databases. I started by putting the additional credentials to login into the second database inside my config file: /application/config/app.ini   [production] database.adapter = "PDO_MYSQL" database.params.host = "localhost" … Continue reading

Posted in General | Tagged , , , | 12 Comments

Extending the Models in Zend Framework = Better readability + Easier to maintain

Let’s say I have a Model named: Psdump.php and it is found in /models/Psdump.php < ?php   /** * Psdump.php * /opt/apache2/htdocs/apps/org_v2/application/models/Psdump.php */   require_once APPLICATION_PATH.’/models/PsdumpTable.php’; //I will need this   class Psdump extends Zend_Db_Table { protected $_table; public function … Continue reading

Posted in General | Tagged , , | Leave a comment