Links for 12.17.07

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

Some git goodies, updates to both Rails and Merb, and other stuff this week. Here’s the breakdown:

To REST Or Not To REST...

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

Assaf Arkin is right, and I stand corrected. SimpleDB ain’t RESTful. Hell, it’s not really even GETSful. But it sure sounds nice when they put it in the marketing literature. Sigh.

From Subbu’s blog: “The technology powering SimpleDB is definitely impressive [..] However, as a REST API, it is a disappointment. The API failed (a) to identify resources, and (b) to specify operations on resources in a RESTful way. It uses a single verb GET to create, delete, update, or get data from the store.”

In any case, Assaf whipped up DeHorrible, a Rails proxy that appropriately RESTifies (GETStifies) SimpleDB. lol.

I’m still psyched about the SimpleDB announcement, and looking forward to trying it out, but I really wish Amazon would clean up their supposedly RESTful APIs. Yes, I’m looking at you, Flexible Payments.

Is it really that hard?

Episode 84: Cookie Based Session Store

Posted almost 7 years back at Railscasts

In Rails 1.2 the default session store is file based. This is inefficient and difficult to maintain. In Rails 2.0 the default is now cookie based which has several benefits as you will see in this episode.

SimpleDB is RESTful & Schema-less?

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

So the big web service of the week announcement goes to Amazon, for their AWS SimpleDB hosted service. This should place nicely with EC2, which is an interesting service except for the fact that persistent data across sessions is problematic (every time you boot an EC2 node it’s a clean slate).

So what is SimpleDB? It’s:

  • Built in Erlang (wow, maybe Erlang is worth learning after all, right?)
  • RESTful(see comments); API returns XML
  • Schema-less
  • Non-relational

Wait, what? Schema-less? Non-relational? Yup. In case you haven’t noticed, there’s been a groundswell of interest in this area lately… Perhaps most buzz-worthy is the CouchDB project, which also uses REST for inserts and queries, storing your data in schema-less databases which Amazon confusingly refers to as “domains” (see other differences). CouchDB is pretty neat, and all the cool kids seem to like it. RDDB has similar goals. And then there’s DBSlayer, which takes the approach of wrapping a REST API around traditional relational databases (MySQL, etc).

So why the interest in moving away from traditional RDBMS, which have served us well for so many years? Simplicity. Ease of scaling. The emphasis on removing business logic from the database and keeping it in the application, where it belongs. At least, those are the arguments. I’m no expert, but I’m certainly interested. Assaf Arkin summarizes the argument much better than I can, and his article Read Consistency: Dumb Databases, Smart Services should be required reading for anyone who’s interested in the future of (dumb) databases on the web. Assaf also has a follow-up article on the merits of CouchDB, specifically. There’s a lot to think about here.

Of course, another key value prop with the Amazon service is that it’s hosted. By Amazon. They claim it’s fast and reliable (they should know a thing or two about that), and it looks to be relatively inexpensive, when you consider that the alternative is clustering your own databases for the same kind of speed and reliability. It’ll be interesting to see how this turns out and I’m anxious to play around with it.

All that said, there’s no Ruby library wrapper for SimpleDB yet. However, as Chad Fowler notes, there are already three different projects registered with RubyForge. None of them have checked in even a single file as of this writing, but you know that somebody out there is hard at work (hint hint), and I’m sure you’ll see it before too long. Alternatively, you can build one yourself.

Me? I’ve already got too much on my plate this week. And I still have to get that DataMapper cheat sheet done, too.

/me apologizes again

/me goes outside to shovel snow

RSpec 1.1

Posted almost 7 years back at Jonathan.inspect

David Chelimsky anounced this morning the release of RSpec 1.1 (as of now the website is not up to date) RSpec 1.1 and just now the brand new website hosting.

What’s in this release ?

  • Nested Example Groups : allows you to nest your describe blocks resulting in group sharing common specifications.
  • Support for Rails 2.0.1
  • Test::Unit interoperability : switch smoothly from Test::Unit to RSpec by allowing you to run your Test::Unit tests with RSpec. The goal here is to provide a way to progressively transition your tests to RSpec syntax.

More infos on David blog post about the RSpec 1.1 release

Congratulation and many thanks to everyone involved in this release !

So you want to be a fashion photographer?

Posted almost 7 years back at Troubleseeker - Home

If you don’t want to join the amateurs1 at The Shot and receive the grand prize to shoot a campaign for Victoria’s Secret in return for being humiliated in public television then you need to get up there the hard way.

Melissa

make-up: Sommer Mbonu, hair: Allison Murphy, model: Melissa for Angies

Becoming a fashion photographer may seem a daunting challenge. You will be spending more time preparing shoots and post-processing your images than actual shooting. You need to have an interest in fashion. Expect to spend money and time as opposed to getting paid – if you’re in for the money: go become a wedding photographer! Seriously! There are a few fashion photographers who make a killing and earn tens of thousands of dollars per day but on average a bad wedding photographer makes more money than a good fashion photographer.

It is not enough if you snap 5000 pictures and eventually end up with one brilliant shot. You need to be able to recreate and you need to be able to do so on command. Not only that: you also need to always be able to adjust to suddenly changing environments, improvise a lot and think “out of the box”.

Jenna

make-up: Sommer Mbonu, hair: Allison Murphy, model: Jenna for Angies

I took the above 6 pictures in one session. 3 looks each. Every make-up demanded a different light setup and a different mood that wanted to be created. Because I had no idea what make-up and hair would look like until they got started, all the lighting had to be ad-hoc leaving little room for wrong decisions.

Even though my example shows Beauty photography pictures instead of Fashion photography pictures, I found it good to make this one point clear: you will need to deliver. Beauty photography is no fashion photography per se but every fashion photographer will want to master the skills required for beauty photography and most photographers in this field are required to offer both.

You are not alone

Unless you like taking self-portraits you will never work alone. The bare minimum is a model. If you are just starting out and don’t have friends who like being in front of a camera you may have to pay someone to model for you. By the time you get more experienced and have some of your work exposed to the public you will see that finding models is rather easy. At one point it seems a good idea to approach a local agency and offer test shots (they will most likely give you their new faces to shoot first)

Two very crucial players in your team are the Make-up artist and the Hair stylist. I have come to learn that both are very essential for a successful shoot. Again, if you are inexperienced you may have to pay them for their work. As time goes by you will want to participate in so-called Creatives where everyone in the team works for free (or for prints) in order to enhance the portfolio.

A Wardrobe stylist is especially useful if you are shooting an editorial which requires many different outfits. An “Art director” (or “Creative director”) will usually supervise a shoot, focus on details, help with posing and give general guidelines so everyone is on the same page. Often he is the guy who picks location and the overall theme.

From assistants to someone whose mere responsibility are fingernails, you can encounter many more roles on a set.

Having all those and adding wardrobe and location leaves you with many variables (infinite possibilities – and we haven’t even touched posing yet) and it is up to you to conduct everything to the vision that you see in a style that you have acquired.

A starting point

Read books or search for “photoshoot” on youtube, learn how to retouch photographs, know your equipment inside out, and assist another photographer in your town. Most important: keep taking pictures and learn to trust yourself.

1 In my opinion Dean is the only good photographer in that show.

AssetPackager Tracker

Posted almost 7 years back at Synthesis

Asset Packager now has a tracker where you can submit tickets. You can find it here.

If you have a bug to report, and/or a patch for Asset Packager, this is the place.

UPDATE: The url to the old tracker died and never came back, so the tracker has been moved. The above link has been changed to the new tracker URL.

ThreadsafeBenchmark

Posted almost 7 years back at Revolution On Rails

When testing products such as services which need to be stress-tested prior to release, it's necessary to use multi-threading to get as close to real world usage as possible. This gem, though not intended to be a replacement for full-fledged testing suites such as LoadRunner, can provide instantaneous results to facilitate TDD programming. To reduce the duplication of code, the gem utilizes Ruby's built-in Benchmark module for the base functionality while preventing the output from clobbering through the use of thread-specific IO buffers.

require 'threadsafe_benchmark'
include ThreadsafeBenchmark

threads = []
max_num = 5000

5.to_i.times { |i|
threads << Thread.new(max_num) { |n|
threadsafe_bm(6) { |x|
x.report("for:") { for i in 1..n; a = "1"; end }
x.report("times:") { n.times do ; a = "1"; end }
x.report("upto:") { 1.upto(n) do ; a = "1"; end }
}
}
}

threads.each { |t| t.join }

Using the standard Benchmark, the results would be printed haphazardly making it difficult to read and interpret. But ThreadsafeBenchmark cleans everything up giving us nicely laid out columns.

usersystemtotalreal
for0.000000.000000.000000( 0.002889)
times0.000000.000000.000000( 0.002477)
upto0.000000.000000.000000( 0.002479)
for0.000000.000000.000000( 0.002401)
times0.010000.000000.010000( 0.002586)
upto0.000000.000000.000000( 0.002413)
for0.000000.000000.000000( 0.002205)
times0.010000.000000.010000( 0.002245)
upto0.000000.000000.000000( 0.002272)
for0.000000.000000.000000( 0.001822)
times0.010000.000000.010000( 0.001958)
upto0.000000.000000.000000( 0.001943)
for0.010000.000000.010000( 0.010090)
times0.010000.000000.010000( 0.009225)
upto0.010000.000000.010000( 0.007986)

The gem and source files are available at Rubyforge.

ThreadsafeBenchmark

Posted almost 7 years back at Revolution On Rails

When testing products such as services which need to be stress-tested prior to release, it's necessary to use multi-threading to get as close to real world usage as possible. This gem, though not intended to be a replacement for full-fledged testing suites such as LoadRunner, can provide instantaneous results to facilitate TDD programming. To reduce the duplication of code, the gem utilizes Ruby's built-in Benchmark module for the base functionality while preventing the output from clobbering through the use of thread-specific IO buffers.

require 'threadsafe_benchmark'
include ThreadsafeBenchmark

threads = []
max_num = 5000

5.to_i.times { |i|
threads << Thread.new(max_num) { |n|
threadsafe_bm(6) { |x|
x.report("for:") { for i in 1..n; a = "1"; end }
x.report("times:") { n.times do ; a = "1"; end }
x.report("upto:") { 1.upto(n) do ; a = "1"; end }
}
}
}

threads.each { |t| t.join }

Using the standard Benchmark, the results would be printed haphazardly making it difficult to read and interpret. But ThreadsafeBenchmark cleans everything up giving us nicely laid out columns.

usersystemtotalreal
for0.000000.000000.000000( 0.002889)
times0.000000.000000.000000( 0.002477)
upto0.000000.000000.000000( 0.002479)
for0.000000.000000.000000( 0.002401)
times0.010000.000000.010000( 0.002586)
upto0.000000.000000.000000( 0.002413)
for0.000000.000000.000000( 0.002205)
times0.010000.000000.010000( 0.002245)
upto0.000000.000000.000000( 0.002272)
for0.000000.000000.000000( 0.001822)
times0.010000.000000.010000( 0.001958)
upto0.000000.000000.000000( 0.001943)
for0.010000.000000.010000( 0.010090)
times0.010000.000000.010000( 0.009225)
upto0.010000.000000.010000( 0.007986)

The gem and source files are available at Rubyforge.

Word Loop (#149)

Posted almost 7 years back at Ruby Quiz

Here's a fun little challenge from the Educational Computing Organization of Ontario.

Given a single word as input try to find a repeated letter inside of it such that you can loop the text around and reuse that letter. For example:

$ ruby word_loop.rb Mississippi
i
p
p
Mis
ss
si

or:

$ ruby word_loop.rb Markham
Ma
ar
hk

or:

$ ruby word_loop.rb yummy
yu
mm

If a loop cannot be made, your code can just print an error message:

$ ruby word_loop.rb Dana
No loop.

NetBeans: Helpful Plugins

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

So, NetBeans 6.0 Final was released a few weeks ago. v6.0 is all about the Ruby love, right out of the box. If you haven’t tried it, I implore you to give it a shot. Even if you’re not a fan of traditional “heavyweight” IDEs, I think you’ll be impressed with what they’ve done. There’s even a slimmed-down Ruby-only version. But sometimes, I must admit, I still miss the power and (relative) simplicity of vim.

I’m in the process of re-reading The Pragmatic Programmer, and was just pawing through the passage on “power editing”, in which Dave and Andy suggest that you “choose [one] editor, know it thoroughly, and use it for all editing tasks”. For me, that editor is most definitely vim. I’ve used it for quite some time, it’s familiar, I don’t even have to think about the keybindings when I’m working in vi, and I’m spoilt by the easy text manipulations that just aren’t possible with some fancy graphical editing tools. I use vim for practically everything text-related.

Everything, that is, except writing Java and Ruby code (and a few random tasks that have to be performed in a word processor, sadly). Yep, you read that right. I use vim for sysadmin tasks, hacking quick scripts, editing config files, and even taking notes, but lately I haven’t been using it where I’d probably see the single largest productivity boost from it.

Since switching to NetBeans, my comfort level with having all the tools I need in one place has increased dramatically, including things such as easy access to a console, in-IDE debugging, test output, solid class introspection, integrated rdocs, and so on. But I also realize that I’ve been doing myself a bit of a disservice when in “heavy edit” mode. Fortunately, that’s easily fixed, as there’s a vi plugin for NetBeans. YES. No idea why I didn’t bother to search for something like this before.

So in any case, if you’re interested, you can retrieve the NetBeans plugin from the jVi homepage. The file named nbvi-FOR-NB-RC1-1.1.2.×6 is the one you want (as of this writing, anyway). Once you’ve downloaded the package, you can install it in NetBeans by going to tools => plugins. Choose the downloads tab, click ‘add plugins’, select the vim core and keybindings plugins, install them, and be happy. Thanks guys, this is so awesome.

Oh and speaking of plugins, here are a few other helpful Ruby-related plugins for NetBeans that you may be interested in. Most of them are available through the plugins browser built into the IDE.

  • Rspec Support (nice!)
  • Ruby dark pastels color scheme (hrmm looks familiar…)
  • HAML and SASS plugin (if that’s the way you roll)
  • Extra Source Code Hints

Low Pro 0.5: Now Compatible With Prototype 1.6

Posted almost 7 years back at danwebb.net - Home

Today I tagged Low Pro 0.5 for release which now works with Prototype 1.6. There are a number of things about this release that are worth mentioning aside from the compatibility. Firstly, it’s gotten a little smaller as Prototype core now includes most of the functionality Low Pro used to add (DOM Ready support, inserting using DOM nodes and a lot more). It’s also got a couple of new features so here’s a rundown:

  1. Event.onReady delegates to the new dom:loaded event: Except that as before if functions are added after the DOM is loaded they fire immediately.
  2. DOMBuilder now delegates to Prototype’s new Element: Now difference in usage here though, just less code.
  3. Low Pro’s DOM methods are now gone: Prototype core does everything you should need now.
  4. Behavior.create() works just like the new Class.create(): Yes, you can now create behavior classes that inherit from other behaviors (or indeed any other class). See the Prototype’s site for more information.
  5. New core behaviors: The Remote and Observed behaviors are now included in the core so you can now turn normal links and forms into Ajaxy links and forms even more easily.
  6. Event.addBehavior.reassignAfterAjax is now false by default: Normally, if you are relying on this behavior it’s much more efficient to move to a solution using event delegation. However, if you do want your behaviors reassigned to new content after Ajax calls then go ahead and set it back to true again. Another solution is to manually call Event.addBehavior.reload();

So that’s about it. As you can see, it’s getting smaller as Prototype fills the gaps and graduating into more of a pure behavior framework. I’d be interested in adding more core behaviors for other common tasks as well as possibly getting together some kind of behavior library. I know I’m building up a fair few and I’d love to see what everyone else is doing (in fact I’ve already seen some great stuff) so suggestions are more than welcome…as are bug reports and patches. For both of these and general assistance try the Google Group.

Grab the new version and have a play.

Low Pro 0.5: Now Compatible With Prototype 1.6

Posted almost 7 years back at danwebb.net - Home

Today I tagged Low Pro 0.5 for release which now works with Prototype 1.6. There are a number of things about this release that are worth mentioning aside from the compatibility. Firstly, it’s gotten a little smaller as Prototype core now includes most of the functionality Low Pro used to add (DOM Ready support, inserting using DOM nodes and a lot more). It’s also got a couple of new features so here’s a rundown:

  1. Event.onReady delegates to the new dom:loaded event: Except that as before if functions are added after the DOM is loaded they fire immediately.
  2. DOMBuilder now delegates to Prototype’s new Element: Now difference in usage here though, just less code.
  3. Low Pro’s DOM methods are now gone: Prototype core does everything you should need now.
  4. Behavior.create() works just like the new Class.create(): Yes, you can now create behavior classes that inherit from other behaviors (or indeed any other class). See the Prototype’s site for more information.
  5. New core behaviors: The Remote and Observed behaviors are now included in the core so you can now turn normal links and forms into Ajaxy links and forms even more easily.
  6. Event.addBehavior.reassignAfterAjax is now false by default: Normally, if you are relying on this behavior it’s much more efficient to move to a solution using event delegation. However, if you do want your behaviors reassigned to new content after Ajax calls then go ahead and set it back to true again. Another solution is to manually call Event.addBehavior.reload();

So that’s about it. As you can see, it’s getting smaller as Prototype fills the gaps and graduating into more of a pure behavior framework. I’d be interested in adding more core behaviors for other common tasks as well as possibly getting together some kind of behavior library. I know I’m building up a fair few and I’d love to see what everyone else is doing (in fact I’ve already seen some great stuff) so suggestions are more than welcome…as are bug reports and patches. For both of these and general assistance try the Google Group.

Grab the new version and have a play.

Last blog post of 2007?

Posted almost 7 years back at Mike Mondragon

Synopsis

I’ve been in a writers block for useful bits of information to post on my blog. I guess I’ll give a summary of things I’ve seen and done lately and perhaps that will inspire others.

Work

I started my own S-Corp. to work freelance out of over the summer. I was motivated to do so after attending the The Business of Rails session at RubyConf 2007. And I’ve gotten a lot of great tips on how to be a business person in Rails from the Google group Ruby on Rails meets the business world

I started consulting through Contentfree over the summer. They are a Rails consulting shop and have been working on a startup for their Eachday photo and memories sharing site. Its been great to working with Dave Myron there. Dave is one of the best coders and software designers I’ve ever worked with and I’m not saying that just to get more work!

RubyConf

I went to RubyConf 2007. It was fun. I played a lot of Werewolf (see #53) in the evenings. Sadly, it felt like the close knit party was/is over in the Ruby community since all the momentum that Rails has brought to Ruby is bringing in the masses (I’m in that group, one of “those guys”). My guess is that RailsConf 2008 is going to feel like a JavaOne, and RubyConf 2008 will feel like RailsConf 2007 with to many tracks.

#fauna

At RubyConf I got to meet the people I’ve met in the #fauna channel on irc.freenode.net. I think some of the greatest Ruby code and ideas I’ve been exposed to are from people in that channel. Shout outs to adamblock, agile, evn, lifo, heaveysixer, loincloth, defunkt, and others.

Evan Weaver

Evan is a genius and pretty cool dude.

Pratik

Pratik is a genius and is very active on RailsCore contributions. He says Just Say No To Named Spaced Models so I guess you should ignore this post: Rails Models in a Namespace

Chris Wanstrath

Chris is a genius is full of ambition Ambition Google Group

ditching Typo

I’m probably going to ditch this Typo blog when I can make time to do it. I’ll either go with an another Rails based blog called Mephisto or Evan Weaver’s Bax blog which uses scripts and Apache SSI and is hidden on fauna’s SVN on Ruby Forge: ‘svn co svn://rubyforge.org/var/svn/fauna/bax’

like Ozimodo

I’ve been thinking about doing a Camping based tumblelog. I even paid a designer to make a template for it. I’ll blog about that latter. It will be like Ozimodo and probably steel code from it.

imPOSTor

I’m sitting on a Gem called imPOSTor that will post comments to forums such as phpBB and Web Wiz Forums . I’ll probably release within the month. It has been working inside a production grade private Rails app for over a month so I think its ready to be released. “The imPOSTor library is used to automate the act of posting comments and data to forums such as phpBB and WWF. impostor encapsulates the work of posting to these forums using a common (ruby) interface.”

MMS2R

I’m about to finish the next major version of MMS2R (2.0) . I think I’ve found the best architecture for it be maintained for the long haul. Each release of MMS2R is named after a character in the Metalocalypse cartoon.

Speaking of MMS2R Luke Francl and I submitted a MMS + Rails proposal for RubyConf 2008 called “Mobile Messaging with Rails”. Luke and I are also writing a PeepCode book about Rails+MMS+Mobile phones.

Last blog post of 2007?

Posted almost 7 years back at Mike Mondragon

Synopsis

I’ve been in a writers block for useful bits of information to post on my blog. I guess I’ll give a summary of things I’ve seen and done lately and perhaps that will inspire others.

Work

I started my own S-Corp. to work freelance out of over the summer. I was motivated to do so after attending the The Business of Rails session at RubyConf 2007. And I’ve gotten a lot of great tips on how to be a business person in Rails from the Google group Ruby on Rails meets the business world

I started consulting through Contentfree over the summer. They are a Rails consulting shop and have been working on a startup for their Eachday photo and memories sharing site. Its been great to working with Dave Myron there. Dave is one of the best coders and software designers I’ve ever worked with and I’m not saying that just to get more work!

RubyConf

I went to RubyConf 2007. It was fun. I played a lot of Werewolf (see #53) in the evenings. Sadly, it felt like the close knit party was/is over in the Ruby community since all the momentum that Rails has brought to Ruby is bringing in the masses (I’m in that group, one of “those guys”). My guess is that RailsConf 2008 is going to feel like a JavaOne, and RubyConf 2008 will feel like RailsConf 2007 with to many tracks.

#fauna

At RubyConf I got to meet the people I’ve met in the #fauna channel on irc.freenode.net. I think some of the greatest Ruby code and ideas I’ve been exposed to are from people in that channel. Shout outs to adamblock, agile, evn, lifo, heaveysixer, loincloth, defunkt, and others.

Evan Weaver

Evan is a genius and pretty cool dude.

Pratik

Pratik is a genius and is very active on RailsCore contributions. He says Just Say No To Named Spaced Models so I guess you should ignore this post: Rails Models in a Namespace

Chris Wanstrath

Chris is a genius is full of ambition Ambition Google Group

ditching Typo

I’m probably going to ditch this Typo blog when I can make time to do it. I’ll either go with an another Rails based blog called Mephisto or Evan Weaver’s Bax blog which uses scripts and Apache SSI and is hidden on fauna’s SVN on Ruby Forge: ‘svn co svn://rubyforge.org/var/svn/fauna/bax’

like Ozimodo

I’ve been thinking about doing a Camping based tumblelog. I even paid a designer to make a template for it. I’ll blog about that latter. It will be like Ozimodo and probably steel code from it.

imPOSTor

I’m sitting on a Gem called imPOSTor that will post comments to forums such as phpBB and Web Wiz Forums . I’ll probably release within the month. It has been working inside a production grade private Rails app for over a month so I think its ready to be released. “The imPOSTor library is used to automate the act of posting comments and data to forums such as phpBB and WWF. impostor encapsulates the work of posting to these forums using a common (ruby) interface.”

MMS2R

I’m about to finish the next major version of MMS2R (2.0) . I think I’ve found the best architecture for it be maintained for the long haul. Each release of MMS2R is named after a character in the Metalocalypse cartoon.

Speaking of MMS2R Luke Francl and I submitted a MMS + Rails proposal for RubyConf 2008 called “Mobile Messaging with Rails”. Luke and I are also writing a PeepCode book about Rails+MMS+Mobile phones.