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: February 2008

Nice Programmer`s Font

http://www.dafont.com/font.php?file=bitstream_vera_mono Very readable!

Posted in General | Tagged | Leave a comment

Get number of hours between 2 timezones

Here is a way to get the number of hours between two different timezones. I am sure that there is a way of doing it shorter and faster, but I did it this way for readability purposes. date_default_timezone_set("America/Kentucky/Louisville"); $lex = … Continue reading

Posted in General | Tagged , | 7 Comments

Hightlight a table row on click using jQuery

The scenario: Every time you click on a row, the row highlights. When you click on the highlighted row – remove the highlight. The jQuery / Javascript code: //highligths the clicked row function highlightrow(obj) { if ($(obj).attr("style")==’background-color: rgb(255, 255, 187);’ … Continue reading

Posted in General | Tagged , , | 4 Comments

How to filter database inserts – HTML, Usernames, etc. in Zend Framwork

I woke up today thinking about how to handle strings when inserting to MySQL. What if the string I am trying to save into the database contains HTML characters? Let’s say you are using FCKEditor, how would you “generally” handle … Continue reading

Posted in General | Tagged , , | 6 Comments

Update rows in Table A from values of Table B in MySQL

Sometimes, we need to update values of tables from the values from another table. Here is an example: UPDATE `transactions` t , `tran_daily` daily SET t.col_manager = daily.Col_manager, t.invoice_date = daily.Invoice_date, t.due_date = daily.Due_date, t.po_no = daily.Po_no, t.remark = daily.Remark, … Continue reading

Posted in General | Tagged | Leave a comment

Cron job examples for newbies

Here are a few examples from this site. 01 * * * * root echo “This command is run at one min past every hour” 17 8 * * * root echo “This command is run daily at 8:17 am” … Continue reading

Posted in General | Tagged , | 1 Comment

What is the safest way to do database queries in Zend Framework?

I have no idea. You tell me. All I do is this: $sql = "SELECT * FROM Table1 WHERE id=’".$target_id."’"; /*That is $target_id inside single-quotes in the SQL Query.*/ Please share your thoughts below.

Posted in General | Tagged , | 9 Comments

jQuery: Select all options in a Multiple-option Select Box

Alright, here is a quick example of how to use jQuery to select all of the items in a multiple-option select box. //Javascript part assuming that you have already included jquery.js in your header $(document).ready(function() { $("#select_all_col_managers").click(function() { $("#col_manager_list").each(function(){ $("#col_manager_list … Continue reading

Posted in General | Tagged , , | 16 Comments

All the Cheatsheets for Web Development in da World!

A few weeks back, someone sent me an email. Hi, We just posted an article “The Cheat Sheet Cheat Sheet: Top 100 Lists of Web Development Cheat Sheets “ ( http://www.virtualhosting.com/blog/2008/the-cheat-sheet-cheat-sheet-top-100-lists-of-web-development-cheat-sheets/ )I thought I’d bring it to your attention just … Continue reading

Posted in General | Tagged , | Leave a comment

Why I hate Code Igniter (and why is ZF FTW!)

Here is a snippet from my code… public function transaction($company_var=”, $company_value=”, $parent_var = ”, $parent_value=”, $current_page=’1′, $offset_value=”) { $data = array(); //GET VARIABLES PASSED THRU FUNCTION //I hate code igniter for this. //I found out that you can have query … Continue reading

Posted in General | Tagged , | 25 Comments