<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Astrails - Home</title>
  <id>tag:blog.astrails.com,2010:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  <link href="http://blog.astrails.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://blog.astrails.com/" rel="alternate" type="text/html"/>
  <updated>2010-01-21T22:21:28Z</updated>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>vitaly</name>
    </author>
    <id>tag:blog.astrails.com,2010-01-21:291</id>
    <published>2010-01-21T22:20:00Z</published>
    <updated>2010-01-21T22:21:28Z</updated>
    <category term="Astrails"/>
    <category term="astrails-safe"/>
    <category term="IT"/>
    <category term="astrails-safe"/>
    <category term="backup"/>
    <category term="enctyption"/>
    <category term="gpg"/>
    <category term="safe"/>
    <link href="http://blog.astrails.com/2010/1/21/astrails-safe-0-2-7" rel="alternate" type="text/html"/>
    <title>astrails-safe 0.2.7</title>
<summary type="html">&lt;p&gt;There is a new (0.2.7) version of Astrails-Safe.&lt;/p&gt;

&lt;p&gt;New features since 0.2.5:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;default options for gpg now include '--no-use-agent'&lt;/li&gt;
&lt;li&gt;support for 'command' option for gpg&lt;/li&gt;
&lt;li&gt;quote values in mysql password file&lt;/li&gt;
&lt;li&gt;add 'lib' to $:&lt;/li&gt;
&lt;li&gt;[EXPERIMENTAL] Rackspace Cloud Files support&lt;/li&gt;
&lt;/ul&gt;</summary><content type="html">
            &lt;p&gt;There is a new (0.2.7) version of Astrails-Safe.&lt;/p&gt;

&lt;p&gt;New features since 0.2.5:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;default options for gpg now include '--no-use-agent'&lt;/li&gt;
&lt;li&gt;support for 'command' option for gpg&lt;/li&gt;
&lt;li&gt;quote values in mysql password file&lt;/li&gt;
&lt;li&gt;add 'lib' to $:&lt;/li&gt;
&lt;li&gt;[EXPERIMENTAL] Rackspace Cloud Files support&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;http://github.com/minter&quot;&gt;H. Wade Minter&lt;/a&gt; contributed support for Rackspace cloud files. I have no way of testing this, so please tell me if it works :)&lt;/p&gt;

&lt;p&gt;To easy the development process, I added the 'lib' directory of the 'currently running' safe to the library load path&quot;$:&quot;. This enables to work on a new version of safe even though you have some version already installed. The files in ./lib will come first in the load path.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IMPORTANT:&lt;/strong&gt; I just stumbled upon a problem with the gpg encryption on a freshly installed Ubuntu EC2 instance. the gpg was asking for a password on the console even though it was passed the --passphrase-file option with the file containing the password. After some investigation I found out that gnupg's default template configuration file now contains 'use-agent' options. The result of it is that on the &lt;em&gt;first&lt;/em&gt; invocation of astrails-safe it will work, but gpg will create a new ~/gnupg/gpg.conf file with 'use-agent' setting, so the next time you run astrails-safe it will fail and ask for  the password on the console!&lt;/p&gt;

&lt;p&gt;if you are running gpg 1.x series, just pass '--no-use-agent&quot; to the &quot;options&quot; setting in the astrails-safe config in the 'gpg' section (since this 0.2.7 version this options is set in the default astrails-safe template config).&lt;/p&gt;

&lt;p&gt;For gpg2 series, I suppose you'll need to run the gpg-agent (actually I'm not sure, I didn't research it too deeply, so I'll be happy to get feedback on the issue)&lt;/p&gt;

&lt;p&gt;I also added 'command' option support for gpg which allows to override the executable astrails-safe is using for the enctyption. For example you can have &quot;command &quot;/usr/loca/bin/gpg&quot; in the gpg section.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>vitaly</name>
    </author>
    <id>tag:blog.astrails.com,2010-01-14:281</id>
    <published>2010-01-14T00:49:00Z</published>
    <updated>2010-01-14T16:34:22Z</updated>
    <category term="Rails"/>
    <category term="Ruby"/>
    <category term="magic"/>
    <category term="metaprogramming"/>
    <category term="ruby"/>
    <link href="http://blog.astrails.com/2010/1/14/there-is-no-magic-indeed" rel="alternate" type="text/html"/>
    <title>There is no magic, indeed.</title>
<content type="html">
            &lt;p&gt;I&#8217;ve just read &#8221;&lt;a href=&quot;http://gilesbowkett.blogspot.com/2009/07/do-you-believe-in-magic.html&quot;&gt;Do You Believe In Magic?&lt;/a&gt;&#8221; and the following quote resonated particularly well:&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;&#8220;It&#8217;s not magic. There is no magic involved. It&#8217;s just, if you never learnt Lisp,
    then you never learned to program, and Ruby&#8217;s power is exposing a deficiency in your skills.&#8221;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I find it to be very true, and I suppose one of the reasons I&#8217;m so happy about Ruby is that I learned Lisp and Scheme before.&lt;/p&gt;

&lt;p&gt;Even though I didn&#8217;t use Lisp for any sizable project. I tried, but I found it to be quite unfriendly and &#8216;hairy&#8217; in setup, environment and library support. Ruby solved all that for me w/o sacrificing almost anything power vise.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>michael</name>
    </author>
    <id>tag:blog.astrails.com,2009-12-16:251</id>
    <published>2009-12-16T17:45:00Z</published>
    <updated>2009-12-17T17:49:18Z</updated>
    <category term="jobthejob"/>
    <category term="startup weekend"/>
    <link href="http://blog.astrails.com/2009/12/16/jobthejob-starts-the-startup" rel="alternate" type="text/html"/>
    <title>JobTheJob starts the startup</title>
<content type="html">
            &lt;p&gt;The opportunity: 120 happy dreamers cooking for 54 hours of pure startup joy, well-fed and ready to work. Of course, I’m talking here about Startup Weekend Israel.&lt;/p&gt;


	&lt;p&gt;The challenge: Come up with an idea that can be implemented in a couple of days, yet is so cool, so innovative, and so useful that I could attract the best of the best.&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;http://blogtheblog.jobthejob.com/2009/12/startupthestartup.html&quot;&gt;Read the rest at blogtheblog.jobthejob.com&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;P.S Now we have some pictures too there, you should &lt;a href=&quot;http://blogtheblog.jobthejob.com/2009/12/startupthestartup.html&quot;&gt;check it out&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>vitaly</name>
    </author>
    <id>tag:blog.astrails.com,2009-12-16:241</id>
    <published>2009-12-16T12:20:00Z</published>
    <updated>2009-12-17T17:38:57Z</updated>
    <category term="Astrails"/>
    <category term="jobthejob"/>
    <category term="startup weekend"/>
    <link href="http://blog.astrails.com/2009/12/16/job-the-job" rel="alternate" type="text/html"/>
    <title>Job the Job</title>
<summary type="html">&lt;p&gt;If you follow us on twitter (&lt;a href=&quot;http://twitter.com/astrails&quot;&gt;@astrails&lt;/a&gt; if you wondering) you already know that we are at the &lt;a href=&quot;http://israel.startupweekend.org/&quot;&gt;Startup Weekend Israel&lt;/a&gt; right now.&lt;/p&gt;


	&lt;p&gt;Which is going amazing by the way, thanks for asking, lots and lots of nice people, very creative and energetic atmosphere, food and beer.&lt;/p&gt;


	&lt;p&gt;Turns out our idea attracted a great team of developers, designers and business developers.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;If you follow us on twitter (&lt;a href=&quot;http://twitter.com/astrails&quot;&gt;@astrails&lt;/a&gt; if you wondering) you already know that we are at the &lt;a href=&quot;http://israel.startupweekend.org/&quot;&gt;Startup Weekend Israel&lt;/a&gt; right now.&lt;/p&gt;


	&lt;p&gt;Which is going amazing by the way, thanks for asking, lots and lots of nice people, very creative and energetic atmosphere, food and beer.&lt;/p&gt;


	&lt;p&gt;Turns out our idea attracted a great team of developers, designers and business developers.&lt;/p&gt;
&lt;p&gt;The idea is very simple: aggregate job postings from various sources (starting with twitter)
with automated translation to several languages (for now Hebrew, English and Russian) and automated tagging and display all on a web page with free text search and categories browsing.&lt;/p&gt;


	&lt;p&gt;It should make searching for a job a little bit less of a hassle as now you have to scavenge less sources to find your perfect job.&lt;/p&gt;


	&lt;p&gt;Why is it good for Startup Weekend:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Easy to explain&lt;/li&gt;
		&lt;li&gt;Is actually useful, solving real people pains.&lt;/li&gt;
		&lt;li&gt;Most importantly it really can be implemented within the constrains of the
   Startup Weekend (it seems like we&#8217;ll have only about 10-15 working hours on it)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The name of the service is &lt;a href=&quot;http://jobthejob.com&quot;&gt;JobTheJob&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;So the team members are:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Me (Vitaly :) and Boris, obviously. Doing backend.&lt;/li&gt;
		&lt;li&gt;Michael can&#8217;t participate as he&#8217;s on the judges panel :)&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://punia.net&quot;&gt;Pavel Kostychev&lt;/a&gt; is doing the UI &#38; identity.&lt;/li&gt;
		&lt;li&gt;Alan Rubin (backend)&lt;/li&gt;
		&lt;li&gt;Elyon DeKoven (front end, research, and all around)&lt;/li&gt;
		&lt;li&gt;Pini Sternshos (biz dev, marketing, etc)&lt;/li&gt;
		&lt;li&gt;Boris Reitman (front end)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;We created a blog for the new company, it&#8217;s called &lt;a href=&quot;http://blogtheblog.jobthejob.com&quot;&gt;BlogTheBlog&lt;/a&gt; of course. You can grab our progress and impression there and i also will be posting links here when there is a new content there, so you can check out &lt;a href=&quot;/jobthejob&quot;&gt;JobTheJob category&lt;/a&gt; on this blog. Also we will be &lt;a href=&quot;http://twitter.com/astrails&quot;&gt;tweeting about it&lt;/a&gt;, and our personal twitter accounts(look to your right) so you welcome to follow the startup creation process in real time and if you have something to say about it we will be glad to hear.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>boris</name>
    </author>
    <id>tag:blog.astrails.com,2009-11-22:231</id>
    <published>2009-11-22T18:07:00Z</published>
    <updated>2009-11-22T18:10:02Z</updated>
    <category term="Astrails"/>
    <link href="http://blog.astrails.com/2009/11/22/startup-weekend-comes-to-israel" rel="alternate" type="text/html"/>
    <title>Startup Weekend Comes to Israel</title>
<summary type="html">&lt;p&gt;&lt;a href=&quot;http://israel.startupweekend.org/&quot;&gt;Startup Weekend&lt;/a&gt; comes to Israel.&lt;/p&gt;

&lt;p&gt;The event will take place at IBM offices in Petch Tikva from Dec-16 to Dec-18. We are going to participate and also sponsor the &lt;a href=&quot;http://israel.startupweekend.org/&quot;&gt;event&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Startup weekends are known to be a good place to network with all those startup people, like enterpreneurs, VCs, lawyers, developers and designers. &lt;/p&gt;

&lt;p&gt;Israeli event seems to be kosher, so it&#8217;s not exactly a weekend: Wed - Fri :-) Grab your &lt;a href=&quot;http://israel.startupweekend.org/tickets/&quot;&gt;discounted ticket&lt;/a&gt; using discount code &lt;i&gt;swearlybird&lt;/i&gt;, and as they say you should bring &#8220;laptop, good attitude, and creative energy&#8221; there.&lt;/p&gt;

&lt;p&gt;Follow &lt;a href=&quot;http://twitter.com/swisrael&quot;&gt;Startup Weekend Israel&lt;/a&gt; tweets to stay updated.&lt;/p&gt;

&lt;p&gt;We will &lt;a href=&quot;http://twitter.com/astrails&quot;&gt;tweet&lt;/a&gt; our impressions and blog about them here.&lt;/p&gt;

&lt;p&gt;Looking forward to have some geek fun.&lt;/p&gt;</summary>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>vitaly</name>
    </author>
    <id>tag:blog.astrails.com,2009-11-12:221</id>
    <published>2009-11-12T23:50:00Z</published>
    <updated>2009-11-16T17:57:56Z</updated>
    <category term="nosql"/>
    <category term="osx"/>
    <category term="cassanrda"/>
    <category term="java"/>
    <category term="nosql"/>
    <category term="osx"/>
    <link href="http://blog.astrails.com/2009/11/12/cassandra-on-osx" rel="alternate" type="text/html"/>
    <title>Cassandra on OSX</title>
<content type="html">
            &lt;p&gt;We just started a project for a client that involves &lt;a href=&quot;http://incubator.apache.org/cassandra/&quot;&gt;Cassandra&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you&#8217;ve been living under a rock and don&#8217;t know what Cassandra is let me tell you :)&lt;/p&gt;

&lt;p&gt;Cassandra is a &#8220;second-generation distributed database&#8221; that was built for web scale.
Its is one of the many distributed &lt;a href=&quot;http://www.google.com/search?q=nosql&quot;&gt;nosql&lt;/a&gt; databases that
appear everywhere lately like mushrooms after a heavy rain :).&lt;/p&gt;

&lt;p&gt;What sets Cassandra apart is that it comes from a recognizable entity - Facebook.&lt;/p&gt;

&lt;p&gt;But I digress. This is not meant to be a Cassandra introduction, there are enough of those on the net.
I Just created a new &lt;a href=&quot;/nosql&quot;&gt;nosql section&lt;/a&gt; on this blog where I&#8217;m going to post various tidbits of information
about cassandra (and probably others) as I learn them while working on this new project.&lt;/p&gt;

&lt;p&gt;Here is the first one:&lt;/p&gt;

&lt;h3&gt;Cassandra gem is just an installer&lt;/h3&gt;

&lt;p&gt;If you are on Mac OSX and interested in Cassandra you probably know that its just a gem installation away (almost):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;gem install cassandra
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;First thing to note though is that this will &lt;strong&gt;not&lt;/strong&gt; install Cassandra. It will install cassandra &lt;strong&gt;installer&lt;/strong&gt;! I got bitten by this when I took my laptop with me to my doughter&#8217;s dancing class. You see, parents are not allowed &#8220;in the room&#8221; to not interfere with the process :), so I have 45 minutes to find myself something to do each time. I installed cassandra gem at home and intended to play with Cassandra while there. Not so fast. When I run &lt;code&gt;cassandra_helper cassandra&lt;/code&gt; which is supposed to start a test cassandra instance it went to connect to a github repository to download and install the actual database. Duh!&lt;/p&gt;

&lt;p&gt;and the 2nd one:&lt;/p&gt;

&lt;h3&gt;Use java preferences&lt;/h3&gt;

&lt;p&gt;When I got back and finally built Cassandra I got the following message when starting it for the first time:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;~ &amp;gt; cassandra_helper cassandra
Set the CASSANDRA_INCLUDE environment variable to use a non-default cassandra.in.sh and friends.
(in /Library/Ruby/Gems/1.8/gems/cassandra-0.5.6.2)
You need to configure your environment for Java 1.6.
If you're on OS X, just export the following environment variables:
  JAVA_HOME=&quot;/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home&quot;
  PATH=&quot;/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin:$PATH&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;First thing to note is that just typing &lt;code&gt;JAVA_HOME=&quot;/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home&quot;&lt;/code&gt; in the terminal wont help.
You need to &lt;strong&gt;export&lt;/strong&gt; it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;export JAVA_HOME=&quot;/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home&quot;
PATH=&quot;/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin:$PATH&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;No need to export PATH as its already exported.&lt;/p&gt;

&lt;p&gt;But there is a better and simpler way!&lt;/p&gt;

&lt;p&gt;Start &#8220;Java Preferences&#8221; (find it in /Applications/Utilities, or just use spotlight):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://blog.astrails.com/assets/2009/11/12/Picture_2.png&quot; alt=&quot;Java Preferences: Java 6 2nd&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Then reorder the entries in the bottom &#8220;Java Applications&#8221; section so that Java 6 will be the 1st:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://blog.astrails.com/assets/2009/11/12/Picture_3.png&quot; alt=&quot;Java Preferences: Java 6 1st&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now cassandra starts right away w/o any exports:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;~ &amp;gt; cassandra_helper cassandra
Set the CASSANDRA_INCLUDE environment variable to use a non-default cassandra.in.sh and friends.
(in /Library/Ruby/Gems/1.8/gems/cassandra-0.5.6.2)
CASSANDRA_HOME: /Users/vitaly/cassandra/server
CASSANDRA_CONF: /Library/Ruby/Gems/1.8/gems/cassandra-0.5.6.2/conf
Listening for transport dt_socket at address: 8888
...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Cool, now go write your killer application!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>vitaly</name>
    </author>
    <id>tag:blog.astrails.com,2009-10-27:181</id>
    <published>2009-10-27T11:06:00Z</published>
    <updated>2009-10-27T18:40:54Z</updated>
    <category term="Rails"/>
    <category term="controller"/>
    <category term="design"/>
    <category term="model"/>
    <category term="mvc"/>
    <category term="rails"/>
    <category term="ruby"/>
    <category term="url_for"/>
    <category term="xml"/>
    <link href="http://blog.astrails.com/2009/10/27/liberate-my-controller" rel="alternate" type="text/html"/>
    <title>Let my controller go or useful impurity in software design.</title>
<summary type="html">&lt;p&gt;Yeah, I know, MVC is the &#8220;Only True Way&#0153;&#8221;. But sometimes, just sometimes, you need your &lt;code&gt;link_to&lt;/code&gt; or html helpers working in the model.&lt;/p&gt;

&lt;p&gt;For example, sometimes the cleanest way to implement something is to have &lt;code&gt;to_html&lt;/code&gt; in the model (widgets anyone?).
Doing this will most probably require generating some urls, and you need a controller for that.
Usually I solved this by passing controller to the to_html function, but it always felt wrong.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;Yeah, I know, MVC is the &#8220;Only True Way&#0153;&#8221;. But sometimes, just sometimes, you need your &lt;code&gt;link_to&lt;/code&gt; or html helpers working in the model.&lt;/p&gt;

&lt;p&gt;For example, sometimes the cleanest way to implement something is to have &lt;code&gt;to_html&lt;/code&gt; in the model (widgets anyone?).
Doing this will most probably require generating some urls, and you need a controller for that.
Usually I solved this by passing controller to the to_html function, but it always felt wrong.&lt;/p&gt;
&lt;p&gt;Another example is when you are working on an API. You somtimes would like to have an option to add actual URIs of related services inside an xml.
Like in 
 &lt;pre&gt;&lt;code&gt;   &amp;lt;articles&amp;gt;
        &amp;lt;article&amp;gt;
            &amp;lt;title&amp;gt;Let my controller go&amp;lt;/title&amp;gt;
            &amp;lt;href&amp;gt;http://example.com/articles/123&amp;lt;/href&amp;gt;
            &amp;lt;created-at&amp;gt;2009-05-24T19:09:06Z&amp;lt;/created-at&amp;gt;
        &amp;lt;/article&amp;gt;
    &amp;lt;/articles&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Now how will you implement that? It would be nice if &lt;code&gt;@articles.to_xml&lt;/code&gt; just worked, but then how will you generate the href url?
&lt;code&gt;url_for&lt;/code&gt; is not available in models.&lt;/p&gt;

&lt;p&gt;Solution? just make it global and let the purists tear their hairs out! :)&lt;/p&gt;

&lt;p&gt;This plugin solves the issues above by making the current controller available from a global function &lt;code&gt;current_controller&lt;/code&gt;.
(actually it uses Thread local storage, so it will work even in multithreaded Rails environment)&lt;/p&gt;

&lt;p&gt;The installation is simple&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;script/plugin install git://github.com/astrails/let_my_controller_go.git
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Or&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;braid -p git://github.com/astrails/let_my_controller_go.git
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then you can implement the above as&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;class Article &amp;lt; ActiveRecord::Base
  def href
    current_controller.url_for(self)
  end

  def to_xml(opts = {})
     super opts.merge(:methods =&amp;gt; :href, :only =&amp;gt; [:title, :created_at])
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then &lt;code&gt;Articles.all.to_xml&lt;/code&gt; will produce what you need (when running in a context of a web request, i.e. it won&#8217;t work from the console).&lt;/p&gt;

&lt;p&gt;So, while it might not pass strict software design review, but it is useful. And as with any tool, it&#8217;s up to you to use it appropriatly. &lt;/p&gt;

&lt;p&gt;Sources are at &lt;a href=&quot;http://github.com/astrails/let_my_controller_go&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;OK, flame away! /ducks and hides under the desk/&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>vitaly</name>
    </author>
    <id>tag:blog.astrails.com,2009-10-21:211</id>
    <published>2009-10-21T03:25:00Z</published>
    <updated>2009-10-21T03:26:23Z</updated>
    <category term="astrails-safe"/>
    <category term="IT"/>
    <category term="astrails-safe"/>
    <category term="backup"/>
    <category term="config"/>
    <category term="release"/>
    <category term="safe"/>
    <link href="http://blog.astrails.com/2009/10/21/astrails-safe-0-2-5" rel="alternate" type="text/html"/>
    <title>astrails-safe 0.2.5</title>
<content type="html">
            &lt;p&gt;Just released a new 0.2.5 version of astrails-safe.&lt;/p&gt;

&lt;p&gt;&#8220;astrails-safe&#8221; is our very simple to use backup script for mysql, postgres, filesystem, and subversion.
It can store your backups locally, on Amazon s3 or on a remote SFTP server.
Optional GnuPG enctyption completes the picture.&lt;/p&gt;

&lt;h2&gt;Changes in this version&lt;/h2&gt;

&lt;p&gt;&lt;br /&gt;
Thanks to &lt;a href=&quot;http://github.com/fkocherga&quot;&gt;Fedor Kocherga&lt;/a&gt; for spotting that &lt;em&gt;astrails-safe&lt;/em&gt; would happily overwrite existing config settings if you used same configuration keyword more then once. For example if you used 2 &lt;code&gt;exclude&lt;/code&gt; lines in your backup config the 2nd one would overwrite the 1st. Fedor&#8217;s fix was merged and now astrails-safe will either merge the configs for &lt;code&gt;files&lt;/code&gt;, &lt;code&gt;exclude&lt;/code&gt;, and &lt;code&gt;skip_tables&lt;/code&gt; keywords and will stop with an error for the rest of the keywords.&lt;/p&gt;

&lt;p&gt;New version is available in source form on &lt;a href=&quot;http://github.com/astrails/safe&quot;&gt;GitHub&lt;/a&gt; and as a ready to install gem on &lt;a href=&quot;http://gemcutter.org/gems/astrails-safe&quot;&gt;Gemcutter&lt;/a&gt;.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>vitaly</name>
    </author>
    <id>tag:blog.astrails.com,2009-10-09:201</id>
    <published>2009-10-09T14:13:00Z</published>
    <updated>2009-10-09T14:13:29Z</updated>
    <category term="astrails-safe"/>
    <category term="IT"/>
    <category term="Ruby"/>
    <category term="astrails-sfe"/>
    <category term="backup"/>
    <category term="bug"/>
    <category term="dry run"/>
    <category term="ftp"/>
    <category term="safe"/>
    <link href="http://blog.astrails.com/2009/10/9/astrails-safe-0-2-4-dry-run-fix-move-to-gemcutter" rel="alternate" type="text/html"/>
    <title>astrails-safe-0.2.4 - dry run fix, move to gemcutter</title>
<content type="html">
            &lt;p&gt;Since Github stopped to build gems we are moving to the gemcutter.&lt;/p&gt;

&lt;p&gt;Changes in 0.2.4 since 0.2.2:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;fixed couple of README errors (thanks &lt;a href=&quot;http://github.com/bobbyw&quot;&gt;Bobby Wilson&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;changed name from &#8216;safe&#8217; to &#8216;astrails-safe&#8217; due to the move to gemcutter&lt;/li&gt;
&lt;li&gt;added missing net-sftp dependency to the gemspec. &lt;/li&gt;
&lt;li&gt;fixed bug where it would crash in a dry-run since local storage didn&#8217;t update some internal variables.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To install the latest version:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;gem install astrails-safe --source http://gemcutter.org
&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>vitaly</name>
    </author>
    <id>tag:blog.astrails.com,2009-10-09:162</id>
    <published>2009-10-09T13:56:00Z</published>
    <updated>2009-10-09T13:57:44Z</updated>
    <category term="astrails-safe"/>
    <category term="IT"/>
    <category term="Ruby"/>
    <category term="amazon"/>
    <category term="backup"/>
    <category term="mysql"/>
    <category term="ruby"/>
    <category term="s3"/>
    <category term="tar"/>
    <link href="http://blog.astrails.com/2009/10/9/astrails-safe-0-2-2-sftp-timing-another-cleanup-bugfix" rel="alternate" type="text/html"/>
    <title>astrails-safe-0.2.2 - sftp, timing + another rotation bugfix</title>
<summary type="html">&lt;p&gt;Damn, I just found this unpublished article in the blog admin&#8230;&lt;/p&gt;

&lt;p&gt;How come it evaded my attention for 3 months??!!&lt;/p&gt;

&lt;p&gt;Anyway, releasing it now thought this is all quite old news, going to announce 0.2.4 in a moment :)&lt;/p&gt;

&lt;p&gt;There is a new 0.2.2 version of astrails-safe on &lt;a href=&quot;http://github.com/astrails/safe/&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you don&#8217;t know it yet astrails-safe is an easy to use backup solution for Unix like operating systems.
It supports filesystem, mysql, postgresql, subversion backups to local filesytem, Amazon S3 and remote SFTP.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;Damn, I just found this unpublished article in the blog admin&#8230;&lt;/p&gt;

&lt;p&gt;How come it evaded my attention for 3 months??!!&lt;/p&gt;

&lt;p&gt;Anyway, releasing it now thought this is all quite old news, going to announce 0.2.4 in a moment :)&lt;/p&gt;

&lt;p&gt;There is a new 0.2.2 version of astrails-safe on &lt;a href=&quot;http://github.com/astrails/safe/&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you don&#8217;t know it yet astrails-safe is an easy to use backup solution for Unix like operating systems.
It supports filesystem, mysql, postgresql, subversion backups to local filesytem, Amazon S3 and remote SFTP.&lt;/p&gt;
&lt;p&gt;The biggest change is support for SFTP as a storage option (contributed by &lt;a href=&quot;http://github.com/adam12&quot;&gt;Adam&lt;/a&gt;).
It can be used instead of or in addition to S3. Note that is is still somewhat experimental and was not tested much in production. Please report any problems in the &lt;a href=&quot;http://github.com/astrails/safe/issues&quot;&gt;issues tracker&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&#8216;local&#8217; storage option is still mandatory since S3 requires knowing the file size &lt;b&gt;before&lt;/b&gt; the upload and keeping all in memory is not a good option :).&lt;/p&gt;

&lt;p&gt;Does anyone &lt;b&gt;really&lt;/b&gt; need an option of using SFTP w/o the local storage? If so please comment and I will look into possibility of implementing it.&lt;/p&gt;

&lt;p&gt;Another change is that astrails-safe will now print timing statistics when running in a verbose mode (-v)
(contributed by &lt;a href=&quot;http://github.com/neerfri&quot;&gt;Neer&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Also another bug with rotation code was fixed (contributed by &lt;a href=&quot;http://github.com/layton&quot;&gt;Layton&lt;/a&gt;). Rotation code would mistakenly match any file starting with the name of the current backup. e.g. cleanup for &#8216;foo&#8217; would cleanup &#8216;foobar&#8217; as well. I also added a test that should have caught this bug :)&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>vitaly</name>
    </author>
    <id>tag:blog.astrails.com,2009-09-29:191</id>
    <published>2009-09-29T08:58:00Z</published>
    <updated>2009-11-16T17:57:48Z</updated>
    <category term="IT"/>
    <category term="osx"/>
    <category term="mac"/>
    <category term="osx"/>
    <category term="sudo"/>
    <category term="sudoers"/>
    <link href="http://blog.astrails.com/2009/9/29/how-to-fix-a-hosed-etc-sudoers-file-on-mac-osx" rel="alternate" type="text/html"/>
    <title>How to fix a hosed /etc/sudoers file on Mac OSX</title>
<content type="html">
            &lt;p&gt;I just did something pretty stupid. I edited /etc/sudoers file directly from within my non-root user account.&lt;/p&gt;

&lt;p&gt;I did&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo vim /etc/sudoers
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and added the following to it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Cmnd_Alias GEM_INSTALL = /usr/bin/gem install *
Cmnd_Alias GEM_UNINSTALL = /usr/bin/gem uninstall *
vitaly ALL=NOPASSWD GEM_INSTALL
vitaly ALL=NOPASSWD GEM_UNINSTALL
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The intention was to grant myself permissions to install gems w/o entering password. I know its insecure, but this is security-vs-convinience kind of thing and I only intended to leave it there for a couple of hours while I do some heavy gem development.&lt;/p&gt;

&lt;p&gt;Anyway, experienced unix users might have spotted the syntax error in my sudoers edits. I forgot the &#8220;:&#8221; just after the NOPASSWD. But the problem is even more basic then that. I shouldn&#8217;t have beed editing the file directly. I should have known better. And now I&#8217;m paying the price:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sudo
&amp;gt;&amp;gt;&amp;gt; sudoers file: syntax error, line 36 &amp;lt;&amp;lt;&amp;lt;
&amp;gt;&amp;gt;&amp;gt; sudoers file: syntax error, line 37 &amp;lt;&amp;lt;&amp;lt;
sudo: parse error in /private/etc/sudoers near line 36

$ sudo vim /etc/sudoers
&amp;gt;&amp;gt;&amp;gt; sudoers file: syntax error, line 36 &amp;lt;&amp;lt;&amp;lt;
&amp;gt;&amp;gt;&amp;gt; sudoers file: syntax error, line 37 &amp;lt;&amp;lt;&amp;lt;
sudo: parse error in /private/etc/sudoers near line 36
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;OOPS!&lt;/p&gt;

&lt;p&gt;Now the sudoers file is broken and I can&#8217;t even fix it since I was using sudo to edit it! Never do that! :) Use the visudo command. it will check the file syntax before &#8216;commiting&#8217; it.&lt;/p&gt;

&lt;p&gt;Now what?&lt;/p&gt;

&lt;p&gt;I looked at the net and the general consensus is that you need to boot into a single-user mode to fix it. I really really didn&#8217;t want to do it. I have 4G of RAM and so I&#8217;m usually running dozens of programs and its a pain to close and reopen them all after boot. I&#8217;m lazy :)&lt;/p&gt;

&lt;p&gt;Then I thought there might be a better way.&lt;/p&gt;

&lt;p&gt;First I checked the permissions on the sudoers file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
$ ls -l /etc/sudoers 
-r--r-----+ 1 root  wheel  1302 Sep 28 17:20 /etc/sudoers
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and only &#8216;root&#8217; is in the group wheel, so no luck here.&lt;/p&gt;

&lt;p&gt;I also couldn&#8217;t &#8216;su root&#8217; since my root user doesn&#8217;t have a password. duh!&lt;/p&gt;

&lt;p&gt;But then it appeared to me that I might be able to circumvent this protection by leveraging my OS X &#8216;admin&#8217; status. After all it ought to count for something :).&lt;/p&gt;

&lt;p&gt;I opened &#8220;/etc&#8221; folder in finder (&#8220;Go&#8221; -&gt; &#8220;Go to Folder&#8230;&#8221;), then opened sudoers file properties. Opening the lock there doesn&#8217;t require to be a root. Its enough to be an Admin and my Admin user does have a password! So I was easily able to grant myself permission to edit the file:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2009/9/28/Picture_3.png&quot; alt=&quot;locked&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2009/9/28/Picture_4.png&quot; alt=&quot;unlocked&quot; /&gt;&lt;/p&gt;

&lt;p&gt;after that I just edited the file with vim again to comment the edits&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;vim /etc/sudoers
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then I did what I was supposed to do from the beginning, I used the &#8216;visudo&#8217; at last:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo visudo
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Last thing was to restore original permissions on the file in finder.&lt;/p&gt;

&lt;p&gt;DONE&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>boris</name>
    </author>
    <id>tag:blog.astrails.com,2009-07-28:171</id>
    <published>2009-07-28T16:02:00Z</published>
    <updated>2009-08-09T16:34:18Z</updated>
    <category term="Astrails"/>
    <category term="JS"/>
    <link href="http://blog.astrails.com/2009/7/28/javascript-widgets-part-1-popup-popin" rel="alternate" type="text/html"/>
    <title>Javascript Widgets. Part 1. Popup/Popin Widgets.</title>
<summary type="html">&lt;p&gt;This is going to be the first part of a blog post series about javascript widgets.&lt;/p&gt;


	&lt;p&gt;First type I&#8217;m going to cover is Popup Widget. Sometimes it&#8217;s called Popin Widget because there is no actually new window that pops up, instead the content is shown IN-side a current page. The idea is quite simple: you provide some html/js snippet to other sites. They put it into relevant place, and you have some functionality of your site running there.&lt;/p&gt;


	&lt;p&gt;I&#8217;m going to explain how exactly it works, what should be done to achieve this, and what common mistakes i see once and again.&lt;/p&gt;


	&lt;p&gt;At the end of the blog post you will get a link to complete javascript library, grab it, play with it, and use it for fun or profit.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;This is going to be the first part of a blog post series about javascript widgets.&lt;/p&gt;


	&lt;p&gt;First type I&#8217;m going to cover is Popup Widget. Sometimes it&#8217;s called Popin Widget because there is no actually new window that pops up, instead the content is shown IN-side a current page. The idea is quite simple: you provide some html/js snippet to other sites. They put it into relevant place, and you have some functionality of your site running there.&lt;/p&gt;


	&lt;p&gt;I&#8217;m going to explain how exactly it works, what should be done to achieve this, and what common mistakes i see once and again.&lt;/p&gt;


	&lt;p&gt;At the end of the blog post you will get a link to complete javascript library, grab it, play with it, and use it for fun or profit.&lt;/p&gt;
&lt;h3&gt;Content.&lt;/h3&gt;

	&lt;p&gt;1. &lt;a href=&quot;#item_1&quot;&gt;Layout&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;2. &lt;a href=&quot;#item_2&quot;&gt;Cross-browser support.&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;3. &lt;a href=&quot;#item_3&quot;&gt;Global namespace.&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;4. &lt;a href=&quot;#item_4&quot;&gt;Loading javascript.&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;5. &lt;a href=&quot;#item_5&quot;&gt;UI problem with &lt;span class=&quot;caps&quot;&gt;WEDJE&lt;/span&gt;.&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;6. &lt;a href=&quot;#item_6&quot;&gt;Never slow down target site.&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;7. &lt;a href=&quot;#item_7&quot;&gt;Using of js frameworks.&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;8. &lt;a href=&quot;#item_8&quot;&gt;Random div ids.&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;9. &lt;a href=&quot;#item_9&quot;&gt;Passing parameters to the script.&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;10. &lt;a href=&quot;#item_10&quot;&gt;Loading, please wait…&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;11. &lt;a href=&quot;#item_11&quot;&gt;Pop up the popup.&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;12. &lt;a href=&quot;#item_12&quot;&gt;&lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;/JS snippet.&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;13. &lt;a href=&quot;#item_13&quot;&gt;Passing referrer.&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;14. &lt;a href=&quot;#item_14&quot;&gt;&lt;span class=&quot;caps&quot;&gt;YUI&lt;/span&gt; compressor&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;15. &lt;a href=&quot;#item_15&quot;&gt;Getting things together.&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;16. &lt;a href=&quot;#item_16&quot;&gt;Example&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Ok, less talk, more work. If you don&#8217;t have a time and strong will to read my thoughts about the approach, scroll to the last part &lt;a href=&quot;#item_15&quot;&gt;15. Getting things together&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;1. Layout.&lt;/h3&gt;&lt;/p&gt;


	&lt;p&gt;The main idea is very simple. Let&#8217;s call a site that have your widget &#8211; &#8220;target&#8221;.
You add one or more divs to the end of target document, and they hold an iframe. Ifame content comes from your site. Once user clicks some button you show a div and bring relevant iframe content. Once user click some &#8220;close&#8221; link, you hide this div together with iframe. Actually it&#8217;s likely to remove iframe completely, I will talk about this later.&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;2. Cross-browser support.&lt;/h3&gt;&lt;/p&gt;


	&lt;p&gt;Well, there is nothing more to say about it. Your code should work with all grade-A browsers, meaning FF, Safari, &lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt;/8 and Opera.&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;3. Global namespace.&lt;/h3&gt;&lt;/p&gt;


Since we&#8217;re going to put our javascript into 3rd party website, we should not spam javascript namespace with our own variables and functions. That&#8217;s why I personally dislike Google approach with setting global variables like 
&lt;pre class=&quot;ruby&quot;&gt;&lt;code class=&quot;javascript&quot;&gt;
google_ad_client = &quot;12345&quot;;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;4. Loading javascript.&lt;/h3&gt;&lt;/p&gt;


	&lt;p&gt;It&#8217;s good idea to have static javascript that can be cached, or even loaded from Amazon S3. If you think you have to generate javascript dynamically, most probably you&#8217;re doing smth wrong and have to review your architecture.
There are 2 different ways to load external javascript: syncronous, and asyncronous (which sometimes called &lt;a href=&quot;http://www.mikeindustries.com/blog/archive/2007/06/widget-deployment-with-wedje&quot;&gt;&lt;span class=&quot;caps&quot;&gt;WEDJE&lt;/span&gt;&lt;/a&gt; &#8211; Widget Enabled &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; Javascript Embedding).&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;5. UI problem with &lt;span class=&quot;caps&quot;&gt;WEDJE&lt;/span&gt;.&lt;/h3&gt;&lt;/p&gt;


	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;WEDJE&lt;/span&gt; approach is the right one for most cases because your javascript doesn&#8217;t slow down the target site. But since we have to bind some button click event with our code, there is a chance that user will click this button before our js code is loaded in a asyncronous way. And that&#8217;s not good. That&#8217;s why this approach is not applicable here, at least it&#8217;s not applicable without modifications.&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;6. Never slow down target site.&lt;/h3&gt;&lt;/p&gt;


	&lt;p&gt;Since &lt;span class=&quot;caps&quot;&gt;WEDJE&lt;/span&gt; approach is not applicable here, we have to go with syncronous way of loading assets. Once you include javascript into a web page, browser stops loading everything else until it loads and runs this javascript. It means that if your site is down and doesn&#8217;t respond to requests, target site will be frozen until the browser figures this out and times out. In other words, if your site is down &#8211; you hurt the target site.&lt;/p&gt;


	&lt;p&gt;It might be tempting to put your javascript on some cloud storage solution, like &lt;a href=&quot;http://aws.amazon.com/s3&quot;&gt;Amazon S3&lt;/a&gt; together with all your other assets. But there is a problem with it. See, S3 doesn&#8217;t support &lt;span class=&quot;caps&quot;&gt;HTTPS&lt;/span&gt; protocol. And if someone will want to use your widget on secure site it will work, but with nasty &#8220;secure/insecure content&#8221; message. Not nice. So please allow &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;HTTPS&lt;/span&gt; access to your widget, it&#8217;s really annoying to find useful widget and not use because of lack of support for &lt;span class=&quot;caps&quot;&gt;HTTPS&lt;/span&gt; (&lt;a href=&quot;http://www.feedburner.com/&quot;&gt;Feedburner&lt;/a&gt;, i&#8217;m looking at you).&lt;/p&gt;


	&lt;p&gt;Update: see Dubek&#8217;s comment below about S3 and &lt;span class=&quot;caps&quot;&gt;HTTPS&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;7. Using of js frameworks.&lt;/h3&gt;&lt;/p&gt;


	&lt;p&gt;Short answer is: no. Long answer is: never ever even try. Since we&#8217;re writing a widget, we are doing something that adds a value to a target site. Target site worked without our widget before and will keep working without it in a future. That&#8217;s why we should be modest here. Modest as in &lt;span class=&quot;caps&quot;&gt;NOT&lt;/span&gt; bringing 100K of framework to use 3.5 functions from it. We have no choice &#8211; need to implement these functions by ourselves. Here is the short list of functions we need: get element by id, show element, hide element, remove element. Right, &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; has it, but who will write document.getElementById serveral times? It takes time to write and takes bytes to load :-)&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;8. Random div ids.&lt;/h3&gt;&lt;/p&gt;


	&lt;p&gt;To avoid problems with similar ids on a page, I&#8217;d suggest to generarte random ids for the elements we&#8217;re going to add to the page. Check out rnd(...) function in the example code.&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;9. Passing parameters to the script.&lt;/h3&gt;&lt;/p&gt;


As i mentioned above, I think it&#8217;s a good idea to avoid spamming the javascript namespace. So, to pass parameters to the script we need to add them into script &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;, and than parse from the script itself, ie.
&lt;pre class=&quot;ruby&quot;&gt;&lt;code class=&quot;javascript&quot;&gt;
 .../mywidget.js?key1=value1&#38;key2=value2
&lt;/code&gt;&lt;/pre&gt;
Once script is loaded, it finds itself in a &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; tree, parses parameters and passes them as-is to the iframe &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; defined in opts.iframe_base_url. See &#8220;detecting protocol and parameters&#8221; section of the code for more detalis.

	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;10. Loading, please wait&#8230;&lt;/h3&gt;&lt;/p&gt;


	&lt;p&gt;Some of the widgets we see on internet doesn&#8217;t provide a visual feedback to users about what&#8217;s going on. While iframe is being loaded users see only dark backgorund, when browser starts loading the iframe users see some white background. That&#8217;s not good. We need to provide some visual feedback like &#8220;Loading, please wait&#8230;&#8221; until the iframe is completely loaded. That&#8217;s is done by binding to &#8220;onload&#8221; event of the iframe and switching the iframe&#8217;s and &#8220;loading&#8230;&#8221; div&#8217;s &#8220;display&#8221; styles. Please pay attention on opts.close_image and opts.loading_image parameters at the beginning of the script.&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;11. Pop up the popup.&lt;/h3&gt;&lt;/p&gt;


	&lt;p&gt;There are serveral approaches here.&lt;/p&gt;


	&lt;p&gt;1. user put a link/button in any place he likes, and passes it&#8217;s &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; id to the script to allow us binding to its click-event;&lt;/p&gt;


	&lt;p&gt;2. we create a link/button in a place that user includes the script.&lt;/p&gt;


The first one is a quite rare approach because it requires more coding on a user side. But you can still use it If you&#8217;re a writing a widget for your own site. In such a case you could pass parameter to the javascript as mentioned in &lt;a href=&quot;#item_9&quot;&gt;9. Passing parameters to the script.&lt;/a&gt;, parse it in jasvascript and call bind(...) function:
&lt;pre class=&quot;ruby&quot;&gt;&lt;code class=&quot;javascript&quot;&gt;
bind(&quot;my_parsed_elelemt_id&quot;, &quot;click&quot;, function(){show_widget(); return false});        
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;The second one is the one we&#8217;re going to implement and use.
We create fancy image that will serve as a link to show the popup and define it in opts.button_image, don&#8217;t forget to avoid defining protocol there.&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;12. &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;/JS snippet.&lt;/h3&gt;&lt;/p&gt;


You should share with your users a snippet. Here it is:
&lt;pre class=&quot;ruby&quot;&gt;&lt;code class=&quot;javascript&quot;&gt;
&amp;lt;script type='text/javascript'&amp;gt;
  document.write(unescape(&quot;%3Cscript src='&quot; + (&quot;https:&quot; == document.location.protocol ? &quot;https&quot; : &quot;http&quot;) + &quot;://assets.astrails.com/popup-assests/astrails-widget.js?q=wow' type='text/javascript'%3E%3C/script%3E&quot;));
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;The snippet will actually embed a button and bind all the events. Pay attention that we pass q=wow parameter to the script, your server-side part of a widget will get this parameter. You can pass anything you want in those parameters.&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;13. Passing referrer.&lt;/h3&gt;&lt;/p&gt;


	&lt;p&gt;Since we open server-side part of a widget in a iframe, sever-side script will not obtain &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt;_REFERRER value. We need to pass it manually in request &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;. Take a look at &#8220;detecting protocol and parameters&#8221; section of the code for more details.&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;14. &lt;span class=&quot;caps&quot;&gt;YUI&lt;/span&gt; compressor&lt;/h3&gt;&lt;/p&gt;


	&lt;p&gt;To finally distribute your code use &lt;a href=&quot;http://developer.yahoo.com/yui/compressor/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;YUI&lt;/span&gt; Compressor&lt;/a&gt;, it could reduce a downloadable code size.&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;15. Getting things together.&lt;/h3&gt;&lt;/p&gt;


	&lt;p&gt;1. &lt;a href=&quot;http://github.com/astrails/popup-widget/tree/master&quot;&gt;Grab&lt;/a&gt; the code from &lt;a href=&quot;http://github.com/astrails/popup-widget/tree/master&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;2. Open astrails-widget.js, and change values of hash &#8220;opts&#8221; to point to your URLs and adjust iframe sizes.&lt;/p&gt;


	&lt;p&gt;3. Read &lt;a href=&quot;#item_6&quot;&gt;6. Never slow down target site.&lt;/a&gt; if you haven&#8217;t already. If you will take only one thing from this article, make it this one.&lt;/p&gt;


	&lt;p&gt;4. Compress the script with &lt;span class=&quot;caps&quot;&gt;YUI&lt;/span&gt; compressor (&lt;a href=&quot;#item_14&quot;&gt;14. &lt;span class=&quot;caps&quot;&gt;YUI&lt;/span&gt; compressor&lt;/a&gt;).&lt;/p&gt;


	&lt;p&gt;5. Upload compressed script to the location defined in opts.js_url.&lt;/p&gt;


	&lt;p&gt;6. Copy-paste a snippet from &lt;a href=&quot;#item_12&quot;&gt;12. &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;/JS snippet.&lt;/a&gt;, add parameters you need on the server side to the javascript &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;8. Write the server part refered by opts.iframe_base_url.&lt;/p&gt;


	&lt;p&gt;9. Give this snippet to your users.&lt;/p&gt;


	&lt;p&gt;10. Enjoy.&lt;/p&gt;


	&lt;p&gt;&lt;a&gt;&lt;/a&gt;
&lt;h3&gt;16. Example&lt;/h3&gt;
Click the button below to see it in action.
&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;


&lt;p&gt;&lt;br /&gt;&lt;/p&gt;


	&lt;p&gt;In a next part i will try cover so called Embedded Widgets.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>michael</name>
    </author>
    <id>tag:blog.astrails.com,2009-06-03:160</id>
    <published>2009-06-03T14:43:00Z</published>
    <updated>2009-06-04T12:59:50Z</updated>
    <category term="Rails"/>
    <link href="http://blog.astrails.com/2009/6/3/clicktale-rails-better-usability" rel="alternate" type="text/html"/>
    <title>Clicktale + Rails = Better Usability</title>
<summary type="html">&lt;p&gt;&lt;a href=&quot;http://clicktale.com&quot;&gt;Clicktale&lt;/a&gt; is a service that allows you to record and later playback behavior of your users while they are using your site. And Rails is &lt;a href=&quot;http://rubyonrails.org&quot;&gt;Rails&lt;/a&gt;, you know. And those two are getting along just fine, until the user logs in. After that clicktale service is cut out of the html pages this user gets and can&#8217;t record the session. But it just started to get interesting&#8230;&lt;/p&gt;

&lt;p&gt;This &lt;a href=&quot;http://github.com/astrails/clicktale/tree/master&quot;&gt;plugin&lt;/a&gt; brings back the connection between Clicktale and Rails even for those closed pages. You&#8217;re going to get your better usability after all.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;&lt;a href=&quot;http://clicktale.com&quot;&gt;Clicktale&lt;/a&gt; is a service that allows you to record and later playback behavior of your users while they are using your site. And Rails is &lt;a href=&quot;http://rubyonrails.org&quot;&gt;Rails&lt;/a&gt;, you know. And those two are getting along just fine, until the user logs in. After that clicktale service is cut out of the html pages this user gets and can&#8217;t record the session. But it just started to get interesting&#8230;&lt;/p&gt;

&lt;p&gt;This &lt;a href=&quot;http://github.com/astrails/clicktale/tree/master&quot;&gt;plugin&lt;/a&gt; brings back the connection between Clicktale and Rails even for those closed pages. You&#8217;re going to get your better usability after all.&lt;/p&gt;
&lt;h3&gt;Clicktale&lt;/h3&gt;

&lt;p&gt;Clicktale is nice. I suggest you to head over to &lt;a href=&quot;http://clicktale.com&quot;&gt;their site&lt;/a&gt; and check out the short(1:15) promotional video they have to get a feeling of what they do.&lt;/p&gt;

&lt;p&gt;It records user sessions, allows form optimization by showing how much users drop out on any form field, does landing page optimization and other goodness.&lt;/p&gt;

&lt;p&gt;Anyways, i find it very useful. It should be installed from the very first users new service is starting to get. It is an easy way to approximate field usability testing. It doesn&#8217;t replace the actual usability testing, but it is as close as you get without dragging yourself from the comfort of your &lt;a href=&quot;http://en.wikipedia.org/wiki/Aeron_chair&quot;&gt;Aeron chair&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Bottom line is that can help you make lives of your users a bit easier.&lt;/p&gt;

&lt;p&gt;They are on pricey side of the internet with cheapest plan at $99/month, but they have a free plan. Very limited, but enough to see what it is about.&lt;/p&gt;

&lt;h3&gt;Rails Integration&lt;/h3&gt;

&lt;p&gt;I was really disappointed to find out that in our rails projects i could record user sessions only on outer parts of the site.&lt;/p&gt;

&lt;p&gt;You see, clicktale works by combining two sides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A small javascript snippet inserted into your rendered page to record user behavior&lt;/li&gt;
&lt;li&gt;A copy of rendered HTML that clicktale stores on it&#8217;s servers to allow playback of recorded user actions on top of it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, the first part in not a problem. The second part is. When a user hides behind a login, clicktale is no longer able to get the HTML. So it still knows where user clicks and where the mouse was moved, but this information is useless without the actual page your user sees at this moment.&lt;/p&gt;

&lt;p&gt;To continue to enjoy the &#8220;big brother&#8221; feeling even after users log in, we need to supply this HTML to clicktale. Fortunately clicktailers allowed this by adding an option to their javascript to provide a URL to this HTML file that is different from the current page&#8217;s URL.&lt;/p&gt;

&lt;p&gt;To close this circle, i use rails caching mechanism to store rendered page on the disk, and handle a path to the resulted file to clicktale.&lt;/p&gt;

&lt;h3&gt;Ok, nice, now how do i&#8230;&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Install the plugin&lt;br /&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;./script/plugin install git://github.com/astrails/clicktale.git&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Head to &lt;a href=&quot;http://clicktale.com&quot;&gt;http://clicktale.com&lt;/a&gt; and signup for a free account. Or not free. Your choice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get a tracking code from clicktale. It should look something like this:&lt;pre class=&quot;ruby&quot;&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;small&gt;&amp;lt;!-- ClickTale Bottom part --&amp;gt;
&amp;lt;div id=&amp;quot;ClickTaleDiv&amp;quot; style=&amp;quot;display: none;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;script src=&amp;quot;http://s.clicktale.net/WRb.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
  if(typeof ClickTale==&amp;#x27;function&amp;#x27;) ClickTale(&amp;lt;u&gt;&lt;strong&gt;&amp;lt;project_id&amp;gt;&lt;/strong&gt;,&lt;strong&gt;&amp;lt;ratio&amp;gt;&lt;/strong&gt;,&lt;strong&gt;&amp;lt;param&amp;gt;&lt;/strong&gt;&amp;lt;/u&gt;);
&amp;lt;/script&amp;gt;
&amp;lt;!-- ClickTale end of Bottom part --&amp;gt;
&lt;/small&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Replace &lt;code&gt;project_id&lt;/code&gt;, &lt;code&gt;ratio&lt;/code&gt; and &lt;code&gt;param&lt;/code&gt; in the autogenerated config/clicktale.yml with values from clicktale tracking code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add clicktale partials into layout inside the ‘body’ tag:&lt;br /&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&amp;lt;body&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;lt;%= clicktale_top %&amp;gt;
&amp;nbsp;&amp;nbsp;...
&amp;nbsp;&amp;nbsp;&amp;lt;%= yield %&amp;gt;
&amp;nbsp;&amp;nbsp;...
&amp;nbsp;&amp;nbsp;&amp;lt;%= clicktale_bottom %&amp;gt;
&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add a cron job(crontab -e, right?) that will take care of the old cached files&lt;br /&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;*/30 * * * * find /path/to/your/application/public/clicktale/ -type f -mmin +30 -exec rm {} \;
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The plugin works by leveraging rails caching mechanism, which is by default only enabled in production environment. To enable the plugin in the development environment do the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;set enabled=true in config/clicktale.yml (development section)&lt;/li&gt;
&lt;li&gt;set config.action_controller.perform_caching=true in config/environments/development.rb&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Another Note:&lt;/strong&gt; As of this writing, clicktale service ignores existance of Safari browser. I hope it will someday.&lt;/p&gt;

&lt;h3&gt;Options&lt;/h3&gt;

&lt;p&gt;Not much for now. But you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add clicktale method on class level in your controller to change the clicktale project for specific controller&lt;br /&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;class UsersController &amp;lt; ApplicationController
&amp;nbsp;&amp;nbsp;clicktale :project_id =&amp;gt; ANOTHER_PROJECT_ID
&amp;nbsp;&amp;nbsp;...
end
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Call the same method to tag this controller&#8217;s actions in clicktale records&lt;br /&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;class UsersController &amp;lt; ApplicationController
&amp;nbsp;&amp;nbsp;clicktale :project_id =&amp;gt; ANOTHER_PROJECT_ID, :tag =&amp;gt; :specific_tag
&amp;nbsp;&amp;nbsp;...
end
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;You can call the same method with same parameters on the action level to control project id and tag for this specific action&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Where&#8217;s everything&lt;/h3&gt;

&lt;p&gt;The code is on &lt;a href=&quot;http://github.com/astrails/clicktale/tree/master&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Please submit issues also to &lt;a href=&quot;http://github.com/astrails/clicktale/issues&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As always, suggestions are welcome, code contributions are even more welcome.&lt;/p&gt;

&lt;p&gt;Now, go see what your users are doing.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>vitaly</name>
    </author>
    <id>tag:blog.astrails.com,2009-05-22:161</id>
    <published>2009-05-22T11:40:00Z</published>
    <updated>2009-08-23T14:30:25Z</updated>
    <category term="astrails-safe"/>
    <category term="Ruby"/>
    <category term="backup"/>
    <category term="bug"/>
    <category term="s3"/>
    <link href="http://blog.astrails.com/2009/5/22/astrails-safe-0-1-9-bugfix-release" rel="alternate" type="text/html"/>
    <title>Astrails-safe: 0.1.9 - BUGFIX release</title>
<content type="html">
            &lt;p&gt;I just pushed new version 0.1.9 of &lt;a href=&quot;http://github.com/astrails/safe&quot;&gt;astrails-safe&lt;/a&gt; to github.&lt;/p&gt;

&lt;p&gt;The main difference is a fix to an embarrassing bug in the S3 backup rotation code.
Thanks to Thuvarakan Tharmalingam for reporting.&lt;/p&gt;

&lt;p&gt;Again, the reason it escaped was the fact that we don't yet have full test coverage.
We are getting there though....&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://blog.astrails.com/">
    <author>
      <name>vitaly</name>
    </author>
    <id>tag:blog.astrails.com,2009-05-21:159</id>
    <published>2009-05-21T01:47:00Z</published>
    <updated>2009-08-23T14:30:18Z</updated>
    <category term="astrails-safe"/>
    <category term="IT"/>
    <category term="Ruby"/>
    <category term="amazon"/>
    <category term="astrails"/>
    <category term="backup"/>
    <category term="encryption"/>
    <category term="s3"/>
    <category term="safe"/>
    <link href="http://blog.astrails.com/2009/5/21/postgress-and-svndump-support-for-astrails-safe-s3-backup" rel="alternate" type="text/html"/>
    <title>PostgreSQL and Subversion support for astrails-safe s3 backup</title>
<summary type="html">&lt;p&gt;It looks like our astrails-safe gem is quite popular :). People started to contribute new features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://github.com/markmansour&quot;&gt;Mark Mansour&lt;/a&gt; contributed PostgreSQL backup support&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://github.com/tangofoxtrot&quot;&gt;Richard Luther&lt;/a&gt; contributed Subversion repository dump support&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I just released new version 0.1.8 on the &lt;a href=&quot;http://github.com/astrails/safe/tree/master&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In addition to postgre/svn support this release also includes a long overdue test suite.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;It looks like our astrails-safe gem is quite popular :). People started to contribute new features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://github.com/markmansour&quot;&gt;Mark Mansour&lt;/a&gt; contributed PostgreSQL backup support&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://github.com/tangofoxtrot&quot;&gt;Richard Luther&lt;/a&gt; contributed Subversion repository dump support&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I just released new version 0.1.8 on the &lt;a href=&quot;http://github.com/astrails/safe/tree/master&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In addition to postgre/svn support this release also includes a long overdue test suite.&lt;/p&gt;
&lt;p&gt;Note: I personally don&#8217;t use Subversion or PostgreSQL so I can&#8217;t actually test it. 
If you use it you can now easily backup it to local filesystem or Amazon S3 and if you find any problem
please report &lt;a href=&quot;http://github.com/astrails/safe/issues&quot;&gt;here&lt;/a&gt; ;-)&lt;/p&gt;

&lt;p&gt;If you don&#8217;t know what is astrails-safe, you can read the original &lt;a href=&quot;/2009/4/6/simple-backups-can-be-simple&quot;&gt;announcement&lt;/a&gt;. In a nutshell its a simple backup script that supports file backups (with tar),
MySQL backup (with mysqldump), PostgreSQL backup (with pg_dump) and Subversion backup (with &#8220;svnadmin dump&#8221;),
all that with GPG encryption and backup rotation and Amazon S3 support.&lt;/p&gt;

&lt;p&gt;See &lt;a href=&quot;http://github.com/astrails/safe/blob/master/README.markdown&quot;&gt;README&lt;/a&gt; for installation instructions.&lt;/p&gt;

&lt;p&gt;The backup can be configured in minutes, so now you don&#8217;t have the excuse not to do it ;-).&lt;/p&gt;
          </content>  </entry>
</feed>
