<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Sagacidad aleatoria</title>
	<atom:link href="http://edgarinvillegas.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://edgarinvillegas.wordpress.com</link>
	<description>edgarin&#039;s sudden blog</description>
	<lastBuildDate>Wed, 02 Nov 2011 01:33:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='edgarinvillegas.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Sagacidad aleatoria</title>
		<link>http://edgarinvillegas.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://edgarinvillegas.wordpress.com/osd.xml" title="Sagacidad aleatoria" />
	<atom:link rel='hub' href='http://edgarinvillegas.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Upgrading to jQuery 1.6: Problems you may face</title>
		<link>http://edgarinvillegas.wordpress.com/2011/05/10/upgrading-to-jquery-1-6-troubleshooting/</link>
		<comments>http://edgarinvillegas.wordpress.com/2011/05/10/upgrading-to-jquery-1-6-troubleshooting/#comments</comments>
		<pubDate>Wed, 11 May 2011 01:38:59 +0000</pubDate>
		<dc:creator>edgarinvillegas</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery 1.6]]></category>
		<category><![CDATA[jQuery upgrade]]></category>
		<category><![CDATA[update to jQuery]]></category>

		<guid isPermaLink="false">http://edgarinvillegas.wordpress.com/?p=5</guid>
		<description><![CDATA[I rarely (never?) blog. I’m not used to it. But I had to start somewhen. I think now is a good moment, cause upgrading to jQuery 1.6 pissed me off, as it&#8217;s not transparent as older upgrades were. I hope &#8230; <a href="http://edgarinvillegas.wordpress.com/2011/05/10/upgrading-to-jquery-1-6-troubleshooting/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=edgarinvillegas.wordpress.com&amp;blog=3939939&amp;post=5&amp;subd=edgarinvillegas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em>I rarely (never?) blog. I’m not used to it. But I had to start somewhen. I think now is a good moment, cause upgrading to jQuery 1.6 pissed me off, as it&#8217;s not transparent as older upgrades were. I hope you’ll enjoy this post, Cheers!.</em></p>
<p>Ok, it’s a happy day, you surf the web and discover  jQuery 1.6 has been born. “<em>New version, that’s cool, let’s upgrade!</em>” you may say.  And you upgrade to the latest version as you usually do… but after some time, suddenly, you see your webpage begins to behave strangely (if not, you’re very lucky or it hasn’t happened yet)… what happened? The reason is that jQuery 1.6 has changed dramatically the behavior of some existing methods, breaking changes indeed&#8230;</p>
<h2>Changes to .attr() method in 1.6. OMG!!</h2>
<p>Maybe the most ‘polemic’ change that doesn’t allow to sleep to many developers (at least me), is the change made to the <code>.attr()</code> function. Now, it returns <strong>only html attributes</strong> and <strong>not dom properties</strong>. (If you want to get a dom property value as before, there’s a new method called <code>.prop()</code>). I think this change is crazy (good if jquery would have been born with this, but now, it’s crazy).</p>
<p>Consider the following markup:</p>
<pre>&lt;input type="checkbox" id="myCheckbox" checked="" value="1" /&gt;</pre>
<p>Now consider doing</p>
<pre>$('#myCheckbox').attr("checked")</pre>
<p>You get the following results:</p>
<table border="1" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th valign="top" width="259">Code</th>
<th valign="top" width="192">jQuery &lt; 1.6 returns:</th>
<th valign="top" width="187">jQuery 1.6 returns:</th>
</tr>
<tr>
<td valign="top" width="259">
<pre>$('#myCheckbox').attr("checked")</pre>
</td>
<td valign="top" width="192">
<pre>true</pre>
</td>
<td valign="top" width="187">
<pre>""</pre>
</td>
</tr>
</thead>
</table>
<p>Oh oh… Let’s go on and see something more ‘applied’:</p>
<pre>if($('#myCheckbox').attr("checked")){
   alert("This executes in jQuery&lt;= 1.5");
}else{
   alert("OMG. This executes in jQuery1.6!");
}</pre>
<p>Oh my god. This is a HUGE problem in my opinion.  jQuery 1.6 <em>broke </em>our code.</p>
<p>Some of you may be thinking: <em>I’d never leave an empty ‘checked’ attribute</em>, or <em>I’d not use <code>.attr()</code> to see if a checkbox is checked.</em> Yes, but that’s not the point. The point is that this change isn’t fully backwards compatible. And, you may know your code well, but you don’t know how 3<sup>rd</sup> party plugins will behave.</p>
<p>Yes, the new <code>.prop()</code> method would do what we want, but this is a new function,  so our old code doesn’t use it.  Big problem</p>
<h2>Changes to .data() method in 1.6</h2>
<p>Now, the <code>.data()</code> function returns data attributes’ names (those prefixed with data-) with camelCase if you use hyphens, and lowercase if you don’t. Why? Because it’s a W3C recommendation. Why is it bad? Because it can break backwards compatibility.</p>
<p>Consider the following markup now:<br />
<code>&lt;input type="text" id="myTextbox" <strong>data-firstName</strong>="John" <strong>data-last-name</strong>="Doe" /&gt;</code><br />
And the following code:</p>
<pre>$txt= $("#myTextbox");
console.log($txt.data());
console.log('.data("firstName")= ' + $txt.data("firstName"));
console.log('.data("firstname")= ' + $txt.data("firstname"));
console.log('.data("last-name")= ' + $txt.data("last-name"));
console.log('.data("lastName")= ' + $txt.data("lastName"));</pre>
<p>These are the results</p>
<table border="1" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th valign="top" width="319">jQuery &lt; 1.6 returns:</th>
<th valign="top" width="319">jQuery 1.6 returns:</th>
</tr>
</thead>
<tbody>
<tr>
<td valign="top" width="319">
<pre>.data()= { <strong>last-name</strong>="Doe", firstname="John"}
.data("firstName")= <strong>John </strong>
.data("firstname")= John
.data("last-name")= Doe
.data("lastName")= <strong>undefined</strong></pre>
</td>
<td valign="top" width="319">
<pre>.data()= { <strong>lastName</strong>="Doe", firstname="John"}
.data("firstName")= <strong>undefined </strong>
.data("firstname")= John
.data("last-name")= Doe
.data("lastName")= <strong>Doe</strong></pre>
</td>
</tr>
</tbody>
</table>
<div style="display:none;">
<p>Legend</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="38">text</td>
<td valign="top" width="303">Equal between jQuery versions</td>
</tr>
<tr>
<td valign="top" width="38">text</td>
<td valign="top" width="303">Different depending on jQuery version</td>
</tr>
</tbody>
</table>
</div>
<p>(Note that only the third and fourth lines return the same results in both cases)</p>
<p>So, if you had the following snippets to say “Hi John”, “Bye Doe” in your old-happy jquery 1.5 code:</p>
<pre>alert("Hi, " + $txt.data("firstName"));  //Outputs "Hi John" in jQuery &lt; 1.6
alert("Bye, " + $txt.data()['last-name']);  //Outputs "Bye Doe" in jQuery &lt; 1.6</pre>
<p>in jQuery 1.6 it would show <code>undefined </code>in both cases. Not good at all.</p>
<h2>Possible solutions</h2>
<p>Well, those are the problems. Now, there are some solutions. But unfortunately, none of them is easy.</p>
<h3>Solution 1: The obvious, and hardest one:</h3>
<p>- Change all the code you have, looking for this <code>.attr()</code> and <code>.data()</code>, and change them (when necessary) to be compatible with jQuery 1.6 (doh!, awful solution!).</p>
<p>- In the case of 3<sup>rd</sup> party plugins, if they are minified apply this changes to unminified versions, and then re-minify them with some minifier (YUI Compressor, packer, uglify or the one you prefer).</p>
<h3>Solution 2: Extend jQuery to have both old and new behaviors</h3>
<p>- Write a jQuery plugin, let’s say <code>.oldAttr()</code>. This method would have to behave exactly as the old <code>.attr()</code>. This is not so hard if you check jquery 1.5’s source code (I can do it if there are requests). The same should be done for <code>.data</code>, writing an <code>.oldData()</code> plugin.</p>
<p>- Replace all <code>.attr()</code> and <code>.data()</code> calls with the new <code>.oldAttr()</code> and <code>.oldData()</code> plugins.</p>
<p>- For 3<sup>rd</sup> party plugins, you should replace in unminified versions and then minify again as explained in the previous solution.</p>
<p>- Then, for your new code, use jQuery 1.6, <code>attr()</code>, <code>prop()</code> and <code>data()</code> as the documentation describes.</p>
<h3>Solution 3: Wait and Pray (and pressure!) so jQuery folks regret. (I really hope it)</h3>
<p>- Wait until the jQuery Team realizes these changes are EVIL (specially the <code>.attr()</code> case), and correct these changes to be backwards-compatible in the next jQuery version (1.6.1). So, we wouldn’t have to make any changes to our code. I hope it!</p>
<hr />
<p>Well, that’s it. Do you agree? Have any comments? Do you think there are other solutions? Any comment is welcome.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/edgarinvillegas.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/edgarinvillegas.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/edgarinvillegas.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/edgarinvillegas.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/edgarinvillegas.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/edgarinvillegas.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/edgarinvillegas.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/edgarinvillegas.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/edgarinvillegas.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/edgarinvillegas.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/edgarinvillegas.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/edgarinvillegas.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/edgarinvillegas.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/edgarinvillegas.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=edgarinvillegas.wordpress.com&amp;blog=3939939&amp;post=5&amp;subd=edgarinvillegas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://edgarinvillegas.wordpress.com/2011/05/10/upgrading-to-jquery-1-6-troubleshooting/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de057083353e7435174218bcaa3e191a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">edgarinvillegas</media:title>
		</media:content>
	</item>
		<item>
		<title>Paginación en SQL Server</title>
		<link>http://edgarinvillegas.wordpress.com/2008/06/10/paginacion-en-sqlserver/</link>
		<comments>http://edgarinvillegas.wordpress.com/2008/06/10/paginacion-en-sqlserver/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 07:02:09 +0000</pubDate>
		<dc:creator>edgarinvillegas</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[La paginación en SQL Server puede ser una pesadilla para muchos, ya que este DBMS no posee una cláusula LIMIT como la de MySQL. Aqui propongo una equivalencia de la cláusula LIMIT de Mysql en SQL Server 2005. En Mysql &#8230; <a href="http://edgarinvillegas.wordpress.com/2008/06/10/paginacion-en-sqlserver/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=edgarinvillegas.wordpress.com&amp;blog=3939939&amp;post=1&amp;subd=edgarinvillegas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>La paginación en SQL Server puede ser una pesadilla para muchos, ya que este DBMS no posee una cláusula LIMIT como la de MySQL.</p>
<p>Aqui propongo una equivalencia de la cláusula LIMIT de Mysql en SQL Server 2005.<br />
En Mysql (con LIMIT):</p>
<p>SELECT EST_NOMBRE, EST_NUMEROSERIE<br />
FROM ESTACION<br />
WHERE EST_DESC LIKE &#8216;%W%&#8217;<br />
ORDER BY est_id<br />
LIMIT 2, 6</p>
<p>En SQL Server 2005 (sin LIMIT):</p>
<p>SELECT EST_NOMBRE, EST_NUMEROSERIE<br />
FROM (<br />
SELECT *, ROW_NUMBER() OVER (ORDER BY est_id) AS nfila FROM ESTACION<br />
WHERE EST_DESC LIKE &#8216;%W%&#8217;<br />
) AS ESTACION_NUMERADA<br />
WHERE nfila BETWEEN 2 AND 8</p>
<p>Espero que les sirva</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/edgarinvillegas.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/edgarinvillegas.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/edgarinvillegas.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/edgarinvillegas.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/edgarinvillegas.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/edgarinvillegas.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/edgarinvillegas.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/edgarinvillegas.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/edgarinvillegas.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/edgarinvillegas.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/edgarinvillegas.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/edgarinvillegas.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/edgarinvillegas.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/edgarinvillegas.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/edgarinvillegas.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/edgarinvillegas.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=edgarinvillegas.wordpress.com&amp;blog=3939939&amp;post=1&amp;subd=edgarinvillegas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://edgarinvillegas.wordpress.com/2008/06/10/paginacion-en-sqlserver/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de057083353e7435174218bcaa3e191a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">edgarinvillegas</media:title>
		</media:content>
	</item>
	</channel>
</rss>
