<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CodeWord: Apokalyptik &#187; Ruby (on or off) Rails</title>
	<atom:link href="http://blog.apokalyptik.com/category/ruby-on-or-off-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.apokalyptik.com</link>
	<description>The random things that spew forth from my brain...</description>
	<lastBuildDate>Tue, 27 Dec 2011 17:43:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19620</generator>
		<item>
		<title>Time based bloom filters</title>
		<link>http://blog.apokalyptik.com/2010/01/06/time-based-bloom-filters/</link>
		<comments>http://blog.apokalyptik.com/2010/01/06/time-based-bloom-filters/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 04:29:56 +0000</pubDate>
		<dc:creator>apokalyptik</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Random Thoughts]]></category>
		<category><![CDATA[Ruby (on or off) Rails]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[SRSLY]]></category>

		<guid isPermaLink="false">http://blog.apokalyptik.com/?p=498</guid>
		<description><![CDATA[I find this concept fascinating and plan to investigate further down this road.]]></description>
			<content:encoded><![CDATA[<p>I find <a href="http://www.igvita.com/2010/01/06/flow-analysis-time-based-bloom-filters/">this concep</a>t fascinating and plan to investigate further down this road.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.apokalyptik.com/2010/01/06/time-based-bloom-filters/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Howto: Enable regular expression highlighting in LimeChat</title>
		<link>http://blog.apokalyptik.com/2009/10/06/howto-enable-regular-expression-highlighting-in-limechat/</link>
		<comments>http://blog.apokalyptik.com/2009/10/06/howto-enable-regular-expression-highlighting-in-limechat/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 18:25:03 +0000</pubDate>
		<dc:creator>apokalyptik</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Ruby (on or off) Rails]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://blog.apokalyptik.com/?p=464</guid>
		<description><![CDATA[in LimeChat.app/Contents/Resources/logrenderer.rb around line 419&#8230; WFM. IANAL. YMMV. RTFM. OMGWTF. WTL. GTFO. ETC. words.each do &#124;w&#124; next if w.empty? s = body offset = 0 # rex = Regexp.new(w, true) # while rex =~ s # begin # left = $~.begin(0) right = $~.end(0) pre = $~.pre_match post = $~.post_match ok = true if exact_word_match [...]]]></description>
			<content:encoded><![CDATA[<p>in LimeChat.app/Contents/Resources/logrenderer.rb around line 419&#8230; WFM. IANAL. YMMV. RTFM. OMGWTF. WTL. GTFO. ETC.</p>
<pre lang="ruby">
    words.each do |w|
      next if w.empty?
      s = body
      offset = 0
# <edit was="rex = Regexp.new(Regexp.escape(w), true)">
      rex = Regexp.new(w, true)
# </edit>
      while rex =~ s
# <edit>
        begin
# </edit>
          left = $~.begin(0)
          right = $~.end(0)
          pre = $~.pre_match
          post = $~.post_match
          ok = true

          if exact_word_match
            if !pre.empty? &#038;&#038; alphabetic?(w.first_char) &#038;&#038; alphabetic?(pre.last_char)
              ok = false
            elsif !post.empty? &#038;&#038; alphabetic?(w.last_char) &#038;&#038; alphabetic?(post.first_char)
              ok = false
            end
          end

          if ok
            keywords < < { :pos => offset+left, :len => right-left }
          end
          s = post
          offset += right
# <edit>
        rescue
          next
        end
# </edit>
      end
    end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.apokalyptik.com/2009/10/06/howto-enable-regular-expression-highlighting-in-limechat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It&#8217;s good for the server.  It&#8217;s good for the soul.</title>
		<link>http://blog.apokalyptik.com/2007/12/12/its-good-for-the-server-its-good-for-the-soul/</link>
		<comments>http://blog.apokalyptik.com/2007/12/12/its-good-for-the-server-its-good-for-the-soul/#comments</comments>
		<pubDate>Wed, 12 Dec 2007 21:53:49 +0000</pubDate>
		<dc:creator>apokalyptik</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby (on or off) Rails]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web Stuff]]></category>

		<guid isPermaLink="false">http://blog.apokalyptik.com/2007/12/12/its-good-for-the-server-its-good-for-the-soul/</guid>
		<description><![CDATA[ack (http://petdance.com/ack/), love it (thanks nikolay)]]></description>
			<content:encoded><![CDATA[<p><a href="http://petdance.com/ack/" target="_blank">ack (http://petdance.com/ack/)</a>, love it (thanks nikolay)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.apokalyptik.com/2007/12/12/its-good-for-the-server-its-good-for-the-soul/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autumn Leaves Leaf #3: Commander</title>
		<link>http://blog.apokalyptik.com/2007/10/03/autumn-leaves-leaf-3-commander/</link>
		<comments>http://blog.apokalyptik.com/2007/10/03/autumn-leaves-leaf-3-commander/#comments</comments>
		<pubDate>Thu, 04 Oct 2007 02:41:31 +0000</pubDate>
		<dc:creator>apokalyptik</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby (on or off) Rails]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web Stuff]]></category>

		<guid isPermaLink="false">http://blog.apokalyptik.com/2007/10/03/autumn-leaves-leaf-3-commander/</guid>
		<description><![CDATA[This leaf is capable of running a script on the local server in response to the !deploy channel command. For security you have to authenticate first. To do so you send it a message with a password. it then it http authenticates against a specific url with your nickname and the mesage text as the [...]]]></description>
			<content:encoded><![CDATA[<p>This leaf is capable of running a script on the local server in response to the !deploy channel command.  For security you have to authenticate first.  To do so you send it a message with a password. it then it http authenticates against a specific url with your nickname and the mesage text as the password.  If the file fetched matches predesignated contents then you are added to the internal ACL.  Anyone in the ACL can run the !deploy command.  If you leave the chan, join the chan, change nicks, or quit irc you will be removed from the ACL and have to re-authenticate.  This could be adapted to any system command for any purpose. I ended up not needing this leaf; I still wanted to put it out there since its functional and useful.</p>
<pre lang="ruby">
require 'net/http'
require 'net/https'

class Commander < AutumnLeaf

  before_filter :authenticate, <img src='http://blog.apokalyptik.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nly => [ :reload, :sync, :quit, :deploy ]
  $authenticated = []

  def authenticate_filter(sender, channel, command, msg, options)
    return true if $authenticated.include?(sender)
    return false
  end

  def did_receive_private_message(sender, msg)
    # assumes there is a file at
    # http://my.svnserver.com/svn/access
    # whose contents are "granted"
    Net::HTTP.start('my.svnserver.com') {|http|
      req = Net::HTTP::Get.new('/svn/access');
      req.basic_auth(sender, msg)
      response = http.request(req)
      $authenticated < < sender if response.body == "granted"
    }
  end

  def someone_did_quit(sender, msg)
    $authenticated.delete(sender)
  end

  def someone_did_leave_channel(sender, channel)
    $authenticated.delete(sender)
  end

  def someone_did_join_channel(sender, channel)
    $authenticated.delete(sender)
  end

  def deploy_command(sender, channel, text)
    message "deploying..."
    system("sudo /usr/local/bin/deploy.sh 1>/dev/null 2>/dev/null")
   end

end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.apokalyptik.com/2007/10/03/autumn-leaves-leaf-3-commander/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autumn Leaves Leaf #2: Feeder</title>
		<link>http://blog.apokalyptik.com/2007/10/02/autumn-leaves-leaf-2-feeder/</link>
		<comments>http://blog.apokalyptik.com/2007/10/02/autumn-leaves-leaf-2-feeder/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 20:52:15 +0000</pubDate>
		<dc:creator>apokalyptik</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Random Thoughts]]></category>
		<category><![CDATA[Ruby (on or off) Rails]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://blog.apokalyptik.com/2007/10/02/autumn-leaves-leaf-2-feeder/</guid>
		<description><![CDATA[This handy little bot keeps track of RSS feeds, and announces in the channel when one is updated. (note: be sure to edit the path to the datafiles) Each poller runs inside its own ruby thread, and can be run on its own independent schedule require 'thread' require 'rss/1.0' require 'rss/2.0' require 'open-uri' require 'fileutils' [...]]]></description>
			<content:encoded><![CDATA[<p>This handy little bot keeps track of RSS feeds, and announces in the channel when one is updated. (note: be sure to edit the path to the datafiles) Each poller runs inside its own ruby thread, and can be run on its own independent schedule</p>
<pre lang="ruby">
require 'thread'
require 'rss/1.0'
require 'rss/2.0'
require 'open-uri'
require 'fileutils'
require 'digest/md5'

class Feeder &lt; AutumnLeaf

def watch_feed(url, title, sleepfor=300)
  message "Watching (#{title}) [#{url}] every #{sleepfor} seconds"
  feedid = Digest::MD5.hexdigest(title)
  Thread.new {
    while true
      begin
        content = ""
        open(url) { |s|
          content = s.read
        }
        rss = RSS::Parser.parse(content, false)
        rss.items.each { |entry|
          digest = Digest::MD5.hexdigest(entry.title)
          if !File.exist?("/tmp/.rss.#{feedid}.#{digest}")
            FileUtils.touch("/tmp/.rss.#{feedid}.#{digest}")
            message "#{entry.title} (#{title}) #{entry.link}"
          end
          sleep(2)
        }
      rescue
        sleep(2)
      end
      sleep(sleepfor)
    end
  }
  sleep(1)
end

def did_start_up
  watch_feed("http://planet.wordpress.org/rss20.xml", "planet", 600)
  watch_feed("http://wordpress.com/feed/", "wpcom", 300)
end

end</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.apokalyptik.com/2007/10/02/autumn-leaves-leaf-2-feeder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autumn Leaves Leaf #1: Announcer</title>
		<link>http://blog.apokalyptik.com/2007/10/02/autumn-leaves-leaf-1-announcer/</link>
		<comments>http://blog.apokalyptik.com/2007/10/02/autumn-leaves-leaf-1-announcer/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 20:48:25 +0000</pubDate>
		<dc:creator>apokalyptik</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Random Thoughts]]></category>
		<category><![CDATA[Ruby (on or off) Rails]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web Stuff]]></category>

		<guid isPermaLink="false">http://blog.apokalyptik.com/2007/10/02/autumn-leaves-leaf-1-announcer/</guid>
		<description><![CDATA[This bot is perfect for anything where you need to easily build IRC channel notifications into an existing process. It&#8217;s simple, clean, and agnostic. Quite simply you connect to a TCP port, give it one line, the port closes, the line given shows up in the channel. eg: echo &#8216;hello&#8217; &#124; nc -q 1 bothost [...]]]></description>
			<content:encoded><![CDATA[<p>This bot is perfect for anything where you need to easily build IRC channel notifications into an existing process. It&#8217;s simple, clean, and agnostic. Quite simply you connect to a TCP port, give it one line, the port closes, the line given shows up in the channel.  eg: <strong>echo &#8216;hello&#8217; | nc -q 1 bothost 22122</strong></p>
<pre lang="ruby">
require 'socket'
require 'thread'

class Announcer &lt; AutumnLeaf

        def handle_incoming(sock)
                Thread.new {
                line = sock.gets
                message line
                sock.close
                }
        end

        def did_start_up
                Thread.new {
                        listener = TCPServer.new('',22122)
                        while (new_socket = listener.accept)
                                handle_incoming(new_socket)
                        end
                }
        end

end</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.apokalyptik.com/2007/10/02/autumn-leaves-leaf-1-announcer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autumn Leaves (a ruby framework for IRC bots)</title>
		<link>http://blog.apokalyptik.com/2007/10/02/autumn-leaves-a-ruby-framework-for-irc-bots/</link>
		<comments>http://blog.apokalyptik.com/2007/10/02/autumn-leaves-a-ruby-framework-for-irc-bots/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 20:44:19 +0000</pubDate>
		<dc:creator>apokalyptik</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby (on or off) Rails]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web Stuff]]></category>

		<guid isPermaLink="false">http://blog.apokalyptik.com/2007/10/02/autumn-leaves-a-ruby-framework-for-irc-bots/</guid>
		<description><![CDATA[What an awesome awesome thing for people who use IRC in their day to day lives!  I&#8217;ll post a couple of utility leaves here real quick. Link: http://www.shutupgeorge.com/al-docs/]]></description>
			<content:encoded><![CDATA[<p>What an awesome awesome thing for people who use IRC in their day to day lives!  I&#8217;ll post a couple of utility leaves here real quick.</p>
<p>Link: <a href="http://www.shutupgeorge.com/al-docs/" target="_blank">http://www.shutupgeorge.com/al-docs/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.apokalyptik.com/2007/10/02/autumn-leaves-a-ruby-framework-for-irc-bots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ruby-Mapquest Release v0.003</title>
		<link>http://blog.apokalyptik.com/2007/02/17/ruby-mapquest-release-v0003/</link>
		<comments>http://blog.apokalyptik.com/2007/02/17/ruby-mapquest-release-v0003/#comments</comments>
		<pubDate>Sat, 17 Feb 2007 22:59:50 +0000</pubDate>
		<dc:creator>apokalyptik</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[Geospacial]]></category>
		<category><![CDATA[Ruby (on or off) Rails]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web Stuff]]></category>

		<guid isPermaLink="false">http://blog.apokalyptik.com/2007/02/17/ruby-mapquest-release-v0003/</guid>
		<description><![CDATA[Primarily a bugfix release.  Catch it here:]]></description>
			<content:encoded><![CDATA[<p>Primarily a bugfix release.  Catch it <a href="http://blog.apokalyptik.com/ruby-mapquest/">here</a>:</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.apokalyptik.com/2007/02/17/ruby-mapquest-release-v0003/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ruby-Mapquest Release v0.002</title>
		<link>http://blog.apokalyptik.com/2007/02/13/ruby-mapquest-release-v0002/</link>
		<comments>http://blog.apokalyptik.com/2007/02/13/ruby-mapquest-release-v0002/#comments</comments>
		<pubDate>Wed, 14 Feb 2007 04:57:33 +0000</pubDate>
		<dc:creator>apokalyptik</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Geospacial]]></category>
		<category><![CDATA[Ruby (on or off) Rails]]></category>
		<category><![CDATA[Web Stuff]]></category>

		<guid isPermaLink="false">http://blog.apokalyptik.com/2007/02/13/ruby-mapquest-release-v0002/</guid>
		<description><![CDATA[Welcome: ruby-Mapquest v0.002.  Wherein I&#8217;ve added support for routing (directions.)  Let me tell you that getting the info together for this was *NOT* a pretty picture&#8230;]]></description>
			<content:encoded><![CDATA[<p>Welcome: <a href="http://blog.apokalyptik.com/ruby-mapquest/">ruby-Mapquest</a> v0.002.  Wherein I&#8217;ve added support for routing (directions.)  Let me tell you that getting the info together for this was *NOT* a pretty picture&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.apokalyptik.com/2007/02/13/ruby-mapquest-release-v0002/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hpricot &lt;text&gt;sometext&lt;/text&gt; workaround</title>
		<link>http://blog.apokalyptik.com/2007/02/13/hpricot-sometext-workaround/</link>
		<comments>http://blog.apokalyptik.com/2007/02/13/hpricot-sometext-workaround/#comments</comments>
		<pubDate>Tue, 13 Feb 2007 18:38:39 +0000</pubDate>
		<dc:creator>apokalyptik</dc:creator>
				<category><![CDATA[Ruby (on or off) Rails]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web Stuff]]></category>

		<guid isPermaLink="false">http://blog.apokalyptik.com/2007/02/13/hpricot-sometext-workaround/</guid>
		<description><![CDATA[As noted by the open trouble ticket here, The most awesome Hpricot seems to have come down with a bug, in that it&#8217;s not able to access &#8220;sometext&#8221; inside this: &#8220;&#60;text&#62;sometext&#60;/text&#62;&#8221; It parses it ok (puts.doc.inspect definately shows the proper {elem}) you just cant get to it. So heres my ugly little hack/workaround for this [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.whytheluckystiff.net/hpricot/ticket/55?replyto=description#comment" target="_blank">As noted by the open trouble ticket here</a>, The most awesome <a href="http://code.whytheluckystiff.net/hpricot">Hpricot</a> seems to have come down with a bug, in that it&#8217;s not able to access &#8220;sometext&#8221; inside this: &#8220;&lt;text&gt;sometext&lt;/text&gt;&#8221;  It parses it ok (puts.doc.inspect definately shows the proper {elem}) you just cant get to it.  So heres my ugly little hack/workaround for this issue until it&#8217;s resolved.  (I&#8217;m posting it here, since I cant seem to signup to make a comment on the bug report on the <a href="http://code.whytheluckystiff.net/hpricot">Hpricot home page</a>&#8230; and someone might find this useful)  This hack is specifically for web documents, however would also work for strings or files with only minor tweaks.</p>
<blockquote><p>    ## Begin hack<br />
doc = &#8220;&#8221;<br />
open(url) do |f|<br />
doc=doc + f.read<br />
end<br />
doc = doc.gsub(/&lt;text&gt;/, &#8220;&lt;mtext&gt;&#8221;)<br />
doc = doc.gsub(/&lt;\/text&gt;/, &#8220;&lt;/mtext&gt;&#8221;)<br />
doc = Hpricot(doc)<br />
## Should be one line<br />
## doc = Hpricot(open(url))<br />
## End hack</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.apokalyptik.com/2007/02/13/hpricot-sometext-workaround/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached
Page Caching using memcached
Database Caching 1/46 queries in 0.014 seconds using memcached
Object Caching 675/774 objects using memcached

Served from: blog.apokalyptik.com @ 2012-02-04 10:14:40 -->
