Out of Hanwell

July 21, 2010

New name for JavaScript Lint

Filed under: JavaScript — Matthias Miller @ 3:29 pm

Someone recently suggested a name change for JavaScript Lint to avoid confusion with JSLint, and I think it’s a great idea. The problem is that I need good suggestions.

Proposals, anyone?

April 7, 2010

How I Got My iPod

Filed under: Uncategorized — Tags: , , — Matthias Miller @ 1:42 pm

The first sign that my MP3 player was failing came early one morning this past winter as I was standing out in the cold, jiggling the headphone’s cord in the jack so that I could get music to both my ears while I jogged.

I’d gotten my 40GB Toshiba Gigabeat on eBay, and I chose it mostly because I wanted something inexpensive (that is, used), something big (which 40GB used to be), and something that ran Rockbox. Indeed, this player was a great choice, joining me in my journeys across the globe.

But this was the morning things started breaking down. Several months before, I wrapped electrical tape around the frame to hold it together, but that hadn’t affected it functionally. But now, whenever I plugged up to my MP3 player, I had to jiggle the cord. Of course, this was inconvenient but it wasn’t a big hassle. I just had to twist it a little bit, and it would always start working. But as time went on, finding that magic spot became increasingly difficult. One day I discovered, much to my surprise, that the player worked if I squeezed the top of the player together, so for a while I carried an MP3 player that was held together by electrical tape and rubber bands.

It’s no surprise that several weeks ago, the player finally went over the edge, and I found myself digging through eBay listings, looking for an MP3 player on a budget. I had pretty much exhausted all the options except one–an iPod that seemed to be in good condition, only the seller said it didn’t sync. In fact, he said, none of his Apple gadgets sync’d with his computer. “Sounds promising,” I thought to myself. “It’s probably just a software problem.”

Sure enough. Not long thereafter, I got my iPod. I first tried installing Rockbox, but the player kept spontaneously rebooting. After fighting with it for a while, I finally relented, reset it to Apple’s firmware, and began syncing it with iTunes. The sync was nearly complete when it failed with a cryptic error.

Maybe the seller had been right, after all.

But there was something else I noticed. The iPod didn’t seem be charging, and I began to suspect the battery. Perhaps the USB had too little current to fully power the iPod, and the sync had depleted what little charge the iPod had. I left it plugged in overnight, but in the morning it still showed basically no change.

The next day I began looking for batteries online. I looked on eBay again, but I had no luck there. I tried Google and came across Milliamp’s ipod battery replacement kit, which, best of all, was on sale. “For $30, it’s worth a try,” I thought.

Sure enough. I got the replacement kit just this past week. The instruction sheet informed me that opening the iPod would be the most difficult part, and difficult it was indeed! Nonetheless I finally got it open, and it didn’t take much to replace the battery. Still, I held my breath.

The big moment came when I tried to sync my iPod. One thousand, two thousand, three thousand songs…and wouldn’t you know–it worked! I unplugged it from my computer and trying playing music–it still worked! I tell you, I was so happy to have an MP3 player again that let me listen to music with both ears!

So, that’s the story of how I got my iPod. :-)

September 28, 2009

Kindles Aren’t Books, Either

Filed under: Uncategorized — Tags: — Matthias Miller @ 4:46 am

Kindles are not books, either.

Books you can drop.

May 8, 2009

Computers Aren’t Books!

Filed under: Uncategorized — Tags: — Matthias Miller @ 5:42 pm

I’ve never liked the idea of reading e-books on a computer. I tried it once five years ago. I downloaded a classic novel from the Gutenberg Project and tried reading it on my computer. It was an awful experience.

Things haven’t gotten better. Right now I’m trying to read a PDF e-book on my computer. It’s miserable.

The computer is the worst imaginable device to read books on. My Eee’s screen is way too small, exaggerated by the PDF’s strange two-column format. I have to scroll down, then up, then down, then jump to the next page, then down, then up, then down, until I’m quite dizzy.

But worst of all, the computer’s much too powerful. When I read, I like to completely change my atmosphere, get far away from the computer, and get into a fresh state of mind. Computers make me very ADD. I read a little bit, then get something to drink. I read a litttle more, then get something to snack on. I read a little more, then check my e-mail. I read a little more, then get caught up in an article about human psychology. I read a little more, then realize how much I dislike reading e-books on my computer, so I blog about it, as if anyone cared.

Trust me, this is no idealistic scientific experiment about the usability and readability of e-books on computers. I need to read this book, but I can’t get a print copy right now. I’ve tried to convert this PDF into a more readable format with a superbly clever Python script, but I’ve wasted too much time trying that already, and it’s not worth it.

Bother.

I guess there’s nothing to do except to go back and keep reading.

January 11, 2009

Basic Web Developer Skills

Filed under: Browsers,Development,JavaScript,Software,Web — Tags: — Matthias Miller @ 12:25 pm

The past several years at work, I’ve done a lot of HTML/JavaScript development. Last summer I handed off my work to another lead developer. During that process, my manager and I discussed the basic skills required for a good web developer, and we came up with this list.

Test cases. A good web developer turns problems into simple, reproducible test cases. When something goes wrong, it’s easy to fall into the lets-see-what-this-does rut. This solves your immediate problem, but it doesn’t leave you much smarter for next time. If you whittle down your problem to a comprehensible size, you can understand exactly what is going on, why it’s not working, and what you need to change. (Well, okay, some browser bugs are simply weird, but at least you have got a fighting chance!)

Research. A good web developer researches problems. You’re the smartest man alive, but you’re not the first to find this bug. You need to know which sites to check, such as QuirksMode, MSDN, MDC, and now Stack Overflow. But you also need to know how to use a search engine. Developers are creative creatures and can find a hundred ways to describe the same problem. You need to learn which keywords will bring the gold to the surface.

Documentation. A good web developer writes clear documentation. Once you solve a problem, it’s easy to check it in and move on. But just because you understand the problem today doesn’t mean that your team understands it or that you’ll understand it tomorrow. Write it down!

Localized Hacks. A good web developer favors localized hacks. Some problems can only be solved by ugly fixes, but you can minimize the damage by localizing the complexity. Keep the knowledge of that hack in one place–for example, hide it behind a JavaScript function, stick it into a CSS block, or fix it by adding a single element on your HTML page.

Pragmatism. A good web developer is pragmatic, neither sailing on the clouds of optimistic idealism or sinking to the depths of pessimistic despair, but somehow maintaining enthusiasm and courage in spite of the challenge.

Our conclusion? A good web developer is primarily a problem solver.

Really, it’s not complicated.

August 16, 2008

Khoros: A Lua Operating System

Filed under: Development,Linux,My Projects — Tags: , , , , — Matthias Miller @ 4:06 pm

Over the past year or two, I’ve been tinkering with my own operating system, which I’ve dubbed Khoros. The name comes from the Greek word χορός, meaning dance, from which we get our English words chorus and choreography. Of course, I chose this name because of its obvious play on words.

My first task was simply getting a bootable system. Rather than write my own bootloader, I used Grub. I based my work off Brandon Friesen’s excellent tutorial. I initially used VMware for virtualization, but since then, I’ve since switched VirtualBox and have had much better success.

As much as possible, the kernel is written in Lua. (Yes, Microsoft’s Singularity project caught my attention.) I am not particularly gung-ho over Lua as a language, but I picked it for its exceptionally small footprint, and it opens interesting possibilities for sandboxing. For example, my C kernel interfaces high-level interfaces to allocate and manipulate memory. However, the Lua scripts cannot specifically address memory. They can only manipulate memory block within the allocated bounds. This allows very powerful but safe low-level programming for my drivers.

With the past several weeks, I finished up basic multi-process support using Lua’s coroutines and debug hooks. (I am not using traditional process boundaries, so everything is running in kernel mode.) Processes can communicate with each other using a very simple IPC mechanism.

Today, my operating system boots into a simple Lua shell, allowing me to run arbitrary Lua code from the command line. This is no small feat, but it is admittedly of limited use. I am trying to decide how to proceed.

A networking stack could be quite beneficial, since it would allow me to program it remotely or to do something interesting like serve websites. However, this involves learning about the PCI bus, the NIC, ethernet, TCP/IP, DHCP, and many more details of which I am certainly unaware.

Alternatively, I could implement rudimentary file system support. For example, I could provide a way to save Lua objects to disk. However, I am lost to what interesting piece this might lead me to.

I blog so infrequently that I’ve probably lost most of my readership, but to all of you out there, what do you think I should develop next?

May 28, 2008

Using vim for Word Processing

Filed under: Linux,Software,Tools — Matthias Miller @ 11:24 pm

I’ve recently been using vim for word processing. However, it’s very cumbersome to edit long lines of text because the up/down/home/end keys do not respect wrapping.

Of course, vimrc comes to the rescue:

imap <up> <C-O>gk
imap <down> <C-O>gj
nmap <up> gk
nmap <down> gj
vmap <up> gk
vmap <down> gj
imap <home> <C-O>g^
imap <end> <C-O>g$
nmap <home> g^
nmap <end> g$
vmap <home> g^
vmap <end> g$

And once again, I’m a happy vim user.

Update: And to get soft word wrapping, I added:

set formatoptions=l
set lbr

Now I’m really happy.

October 17, 2007

Don’t Steal My Parameters

Filed under: Humor/Mental Leisure,JavaScript — Matthias Miller @ 1:33 pm

I was perusing the source code for Dean Edwards’ base2 library when I discovered that functions can access the parameters of other functions in the call stack. My mind immediately started spinning, imagining the convoluted code this would allow.

Here’s one to get you started:

function checkArgTypes(/*expected types*/) {
    var callerArgs = arguments.callee.caller;
    if (callerArgs.length !== arguments.length) {
        throw new Error('checkArgTypes does not have enough arguments.');
    }

    for (var i = 0; i < arguments.length; i++) {
        if (typeof callerArgs[i] !== arguments[i]) {
            throw new Error('Argument ' + (i+1) + ' is of type ' + typeof callerArgs[i] + ' but should be of type ' + arguments[i] + '.');
        }
    }
}

function run(str, num, bool) {
    checkArgTypes('string', 'number', 'boolean');
}

You might want to try it out in jconsole.

And, of course, you can’t ignore the obligatory security implications:

function validateUser(username, password) {
    /* accidentally call trojan function */
    trojan();
}

function trojan() {
    alert('Your password is ' + validateUser[1] + '.');
}

validateUser('user', 'secret');

Ahh, well. I’d best get back to writing real code.

NOTE: Edited to fix WordPress source code formatting problem.

Update: Fixed a typo in my “for” loop. (Thanks Philippe!)

October 5, 2007

Python: A Gateway to Understanding JavaScript

Filed under: JavaScript — Matthias Miller @ 3:46 pm

The past day or two I’ve been exploring Python. Although I’ve enjoyed tinkering with the language, I’ve never done any serious development with it. As I explored it more, I was surprised to find that Python’s approach to object-oriented programming provides a great foundation for understanding JavaScript’s objects and prototype chains. The two languages are conceptually similar, but Python provides object-orientation in a much cleaner, straightforward way.*

In my opinion, someone should write a tutorial that first introduces the concepts of object-oriented Python, then illustrates how the same concepts apply to JavaScript.

* To defend myself against JavaScript purists, the point is to better understand JavaScript as a language. It’s not that I’m trying to coerce JavaScript into the mold of another language.

September 20, 2007

Switching to WordPress

Filed under: Blogosphere — Matthias Miller @ 11:19 pm

I’m switching from b2evolution to WordPress for one reason: WordPress can host my installation on my domain for $10 a year. My installation of b2evolution has been becoming obsolete, and you’d have to pay me more than $10 to go to the work of upgrading it!

In less than three hours of hacking, I’ve set up a WordPress blog on my domain, transferred my b2evolution posts and media, and changed all links to my old blog to redirect to my new one.

I’m impressed.

Older Posts »

Blog at WordPress.com.