<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom">
 <title>Miguel Regedor</title>
 
 <link href="http://www.regedor.com/" />
 <updated>2011-07-19T17:52:36-07:00</updated>
 <id>http://www.regedor.com/</id>
 <author>
   <name>Miguel Regedor</name>
   <email>miguel@regedor.com</email>
 </author>
 
 <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/regedor" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="regedor" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
   <title>From Wordpress to GitHub and About.me with Custom Domain</title>
   <link href="http://www.regedor.com/2011/06/wordpress-to-wordpress-and-about-me-custom-domain/" />
   <updated>2011-06-15T00:00:00-07:00</updated>
   <id>http://www.regedor.com/2011/06/wordpress-to-wordpress-and-about-me-custom-domain</id>
   <content type="html">&lt;p&gt;Recently, I moved my writings from Worpress to GitHub.
In addition, I created a profile on "about.me" and I wanted to have everything under the same domain (www.regedor.com).&lt;/p&gt;

&lt;p&gt;The plan was to have the about.me profile as the landing page,
but about.me does not provide a custom domain service.
In fact, they were planing to add it.
Although, because they were acquired by AOL, it isn't sure if that is going to happen anytime soon.&lt;/p&gt;

&lt;p&gt;I could have used a rewrite rule in the htaccess, but either get the redirect without the URL or get the URL with broken links.
Furthermore, I wanted to have the blog posts under the same domain, so this would never work.&lt;/p&gt;

&lt;p&gt;My solution was to host the blog in GitHub
(All GitHub accounts include web hosting and you can add custom domains to it.)
and use the old style framesets to embed the about.me profile,
the only issue with this solution is that it will mess the about.me link source statistics,
obvious the source link will always be your own web site.&lt;/p&gt;

&lt;p&gt;Lots of people asked how I did.
Next, I'll explain the whole process (you should consider www.regedor.com as an example, replace it with your domain):&lt;/p&gt;

&lt;h2&gt;Embeding about.me&lt;/h2&gt;

&lt;p&gt;After creating the repository, in my case regedor.github.com.
Create an index.html file like the one bellow. This is the magic for embedding about.me or any other site into any webpage under any domain.
However, when you're using frames with pages not from the same domain, you will have some limitation, that happens for security reasons.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code class="html"&gt;&lt;span class="lineno"&gt; 1&lt;/span&gt; &lt;span class="cp"&gt;&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//W3C//DTD HTML 4.01 Frameset//EN&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt; 2&lt;/span&gt; &lt;span class="cp"&gt;  &amp;quot;http://www.w3.org/TR/html4/frameset.dtd&amp;quot;&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt; 3&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt; 4&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt; 5&lt;/span&gt;   &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;http-equiv=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;content-type&amp;quot;&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;text/html; charset=utf-8&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt; 6&lt;/span&gt;   &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Personal Web Site&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt; 7&lt;/span&gt;   &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Description&amp;quot;&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Personal Web Site&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; 
&lt;span class="lineno"&gt; 8&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt; 9&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;frameset&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt;10&lt;/span&gt;   &lt;span class="nt"&gt;&amp;lt;frame&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;http://about.me/regedor&amp;quot;&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt;11&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;/frameset&amp;gt;&lt;/span&gt; 
&lt;span class="lineno"&gt;12&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;    
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Then, create a file called CNAME containing your domain, so that GitHub will accept the custom domain, this can be done in the shell:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;echo "www.regedor.com" &amp;gt; CNAME
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You need to add the CNAME record to your DNS (it should redirect www.regedor.com to regedor.github.com).&lt;/p&gt;

&lt;h2&gt;Exporting posts from wordpress:&lt;/h2&gt;

&lt;p&gt;The first step is to download the xml file containing the posts (replace miguelregedor with your wordpress username):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; https://miguelregedor.wordpress.com/wp-admin/export.php
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;At this point I tried to use Jekyll::WordpressDotCom to create the posts.
However, it was a litle bit buggy at the time.
I created a script (based on Jekyll code). After downloading the script,
&lt;a href="https://raw.github.com/regedor/regedor.github.com/master/assets/wordpress_xml.rb"&gt;here&lt;/a&gt;,
you can use it to generate the posts with something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ ruby -r 'wordpress_xml.rb' -e 'WordpressXML.to_posts("wordpress.xml")'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now you have a folder with all your posts.
You just need to add a file that will list the posts:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;code class="html"&gt;&lt;span class="lineno"&gt; 1&lt;/span&gt; ---
&lt;span class="lineno"&gt; 2&lt;/span&gt; layout: default
&lt;span class="lineno"&gt; 3&lt;/span&gt; title: Miguel Regedor
&lt;span class="lineno"&gt; 4&lt;/span&gt; ---
&lt;span class="lineno"&gt; 5&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;home&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt; 6&lt;/span&gt;   &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Writings&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt; 7&lt;/span&gt;   &lt;span class="nt"&gt;&amp;lt;ul&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;posts&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt; 8&lt;/span&gt;     { % for post in site.posts %}
&lt;span class="lineno"&gt; 9&lt;/span&gt;     &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt;10&lt;/span&gt;       &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;{ { post.url }}&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;{ { post.title }}&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;,
&lt;span class="lineno"&gt;11&lt;/span&gt;       &lt;span class="nt"&gt;&amp;lt;span&amp;gt;&lt;/span&gt;{ { post.date | date_to_long_string }}&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt;12&lt;/span&gt;     &lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;span class="lineno"&gt;13&lt;/span&gt;     { % endfor %}
&lt;span class="lineno"&gt;14&lt;/span&gt;   &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt; 
&lt;span class="lineno"&gt;15&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;To have a better understanding of how to organize your files, you can look at my repository.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Contact Day Sonae</title>
   <link href="http://www.regedor.com/2011/03/contact-day-sonae/" />
   <updated>2011-03-11T00:00:00-08:00</updated>
   <id>http://www.regedor.com/2011/03/contact-day-sonae</id>
   <content type="html">More than 11000 university students registered in "Rede Contacto", the social network created by Sonae (Sonae is a retail company, the largest private employer in Portugal). The aim is to start a innovative recruitment process of young graduates with high potential. For months, students are challenged to perform various tasks (online quizzes, questionnaires, etc). That allows the participants to accumulate points that grant access to Dia Contacto (Contact Day).

I was one of the lucky 60 selected students. I was invited to spend a full day getting to know Sonae. I accepted the invitation. What can I say now? It made me have a very positive image of Sonae.

In the morning, they showed us the facilities, the whole team was friendly, and everything seemed well organized. They even provided a free lunch (It was good, not too posh, a quick stand-up buffet). After lunch, we listen to the top officers (Eng. Belmiro, Eng. Paul, Dr. Luís Reis). I really liked their proximity and the stories told. Furthermore, I compliment the emphasis given to the company's values​​, although the talk about it was a bit too long. In my opinion, there is no need to write values on walls. Values are defined through the committed actions.

Also during the afternoon, the students formed teams and played games. The performances of students were being assessed throughout all day. The challenges seemed too simple, for masters degree students with some professional experience. I believe that this day was primarily designed for post-bolonha graduates, a student can now finish a degree with only 19 years, sometimes maturity may call into question. The main element of assessment was the willingness  to be part of Sonae. Anyway, it was an inspiring day for people desirous to start a professional career.

Overall, it was a nice experience. Sonae +1
</content>
 </entry>
 
 <entry>
   <title>Analysing and Measuring Open Source Projects</title>
   <link href="http://www.regedor.com/2011/02/analysing-and-measuring-open-source-projects/" />
   <updated>2011-02-10T00:00:00-08:00</updated>
   <id>http://www.regedor.com/2011/02/analysing-and-measuring-open-source-projects</id>
   <content type="html">Thousands of open source software projects are available for collaboration in platforms like Github or Sourceforge.
However, there is no systematic information about the quality of those projects.

Few users have the ability to assess the quality of a project by looking at source code. 
With that in mind, a system capable of automatically analysing and producing reports about a given Open Source Sofware Project would enable users to make better choices,
and developers to further improve their software. 

Furthermore, I am, currently, writing my master thesis and will engage myself to create an application capable of automatic analyse and measure GitHub public projects.
</content>
 </entry>
 
 <entry>
   <title>Shutdown Timer</title>
   <link href="http://www.regedor.com/2010/06/shutdown-timer/" />
   <updated>2010-06-13T00:00:00-07:00</updated>
   <id>http://www.regedor.com/2010/06/shutdown-timer</id>
   <content type="html">This is a simple tip. Go to the terminal and type:

&lt;code&gt;sudo shutdown -h +45&lt;/code&gt;

After that your system will shut down in 45 minutes.
You can also specify the exact time:

&lt;code&gt;sudo shutdown -h 22:30&lt;/code&gt;

If you want to cancel the shutdown timer you should use the flag "-c":

&lt;code&gt;sudo shutdown -c&lt;/code&gt;

You can also use the flag "-r" or "-s", to reboot or make the system sleep. 
Read &lt;code&gt;man shutdown&lt;/code&gt; for further documentation.
</content>
 </entry>
 
 <entry>
   <title>Create XML schema from XML file</title>
   <link href="http://www.regedor.com/2010/02/create-xml-schema-from-xml-file/" />
   <updated>2010-02-13T00:00:00-08:00</updated>
   <id>http://www.regedor.com/2010/02/create-xml-schema-from-xml-file</id>
   <content type="html">Suppose you want to create a xsd based on an "example.xml" structure.
After download and extract &lt;a href="http://code.google.com/p/jing-trang/downloads/detail?name=trang-20090818.zip"&gt;trang&lt;/a&gt; you can run it with:


&lt;code&gt;java -jar /trang.jar example.xml example.xsd&lt;/code&gt;

The "example.xsd" file generated may not be exactly what you need, but most of the time it is a good starting point.

To validate a xml file, for instance "example.xml", against an xsd file,
"example.xsd", you can use the following command:

&lt;code&gt;xmllint --schema form.xsd ~/form.xml&lt;/code&gt;
</content>
 </entry>
 
 <entry>
   <title>ActionMailler and Gmail (no plugins)</title>
   <link href="http://www.regedor.com/2009/10/actionmailler-and-gmail--no-plugins-/" />
   <updated>2009-10-17T00:00:00-07:00</updated>
   <id>http://www.regedor.com/2009/10/actionmailler-and-gmail--no-plugins-</id>
   <content type="html">Last week I had some problems while trying to configure the ActionMailler with Gmail. I already have some applications in production mode recurring to this system, but this one, using ruby 1.8.7 and rails 2.3.3 gave me some trouble. Gmail requires TLS, older versions of ruby and rails do not support that, the work around was a pluging to enhance it(for example &lt;a href="http://github.com/openrain/action_mailer_tls/tree/master" title="Gmail e ActionMailer"&gt;ActionMailerTLS&lt;/a&gt;). If you are using Ruby 1.8.7 and Rails 2.2.1, or later versions, you don't need any plugin, you only need to follow my instructions.

Add the following lines in your config/enviroments/production.rb
&lt;blockquote&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;config&lt;span style='color:#808030;'&gt;.&lt;/span&gt;action_mailer&lt;span style='color:#808030;'&gt;.&lt;/span&gt;delivery_method &lt;span style='color:#808030;'&gt;=&lt;/span&gt; :smtp
config&lt;span style='color:#808030;'&gt;.&lt;/span&gt;action_mailer&lt;span style='color:#808030;'&gt;.&lt;/span&gt;smtp_settings &lt;span style='color:#808030;'&gt;=&lt;/span&gt; YAML&lt;span style='color:#808030;'&gt;.&lt;/span&gt;&lt;span style='color:#400000;'&gt;load&lt;/span&gt; File&lt;span style='color:#808030;'&gt;.&lt;/span&gt;&lt;span style='color:#400000;'&gt;open&lt;/span&gt;&lt;span style='color:#808030;'&gt;(&lt;/span&gt;&lt;span style='color:#0000e6;'&gt;"#{RAILS_ROOT}/config/mailer.yml"&lt;/span&gt;&lt;span style='color:#808030;'&gt;)&lt;/span&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
And then create the yaml file config/mailer.yml :
&lt;blockquote&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#808030;'&gt;-&lt;/span&gt;&lt;span style='color:#808030;'&gt;-&lt;/span&gt;&lt;span style='color:#808030;'&gt;-&lt;/span&gt; 
  :enable_starttls_auto: &lt;span style='color:#800000;font-weight:bold;'&gt;true&lt;/span&gt; &lt;span style='color:#696969;'&gt;# This is how you tell ActionMailler to use tls&lt;/span&gt;
  :address: smtp&lt;span style='color:#808030;'&gt;.&lt;/span&gt;gmail&lt;span style='color:#808030;'&gt;.&lt;/span&gt;com
  :port: &lt;span style='color:#008c00;'&gt;587&lt;/span&gt;
  :domain: gmail&lt;span style='color:#808030;'&gt;.&lt;/span&gt;com
  :user_name: my_username &lt;span style='color:#696969;'&gt;#You should type your username, you should not include the "@gmail.com".&lt;/span&gt;
  :password: my_password &lt;span style='color:#696969;'&gt;#You should type your password&lt;/span&gt;
  :authentication: :plain
&lt;/pre&gt;&lt;/blockquote&gt;
That's it!

Now take a look in this notifier class example:
&lt;blockquote&gt;&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#800000;font-weight:bold;'&gt;class&lt;/span&gt; Notifier &amp;lt; ActionMailer::Base
  &lt;span style='color:#800000;font-weight:bold;'&gt;def&lt;/span&gt; activation_instructions&lt;span style='color:#808030;'&gt;(&lt;/span&gt;user&lt;span style='color:#808030;'&gt;)&lt;/span&gt;
    @recipients  &lt;span style='color:#808030;'&gt;=&lt;/span&gt; &lt;span style='color:#0000e6;'&gt;"#{user.email}"&lt;/span&gt;
    &lt;span style='color:#696969;'&gt;#@from        = "Miguel &lt;/span&gt;&lt;span style='color:#0000e6;'&gt;&amp;lt;&lt;/span&gt;&lt;span style='color:#7144c4;'&gt;my_username@gmail.com&lt;/span&gt;&lt;span style='color:#0000e6;'&gt;&amp;gt;&lt;/span&gt;&lt;span style='color:#696969;'&gt;" # Doesn't work anymore &lt;/span&gt;
    @from        &lt;span style='color:#808030;'&gt;=&lt;/span&gt; &lt;span style='color:#0000e6;'&gt;"my_username@gmail.com"&lt;/span&gt; 
    @subject     &lt;span style='color:#808030;'&gt;=&lt;/span&gt; &lt;span style='color:#0000e6;'&gt;"[Card-Sorting] "&lt;/span&gt;
    @sent_on     &lt;span style='color:#808030;'&gt;=&lt;/span&gt; Time&lt;span style='color:#808030;'&gt;.&lt;/span&gt;now
    @subject    &lt;span style='color:#808030;'&gt;+&lt;/span&gt;&lt;span style='color:#808030;'&gt;=&lt;/span&gt; &lt;span style='color:#0000e6;'&gt;"Important"&lt;/span&gt; 
    @body&lt;span style='color:#808030;'&gt;[&lt;/span&gt;:user&lt;span style='color:#808030;'&gt;]&lt;/span&gt; &lt;span style='color:#808030;'&gt;=&lt;/span&gt; user
  &lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/blockquote&gt;
There is a lack of backward compatible. Due to some changes in the latest versions you cannot use that syntax anymore, if you are upgrading from old versions be careful, you should only simply specify your email to get it correctly parsed.
</content>
 </entry>
 
 <entry>
   <title>Gato Fedorento - Esmiúça os Sufrágios</title>
   <link href="http://www.regedor.com/2009/09/gato-fedorento-candidatos/" />
   <updated>2009-09-16T00:00:00-07:00</updated>
   <id>http://www.regedor.com/2009/09/gato-fedorento-candidatos</id>
   <content type="html">Apenas uma referencia para quem me pediu os links:
1º Episódio - &lt;a href="http://www.youtube.com/watch?v=dvm2nhd-KtY"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=2fushE58VYw"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=XUZWLCvqCGU"&gt;part3&lt;/a&gt; (José Sócrates)
2º Episódio - &lt;a href="http://www.youtube.com/watch?v=cJsSim2OR2g&amp;amp;feature=related"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=LV3g1YIjHKM&amp;amp;feature=related"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=psQc3gJfOeo&amp;amp;feature=related"&gt;part3&lt;/a&gt; (Manuela Ferreira Leite)
3º Episódio - &lt;a href="http://www.youtube.com/watch?v=kxACTEPkwNQ"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=R3Dr1BYvrA4"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=khgOUZPuQOc"&gt;part3&lt;/a&gt; (Paulo Portas)
4º Episódio - &lt;a href="http://www.youtube.com/watch?v=jbDI6PMsa6s"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=G7n1x163GCk"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=Y-5iVunZCno"&gt;part3&lt;/a&gt; (Francisco Louçã)
5º Episódio - &lt;a href="http://www.youtube.com/watch?v=_Ln0KTuS1zc"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=Aep2XHNFJOw"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=qe4dfSRhKbI"&gt;part3&lt;/a&gt; (Paulo Rangel)
6º Episódio - &lt;a href="http://www.youtube.com/watch?v=tANkJ_bvd3g"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=QYZKMId7kCQ"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=IkCUNJczhFo"&gt;part3&lt;/a&gt; (Jerónimo de Sousa )
7º Episódio - &lt;a href="http://www.youtube.com/watch?v=sbjXI88896o"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=ZeeZiJ3WqV8"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=sQabk1uA3Co"&gt;part3&lt;/a&gt; (Joana Amaral DIas )
8º Episódio - &lt;a href="http://www.youtube.com/watch?v=LfLhuetJ_Mw"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=KmtJeDguvjo"&gt;part2&lt;/a&gt; (Ministro Teixeira dos Santos )
9º Episódio - &lt;a href="http://www.youtube.com/watch?v=rcDwJu0SpKI"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=e3UXjlt68gs"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=3_UfwLwEFeo"&gt;part3&lt;/a&gt; (Maria José Nogueira Pinto )
10º Episódio - &lt;a href="http://www.youtube.com/watch?v=uLNAhzzpWSE"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=0ds6yCklDBQ"&gt;part2&lt;/a&gt; (Garcia Pereira )
11º Episódio - &lt;a href="http://www.youtube.com/watch?v=l9rjxFopwZM"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=E--JOypVeeo"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=-GHsOM6wox8"&gt;part3&lt;/a&gt; (António Costa )
12º Episódio - &lt;a href="http://www.youtube.com/watch?v=qXqGHC7iWd4"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=lGxzc_b9ahM"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=S91ZnK_jGF8"&gt;part3&lt;/a&gt; (Pedro Santana Lopes)
13º Episódio - &lt;a href="http://www.youtube.com/watch?v=xfVo1Hb9cjg"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=s_cxAfw-Iyc"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=RbT1kzvu_7I"&gt;part3&lt;/a&gt; (Rui Rio)
14º Episódio - &lt;a href="http://www.youtube.com/watch?v=-QZyjbge-II"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=DUy0gPMO8ZU"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=UxKE7iqBCFU"&gt;part3&lt;/a&gt; (Luis Filipe Menezes)
15º Episódio - &lt;a href="http://www.youtube.com/watch?v=5yjLcpJ6TmA"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=S-P98RPl6nw"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=CcZTsQ5RNgo"&gt;part3&lt;/a&gt; (Mário Soares)
16º Episódio - &lt;a href="http://www.youtube.com/watch?v=OEeGmCfc3rA"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=FXPphvhsvAk"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=3Ee8MoGOCQU"&gt;part3&lt;/a&gt; (Pedro Passos Coelho)
17º Episódio - &lt;a href="http://www.youtube.com/watch?v=3cEs_Uz0Xl4"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=rygBkMZlkzE"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=PznFX0Ly6aY"&gt;part3&lt;/a&gt; (Elisa Ferreira)
18º Episódio - &lt;a href="http://www.youtube.com/watch?v=zErVsgslshY"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=kUk7EnyQkxM"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=vfvdhlDts7E"&gt;part3&lt;/a&gt; (Marques Mendes)
19º Episódio - &lt;a href="http://www.youtube.com/watch?v=LHu_31cUl14"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=rxEzwdVIVQc"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=x74etsW6GD"&gt;part3&lt;/a&gt; (António Marinho Pinto)
20º Episódio - &lt;a href="http://www.youtube.com/watch?v=beS9VwoZXMU"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=BKZgIdw6REI"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=Vuz1upQDf14"&gt;part3&lt;/a&gt; (Nuno Melo)
21º Episódio - &lt;a href="http://www.youtube.com/watch?v=wsRyvP2W74E"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=9HkbEHvaAbU"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=E5tFKA-Uk0o"&gt;part3&lt;/a&gt; (Jorge Coelho)
22º Episódio - &lt;a href="http://www.youtube.com/watch?v=U24KsFL8c4c"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=TLIdA6ZrWuo"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=qKsiKJaIJs0"&gt;part3&lt;/a&gt; (Francisco Moita Flores)
23º Episódio - &lt;a href="http://www.youtube.com/watch?v=6tU4CXqeCyU"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=m5SAzMZKbv0"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=dCOnm4P5ocg"&gt;part3&lt;/a&gt; (Mário Lino)
24º Episódio - &lt;a href="http://www.youtube.com/watch?v=x9N76z8JTQg"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=nIftjUUvfSU"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=5wZVNn3D080"&gt;part3&lt;/a&gt; (General Ramalho Eanes)
25º Episódio - &lt;a href="http://www.youtube.com/watch?v=seHq61TdFHk"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=VIb19JhI8L0"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=099e6bDEfLs"&gt;part3&lt;/a&gt; (Bernardino Soares)
26º Episódio - &lt;a href="http://www.youtube.com/watch?v=gJzEPXkf1VM"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=3csRlOWnCac"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=oTCX23j5Qto"&gt;part3&lt;/a&gt; (Marcelo Rebelo de Sousa)
27º Episódio - &lt;a href="http://www.youtube.com/watch?v=SXmtjLzsA4M"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=C3xPciQvrak"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=4Ocn6W1kFhQ"&gt;part3&lt;/a&gt; (Francisco Assis, José Pedro Aguiar Branco)
28º Episódio - &lt;a href="http://www.youtube.com/watch?v=G_wTmJRZQgA"&gt;part1&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=QhiJJfpslzQ"&gt;part2&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=EQhHMkRe99s"&gt;part3&lt;/a&gt;, &lt;a href="http://www.youtube.com/watch?v=8PTxqXICKS4"&gt;part4&lt;/a&gt; (José Alberto de Carvalho, Julio Magalhães, Rodrigo Guedes de Carvalho)
 
</content>
 </entry>
 
 <entry>
   <title>My friends twitter updates on Google Reader</title>
   <link href="http://www.regedor.com/2009/07/my-friends-twitter-updates-on-google-reader/" />
   <updated>2009-07-14T00:00:00-07:00</updated>
   <id>http://www.regedor.com/2009/07/my-friends-twitter-updates-on-google-reader</id>
   <content type="html">I was trying to get this working, but Twitter RSS feeds now require authentication, and Google Reader does not support authentication. 
A service called http://freemyfeed.com can strip away the authentication from the feed, and gives you a new RSS feed that you can then supply to Google Reader or IGoogle.
</content>
 </entry>
 
 <entry>
   <title>Change default user shell</title>
   <link href="http://www.regedor.com/2009/06/change-default-user-shell/" />
   <updated>2009-06-28T00:00:00-07:00</updated>
   <id>http://www.regedor.com/2009/06/change-default-user-shell</id>
   <content type="html">Example of how to use chsh command to change current user shell to bash:

&lt;code&gt;chsh -s /bin/bash&lt;/code&gt;

</content>
 </entry>
 
 <entry>
   <title>Git push to remote</title>
   <link href="http://www.regedor.com/2009/05/git-push-to-remote/" />
   <updated>2009-05-01T00:00:00-07:00</updated>
   <id>http://www.regedor.com/2009/05/git-push-to-remote</id>
   <content type="html">Just a note, this is the way to push the current branch to a branch on a remote git repository using ssh trough non default port:
&lt;code&gt;
  git push ssh://remote_user@domain.com:remote_port/~/remote_repository remote_branch
&lt;/code&gt;
</content>
 </entry>
 
 <entry>
   <title>Git diff pacth</title>
   <link href="http://www.regedor.com/2009/04/git-diff-pacth/" />
   <updated>2009-04-28T00:00:00-07:00</updated>
   <id>http://www.regedor.com/2009/04/git-diff-pacth</id>
   <content type="html">How to create a patch with git diff:
&lt;code&gt;
&lt;pre style='color:#000000;background:#ffffff;'&gt;git diff HEAD~&lt;span style='color:#008c00;'&gt;2&lt;/span&gt; &lt;span style='color:#e34adc;'&gt;&amp;gt;&lt;/span&gt; changes&lt;span style='color:#800000;font-weight:bold;'&gt;.&lt;/span&gt;diff&lt;/pre&gt;
&lt;/code&gt;
How to use it:
&lt;code&gt;
&lt;pre style='color:#000000;background:#ffffff;'&gt;patch -Np2 -i changes&lt;span style='color:#800000;font-weight:bold;'&gt;.&lt;/span&gt;diff&lt;/pre&gt;
&lt;/code&gt;

thanks to Andy ;)
</content>
 </entry>
 
 <entry>
   <title>Hash to Object</title>
   <link href="http://www.regedor.com/2009/04/hash-to-object/" />
   <updated>2009-04-01T00:00:00-07:00</updated>
   <id>http://www.regedor.com/2009/04/hash-to-object</id>
   <content type="html">Sometimes I have the need to create objects that responds to some methods with a specific values. 
Something that I can use like 
HashObject.new :method1 =&amp;gt; value_for_method1, :method2 =&amp;gt; value_for_method2
There is already a way to do it, with OpenStruct, but I created a HashObject. Just for academic proposals. I didn't knew the OpenStruct at the time. 
&lt;code&gt;
&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#800000;font-weight:bold;'&gt;class&lt;/span&gt; HashObject
  &lt;span style='color:#800000;font-weight:bold;'&gt;def&lt;/span&gt; initialize&lt;span style='color:#808030;'&gt;(&lt;/span&gt;hash&lt;span style='color:#808030;'&gt;)&lt;/span&gt;
    hash&lt;span style='color:#808030;'&gt;.&lt;/span&gt;&lt;span style='color:#800000;font-weight:bold;'&gt;each&lt;/span&gt; &lt;span style='color:#800000;font-weight:bold;'&gt;do&lt;/span&gt; |k,v|
      &lt;span style='color:#800000;font-weight:bold;'&gt;self&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;instance_variable_set&lt;span style='color:#808030;'&gt;(&lt;/span&gt;&lt;span style='color:#0000e6;'&gt;"@#{k}"&lt;/span&gt;, v&lt;span style='color:#808030;'&gt;)&lt;/span&gt;
      &lt;span style='color:#800000;font-weight:bold;'&gt;self&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;&lt;span style='color:#800000;font-weight:bold;'&gt;class&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;send&lt;span style='color:#808030;'&gt;(&lt;/span&gt;:define_method, k, &lt;span style='color:#400000;'&gt;proc&lt;/span&gt;&lt;span style='color:#800080;'&gt;{&lt;/span&gt;&lt;span style='color:#800000;font-weight:bold;'&gt;self&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;instance_variable_get&lt;span style='color:#808030;'&gt;(&lt;/span&gt;&lt;span style='color:#0000e6;'&gt;"@#{k}"&lt;/span&gt;&lt;span style='color:#808030;'&gt;)&lt;/span&gt;&lt;span style='color:#800080;'&gt;}&lt;/span&gt;&lt;span style='color:#808030;'&gt;)&lt;/span&gt;
      &lt;span style='color:#800000;font-weight:bold;'&gt;self&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;&lt;span style='color:#800000;font-weight:bold;'&gt;class&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;send&lt;span style='color:#808030;'&gt;(&lt;/span&gt;:define_method, &lt;span style='color:#0000e6;'&gt;"#{k}="&lt;/span&gt;, &lt;span style='color:#400000;'&gt;proc&lt;/span&gt;&lt;span style='color:#800080;'&gt;{&lt;/span&gt;|v| &lt;span style='color:#800000;font-weight:bold;'&gt;self&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;instance_variable_set&lt;span style='color:#808030;'&gt;(&lt;/span&gt;&lt;span style='color:#0000e6;'&gt;"@#{k}"&lt;/span&gt;, v&lt;span style='color:#808030;'&gt;)&lt;/span&gt;&lt;span style='color:#800080;'&gt;}&lt;/span&gt;&lt;span style='color:#808030;'&gt;)&lt;/span&gt;
    &lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
  &lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
  
  &lt;span style='color:#800000;font-weight:bold;'&gt;def&lt;/span&gt; to_hash
    hash_to_return &lt;span style='color:#808030;'&gt;=&lt;/span&gt; &lt;span style='color:#800080;'&gt;{&lt;/span&gt;&lt;span style='color:#800080;'&gt;}&lt;/span&gt;
    &lt;span style='color:#800000;font-weight:bold;'&gt;self&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;instance_variables&lt;span style='color:#808030;'&gt;.&lt;/span&gt;&lt;span style='color:#800000;font-weight:bold;'&gt;each&lt;/span&gt; &lt;span style='color:#800000;font-weight:bold;'&gt;do&lt;/span&gt; |var|
      hash_to_return&lt;span style='color:#808030;'&gt;[&lt;/span&gt;var&lt;span style='color:#808030;'&gt;.&lt;/span&gt;&lt;span style='color:#400000;'&gt;gsub&lt;/span&gt;&lt;span style='color:#808030;'&gt;(&lt;/span&gt;&lt;span style='color:#0000e6;'&gt;"@"&lt;/span&gt;,&lt;span style='color:#0000e6;'&gt;""&lt;/span&gt;&lt;span style='color:#808030;'&gt;)&lt;/span&gt;&lt;span style='color:#808030;'&gt;]&lt;/span&gt; &lt;span style='color:#808030;'&gt;=&lt;/span&gt; &lt;span style='color:#800000;font-weight:bold;'&gt;self&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;instance_variable_get&lt;span style='color:#808030;'&gt;(&lt;/span&gt;var&lt;span style='color:#808030;'&gt;)&lt;/span&gt;
    &lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
    &lt;span style='color:#800000;font-weight:bold;'&gt;return&lt;/span&gt; hash_to_return
  &lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/code&gt;
</content>
 </entry>
 
 <entry>
   <title>Object.tot</title>
   <link href="http://www.regedor.com/2009/03/object-tot/" />
   <updated>2009-03-24T00:00:00-07:00</updated>
   <id>http://www.regedor.com/2009/03/object-tot</id>
   <content type="html">I know Rails 2.3 is out and has a new "try" method, But I was looking into an old app and I saw some code I have written. It's extending the object class with a method called tot (that or that lolol) so that you can use it anywhere like in the example:

&lt;pre style='color:#000000;background:#ffffff;'&gt;tot &lt;span style='color:#800000;font-weight:bold;'&gt;do&lt;/span&gt; params&lt;span style='color:#808030;'&gt;[&lt;/span&gt;:search&lt;span style='color:#808030;'&gt;]&lt;/span&gt;&lt;span style='color:#808030;'&gt;[&lt;/span&gt;:name&lt;span style='color:#808030;'&gt;]&lt;/span&gt; &lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;/pre&gt;

or like that
&lt;pre style='color:#000000;background:#ffffff;'&gt;tot&lt;span style='color:#808030;'&gt;(&lt;/span&gt;:also &lt;span style='color:#808030;'&gt;=&lt;/span&gt;&amp;gt; &lt;span style='color:#808030;'&gt;[&lt;/span&gt;&lt;span style='color:#0000e6;'&gt;""&lt;/span&gt;,&lt;span style='color:#0000e6;'&gt;"nome feio"&lt;/span&gt;&lt;span style='color:#808030;'&gt;]&lt;/span&gt;, &lt;span style='color:#800000;font-weight:bold;'&gt;return&lt;/span&gt; &lt;span style='color:#808030;'&gt;=&lt;/span&gt;&amp;gt; &lt;span style='color:#0000e6;'&gt;"nome invalido"&lt;/span&gt;&lt;span style='color:#808030;'&gt;)&lt;/span&gt; &lt;span style='color:#800000;font-weight:bold;'&gt;do&lt;/span&gt; params&lt;span style='color:#808030;'&gt;[&lt;/span&gt;:search&lt;span style='color:#808030;'&gt;]&lt;/span&gt;&lt;span style='color:#808030;'&gt;[&lt;/span&gt;:name&lt;span style='color:#808030;'&gt;]&lt;/span&gt; &lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;/pre&gt;
this last example case will return "nome invalido" in case of params[:search][:name] being empty string, "nome feio", or if a NoMethodError happens", other wise it will return params[:search][:name] value

And that is my code extending object class.
&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#800000;font-weight:bold;'&gt;class&lt;/span&gt; Object
  &lt;span style='color:#800000;font-weight:bold;'&gt;def&lt;/span&gt; tot&lt;span style='color:#808030;'&gt;(&lt;/span&gt;options &lt;span style='color:#808030;'&gt;=&lt;/span&gt; &lt;span style='color:#800080;'&gt;{&lt;/span&gt;&lt;span style='color:#800080;'&gt;}&lt;/span&gt;&lt;span style='color:#808030;'&gt;)&lt;/span&gt;
    &lt;span style='color:#800000;font-weight:bold;'&gt;begin&lt;/span&gt;
      &lt;span style='color:#808030;'&gt;(&lt;/span&gt;options&lt;span style='color:#808030;'&gt;[&lt;/span&gt;:also&lt;span style='color:#808030;'&gt;]&lt;/span&gt; &lt;span style='color:#800000;font-weight:bold;'&gt;and&lt;/span&gt; options&lt;span style='color:#808030;'&gt;[&lt;/span&gt;:also&lt;span style='color:#808030;'&gt;]&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;include?&lt;span style='color:#808030;'&gt;(&lt;/span&gt;&lt;span style='color:#800000;font-weight:bold;'&gt;yield&lt;/span&gt;&lt;span style='color:#808030;'&gt;)&lt;/span&gt;&lt;span style='color:#808030;'&gt;)&lt;/span&gt; ? options&lt;span style='color:#808030;'&gt;[&lt;/span&gt;:&lt;span style='color:#800000;font-weight:bold;'&gt;return&lt;/span&gt;&lt;span style='color:#808030;'&gt;]&lt;/span&gt; : &lt;span style='color:#800000;font-weight:bold;'&gt;yield&lt;/span&gt;
      &lt;span style='color:#800000;font-weight:bold;'&gt;rescue&lt;/span&gt; NoMethodError
      options&lt;span style='color:#808030;'&gt;[&lt;/span&gt;:&lt;span style='color:#800000;font-weight:bold;'&gt;return&lt;/span&gt;&lt;span style='color:#808030;'&gt;]&lt;/span&gt;
    &lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
  &lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;/pre&gt;

I found it funny, anyway Ruby on Rails got it's own try method built in some months later.
</content>
 </entry>
 
 <entry>
   <title>Git clone from remote repositorium with ssh and non default port</title>
   <link href="http://www.regedor.com/2009/03/git-clone-from-remote-repositorium-with-ssh-and-non-default-port/" />
   <updated>2009-03-11T00:00:00-07:00</updated>
   <id>http://www.regedor.com/2009/03/git-clone-from-remote-repositorium-with-ssh-and-non-default-port</id>
   <content type="html">just a reminder, suppose your ssh port is 3022: (sometimes I swap the way to specify the port in those two commands)

&lt;code&gt;
&lt;pre style='color:#000000;background:#ffffff;'&gt;git clone ssh&lt;span style='color:#808030;'&gt;:&lt;/span&gt;&lt;span style='color:#40015a;'&gt;/&lt;/span&gt;&lt;span style='color:#40015a;'&gt;/user&lt;/span&gt;@domain&lt;span style='color:#800000;font-weight:bold;'&gt;.&lt;/span&gt;com&lt;span style='color:#808030;'&gt;:&lt;/span&gt;&lt;span style='color:#008c00;'&gt;3022&lt;/span&gt;&lt;span style='color:#40015a;'&gt;/&lt;/span&gt;~&lt;span style='color:#40015a;'&gt;/Projects/my_project&lt;/span&gt;
&lt;/pre&gt;
&lt;/code&gt;

&lt;code&gt;
&lt;pre style='color:#000000;background:#ffffff;'&gt;ssh user@domain&lt;span style='color:#800000;font-weight:bold;'&gt;.&lt;/span&gt;com &lt;span style='color:#44aadd;'&gt;-p&lt;/span&gt; &lt;span style='color:#008c00;'&gt;3022&lt;/span&gt;
&lt;/pre&gt;
&lt;/code&gt;
(when connecting through ssh the non default port goes as param, the default port is 22)
</content>
 </entry>
 
 <entry>
   <title>Get all values of a single column efficiently</title>
   <link href="http://www.regedor.com/2009/02/get-all-values-of-a-single-column-efficiently/" />
   <updated>2009-02-25T00:00:00-08:00</updated>
   <id>http://www.regedor.com/2009/02/get-all-values-of-a-single-column-efficiently</id>
   <content type="html">Imagine you want this:

&lt;code&gt;
&lt;pre style='color:#000000;background:#ffffff;'&gt;@names &lt;span style='color:#808030;'&gt;=&lt;/span&gt; MyModel&lt;span style='color:#808030;'&gt;.&lt;/span&gt;find&lt;span style='color:#808030;'&gt;(&lt;/span&gt;:all&lt;span style='color:#808030;'&gt;)&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;map&lt;span style='color:#800080;'&gt;{&lt;/span&gt; |i| i&lt;span style='color:#808030;'&gt;.&lt;/span&gt;name &lt;span style='color:#800080;'&gt;}&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;uniq
&lt;/pre&gt;
&lt;/code&gt;

Yes, that works! You get all distinct names of one column, you can even do something like that:

&lt;code&gt;
&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#696969;'&gt;#Using Shortcut Blocks with Symbol to_proc&lt;/span&gt;
@names &lt;span style='color:#808030;'&gt;=&lt;/span&gt; MyModel&lt;span style='color:#808030;'&gt;.&lt;/span&gt;all&lt;span style='color:#808030;'&gt;.&lt;/span&gt;map&lt;span style='color:#808030;'&gt;(&lt;/span&gt;&amp;amp;:name&lt;span style='color:#808030;'&gt;)&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;uniq
&lt;/pre&gt;
&lt;/code&gt;

Cool, rely small code(almost seems I'm using Haskel) but not that efficient if your model's table has lots of columns. (Imagine! The whole table is being loaded to memory) So what is the solution?

&lt;code&gt;
&lt;pre style='color:#000000;background:#ffffff;'&gt;MyModel&lt;span style='color:#808030;'&gt;.&lt;/span&gt;find&lt;span style='color:#808030;'&gt;(&lt;/span&gt; :all, :&lt;span style='color:#400000;'&gt;select&lt;/span&gt; &amp;gt; &lt;span style='color:#0000e6;'&gt;'DISTINCT name'&lt;/span&gt; &lt;span style='color:#808030;'&gt;)&lt;/span&gt;
&lt;/pre&gt;
&lt;/code&gt;

If you specify wich columns you need, in the sql query, you will spare some memory. And in my earlier example you can also pass the "uniq" work to the database.
</content>
 </entry>
 
 <entry>
   <title>will_paginate without losing params</title>
   <link href="http://www.regedor.com/2009/02/will-paginate-without-losing-params/" />
   <updated>2009-02-24T00:00:00-08:00</updated>
   <id>http://www.regedor.com/2009/02/will-paginate-without-losing-params</id>
   <content type="html">I'm sure you like will_paginate, it seams magic! But I was having the issue, that I simply solved like that:

&lt;code&gt;will_paginate(@reports, :params =&amp;gt; params.except(:page))&lt;/code&gt;
</content>
 </entry>
 
 <entry>
   <title>Rewrite humanize</title>
   <link href="http://www.regedor.com/2009/01/rewrite-humanize/" />
   <updated>2009-01-30T00:00:00-08:00</updated>
   <id>http://www.regedor.com/2009/01/rewrite-humanize</id>
   <content type="html">I have an application with all tables and field names in English, but the whole views now need to be in Portuguese.

Because I'm always using the humanize method, a simple solutions should emerge.

First solution:
&lt;code&gt;
&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#800000;font-weight:bold;'&gt;class&lt;/span&gt; Ticket
  HUMANIZED_ATTRIBUTES &lt;span style='color:#808030;'&gt;=&lt;/span&gt; &lt;span style='color:#800080;'&gt;{&lt;/span&gt;
    :category &amp;gt; &lt;span style='color:#0000e6;'&gt;"Categoria"&lt;/span&gt;,
    :title &amp;gt; &lt;span style='color:#0000e6;'&gt;"Assunto"&lt;/span&gt;
  &lt;span style='color:#800080;'&gt;}&lt;/span&gt;
  &lt;span style='color:#800000;font-weight:bold;'&gt;def&lt;/span&gt; self&lt;span style='color:#808030;'&gt;.&lt;/span&gt;human_attribute_name&lt;span style='color:#808030;'&gt;(&lt;/span&gt;attr&lt;span style='color:#808030;'&gt;)&lt;/span&gt;
    HUMANIZED_ATTRIBUTES&lt;span style='color:#808030;'&gt;[&lt;/span&gt;attr&lt;span style='color:#808030;'&gt;.&lt;/span&gt;to_sym&lt;span style='color:#808030;'&gt;]&lt;/span&gt; || &lt;span style='color:#800000;font-weight:bold;'&gt;super&lt;/span&gt;
  &lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/code&gt;
Setting the human_attribue_name in each model works ok,
but if like in my case, you have 20 models and all of them have a description, title,... much duplication...

So I thought in doing something similar to this in my enviroment.rb:
&lt;code&gt;
&lt;pre style='color:#000000;background:#ffffff;'&gt;Inflector&lt;span style='color:#808030;'&gt;.&lt;/span&gt;inflections &lt;span style='color:#800000;font-weight:bold;'&gt;do&lt;/span&gt; |inflect|
  inflect&lt;span style='color:#808030;'&gt;.&lt;/span&gt;plural &lt;span style='color:#808030;'&gt;/&lt;/span&gt;^&lt;span style='color:#808030;'&gt;(&lt;/span&gt;foo&lt;span style='color:#808030;'&gt;)&lt;/span&gt;$&lt;span style='color:#808030;'&gt;/&lt;/span&gt;i, &lt;span style='color:#0000e6;'&gt;'\1ze'&lt;/span&gt;
  inflect&lt;span style='color:#808030;'&gt;.&lt;/span&gt;singular &lt;span style='color:#808030;'&gt;/&lt;/span&gt;^&lt;span style='color:#808030;'&gt;(&lt;/span&gt;foo&lt;span style='color:#808030;'&gt;)&lt;/span&gt;ze&lt;span style='color:#808030;'&gt;/&lt;/span&gt;i, &lt;span style='color:#0000e6;'&gt;'\1'&lt;/span&gt;
&lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;/pre&gt;
 &lt;/code&gt;
But for the humanized method instead of pluralize. Yah It would make sense that way, but rails doesn't provide that feature. You can go &lt;a href="http://github.com/rails/rails/commit/4f75840d72b96fff34d65b59480da7d6c7494120#diff-1"&gt;here&lt;/a&gt; to find a patch for getting that functionality into your rails, I hope they get that into the core... anyway If didn't want to download the patch, how do I solve the problem?

Maybe a rubbish solution but perfect to get what I was needing, translate my views with few lines of code!
What I've done? Just added those lines into my environment.rb
&lt;code&gt;
&lt;pre style='color:#000000;background:#ffffff;'&gt;&lt;span style='color:#800000;font-weight:bold;'&gt;class&lt;/span&gt; &lt;span style='color:#400000;'&gt;String&lt;/span&gt;
  &lt;span style='color:#800000;font-weight:bold;'&gt;def&lt;/span&gt; humanize
    &lt;span style='color:#800080;'&gt;{&lt;/span&gt;:movie              &lt;span style='color:#808030;'&gt;=&lt;/span&gt;&amp;gt; &lt;span style='color:#0000e6;'&gt;"Filme"&lt;/span&gt;,
     :movies             &lt;span style='color:#808030;'&gt;=&lt;/span&gt;&amp;gt; &lt;span style='color:#0000e6;'&gt;"Filmes"&lt;/span&gt;,
     :name               &lt;span style='color:#808030;'&gt;=&lt;/span&gt;&amp;gt; &lt;span style='color:#0000e6;'&gt;"Nome"&lt;/span&gt;,
     :title              &lt;span style='color:#808030;'&gt;=&lt;/span&gt;&amp;gt; &lt;span style='color:#0000e6;'&gt;"Título"&lt;/span&gt;,
     :synopsis           &lt;span style='color:#808030;'&gt;=&lt;/span&gt;&amp;gt; &lt;span style='color:#0000e6;'&gt;"Sinopse"&lt;/span&gt;,
     :genre              &lt;span style='color:#808030;'&gt;=&lt;/span&gt;&amp;gt; &lt;span style='color:#0000e6;'&gt;"Genero"&lt;/span&gt;,
     :author             &lt;span style='color:#808030;'&gt;=&lt;/span&gt;&amp;gt; &lt;span style='color:#0000e6;'&gt;"Autor"&lt;/span&gt;,
     :authors            &lt;span style='color:#808030;'&gt;=&lt;/span&gt;&amp;gt; &lt;span style='color:#0000e6;'&gt;"Autores"&lt;/span&gt;
     &lt;span style='color:#808030;'&gt;.&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;
    &lt;span style='color:#800080;'&gt;}&lt;/span&gt;&lt;span style='color:#808030;'&gt;[&lt;/span&gt;&lt;span style='color:#800000;font-weight:bold;'&gt;self&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;&lt;span style='color:#400000;'&gt;gsub&lt;/span&gt;&lt;span style='color:#808030;'&gt;(&lt;/span&gt;&lt;span style='color:#808030;'&gt;/&lt;/span&gt;_id$&lt;span style='color:#808030;'&gt;/&lt;/span&gt;, &lt;span style='color:#0000e6;'&gt;""&lt;/span&gt;&lt;span style='color:#808030;'&gt;)&lt;/span&gt;&lt;span style='color:#808030;'&gt;.&lt;/span&gt;to_sym&lt;span style='color:#808030;'&gt;]&lt;/span&gt; || &lt;span style='color:#800000;font-weight:bold;'&gt;super&lt;/span&gt;
  &lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;span style='color:#800000;font-weight:bold;'&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/code&gt;
I simply redefined the humanize method for whole strings. It works perfectly in my case, because I'm always calling humanize in my views.

keep humanizing the world!
</content>
 </entry>
 
 <entry>
   <title>Ruby on Rails no Ubuntu</title>
   <link href="http://www.regedor.com/2009/01/ruby-on-rails-no-ubuntu/" />
   <updated>2009-01-24T00:00:00-08:00</updated>
   <id>http://www.regedor.com/2009/01/ruby-on-rails-no-ubuntu</id>
   <content type="html">As seguintes instruções demonstram como instalar o framework ruby on rails. Os comandos abaixo listados, foram por mim executadas exactamente após a instalação do Ubuntu 8.10.

Não deve ser necessário editar os repositórios. Mas fica o comando apenas para referencia.
&lt;code&gt;
sudo vim /etc/apt/sources.list
&lt;/code&gt;

Pode pensar que full-upgrade inclui o safe-upgrade, mas é mentira são comandos diferentes. Portanto aconselho a intoduzir os dois pela seguinte ordem:
&lt;code&gt;
sudo aptitude safe-upgrade
sudo aptitude full-upgrade
&lt;/code&gt;

Nesta fase é responder Yes a todas as perguntas!
&lt;code&gt;
sudo aptitude install build-essential
&lt;/code&gt;

(Como disse estou a descrever os passos exactos que executei após a instalação do SO)
Agora sim vamos ao importante:
&lt;code&gt;
sudo aptitude install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby sqlite3 libsqlite3-ruby1.8
&lt;/code&gt;

Criar alguns symlinks:
&lt;code&gt;
sudo ln -s /usr/bin/ruby1.8 /usr/bin/ruby
sudo ln -s /usr/bin/ri1.8 /usr/bin/ri
sudo ln -s /usr/bin/rdoc1.8 /usr/bin/rdoc
sudo ln -s /usr/bin/irb1.8 /usr/bin/irb
&lt;/code&gt;

Agora vamos instalar o rubygems que nos oferece o comando gem, uma espécie de aptitude para o ruby.
Deve verificar qual a ultima versão de rubygems(http://rubyforge.org/projects/rubygems/), no caso de existir uma versão mais recente, substituir no comando em baixo.
&lt;code&gt;
wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar xzvf rubygems-1.3.1.tgz
cd  rubygems-1.3.1
sudo ruby setup.rb
&lt;/code&gt;

Criar symlink e garantir que temos o rubygems actualizado
&lt;code&gt;
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
sudo gem update
sudo gem update --system
&lt;/code&gt;

E finalmente instalar o Ruby on Rails.
&lt;code&gt;
sudo gem install rails
&lt;/code&gt;

Confirmar que tudo correu bem.
&lt;code&gt;sudo gem list&lt;/code&gt;
Devemos obter uma lista deste genero:
&lt;code&gt;*** LOCAL GEMS ***&lt;/code&gt;

actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.2.2)
rails (2.2.2)
rake (0.8.3)

Verificar a operabilidade do sistema de base de dados sqlite:
&lt;code&gt;
irb
.......
irb(main):001:0&amp;gt; require 'sqlite3'
=&amp;gt; true
irb(main):002:0&amp;gt; exit
&lt;/code&gt;

Para criar o primeiro projecto:
&lt;code&gt;
rails nome_do_meu_projecto
&lt;/code&gt;

Já agora instalar o rmagick possivelmente tambem será util para a maioria dos projectos.
&lt;code&gt;
  sudo aptitude install imagemagick
  sudo aptitude install libmagick9-dev
  sudo gem install rmagick
&lt;/code&gt;

Agora é só por mãos a obra... e talvez arranjar um bom editor. Aconselho o textmate ou o vim, descreverei em breve como configurar e instalar alguns plugins para rails, no caso de escolher o vim.
</content>
 </entry>
 
 <entry>
   <title>How to Install Skype (Ubuntu)</title>
   <link href="http://www.regedor.com/2009/01/how-to-install-skype--ubuntu-/" />
   <updated>2009-01-23T00:00:00-08:00</updated>
   <id>http://www.regedor.com/2009/01/how-to-install-skype--ubuntu-</id>
   <content type="html">Easy as it is. Just add the repository into your rep. list, update the package information and install Skype.

Open your list:
&lt;blockquote&gt;&lt;code&gt;sudo vim /etc/apt/sources.list&lt;/code&gt;&lt;/blockquote&gt;

Add this line at the end:
&lt;blockquote&gt;&lt;code&gt;deb http://download.skype.com/linux/repos/debian/ stable non-free&lt;/code&gt;&lt;/blockquote&gt;

Update:
&lt;blockquote&gt;&lt;code&gt;sudo aptitude update&lt;/code&gt;&lt;/blockquote&gt;

Install skype, answer yes to all question(but think for your self!)
&lt;blockquote&gt;&lt;code&gt;sudo aptitude install skype&lt;/code&gt;&lt;/blockquote&gt;

If you have some problems with audio(like I had) try this lines:
&lt;blockquote&gt;&lt;code&gt;
killall pulseaudio
sudo aptitude remove pulseaudio
sudo aptitude install esound
sudo rm /etc/X11/Xsession.d/70pulseaudio
&lt;/code&gt;&lt;/blockquote&gt;

(I'm using Ubuntu 8.10, but also works with Ubuntu 9.10)
</content>
 </entry>
 
 <entry>
   <title>Awareness Test</title>
   <link href="http://www.regedor.com/2009/01/awareness-test/" />
   <updated>2009-01-09T00:00:00-08:00</updated>
   <id>http://www.regedor.com/2009/01/awareness-test</id>
   <content type="html">[youtube=http://www.youtube.com/watch?v=2cd63P54PaI]

Go here http://www.dothetest.co.uk/ to see the first one and some others!
</content>
 </entry>
 
 <entry>
   <title>PayPal Payments Standard, Subscriptions and IPN with Ruby on Rails.</title>
   <link href="http://www.regedor.com/2008/12/paypal-payments-standard--subscriptions-and-ipn-with-ruby-on-rails-/" />
   <updated>2008-12-05T00:00:00-08:00</updated>
   <id>http://www.regedor.com/2008/12/paypal-payments-standard--subscriptions-and-ipn-with-ruby-on-rails-</id>
   <content type="html">&lt;div&gt;Hi there!&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;I spend the last week struggling with PayPal documentations and with their buggy sandbox. The information is not well organized, and you can spend hours jumping between pages and pdf to find out what you want, I'm sure they like treasure hunt   games, I remember to following  10 steps, described on a pdf,  to download a sample code, (you should click this link, and now try to find a small square in the middle of the page, press it  and then you should close your eyes for about... crazy weirdoes) anyway... my goal was to implement a subscription system for &lt;a title="laurelandhardyarchive" href="http://www.laurelandhardyarchive.com/"&gt;laurelandhardyarchive&lt;/a&gt;, and of course because is subscriptions, with PayPal at UK, with IPN, and using rails, everything seems to be a little more difficult (only at the beginning ;)), PayPal doesn’t provide any ruby samples, and there is a good plugin Active Merchant, but again because it's subscription, the documentations also fails(not only for subscriptions, the whole Active Merchant  has a lack of documentation). With that scenario I figure out the best way to solve the problem was to build my own gem to deal with that, the gem should be finished soon, but anyway I leave you a small brief of what is needed to accomplish this, and I leave you some links, so that way you don’t need to a treasure hunt throw PayPal web site.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;So... do you need to integrate PayPal subscriptions and IPN into your web site?&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;For starting you should register into &lt;a title="paypal developer page" href="https://developer.paypal.com/" target="_blank"&gt;developer PayPal&lt;/a&gt; then you should create two sandbox PayPal  accounts to do your tests (you can use the preconfigured account button for those, but be aware to chose country US even if you are in UK, because you will have troubles to activate the test account, but don’t worry you real account should not have any problems based in the country),  one of the account should be busyness type and the other personal type account, you will use them  to simulate the seller and buyer roles, don't forget to start the personal account (the buyers one) with some money(fake money) you can do that while creating it, click the advanced otptions drop down.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;So right now you can use your business account to create code for subscription buttons. For doing that you should access PayPal sandbox, in the developers page (when listing the accounts) you have a link for that. PayPal sandbox is a complete copy of the original PayPal web site, and all test accounts can interact in this closed world.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;This is all for now. I'll try to post some code latter. In any case if you're trying to achive something similar and having some difficulties, leave me a message, if have the knowledge to I be glade to help.&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>VIM for beginners</title>
   <link href="http://www.regedor.com/2007/12/vim-for-beginners/" />
   <updated>2007-12-05T00:00:00-08:00</updated>
   <id>http://www.regedor.com/2007/12/vim-for-beginners</id>
   <content type="html">&lt;p&gt;The first time I saw vi text editor was when I reached university. At the time, it seemed a little bit counterintuitive .
I think it is a normal feeling to new vi users, even more, if you are, like I was, used to Windows and GUIs but make no mistake,
there is a good reason for this 30-year old tool still be widely used by many of the best developers in the world.
A few days ago, I was programming some rails application, while doing some changes to a few files,
I realized that I wasn't taking full advantage of vim,
I couldn't do what I normally saw my teachers doing, like !indenting! a text with few keyboard shortcuts.
I spend some hours reading the vim help and realized how fantastic vim is!
Now if you wanna try vi I will give some little tips, like a mini tutorial for vi/vim beginners.&lt;/p&gt;

&lt;p&gt;For showing you the shortcuts I’ll use a similar notation to the used on vim help.
&lt;code&gt;&amp;lt;ESC&amp;gt;&amp;lt;CTRL-v&amp;gt;5jI&lt;/code&gt;
This means you press ESC key then you press Ctrl and “v” key simultaneous then you press the number 5 followed by the “j” key and finally you press “I”.
I think you get the idea. If you can’t, vim isn’t for you!&lt;/p&gt;

&lt;p&gt;First, Vim has something similar to a command line,
when you press &lt;code&gt;&amp;lt;ESC&amp;gt;:&lt;/code&gt; you will start writing commands at the bottom of the screen for example, :q is for quitting the program.
Of course when I say something started with “:” like “:q” I’m expecting you to write that on the command line, not in your text,
so if you are in insert mode you have to do something like this &lt;code&gt;&amp;lt;ESC&amp;gt;:q&amp;lt;ENTER&amp;gt;&lt;/code&gt;
Well... now when talked about insert mode I introduced one more thing; the vi working modes!
When using vim, you can switch between different working modes, for example to insert text you should be on INSERT MODE,
when selecting text you are on SELECTION MODE, you have also REPLACE MODE, VISUAL MODE, and more.
Those operating modes give you ultrafast access to key commands that can edit, insert, and move text on-the-fly.&lt;/p&gt;

&lt;p&gt;Here are some examples of commands:&lt;/p&gt;

&lt;p&gt;Calling VIM:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Vi                 Open vim with no file.
vi PATH            Open PATH file with vim, if the file doesn’t exist create it.
vi PATH +          Open the PATH file and focus cursor at end of file.
vi PATH +10        Open file at line 10.
vi PATH +/regedor  Open file with courser at the first occurrence of  the word “regedor”
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Saving/Quitting VIM:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;:w                 Save
:q                 Exit without saving
:wq or : x or ZZ   Exit and save
:w!                Force Save
:q!                Force Quit
:wq!               Force Save and Quit
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Well this is good for beginners. For now I don’t have more time, I will set up a more complex tutorial with a few more advanced commands soon.&lt;/p&gt;
</content>
 </entry>
 
</feed>

