<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Mr Dias Blog</title>
    
    <link>http://mrdias.com/</link>
    <description>He talks about code...</description>
    <language>en-us</language>
    <pubDate>Wed, 12 Aug 2009 16:42:34 +0000</pubDate>
    <copyright>Copyright Jorge Dias</copyright>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/mrdias" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
      <title>IE issues with new Element and class</title>
      <link>http://feedproxy.google.com/~r/mrdias/~3/lmoIku-yjZU/2009-08-12-ie-issues-with-new-element-and-class</link>
      <description>&lt;p&gt;The problem we have is that this code&lt;/p&gt;
        &lt;pre class="sh_javascript"&gt;
        new Element('div', {'class':'klassName'})
        &lt;/pre&gt;
        &lt;p&gt;will work in firefox but in IE (tested on version 8) the className is never set, which was causing some problems with the elements styles.&lt;/p&gt;
        &lt;p&gt;One of the workarounds would be to explicitly add the class name, like this:&lt;/p&gt;
        &lt;pre class="sh_javascript"&gt;
        var e = new Element('div');
        e.addClassName('klassName');
        &lt;/pre&gt;
        &lt;p&gt;The problem with this approach is that at work, we have a huge javascript codebase, so instead, we are going to monkey patch Prototype. We&amp;#8217;re working against version 1.6.0.3 of prototype, that&amp;#8217;s why we add the alert, so when we update, we&amp;#8217;ll catch this and check if it was fixed on core.&lt;/p&gt;
        &lt;pre class="sh_javascript"&gt;
        // This is a dirty hack to protoype, so IE, will take class names on new Element
        // new Element('div', {'class':'klassName'}) doesn't work on IE but does on firefox
        // in IE, we wouldn't get the className set.
        
        if (Prototype.Version != '1.6.0.3') alert("BEWARE OF THE PROTOTYPE VERSION");
        
        (function() {
          var element = this.Element;
          this.Element = function(tagName, attributes) {
            attributes = attributes || { };
            tagName = tagName.toLowerCase();
            var cache = Element.cache;
            if (Prototype.Browser.IE &amp;amp;&amp;amp; (attributes.name || attributes['class'])) {
              tagName = '&amp;lt;' + tagName + ' name="' + attributes.name + '"' + 'class="' + attributes['class'] + '"' + '&amp;gt;';
              delete attributes.name;
              
              return Element.writeAttribute(document.createElement(tagName), attributes);
            }
            if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
            return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
          };
          Object.extend(this.Element, element || { });
          if (element) this.Element.prototype = element.prototype;
        }).call(window);
        &lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/mrdias/~4/lmoIku-yjZU" height="1" width="1"/&gt;</description>
      <pubDate>Wed, 12 Aug 2009 16:42:34 +0000</pubDate>
      <guid isPermaLink="false">http://mrdias.com/articles/2009-08-12-ie-issues-with-new-element-and-class</guid>
    <feedburner:origLink>http://mrdias.com/articles/2009-08-12-ie-issues-with-new-element-and-class</feedburner:origLink></item>
    <item>
      <title>Whydicab gets some love</title>
      <link>http://feedproxy.google.com/~r/mrdias/~3/HneyDwl05Tg/2009-02-15-whydicab-gets-some-love</link>
      <description>&lt;p&gt;I did a few changes to this blog lately. First comes support for rss and atom feeds. You can also just configure in your settings to use an external feed like feedburner, just how I&amp;#8217;m doing it.&lt;br /&gt;
        While upgrading Merb, I&amp;#8217;ve had some issues with the new way of bundling, which affects my deployments. I haven&amp;#8217;t figured out an easy way to have different dependencies per environment. I&amp;#8217;ll have to check that out.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/mrdias/~4/HneyDwl05Tg" height="1" width="1"/&gt;</description>
      <pubDate>Sun, 15 Feb 2009 16:53:35 +0000</pubDate>
      <guid isPermaLink="false">http://mrdias.com/articles/2009-02-15-whydicab-gets-some-love</guid>
    <feedburner:origLink>http://mrdias.com/articles/2009-02-15-whydicab-gets-some-love</feedburner:origLink></item>
    <item>
      <title>Git goodies</title>
      <link>http://feedproxy.google.com/~r/mrdias/~3/8ElQ2G17sJA/2009-02-12-git-goodies</link>
      <description>&lt;p&gt;A couple days ago I had to gather some information from a git repository, so I&amp;#8217;m sharing this small scripts with you.&lt;/p&gt;
        &lt;p&gt;List of all authors on a git repo:&lt;/p&gt;
        &lt;pre class="sh_sh"&gt;
        git log --pretty=short | grep Author: | awk '{print $2}' | sort | uniq
        &lt;/pre&gt;
        &lt;p&gt;List all modified files since a revision:&lt;/p&gt;
        &lt;pre class="sh_sh"&gt;
        git-whatchanged revision.. --pretty=oneline | grep '^:' | awk '{print $6}' | sort | uniq
        &lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/mrdias/~4/8ElQ2G17sJA" height="1" width="1"/&gt;</description>
      <pubDate>Thu, 12 Feb 2009 13:51:15 +0000</pubDate>
      <guid isPermaLink="false">http://mrdias.com/articles/2009-02-12-git-goodies</guid>
    <feedburner:origLink>http://mrdias.com/articles/2009-02-12-git-goodies</feedburner:origLink></item>
    <item>
      <title>Will Paginate and Ajax</title>
      <link>http://feedproxy.google.com/~r/mrdias/~3/FYGOOQmUBVw/2008-12-16-will-paginate-and-ajax</link>
      <description>&lt;p&gt;I recently had to implement some ajax pagination for a site. After googling for a while I found a solution, but I couldn&amp;#8217;t customize the pagination url&amp;#8217;s or I had to specify the paginator to use (will paginate&amp;#8217;s default or mine for ajax), so I came up with this solution which fulfils all my needs.&lt;/p&gt;
        &lt;p&gt;First create the following class in your app/helpers.&lt;/p&gt;
        &lt;pre class="sh_ruby"&gt;
        class RemoteLinkRenderer &amp;lt; WillPaginate::LinkRenderer
          def prepare(collection, options, template)
            @remote = options.delete(:remote)
            super
          end
        
        protected
          def page_link(page, text, attributes = {})
            if @remote
              @template.link_to_remote(text, {:url =&amp;gt; url_for(page), :method =&amp;gt; :get}.
                                       merge(@remote), attributes)
            else
              @template.link_to(text, url_for(page), attributes)
            end
          end
        end
        &lt;/pre&gt;
        &lt;p&gt;Then you have to tell will_paginate which link_renderer to use, I do this in a rails initializer.&lt;/p&gt;
        &lt;pre class="sh_ruby"&gt;
        WillPaginate::ViewHelpers.pagination_options[:renderer] = 'RemoteLinkRenderer'
        &lt;/pre&gt;
        &lt;p&gt;So with this solution, you can work like you would normally with will_paginate, but if you need to do an ajax link, then you&amp;#8217;ll have to pass the options in the remote hash, something like this:&lt;/p&gt;
        &lt;pre class="sh_ruby"&gt;
         will_paginate(@comments, :remote =&amp;gt; {:update =&amp;gt; 'comments'})
        &lt;/pre&gt;
        &lt;p&gt;That&amp;#8217;s it enjoy. You can keep passing the same options you would normally do to will_paginate to customize the behaviour.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/mrdias/~4/FYGOOQmUBVw" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 16 Dec 2008 17:45:07 +0000</pubDate>
      <guid isPermaLink="false">http://mrdias.com/articles/2008-12-16-will-paginate-and-ajax</guid>
    <feedburner:origLink>http://mrdias.com/articles/2008-12-16-will-paginate-and-ajax</feedburner:origLink></item>
    <item>
      <title>Will Paginate and Merb</title>
      <link>http://feedproxy.google.com/~r/mrdias/~3/KGlSlyI0Z-U/2008-12-09-will-paginate-and-merb</link>
      <description>&lt;p&gt;So this blog is using will_paginate and merb.&lt;/p&gt;
        &lt;p&gt;I read something about how to do it in this &lt;a href="http://merbist.com/2008/10/27/will_paginate-and-merb/"&gt;post&lt;/a&gt; by The merbist, albeit the information was not complete.&lt;br /&gt;
        So here are my instructions:&lt;br /&gt;
        Clone mislav&amp;#8217;s will_paginate repo and build the gem from the agnostic branch.&lt;/p&gt;
        &lt;pre class="sh_sh"&gt;
        git clone git://github.com/mislav/will_paginate.git
        cd will_paginate/
        git checkout origin/agnostic 
        gem build
        &lt;/pre&gt;
        &lt;p&gt;With this commands you&amp;#8217;ve generated the will_paginate-3.0.0.gem.&lt;/p&gt;
        &lt;p&gt;If you want to install it system-wide use your usual gem install.&lt;br /&gt;
        If you want to bundle it in your project, as I did, then you&amp;#8217;ll have to do:&lt;/p&gt;
        &lt;pre class="sh_sh"&gt;
        thor merb:gem:install path/to/gem
        &lt;/pre&gt;
        &lt;p&gt;That&amp;#8217;s it.&lt;/p&gt;
        &lt;p&gt;&lt;span class="caps"&gt;UPDATE&lt;/span&gt;: If you don&amp;#8217;t want to build that stuff you can download it &lt;a href="http://mrdias.com/will_paginate-3.0.0.gem"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/mrdias/~4/KGlSlyI0Z-U" height="1" width="1"/&gt;</description>
      <pubDate>Tue, 09 Dec 2008 10:29:33 +0000</pubDate>
      <guid isPermaLink="false">http://mrdias.com/articles/2008-12-09-will-paginate-and-merb</guid>
    <feedburner:origLink>http://mrdias.com/articles/2008-12-09-will-paginate-and-merb</feedburner:origLink></item>
    <item>
      <title>Introducing whydicab</title>
      <link>http://feedproxy.google.com/~r/mrdias/~3/Lc11f3HvOBc/2008-12-08-introducing-whydicab</link>
      <description>&lt;p&gt;&lt;strong&gt;Whydicab&lt;/strong&gt;: Why did I create another blog?&lt;br /&gt;
        The answer is very simple, to learn. This is a playground for different technologies I&amp;#8217;ve been trying lately. This small blog is based on Merb and Datamapper.&lt;br /&gt;
        It is using rspec, dm-sweatshop, dm-tags, etc.&lt;br /&gt;
        It&amp;#8217;s inspired on &lt;a href="http://featherblog.org/"&gt;feather&lt;/a&gt; but without all the other stuff I didn&amp;#8217;t need.&lt;br /&gt;
        So I&amp;#8217;ll be using this blog to tell you the things I find interesting for the ruby community and other technologies related.&lt;br /&gt;
        If you want to checkout the code powering this blog, visit the repo at &lt;a href="http://github.com/diasjorge/whydicab/tree"&gt;http://github.com/diasjorge/whydicab/tree&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/mrdias/~4/Lc11f3HvOBc" height="1" width="1"/&gt;</description>
      <pubDate>Mon, 08 Dec 2008 19:35:59 +0000</pubDate>
      <guid isPermaLink="false">http://mrdias.com/articles/2008-12-08-introducing-whydicab</guid>
    <feedburner:origLink>http://mrdias.com/articles/2008-12-08-introducing-whydicab</feedburner:origLink></item>
  </channel>
</rss>
