a day in the pit my view from inside

26Jan/120

HelloBirthday Grows Up, Goes Private

It must have been two years ago that I missed my friends birthday and she was super upset with me. Naturally, I devoted 48 hours to building an app that would never let me forget a birthday. (I think this may have pissed her off even more...)

Fast forward... I've decided to change HelloBirthday so that as of January 25th, 2012 new users will only see a forecast of birthdays and wishing will not occur. This only affects new users; current users you're OK.

HelloBirthday still has the capabilities to automate wishing and I'm letting friends, family, and people who know me to continue to use it. If you want to use HelloBirthday please add it and then e-mail me (mike@thinkeffect.com).

20Aug/111

Visualizing Subversion’s Commit History

Yeah, it's Friday! Woohoo. Yup, that's right people, it's time to kick off your shoes and code...

I have not posted in like two weeks. Lemme tell ya, One of those weeks I spent in Vegas on a much needed vacation without a laptop. It was pretty spectacular. This week has just flown by. But today I felt like doing something fun; I felt like being a movie producer, director, composer, etc. However, I don't really like to get off the couch just to film a movie when I have a at least 25 storylines wandering around my computer.

Without further pause here is my story of the main Subversion repository I contribute to at work:
[ By the way, dots (or nodes) are directories or files. As the two people-icons run around the screen they are making subversion commits. Explosions typically occur when a big check-in happens. ]

Enjoy? Let's make you a video. Visualizing Subversion commit activity is crazy simple. Dayum! I'm running Mac OS X 10.6.8 so all of following was done on that environment.

You'll want to get ffmpeg and some codecs. I use Darwin Ports to manage packages like these so if you're like me here's the quick fix

sudo port install ffmpeg +gpl +lame +x264 +xvid

Next, we're going to need Gource, and ffmpeg.

Download gource. unzip it and head into the directory. once in the gource directory go ahead and

sudo ./configure
sudo make; sudo make install
gource --help

Alright we're pretty much ready to go. Head over to one of your subversion root directories. Add this file to your directory: summerfun.conf
and in it put

[gource]
bloom-intensity=0.25
colour-images=true
hide=filenames,dirnames
path=my-project-log.xml
seconds-per-day=0.1

You'll see the my-project-log.xml is nowhere to be found. Let's create it:

svn log -r 1:HEAD --xml --verbose --quiet > my-project-log.xml

That will make the video play a little faster. You can remove or muck with all of the settings; just read the README for available options. Now here is the command I executed:

gource --load-config summerfun.conf -1280x720 -o - | ffmpeg -y -b 10000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre default -threads 0 -bf 0 gource.x264.mp4

This command launches a video; watch it & interact with it. Give it a try. All interactions get recorded in the video output. So zoom as you wish, to entertain your watchers. Let me know how it goes and post your videos.

Reference:

1Aug/110

Under the hood – Ruby methods Array#map, Array#inject

In the spirit or writing some Ruby methods I'm going to add three in this post. We'll begin with mapping elements of an Array.

class Array
    def rb_map
        n_array = []
        self.each { |elm| n_array << yield(elm) }
        n_array
    end
end

Then we do Inject,

class Array
    def rb_inject initial = nil
        value = initial
        self.each { |elm| value = yield(value,elm) }
        value
    end
end

And finally, let's revisit map using our inject:

class Array
    def new_map_using_inject
        rb_inject([]) { |set, elm| set << elm }
    end
end

You'll notice I did not do any error handling. That's not the point of the exercise; we want to know what the methods we call daily do behind the scenes.

Filed under: Code, Learning, Ruby No Comments
25Jul/111

Releasing LogThingy.com, a Domain Manager/Content Server

This last weekend was filled with a hackishly fun project: build a rails app that can route domain names to dynamically generated html content. The need arose from having too many domains and them being parked all over the place. I needed something all-inclusive. Ideally, a web site that lets me add newly parked domains and serve up the full html page creation dynamically.

Thus began a journey lasting about one week. Monday of last week I embarked to build said application and can report back today that I have launched it to a production environment, still in early beta stages. LogThingy.com, for lack of a better name, is a domain social network with content-parking capabilities. You can add domain names to your account, we'll fetch all the name servers and expiration details, and then once your domain is parked onto my server the application will begin serving requests to that domain the html that you've stored.

This is an invite-only pre-release. There are numerous feature gaps, but things are running stable and you can see the net result by visiting some of the domains: synced.org, comparestrains.com, logthingy.com, answerwise.com

All domains serve a standard "Coming Soon" image unless content has been defined via the backend. You'll see LogThingy.com is a "Coming Soon," while the other domains have content (albeit slim). Thoughts and feedback welcome. Here are some screenshots of what things look like..

More updates to come =) Oh, and don't forget about SimplyFor.US, updates were just rolled out over there.

19Jul/111

Hanging in the Treetops

Parsing in Ruby is pretty easy is you know what you're doing. Fortunately, for people like me, who don't, we have handy gems that do a lot of work for us.

I wanted to find a way to parse short urls without making any database calls. Since I have a pattern for short urls I figured, for a bit of fun, a parser would make this possible.

Enter Treetop: "Treetop is a language for describing languages. Combining the elegance of Ruby with cutting-edge parsing expression grammars, it helps you analyze syntax with revolutionary ease." Treetop

The grammar defined is straight forward: (FILE: message_grammar.treetop)

grammar MessageGrammar
 rule message
   [0-9] / 'X' message / ('Y' / 'Z') message message
 end
end

So here are some valid codes: 0, X0, XY00, XX0, XY09
Invalid codes: T0, P, PPPPP0, X0X0X00

Make sure you've got treetop installed. Drop into terminal in the directory of the grammar file and run
tt message_grammar.treetop
This will result in a file called message_grammar.rb which you can include in another file to use as your parser...

File: message_parser.rb

require "rubygems"
require "treetop"
require "polyglot"
require "message_grammar"
 
# MessgeGrammarParser is a generated Parsing class based on the grammar
# defined in message_grammar.treetop
parser = MessageGrammarParser.new
 
STDIN.each do |string|
 
 # for each string, split on whitespace
 string.split(" ").each do |message|
   # print status of whether the message could be parsed or not
   puts "#{message} #{parser.parse(message) ? 'VALID' : 'INVALID'}"
 end
end

And we're Done-zo Washington. Parse away.

Filed under: Code, Learning, Ruby, Software 1 Comment