<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>srejbi.info</title>
    <link>http://srejbi.info/</link>
    <description>srejbi.info -- a test blog for the yaqrb project, as well as the personal blog of George Schreiber, computer enthusiast, software engineer</description>
    <language>en-us</language>
    <item>
      <title>Arduino &amp; printf/scanf &amp; floats</title>
      <description>&lt;p&gt;So, you want to use floats and scanf/printf in your &lt;a href=&quot;http://arduino.cc&quot;&gt;Arduino&lt;/a&gt; &lt;sup&gt;TM&lt;/sup&gt; project, but getting &amp;#8216;?&amp;#8217;-s when printing and 0&amp;#8217;s when scanning?&lt;/p&gt;
&lt;p&gt;The solution is to provide the &lt;span class=&quot;caps&quot;&gt;AVR&lt;/span&gt; linker (avr-gcc) options that will instruct the linker to link against libprintf_flt.a and libscanf_flt.a (the files can be found under &lt;em&gt;&amp;#8216;&lt;arduino-root&gt;/hardware/tools/avr/avr/lib/&amp;#8217;&lt;/em&gt; and the &lt;span class=&quot;caps&quot;&gt;MCU&lt;/span&gt;-respective subdirectories, if applicable). According to the sample makefile provided with the &lt;span class=&quot;caps&quot;&gt;AVR&lt;/span&gt; toolchain (&lt;em&gt;&lt;arduino-root&gt;/hardware/tools/avr/sample/Makefile&lt;/em&gt;), the linker options should be &lt;em&gt;-Wl,-u,vfscanf -lscanf_flt&lt;/em&gt; for float enabled scanf and &lt;em&gt;-Wl,-u,vfprintf -lprintf_flt&lt;/em&gt; for the float-enabled printf.&lt;/p&gt;
&lt;p&gt;The challenge is that Arduino &lt;sup&gt;TM&lt;/sup&gt; &lt;span class=&quot;caps&quot;&gt;IDE&lt;/span&gt; has the &lt;span class=&quot;caps&quot;&gt;AVR&lt;/span&gt; toolchain options hardcoded, therefore by default there is no way of changing what options we want to pass to the linker. So it will link to the minimal versions&amp;#8230;&lt;/p&gt;
&lt;p&gt;The options:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;run the &lt;span class=&quot;caps&quot;&gt;AVR&lt;/span&gt; toolchain manually from the shell, then use avrdude to upload&amp;#8230; &lt;em&gt;sounds like a painful option&amp;#8230; ;-) personally I am too lazy for doing that (knowing I&amp;#8217;d have to do it a 100 times later on&amp;#8230;)&lt;/em&gt;&lt;/li&gt;
	&lt;li&gt;build a patched version of Arduino &lt;sup&gt;TM&lt;/sup&gt; &lt;span class=&quot;caps&quot;&gt;IDE&lt;/span&gt; that allows you to tweak the linker options &lt;em&gt;this is one of the options I tested with success, Arduino-1.0&lt;/em&gt;&lt;/li&gt;
	&lt;li&gt;set up Eclipse with either the &lt;a href=&quot;http://www.baeyens.it/eclipse/&quot;&gt;Arduino plugin&lt;/a&gt; or &lt;a href=&quot;http://avr-eclipse.sourceforge.net/wiki/index.php/The_AVR_Eclipse_Plugin&quot;&gt;&lt;span class=&quot;caps&quot;&gt;AVR&lt;/span&gt; plugin&lt;/a&gt; (&lt;em&gt;successfully tested with the Arduino plugin, v.1.2.0 &amp;amp; Arduino-1.0&lt;/em&gt;)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In this article option 2) is described. Briefly:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;check out the &amp;#8220;Building Arduino&amp;#8221; &lt;sup&gt;TM&lt;/sup&gt;:http://code.google.com/p/arduino/wiki/BuildingArduino tutorial that describes how to set up the environment for building Arduino (Eclipse, Ant, &lt;span class=&quot;caps&quot;&gt;AVR&lt;/span&gt; toolchain, &lt;em&gt;Arduino source code&lt;/em&gt;)&lt;/li&gt;
	&lt;li&gt;pull the Arduino sources from &lt;a href=&quot;http://github.com/srejbi/Arduino.git&quot;&gt;my fork of Arduino-1.0&lt;/a&gt; or, if pulled the official branch, patch with &lt;a href=&quot;https://github.com/srejbi/Arduino/commit/f53db6aab6b461975a3682c19b6d5d6f329defaa&quot;&gt;this patch&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;run ant to build your Arduino&lt;/li&gt;
	&lt;li&gt;edit your preferences.txt file (be nice, edit the user specific settings, not the default one!)&lt;br /&gt;
options to be added to the preferences.txt:&lt;br /&gt;
&amp;gt; build.linker_options=-Wl,-u,vfprintf,-u,vfscanf,&amp;#8212;gc-sections&lt;br /&gt;
&amp;gt; build.linker_additional_options=-lprintf_flt -lscanf_flt -lm&lt;/li&gt;
	&lt;li&gt;run your newly built Arduino from the &amp;#8220;&lt;Arduino sources root&gt;/build/&lt;platform&gt;/work/&amp;#8221; directory&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;
/*
  lprintfscanf_test sketch
  by George Schreiber
  2012.03.26.

  this sketch does nothing but verifies if the binary has been linked with the float-capable versions
  of printf and scanf.

  to link these libraries, a patched version of Arduino IDE (or other options to tweak with the AVR linker options)
  is necessary. 
  
  to go with a patched version of Arduino(TM)-1.0, download and build sources from http://github.com/srejbi/Arduino.git 
  
  then add to the user's Arduino preferences.txt:
    build.linker_options=-Wl,-u,vfprintf,-u,vfscanf,--gc-sections
    build.linker_additional_options=-lprintf_flt -lscanf_flt -lm

  re-compile, upload and enjoy!
*/


boolean testprintf();    // test function for printf
boolean testscanf();     // test function for scanf
void printscan();        // a dummy function that relies on the float-enabled versions of printf/scanf

void setup(void) {
  Serial.begin(57600);
  Serial.println(&quot;printf/scanf linking tester&quot;);
  if (testprintf() &amp;amp;&amp;amp; testscanf()) printscan();
}

void loop(void) {
    // we're done already.
}

// checks printf float behaviour with known value
boolean testprintf()  {
  float ftest = 0;
 
  char sztest[10] =&quot;&quot;;
  sprintf(sztest,&quot;%.4f&quot;, 2012.0326);        // print 2012.0326 to string
  Serial.print(sztest);
  Serial.print(&quot; - version of printf linked: &quot;);  
  if (sztest[0] == '?') {                                // minimal version
    Serial.println(&quot;minimal&quot;);
  } else if (strstr(sztest,&quot;2012.0326&quot;)==sztest) {       // if float conversion was ok
    Serial.println(&quot;float-capable&quot;);
    return true;
  } else {                                               // something unexpected happened...
    Serial.println(&quot;wtf?&quot;);
  }
  return false;
}

// checks sscanf float behaviour with known value
boolean testscanf()  {
  float ftest = 0;
  
  sscanf(&quot;2012.0326&quot;,&quot;%f&quot;, &amp;amp;ftest);          // scan 2012.0326 from string
  Serial.print(ftest,4);
  Serial.print(&quot; - version of scanf linked:&quot;);  
  if (ftest == 0) {                          // if no value, we have minimal version
    Serial.println(&quot;minimal&quot;);
  } else if (ftest == 2012.0326 ) {          // if the value matches, we're good
    Serial.println(&quot;float-capable&quot;);
    return true;
  } else {                                   // expecting the unexpected
    Serial.println(&quot;wtf?&quot;);
  }
  return false;
}

// happy to print what it scans :)
void printscan() {
  char szbuf[10];
  float tfloat = 0;
  sscanf(&quot;2012.0326&quot;,&quot;%f&quot;,&amp;amp;tfloat);
  sprintf(szbuf,&quot;%.4f&quot;,tfloat);
  Serial.print(&quot;Oh happy day:&quot;);
  Serial.println(szbuf);
}

&lt;/pre&gt;
&lt;p&gt;If you followed the steps carefully, all should compile fine and upon checking your serial terminal to the Arduino, you should see:&lt;/p&gt;
&lt;pre&gt;
printf/scanf linking tester
2012.0326 - version of printf linked: float-capable
2012.0325 - version of scanf linked:float-capable
Oh happy day:2012.0326
&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;That actually reveals some bug in the Arduino Serial library and float conversion (notice the difference at the 10 &lt;sup&gt;-4&lt;/sup&gt; precision), but, as per the last debug message, no worry, the float itself is keeping the proper value and is printed out perfectly by the &lt;span class=&quot;caps&quot;&gt;AVR&lt;/span&gt; libraries. One more reason to use them&amp;#8230;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Good luck and enjoy!&lt;/p&gt;</description>
      <author>srejbi</author>
      <pubDate>Mon, 26 Mar 2012 16:32:48 +0000</pubDate>
      <link>http://srejbi.info/posts/16_arduino-printf-scanf-floats</link>
      <guid>http://srejbi.info/posts/16_arduino-printf-scanf-floats</guid>
    </item>
    <item>
      <title>clear_helpers is your new friend...</title>
      <description>&lt;p&gt;The dog is buried in ActionController::Base (the parent class of your ApplicationController class).&lt;br /&gt;
in  The reason for this lies in In Rails 3:actionpack/actioncontroller/base.rb (around line 224)&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
&lt;code class=&quot;Ruby&quot;&gt;
    def self.inherited(klass)
      super
      klass.helper :all if klass.superclass == ActionController::Base
    end
&lt;/code&gt;&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Since you usually derive your ApplicationController from ActionController::Base, all helpers will be included by default.&lt;/p&gt;
&lt;p&gt;To come around this, call &amp;#8216;&lt;strong&gt;clear_helpers&lt;/strong&gt;&amp;#8217; (AbstractClass::Helpers; included in ActionController::Base) at the beginning of your controller&amp;#8217;s code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;clear_helpers&lt;/strong&gt; clears up all existing helpers in this class, only keeping the helper with the same name as this class.&lt;/p&gt;
&lt;p&gt;Eg.:&lt;/p&gt;
&lt;pre&gt;
&lt;code class=&quot;Ruby&quot;&gt;
class ApplicationController &amp;lt; ActionController::Base
  clear_helpers
  ...
  # your existing code
  ...
end
&lt;/code&gt;
&lt;/pre&gt;</description>
      <author>srejbi</author>
      <pubDate>Wed, 17 Nov 2010 14:14:17 +0000</pubDate>
      <link>http://srejbi.info/posts/11_clear_helpers-is-your-new-friend</link>
      <guid>http://srejbi.info/posts/11_clear_helpers-is-your-new-friend</guid>
    </item>
    <item>
      <title>automatic mounting broken (again) in Ubuntu 10.04 - Lucid Lynx</title>
      <description>&lt;p&gt;When seeing this message, I was wondering how this can come back again, as I have fixed it a long while ago by editing the &lt;strong&gt;/usr/share/polkit-1/actions/org.freedesktop.devicekit.disks.policy&lt;/strong&gt; file (in Karmic Koala) allowing any user &amp;#8212; not just the active ones &amp;#8212; to mount usb harddrives. But, this file was gone&amp;#8230; :(&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;#8230;if not interested in the intermezzos, just the fix, scroll to the end&amp;#8230; :)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;However, discovered a new &amp;#8220;suspicious&amp;#8221; file in the same directory: &lt;strong&gt;/usr/share/polkit-1/actions/org.freedesktop.udisks.policy&lt;/strong&gt;. I opened it with great hopes, and was not disappointed, right at the beginning was this section:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
&lt;code class=&quot;xml&quot;&gt;
  &amp;lt;action id=&quot;org.freedesktop.udisks.filesystem-mount&quot;&amp;gt;
    &amp;lt;description&amp;gt;Mount a device&amp;lt;/description&amp;gt;
    &amp;lt;description xml:lang=&quot;da&quot;&amp;gt;Mont&#233;r en enhed&amp;lt;/description&amp;gt;
    &amp;lt;description xml:lang=&quot;de&quot;&amp;gt;Ger&#228;t einh&#228;ngen&amp;lt;/description&amp;gt;
    &amp;lt;message&amp;gt;Authentication is required to mount the device&amp;lt;/message&amp;gt;
    &amp;lt;message xml:lang=&quot;da&quot;&amp;gt;Autorisering er p&#229;kr&#230;vet for at montere et fil system&amp;lt;/message&amp;gt;
    &amp;lt;message xml:lang=&quot;de&quot;&amp;gt;Zugriffsrechte werden ben&#246;tigt um das Ger&#228;t einzuh&#228;ngen&amp;lt;/message&amp;gt;
    &amp;lt;defaults&amp;gt;
      &amp;lt;allow_any&amp;gt;no&amp;lt;/allow_any&amp;gt;
      &amp;lt;allow_inactive&amp;gt;no&amp;lt;/allow_inactive&amp;gt;
      &amp;lt;allow_active&amp;gt;yes&amp;lt;/allow_active&amp;gt;
    &amp;lt; /defaults&amp;gt;
  &amp;lt; /action&amp;gt;
&lt;/code&gt;&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;thought that I simply switch the following values, and that will be it:&lt;/p&gt;
&lt;pre&gt;
&lt;code class=&quot;xml&quot;&gt;
      &amp;lt;allow_any&amp;gt;yes&amp;lt;/allow_any&amp;gt;
      &amp;lt;allow_inactive&amp;gt;yes&amp;lt;/allow_inactive&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;well, doing it (and restarting policykit) was a disappointment, I still had these &amp;#8220;Not Authorized&amp;#8221; messages when plugging my external &lt;span class=&quot;caps&quot;&gt;HDD&lt;/span&gt; in (or trying to mount it with Nautilus in my &lt;span class=&quot;caps&quot;&gt;VNC&lt;/span&gt; session)&amp;#8230;&lt;/p&gt;
&lt;p&gt;Anyway, after some time googling I found nothing but some people complaining about the same thing&amp;#8230; I tried reinstalling &lt;strong&gt;policykit&lt;/strong&gt;, &lt;strong&gt;policykit-gnome&lt;/strong&gt;, &lt;strong&gt;policykit-desktop-privileges&lt;/strong&gt;, &lt;strong&gt;policykit-1&lt;/strong&gt;, etc. no use.&lt;/p&gt;
&lt;p&gt;Finally, this pointed me in the right direction:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;locate policykit&lt;/strong&gt;&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
&amp;#8230;&lt;br /&gt;
/var/lib/dpkg/info/policykit-1.list&lt;br /&gt;
/var/lib/dpkg/info/policykit-1.md5sums&lt;br /&gt;
/var/lib/dpkg/info/policykit-1.postinst&lt;br /&gt;
/var/lib/dpkg/info/policykit-desktop-privileges.list&lt;br /&gt;
/var/lib/dpkg/info/policykit-desktop-privileges.md5sums&lt;br /&gt;
/var/lib/dpkg/info/policykit-gnome.list&lt;br /&gt;
/var/lib/dpkg/info/policykit-gnome.md5sums&lt;br /&gt;
&amp;#8230;&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;let&amp;#8217;s see what the desktop privileges package installs:&lt;br /&gt;
&lt;strong&gt;cat /var/lib/dpkg/info/policykit-desktop-privileges.list&lt;/strong&gt;&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
/.&lt;br /&gt;
/var&lt;br /&gt;
/var/lib&lt;br /&gt;
/var/lib/polkit-1&lt;br /&gt;
/var/lib/polkit-1/localauthority&lt;br /&gt;
/var/lib/polkit-1/localauthority/10-vendor.d&lt;br /&gt;
/var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla&lt;br /&gt;
/usr&lt;br /&gt;
/usr/share&lt;br /&gt;
/usr/share/doc&lt;br /&gt;
/usr/share/doc/policykit-desktop-privileges&lt;br /&gt;
/usr/share/doc/policykit-desktop-privileges/copyright&lt;br /&gt;
/usr/share/doc/policykit-desktop-privileges/changelog.gz&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;ok, eager to see that policy file:&lt;br /&gt;
&lt;strong&gt;cat /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla&lt;/strong&gt;&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
[Mounting, checking, etc. of internal drives]&lt;br /&gt;
Identity=unix-group:admin&lt;br /&gt;
Action=org.freedesktop.udisks.filesystem-&lt;strong&gt;;org.freedesktop.udisks.drive-ata-smart&lt;/strong&gt;&lt;br /&gt;
ResultActive=yes&lt;/p&gt;
&lt;p&gt;[Change &lt;span class=&quot;caps&quot;&gt;CPU&lt;/span&gt; Frequency scaling]&lt;br /&gt;
Identity=unix-group:admin&lt;br /&gt;
Action=org.gnome.cpufreqselector&lt;br /&gt;
ResultActive=yes&lt;/p&gt;
&lt;p&gt;[Setting the clock]&lt;br /&gt;
Identity=unix-group:admin&lt;br /&gt;
Action=org.gnome.clockapplet.mechanism.*&lt;br /&gt;
ResultActive=yes&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span class=&quot;caps&quot;&gt;SOLUTION&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;ok, the structure and values in the file, especially &amp;#8220;ResultActive&amp;#8221; looked promising (I must admit, at this point I was too impatient and sleepy, so did not do further readings on the subject), so I just added the following 2 lines after every section in the file:&lt;br /&gt;
&lt;strong&gt;nano -w /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla&lt;/strong&gt; (sudo if you&amp;#8217;re using your regular user account)&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
ResultAny=auth_admin&lt;br /&gt;
ResultInactive=yes&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;restarted policykit, and suddenly I could mount from Nautilus again&amp;#8230; :)&lt;/p&gt;</description>
      <author>srejbi</author>
      <pubDate>Sat, 05 Jun 2010 12:48:29 +0000</pubDate>
      <link>http://srejbi.info/posts/8_automatic-mounting-broken-again-in-ubuntu-10-04-lucid-lynx</link>
      <guid>http://srejbi.info/posts/8_automatic-mounting-broken-again-in-ubuntu-10-04-lucid-lynx</guid>
    </item>
    <item>
      <title>XBMC on Ubuntu 10.04 Lucid Lynx</title>
      <description>&lt;script type=&quot;text/javascript&quot;&gt;
    hopfeed_template='';
    hopfeed_align='LEFT';
    hopfeed_type='IFRAME';
    hopfeed_affiliate_tid='videotextbanner';
    hopfeed_affiliate='kdfs2010';
    hopfeed_fill_slots='true';
    hopfeed_height='90';
    hopfeed_width='728';
    hopfeed_cellpadding='5';
    hopfeed_rows='1';
    hopfeed_cols='4';
    hopfeed_font='Verdana, Arial, Helvetica, Sans Serif';
    hopfeed_font_size='7pt';
    hopfeed_font_color='000000';
    hopfeed_border_color='FFFFFF';
    hopfeed_link_font_color='3300FF';
    hopfeed_link_font_hover_color='3300FF';
    hopfeed_background_color='FFFFFF';
    hopfeed_keywords='movies';
    hopfeed_path='http://kdfs2010.hopfeed.com';
    hopfeed_link_target='_blank';
&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src='http://kdfs2010.hopfeed.com/script/hopfeed.js'&gt;&lt;/script&gt;&lt;p&gt;After the upgrade from Karmic Koala to Lucid Lynx (and re-enabling lucid package sources, reinstalling the appropriate xbmc packages), the video playback was producing some strange results; while audio and subtitles were displayed nicely, the screen was just flashing in different colours where it should have shown video&amp;#8230;&lt;/p&gt;
&lt;p&gt;The xbmc.log was not in any way suspicious to me (no errors, warnings, complaints about display or rendering).&lt;/p&gt;
&lt;p&gt;The best solution for the time being was to go to &lt;strong&gt;System / Video / Playback&lt;/strong&gt; in &lt;span class=&quot;caps&quot;&gt;XBMC&lt;/span&gt; and change &lt;strong&gt;Render method&lt;/strong&gt; from &lt;strong&gt;Auto detect&lt;/strong&gt; to either &lt;strong&gt;Software&lt;/strong&gt; or to &lt;strong&gt;Basic shaders (&lt;span class=&quot;caps&quot;&gt;ARB&lt;/span&gt;)&lt;/strong&gt;. &lt;em&gt;Basic shaders look slightly better to me, also that should utilize the &lt;span class=&quot;caps&quot;&gt;GPU&lt;/span&gt; instead the &lt;span class=&quot;caps&quot;&gt;CPU&lt;/span&gt; so that&amp;#8217;s what I set for my box.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span class=&quot;caps&quot;&gt;VDPAU&lt;/span&gt;&lt;/strong&gt; and &lt;strong&gt;Advanced shaders (&lt;span class=&quot;caps&quot;&gt;GLSL&lt;/span&gt;)&lt;/strong&gt; are both producing the forementioned colourful psychedelic effect.&lt;/p&gt;
&lt;p&gt;The box is an EeeBox B206 with a Radeon &lt;span class=&quot;caps&quot;&gt;HDMI&lt;/span&gt; card:&lt;br /&gt;
&lt;pre&gt;lspci | grep -i vga&lt;br /&gt;
03:00.0 &lt;span class=&quot;caps&quot;&gt;VGA&lt;/span&gt; compatible controller: &lt;span class=&quot;caps&quot;&gt;ATI&lt;/span&gt; Technologies Inc Mobility Radeon HD 3400 Series&lt;/pre&gt;, using the fglrx driver.&lt;/p&gt;</description>
      <author>srejbi</author>
      <pubDate>Sat, 05 Jun 2010 12:01:52 +0000</pubDate>
      <link>http://srejbi.info/posts/7_xbmc-on-ubuntu-10-04-lucid-lynx</link>
      <guid>http://srejbi.info/posts/7_xbmc-on-ubuntu-10-04-lucid-lynx</guid>
    </item>
    <item>
      <title>selenium-on-rails on rails 2.3.5</title>
      <description>&lt;p&gt;Supposing you installed already the &lt;a href=&quot;http://seleniumhq.org/&quot;&gt;Selenium&lt;/a&gt; gem (&lt;em&gt;gem install Selenium&lt;/em&gt; &amp;#8212; mind the capital &amp;#8216;S&amp;#8217;) and installed the &lt;a href=&quot;http://github.com/paytonrules/selenium-on-rails/&quot;&gt;selenium-on-rails&lt;/a&gt; plugin, but run into the following error when trying to run the Rakefile for Selenium:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
cd [project]/vendor/plugins/selenium-on-rails&lt;br /&gt;
rake&lt;br /&gt;
&lt;/pre&gt;&lt;br /&gt;
results in:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
(in  [project]/vendor/plugins/selenium-on-rails)&lt;br /&gt;
/usr/bin/ruby18 -I&amp;quot;lib:lib&amp;quot; &amp;#8220;/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb&amp;#8221; &amp;#8220;test/selenium_controller_test.rb&amp;#8221; &amp;#8220;test/renderer_test.rb&amp;#8221; &amp;#8220;test/setup_test.rb&amp;#8221; &amp;#8220;test/paths_test.rb&amp;#8221; &amp;#8220;test/selenium_on_rails_config_test.rb&amp;#8221; &amp;#8220;test/selenese_test.rb&amp;#8221; &amp;#8220;test/selenium_support_test.rb&amp;#8221; &amp;#8220;test/switch_environment_controller_test.rb&amp;#8221; &amp;#8220;test/rselenese_test.rb&amp;#8221; &amp;#8220;test/suite_renderer_test.rb&amp;#8221; &lt;br /&gt;
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in `const_missing&amp;#8217;: uninitialized constant ActionView::Base::Helpers (NameError)&lt;br /&gt;
	from /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:163&lt;br /&gt;
	from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require&amp;#8217;&lt;br /&gt;
	from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require&amp;#8217;&lt;br /&gt;
	from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require&amp;#8217;&lt;br /&gt;
	from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in&amp;#8217;&lt;br /&gt;
	from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require&amp;#8217;&lt;br /&gt;
	from ./test/test_helper.rb:14&lt;br /&gt;
	from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require&amp;#8217;&lt;br /&gt;
	from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require&amp;#8217;&lt;br /&gt;
	from ./test/selenium_controller_test.rb:1&lt;br /&gt;
	from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load&amp;#8217;&lt;br /&gt;
	from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5&lt;br /&gt;
	from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each&amp;#8217;&lt;br /&gt;
	from /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5&lt;br /&gt;
rake aborted!&lt;br /&gt;
Command failed with status (1): [/usr/bin/ruby18 -I&amp;quot;lib:lib&amp;quot; &amp;quot;/usr/lib/ruby&amp;#8230;]&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;than you probably installed the plugin from the &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; recommended for projects using Rails 2.2 and up&amp;#8230; Apparently this fork has not been updated for 2.3.5 compatibility, fortunately the one in git is. So just do&lt;/p&gt;
&lt;pre&gt;
script/plugin remove selenium-on-rails
script/plugin install git://github.com/paytonrules/selenium-on-rails.git
&lt;/pre&gt;
&lt;p&gt;The errors should be gone&amp;#8230; :)&lt;/p&gt;</description>
      <author>srejbi</author>
      <pubDate>Wed, 12 May 2010 15:55:21 +0000</pubDate>
      <link>http://srejbi.info/posts/6_selenium-on-rails-on-rails-2-3-5</link>
      <guid>http://srejbi.info/posts/6_selenium-on-rails-on-rails-2-3-5</guid>
    </item>
    <item>
      <title>linux_fortune</title>
      <description>&lt;p&gt;being a linux enthusiast, when looking for quotes for this blog &amp;#8211; and playing with ruby / learning how to write and package gems &amp;#8211; what else could have been my first thought than displaying random quotes using the &amp;#8216;notorious&amp;#8217; &lt;a href=&quot;http://en.wikipedia.org/wiki/Fortune_%28Unix%29&quot;&gt;fortune&lt;/a&gt; program on this blog. &lt;br /&gt;
a quick search on github resulted &lt;a href=&quot;http://github.com/lacco/ruby-fortunes&quot;&gt;lacco&amp;#8217;s ruby-fortunes&lt;/a&gt;  &amp;#8212; a library that provides fortunes using a network service.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;well, i&amp;#8217;m wondering why one needs a fortune webservice (assuming that fortune is needed in a linux-box-hosted-project; others rather need luck and spend a fortune ;-) ), though it&amp;#8217;s definitely a convenient idea to provide network access to fortune.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;anyway, since i have fortune right at my fingertips to my servertops and wanted to play with ruby gem creation, thought to create a gem for linux / unix machines with rails projects. (though it might work on win-whatever too, having &lt;a href=&quot;http://www.alagad.com/projects.fortune&quot;&gt;cygwin&lt;/a&gt; installed for example; have not tested, nor researched this matter or the existence of fortune ports to win)&lt;/p&gt;
&lt;p&gt;the current, humble version 0.0.2 was in fact only tested on &lt;a href=&quot;http://gentoo.org&quot;&gt;gentoo&lt;/a&gt; and a demo has been installed to this blog, on the &lt;a href=&quot;/&quot;&gt;home page&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;installing it was simple as:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;install gem&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
sudo gem install linux_fortune&lt;br /&gt;
&lt;/pre&gt;&lt;/li&gt;
	&lt;li&gt;use the gem (edit config/environment.rb)&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
&lt;code class=ruby&gt;
config.gem &quot;linux_fortune&quot;
&lt;/code&gt;&lt;br /&gt;
&lt;/pre&gt;&lt;/li&gt;
	&lt;li&gt;finally call fortune from the site index template the following line:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
&lt;code class=html&gt;
&amp;lt;div class=&quot;fortune&quot;&amp;gt;&amp;lt;%= LinuxFortune.generate.body.gsub(/\n/, &quot;&amp;lt;br/&amp;gt;&quot;) %&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;br /&gt;
&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;for more details and source code, see the &lt;a href=&quot;http://github.com/srejbi/linux_fortune&quot;&gt;project page on GitHub&lt;/a&gt; and the &lt;a href=&quot;http://rubygems.org/gems/linux_fortune&quot;&gt;gem page&lt;/a&gt;&lt;/p&gt;</description>
      <author>srejbi</author>
      <pubDate>Wed, 24 Mar 2010 00:33:35 +0000</pubDate>
      <link>http://srejbi.info/posts/5_linux_fortune</link>
      <guid>http://srejbi.info/posts/5_linux_fortune</guid>
    </item>
    <item>
      <title>mini_captcha</title>
      <description>&lt;p&gt;&lt;a href=&quot;http://github.com/srejbi/mini_captcha&quot;&gt;mini_captcha&lt;/a&gt; is a minimalistic captcha plugin for rails projects, based on some code developed for a friend&amp;#8217;s website. &lt;br /&gt;
developing another captcha plugin (there are a few other plugins out there) was inspired by the spirit of minimalism:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;not to store images in the db&lt;/li&gt;
	&lt;li&gt;not to keep images with any of the models that might need captcha protection when creating instances&lt;/li&gt;
	&lt;li&gt;keep images only as long as needed (serve once, delete)&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;&lt;span class=&quot;caps&quot;&gt;HOWTO&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;To install and integrate to your rails website, follow these steps:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;install RMagick and Digest &amp;#8212; if not yet installed&lt;/li&gt;
	&lt;li&gt;install mini_captcha:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
script/plugin install git@github.com:srejbi/mini_captcha.git&lt;br /&gt;
&lt;/pre&gt;&lt;/li&gt;
	&lt;li&gt;add the following lines to your application controller:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
&lt;code class=&quot;ruby&quot;&gt;
require 'vendor/plugins/mini_captcha/lib/mini_captcha'
include MiniCaptcha::ControllerHelpers
&lt;/code&gt;&lt;br /&gt;
&lt;/pre&gt;&lt;/li&gt;
	&lt;li&gt;add a map to the MiniCaptcha controller for the MiniCaptcha image display&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
&lt;code class=&quot;ruby&quot;&gt;
map.mini_captcha '/mini_captcha/:action', :controller =&amp;gt; 'mini_captcha', :action =&amp;gt; 'show_image'
&lt;/code&gt;&lt;br /&gt;
&lt;/pre&gt;&lt;/li&gt;
	&lt;li&gt;add a div like this to any view you want to protect with MiniCaptcha from spam:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
&lt;code class=&quot;ruby&quot;&gt;
  ... (your page &amp;amp; form)...
  &amp;lt;div class=&quot;...&quot;&amp;gt;&amp;lt;%= show_mini_captcha  %&amp;gt; &amp;lt;/div&amp;gt;
  ... (your page) ....
&lt;/code&gt;&lt;br /&gt;
&lt;/pre&gt;&lt;/li&gt;
	&lt;li&gt;update the processing controller similarly to the following block:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
&lt;code class=&quot;ruby&quot;&gt;
 if @form.valid?    your original validation
       if mini_captcha_valid?  extend it with checking the MiniCaptchaChallenge
         do whatever...
         flash[:notice] = 'Your form input was correct.'
         redirect as you wish
       else                     belongs to your new validation of MiniCaptchaChallenge (failure branch)
         flash[:error] = 'Failed MiniCaptcha Challenge.'
         punish the 'bot, piss off the user (just kidding ;))
       end                      end of yout new block for MiniCaptchaChallenge failure
     end
&lt;/code&gt;&lt;br /&gt;
&lt;/pre&gt;&lt;/li&gt;
	&lt;li&gt;enjoy getting less spam, more real comments :-)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Credits: thanks to &lt;a href=&quot;http://github.com/milkfarm&quot;&gt;milkfarm&lt;/a&gt; for specs, ideas, and actual updates on the code.&lt;/p&gt;
&lt;p&gt;for more details and updates, visit the &lt;a href=&quot;http://github.com/srejbi/mini_captcha&quot;&gt;project page on GitHub&lt;/a&gt;&lt;/p&gt;</description>
      <author>srejbi</author>
      <pubDate>Tue, 23 Mar 2010 22:57:19 +0000</pubDate>
      <link>http://srejbi.info/posts/4_mini_captcha</link>
      <guid>http://srejbi.info/posts/4_mini_captcha</guid>
    </item>
    <item>
      <title>get time estimates from redmine</title>
      <description>&lt;p&gt;though the latest (0.9.x) versions of &lt;a href=&quot;http://www.redmine.org&quot;&gt;Redmine&lt;/a&gt; definitely has improved issues display, still some columns are missing from the view, such as the time spent already and projections of the total time (or time remaining) based on the original estimate, time inputted already and the completion ratio.&lt;/p&gt;
&lt;p&gt;below is my dirty &lt;span class=&quot;caps&quot;&gt;SQL&lt;/span&gt; workaround for getting these base numbers out for simple maths:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
&lt;code class=&quot;sql&quot;&gt;
SELECT distinct i.id, fixed_version_id, estimated_hours, done_ratio, SUM(te.hours) AS time_spent, subject 
FROM issues i 
    LEFT OUTER JOIN time_entries te ON i.id = te.issue_id 
WHERE i.project_id = ${project}
GROUP BY i.id 
ORDER BY fixed_version_id ASC, id ASC;
&lt;/code&gt;&lt;br /&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;em&gt;where ${project} is your selected project;&lt;/em&gt;&lt;br /&gt;
_ or also one can remove condition, add ordering by &lt;strong&gt;i.project_id&lt;/strong&gt; and see all projects (also could put any other columns there)_&lt;/p&gt;
&lt;p&gt;or do already the simple math for doing linear projections of the remaining time estimate based on the original or on the already spent time:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
&lt;code class=&quot;sql&quot;&gt;
SELECT DISTINCT i.id, fixed_version_id, estimated_hours, done_ratio, 
                SUM(te.hours) AS time_spent, 
                (CASE done_ratio WHEN 100 THEN 0 ELSE (estimated_hours*(100-done_ratio)/100) END) AS rem_est_est, 
                (CASE done_ratio WHEN 100 THEN 0 ELSE (SUM(te.hours)*(100/done_ratio)-SUM(te.hours)) END) AS rem_est_done, 
                subject 
FROM issues i LEFT OUTER JOIN time_entries te ON i.id = te.issue_id WHERE i.project_id = ${project} 
GROUP BY i.id 
ORDER BY fixed_version_id ASC, id ASC
&lt;/code&gt;&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;these &lt;span class=&quot;caps&quot;&gt;SQL&lt;/span&gt; statements were tested on MySQL, but supposed to work without modification on PostgreSQ. tested with redmine versions 0.8 &amp;#8211; 0.9.2&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;this would result a table like this.&lt;/p&gt;
&lt;table style=&quot;border:1px solid gray;&quot;&gt;
	&lt;tr&gt;
		&lt;td&gt;id&lt;/td&gt;
		&lt;td&gt;fixed_version_id&lt;/td&gt;
		&lt;td&gt;estimated_hours&lt;/td&gt;
		&lt;td&gt;done_ratio&lt;/td&gt;
		&lt;td&gt;time_spent&lt;/td&gt;
		&lt;td&gt;rem_est_est&lt;/td&gt;
		&lt;td&gt;rem_est_done&lt;/td&gt;
		&lt;td&gt;subject&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;1&lt;/td&gt;
		&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;NULL&lt;/span&gt;&lt;/td&gt;
		&lt;td&gt;80&lt;/td&gt;
		&lt;td&gt;0&lt;/td&gt;
		&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;NULL&lt;/span&gt;&lt;/td&gt;
		&lt;td&gt;80&lt;/td&gt;
		&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;NULL&lt;/span&gt;&lt;/td&gt;
		&lt;td&gt;an unstarted issue with estimate&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;2&lt;/td&gt;
		&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;NULL&lt;/span&gt;&lt;/td&gt;
		&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;NULL&lt;/span&gt;&lt;/td&gt;
		&lt;td&gt;0&lt;/td&gt;
		&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;NULL&lt;/span&gt;&lt;/td&gt;
		&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;NULL&lt;/span&gt;&lt;/td&gt;
		&lt;td&gt;&lt;span class=&quot;caps&quot;&gt;NULL&lt;/span&gt;&lt;/td&gt;
		&lt;td&gt;unstarted issue without estimate&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;3&lt;/td&gt;
		&lt;td&gt;3&lt;/td&gt;
		&lt;td&gt;5&lt;/td&gt;
		&lt;td&gt;100&lt;/td&gt;
		&lt;td&gt;4.70000004023314&lt;/td&gt;
		&lt;td&gt;0&lt;/td&gt;
		&lt;td&gt;0&lt;/td&gt;
		&lt;td&gt;completed issue 1&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;6&lt;/td&gt;
		&lt;td&gt;3&lt;/td&gt;
		&lt;td&gt;8&lt;/td&gt;
		&lt;td&gt;100&lt;/td&gt;
		&lt;td&gt;12.1599999666214&lt;/td&gt;
		&lt;td&gt;0&lt;/td&gt;
		&lt;td&gt;0&lt;/td&gt;
		&lt;td&gt;completed issue 2&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;4&lt;/td&gt;
		&lt;td&gt;4&lt;/td&gt;
		&lt;td&gt;4&lt;/td&gt;
		&lt;td&gt;30&lt;/td&gt;
		&lt;td&gt;1.30000002682209&lt;/td&gt;
		&lt;td&gt;2.8&lt;/td&gt;
		&lt;td&gt;3.033290062584&lt;/td&gt;
		&lt;td&gt;issue progressing slightly worse than estimated&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;5&lt;/td&gt;
		&lt;td&gt;4&lt;/td&gt;
		&lt;td&gt;6&lt;/td&gt;
		&lt;td&gt;10&lt;/td&gt;
		&lt;td&gt;1.89999997615814&lt;/td&gt;
		&lt;td&gt;5.4&lt;/td&gt;
		&lt;td&gt;17.099999785423&lt;/td&gt;
		&lt;td&gt;issue progressing much worse than estimated&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;7&lt;/td&gt;
		&lt;td&gt;4&lt;/td&gt;
		&lt;td&gt;16&lt;/td&gt;
		&lt;td&gt;60&lt;/td&gt;
		&lt;td&gt;7.95000000298023&lt;/td&gt;
		&lt;td&gt;6.4&lt;/td&gt;
		&lt;td&gt;5.3002650019869&lt;/td&gt;
		&lt;td&gt;issue progressing better than estimated&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;8&lt;/td&gt;
		&lt;td&gt;4&lt;/td&gt;
		&lt;td&gt;3&lt;/td&gt;
		&lt;td&gt;90&lt;/td&gt;
		&lt;td&gt;1.5&lt;/td&gt;
		&lt;td&gt;0.3&lt;/td&gt;
		&lt;td&gt;0.16665&lt;/td&gt;
		&lt;td&gt;issue progressing much better than estimated&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;how realistic are these figures?&lt;/strong&gt; i do not know &amp;#8212; it all comes down to the issue specs. the high resolution and precisely detailed issue specification is the key factor to increase the precision of initial and ongoing estimates (completion ratio), generally speaking. however there could be an entire post about it&amp;#8230;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;anyway, back to the original topic; the above &lt;span class=&quot;caps&quot;&gt;SQL&lt;/span&gt; is good enough for me to keep tracking how my &amp;#8211; often lousily specified issues &amp;#8211; keep progressing &amp;#8211; as the specs are getting refined as well as work is being done on the issues &amp;#8211; so i can have a better idea of where the project will end up (in terms of time spent) than if i just look at the remaining (original) estimate.&lt;/p&gt;
&lt;p&gt;however, one can think of many other things to do here, eg. interpolate time entries to get another projected total time per issue / project, or calculate projected estimate for non-started tasks based on the original estimate and the precision of original estimates in the project (based on closed tasks). i have no need for that stuff right now, and no time to play with it just for fun (though would be interesting to see), maybe another time&amp;#8230; :)&lt;/p&gt;</description>
      <author>srejbi</author>
      <pubDate>Wed, 10 Feb 2010 11:47:41 +0000</pubDate>
      <link>http://srejbi.info/posts/2_get-time-estimates-from-redmine</link>
      <guid>http://srejbi.info/posts/2_get-time-estimates-from-redmine</guid>
    </item>
    <item>
      <title>The Cobbler's Children Have No Shoes</title>
      <description>&lt;p&gt;well, as you can guess, i am not a cobbler, actually&amp;#8230; just another busy software engineer that wonders every once in a while why his own website looks like crap /if there is a website at all :)/&amp;#8230;&lt;/p&gt;
&lt;p&gt;having my personal page up with &lt;a href=&quot;http://wordpress.org&quot;&gt;wordpress&lt;/a&gt; for some time now, i felt a little less pressure to do anything about it. however, doing plenty of rails stuff for some time now, started to wonder why i should keep running my site on wp and not just create something &lt;a href=&quot;http://en.wikipedia.org/wiki/KISS_principle&quot;&gt;simple and stupid&lt;/a&gt; in rails.&lt;/p&gt;
&lt;p&gt;so here it goes.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://dev.mobility.ws:4443/projects/show/yaqrb&quot;&gt;project page&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;this is free software, so feel free to grab it if you need something like this.&lt;/p&gt;
&lt;pre&gt;
git clone git://git.mobility.ws/yaqrb.git
&lt;/pre&gt;</description>
      <author>srejbi</author>
      <pubDate>Fri, 05 Feb 2010 22:59:11 +0000</pubDate>
      <link>http://srejbi.info/posts/1_the-cobbler-s-children-have-no-shoes</link>
      <guid>http://srejbi.info/posts/1_the-cobbler-s-children-have-no-shoes</guid>
    </item>
  </channel>
</rss>

