Archive for the 'Nerding' Category

Complain all you want, we’ll sing more.

nerkles May 15th, 2008

Look everybody, my first real live Ruby on Rails app!

The Chicago Complaints Choir was looking for a good way to collect new complaints so we can write a new song or two. I’ve been meaning to learn Rails, but couldn’t scrape up the motivation without something “real” to work on. And thus a giant robot was born…

Announcing the Complain-O-Tron 3000™: Complain Here!

Please send in your complaints about anything, one by one, whenever you think of one, and get them off your chest!

Shell History

nerkles April 11th, 2008

Ok, I’ll bite on the shell history meme.

This command will tell you the top 10 things you’ve been typing in the shell.

isaac$ history|awk '{a[$2]++} END{for(i in a){printf "%5d\t%s\n",a[i],i}}'|sort -rn|head
  101   nosetests
   68   paster
   45   cd
   38   ls
   34   hg
   25   rake
   21   script/server
   21   script/generate
   16   sync
   16   rm

Yes, despite being a total Python freak, I’m using Rails a bit lately. I kinda like 2.0… it’s much more polished than 1.x… but so far I still like Pylons + Elixir better… subjectively. It’s too soon to say whether that’s just my relative amount of experience in each framework. I’ve been using Python for years, and Pylons for enough time to know it very well. But I’ve only been dabbling in Rails and Ruby.

I have this sort of tic where I type sync all the time. I picked it up from a sysadmin I knew back in the day (late nineties, remember Mosaic?). I didn’t know so much Unix back then (or was that Solaris flavor?) and I saw him type it all the time and I figured it’s just what you do right after you do something else. It’s useless now, but I still type it all the time anyway without even thinking about it. It just flushes buffers to disk. Back then, on that particular web server (probably a pre-1.0 Apache), my changes to sites would not show up if I didn’t run sync, so it became this ingrained habit to type it after changing anything, and I still do it 10+ years later.

And I’m sure typing hg a lot lately. I’ve switched every project I’m in control of (at home and at work) from subversion to mercurial. Yep, it’s that awesome, and I doubt I’ll be looking back. Not to say something better won’t come along one day, but for now it’s the bees knees in version control.

What I Want from CSS3

nerkles March 5th, 2008

Well you asked…

Positioning and sizing of elements relative to others. Grouping of elements. I want to say #a #b and every div.awesome constitute a group named #superGreat, and then be able to say that #c should always appear below that group, or to the right of it, or 23 ems from the top left of the group. I want to say that every item in that group should have the height of the tallest one among them, based on its content… or that all the members should have their bottom edges aligned, and the tops move down based on each element’s size.

I realize that this is difficult to implement in a rendering engine because an amateur could easily create circular dependencies (to name just one of many). I’m not opposed to the browser throwing an error dialog in this situation. We’re all grown-ups here, and if you can’t think through your design well enough to avoid infinite recursion, then you need to think it through again.

Next, I want to have variables where I can define a set of color, borders, backgrounds, or whatever, and then apply that set of styles to other elements.

That’s about as simply as I can say it. That’s what I want from CSS3. Give me those in every browser and maybe I’ll stop complaining. That’s not true. I joined the Chicago Complaints Choir for cripes sake. But give me those things, and I’ll complain about something else instead. How’s that for a deal?

My Early “‘L33T H4X0R” days

nerkles April 21st, 2007

So I was just listening to Ben Folds’ iTunes Originals interviews today. In one of the tracks he talks about how he’d write obnoxious songs and put them on a tape to see how people would react. Then he’d go to JC Penney and put it on a stereo and play it in the store. So all of a sudden memories of one of my old favorite pastimes came back.

My first computer was the venerable Commodore 64, and I quickly taught myself to program by typing code out of magazines and then seeing what happened, and then trying out my own ideas.

I got to be pretty good at it. And like most kids, I had to go to various department stores with my parents or grandparents and they’d often leave me in the computer section while they were off getting socks and cat food.

The little impromptu program I’d write would:

  • disable the “Run/Stop” key
  • start a countdown timer for 1 minute
  • put an obnoxious message on the screen
  • start the screen flashing through every possible combination of text & background colors
  • play a terrible siren-like noise

Then I’d turn the volume all the way up, run the program, and get far enough away that I wouldn’t be seen, sometimes I’d go down the escalator, just close enough to hear.

I did that to every department store Commodore 64 that crossed my path for quite a few years.

So to all you department store computer salesmen (they were always men) who had to figure out how to make it stop… well, you got what you deserved. I did it because every one of you would treat me like an idiot if I had any questions or wanted to chat with you about computers. I laughed my ass off every time, and you never caught me. Sometimes it took you a long time to figure out where the volume knob was.

Remember this story next time you’re busy underestimating a 12 year old.

Emergency IT Hologram

nerkles April 21st, 2007

I’ve been catching up on old episodes of Voyager lately. So I had this dumb idea… If I were the Emergency IT Hologram, I’d appear and say:

“Please state the nature of the computational emergency.”

(And there have been many of them the last few days, so I kinda feel a little robotic.)

Dilbert Vista

nerkles April 19th, 2007

If there were an Operating System equivalent of the Dilbert Mission Statement Generator, it would surely have spewn Windows Vista.

Automatic “waiting for” emails

nerkles September 15th, 2005

Regarding the clever trick for automating your emails that require follow-up.

Here’s what I did (I use Apple Mail on Tiger):

  • Created a couple extra signatures, one with my usual sig, plus a tag like [*ABC.wf*] (where ABC is your initials or something unique) which I set to be white text and very tiny so it’s invisible to most people. I also made a sig called “inivisi-wf” with just the tag in white, for less formal emails.
  • create a Rule like “message content” contains [*ABC.wf*] and have that route the message to your Waiting For… folder.
  • BCC myself on WF emails.

This was much easier than setting up a whole other email address, and I don’t really care if someone with a non-HTML capable email client sees my little tag.

It has the added benefit that replies will also go to your ‘waiting for’ folder if the responder doesn’t strip your sig.

Crackpot Idea for Core Data Multi-User Document

nerkles August 5th, 2005

I’m still a bit new to Cocoa and Objective-C, but not to programming in general.

I’ve been grappling with a way to use all the goodness and time-savingness of Apple’s new Core Data such that multiple users can access the same data but not mess each other up. I have no idea if this would work. But I’ve done quite a lot of digging and the consensus seems to be that this is impossible, and it would be much easier to settle for FileMaker 7, or maybe Servoy or 4D.

From what I’ve read on various listservs and forums, it seems that it’s safe for multiple users to access the same Core Data document over AFP (assuming it’s stored in SQLite format), and it’s quite unlikely to get corrupted. The problem is that no notifications are sent, so if User A and User B are both editing the same Object, you could run into trouble: they can overwrite each others’ changes and that makes the data unreliable.

My crackpot idea for a potential way around this problem is that the Client app has to log in to a Coordinator server. Any time a user starts editing an object, the client sends a notification to the Coordinator, which quickly tells all the other Clients to lock their user from editing that particular object. When the edit (or creation of a new object) is complete, client tells Coordinator, which tells the other clients to refresh their copy of that object. This might require the use of an “Edit” button similar to how Apple’s Address Book works.

The client app has to be responsible for sending some kind of “hey, I’m editing this object” message to the Coordinator before letting the user finalize a change, and it has to quickly mark an entire object uneditable when it receives a notification from the Coordinator (which means each client is running a server thread to listen for these).

Here’s a rough diagram:

Idea for Multi-User Core Data document

That’s the basic idea. So am I nuts? Is this just too impossibly complex, is it even possible, is there a better way?

I was also kicking around the possibility of the Client apps coordinating themselves, by way of Bonjour. But that means you couldn’t run this across the Internet, only on a LAN (which may be OK for most cases, and there is always VPN).

Anybody want to work together on an open source proof of concept?

Is JavaScript “Back”?

nerkles March 14th, 2005

Molly.com has an interesting post (and ensuing discussion) about “The Return of JavaScript”.

I posted this in the comments (so far it seems to still be in the moderation queue UPDATE: it’s posted now.):

It is “back,” but in a new way.

JS + DOM + CSS enables us to start with a basic, standards-compliant, accessible page first, and then add in some clever tricks and styling with JavaScript and the DOM later (after the page loads). It’s tricky (though a fun challenge) to do it in ways that don’t ruin the order in which a screen reader like JAWS will read the page. Using a post-page-load script to move elements around can help you determine how search engines and content indexing systems will read your pages, but you can still have the layout you want.

I recently wrestled that one down (I think!) in this method of adding a floated sidebar that text can wrap around while keeping it at the end of the source.

The DOM can become a good friend to standards-based design now that a majority of browsers support it well. And emerging things like Ajax can make very interesting use of the DOM too.

The Modern Sidebar

nerkles March 8th, 2005

Here’s a simple technique to add a floated sidebar to a web page with the following features:

  • uses table-free layout with CSS.
  • source-ordered: the sidebar content is at the end of the XHTML source code.
  • good accessibility.
  • graceful degradation: still visible and usable in old browsers (pre-5.x), but it’s at the bottom of the page and accessed via anchors instead of floated alongside the article.
  • uses unobtrusive JavaScript to move the sidebar into place on modern browsers at page load time.
  • you can style it however you like with CSS.

Here is a complete example.

And here’s what it will look like on older browsers. (This is the exact same XHTML & CSS, minus the JavaScript.)

An Accessibility Story

I downloaded the demo version of JAWS to get an idea of how this would work out. My first attempt at this placed the sidebar into the flow of the document’s body, but running JAWS revealed that it reads you the document after the JavaScript has had its way with the DOM. What to do?

The technique leaves the sidebar at the bottom of the document by performing this series of steps:

  1. move a copy of the sidebar into the document via the DOM to where you want it appear.
  2. get its pixel size and position
  3. remove the copy of the sidebar from the DOM
  4. replace it with a floated, empty div of the same dimensions
  5. position the actual sidebar content on top of the empty one with absolute positioning, setting its position and size to match.
  6. repeat this process at onresize events

I’d appreciate if any users of screen readers or other assistive devices out there would report whether this technique works properly for them. From my tests, it works well in JAWS.

I suspect a similar problem is cropping up for JAWS users with the Semantically Correct Knockout Quotes technique I posted, so I’ll have to re-visit that at some point.

NOTE: this requires the X library, and you may need to adjust the path to it in the JavaScript to match where you put it.

Next »