<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5698332201573706833</id><updated>2012-02-16T18:29:36.649Z</updated><category term='script'/><category term='linux'/><category term='jquery'/><category term='link'/><category term='javascript'/><category term='bash'/><category term='mysql'/><category term='php'/><title type='text'>wiredplace</title><subtitle type='html'>Useful links and code snippets. PHP, MySQL, Javascript, Jquery, Bash, etc…</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.wiredplace.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>wiredplace</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-7243606062786408277</id><published>2011-11-26T15:48:00.000Z</published><updated>2011-11-26T15:48:00.956Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><title type='text'></title><content type='html'>MySQL snippet to group records by week.&lt;br /&gt;&lt;pre&gt;SELECT COUNT(*), DATE_ADD(DATE(`&lt;span class="Apple-style-span" style="color: #999999;"&gt;orders&lt;/span&gt;`.&lt;span class="Apple-style-span" style="background-color: white;"&gt;`&lt;span class="Apple-style-span" style="color: #999999;"&gt;date&lt;/span&gt;`&lt;/span&gt;), INTERVAL (7 - DAYOFWEEK(`&lt;span class="Apple-style-span" style="color: #999999;"&gt;orders&lt;/span&gt;`.`&lt;span class="Apple-style-span" style="color: #999999;"&gt;date&lt;/span&gt;`)) DAY) AS `week_end` FROM `&lt;span class="Apple-style-span" style="color: #999999;"&gt;orders&lt;/span&gt;` GROUP BY `week_end`;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-7243606062786408277?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/7243606062786408277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=7243606062786408277' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/7243606062786408277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/7243606062786408277'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/11/mysql-snippet-to-group-records-by-week.html' title=''/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-6069009547921753434</id><published>2011-10-31T13:51:00.002Z</published><updated>2011-10-31T13:52:34.426Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><title type='text'>Get the index of an element in an unordered set</title><content type='html'>JQUERY snippet to find the index of an item.&lt;br /&gt;&lt;br /&gt;In this case if a list item is clicked, we get the index of the element in relation to it's parent container.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$("ul &amp;gt; li").click(function () { &lt;br /&gt;    var index = $(this).prevAll().length; &lt;br /&gt;}); &lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-6069009547921753434?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/6069009547921753434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=6069009547921753434' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/6069009547921753434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/6069009547921753434'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/10/get-index-of-element-in-unordered-set.html' title='Get the index of an element in an unordered set'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-8673695783677109170</id><published>2011-04-04T18:03:00.001+01:00</published><updated>2011-04-04T18:03:00.481+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><title type='text'>Duplicating a MySQL Table</title><content type='html'>To duplicate an existing table you can use the following command:&lt;br /&gt;&lt;pre&gt;CREATE TABLE `NEW_TABLE` LIKE `OLD_TABLE`&lt;/pre&gt;To duplicate an existing table and it's contents you can use:&lt;br /&gt;&lt;pre&gt;CREATE TABLE `NEW_TABLE` SELECT * FROM `OLD_TABLE`&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-8673695783677109170?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/8673695783677109170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=8673695783677109170' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/8673695783677109170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/8673695783677109170'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/04/duplicating-mysql-table.html' title='Duplicating a MySQL Table'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-5313397091939220430</id><published>2011-03-11T21:21:00.002Z</published><updated>2011-03-11T21:21:00.562Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Compress PHP file</title><content type='html'>Use PHP itself to compress a PHP source file.&lt;br /&gt;&lt;br /&gt;This command line option will strip all comments and white space.&lt;br /&gt;&lt;pre&gt;php –w input.php &amp;gt; output.php&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-5313397091939220430?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/5313397091939220430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=5313397091939220430' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/5313397091939220430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/5313397091939220430'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/03/compress-php-file.html' title='Compress PHP file'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-5889509268040492867</id><published>2011-03-10T19:08:00.001Z</published><updated>2011-03-10T19:08:00.287Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Check request is via AJAX in PHP</title><content type='html'>A simple function to indicate whether a request was made via AJAX or not (&lt;i&gt;note: this is easily spoofed so it's not a secure method&lt;/i&gt;).&lt;br /&gt;&lt;pre&gt;function isAjax()&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;{&lt;br /&gt;   return (isset($_SERVER['HTTP_X_REQUESTED_WITH'])&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;   &amp;amp;&amp;amp; ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'));&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-5889509268040492867?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/5889509268040492867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=5889509268040492867' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/5889509268040492867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/5889509268040492867'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/03/check-request-is-via-ajax-in-php.html' title='Check request is via AJAX in PHP'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-5534819795513298154</id><published>2011-03-08T21:58:00.000Z</published><updated>2011-03-08T21:58:00.543Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>How to find duplicate rows with SQL</title><content type='html'>&lt;blockquote&gt;This article shows how to find duplicated rows in a database table. This is a very common beginner question. The basic technique is straightforward. I’ll also show some variations, such as how to find “duplicates in two columns”&lt;/blockquote&gt;&lt;a href="http://www.xaprb.com/blog/2006/10/09/how-to-find-duplicate-rows-with-sql/"&gt;http://www.xaprb.com/blog/2006/10/09/how-to-find-duplicate-rows-with-sql/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-5534819795513298154?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/5534819795513298154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=5534819795513298154' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/5534819795513298154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/5534819795513298154'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/03/how-to-find-duplicate-rows-with-sql.html' title='How to find duplicate rows with SQL'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-6748636674405270071</id><published>2011-03-07T21:54:00.003Z</published><updated>2011-03-08T14:05:54.046Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Retrieving MySQL enum values in PHP</title><content type='html'>Retrieve an array of all the available &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/enum.html"&gt;enum&lt;/a&gt; values.&lt;br /&gt;&lt;pre&gt;if ($result = mysql_query("SHOW COLUMNS FROM {$table} LIKE '{$column}'))&lt;br /&gt;{&lt;br /&gt;  $enum = mysql_fetch_object($result);&lt;br /&gt;  preg_match_all("/'([\w ]*)'/", $enum-&amp;gt;Type, $values);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-6748636674405270071?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/6748636674405270071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=6748636674405270071' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/6748636674405270071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/6748636674405270071'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/03/retrieving-mysql-enum-values-in-php.html' title='Retrieving MySQL enum values in PHP'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-2971577212046715551</id><published>2011-03-07T13:33:00.000Z</published><updated>2011-03-07T13:33:22.252Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><title type='text'>Find all large files on Linux</title><content type='html'>&lt;br /&gt;Finds all files over 10MB in size under &lt;i&gt;/path&lt;/i&gt; and presents their names and size in a human readable format:&lt;br /&gt;&lt;pre&gt;&lt;span class="ident"&gt;find&lt;/span&gt; /path &lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;size&lt;/span&gt; &lt;span class="punct"&gt;+10M&lt;/span&gt; &lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;exec&lt;/span&gt; &lt;span class="ident"&gt;du&lt;/span&gt; &lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;h&lt;/span&gt; &lt;span class="punct"&gt;{}&lt;/span&gt; \&lt;span class="punct"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-2971577212046715551?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/2971577212046715551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=2971577212046715551' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/2971577212046715551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/2971577212046715551'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/03/find-all-large-files-on-linux.html' title='Find all large files on Linux'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-4792221954061054061</id><published>2011-03-06T21:46:00.005Z</published><updated>2011-03-06T21:46:00.824Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><title type='text'>MySQL Field Types</title><content type='html'>&lt;table&gt;&lt;tbody&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;Type&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Use for&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Size&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;TINYINT&amp;nbsp;&lt;/td&gt;&lt;td&gt;A very small integer&amp;nbsp;&lt;/td&gt;&lt;td&gt;The signed range is&amp;nbsp;–128 to 127. The unsigned range is 0 to 255.&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;SMALLINT&amp;nbsp;&lt;/td&gt;&lt;td&gt;A small integer&amp;nbsp;&lt;/td&gt;&lt;td&gt;The signed range is&amp;nbsp;–32768 to 32767. The unsigned range is 0 to 65535&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;MEDIUMINT&amp;nbsp;&lt;/td&gt;&lt;td&gt;A medium-size integer&amp;nbsp;&lt;/td&gt;&lt;td&gt;The signed range is&amp;nbsp;–8388608 to 8388607. The unsigned range is 0 to 16777215&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;INT or INTEGER&amp;nbsp;&lt;/td&gt;&lt;td&gt;A normal-size integer&amp;nbsp;&lt;/td&gt;&lt;td&gt;The signed range is&amp;nbsp;–2147483648 to 2147483647. The unsigned range is 0 to 4294967295&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;BIGINT&amp;nbsp;&lt;/td&gt;&lt;td&gt;A large integer&amp;nbsp;&lt;/td&gt;&lt;td&gt;The signed range is&amp;nbsp;–9223372036854775808 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;FLOAT&amp;nbsp;&lt;/td&gt;&lt;td&gt;A small (single-precision) floating-point number. Cannot be unsigned&amp;nbsp;&lt;/td&gt;&lt;td&gt;Ranges are&amp;nbsp;–3.402823466E+38 to&amp;nbsp;–1.175494351E-38, 0 and 1.175494351E-38 to 3.402823466E+38. If the number of Decimals is not set or &amp;lt;= 24 it is a single-precision floating point number&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;DOUBLE,&lt;br /&gt;DOUBLE PRECISION,&lt;br /&gt;REAL&amp;nbsp;&lt;/td&gt;&lt;td&gt;A normal-size (double-precision) floating-point number. Cannot be unsigned&amp;nbsp;&lt;/td&gt;&lt;td&gt;Ranges are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0 and 2.2250738585072014E-308 to 1.7976931348623157E+308. If the number of Decimals is not set or 25 &amp;lt;= Decimals &amp;lt;= 53 stands for a double-precision floating point number&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;DECIMAL,&lt;br /&gt;NUMERIC&amp;nbsp;&lt;/td&gt;&lt;td&gt;An unpacked floating-point number. Cannot be unsigned&amp;nbsp;&lt;/td&gt;&lt;td&gt;Behaves like a CHAR column:&amp;nbsp;“unpacked”&amp;nbsp;means the number is stored as a string, using one character for each digit of the value. The decimal point, and, for negative numbers, the&amp;nbsp;‘-‘&amp;nbsp;sign is not counted in Length. If Decimals is 0, values will have no decimal point or fractional part. The maximum range of DECIMAL values is the same as for DOUBLE, but the actual range for a given DECIMAL column may be constrained by the choice of Length and Decimals. If Decimals is left out it’s set to 0. If Length is left out it’s set to 10. Note that in MySQL 3.22 the Length includes the sign and the decimal point&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;DATE&amp;nbsp;&lt;/td&gt;&lt;td&gt;A date&amp;nbsp;&lt;/td&gt;&lt;td&gt;The supported range is&amp;nbsp;‘1000-01-01’&amp;nbsp;to&amp;nbsp;‘9999-12-31&lt;wbr&gt;&lt;/wbr&gt;’. MySQL displays DATE values in&amp;nbsp;‘YYYY-MM-DD’&amp;nbsp;format&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;DATETIME&amp;nbsp;&lt;/td&gt;&lt;td&gt;A date and time combination&amp;nbsp;&lt;/td&gt;&lt;td&gt;The supported range is&amp;nbsp;‘1000-01-01 00:00:00’&amp;nbsp;to&amp;nbsp;‘9999-12-31 23:59:59’. MySQL displays DATETIME values in&amp;nbsp;‘YYYY-MM-DD HH:MM:SS’&amp;nbsp;format&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;TIMESTAMP&amp;nbsp;&lt;/td&gt;&lt;td&gt;A timestamp&amp;nbsp;&lt;/td&gt;&lt;td&gt;The range is&amp;nbsp;‘1970-01-01 00:00:00’&amp;nbsp;to sometime in the year 2037. MySQL displays TIMESTAMP values in YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD or YYMMDD format, depending on whether M is 14 (or missing), 12, 8 or 6, but allows you to assign values to TIMESTAMP columns using either strings or numbers. A TIMESTAMP column is useful for recording the date and time of an INSERT or UPDATE operation because it is automatically set to the date and time of the most recent operation if you don’t give it a value yourself&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;TIME&amp;nbsp;&lt;/td&gt;&lt;td&gt;A time&amp;nbsp;&lt;/td&gt;&lt;td&gt;The range is&amp;nbsp;‘-838:59:59’&amp;nbsp;to&amp;nbsp;‘838:59:59’&lt;wbr&gt;&lt;/wbr&gt;. MySQL displays TIME values in&amp;nbsp;‘HH:MM:SS’&amp;nbsp;format, but allows you to assign values to TIME columns using either strings or numbers&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;YEAR&amp;nbsp;&lt;/td&gt;&lt;td&gt;A year in 2- or 4- digit formats (default is 4-digit)&amp;nbsp;&lt;/td&gt;&lt;td&gt;The allowable values are 1901 to 2155, and 0000 in the 4 year format and 1970-2069 if you use the 2 digit format (70-69). MySQL displays YEAR values in YYYY format, but allows you to assign values to YEAR columns using either strings or numbers. (The YEAR type is new in MySQL 3.22.)&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;CHAR&amp;nbsp;&lt;/td&gt;&lt;td&gt;A fixed-length string that is always right-padded with spaces to the specified length when stored&amp;nbsp;&lt;/td&gt;&lt;td&gt;The range of Length is 1 to 255 characters. Trailing spaces are removed when the value is retrieved. CHAR values are sorted and compared in case-insensitive fashion according to the default character set unless the BINARY keyword is given&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;VARCHAR&amp;nbsp;&lt;/td&gt;&lt;td&gt;A variable-length string. Note: Trailing spaces are removed when the value is stored (this differs from the ANSI SQL specification)&amp;nbsp;&lt;/td&gt;&lt;td&gt;The range of Length is 1 to 255 characters. VARCHAR values are sorted and compared in case-insensitive fashion unless the BINARY keyword is given&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;TINYBLOB,&lt;br /&gt;TINYTEXT&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;A BLOB or TEXT column with a maximum length of 255 (2^8 - 1) characters&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;BLOB,&lt;br /&gt;TEXT&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;MEDIUMBLOB,&lt;br /&gt;MEDIUMTEXT&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1) characters&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;LONGBLOB,&lt;br /&gt;LONGTEXT&amp;nbsp;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;A BLOB or TEXT column with a maximum length of 4294967295 (2^32 - 1) characters&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;ENUM&amp;nbsp;&lt;/td&gt;&lt;td&gt;An enumeration&amp;nbsp;&lt;/td&gt;&lt;td&gt;A string object that can have only one value, chosen from the list of values&amp;nbsp;‘value1’,&amp;nbsp;‘value2’, ..., or NULL. An ENUM can have a maximum of 65535 distinct values.&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr valign="TOP"&gt;&lt;td&gt;SET&amp;nbsp;&lt;/td&gt;&lt;td&gt;A set&amp;nbsp;&lt;/td&gt;&lt;td&gt;A string object that can have zero or more values, each of which must be chosen from the list of values&amp;nbsp;‘value1’,&amp;nbsp;‘value2’, ... A SET can have a maximum of 64 members&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-4792221954061054061?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/4792221954061054061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=4792221954061054061' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/4792221954061054061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/4792221954061054061'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/03/mysql-field-types.html' title='MySQL Field Types'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-7635047845160360668</id><published>2011-03-05T21:44:00.001Z</published><updated>2011-03-05T21:44:00.673Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><title type='text'>Top 20+ MySQL Best Practices</title><content type='html'>&lt;blockquote&gt;Database operations often tend to be the main bottleneck for most web applications today. It’s not only the DBA’s (database administrators) that have to worry about these performance issues. We as programmers need to do our part by structuring tables properly, writing optimized queries and better code. Here are some MySQL optimization techniques for programmers.&lt;/blockquote&gt;&lt;a href="http://net.tutsplus.com/tutorials/other/top-20-mysql-best-practices/"&gt;http://net.tutsplus.com/tutorials/other/top-20-mysql-best-practices/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-7635047845160360668?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/7635047845160360668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=7635047845160360668' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/7635047845160360668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/7635047845160360668'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/03/top-20-mysql-best-practices.html' title='Top 20+ MySQL Best Practices'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-1707885808914082283</id><published>2011-03-04T21:38:00.001Z</published><updated>2011-03-04T21:38:00.642Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>How to use locks in PHP cron jobs to avoid cron overlaps</title><content type='html'>&lt;blockquote&gt;Cron jobs are hidden building blocks for most of the websites. They are generally used to process/aggregate data in the background. However as a website starts to grow and there is gigabytes of data to be processed by every cron job, chances are that our cron jobs might overlap and possibly corrupt our data. In this blog post, I will demonstrate how can we avoid such overlaps by using simple locking techniques. I will also discuss a few edge cases we need to consider while using locks to avoid overlap.&lt;/blockquote&gt;&lt;a href="http://abhinavsingh.com/blog/2009/12/how-to-use-locks-in-php-cron-jobs-to-avoid-cron-overlaps/"&gt;http://abhinavsingh.com/blog/2009/12/how-to-use-locks-in-php-cron-jobs-to-avoid-cron-overlaps/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-1707885808914082283?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/1707885808914082283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=1707885808914082283' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/1707885808914082283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/1707885808914082283'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/03/how-to-use-locks-in-php-cron-jobs-to.html' title='How to use locks in PHP cron jobs to avoid cron overlaps'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-1222813544772825315</id><published>2011-03-03T21:25:00.000Z</published><updated>2011-03-03T21:25:00.377Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Develop PHP applications with Picasa Web Albums</title><content type='html'>&lt;br /&gt;Integrate data from Picasa Web Albums into a custom PHP application&lt;br /&gt;&lt;blockquote&gt;Picasa Web Albums offers Web application developers a REST-based Data API to manipulate the photos and albums stored on its servers. PHP's SimpleXML extension and Zend's GData Library are ideal to process the XML feeds generated by this API so you can customize PHP photo management and photo sharing applications. In this article, meet the Picasa Web Albums Data API and see how you can use it to retrieve photos and photo metadata; add, modify and delete photos; and perform keyword searches of Picasa's user-generated content.&lt;/blockquote&gt;&lt;span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12px;"&gt;&lt;em style="color: #666666; font-family: verdana, sans-serif; font-size: 1.1em; font-style: normal; font-weight: bold;"&gt;&lt;a href="http://www.ibm.com/developerworks/library/x-picasalbum/"&gt;http://www.ibm.com/developerworks/library/x-picasalbum/&lt;/a&gt;&lt;/em&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-1222813544772825315?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/1222813544772825315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=1222813544772825315' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/1222813544772825315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/1222813544772825315'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/03/develop-php-applications-with-picasa.html' title='Develop PHP applications with Picasa Web Albums'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-8234306956391443624</id><published>2011-02-28T22:15:00.000Z</published><updated>2011-02-28T22:15:44.558Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Search and update Google Base with PHP</title><content type='html'>&lt;br /&gt;Use PHP to process and integrate data from Google Base with a custom Web application&lt;br /&gt;&lt;blockquote&gt;Google Base allows users to store any type of content online in Google's version of a massive online database. Web application developers are able to access and search this content through the Google Base Data API. This article introduces the Google Base Data API and demonstrates it in the context of a PHP application, explaining how to use SimpleXML and the Zend_Gdata module to search, retrieve, add, and edit different types of data on Google Base.&lt;/blockquote&gt;&lt;a href="http://www.ibm.com/developerworks/library/x-gbase/"&gt;http://www.ibm.com/developerworks/library/x-gbase/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-8234306956391443624?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/8234306956391443624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=8234306956391443624' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/8234306956391443624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/8234306956391443624'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/02/search-and-update-google-base-with-php.html' title='Search and update Google Base with PHP'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-3857018430759420374</id><published>2011-02-28T21:25:00.001Z</published><updated>2011-02-28T21:25:39.762Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Delete directories older than a set number of days</title><content type='html'>&lt;br /&gt;Find subdirectories under a path and delete any older than a set number of days.&lt;br /&gt;&lt;pre&gt;find /&lt;span class="Apple-style-span" style="color: #073763;"&gt;path&lt;/span&gt;/* -type d -ctime +&lt;span class="Apple-style-span" style="color: #073763;"&gt;6&lt;/span&gt; | xargs rm -r&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-3857018430759420374?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/3857018430759420374/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=3857018430759420374' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/3857018430759420374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/3857018430759420374'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/02/delete-directories-older-than-set.html' title='Delete directories older than a set number of days'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5698332201573706833.post-6287439503315369066</id><published>2011-02-28T21:19:00.006Z</published><updated>2011-03-08T22:15:49.216Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><category scheme='http://www.blogger.com/atom/ns#' term='script'/><title type='text'>Bash script lftp with lock file</title><content type='html'>&lt;br /&gt;Bash script to upload a directory to a remote ftp site.&lt;br /&gt;&lt;br /&gt;Uses the built in mirror function of the lftp ftp client.&lt;br /&gt;&lt;br /&gt;A lock file is created so script so two instances of the script cannot conflict with each other.&lt;br /&gt;&lt;pre&gt;#!/usr/bin/bash&lt;br /&gt;LOCKFILE=/tmp/ftp_mirror.lock&lt;br /&gt;&lt;br /&gt;if [ -e ${LOCKFILE} ] &amp;amp;&amp;amp; kill -0 `cat ${LOCKFILE}`; then&lt;br /&gt;&amp;nbsp;&amp;nbsp; exit # already running&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;HOST="&lt;span class="Apple-style-span" style="color: #073763;"&gt;ftphost&lt;/span&gt;"&lt;br /&gt;USER="&lt;span class="Apple-style-span" style="color: #073763;"&gt;username&lt;/span&gt;"&lt;br /&gt;PASS="&lt;span class="Apple-style-span" style="color: #073763;"&gt;password&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;LCD="&lt;span class="Apple-style-span" style="color: #073763;"&gt;localpath&lt;/span&gt;"&lt;br /&gt;RCD="&lt;span class="Apple-style-span" style="color: #073763;"&gt;remotepath&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;# make sure the lockfile is removed when we exit and then claim it&lt;br /&gt;trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT&lt;br /&gt;echo $$ &amp;gt; ${LOCKFILE}&lt;br /&gt;&lt;br /&gt;# upload files&lt;br /&gt;lftp -c "set ftp:list-options -a;&lt;br /&gt;open ftp://$USER:$PASS@$HOST;&lt;br /&gt;lcd $LCD;&lt;br /&gt;cd $RCD;&lt;br /&gt;mirror --reverse"&lt;br /&gt;&lt;br /&gt;rm -f ${LOCKFILE}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5698332201573706833-6287439503315369066?l=www.wiredplace.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.wiredplace.com/feeds/6287439503315369066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5698332201573706833&amp;postID=6287439503315369066' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/6287439503315369066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5698332201573706833/posts/default/6287439503315369066'/><link rel='alternate' type='text/html' href='http://www.wiredplace.com/2011/02/bash-script-lftp-with-lock-file.html' title='Bash script lftp with lock file'/><author><name>Ed</name><uri>http://www.blogger.com/profile/09578732608819034964</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
