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.

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.

The Camping Episode II - Ruby on Rails Podcast

Posted over 7 years back at Ruby on Rails Podcast

After a month, Camping Episode II!

  • Chris van Pelt on his cropper and presenter apps.
  • Manfred Stienstra talks about his HTTP authentication library for Camping and also UTF-8 encoding in “that other web framework.”

Switch & Solo Cards with Website Payments Pro UK (Payflow) and XMLPay

Posted over 7 years back at Cody Fauser

While implementing support for PayPal Website Payments Pro UK in ActiveMerchant I ran across a small problem while processing the UK cards Switch & Solo.

Switch & Solo cards are a special case when processing credit cards, as they need some additional information. The additional information is either the card issue number or start date, as printed on the card. The problem is that the XMLPay guide provided by PayPal doesn't exactly specify where to put this information. If you dig around in the schema it appears as though you can place the CardIssue or CardStart element within a Level3Invoice element, however that didn't seem to work, and always returned the error "Field format error: CARDSTART or CARDISSUE must be present"

After some trial and error, and a helping hand in the right direction from Todd Sieber at PayPal, I was finally able to successfully process the Switch & Solo cards using the ExtData elements within the Card element of the XML request:

1
2
3
4
5
6
7
8
9
10

<Card>
  <CardType>Switch</CardType>
  <CardNum>5641820000000005</CardNum>
  <ExpDate>200801</ExpDate>
  <NameOnCard>Cody Fauser</NameOnCard>
  <CVNum>123</CVNum>
  <ExtData Name='CardIssue' Value='01'/>
  <ExtData Name='CardStart' Value='0299'/>
</Card>

You only need either the CardIssue or CardStart element to be present, but for illustrative purposes I included them both.

One other thing to note is that XMLPay API will no longer be updated by PayPal. So if you are writing new code then you might as well just stick to the Name-Value pair API.

Episode 3: Find Through Association

Posted over 7 years back at Railscasts

No need to pass foreign keys in find conditions, just do the find through a has_many association.

DEISA Sessions (Distributed European Infrastructure for Supercomputing Applications)

Posted over 7 years back at Spejman On Rails

This week I'm taking DEISA training sessions in Barcelona, they are teaching us how to submit tasks into most powerful supercomputers of Europe (DEISA Architecture).

Within this supercomputers we can meet Marenostrum, nowadays is the most powerful supercomputer in Europe and the World's fifth most powerful as you can see in www.top500.org. It's made of 10.240 CPUs Power PCs, 20 TeraBytes of RAM and 370 TeraBytes of disk. It's placed in a old chapel which gives it a special feeling.

Today I've been lucky and I could visit inside Marenostrum as you can see in this photos:

Marenostrum

Marenostrum

Marenostrum Core

More photos: http://www.flickr.com/photos/spejman/tags/marenostrum/

Episode 2: Dynamic find_by Methods

Posted over 7 years back at Railscasts

Shorten simple finds considerably and improve readability by using the dynamic find_all_by and find_by methods.