August 29th, 2009 4:00:02 pm pst by Sterling Camden
Posted in Share the Love | No Comments » RSS 2.0
August 27th, 2009 6:00:04 pm pst by Sterling Camden
Posted in Share the Love | 4 Comments » RSS 2.0
February 27th, 2008 2:33:31 am pst by Sterling Camden
-
Wow, SNL can still be funny…
-
I never liked final/sealed classes in Java/C#. I’ve always thought that methods want to be virtual. But I must admit that when I first learned Ruby I thought that open classes were heresy. Two years later, it’s become a requirement.
-
Manufacturers disagree — they have a large effect on the transference of cash. Thanks,
Joseph.
Posted in Share the Love | 2 Comments » RSS 2.0
February 26th, 2008 4:07:47 pm pst by Sterling Camden
MySQL and I are acquainted, but we have yet to establish an intimate relationship. She’s a cheap date who’s always available and doesn’t make a scene. But lately she’s been eluding my desire for something more exciting. Maybe she’s jealous because I want to bring Ruby in on one of her triggers.
Maybe you can help me to be more persuasive. I need to execute a Ruby script whenever a row is inserted or deleted on a specific table. Ideally, this should occur as immediately as possible. It would make sense to do this from within a MySQL trigger function, but there doesn’t seem to be any easy way to get there from here. I searched the MySQL forums and found three similar requests, but no answers.
Guy Naor posted exactly what I need except that it uses Postgres’ LISTEN/NOTIFY mechanism, which is sadly lacking in MySQL. Unfortunately, we don’t have the option of changing database servers.
Baron published an approach using advisory locks as a notification mechanism. But commenter Arjen Lentz said “I’ve tended to advise against using MySQL’s advisory locking functions, there are enough pitfalls to make it undesirable in terms of relying on it for an application” — without specifying exactly what those pitfalls are. Besides, the idea of using something intended as a lock in place of a message seems like it’s bound to get, um, locked up.
We’re currently considering using a polling mechanism instead. The trigger function would insert a row into a new table that acts as a queue, and the polling process would read the queue and handle the notifications. But that does introduce a delay of up to a little more than our polling interval, and it also seems just a bit Mousetrappish. I’m hoping that some of my readers who have taken MySQL and Ruby around the block a few more times than I have (glances with puppy dog eyes in the direction of Assaf, lower lip protruding and trembling slightly) might come up with a better idea (pppplease).
Posted in Coding...OK?, Wildly popular | 2 Comments » RSS 2.0
January 17th, 2008 2:09:23 am pst by Sterling Camden
Posted in Share the Love | No Comments » RSS 2.0
January 25th, 2007 5:46:34 pm pst by Sterling Camden
Sightings: “The 47 Society is dedicated to exploring the phenomenon that is 47.”
Doug Karr on a little-known but very useful Firefox feature: keymarks .
Everything you ever wanted to know about CSS, but were afraid to ask (thanks, Assaf ).
TDavid on writing good content. Writing may be one of the 3 R’s, but it’s all about the 5 W’s.
Some bizarre ancient artifacts that make you question everything we “know”. I have to wonder if some of these aren’t being a bit hyped, but they do make you wonder. (via Mercola)
Ruby Brazil features my Rats on Rails. Obrigado!
locopoco: “Das Leben, Das Universum und Ich”. Und mein tagcloud widget. Danke und guten tag!
Posted in Share the Love | 5 Comments » RSS 2.0
August 9th, 2006 7:18:23 pm pst by Sterling Camden
-
Ruby on Rails in Visual Studio 2005 (thanks TDavid). If I can overcome the horror of this wicked union, I might find this to be, well, wicked.
-
Just go look at it.
Posted in Share the Love | No Comments » RSS 2.0
July 6th, 2006 2:04:07 pm pst by Sterling Camden
Apparently I was mistaken the other day when I said that I had never worked directly with REST.
A post from Assaf the next day led me to dig further into what REST is. Turns out I’ve been doing a lot of that. Any time you write an RSS or ATOM feed and make it available at a URI, that’s an example of REST. Ruby on Rails uses RESTful URIs in their implementation of the model-view-controller pattern. Some even say that every web page implements REST, though that’s stretching the definition pretty thin.
I haven’t yet implemented any web services using REST, though. I’ve always used SOAP for that. I can see how REST could simplify the implementation and speed up execution, not only by removing the envelope but also by transferring the method name to the URI. It separates the calling mechanism from the document, so you only have to transmit and parse the data and its metadata.
On the down side, you must create a consistent and extensible URI scheme (like Rails has) in order to do anything complex. You must validate that clients are using the URIs in an acceptable manner (just as you have to validate the XML in a SOAP request). Seems like you would also want to rely more on the web server for implementing security, in order to use more GET operations for retrieval rather than posting credentials or tokens. Not that there’s anything wrong with that.
But I was having trouble understanding Assaf’s distinction between REST and XML/HTTP, until I ran across this post from April, 2005 by Dare Obasanjo. At least I think it’s the same distinction, or part of it. Distilled into a nutshell (and mixing my metaphors), you can’t call it RESTful if an HTTP GET operation can be used to modify data on the server. Dare gives some good examples of APIs that violate that rule of “safe and idempotent methods”. A RESTful system should use HTTP POST, PUT, or DELETE for operations that affect server data.
But I think there might be more to Assaf’s distinction than that — particularly in drawing a line between REST and “SOAP Lite”. Maybe he’ll stop by in the comments and clarify it for me. Specifically, in what ways did this promise fail?
BTW, I agree with Assaf’s main point. The interface contract between disjoint systems can never be an “implementation detail”.
Posted in Coding...OK? | 7 Comments » RSS 2.0
June 20th, 2006 4:32:40 pm pst by Sterling Camden
TechCrunch was the first to give me the news: Opera 9 has been released. So I downloaded and played with it a bit. Check out the built-in bittorrent support (slow, as Marshall notes). Tab preview and widgets are, well, cute. Not enough here yet to pull me away from Firefox, even though of late Firefox has been frequently slowing down for me. Maybe I have too many extensions installed.
But on to the one true test: the infamous Rat Race. In case you don’t recall, this little Ruby on Rails application injects ten crudely animated rats with AJAX amphetamines so you can watch them spasmodically race for the cheese. For a benchmark of how responsively a browser handles AJAX, we get these ravenous rodents worked up into a good lather and then attempt to yank the track right out from under them by navigating to another page. Opera 9 performed exactly the same as Opera 8 on this test, ranking second-best among browsers I tested, at 13 seconds to navigate away. Hey, at least they didn’t break anything. Firefox still reigns supreme, at only 5 seconds.
Yes, I know. The Rat Race only tests a very tiny subset of what’s important in a browser. But it provides me the wicked pleasure of wagging my finger at Internet Explorer and its bastard offspring Maxthon.
Posted in Geek Meditations | No Comments » RSS 2.0
February 17th, 2006 8:15:33 pm pst by Sterling Camden
This blog entry on “Elegance” by apotheon has been simmering on the back burner of my mind for over a month now. Sometimes I’ll take the lid off and give it a little stir and taste it, maybe adding just a pinch of salt. Though I might not agree with all of the characterization of OOP in this essay, it certainly makes some good points about agile programming and the need to “slaughter the holy cows”, as David Heinemeier Hansson once said regarding the philosophy behind Ruby on Rails.
Even though, as apotheon states, OOP may be mostly used to keep mediocre programmers from creating a code nightmare, the concept didn’t start out that way. OOP is supposed to be used to model real-world objects in code, so that the abstractions and categories in the code mirror those of the objects whose functions are being automated. That should, I think, fit into the agile paradigm quite well if done properly. As I mentioned in a comment on apotheon’s post, the key is to make the abstractions at the right levels. If you over-dissect your objects, you end up with gratuitous inheritance models. On the other hand, if you over-generalize your classes, then you end up doing all sorts of “case on type” tests within the methods.
As I also intimated in my comment, apotheon’s post really seems to call for a language change, over and above (but including) a change in programming style. Working with Ruby a lot lately (here, here, here, and here) has opened my eyes to how much more agile a programming language can be when it allows you to break some of the Holy Laws of OOP: type safety and immutable interfaces are two that pop to mind. Both of those features of Java/C++/C# (and others) seem to specifically relate to preventing Junior from shooting himself in the foot. In the agile model, Junior shouldn’t even have the gun. Give it to someone who knows how to use it, and allow them to remove the safety.
The next question that occurs to me is “what’s next, then?” How many times in the past have I witnessed the birth of The Ultimate Programming Language, only to have it become obsolete within a decade (or less)? Undoubtedly, LISP wears its age better than any other language. What more can other languages learn from LISP, or invent on their own, that will make it easier and (more importantly) clearer (dare I say, more elegant) to describe the abstractions that mirror real-world objects and processes?
Posted in Coding...OK? | 2 Comments » RSS 2.0