<rss version="2.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/" 
>
<channel>
<title>in web we trust</title>
<link>http://www.inwebwetrust.net</link>
<description>Fernando Blat's blog, freelance web developer</description>
<language>es-es</language>
<dc:subject>Economía</dc:subject>


<generator>the-shaker v0.1. More on http://www.the-shaker.com</generator>
<item>
<title>The importance of supporting native data types </title>
<link>http://www.inwebwetrust.net/post/2010/07/14/the-importance-of-supporting-native-data-types</link>
<pubDate>2010-07-14T17:40:56+00:00</pubDate>
<content:encoded><![CDATA[<p>I'm going to start a new project which can have in very short time hard requirements on database performance: there are two entities, let's say <em>items</em> and <em>users</em> that will be related (a common <em>one-to-many</em> relationship). The question is that this relation is very probable to grow a lot and the <em>item</em> will be related with thousands of <em>users</em>. </p>
<p>In order to avoid having the <em>one-to-many</em> table with millions of rows I have decided to try with some NoSQL solutions, with the good luck that the first that I have tried still keeps me very impressed: <a href="http://code.google.com/p/redis/wiki/index?tm=6">Redis</a> is very awesome! It's very fast, extremely easy to use and very powerful. And the <em>set</em>, <em>ordered set</em> or <em>list</em> seem to fit perfectly in my problem.</p>
<p>So I decided to perform some tests:</p>
<pre name="code" class="ruby"> total_actions = 100000 # 10000 actions 1.upto(total_actions) do |i|   b = Benchmark.measure do     subscribers_per_action = 10000     1.upto(subscribers_per_action) do |user_id|       $redis.incr "action-#{i}-count"       $redis.sadd "action-#{i}", user_id     end   end   puts "#{i} / #{total_actions} / #{b.real} / #{$redis.dbsize}" end </pre>
<p>The results are impressive: <strong>10,000 incr and 10,000 adds to a set performed in 2.4 secs approximately</strong>. And not only in an empty database. I'm testing it with databases that have a lot of entries and still is performing such well.</p>
<p>So I decided to try the same in a Tokyo Tyrant server. The problem is that Tokyo Cabinet doesn't support datasets, it is a classical <em>key-value</em> storage. So if you want to add elements in a key you have to store them in a YAML, or in a string with a well-known separator, or that way.</p>
<p>The same test with Redis took the double of time with Tokyo Tyrant. I know that 5.7 secs for 20,000 operations is very very fast, but I'm still impressed of the performance of Redis working with data types much more complex that a string. My choice is quite clear.</p>
]]></content:encoded>
<comments>
http://www.inwebwetrust.net/post/2010/07/14/the-importance-of-supporting-native-data-types#comentarios
</comments>
</item>
<item>
<title>United States, here we go</title>
<link>http://www.inwebwetrust.net/post/2010/06/03/united-states-here-we-go</link>
<pubDate>2010-06-03T09:33:50+00:00</pubDate>
<content:encoded><![CDATA[<p>Tomorrow I'm leaving to Baltimore, I'll be attending to the <a href="http://en.oreilly.com/rails2010">RailsConf 2010</a> (as part as the Spanish noisy crew). It will be my first American Rails Conference (three years ago we went to London, when RailsConf was also european.</p>
<p>And in the next week I'll be in New York, picking our <a href="https://www.webbyawards.com/webbys/current.php?media_id=96&amp;season=14#webby_entry_travel">Webby award</a> as part of the founder team of <a href="http://iwannagothere.com">i wanna go there</a>. So exiting!</p>
]]></content:encoded>
<comments>
http://www.inwebwetrust.net/post/2010/06/03/united-states-here-we-go#comentarios
</comments>
</item>
<item>
<title>Conferencia Rails 2009</title>
<link>http://www.inwebwetrust.net/post/2009/10/24/conferencia-rails-2009</link>
<pubDate>2009-10-24T18:43:09+00:00</pubDate>
<content:encoded><![CDATA[<p>The Spanish community Rails conference (aka <a href="http://app.conferenciarails.org">Conferencia Rails</a>) is so close! Last week we opened <a href="http://app.conferenciarails.org/payment/new">the register</a> (what are you waiting for?), late than usual, but this year everything is a little bit more messy, because this year <strong>the conference is growing</strong> in a lot of aspects:</p>
<ul>
<li>this year we are moving to Vicálvaro, a village close to Madrid, to allow more attendees that past years (up to 250)</li>
<li>we have 3 international keynoters: <a href="http://yehudakatz.com/">Yehuda Katz</a>, <a href="http://dablog.rubypal.com/">David Black</a> and <a href="http://blog.talbott.ws/">Nathaniel Talbott</a></li>
<li>also there are coming people from the States, like Scott Chacon from <a href="http://github.com">Github</a>, or Obie Fernandez and the UK (surprise, surprise...)</li>
<li>we are having an extra day of workshops</li>
</ul>
<p>In spite of all the "anglo-attendees", the most of the talks will be in Spanish, and we are trying to make a calendar  with talks in English and Spanish, not both in English at the same time.</p>
<p>There is a lot of diversity in the topics of this year: git, jruby, cucumber, sinatra, ruby 1.9, rails 3, internazionalization, key-value storages, ror-es mailing list, and so on... In fact, I'm so excited, and I think (I know which are the talks of this year) it is, maybe, one of the best editions of this conference.</p>
]]></content:encoded>
<comments>
http://www.inwebwetrust.net/post/2009/10/24/conferencia-rails-2009#comentarios
</comments>
</item>
<item>
<title>DRYing a little bit the translation of your views with I18n</title>
<link>http://www.inwebwetrust.net/post/2009/10/03/drying-little-bit-the-translation-of-your-views-with-i18n</link>
<pubDate>2009-10-03T19:05:58+00:00</pubDate>
<content:encoded><![CDATA[<p>Since we have been using I18n in <a href="http://www.partigi.com">Partigi</a> for the last months we have notice that we were always repeating ourselves when localising a sentence like this:</p>
<blockquote><p>
  This film has been saved by 4 friends
</p></blockquote>
<p>What is special in this sentece is that, depending on the number of friends that saved the film, the sentence could be <em>"This film has been saved by one friend"</em>. It can be solved with <code>pluralize</code> helper, but it requires the counter to be at the beginning of the sentence.</p>
<p>Finally we decided to adopt a small convention: if a translation has a parameter <code>count</code> then, if <code>count</code> is singular the key for the translation will be the one in the view, but if it's plural, it will be the one in the view plus a suffix <em>_plural</em>. For example:</p>
<p>Before we had:</p>
<pre name="code" class="ruby">   &lt;% if @reviews_count == 1 %&gt;     &lt;%= t('films.saved_by_friends', :count =&gt; @reviews_count) %&gt;   &lt;% else %&gt;     &lt;%= t('films.saved_by_friends_plural', :count =&gt; @reviews_count) %&gt;   &lt;% end %&gt; </pre>
<p>And now, with this hack:</p>
<pre name="code" class="ruby">   &lt;%= t('films.saved_by_friends', :count =&gt; @reviews_count) %&gt; </pre>
<p>The hack is this (put it where you like more):</p>
<pre name="code" class="ruby"> module I18n    class << self     # Returns true if a given key exists     def exists?(key, options = {})        locale = options.delete(:locale) || I18n.locale       backend.exists?(locale, key, options = {})     end          # Overwrite I18n.trasnlate method     def translate(key, options = {})       locale = options.delete(:locale) || I18n.locale       if options[:count] && options[:count].to_i != 1         plural_key = "#{key}_plural"          if exists?(plural_key)           key = plural_key         end       end       backend.translate(locale, key, options)     rescue I18n::ArgumentError => e       raise e if options[:raise]       send(@@exception_handler, e, locale, key, options)     end   end end  </pre>
<p>The good thing is that if the pluralized key doesn't exists, your views won't be broken, so you can start using it now and change your views when you have time.</p>
</<>]]></content:encoded>
<comments>
http://www.inwebwetrust.net/post/2009/10/03/drying-little-bit-the-translation-of-your-views-with-i18n#comentarios
</comments>
</item>
<item>
<title>Request log analyzer</title>
<link>http://www.inwebwetrust.net/post/2009/09/19/request-log-analyzer</link>
<pubDate>2009-09-19T09:46:26+00:00</pubDate>
<content:encoded><![CDATA[<p>One of my discoveries in the last <a href="http://app.euruko2009.org/">Euruko conference</a> was the project <a href="http://github.com/wvanbergen/request-log-analyzer">request log analyzer</a>, an improved log analyzer for Rails logs (but also merb and the format you decide). Until now we have used <a href="http://seattlerb.rubyforge.org/production_log_analyzer/">production log analyzer</a> from <a href="http://seattlerb.rubyforge.org/">seattlerb boys</a>, which is still a great tool.</p>
<p>The reason for this change is that request log analyzer <a href="http://wiki.github.com/wvanbergen/request-log-analyzer/creating-your-own-file-format-definition">let's you define your own parser</a> which was exactly what we needed to parse logs from two of our applications (<a href="http://iwannagothere.com">iwannagothere</a> and <a href="http://www.partigi.com">partigi.com</a>), because both of them have a mobile version in a different host (the common <code>m.domain</code> host) and we wanted to separate the analysis of these two versions as if they were different applications (they are different, really).</p>
<p>So modify the rails parser was really easy: we only had to change the rails completed line to match the domain of the request:</p>
<pre name="code"> # Completed in 614ms (View: 120, DB: 31) | 200 OK [http://floorplanner.local/demo]</pre>
<p>In this example the domain is <code>floorplanner.local</code>. By default, the regular expression matches the full url: <code>floorplanner.local/demo</code>, but this url is not used in the analysis, so change it didn't supposed a drastic change.</p>
<p>So, we have copied the rails file and modified the rails completed line, with this new regular expression:</p>
<pre name="code" class="ruby"> RAILS_22_COMPLETED = /Completed in (\d+)ms \((?:View: (\d+), )?DB: (\d+)\) \| (\d\d\d).+\[http:\/\/([^\/]+)\/.+\]/</pre>
<p>Now, you have to run request log analyzer indicating the path to your new parser and the parameter <code>--select url m.your_domain</code>. I.e.:</p>
<pre name="code"> /usr/bin/request-log-analyzer /var/www/partigi/shared/log/production.log --file /tmp/log_partigi --format /var/www/partigi/current/vendor/request-log-analyzer/rails_host.rb --select url m.partigi.com</pre>
<p>Easy, isn't it?</p>
]]></content:encoded>
<comments>
http://www.inwebwetrust.net/post/2009/09/19/request-log-analyzer#comentarios
</comments>
</item>
<item>
<title>Conferencia Rails 2009, call for papers</title>
<link>http://www.inwebwetrust.net/post/2009/09/10/conferencia-rails-2009-call-for-papers</link>
<pubDate>2009-09-10T07:50:50+00:00</pubDate>
<content:encoded><![CDATA[<p><img src="http://www.lacoctelera.com/myfiles/inwebwetrust/logo.png?Expires=1281650400&Signature=RJHxb6Jwi7vGiXy-TTB3tRtdaRhwg6QeCyGzb3zJ2kr1sDBveB4PWictHq4qIfe0fYv-CFvhC6FaGckuc48u5afbb-~SprhsFjsFACy~8221cag9ypIrKNpDTFZn4-q7ZtpLL7J5WY5NtpZxkRudVdr~c5dETDDJ2js2zTuQKmA_&Key-Pair-Id=APKAJYN3LZI5CG46B7AA&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cDovL2QzZHM0b3k3ZzF3cnFxLmNsb3VkZnJvbnQubmV0L2lud2Vid2V0cnVzdC9teWZpbGVzL2xvZ28ucG5nIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxMjgxNjUwNDAwfX19XX0_" alt="" class="imgcen" /></p>
<p>It's time again for the Spanish Rails Conference! If you want to give a talk, you can send your proposals <a href="http://app.conferenciarails.org/talks/new">here</a>. This year we want to encourage English people who wanna come with us and give talks (but notice that the most of the talks will be in Spanish).</p>
<p>Remember that this year there will be not only talks, but workshops of about 2 or 4 hours. The schedule is still not decided.</p>
<p>For more information, visit the <a href="http://www.conferenciarails.org/">oficial web</a>.</p>
]]></content:encoded>
<comments>
http://www.inwebwetrust.net/post/2009/09/10/conferencia-rails-2009-call-for-papers#comentarios
</comments>
</item>
<item>
<title>No SQL</title>
<link>http://www.inwebwetrust.net/post/2009/07/04/no-sql</link>
<pubDate>2009-07-04T19:12:05+00:00</pubDate>
<content:encoded><![CDATA[<p>Lately, I have been so curious about <a href="http://www.computerworld.com/action/article.do?command=printArticleBasic&taxonomyName=Databases&articleId=9135086&taxonomyId=173">alternatives to relational databases</a>. Deeping a little bit exist a lot of interest about topics related with it.</p>
<p>The most important that I have found recently is the <a href="http://blog.oskarsson.nu/2009/06/nosql-debrief.html">NoSQL conference</a>, with lot of talks and information about <a href="http://project-voldemort.com/">Voldemort</a>, <a href="http://incubator.apache.org/cassandra/">Cassandra</a>, <a href="http://couchdb.apache.org/">CouchDB</a>, and so on.</p>
<p>You can find some notes about that <a href="http://developer.yahoo.net/blog/archives/2009/06/nosql_meetup.html">here</a>.</p>
<p>I'm still suspicous about all this technologies, specially because it implies a hard change in the way to model and consume data, moreover when SQL and RDMBs are very valid nowadays, and (for sure) they have a big future, but they offer a lot of advantages that you have to know in order to take advantage if you have the chance.</p>
<p><strong>Update:</strong></p>
<p>A great post about this topics: <a href="http://thinkvitamin.com/dev/should-you-go-beyond-relational-databases/">Should you go Beyond Relational Databases?</a></p>
]]></content:encoded>
<comments>
http://www.inwebwetrust.net/post/2009/07/04/no-sql#comentarios
</comments>
</item>
<item>
<title>Modeling entity relationships in a non-relational scenario</title>
<link>http://www.inwebwetrust.net/post/2009/06/27/modeling-entity-relationships-in-non-relational-scenario</link>
<pubDate>2009-06-27T18:22:58+00:00</pubDate>
<content:encoded><![CDATA[<p>Since I saw <a href="http://couchdb.apache.org/index.html">the presentation</a> about <a href="https://github.com/langalex/couch_potato/tree">Couch Potato</a>, a library for using <a href="http://couchdb.apache.org/index.html">CouchDB</a> with your Ruby applications I was very curious about how to map a relational schema (that is the most common way to model entities and their relationship) in a document / plain schema where each element has no relation with the others.</p>
<p>And at last, today I found a <a href="http://code.google.com/appengine/articles/modeling.html">cool post from Google</a> and it's <a href="http://wiki.apache.org/couchdb/EntityRelationship">equivalent for CouchDB</a>.</p>
<p>Now it's time to play with CouchDB!</p>
]]></content:encoded>
<comments>
http://www.inwebwetrust.net/post/2009/06/27/modeling-entity-relationships-in-non-relational-scenario#comentarios
</comments>
</item>
<item>
<title>Forcing I18n locale in a block</title>
<link>http://www.inwebwetrust.net/post/2009/06/11/tricks-for-i18n</link>
<pubDate>2009-06-11T18:32:16+00:00</pubDate>
<content:encoded><![CDATA[<p>If you work in a project with i18n maybe you found useful this small trick for forcing the locale in a block:</p>
<pre name="code" class="ruby"> module I18n    class << self       def in_locale(new_locale, &block)       old_locale = I18n.locale       I18n.locale = new_locale       yield       I18n.locale = old_locale     end   end end </pre>
<p>This is very useful, for example, when you have to send a notification to a user in his locale, not in the current locale, so you have to do it in this way:</p>
<pre name="code" class="ruby">   I18n.in_locale(@user) { UserMailer.deliver_new_comment(...) }  </pre>
<p>Hope it helps.</p>
]]></content:encoded>
<comments>
http://www.inwebwetrust.net/post/2009/06/11/tricks-for-i18n#comentarios
</comments>
</item>
<item>
<title>i18n_gettext</title>
<link>http://www.inwebwetrust.net/post/2009/02/16/i18n_gettext</link>
<pubDate>2009-02-16T07:25:29+00:00</pubDate>
<content:encoded><![CDATA[<p>Two weekends ago we celebrated the first <a href="http://rails-hackathon.org/">Rails Hackathon</a> in Madrid: the idea was to make groups of two or the people, select a ticket from the Rails core, and create a patch for it.</p>
<p><a href="http://www.samlown.com/">Sam Lown</a> and me, decided to work in a plugin for allowing compatibility between <a href="http://www.gnu.org/software/gettext/">GetText</a> and the new <a href="http://rails-i18n.org/">Rails i18n</a> support. The result is our beta plugin <a href="http://github.com/ferblape/i18n_gettext/tree/master">i18n_gettext</a>, which is still in development and we are trying in beta versions of <a href="http://unvlog.com">unvlog.com</a> and <a href="http://www.planetaki.com">planetaki.com</a>.</p>
<p>If you try it, any feedback will be wellcome.</p>
]]></content:encoded>
<comments>
http://www.inwebwetrust.net/post/2009/02/16/i18n_gettext#comentarios
</comments>
</item>
 
</channel>
</rss>
