Company Blogging with Yahoo Pipes

May 2nd, 2007

I’ve blogged about my gripes with multiple blogs in the past, concluding with an informal protest to only use one.

A specific instance of the problem that I mentioned was having a personal blog in addition to blogging under a company. Well, it turns out that you can have the best of both worlds with little to no effort.

Yahoo Pipes takes advantage of the fact that so many sites and services distribute some form of feed syndication. It allows you interact with feeds from different sources in an absolutely incredible amount of ways. Through graphically playing “connect-the-dots” with various modules and/or filters, you gain an unprecedented amount of easily accessible power to create mashup feeds. Of course you can export these to RSS (or JSON), but they even offer email or mobile exports!… and publicly sharing the “source” file so others can copy your project where you left off and continue it!

Okay enough fanaticism (although it is completed warranted), and lets get back to the topic. Grabbing feeds from separate employee blogs to combine on a company blog has always been an option. However, Pipes makes this so easy that you have no excuse to not use it.

Here’s a simple proof-of-concept… totally usable though. It uses the “fetch feed” module that you pass an RSS url to. Then, the sort module is used to sort for the most recent entries by date published, and even by new blog comments. And then… nope that’s it, just connect to the “pipe output” module and you’re done!
(Note that I only included my blog here in the RSS, but you can add as many as you want to get mixed in by just hitting the “plus” icons):
http://pipes.yahoo.com/pipes/pipe.info?_id=3PcgeID42xGTQKjsy6ky6g

Another cool thing you could do is make a filter to only grab posts out of the feeds to put on the company blog that have been posted under a certain category… sweet!


Cool Minimalistic Site Design

April 22nd, 2007

I just recently got Eric Allam to give me his blog URL, and I love his site design at last100meters. In trying to come up with a design for the project I’m working on, my aim is to strike a balance between minimalism and a flashy web 2.0 look, while still being unique and useful UI-wise.

Eric’s site definitely appeals to the minimalist in me though, and is the first that I’ve liked a lot since Google’s homepage. The posts/titles are big, prominent, and pure text, spanning the whole left pane down the page. Three links, the RSS feed, Google Reader shares, and Twitter feed are the only things with images, even then being tiny. White space is everywhere, and his contact information is immediately available. I love it!

In contrast, you can tell from my blog design that I like to just take everything I have ever touched and throw it all together… now that’s art =p


Multiple Blogs Are Not For Me

April 22nd, 2007

Whether or not to commit to other blogs has been bothering me for a while now. I started with this blog… When I had a job at New Media (seems their site is down right now, how ironic =), I was assigned another blogging account. It started there, I had to make decisions between what I considered better suited for my personal blog or my work blog. This type of thing is especially hard for a web developer, as the divide between personal and work related activities is hazy at best.

I never ended up using that account, and didn’t post here either because of never knowing where to post. Later, I was offered to blog Ruby and Rails specific stuff with the guys at Rails Envy. Although they are both great dudes whom I respect, for some reason I couldn’t get myself to say yes.

We were also thinking about how it might be cool to have a Rails/Ruby dev blog for PayPerPost. You know, get a bunch of developers all blogging in the same place about cool stuff we come up with daily. Yet again, that would mean splitting content between this blog and another (can you see what I mean about a developers work/play divide being slim?)

Just today I was asked whether I wanted to be apart of a neat idea for a Ruby blog with my friend/coworker Eric

As I hinted in my last post and my latest rockstartup confessional (doesn’t seem to be online yet, wait for it!), I am spending my spare time working on an awesome site to help people blog more (solving my own problems here, heh) and pump quality content into the web via microformats. Of course, I have to be cool and make a company blog for that, right?

Nope, I say all this worry and frustration ends here. I am making the decision now to devote all my time and effort blogging to this site. No more distractions, no more stress, and much more learning and content. I’m not sure if I’m the only one running into this problem, but if you felt anything like dejavu reading this I invite you to do the same.


Beast Source Code Snippet

April 18th, 2007

I downloaded and browsed the source code for the Beast forum today. Because it’s REST’ful, open source, and developed by Rick Olson, I recommend any Rails developer to look at it. What makes it even better is that a goal of Beast is to “stay around 500 lines”, meaning the app doesn’t take much time to figure out and can be studied leisurely.

Anything you define in YourController#rescue_action will be run when an error is raised, so check out what I found in Beast:

def rescue_action(exception)
exception.is_a?(ActiveRecord::RecordInvalid) ? render_invalid_record(exception.record) : super
end

def render_invalid_record(record)
render :action => (record.new_record? ? ‘new’ : ‘edit’)
end

As you can see, now any errors that are invalid AR objects will call a special method. This method render’s new or edit depending on whether the record exists yet or not.

So…rather than doing this in our controllers:

def create
@record = Record.new(params[:record])
if @record.save
flash[:notice] = ‘Saved successfully’
redirect_to :action => ‘index’
else
render :action => ‘new’
end
end

We simply do this:

def create
@record = Record.new(params[:record])
@record.save! and flash[:notice]=(’Saved successfully’) and redirect_to(:action => ‘index’)
end

The magic is in the save! method, as the “bang” raises errors instead of returning false when validation fails, not bad!

On another note, I’ve been spending a lot of my time recently on reading books about and developing a social site… As you know, my ambition to blog a lot since the creation of larrytheliquid.com has quickly diminished. I’m making this app to change that for myself and all bloggers… but that’s enough for now =)


Validating Positive With Infinity

March 18th, 2007

Ruby has a nifty feature to be able to use a special constant that represents infinity, accessible as follows:

irb(main):001:0> 1.0/0
=> Infinity

Recently, I needed to validate that a field in my Rails model would be positive. While there are countless ways to do this, I was very happy to find a fun and practical use for infinity.

validates_inclusion_of :some_attribute, :within => 1..1.0/0, :allow_nil => true, :message => 'should be positive'

The attribute is validated to be within positive one (inclusive) and positive infinity (technically exclusive.) This is done with Rails’ validates_inclusion_of for numeric data, Ruby’s range operator .., and the infinity constant 1.0/0.

Huzzah!


Portable and Organized Bookmarks

November 2nd, 2006

Across desktops, laptops, work computers, etc managing your bookmarks can become a pain. I used to use a Firefox plugin called “Bookmarks Synchronizer”:https://addons.mozilla.org/firefox/14/ and a free FTP service. But, having to download bookmarks on startup and upload them when they change got to be to annoying.

Eventually I stopped using it and got back into disorganized and multiple computer bookmark hell. This wasn’t good so I quickly sought a solution, and started using “del.icio.us”:http://del.icio.us/ . As it is too tedious to use the web interface to add bookmarks, the “Delicious plugin”:http://del.icio.us/help/firefox/extension is a must have, allowing you to go to your bookmarks and create a new bookmark from buttons on Firefox.

The nice thing is that throwing a bunch of tags onto something organizes your bookmarks for you. As you type, popular suggestions and bookmarks you’ve used are displayed to avoid tagging some things “rails” and others “rubyonrails”. Another nice benefit is that the popup to bookmark something also contains a description field, making it more convenient to describe the value of the bookmark instead of only naming like you do with traditional bookmarks (not that you can’t add descriptions to them, it’s just less convenient.)

I still use Firefox’s bookmarks toolbar for frequent sites that I use access like Gmail, Rails and Ruby API’s, etc. But, which of these are used usually varies computer-to-computer because they are situational (work, personal, etc), making the need for them to be portable less. Plus, the number of these are limited so you can always add them quickly.

In any case, another great tip is to use “Firefox Live Bookmarks”:http://johnbokma.com/firefox/rss-and-live-bookmarks.html to grab the feeds related to specific tags or delicious groups, and add them to your bookmarks toolbar. You could even make a “bookmarkstoolbar” tag that you subscribe to as a live bookmark, making the whole thing even more portable!


Simple Flash SEO

November 1st, 2006

100% Flash websites have the bad reputation of being associated with spam, not maintainable, unintuitive, and not search engine accessible. While those first few are myths to be busted elsewhere, this article will deal with the last issue.

Remember the old days of frames within sites? Now don’t try to cringe too much, but remember when not all browsers supported them? Well, there is an important parallel to draw here between framed sites and Flash sites. Both are seen as unconventional and have interesting problems dealing with information support among different mediums.

With framed sites, getting markup information to a user whose browser does not support frames is an obvious issue. The solution was the @

@ tag. In this tag, a webmaster of a framed site can include the complete or partially complete version of a site to people without frame support.</p> <p>”Yup, old news, so how does this apply to Flash?” Well, in a Flash based website you are able to get all the information to a user through the ubiquitous Flash player. Wait a second, what if the end user DOESN’T have the Flash player. Hm…now what if that end user is the Googlebot crawler? You guessed it, @<noframes>@ tag to the rescue solving essentially the same problem as described above.</p> <p>This method lets you enter info into a web page that gets indexed by Google, has fairly nice semantic meaning (noframes == noflash), and without resorting to the kind of trickery that results in being banned by Google (ie: invisible text with the same color as the background.) Better yet, it doesn’t affect your layout at all…unless of course the end user doesn’t have frames =p.</p> <p>Example:</p> <p><code><br /> <html><br /> <head></head><br /> <body><br /> <noframes>This info gets indexed by Google, even though the only thing in this web page is my Flash application!


Versioned Taste in Music

October 31st, 2006

Some people can’t tolerate music during work, and I can vary. When I am in the music-with-work groove, then it’s great. But, let’s face it, getting work done is the goal and any time spent on looking for, organizing, remembering, etc music is a distraction.

Enter “RadioBlogClub”:http://radioblogclub.com/ , a website distributing a Flash application that streams music in its player. You can get complicated with it, and use similar services such as “Pandora”:http://www.pandora.com/ , but I prefer the speed and simplicity of RadioBlogClub (I call it radioblog among friends for brevity, and I will adopt that for the rest of this article =p ). What this entails is going to the website, searching for any song you like (many people host the player so a lot of songs are on there), and picking one. After the song ends, the “blog” will continue to the next song in the playlist, and the one after that, etc.

So…you get free songs that usually have a similar style that you’re looking for. You end up getting tons of new and old songs that come to you! No work required, you just keep developing and new songs appear before your very ears. So…you may be asking yourself, “Where does versioning come in?” Like I said before, I don’t like to waste time using the service’s features and building “bookmarks” of popular playlists. I don’t get interested in just one song from a particular blog either. Instead, with radioblog you get unique attachments to songs because they bring up several blogs, each with different styles of music…and you get attached to that as a whole.

“Yeah, yeah, so what’s the solution?” Well, as many of you probably know “37signals”:http://www.37signals.com/ has these neat little wiki-like editable pages called “Writeboards”:http://www.writeboard.com/ . They use a great markup language, “textile”:http://www.textism.com/tools/textile/ , that I also use in this blog (try it in the comments!) Like wiki history entries, writeboards have revisions. They also have this nice little ability that lets you compare two revisions (think the unix @diff@ command formatted nicely and with color), something that tailors to Writeboard’s collaborative writing audience. Finally, here comes the elegant solution: use writeboards to store a simple collection of songs that you currently enjoy. At any time, pull up your writeboard and radioblog the song and/or artist combo. If you find a new song/artist combo that pulls interesting results in radioblog, edit your writeboard to include it.

The key is to only keep the combos that you currently like in your writeboard. That way, the board isn’t cluttered…but even better, now try to compare two revisions. Alright! Versioned taste in music! At any time you can look at what you liked in the past, and start radioblogging those combos again. Talk about simple, fast, and productive…now get on to coding and Happy Halloween!

As my treat to you, here is a very simple example of the textile markup to keep your combos in. This can be made more pretty, but I like it because it keeps the textile markup I edit easy to read and manage too:

bq.
|*Song*|*Artist*|
|Perfume|Sparks|
|Zombie Remix|Cranberries|
|*|Richard Cheese|
|*|Daft Punk|

Which ends up looking something like this:

|*Song*|*Artist*|
|Perfume|Sparks|
|Zombie Remix|Cranberries|
|*|Richard Cheese|
|*|Daft Punk|


Ruby’esque Method Caching

October 30th, 2006

I am in love with how dynamic Ruby is… Whenever I talk about that aspect of Ruby I always bring up this example, which I heard about from someone that read it on the Ruby-talk mailing list. Nevertheless, doing it always amuses me.

So here we go. What I am going to do is make a Ruby class with an instance method and instance variable. The method first assigns the current time to an instance variable. Simple enough…but then I reopen the method and define it to just return that instance variable. What this ends up being is a simple form of caching:

class Cacher
def cache
@time=Time.now
def cache
‘Succesfully cached at: ‘ + @time.to_s
end
end
end

So now I can do this:

larry-diehls-computer:~ larrytheliquid$ irb
irb(main):001:0> require ‘cacher’
=> true
irb(main):002:0> c=Cacher.new
=> #
irb(main):003:0> c.cache
=> nil
irb(main):004:0> c.cache
=> “Succesfully cached at: Mon Oct 30 23:31:26 EST 2006″
irb(main):005:0> c.cache
=> “Succesfully cached at: Mon Oct 30 23:31:26 EST 2006″
irb(main):006:0> c.cache
=> “Succesfully cached at: Mon Oct 30 23:31:26 EST 2006″
irb(main):007:0> c.cache
=> “Succesfully cached at: Mon Oct 30 23:31:26 EST 2006″
irb(main):008:0>

As you can see, the @cache@ method gets redefined and always outputs the same thing. This works great for any method that takes a long time to execute but needs to be called multiple times. Say, maybe a Google Map API call, an intensive SQL statement, etc…

I love how simple this example is and plan to post plenty other such examples that illustrate the elegance of Ruby in the future, so stay tuned. Have something short and similar? You are most welcome to post it, or a link to your blog post about it, etc in the comments!


JRuby of Second Life Recap

October 29th, 2006

I came across “an interesting message”:http://www.ruby-forum.com/topic/83839 on the ruby talk mailing list a month ago. “Second Life”:http://secondlife.com/ is a 3d, online virtual world with no specific purpose. I heard about it from a good friend that was planning a business within it, selling virtual goods and services (the game lets you exchange real money for “Linden dollars”.) Although the concept appealed to me, I was never interested in it enough to install it and give it a try.

I had also heard of the “recent hiring”:http://headius.blogspot.com/2006/09/jruby-steps-into-sun.html of JRuby developers (Charles Nutter and Thomas Enebo) by Sun. I knew that “JRuby”:http://jruby.org/ was some sort of Ruby integration with Java (like Jython), and was happy as a Rails developer that Sun was giving Ruby some love. But again, I was satisfied with Rails enough to not dig deeper into it.

I love web development and try to stay in touch with local scenes such as the “Orlando Ruby Users Group”:http://www.orug.org/ , “Refresh Orlando”:http://www.refreshorlando.org/ , the upcoming “Refresh06 conference”:http://refresh06.com/ , and have attended “BarCamp Jacksonville”:http://barcamp.org/BarCampJacksonville and “Refresh Jacksonville”:http://www.refreshjacksonville.org/ in the past. Needless to say, being able to meet up with a virtual locality of “Rubyists of Second Life”:http://rosl.iandb.net/ AND learn about JRuby seemed like an amazing opportunity to indulge in the kind of fun that makes the internet so great.

“[click here to see all the screenshots I took]”:http://flickr.com/photos/larrytheliquid/sets/72157594350925388/ !

@On my trips to the meeting before it started, in my Eastern time zone, I had fun playing with interactive billboards that had pages like the RoR website, some Ruby sites, etc. The coolest thing was this little red cube on the middle of the giant ruby…it was a module that let you use IRB in Second Life! That’s right, IRB right there in the game…so cool.@

Then came the presentation, a format I found to be very entertaining. Headius started off the projector with some introductory slides, to the sweet tunes of Daft Punk that someone in the audience was streaming. You could see his avatar move his eyes and body to change slides, look around at people, and gestures were performed during chat to make the whole thing eerily lifelike. As you can see in the “presentation and chat log”:http://rosl.iandb.net/presentations/jruby/JRuby%20Presentation%2018%20Oct%2006.html , discussion during and between slides ensued…the air was electric and the format for this kind of meeting definitely works.

!

!

So to sum this all up, Second Life is a fun and exciting presentation medium. I encourage anyone interested enough in Ruby to read this article, to join the Rubyists of Second Life group (refer to “install and setup instructions here”:http://www.ruby-forum.com/topic/83839 .) JRuby has great and friendly developers that have that oh-so-good open source concern for community needs, and now has the backing of Sun. Anything that gives the dark side of Rails (deployment) another alternative is fantastic in my book, and access to probably the best libraries ever (Java’s) is also very sweet. Plus…possible better performance…sign me up! I’ll definitely be playing with JRuby, and am glad to have found out more about something I initially neglected. And finally, in case anyone cared, my in-game name is “Liquid Lunardi”.