Naim Falandino

a guy who doesn't write enough

Category: computing

Catastrophic drive failure

My storage drive appears to be toast. I’m a bit too distressed right now to really go into it, but I probably lost 200 GB of data easy. The rub is that I just consolidated all my data onto that drive because I was planning on building a file server with redundancy in just a couple weeks.

I’m still hoping for a miracle that I’ll be able to rescue the data, but honestly at this point it doesn’t look good. At all.

One of my role models turns 70

Today is the 70th birthday of Donald Knuth. For those of you who don’t know, he is arguably one of the most notable and influential figures in the history of computer science, and certainly the most important one who is still alive today. Though the guy has produced just an amazing amount of written works he’s probably best known for The Art of Computer Programming; that’s how I was first introduced.

When I was a young kid, around six or seven years old, I was starting to get more and more interested in computers and more specifically how they worked. I was extraordinarily lucky. At that age (we’re talking around 1988) I wasn’t only fortunate enough to have access to a computer in the home, but I had my own computer. My dad (being an electrical engineer and very interested in computers) always liked this kind of stuff, and so we had a computer in the house from as early as I can remember. I remember getting several different computers. First, there was the old Radio Shack kit. Next, the Atari ST and then, a quantum leap in terms of capability and power: the Amiga 1000.

This was the system that I really cut my teeth on. I learned my first programming language (AMOS Pro) on that system when I was about 8. Looking back the AMOS Pro (albeit a simple language) was an amazingly complete package. I think it was a great language to learn as a beginner, not only because it was simple, but also because it didn’t actually interface with AmigaOS; programs you wrote in AMOS controlled the computer directly. This ended up being a bit of a fault with the language in the long run (the Wikipedia article cites a few reasons) but as a kid just trying to understand exactly what was going on it provided that “against the metal” experience that I think is crucial to really form a solid understanding of what it means to actually program a computer. The tools have gotten sophisticated enough and the systems have gotten sufficiently complicated that I think some of that is lost in the current day and age, definitely for most general programmers. Even graduates of well renowned computer science programs often don’t have would I would consider a complete understanding of the processes involved.

But I digress. The point is that I was lucky to have so much exposure so early to computers. (Well, I guess lucky is one way of looking at it.) Some years pass and I’m now about 9 or 10 I have my very own Amiga 2000 in my bedroom and we also have a Hayes 1200 baud modem. Talk about good times. But it wasn’t enough. I needed to know more. I was interested in it, but beyond doing some sprite-based games in AMOS I didn’t really have an appreciation for everything else that you could do with a computer. That’s when I found my dad’s copy of The Art of Computer Programming Volume 1: Fundamental Algorithms.

This book basically laid it all out. While a good deal of it was over my head, I was sufficiently familiar with the concepts where I was able to understand a fair bit, and figure out quite a bit more. I think that was probably one of my biggest jumps in understanding about programming, even more than when I went to college to study computer science. And at that point I was also hooked. The light had turned on and finally I understood just how broad the field was.

So, thank you Donald Knuth. I’m sure there are many others like me who found something amazing in your books and made it their life’s work as well.

New theme

The last few weeks I have been getting really tired of the default-y theme. Luckily I happened across this theme which I actually liked. Most of the pre-built, freely available themes for WordPress that I can find I’m really not a fan of. I’ve been meaning to build my own, but honestly web design just doesn’t interest me quite as much as it used to. I’m more of a tweaker now. Other things that I’d rather spend my time on, I suppose.

Regardless, I’m pretty happy with how this looks for now. I’ll probably adjust a few things here and there, but I think it’s pretty snappy. Any thoughts?

Edit: Oh, one minor issue. It doesn’t display the tags associated with a post. I’ll be able to fix that pretty quickly later though. Fixed.

Testing of new audio player

I found a nice audio player plugin for WP called – oddly enough – Audio Player. It looks exactly like what I wanted; more actually. So without further adieu here’s a test of it playing an old little experimental clip I did back when I was first learning Ableton Live 5 (I happened to have this uploaded already).

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Edit: Seems to be working perfectly. Exactly what I was looking for!

Flash audio player?

I need to find a small Flash application that I can embed in posts to play audio. I’m getting to the point where I’m eager to really start getting my music out there. I’ve sort of reached a critical mass in terms of gear and now I really have the components to just start playing and letting some creativity spill out.

So I want to get/make a small flash application that I can use to play mp3’s right in my blog posts. Anyone know of anything nice like that? I could make one without much trouble honestly, but then I’d need to get a copy of Flash… Maybe I’ll just sign up for MySpace Music or something.

ISO 8601. Use it.

It goes without saying that if you develop software, you will need to deal with time. Yes, management of time, but I’m talking in a more literal sense: date/time data. No big deal, right? Old news, right? For the most part yes, but I have to say, it’s pretty alarming that I see developers still using (and parsing) a MM-DD-YYYY format for their date stamps. I shouldn’t see this. Ever.

There’s a standard to prevent it called ISO 8601. If you’re representing a date then you should store all your string-ish dates in the YYYY-MM-DD format, for a number of reasons.

  • Correct sorting if used in a file system.
  • Standard parse format for any common datetime class I can think of.
  • Standard format for querying SQL databases.
  • Other countries don’t use MM-DD-YYYY.

The last one is probably the most important. The others are definitely important, as neglecting the standard makes your code much more difficult to consume or interop with. But in this age of global computing, with SOAs and multi-culture apps, it’s critical that you adhere to the standard.

Case in point: An app I worked with had a license manager that used the typical MM-DD-YYYY format to store a date related to the customer’s purchase in the license file. Well, when a customer in China (with their system locale set to cn-PRC) went to use the app the framework parsed the date differently (because of their system locale) and the application wouldn’t unlock. The work around ended up being to force a culture change (Windows locale) for the thread used to validate the license (e.g. Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");). If the developer had used the proper ISO date format it wouldn’t have been an issue.

This is all magnified even more when you bring specific times into the picture as well. The standard addresses that as well. If you’re dealing with UTC time codes (which you should) just remember that you should represent everything on a 24-hour clock and in GMT (or Zulu time) like this: hh:mm:ssZ. If you want to use a specific time zone you do it by using an offset from UTC, like this: hh:mm:ss±hh[:mm[:ss]] (minute and second designations being optional, of course).

It’s practically a sin that I feel I even need to make this post, but if it prevents just one young developer from using their lazy conventional date/time format then I think it was worth it. If you want to take it the next step (like me) in your day-to-day writing, drop all those unnecessary “-st”, “-nd”, “-rd”, and “-th” from your date representations and write out dates like 06-06-2007, or 6 June 2007. It might be backwards from the ISO standard, but it’s a little nicer for humans to read, and if you know it’s only for a human, well then it’s not that big of a deal.

Edit: Funny, all this talk about time made me realize WordPress doesn’t update for daylight savings time. All my posts recent posts have been off by an hour.

New MBP drool-worthy, but patience prevails

Yesterday Apple unveiled their new MacBook Pro, featuring a LED backlit display and the new Intel “Santa Rosa” platform. These on their own are pretty nice updates, but my first gen 2.16 dual core is still humming along just fine. While it would be nice to upgrade, I really have no need to at the moment. Plus, Leopard isn’t out yet, and until it is there is no real practical reason to do it now. Even once that OS update comes out my system will still be capable (though I’ll probably drop a little more RAM into it at that point).

Point is, each update that Apple does makes the system just that much cooler. While I could sell my machine for probably $1,000 easily (maybe more like $1,200 even) and not have to spend that much on a new one, it’s better to wait, especially because I’m trying to save money for a house.

I have this vision of what computing will be like once I get my own place. I’ll have my PC of course – probably with Windows XP on it still – most likely in the “computer/music room” of the basement. That’s where I’d do all my PC-ish things: work on my Microsoft development (Mac fan or not a large part of the work I do is with Microsoft technologies), play the occasional PC game, work on my musical endeavors, etc. Upstairs in the “office” there will be a nice, large, open desk with one large (I’m talking 30″) display and a wireless keyboard/mouse. To this I’d hook my MacBook Pro, which at this point I’d consider my primary system. Having it portable would be great for going to the couch, or even taking it downstairs to hook it to music equipment, but the office would just be reserved for day-to-day computing tasks, as well as all my normal non-Microsoft development work.

Tying it all together from the basement would be the home server. I’d probably run some linux variant; probably Ubuntu. This would be a new box that would have only a moderate amount of horsepower, but be focused on power efficiency and silent-running. It’s main task would be file storage, en masse. I’m talking 1 TB of striped, mirrored storage and I’d like to be able to expand to 2 TB. I’ve dodged the bullet regarding backups for about four years now, and I can just feel the clock running short, so I need a proper centralized storage location that I can also burn archive media from. Other ideas for what I could do with this computer would be media server, phone server, and web/app/db server (for dev purposes). I’m not really looking forward to setting up the SAMBA server that I’ll need so that all my computers can talk to it… I tried to make one about five years ago and failed horribly. I can only hope it has gotten somewhat better since then. (Probably not.)

Anyway, that’s my vision. I actually want to put as much forethought as possible into making this a system that can be sustained for a long period of time, as well as upgraded relatively easily. I’ll also want to properly wire my whole house for network, but seeing as my good friend Matt did that to his own place (in fact, this whole system is similar to what he’s done at his place) I’m sure I could talk him into showing me the ropes.

WordPress 2.1.3 and other minor changes

Now running on WP 2.1.3, and several other upgraded plugins. However, I’m noticing some strange things. Not sure if they were working before though, so who knows. Here’s the laundry list:

  • Search does not work. You can put something in and hit search, but it never finds anything. This is caused by a bad query in Ultimate Tag Warrior trying to hook into the search. I’ve disabled UTW for now and will fix the query soon.
  • Recent Posts widget disappears on the search page. Spent a little while researching it and I can’t pinpoint the issue yet. This is also caused by UTW, though I’m not sure why. Disabling it fixes the issue.
  • Meta section is missing a bunch of features it had before. Looking at the actual code for that section shows that the missing links are still there, so they’re not rendering for some reason (or a different piece of code is being called). Fixed by simply removing that category. The RSS links were the most important and Sidebar Widgets now has a separate widget for that, so problem solved I guess.
  • Code highlighting plugin doesn’t render properly on archive views of posts. This doesn’t surprise me really and isn’t an issue per se, but it would be nice if this rendering did work.

I re-uploaded all the files, so I’m fairly certain that’s not the issue. Could be the theme (which I also upgraded). I’d really like to make my own theme but I just don’t seem to have the time right now. Regardless these obviously aren’t really serious issues. I’ll work through them as I can.

Edit: I’ve been thinking through this a bit more and it raises a question that I’ve actually wondered a bit. What’s really the best way to navigate through a blog? Search is obviously helpful, but proper categorization and tagging (which I’m not doing yet but want to) seems more valuable to me. I don’t get those long lists of monthly archives, they just grow and don’t seem to provide a lot of value. The calendar control is a decent compromise, though it’s a bit time consuming to navigate. An AJAX-ified version of the calendar control would be a lot nicer.

If you have any thoughts on the subject, leave a comment. I might just get rid of search and start tagging and get some tag clouds and what not.

Testing new code plugin

I think I finally found a syntax highlighting code plugin that I like, so I’m giving it a shot. To test it out, here’s a bit of code from back in school that I was always a little fond of.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
let explode s =
  let rec explode s i = if i < String.length s
  then s.[i]::(explode s (i + 1))
  else []
  in (explode s 0)
 
let implode l = 
  begin
    let v = (String.create (List.length l)) in
    for i = 0 to ((List.length l) - 1) do
      String.set v i (List.nth l i)
    done; v
  end
 
let lex s =
  let rec tok c w = match c, w with
    [], w -> [implode w]
  | (c::cs), w -> match c with
      ' ' -> [implode w]@(tok cs [])
    | '\n' -> [implode w]@(["\n"]@(tok cs []))
    | '\t' -> [implode w]@(["\t"]@(tok cs []))
    | _ ->  tok cs (w@[c])
  in
  tok (explode s) []

It’s a few utility functions used in a combinator recognizer in OCaml. Combinator recognizers are like a lite parser, simply answering if a sentence is included in a grammar, but it doesn’t provide the derivation. They can be pretty useful because they’re easy to put together and show partial matches still. Maybe I’ll go a little more in depth in the future and fully describe one with examples.

string test = "Testing a really long line to see how if it scrolls the div the way I'd like. Hopefully it does. I also should hack the plugin so that it displays a little header that says what type of code is being displayed.";

It appears everything is working beautifully. In case you’re wondering I’m using wp-syntax which in turn uses GeSHi for syntax highlighting. Was a snap to drop in place and works great. Looks pretty good too.

Falling in love with Ruby

So, I’m completely in love with the Ruby programming language. I started to learn it about a year ago when the buzz for Rails was really starting to get loud and have done probably 75% of my personal programming in the language in the past 6 months. I still write practically exclusively in C# for work (which isn’t so bad really) but I do find myself less enamored with the language since I’ve learned Ruby.

The biggest reason for this is pretty simple. More than anything else, writing Ruby programs is more fun than writing in most other languages I’ve found. But it wasn’t love at first sight, few things are. Learning the language was easy enough, but learning to program in it the way you should (to really embrace the Ruby philosophy) took me a little while.

That also has a pretty simple reason, and it’s has almost nothing to do with Ruby itself. Working with all that C# you get very used to being very formal and strict about everything. You have all sorts of design meetings and guidelines and standards. That’s the only way you can make code that’s deliverable and maintainable and able to be documented and all that. And, that’s actually OK by me. I’m pretty into perfection and so getting down into that nitty gritty doesn’t bother me too much. So I got used to it.

Now, that’s not to say you can’t be precise and stick to standards and be anal with Ruby, because you can. But, the language is designed in a way where you’re most productive if you just “let it flow.” That’s the best way I can say it really. The main proponents of Ruby weren’t lying where they said it is a language that was designed with the programmer in mind.

Since I’ve re-awoken that part of me that had somehow forgotten to just “let it flow” I’ve been developing a lot more and have been a lot more productive. It also forced me to examine some of the habits I had when developing in other C style languages and realize, “you know, there’s no real reason that I have to do it that way.” And I think I’m better because of it.