Block Comments

26 May 2008

128 Comments

Since I seem to be on a “Comment” and “Terseness” rant, I’d like to point out that I dislike block comments for everything but RDoc. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 x ||= ["0"] =begin this is a block comment It's good for auto-generated documentation , I […]

Continue reading...

Sidebar comments in code

26 May 2008

2 Comments

In my post about clever code vs. terse code, I showed some distaste for code that attempts to put a bunch of logical statements on one line. I have a particular coding prejudice that lines of code should be short from left-to-right, if at all possible. The reason? I like sidebar comments. Maybe this is […]

Continue reading...

Simple and Terse Vs. Too Clever

26 May 2008

34 Comments

In 21 Ruby Tricks You Should Be Using In Your Own Code, Peter Cooper outlines some really useful best practices that programmers could benefit from. However, I think that there’s a tendency to over-obfuscate code from time to time in the Ruby world. I like terse code. I like beautiful code. But I dislike tricky […]

Continue reading...

Ruby Gem – Threaded Collections: Process collections over many threads

8 May 2008

7 Comments

I often have to iterate over a collection and perform some remote, or long running task on each member of the collection. Threaded Collections is a package for iterating through collections over multiple threads. With large collections, sometimes it can be more efficient to process a collection in parallel, provided that the collected items don’t […]

Continue reading...

DRY controllers: Which Framework do you use?

7 May 2008

10 Comments

RESTful applications built with script/generate have a lot of repetitive code. Each generated controller will define default “index” “create” “new” “update” and “destroy” methods that looks similar from controller to controller. There are at least FOUR plugins that aim to DRY up RESTful controllers each with their own benefits and weaknesses: make_resourceful – There’s a […]

Continue reading...

Integrating with Services that exhibit the Java Timezone Issue

6 May 2008

2 Comments

In my last post, I described an XML over HTTP service written in Java that I have to integrate with. I expressed a minor and general annoyance at the fact that the developers of this service specify that a “DateTime” parameter be specified in “milliseconds since the epoch”. There is another typical problem with Java […]

Continue reading...

Converting to and from Unix / Java time (epoch)

6 May 2008

5 Comments

Working in telecom, I have to integrate my Rails and plain Ruby apps with Java or Unix based systems running on remote hosts. Most often these systems are running remotely and are accessed via an XML-over-HTTP interface (no SOAP, no REST, blah…). I’ve found that one of the most infuriating things that UNIX and Java […]

Continue reading...

Fixed standard_issue Theme for proper code formatting

3 May 2008

0 Comments

Alright. The Typo 5.x Standard Issue theme (which I really like, so much that I switched from Scribbish) does not account for the styles used by typo:code macros. After much headache trying to get Typo to include the typocode themes in minimal.css while rendering themes (so that code would render nicely in any theme that […]

Continue reading...

Code Highlighting in Typo

2 May 2008

4 Comments

Code Highlighting in Typo is awful, cumbersome, and a pain. I am currently running this blog on Typo 5.0.3, and when I write an article using typo:code snippets using LivePreview, here is what I see: But then it RENDERS like this, no matter which theme I am using: GAH! That’s not what I thought I […]

Continue reading...

Adding Multiple Attachements to a Model in one View

30 April 2008

6 Comments

AttachmentFu is a great plugin. It’s heavily used all over the place to upload images to a Rails app. It’s also good with other file types. I had a requirement to provide users with the ability to set up an entity (call it a Batch), then upload a number of CSV files to that batch. […]

Continue reading...