Quotes can provide inspiration or food for thought. In this entry, I’m examining the use of open-uri and feed-normalizer to get a random quote which could be used as either a thought for the day or a “fortune” replacement.
Sep 05
A “grue”some look at Statemachine and Treetop
In this blog entry, dear reader, we examine the statemachine and treetop gems via an old standby, a Zork imitation. And, despite the title, you won’t find a grue.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
$ ruby adventure.rb This is the beginning. Like all tales, there's a beginning, a middle and an end.... Paths lead n. What do you want to do? n This is a path in the forest, it looks fairly well travelled. You see a clearing to the east Paths lead w, n, e, s. What do you want to do? e This is a clearing. You can actually see the sky here. Compared to the deep dark forest, it seems a relief. A path can be seen to the west. Paths lead w, n, e, s. You see the following: letter. What do you want to do? get letter Ok, you pick up the letter. What do you want to do? w This is a path in the forest, it looks fairly well travelled. You see a clearing to the east Paths lead w, n, e, s. What do you want to do? w You're lost in the depths of the forest. You're not sure where you are, nor how to get out of there. Paths lead w, n, e, s. What do you want to do? quit |
Sep 05
Converting a rails app from 1.2.6 to 2.1
This is the first in a series(???) of posts detailing things that I’ve found in the process of updating rails (and other plugins/gems) for an application. Due to politics, it’s using JRuby, running inside a JBoss container, with a Derby backend.
Things which are getting updated include:
- Rails
- ActiveRecord-JDBC
- ActiveScaffold
- ActiveScaffoldExport
- Goldspike is being replaced with Warbler
Here’s a list of what I’ve encountered thus far:
Sep 02
A language a year
The Pragmatic Programmers have proposed that developers learn a language a year. I agree that it’s very important to keep abreast of changes in IT and that by learning new languages we can keep our minds sharp and bring new ways of doing things into old languages. However, I have to wonder if this learning a language gets in the way of knowing a language.
I’ve always been a generalist, when I was younger I wanted to be a renaissance man. But sometimes I think that getting caught up in being a generalist is as large a trap as specializing in one thing and not not being willing to learn anything else.
When I was 19, I taught C at a local community college’s Continuing Ed programme. I’d been asked to do so six weeks prior to teaching the course. I followed K&R, and I know I was able to get the gist across to my students. I’d learned C, but I didn’t know C. It took at least 6-12 months of programming C day-in, day out to know the language.
And then there’s unix. I recently celebrated my 20th aniversary of using it. I can claim to having learned it, even perhaps understanding it. But knowing? I’m still discovering new aspects of it.
I agree that it’s important to learn new things, but sometimes you need to just know a thing.
Aug 29
$0.23 Skiddoo
Just for grins and giggles, I went to see how much I’ve earned from scribefire thus far — $0.23 cents — they’ve determined that 218 impressions have been viewed.
That said, I’m currently at about 1520 views for the last three weeks. I did the scribefire on the 25th, I’ve had ~400 views (according to wordpress) since then. I expect that a good bit of the traffic is feed related (hence no ads), but still, as an experiment, it means that at my current rate of views I make $1/month, which is 20% of my hosting fee — that said, I’d like to plug my provider, DrakNet
(if you click on that link and sign up, I do get an affiliate fee). They’ve been simply wonderful to work with. Their tech support is great and they really are friendly and go the extra mile. I can’t recommend them more highly. Additionally, they are carbon neutral, if you’re into that sort of thing.
Aug 29
CSS tooltips using CSS Sprites
For a project I’m currently working on I wanted to make some “bubble” tooltips. In order to cut down on the size/number of images, I’m using css sprites. A quick google reveals that nobody else has (at least on the first page) put together tooltips using sprites. The technique will work with any sort of image, so you needn’t use the “bubbles”. So, here’s how I did it, with the caveats/gotchas.
Aug 29
Blogs I’m excited about…
Earlier I was going through rss feeds when I noticed that a blog had been updated. I thought to myself “Oh, cool! they’ve updated.” It struck me that there are certain individual (as in written by an individual) blogs which I follow and am excited when I see posts. Here’s a partial list — bear in mind a number of blogs (most, in fact) I read through aggregators. While there are some really nifty ones there, I’ve left them out. Also I’ve left out “magazine” blogs, however cool they may be. Well, with one exception, which I miss, and I believe others miss a lot.
In no particular order, I present….. (with links to feeds):
- Dion Hichcliffe’s Web 2.0 Blog
- Creating Passionate Users
- Presentation Zen
- Software by Rob
- Muness
- 24slash7
- Creative Generalist
- Hackity.org
- Igvita
- Veerle’s Blog
Does anyone have feeds like these that they love to see?
Aug 28
CSS “width” gotcha
I found out something interesting today. Per the W3C, the total “width” that a block element uses is:
If ‘left’ or ‘right’ are given as ‘auto’, their computed value is 0. The following constraints must hold between the other properties:
‘margin-left’ + ‘border-left-width’ + ‘padding-left’ + ‘width’ + ‘padding-right’ + ‘border-right-width’ + ‘margin-right’ = width of containing block
This made life interesting while working on a css sprite (more on that next). I kept wondering why it bled into the next sprite….
I had thought it was the total width of the element. Foolish me. Now I know and……
Aug 27
Programming philosophy in the oddest of places
Today’s thought for the day from A Word A Day is:
Not being able to govern events, I govern myself.
-Michel de Montaigne, essayist (1533-1592)
This struck me as being very much the idea behind defensive programming. Because we don’t know what sort of events life will throw at a programme, we need for it to be robust and able to respond to most anything, barring, of course, Fear, Fire, and Foes.
So how do we go about doing so? For starters, there’s testing, whether BDD or TDD. Boundary conditions and fencepost errors frequently cause grief. And any time the programme interracts with the “outside” there’s room for error — whether it be bad data or an I/O error.
Aug 26
Mini Sagas
One of the manifestos from ChangeThis this month is about Mini Sagas. The author, Rajesh Setty presents the idea that writing mini sagas, which contain exactly 50 words, expands your creativity — following on the idea that Creativity Loves Constraints. Typically the mini saga expresses some sort of message or value — I think in some ways they might be like koans or zen stories. Here’s one I’ve written:
Once there was a developer who wanted to make the new killer app. He plotted and planned for months, seeking perfection. He planned for infinite scalability and flexibility. Then he coded.
Another developer wrote code that was just enough to solve his problem. And the problem of millions more.