Out of Hanwell

July 1, 2011

Debug Code in Production

Filed under: Uncategorized — Matthias Miller @ 10:54 pm

I know this happens to everyone, but I noticed tonight that Dell has debug code on their production site:


/*script:temp.js*/
var startTScript=new Date().getTime ();

function menuItem(){}
function menuRef(){}
function menuSep(){}
function editListen(ev)
{kCode=ev.keyCode||ev.which;if(ev.ctrlKey&&ev.shiftKey&&(kCode==69||kCode==5)){if(m_editurl){if(confirm("edit page?")){m_editurl=m_editurl.replace(/local.dell.com/i,"cmscontent.dell.com");window.open(m_editurl,'editwin');}}}
else if(ev.ctrlKey&&ev.shiftKey){alert(kCode);}}
if (window.console){console.log('ex time: temp.js', new Date().getTime() - startTScript);}

All this means is that if you’re trying to switch to a previous tab using Ctrl+Shift+Tab, you get a silly message box. (And I’m sure you can find a lot of other shortcuts that will trigger this.) If you hit Ctrl+Shift+E, it tries to take you to an internal site.

Looks like someone overlooked something when they checked in their work.

October 1, 2010

The Idea Bank

Filed under: Uncategorized — Matthias Miller @ 2:00 pm

Over the past several years, but especially this past year, I’ve started to seriously re-evaluate my life, my career, and my vision. The reason I quit blogging several years ago was because of the profound realization that my life wasn’t about myself, and I realized that I had more to offer the world than merely software. I’ve become much more intentional about the way that I live my life, and I’ve become much more focused on finding those things that I am genuinely good at. In fact, several times this past year, and even as recently as last week, I sat down to build a specific vision statement for ways I want to change in this next year, both personally and vocationally.

Out of that, I’ve recently started an “idea bank”. I’m one of those people who has a lot of ideas rolling through his head of business ideas, philosophies of life, ways to change the world, or who knows what else! However, those ideas are only meaningful if they are implemented, and they can only be implemented if they are expressed. I’ve started a personal “idea bank” where I sit down with my phone and bluetooth keyboard, and I start to draft a skeleton view of what this idea would look like. Sometimes the idea is obviously bad, but I still file for later. Some ideas have a few action points that I can do now. Others I keep in the back of my mind until I meet the right person for them.

To me, it’s a huge relief to have these ideas on paper, but I know that for them to be any good, they have to move beyond that. Most of these ideas I have little interest in actually implementing myself, but I would love to work with other people to see them implemented.

This is an open question to you all. Right now, these ideas are useless journal entries on my computer. How do I move beyond this step and actually make the “idea bank” something useful to the world?

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!)

Older Posts »

The Shocking Blue Green Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.