Articles

2. Ruby Blocks - Part 2

In this screencast you will learn: * Differences between Proc and Lambda * Using multiple proc objects in a function * Closure * Converting Procs to Blocks * and more...

1. Ruby Blocks - Part 1

In Ruby (like in Smalltalk), one of the killer features are blocks. This talk looks in depth at what Ruby blocks are and how they are used to show what they afford a programmer that most other languages don't. Blocks turn out to be a general purpose approach to creating clear, clean, versatile and often elegantly encapsulated interfaces.

Taming Your Views

Here’s a note I should have posted a couple weeks ago..

The Taming Your Views talk I gave at the Charity Workshop for the Lone Star Ruby Conference is available at MindBites (along with the other talks filmed that night), with proceeds going to charity.

MindBites has some interesting videos (and you get some free credits when you sign up), so go have a look. Many thanks to Damon Clinkscales for putting the workshop together and handing video QA.

introducing QuarkRank

We're back to blogging after taking a leave for more than a month. We have been very busy developing QuarkRank, a summarized reviews repository. It is a result of more than 18 months of dedicated research on Natural language processing, HTML Scrapping and User interface. Finally, we are happy to make this product live!!!

Currently, the repository is accessible using RESTful API or Widget. Moreover, its absolutely free!

10 Minutes with Factor

Factor is a stack-oriented language, similar in that respect to Forth and Joy. I’ve played with both at one point or another, so when I recently ran across a reference to Factor in a recent interview with Zed Shaw, I thought I’d take a look. I’m always on the prowl for little esoteric languages, hoping to harvest new (or newly revised) approaches to software development.

Rails 2.0 and Scaffolding Step by Step

Rails 2.0 step by step.

Gem

Rails plugins have been a great tool to have around; just look at the amazing number of plugins that have popped up over the last couple of years; great ideas from all over the place. Plugins are so easy to put together and distribute that many people who’ve never released software before

They also have some pretty serious flaws. There’s no built-in versioning or Rails version requirements. There’s no dependency resolution. There’s no real metadata or built-in search functionality.

An easy way to make your code more testable

James Golick wrote a
very good article about testing a while ago. In it he dissects (and refutes) the too often heard arguments where people say they don’t write automated tests because they don’t have the time.

Rails 2.0 is out

Yes, yes, I've been awfully quiet here lately. But let's blame that on the long crunch session for Rails 2.0 and call it cheers, ye? It's out, gawd dammit. Finally. After about a year in development and oh-so-many we're-almost-there's. Feels good, does it.

Now I just have to put the final hand on the new screencast for Rails. The current one is awfully stale.

So dig in and get it: Rails 2.0.

Syntax Changes in 1.9

I think one of the more interesting conversations that’s going to occur in the Ruby community once 1.9 is released is how we integrate the syntax (and behavioral) changes coming into the language in as elegant form as possible. Over time, the consensus (or at least conventional usage) will drive what we label Rubyesque (that is, idiomatically Ruby); what is accepted, what is absurd, what is clean, what is over-engineered, and what is far more clever than it is smart. We’ll be reforming the feel and taste of Ruby using new artistic tools.

Extending Tokyo Cabinet DB with Lua | Rails Fire

Extending Tokyo Cabinet DB with Lua

Tokyo Cabinet is a trove of hidden of gems, the more you learn about it, the more you will appreciate the design and technical decisions behind it. By database standards it is a young project (started in 2007), but since it is a successor to the QDBM project developed by Hirabayashi-san (2000-2007), we could make the argument that it has been, in fact, nine years in the making.

Best of all, the rewrite allowed the project to shed its past baggage and build on a more modern stack with a better perspective of the required features for a modern deployment (Drizzle is another recent example from the MySQL camp). Case in point, Tokyo Tyrant supports Lua scripting on the server, allowing us to add arbitrary user defined functions (UDF's in MySQL parlance) and to extend the database itself!

Lowering the Barrier With Lua Scripting

If you have played with Lego Mindstorms, or ever tried to script your phone or a gaming environment (WoW), chances are you've worked with Lua. Due to its extremely small footprint (~212kb for source, documentation, and examples), fast interpreter, portability and easy to understand syntax it has become the de-facto embedded scripting language for many applications. Explore the available tutorials, or pick up "Programming Lua" by the creator of the language for a more in depth look, it's a fun language!

So why is Lua scripting such an exciting feature for Tokyo Tyrant? Because it lowers the barrier for programming and extending the database by an order of magnitude! If you have ever worked with MySQL UDF functions, you'll definitely appreciate the ease and the speed of development. No need for mucking with internal API's, nothing to compile or link against, and execution is done within a stable and sandboxed environment.

Extending Tokyo Tyrant with Lua

Anytime you bootup a Tokyo Tyrant server you can tell it to load arbitrary Lua code alongside which will then be evaluated at runtime if the client requests it. From there, the developer of the extension has full access to the incoming request and the underlying Tokyo Cabinet database, allowing us to inject arbitrary functionality. To get a flavor for the workflow, take a look at some of the examples in the following slides:

tokyo-recipes.git (Lua Extensions for Tokyo Tyrant)

Downloads: 474 File Size: 0.0 KB

Because the Lua scripting interface is relatively new, the number of available extensions and documentation is not very large. For that reason, I've started the tokyo-recipes repo on GitHub, in which I've aggregated some of the available extensions, and added extra documentation and examples to help grease the wheels: TTL functionality (ala memcached), working with Sets (ala Redis), session timestamping and a wordcount map-reduce example just to name a few. Give it a try, it is an extremely powerful feature!