Kid

Posted over 7 years back at The Hobo Blog

Any of you Ruby folk taken a look over the fence into Python land and seen Kid templates?

They call it an “attribute language” because unlike DRYML, there are smart attributes rather than smart tags. e.g. from their docs:

<p py:if="system() == 'Linux'">
  Good for you!
</p>

When you’ve stopped sniggering about those empty brackets, you might agree that it’s rather elegant and compact – particularly for this specific example: a conditional.

Over in the forums we’ve been chatting about how all the if_this, if_that tags in DRYML are kinda icky. I’m wondering about supporting this style just for if. Something like

<p if="logged_in?">Logged in as <display_name obj="#current_user"/></p>

Is that just too inconsistent when everything else is done with tags? How about the else? Whadayathink?

p.s. I was going to post this in the forums, but I thought I’d give this way a try. Let me know if you think this is noise in the context of the blog.

So that’s two questions for you. I just put a fresh pad of blank comments in the server so knock yourself out.

Kid

Posted over 7 years back at The Hobo Blog

Any of you Ruby folk taken a look over the fence into Python land and seen Kid templates?

They call it an “attribute language” because unlike DRYML, there are smart attributes rather than smart tags. e.g. from their docs:

<p py:if="system() == 'Linux'">
  Good for you!
</p>

When you’ve stopped sniggering about those empty brackets, you might agree that it’s rather elegant and compact – particularly for this specific example: a conditional.

Over in the forums we’ve been chatting about how all the if_this, if_that tags in DRYML are kinda icky. I’m wondering about supporting this style just for if. Something like

<p if="logged_in?">Logged in as <display_name obj="#current_user"/></p>

Is that just too inconsistent when everything else is done with tags? How about the else? Whadayathink?

p.s. I was going to post this in the forums, but I thought I’d give this way a try. Let me know if you think this is noise in the context of the blog.

So that’s two questions for you. I just put a fresh pad of blank comments in the server so knock yourself out.

Nearly forgot

Posted over 7 years back at The Hobo Blog

If you are updating an existing app that uses Rapid to Hobo 0.5, you will need to add the following at the top of your views/hobolib/application.dryml

<taglib src="plugins/hobo/tags/rapid"/>

<set_theme name="default"/>

Nearly forgot

Posted over 7 years back at The Hobo Blog

If you are updating an existing app that uses Rapid to Hobo 0.5, you will need to add the following at the top of your views/hobolib/application.dryml

<taglib src="plugins/hobo/tags/rapid"/>

<set_theme name="default"/>

Hobo 0.5 and more...

Posted over 7 years back at The Hobo Blog

It was 17 and a half hours in the end but we seem to have made it. Although without a great deal of surplus energy for a riveting blog post!

Hope you enjoy the new site – we’ve tried to have a bit of fun with it :-). Also don’t miss: two new screencasts, the docs, and of course Hobo 0.5 (changelog).

Let me know what breaks!

ZZZZZzzzzzz…

Hobo 0.5 and more...

Posted over 7 years back at The Hobo Blog

It was 17 and a half hours in the end but we seem to have made it. Although without a great deal of surplus energy for a riveting blog post!

Hope you enjoy the new site – we’ve tried to have a bit of fun with it :-). Also don’t miss: two new screencasts, the docs, and of course Hobo 0.5 (changelog).

Let me know what breaks!

ZZZZZzzzzzz…

Docs

Posted over 7 years back at The Hobo Blog

The Hobo Tutorial

Stop Press! The new, improved and up-to-date (Hobo 0.7.1) tutorial is now available!

beta.hobocentral.net

Not only that, but the source-code to beta.hobocentral.net is available! The idea is that this source-code will heavily commented in order to act as a form of documentation. At the moment there’s not a huge amount there, but the model layer has a few nuggets of knowledge in the comments. Also note that a lot of the functionality can be found in vendor/plugins as reusable Hobo bundles. More coming!

svn checkout svn://hobocentral.net/hobo/trunk/hobocentral

Docs

Posted over 7 years back at The Hobo Blog

The Hobo Tutorial

Stop Press! The new, improved and up-to-date (Hobo 0.7.1) tutorial is now available!

beta.hobocentral.net

Not only that, but the source-code to beta.hobocentral.net is available! The idea is that this source-code will heavily commented in order to act as a form of documentation. At the moment there’s not a huge amount there, but the model layer has a few nuggets of knowledge in the comments. Also note that a lot of the functionality can be found in vendor/plugins as reusable Hobo bundles. More coming!

svn checkout svn://hobocentral.net/hobo/trunk/hobocentral

16 hours and counting...

Posted over 7 years back at The Hobo Blog

…the new site is still broken, the docs aren’t done, I’ve got the ‘Hyperactive’ playlist going in iTunes, it’s dark and we’re wearing sunglasses.

Hit it.

(OMG half of you are probably too young to even have heard of that)

16 hours and counting...

Posted over 7 years back at The Hobo Blog

…the new site is still broken, the docs aren’t done, I’ve got the ‘Hyperactive’ playlist going in iTunes, it’s dark and we’re wearing sunglasses.

Hit it.

(OMG half of you are probably too young to even have heard of that)

Episode 5: Using with_scope

Posted over 7 years back at Railscasts

Learn how to use with_scope - a very powerful method which will allow your custom find methods to accept any find options. Just like magic!

Ruby - Power, Simplicity, and Beauty

Posted over 7 years back at Cody Fauser

Tonight while reading through Refactoring by Martin Fowler I was once again amazed by power, beauty, and simplicity of Ruby. Wait, hold on, aren't the code examples in Refactoring in Java? Yes, that is precisely the point. All day I am lucky enough to write Ruby, but sometimes I need to take a look back over the other side of the fence to appreciate where I'm at. Let me tell you that the grass is definitely not green over there.

Consider the simple method being extracted on page 27 of the book:

1
2
3
4
5
6
7
8
9
10

private double getTotalCharge() {
  double result = 0;
  Enumeration rentals = _rentals.elements();
  while (rentals.hasMoreElements()) {
    Rental each = (Rental) rentals.nextElement();
    result += each.getCharge();
  }
  return result;
}

Basically the code is just iterating over the collection of Rental objects and calculating the total charge. Simple enough. The equivalent using inject with Ruby:

1
2
3
4

  def get_total_charge
    rentals.inject{ |sum, rental| sum + rental.get_charge }
  end

Then, with the new sum method added to Enumerable in Rails it gets even simpler:

1
2
3
4

  def get_total_charge
    rentals.sum{ |r| r.get_charge }
  end

This just goes to show the power and expressiveness of Ruby. With so many fewer keystrokes, and lines of code, it is so much easier to focus on the problem at hand.

Episode 4: Move Find into Model

Posted over 7 years back at Railscasts

Move a find into the model to clean up the controllers and remove duplication. Also see how you can call these custom find methods through an association.

March Reading List

Posted over 7 years back at zerosum dirt(nap) - Home

We’ve been hard at work lately, so blog updates have been a little more infrequent than I’d like. But in the meantime, I thought I’d post some books I’ve been reading. All come highly recommended.

Breaking the Silence

Posted over 7 years back at The Hobo Blog

January 26th? 6 weeks ago!?! Is it really that long since I last posted? Wow. I do apologise for keeping you all hanging for so long. Really.

The funny thing is I guess it hadn’t really sunk in that anyone would be that bothered. I mean, I do see the stats – we’re getting a fairly steady 600ish visits per day – but what does that mean? It’s just a number. Maybe a moderately large number on the scale of all the blogs out there, but there’s nothing that powerful about a number, not compared to, say, the human voice. And then suddenly you have a voice – the previous post now has some fairly heart-felt comments that carry more weight than web stats ever could.

To be honest it’s a little bit overwhelming for me. I’m just some guy with zero prior standing in the Ruby community who wrote a Rails plugin. I stop blogging and someone actually gives a hoot? Really? People are annoyed that I stopped?! Woah!

But OK - if that’s how things are, I guess I better step up. A change is definitely needed. We need to solve a problem nicely articulated by Michiel:

Currently, Hobo feels like a closed tower. Updates are announced without a timetable or a feature list. So no-one can guess what’s coming next or when it will arrive. This is obviously frustrating because none of us can really work or play with Hobo like this.

I would advise the Hobo team to blog a bit more about various features and use-cases instead of putting the focus on documentation and new releases with new features.

A good way to come down from the tower would be to tell you a little about the “Hobo team”. Um. There isn’t one. It’s just me. Well, there’s one other guy deeply involved - my good friend Nigel Powell. He’s chief evangelist, cheerleader and fellow Hobo visionary. Nigel has contributed a lot to the vision for Hobo (Oh, and he came up with the name BTW). Nigel shows up on the blog as Red, which is his nickname from his blog The Red Ferret Journal (which is a fun read if you’re into tech trivia). So when I say there is no team, I don’t mean to disregard all that Nigel has done for the project, but Nigel is not a coder. So the stuff you guys are really interested in – Hobo itself, documentation – there is no team for all that. Just me, and of course – you!

OK, that’s who we are, now a bit about what we’re doing with Hobo. Hobo was ‘extracted’ from an app I was building, much as Rails was extracted from Basecamp. I was just doing what programmers do - trying to keep the abstraction level in my app very high so I didn’t have to repeat myself, and could take a very agile approach to evolving the app. OK DRYML was a bit of an indulgence, but I’d built something similar before a couple of times (in Perl, circa 1994, and later in Python), and I was able to knock up a working prototype in a couple of days. When DRYML was working I looked at what I had, and thought hey, this is cool, I could release this. I showed what I had to Nigel, and he pounced on it.

Things started to move pretty quickly from there, and as our enthusiasm grew we decided to form HoboTech Ltd. A web-development / consulting firm that uses Hobo as its not-so-secret weapon. We’re just nearing the completion of our first major project and are very happy about the fact that the use of Hobo has been an enormous success.

So that’s what we’re doing - commercial Rails development projects, taking advantage of Hobo, and effectively funding the development of Hobo at the same time. It’s kind of fascinating how this approach is so much better than seeking venture funding. Having to deal with the idiosyncrasies of clients’ projects sometimes feels like a pain, but it keeps Hobo real.

Of course it can be frustrating that I don’t have all the time I’d like to throw into pure Hobo, and it’s inevitable that doesn’t-pay-the-bills work like documenting Hobo is the first to suffer. But overall, this real-world work is making Hobo way better than it otherwise would be. Agreed, good code with bad docs is frustrating, but good docs for bad code is just plain useless.

That’s all well and good, but what about Hobo? What’s going on with the 0.5 release, I hear you ask? The reason for the hold-up is that we’ve decided to do a kind of a second launch. We launched Hobo with a screencast that gave just a glimpse of what Hobo does, a fairly buggy codebase, and a web-site that was broken in the world’s dominant browser. And then, to our total amazement, we had 20,000 visits in January. We’d like to do it again properly. Hobo has now been used in a production quality app other than the app it was spun out of, which is a hugely important milestone. We have two new screencasts, and together the three do a vastly better job of showing what Hobo is about. We have a “mini manual” nearing completion, which though compact should be very useful. And we’ve nearly finished the shiny new web-site. To be honest, in terms of the codebase, Hobo 0.5 won’t be that far from Hobo 0.4.3, but there is one new feature in there that I’m really excited about (which I’ll tell you all about in a post soon).

We honestly thought all this would be done weeks ago, but we got busy with HoboTech work, and some easy things turned out not to be (gasp!).

But enough is enough - all these things will land on the Interwebs no later than this Wednesday 14th (that’s GMT BTW - just in case it goes to the wire!)

Hopefully this post has set the tone for a more open and conversational future. I have some very interesting ideas that I haven’t even begun to implement yet, and I think now I’ll blog about them first, to see what people think. And I promise to post more often!

Oh and one last thing - can I just state the obvious and remind everyone that if you are trying to use Hobo, you are trying to use an early beta. If that’s what you want to do, I am stupendously grateful to you, but please expect the documentation to be lamentable! Please expect the ride to be bumpy! I will try very hard to make things smoother for you. It will take a little time! Hopefully we’ll do it together.