firebus's blog

firebus's picture

A sequencing problem

I had to implement a function the other day to abbreviate a set of days of the week, taking every sequence of adjacent days and replacing them with a hyphenated range. Comma-separating non-adjacent items.

So, {Mon, Tue, Wed, Fri} would become "Mon - Wed, Fri"

I came up with a really ugly, mishmashy recursive solution for it.

Bigokro suggested a non-recursive, linear-time algorithm which is not terrible.

But I still feel like there's something more elegant out there.

Does anyone know if this kind of algorithm has a name and if there's a canonical solution?

firebus's picture

Metalike and Node Knockout

I participated in Node Knockout, a 48-hour Node.js hackathon/competition as a solo team.

My intent was to learn node by failing, and I think I succeeded. My entry, Metalike is full of fail, and barely works, but I have a much better understanding of node, it's ecosystem, and what I need to work on the become more useful as a JavsScript developer.

You can still click through to my team page and vote for me if you want to!

firebus's picture

Including external javascript files in drupal 6

In D7, drupal_add_js can handle external javascript files, but in D6 it cannot handle external js in a nice way.

Most people instead include external js with a preprocess_page function, or hook_footer. However, in both cases, the external js is added before the scripts added by drupal_add_js (the $scripts page template variable) which can be a performance problem.

I've seen one kind of nasty workaround that (ab)uses drupal_add_js to make a call to document.write:

firebus's picture

Backwards compatible casual games

The problem with multiplayer (or massively-multiplayer) casual games is that at some point after release, everyone moves on to the next big thing and they become empty wastelands. Crickets. Tumbleweeds.

I propose that a games publisher release a series of games where the actions in the most recently released games are translated into actions in the previous game.

firebus's picture

Bromance Novel

Romance novels are the largest and most profitable segment of the publishing industry. This is kind of sexist - where are the bromance novels? The committee suggested a great name for a bromance novel imprint: Porterhouse.

firebus's picture

Electric Digeridoo

Not just a digeridoo with a microphone in it, but something with a pickup similar to the wind controller of a digital saxophone.

firebus's picture


Maybe these guys would be willing to take on the challenge of making thongcks a reality?

firebus's picture

Creating a custom submit button with webform API

I've been building some custom components with the webform API. Each component contains a set of related form fields, and one of them has a number of different fieldsets, each with its own submit button. We'll theme this component to make it appear as if there are multiple forms on the page.

It's easy to add extra submit buttons through the webform API, but harder to make them work. When I hit one of my component submit buttons, the form would reload the same page instead of submitting the form, or going to the next page.

firebus's picture

Susan G. Komen For Bad

I've been unhappy with the pink ribbon people for awhile, and for a lot of these reasons, but it's nice to see them presented in such a concise and complete list.

AFAICT, these folks are only interested in promoting themselves, defending their turf, and hoarding money. It would be great if instead of hearing about their corporate deals and their attempts to stifle competition in their space we heard about their impact on meaningful research.

Syndicate content

Powered by Drupal - Design by Artinet - Amazon Affiliate