<?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>El Blog del Antonio &#187; Tools</title>
	<atom:link href="http://www.ramirezcobos.com/tag/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ramirezcobos.com</link>
	<description>Programming Web with PHP, CSS, Javascript and ∞</description>
	<lastBuildDate>Wed, 14 Jul 2010 14:03:05 +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>Yii Framework -Final Decision</title>
		<link>http://www.ramirezcobos.com/2010/06/19/yii-framework-final-decision/</link>
		<comments>http://www.ramirezcobos.com/2010/06/19/yii-framework-final-decision/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 18:43:51 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Frameowrk]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=481</guid>
		<description><![CDATA[I never felt comfortable with external libraries, those created by other people. Always, since my old times with Visual Basic, have created my own and until now, everything I created was good enough but&#8230; Suddenly, after I found that marvellous library called RedBean, I found my self re-programming all my libraries and end up creating]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-483" href="http://www.ramirezcobos.com/2010/06/19/yii-framework-final-decision/yii_logo-300x300/"><img class="alignright size-full wp-image-483" title="Yii Framework" src="http://www.ramirezcobos.com/wp-content/uploads/2010/06/yii_logo-300x300.jpg" alt="" width="300" height="300" /></a>I never felt comfortable with external libraries, those created by other people. Always, since my old times with Visual Basic, have created my own and until now, everything I created was good enough but&#8230; Suddenly, after I found that marvellous library called <a href="http://www.redbeanphp.com" target="_blank">RedBean</a>, I found my self re-programming all my libraries and end up creating a controller and a base model class for a sort of MVC library &#8211; I will post it one of these days so you guys can look at it and find out how easy is to implement that incredible library is (thanks Gabor de Mooij!) on your libraries.</p>
<p>But, as a programmer, I started to think that, even though my own libraries speed up my development processes, I want it to be hands on a bigger and more ambitious projects -that happened long time a go but never felt impressed by any library out there. My libraries lacked on scalable development architecture and had to find for a better solution for a much bigger project I am jumping right now. I google around and found interesting offers as exposed on <a href="http://www.ramirezcobos.com/2010/01/26/php-frameworks/" target="_blank">one of my old posts</a>:</p>
<ul>
<li><a href="http://www.codeigniter.com" target="_blank">CodeIgniter</a></li>
<li><a href="http://www.yiiframework.com/">Yii</a></li>
<li><a href="http://www.cakephp.org" target="_blank">CakePHP</a></li>
<li><a href="http://framework.zend.com/home" target="_blank">Zend</a></li>
<li><a href="http://www.symfony-project.com/" target="_blank">Symfony</a></li>
<li><a href="http://www.phpdevshell.org/" target="_blank">PHPDevShell</a></li>
<li><a href="http://www.pradosoft.com/" target="_blank">Prado</a></li>
<li><a href="http://www.akelos.org/" target="_blank">Akelos</a></li>
<li><a href="http://www.akelos.org/" target="_blank">ZooP</a></li>
<li><a href="http://qphp.net/" target="_blank">QPHP</a></li>
<li><a href="http://www.ez.no/ezcomponents" target="_blank">ezComponents</a></li>
<li><a href="http://www.doophp.com/" target="_blank">DooPHP</a></li>
</ul>
<p>Actually, far too many, so I took my time to decide for one to suit all my needs. Checked around and read some good articles about Yii framework and then, telling the truth, I was very impressed with (information taken from <a href="http://programmersnotes.info/2009/02/24/yii_framework_of_my_choice/" target="_self">http://programmersnotes.info</a>:</p>
<ul>
<li>100% OO architecture. It is really good application design.</li>
<li>Authentication &amp; roles mechanism</li>
<li>Caching techniques</li>
<li>DB access, which is based on PDO</li>
<li>Active record and relational active record implementation</li>
<li>Validation – that is really, really nice. To create quite complex  register form (check if login is unique, if email is unique, email match  with confirmation, passwords match, validate integer/string values,  check empty fields and give nice error messages for each field you need  only template (view) and model with rules defined. It took me 10-15 mins  to do that!)</li>
<li>Component concept. Just to give an idea, why is it nice – you can  define getter and setter methods for properties, you can define  read-only properties for components, define and invoke events, attach  event handlers and additional features to the class without modifying  it, just by attaching additional behaviour to it</li>
<li>Also, check its graphical benchmarking against other MVC frameworks <a href="http://www.yiiframework.com/performance" target="_blank">http://www.yiiframework.com/performance</a>.</li>
</ul>
<p>Wondering whether <a href="http://www.doophp.com">DooPHP</a> (claiming is the fastest at the moment) or <a href="http://www.yiiframework.com/" target="_blank">Yii</a>, I finally decided to use the latest due that DooPHP is quite new and Yii has a huge amount of features and tweaks that, even its documentation is not the best (I just read their Definitive Guide and I think I will have to read to a couple of hundreds articles more to be &#8216;good&#8217; at it), I think at the end will become the Toolset for highly scalable projects -using its automation tool called <a href="http://www.yiiframework.com/doc/guide/topics.gii" target="_blank">Gii</a>, I did the skeleton of a project in less than 30 seconds -duh!.</p>
<p>In addition. last but not least, you can integrate <a href="http://framework.zend.com/manual/components">Zend components</a> easily and <a href="http://www.jquery.com" target="_blank">jQuery</a> is nativelly implemented -and I loooooove jQuery.</p>
<p>For the small ones I still like my own libraries though <img src='http://www.ramirezcobos.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/06/19/yii-framework-final-decision/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uri Class for PHP</title>
		<link>http://www.ramirezcobos.com/2010/06/10/uri-class-for-php/</link>
		<comments>http://www.ramirezcobos.com/2010/06/10/uri-class-for-php/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 07:38:15 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=466</guid>
		<description><![CDATA[For years, we developers tend to keep functions that we find useful into our projects, after certain time they become obsolete or you move one to higher level ways of programming. Some of us, can&#8217;t get rid of the code that was once collected-created and I thought let&#8217;s see if I post one of my]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><a rel="attachment wp-att-467" href="http://www.ramirezcobos.com/2010/06/10/uri-class-for-php/open-source/"><img class="alignright size-medium wp-image-467" title="open-source" src="http://www.ramirezcobos.com/wp-content/uploads/2010/06/open-source-300x258.png" alt="" width="300" height="258" /></a>For years, we developers tend to keep functions that we find useful into our projects, after certain time they become obsolete or you move one to higher level ways of programming. Some of us, can&#8217;t get rid of the code that was once collected-created and I thought let&#8217;s see if I post one of my silly old classes what can we get out of it? Let&#8217;s make it open source hahahaha.</p>
<p style="text-align: justify;">I propose you the following: Here is my small old good set of Uri PHP functions encapsulated into one class, I know is not a great deal but, let&#8217;s see what can we all do with it. For every programmer that posts a function, I will write his reference into the class and post his/her site link in this post.</p>
<p style="text-align: justify;">There are certain rules though:</p>
<ol style="text-align: justify;">
<li>Functions cannot be greater than 20 lines of code</li>
<li>Functions cannot depend of far too many external components (maximum one)</li>
<li>If functions depend of an external component/class, a URL indicating its reference must be provided</li>
<li>Functions are not to be repetitive, if there is one better written that the ones exposes we will replace it</li>
</ol>
<h3 style="text-align: justify;">The Uri Class</h3>
<p style="text-align: justify;">Here is my class:</p>
<p style="text-align: justify;">
<pre class="brush: php;">
&lt;?php
/**
 * @author Antonio Ramirez &lt;contactme@atmyblog.com&gt;
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link http://www.ramirezcobos.com/
 *
 *
 */
class Uri
{
	/**
	 * Encodes the parameter to hide
	 * its contents to user
	 *
	 * @param string $val
	 */
	function uriEncode($val)
	{
		return rawurlencode(base64_encode($val));
	}
	/**
	 * Decodes a parameter string that
	 * was previously encoded with uriEncode
	 * function
	 *
	 * @param string $val
	 */
	function uriDecode($val){
		return base64_decode(rawurldecode($val));
	}
	/**
	 * Translates a given url to
	 * tinyurl version -curl required
	 *
	 * @param string $url
	 * @access public
	 * @return string $data
	 */
	function getTinyUrl($url){
		$ch = curl_init();
		$timeout = 5;
		curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url);
		curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
		$data = curl_exec($ch);
		curl_close($ch);
		return $data;
	}
	/**
	 * Translates a given url to
	 * ToLyUrl version -curl required
	 *
	 * @param string $url
	 * @access public
	 * @return string $data
	 */
	function getToLyUrl($url){
		$ch = curl_init();

		curl_setopt($ch, CURLOPT_URL, 'http://to.ly/api.php?longurl='.urlencode($url));
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch, CURLOPT_HEADER, 0);

		$data = curl_exec ($ch);
		curl_close ($ch);

		return $data;
	}
	/**
     * Gets Request param
     *
     * @param string $paramName
     * @param string $slash
     * @access public
     * @return string $param or boolean $false
     */
	function getParam($paramName, $slash=false)
	{
		return (isset($_REQUEST[$paramName])?($slash?addslashes($_REQUEST[$paramName]):$_REQUEST[$paramName]):false);
	}
	/**
     * Serializes Request params
     *
     * @param string $notThisOne
     * @access public
     * @return string $query_string
     */
	function getParams($notThisOne=false)
  	{
		global $REQUEST_METHOD, $HTTP_GET_VARS, $HTTP_POST_VARS;
		$query_string='';
		if (strpos($_SERVER['REQUEST_URI'],&quot;?&quot;))
		{
			list($fullfile, $voided) = explode(&quot;?&quot;, $_SERVER['REQUEST_URI']);
			$cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $HTTP_GET_VARS : $HTTP_POST_VARS;
			reset ($cgi);
			while (list($key, $value) = each($cgi)) {
			  if ($key != $notThisOne)
				$query_string .= &quot;&amp;&quot; . $key . &quot;=&quot; . $value;
			}
		}
		return $query_string;
  	}
	/**
     * Makes a Soap Call
     *
     * @param string $uri
     * @param string $command
     * @param string $xml
     * @access public
     * @return string $response
     *
     * Requires Soap
     */
	function makeSoapCall($uri,$command,$xml)
	{

		try{

			ini_set('default_socket_timeout',10); // ten seconds, that is all we wait

			$client = new SoapClient($uri,array(&quot;connection_timeout&quot;=&gt;10));

			$response =  $client-&gt;__soapCall($command,array(new SoapParam($xml,'Peticion')));
		}
		catch(Exception $e){

			$response = false;
		}
		return $response;
	}
	/**
	 * Parses a given $url for validation
	 *
	 * @param string $url
	 * @access public
	 * @return $parsed_url
	 */
	function getParsedUrl($url)
	{
		$parsed_url = parse_url($url);

		if (!isset($parsed_url['scheme']) or $parsed_url['scheme'] != 'http'){
			echo 'Unsupported URL sheme given, please just use &quot;HTTP&quot;.';
			exit();
		}
		if (!isset($parsed_url['host']) or $parsed_url['host'] == ''){
			echo 'Invalid URL given!';
			exit();
		}

		$host = $parsed_url['host'];
		$host .= (isset($parsed_url['port']) and  !empty($parsed_url['port'])) ? ':'.$parsed_url['port'] : '';
		$path = (isset($parsed_url['path']) and  !empty($parsed_url['path'])) ? $parsed_url['path'] : '/';
		$path .= (isset($parsed_url['query']) and  !empty($parsed_url['query'])) ? '?'.$parsed_url['query'] : '';

		return 'http://' . $host . $path;
	}
	/**
     * Requests a Url and returns its contents
     *
     * @param string $url
     * @access public
     * @return string $query_string
     * @uses Snoopy class http://sourceforge.net/projects/snoopy/
     */
	function getUrlContent($url)
	{
		App::import('component','snoopy');

		$url = Uri::getParsedUrl($url);

		$snoopy = new Snoopy();
		$snoopy-&gt;agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; es-ES; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12';
		$snoopy-&gt;referer = '';

		$results = false;

		if($snoopy-&gt;fetch($url)){

			$results = $snoopy-&gt;results;
			// empty buffer:
			$snoopy-&gt;results = '';
		}

		return $results;
	}
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/06/10/uri-class-for-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RedBean ORM</title>
		<link>http://www.ramirezcobos.com/2010/06/07/redbean-orm/</link>
		<comments>http://www.ramirezcobos.com/2010/06/07/redbean-orm/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 09:34:21 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=457</guid>
		<description><![CDATA[I was breaking my head towards to find a better ORM approach for my own written framework. I used, and was very happy with P.O.R.K., for quite long time but, as most of us, I was looking for something that could improve the speed of my projects. P.O.R.K. configuration is not hard at all, it]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-458" href="http://www.ramirezcobos.com/2010/06/07/redbean-orm/redb/"><img class="alignright size-medium wp-image-458" title="redB" src="http://www.ramirezcobos.com/wp-content/uploads/2010/06/redB-300x180.jpg" alt="" width="300" height="180" /></a>I was breaking my head towards to find a better <a href="http://en.wikipedia.org/wiki/Object-relational_mapping" target="_blank">ORM</a> approach for my own written framework. I used, and was very happy with <a href="http://www.schizofreend.nl/Pork.dbObject" target="_blank">P.O.R.K.</a>, for quite long time but, as most of us, I was looking for something that could improve the speed of my projects. <a href="http://www.schizofreend.nl/Pork.dbObject" target="_blank">P.O.R.K.</a> configuration is not hard at all, it is compound of a set of classes encapsulated in three files that allowed me to create <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">models</a> in sort of ActiveRecord style and was really, really good when I first started.</p>
<p>Now my projects are bigger, require a lot more of database analysis and those sometimes go up to 30 tables or more. That means that once analysed a project, I had to create those tables in the database, specify their fields and so on&#8230; you know.</p>
<p>I found my self into the lazyness mode and I was already thinking that it could be great to create a set of libraries that do not require any configuration files at all and could manipulate my databases in such a way that not only queries for data but also dynamically creates the tables for me if they do not exists. That could save me around one or two days of work I thought&#8230;</p>
<p>Before creating anything I ask mr &#8216;Google&#8217; if there was something around that could match my concept (never reinvent the wheel) and OH MY&#8230; I found it, its name is <a href="http://redbeanphp.com/" target="_blank">RedBean</a> and I have to say that is one of the greatest libraries that have ever came across.</p>
<p><strong>How it works</strong></p>
<p>Create a database</p>
<p>Include the required files to work with RedBean -one file: redbean.inc.php</p>
<pre class="brush: php;">

include('mypathto/redbean.inc.php&quot;);
</pre>
<p>Access its core:</p>
<pre class="brush: php;">
//Assemble a database connection string (DSN)
$dsn = &quot;mysql:host=localhost;dbname=mydatabasename&quot;;

//Connect to database and fetch the toolbox; either with password
$toolbox = RedBean_Setup::kickstartDev($dsn, $username, $password);
</pre>
<p>Now, just for this example: creating one Bean</p>
<pre class="brush: php;">

$rb = $toolbox-&gt;getRedBean();

// lets create one object that we didnt even declared anywhere <img src='http://www.ramirezcobos.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
$post = $rb-&gt;dispense('post');

// set some variables -fields
$post-&gt;title = 'This is magic';
$post-&gt;created = date('Y-m-d');

// save newly created object to database (how come?)
$rb-&gt;store($post);
</pre>
<p>If we were to look onto our database, we will find now that a new table is created called &#8216;post&#8217; and your bean has successfully saved its properties.</p>
<p>Of course, this is a silly example, in my case I am using redbean on a MVC &#8216;modified&#8217; pattern (I don&#8217;t like the &#8216;View&#8217; part as it is implemented in modern frameworks and for small projects I use my own approach). Please, have a look to its manual, trust me, it is <a href="http://redbeanphp.com/#/beans" target="_blank">worth</a> a try.</p>
<p>From the deep of my heart, THANKS for such a great job to his developer mr (Gabor) de Mooij. At last, one EASY yet POWERFULL library for our projects that really help us saving developing time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/06/07/redbean-orm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Lightbox</title>
		<link>http://www.ramirezcobos.com/2010/02/08/visual-lightbox/</link>
		<comments>http://www.ramirezcobos.com/2010/02/08/visual-lightbox/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 15:38:19 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[On The Web]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=273</guid>
		<description><![CDATA[This post is for those who wish to implement a beautiful Lightbox plugin on their site or blog and, unfortunately, do not have a clue about Javascript and/or jQuery and/or Html. VisualLightBox is a free application that helps you easily generate online photo albums, lightbox gallery with a nice Lightbox-style overlay effect, in a few]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/02/lightboxXL-thumb.jpg"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/02/add-images-to-gallery.jpg"><img class="alignright size-medium wp-image-385" title="add-images-to-gallery" src="http://www.ramirezcobos.com/wp-content/uploads/2010/02/add-images-to-gallery-300x210.jpg" alt="" width="300" height="210" /></a></a>This post is for those who wish to implement a beautiful Lightbox plugin on their site or blog and, unfortunately, do not have a clue about Javascript and/or jQuery and/or Html.</p>
<p>VisualLightBox is a free application that helps you easily generate online photo albums, lightbox gallery with a nice Lightbox-style overlay effect, in a few clicks without writing a single line of code.</p>
<p>Just drag&amp;drop your photos to VisualLightBox wizard window, press &#8220;Publish&#8221; and your own css web site album with beautiful LightBox effects will open in the browser instantly!<br />
No css, image editing, javascript, html coding, just a click to get your cool web page album ready.</p>
<p>It takes less than a minute to have your own image gallery.</p>
<p>For full documentation please go to http://lightbox2.com/</p>
<p>Newbies, now there is no excuse to have your featured lightbox on your site!<br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/02/08/visual-lightbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Php Frameworks</title>
		<link>http://www.ramirezcobos.com/2010/01/26/php-frameworks/</link>
		<comments>http://www.ramirezcobos.com/2010/01/26/php-frameworks/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 16:25:54 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=258</guid>
		<description><![CDATA[I decided to jump over the MVC (Model View Controller) pattern and on one of my linkedin groups I drop a question: Which one is best? A huge amount of PHP programmers started to join this discussion writing their personal PHP Framework tastes, providing me with a huge list of Frameworks I would like to]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/01/php_frameworks.png"></a><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/php_frameworks-300x200.png"><img class="alignright size-full wp-image-299" title="php_frameworks-300x200" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/php_frameworks-300x200.png" alt="" width="300" height="200" /></a>I decided to jump over the MVC (Model View Controller) pattern and on one of my linkedin groups I drop a question:</p>
<p><em>Which one is best? </em></p>
<p>A huge amount of PHP programmers started to join this discussion writing their personal PHP Framework tastes, providing me with a huge list of Frameworks I would like to share with you. I don&#8217;t say that one is best that another, as one of the members said, there is no &#8216;best PHP MVC Framework, is whatever suits you best on your project goals&#8217;.</p>
<ul>
<li><a href="http://www.codeigniter.com" target="_blank">CodeIgniter</a></li>
<li><a href="http://www.yiiframework.com/">Yii</a></li>
<li><a href="http://www.cakephp.org" target="_blank">CakePHP</a></li>
<li><a href="http://framework.zend.com/home" target="_blank">Zend</a></li>
<li><a href="http://www.symfony-project.com/" target="_blank">Symfony</a></li>
<li><a href="http://www.phpdevshell.org/" target="_blank">PHPDevShell</a></li>
<li><a href="http://www.pradosoft.com/" target="_blank">Prado</a></li>
<li><a href="http://www.akelos.org/" target="_blank">Akelos</a></li>
<li><a href="http://www.akelos.org/" target="_blank">ZooP</a></li>
<li><a href="http://qphp.net/" target="_blank">QPHP</a></li>
<li><a href="http://www.ez.no/ezcomponents" target="_blank">ezComponents</a></li>
</ul>
<p>I know the list could be much bigger, if you know more PHP Frameworks to add to this list, please comment and I will update it.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/01/26/php-frameworks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get Latitude and Longitude with Google Maps V3</title>
		<link>http://www.ramirezcobos.com/2010/01/22/get-latitude-and-longitude-with-google-maps-v3/</link>
		<comments>http://www.ramirezcobos.com/2010/01/22/get-latitude-and-longitude-with-google-maps-v3/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 14:56:24 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Google Maps]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=251</guid>
		<description><![CDATA[I would like to share with you a little piece of code that I find quite useful in my applications. I do create lots of guides that require a small utility to find out the latitude and longitude of a business location from a control panel in order to display the maps appropiately on the]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/01/Picture-22.png"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-22-300x198.png"><img class="alignright size-full wp-image-320" title="Picture-22-300x198" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-22-300x198.png" alt="" width="300" height="198" /></a></a>I would like to share with you a little piece of code that I find quite useful in my applications. I do create lots of guides that require a small utility to find out the latitude and longitude of a business location from a control panel in order to display the maps appropiately on the Web. Here I will do my best to explain a step procedure on how to do that -once you know the procedure, it is easy to create plugins or whatever you wish to do.</p>
<h3>Step 1</h3>
<p>First of all, lets make a reference to the new version of Google Maps. Check that we have to specify a parameter sensor=false. To find out more about this parameter please follow this <a href="http://code.google.com/intl/en-EN/apis/maps/documentation/#SpecifyingSensor">link</a>.</p>
<pre class="brush: xml;">
&lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;
</pre>
<h3>Step 2</h3>
<p>Now we are going to write the HTML tags on the BODY of our document that will hold the map and the controls that will hold latitude, longitude and zoom level references. Also, see the CSS that control the size of the map holder.</p>
<pre class="brush: xml;">
&lt;style&gt;
div#gmap {
width: 100%;
height: 300px;
}
&lt;/style&gt;
&lt;body&gt;
&lt;center&gt;
&lt;!-- MAP HOLDER --&gt;
&lt;div id="gmap"&gt;&lt;/div&gt;
&lt;!-- REFERENCES --&gt;
lat:&lt;span id="lat"&gt;&lt;/span&gt; lon:&lt;span id="lon"&gt;&lt;/span&gt;&lt;br/&gt;
zoom level: &lt;span id="zoom_level"&gt;&lt;/span&gt;
&lt;/center&gt;
&lt;/body&gt;
</pre>
<h3>Step 3</h3>
<p>Now, we are going to write the function that will display the map when the document loads. The function, that we will call &#8216;initialize&#8217; has different parts that we will describe now:</p>
<h4>Part 1</h4>
<p>Setting the map zoom level and its position in the world:</p>
<pre class="brush: jscript;">
var myLatlng = new google.maps.LatLng(38.971154274048345,1.415863037109375); // IBIZA <img src='http://www.ramirezcobos.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
var myOptions = {
zoom: 16,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("gmap"), myOptions);
</pre>
<h4>Part 2</h4>
<p>Placing a marker on the map specifying its center position (please refer to above code for LatLon location).</p>
<pre class="brush: jscript;">
// marker refers to a global variable
marker = new google.maps.Marker({
position: myLatlng,
map: map
});
</pre>
<h4>Part 3</h4>
<p>Now, the events that will take control of the marker center re-positioning and placing the information on the correspondent document objects (lat, lon, and zoom level).</p>
<pre class="brush: jscript;">
// if center changed then update lat and lon document objects
google.maps.event.addListener(map, 'center_changed', function() {
var location = map.getCenter();
document.getElementById("lat").innerHTML = location.lat();
document.getElementById("lon").innerHTML = location.lng();
// call function to reposition marker location
placeMarker(location);
});
// if zoom changed, then update document object with new info
google.maps.event.addListener(map, 'zoom_changed', function() {
zoomLevel = map.getZoom();
document.getElementById("zoom_level").innerHTML = zoomLevel;
});
// double click on the marker changes zoom level
google.maps.event.addListener(marker, 'dblclick', function() {
zoomLevel = map.getZoom()+1;
if (zoomLevel == 20) {
zoomLevel = 10;
}
document.getElementById("zoom_level").innerHTML = zoomLevel;
map.setZoom(zoomLevel);
});
</pre>
<h4>Part 4</h4>
<p>Initialize the document objects with default information</p>
<pre class="brush: jscript;">
document.getElementById("zoom_level").innerHTML = 16;
document.getElementById("lat").innerHTML = 38.971154274048345;
document.getElementById("lon").innerHTML = 1.415863037109375;
</pre>
<h4>Step 4</h4>
<p>Finally, we have to write the function that will reposition the marker on &#8216;zoom_changed&#8217; map event and call the &#8216;initialize&#8217; function on window load event.</p>
<pre class="brush: jscript;">
function placeMarker(location) {
var clickedLocation = new google.maps.LatLng(location);
marker.setPosition(location);
}
window.onload = function(){initialize()};
</pre>
<p>And that&#8217;s it, we have a great utility to plug onto our projects in order to find out the latitude and longitude of an address.</p>
<h3>DOWNLOAD</h3>
<p>I have included the working version of this tutorial for you to download. If you make any changes on the code in order to improve/add more functionality to it (that is easy fellows), please share it here with us.</p>
<div style="padding: 10px; text-align: center; background-color: #ffffff; border: 3px solid #dddddd;"><table style="border: 1px solid #CCC;" cellpadding="3" width="100%">
  <tr>
    <td width="35">
      <img src="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/img/icons/default.gif" alt="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/img/icons/default.gif">
    </td>
    <td>
      <b>download:</b> <a href="http://www.ramirezcobos.com/?file_id=9">Get Lat Lon Finder</a> <small>(1.41KB)</small><br />
      <b>added:</b> 22/01/2010 <br />
      <b>clicks:</b> 387 <br />
      <b>description:</b>  <br />
    </td>
  </tr>
</table></div>
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/01/22/get-latitude-and-longitude-with-google-maps-v3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EzRegAPI OCX Control</title>
		<link>http://www.ramirezcobos.com/2010/01/12/ezregapi-ocx-control/</link>
		<comments>http://www.ramirezcobos.com/2010/01/12/ezregapi-ocx-control/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 10:46:20 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[OCX]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=159</guid>
		<description><![CDATA[Here is another Activex Control I have created on the old times of Visual Basic. This time, it easiest the tasks of a programmer to use the registry API functions of Windows. Visual Basic was one of my preferred languages when I started programming, everybody thought that it was a very slow programming language and,]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/01/Picture-31.png"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-31-300x162.png"><img class="alignright size-full wp-image-323" title="Picture-31-300x162" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-31-300x162.png" alt="" width="300" height="162" /></a></a>Here is another Activex Control I have created on the old times of Visual Basic. This time, it easiest the tasks of a programmer to use the registry API functions of Windows.</p>
<p>Visual Basic was one of my preferred languages when I started programming, everybody thought that it was a very slow programming language and, even more, it was not a true programming language. My love for this pseudo-language was so strong that I decided to prove to everybody that, with a bit of tweaking here and there and making use of the DLL libraries, I could speed up the application 10 times more.</p>
<p>And that happened, nevertheless, API programming was not easy to do and if you failed to &#8216;translate&#8217; the variable types of the function called to that of Visual Basic, you could probably end up with a &#8216;crash&#8217; or &#8216;out of memory&#8217; error.</p>
<p>This is why I created these ActiveX Controls, so to help others providing a simpler and already translated code to make use of the API functions without worrying about a crash of their programs.</p>
<p>This is what I wrote back then (remember, I was a new born programmer -script kid)</p>
<blockquote><p>Well, most of the people I know studying our so-loved Visual Basic language find really hard to learn and very time-consuming the way to implement the power of API functions into VB programs. Even for the most simple thing is a time-consuming operation: find and insert necessary functions, constants, and then know exactly the steps to do in order to use the functions appropriately. It is true that VB6 environment provides some templates and that you can create your own to do the job, but sometimes those templates have to be re-shaped to suit the needs of a new project.<br />
That&#8217;s why I have started a series of ActiveX controls that will help not only beginners but to all those lazy programmers that, like me, doesn&#8217;t like to spend too much time doing research/re-shape and just want to design and code like maniacs.</p></blockquote>
<h3>How to use</h3>
<p>The download zip package has a well written help file. You will find everything you need in it.</p>
<h3>Download</h3>
<div style="padding: 10px; text-align: center; background-color: #ffffff; border: 3px solid #dddddd;"><table style="border: 1px solid #CCC;" cellpadding="3" width="100%">
  <tr>
    <td width="35">
      <img src="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/img/icons/default.gif" alt="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/img/icons/default.gif">
    </td>
    <td>
      <b>download:</b> <a href="http://www.ramirezcobos.com/?file_id=7">EzRegAPI OCX Control</a> <small>(203.05KB)</small><br />
      <b>added:</b> 12/01/2010 <br />
      <b>clicks:</b> 258 <br />
      <b>description:</b>  <br />
    </td>
  </tr>
</table></div>
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/01/12/ezregapi-ocx-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SWFUpload_0_0. Error HTTP Status: 403 Solved</title>
		<link>http://www.ramirezcobos.com/2010/01/05/swfupload_0_0-error-http-status-403-solved/</link>
		<comments>http://www.ramirezcobos.com/2010/01/05/swfupload_0_0-error-http-status-403-solved/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 11:21:18 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[On The Web]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=161</guid>
		<description><![CDATA[SWFUpload is a client-side file upload tool originally developed by Vinterwebb.se. It uses a combination of Flash and JavaScript to provide file upload functionality beyond what the basic browser provides with the &#60;input type=&#8221;file&#8221; /&#62; tag. The main features that SWFUpload provides are: The ability to select multiple files in the file browser dialog. AJAX-style]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/01/Picture-6.png"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-6.png"><img class="alignright size-medium wp-image-312" title="Picture-6" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-6-300x143.png" alt="" width="300" height="143" /></a></a><br />
<a href="http://www.swfupload.org/">SWFUpload</a> is a client-side file upload tool originally developed by <a href="http://www.vinterwebb.se/">Vinterwebb.se</a>. It uses a combination of Flash and JavaScript to 	provide file upload functionality beyond what the basic browser provides with the &lt;input type=&#8221;file&#8221; /&gt; tag.</p>
<p>The main features that SWFUpload provides are:</p>
<ul>
<li>The ability to select multiple files in the file browser dialog.</li>
<li>AJAX-style uploading without a page refresh.</li>
<li>Upload progress events.</li>
<li>Namespaced classes compatible with other JavaScript libraries (i.e., jQuery, Prototype, etc.).</li>
<li>Flash 9 and Flash 10 support. (Flash 8 support dropped in version 2.2.0)</li>
</ul>
<p>SWFUpload is different from other Flash based upload tools because of the philosophy 		behind its design.  SWFUpload gives developers control by leaving the UI in the browser (as much as possible). 		Developers can use XHTML, CSS, and JavaScript to tailor the upload UI to the needs and 		style of their site.  Upload status updates are made through a set of simple JavaScript events. 		The developer uses these events to update the webpage as the file upload progresses.</p>
<h3>How to use it</h3>
<p>I am not going to explain how to use it, if any of you are interested on it, SWFUpload guys have developed a very <a href="http://demo.swfupload.org/Documentation/" target="_blank">good site explaining its full functionality</a>.</p>
<h3>The problem</h3>
<p>After successfully installing the component on one of my projects and working amazingly good on the local computer, when I uploaded the project to the server where I contracted the hosting, suddenly I had an error: SWFUpload_0_0. Error HTTP Status: 403.</p>
<p>I google to find a solution to my problem and found tons of people having the same issue and the answers where always the same. For example:</p>
<p><strong><span style="color: #000000;"><em>&#8220;You are getting a 403.  Which means &#8220;forbidden&#8221;.  This is something on the web server that you&#8217;ll have to figure out.SWFUpload doesn&#8217;t save the file. It just uploads it to your upload_url (upload.php). You need to add PHP code that saves the file. In PHP the uploaded file is found in $_FILE["Filedata"] by default.&#8221;</em></span></strong></p>
<p>Say what? I looked at my server&#8217;s configuration, checked folder permissions, reviewed my JS and PHP code&#8230; <strong>NOTHING</strong>. Then I thought it was something wrong with server POST Payload checks. Normally,<a href="http://www.modsecurity.org/documentation/modsecurity-apache/1.9.3/html-multipage/03-configuration.html" target="_blank"> this security configuration is disabled by default on Apache Servers</a> but my provider &#8216;could&#8217; possibly had this security check on. I had to try and&#8230;</p>
<h3>Solution</h3>
<p>I solved the issue by creating an .htaccess file and writing the following in it:</p>
<p><strong><em>SetEnvIfNoCase Content-Type &#8220;^multipart/form-data;&#8221; &#8220;MODSEC_NOPOSTBUFFERING=Do not buffer file uploads&#8221;</em></strong></p>
<p>Hope this also works for those having the same issue.</p>
<p><em>Happy New Year BTW!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/01/05/swfupload_0_0-error-http-status-403-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>eyeOS a &#8216;very close&#8217; Web Operating System</title>
		<link>http://www.ramirezcobos.com/2010/01/04/eyeos-a-very-close-web-operating-system/</link>
		<comments>http://www.ramirezcobos.com/2010/01/04/eyeos-a-very-close-web-operating-system/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 10:31:30 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=154</guid>
		<description><![CDATA[I would like to talk to you about an open source Web application that I have followed since its beginnings: eyeOS. This application started with the goal to become a true Web Operating System and now the guys call it Open Source Cloud Computing&#8217;s Web Desktop. Even though the idea of having the system files]]></description>
			<content:encoded><![CDATA[<div id="attachment_155" class="wp-caption alignright" style="width: 310px"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/01/Picture-2.png"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-2.png"><img class="alignright size-medium wp-image-303" title="Picture-2" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-2-300x133.png" alt="" width="300" height="133" /></a></a><p class="wp-caption-text">eyeOS a Web Operating System</p></div>
<p>I would like to talk to you about an open source Web application that I have followed since its beginnings: <a href="http://eyeos.org/en/?section=home">eyeOS</a>. This application started with the goal to become a true Web Operating System and now the guys call it <strong>Open Source Cloud Computing&#8217;s Web Desktop</strong>. Even though the idea of having the system files on a server and have &#8216;dumb&#8217; clients is not new, these guys have created a great tool and nowadays they even work in conjunction with the IT monster IBM.</p>
<p>Maybe the dreamed future of every System Administrator is near, where they do not need to have certain operating system installed on their computers and everything, every little detail, is managed from a server. Client computers just having a &#8216;web browser&#8217; and a reliable network bandwidth (most LAN do have it) will reduce enormously companies costs and Microsoft&#8217;s pocket <img src='http://www.ramirezcobos.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Even though I think is a great tool I dislike their interface (sorry guys), it looks far too much like Windows and I think&#8230; that nowadays we could provide a better and more intuitive interfaces for clients. Not everybody is a guru folks and not everybody needs to learn Windows to use a computer. Best days are about to come but meanwhile, congratulations eyeOS.</p>
<h2>ScreenShoots</h2>
<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/01/Picture-3.png"><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-3-300x248.png"><img class="alignnone size-full wp-image-305" title="Picture-3-300x248" src="http://www.ramirezcobos.com/wp-content/uploads/2010/03/Picture-3-300x248.png" alt="" width="300" height="248" /></a></a><br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/01/04/eyeos-a-very-close-web-operating-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cookies on Roids -JSON Based</title>
		<link>http://www.ramirezcobos.com/2010/01/01/cookies-on-roids/</link>
		<comments>http://www.ramirezcobos.com/2010/01/01/cookies-on-roids/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 21:13:25 +0000</pubDate>
		<dc:creator>Antonio Ramirez</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Cookies]]></category>

		<guid isPermaLink="false">http://www.ramirezcobos.com/?p=142</guid>
		<description><![CDATA[Every Web programmer, one day or another, works with cookies. Some of us prefer to use server side cookies, others client cookies, and also both, client and server cookies. On my older blogspot blog, one that I even really care to update everyday as I do with this one, I post one class to work]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ramirezcobos.com/wp-content/uploads/2010/01/cookies.jpg"><img class="alignright size-medium wp-image-144" style="border: 3px solid #ddd; margin: 5px;" title="cookies" src="http://www.ramirezcobos.com/wp-content/uploads/2010/01/cookies-300x168.jpg" alt="" width="300" height="168" /></a>Every Web programmer, one day or another, works with cookies. Some of us prefer to use server side cookies, others client cookies, and also both, client and server cookies. On my older blogspot blog, one that I even really care to update everyday as I do with this one, I post one class to work with cookies on the client side and one fellow programmer told me about <a href="http://www.lalit.org/lab/jsoncookies">json cookies</a>. I thought it was a great script and that was because by using JSON (thanks David Crockford again!) encoding we could save objects and arrays of information into our good friends &#8216;cookies&#8217;.</p>
<p>Well, on my last post, I have included a JSON Plugin script to use with JQuery. By making a couple of modifications I have created a Cookie and JSON javascript objects to provide you with the possibility to save objects and arrays on cookies. Both of the objects do not require any other dependency library&#8230;</p>
<p><strong>Here is the script:</strong></p>
<p>
<pre class="brush: jscript;">&lt;br /&gt;
var JSON = {&lt;br /&gt;
    useHasOwn : ({}.hasOwnProperty ? true : false),&lt;br /&gt;
  	pad : function(n) {&lt;br /&gt;
        return n &amp;lt; 10 ? &amp;quot;0&amp;quot; + n : n;&lt;br /&gt;
    },&lt;br /&gt;
    m : {&lt;br /&gt;
        &amp;quot;\b&amp;quot;: '\\b',&lt;br /&gt;
        &amp;quot;\t&amp;quot;: '\\t',&lt;br /&gt;
        &amp;quot;\n&amp;quot;: '\\n',&lt;br /&gt;
        &amp;quot;\f&amp;quot;: '\\f',&lt;br /&gt;
        &amp;quot;\r&amp;quot;: '\\r',&lt;br /&gt;
        '&amp;quot;' : '\\&amp;quot;',&lt;br /&gt;
        &amp;quot;\\&amp;quot;: '\\\\'&lt;br /&gt;
    },&lt;br /&gt;
    encodeString : function(s){&lt;br /&gt;
        if (/[&amp;quot;\\\x00-\x1f]/.test(s)) {&lt;br /&gt;
            return '&amp;quot;' + s.replace(/([\x00-\x1f\\&amp;quot;])/g, function(a, b) {&lt;br /&gt;
                var c = m[b];&lt;br /&gt;
                if(c){&lt;br /&gt;
                    return c;&lt;br /&gt;
                }&lt;br /&gt;
                c = b.charCodeAt();&lt;br /&gt;
                return &amp;quot;\\u00&amp;quot; +&lt;br /&gt;
                    Math.floor(c / 16).toString(16) +&lt;br /&gt;
                    (c % 16).toString(16);&lt;br /&gt;
            }) + '&amp;quot;';&lt;br /&gt;
        }&lt;br /&gt;
        return '&amp;quot;' + s + '&amp;quot;';&lt;br /&gt;
    },&lt;br /&gt;
    encodeArray : function(o){&lt;br /&gt;
        var a = [&amp;quot;[&amp;quot;], b, i, l = o.length, v;&lt;br /&gt;
            for (i = 0; i &amp;lt; l; i += 1) {&lt;br /&gt;
                v = o[i];&lt;br /&gt;
                switch (typeof v) {&lt;br /&gt;
                    case &amp;quot;undefined&amp;quot;:&lt;br /&gt;
                    case &amp;quot;function&amp;quot;:&lt;br /&gt;
                    case &amp;quot;unknown&amp;quot;:&lt;br /&gt;
                        break;&lt;br /&gt;
                    default:&lt;br /&gt;
                        if (b) {&lt;br /&gt;
                            a.push(',');&lt;br /&gt;
                        }&lt;br /&gt;
                        a.push(v === null ? &amp;quot;null&amp;quot; : JSON.encode(v));&lt;br /&gt;
                        b = true;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            a.push(&amp;quot;]&amp;quot;);&lt;br /&gt;
            return a.join(&amp;quot;&amp;quot;);&lt;br /&gt;
    },&lt;br /&gt;
    encodeDate : function(o){&lt;br /&gt;
        return '&amp;quot;' + o.getFullYear() + &amp;quot;-&amp;quot; +&lt;br /&gt;
                pad(o.getMonth() + 1) + &amp;quot;-&amp;quot; +&lt;br /&gt;
                pad(o.getDate()) + &amp;quot;T&amp;quot; +&lt;br /&gt;
                pad(o.getHours()) + &amp;quot;:&amp;quot; +&lt;br /&gt;
                pad(o.getMinutes()) + &amp;quot;:&amp;quot; +&lt;br /&gt;
                pad(o.getSeconds()) + '&amp;quot;';&lt;br /&gt;
    },&lt;br /&gt;
    encode : function(o){&lt;br /&gt;
        if(typeof o == &amp;quot;undefined&amp;quot; || o === null){&lt;br /&gt;
            return &amp;quot;null&amp;quot;;&lt;br /&gt;
        }else if(o instanceof Array){&lt;br /&gt;
            return JSON.encodeArray(o);&lt;br /&gt;
        }else if(o instanceof Date){&lt;br /&gt;
            return JSON.encodeDate(o);&lt;br /&gt;
        }else if(typeof o == &amp;quot;string&amp;quot;){&lt;br /&gt;
            return JSON.encodeString(o);&lt;br /&gt;
        }else if(typeof o == &amp;quot;number&amp;quot;){&lt;br /&gt;
            return isFinite(o) ? String(o) : &amp;quot;null&amp;quot;;&lt;br /&gt;
        }else if(typeof o == &amp;quot;boolean&amp;quot;){&lt;br /&gt;
            return String(o);&lt;br /&gt;
        }else {&lt;br /&gt;
            var a = [&amp;quot;{&amp;quot;], b, i, v;&lt;br /&gt;
            for (i in o) {&lt;br /&gt;
                if(!JSON.useHasOwn || o.hasOwnProperty(i)) {&lt;br /&gt;
                    v = o[i];&lt;br /&gt;
                    switch (typeof v) {&lt;br /&gt;
                    case &amp;quot;undefined&amp;quot;:&lt;br /&gt;
                    case &amp;quot;function&amp;quot;:&lt;br /&gt;
                    case &amp;quot;unknown&amp;quot;:&lt;br /&gt;
                        break;&lt;br /&gt;
                    default:&lt;br /&gt;
                        if(b){&lt;br /&gt;
                            a.push(',');&lt;br /&gt;
                        }&lt;br /&gt;
                        a.push(JSON.encode(i), &amp;quot;:&amp;quot;,&lt;br /&gt;
                                v === null ? &amp;quot;null&amp;quot; : JSON.encode(v));&lt;br /&gt;
                        b = true;&lt;br /&gt;
                    }&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            a.push(&amp;quot;}&amp;quot;);&lt;br /&gt;
            return a.join(&amp;quot;&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
    },&lt;br /&gt;
    decode : function(json){&lt;br /&gt;
        return eval(&amp;quot;(&amp;quot; + json + ')');&lt;br /&gt;
    }&lt;br /&gt;
};&lt;/p&gt;
&lt;p&gt;var Cookie = {&lt;br /&gt;
	jsonencode : JSON.encode,&lt;br /&gt;
	jsondecode : JSON.decode,&lt;/p&gt;
&lt;p&gt;   	set : function(name,value,options){&lt;/p&gt;
&lt;p&gt;   		options = this.extend({}, options);&lt;/p&gt;
&lt;p&gt;        if (value === null) {&lt;br /&gt;
            value = '';&lt;br /&gt;
            options.expires = -1;&lt;br /&gt;
        }&lt;br /&gt;
        var expires = '';&lt;br /&gt;
        if (options.expires &amp;amp;&amp;amp; (typeof options.expires == 'number' || options.expires.toUTCString)) {&lt;br /&gt;
            var date;&lt;br /&gt;
            if (typeof options.expires == 'number') {&lt;br /&gt;
                date = new Date();&lt;br /&gt;
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));&lt;br /&gt;
            } else {&lt;br /&gt;
                date = options.expires;&lt;br /&gt;
            }&lt;br /&gt;
            expires = '; expires=' + date.toUTCString();&lt;br /&gt;
        }&lt;/p&gt;
&lt;p&gt;        var self = this;&lt;/p&gt;
&lt;p&gt;  		value = options.json ? encodeURIComponent(Cookie.jsonencode(value)):encodeURIComponent(value);&lt;/p&gt;
&lt;p&gt;        var path = options.path ? '; path=' + (options.path) : '';&lt;br /&gt;
        var domain = options.domain ? '; domain=' + (options.domain) : '';&lt;br /&gt;
        var secure = options.secure ? '; secure' : '';&lt;/p&gt;
&lt;p&gt;        document.cookie = [name, '=', value, expires, path, domain, secure].join('');&lt;br /&gt;
	},&lt;br /&gt;
	get : function(name,json){&lt;/p&gt;
&lt;p&gt;		var cookieValue = null;&lt;/p&gt;
&lt;p&gt;        if (document.cookie &amp;amp;&amp;amp; document.cookie != '') {&lt;br /&gt;
            var cookies = document.cookie.split(';');&lt;br /&gt;
            for (var i = 0; i &amp;lt; cookies.length; i++) {&lt;br /&gt;
                var cookie = this.trim(cookies[i]);&lt;br /&gt;
                // Does this cookie string begin with the name we want?&lt;br /&gt;
                if (cookie.substring(0, name.length + 1) == (name + '=')) {&lt;br /&gt;
                    cookieValue = json ? this.jsondecode(decodeURIComponent(cookie.substring(name.length + 1))):decodeURIComponent(cookie.substring(name.length + 1));&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;/p&gt;
&lt;p&gt;        return cookieValue;&lt;/p&gt;
&lt;p&gt;	},&lt;br /&gt;
	unset: function(name){&lt;br /&gt;
		Cookie.set(name,'',-1);&lt;br /&gt;
	},&lt;br /&gt;
	trim: function( val ) {&lt;br /&gt;
		return (val || &amp;quot;&amp;quot;).replace( /^\s+|\s+$/g, &amp;quot;&amp;quot; );&lt;br /&gt;
	},&lt;br /&gt;
	extend: function()&lt;br /&gt;
	{&lt;br /&gt;
		var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;&lt;br /&gt;
		if ( typeof target === &amp;quot;boolean&amp;quot; ) {&lt;br /&gt;
			deep = target;&lt;br /&gt;
			target = arguments[1] || {};&lt;br /&gt;
			i = 2;&lt;br /&gt;
		}&lt;br /&gt;
		if ( typeof target !== &amp;quot;object&amp;quot; &amp;amp;&amp;amp; !isFunction(target) )&lt;br /&gt;
			target = {};&lt;br /&gt;
		if ( length == i ) {&lt;br /&gt;
			target = this;&lt;br /&gt;
			--i;&lt;br /&gt;
		}&lt;br /&gt;
		for ( ; i &amp;lt; length; i++ )&lt;br /&gt;
			if ( (options = arguments[ i ]) != null )&lt;br /&gt;
				for ( var name in options ) {&lt;br /&gt;
					var src = target[ name ], copy = options[ name ];&lt;/p&gt;
&lt;p&gt;					if ( target === copy )&lt;br /&gt;
						continue;&lt;/p&gt;
&lt;p&gt;					if ( deep &amp;amp;&amp;amp; copy &amp;amp;&amp;amp; typeof copy === &amp;quot;object&amp;quot; &amp;amp;&amp;amp; !copy.nodeType )&lt;br /&gt;
						target[ name ] = this.extend( deep,&lt;br /&gt;
							src || ( copy.length != null ? [ ] : { } )&lt;br /&gt;
						, copy );&lt;/p&gt;
&lt;p&gt;					else if ( copy !== undefined )&lt;br /&gt;
						target[ name ] = copy;&lt;/p&gt;
&lt;p&gt;				}&lt;br /&gt;
		return target;&lt;br /&gt;
	},&lt;br /&gt;
	isFunction: function(obj){&lt;br /&gt;
		return toString.call(obj) === &amp;quot;[object Function]&amp;quot;;&lt;br /&gt;
	}&lt;br /&gt;
};&lt;br /&gt;
</pre>
</p>
<p>As you can see above, I have included a couple of methods that allow me to extend the options of the object at will (thanks jQuery). I believe that you will find it quite useful to extend its functionality. Any ideas will be highly appreciated.</p>
<p><strong>How to use it</strong></p>
<p>
<pre class="brush: jscript;">&lt;/p&gt;
&lt;p&gt;// Create a cookie with the given name and value and other optional parameters.&lt;br /&gt;
//&lt;br /&gt;
// session cookie -no json&lt;br /&gt;
Cookie.set('the_cookie_name', 'the_value');&lt;/p&gt;
&lt;p&gt;// get cookie (no json):&lt;br /&gt;
var cv = Cookie.get('the_cookie_name');&lt;/p&gt;
&lt;p&gt;// session cookie -json, the value can be an object or an array too&lt;br /&gt;
Cookie.set('the_cookie_name', 'the_value', {json:true});&lt;/p&gt;
&lt;p&gt;// get the cookie (json)&lt;br /&gt;
var cv = Cookie.get('the_cookie_name',true);&lt;/p&gt;
&lt;p&gt;// Secured cookie, expiring in 14 days&lt;br /&gt;
Cookie.set('the_cookie_name', 'the_value', { expires: 14, path: '/', domain: 'yourdomain.com', secure: true });&lt;/p&gt;
&lt;p&gt;// Deleting a cookie&lt;br /&gt;
Cookie.unset('the_cookie_name', null);&lt;/p&gt;
&lt;p&gt;</pre>
</p>
<p><strong>DOWNLOAD</strong></p>
<div style="padding: 10px; text-align: center; background-color: #ffffff; border: 3px solid #dddddd;"><table style="border: 1px solid #CCC;" cellpadding="3" width="100%">
  <tr>
    <td width="35">
      <img src="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/img/icons/default.gif" alt="http://www.ramirezcobos.com/wp-content/plugins/downloads-manager/img/icons/default.gif">
    </td>
    <td>
      <b>download:</b> <a href="http://www.ramirezcobos.com/?file_id=5">Cookies on Roids</a> <small>(2.18KB)</small><br />
      <b>added:</b> 01/01/2010 <br />
      <b>clicks:</b> 234 <br />
      <b>description:</b>  <br />
    </td>
  </tr>
</table></div>
<p><center><br />
<script type="text/javascript"><!--
google_ad_client = "pub-7060132287364604";
/* 468x60, creado 16/03/10 */
google_ad_slot = "9029910384";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
</center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramirezcobos.com/2010/01/01/cookies-on-roids/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
