.

Javascript: The Good Parts

Over the weekend I finished reading Douglas Crockford’s JavaScript: The Good Parts.

This book spent quite some time on my to-read list and I am really happy to have finally read it. I now feel that I really know how to use closures in Javascript, and Mr. Crockford has inspired me with his use of functions as values, and creating functions that return functions or objects, maintaining access to local variables within a closure, is genius.

I found myself leaning heavily on my previous knowledge to understand The Good Parts, making it, as it says in the preface, not a book for beginners. I can imagine that the Regular Expressions chapter might be tough without a pre-existing understanding of regular expressions, however, that’s easy to obtain at regular-expressions.info.

After reading The Good Parts I’m really excited to work on some Javascript that I’m going to be refactoring and improving over the next few weeks. I can apply the some of principles contained here to write smaller, faster, and easier to maintain Javascript, something that is always my goal.

The cover of Javascript: The Good Parts
Want to read it yourself? Get it from one of these places and I’ll receive a small kickback:

Amazon.com (USA) Amazon.ca (Canada) Amazon.co.uk (UK)

The Flat World

A couple of years ago my sister gave me a copy of a book that she had been given when she received her first degree. The book is The World Is Flat by Thomas L. Friedman. On the back it says “One mark of a great book is that it makes you see things in a new way, and Mr. Friedman certainly succeeds in that goal.” I couldn’t agree more.

When I started reading The World is Flat on my commute I didn’t know much about it. I thought, actually, that it would fit kind of in the “self-help” category and tell me how I could do more in the world. Instead it showed me how the world has changed in my lifetime, and the power that we all have today to collaborate with nearly anyone, anywhere, in ways that even I, who works online and rarely sees my coworkers and clients, hadn’t imagined. I’ve never been motivated to write here about a book I read, but this book has motivated me to do just that. I think it should be read by as many people as possible, especially people who work in business, education, or government.

The World is Flat is a solid look at globalization and what it means for the American people, and by extension us Canadians. It means, among other things, that we have to work our asses off to stay in front of the millions of people that can now compete for our jobs from India, Russia, or pretty much anywhere there is an internet connection. But it also means that as an employer I can hire the best person to do a job at the best price, providing a better service to my customers at a lower price than I would otherwise be able to provide.

I’ve already experienced our Flat World. I’m in Montréal, and I work all the time with a group in California, as well as on occaision with people in Arizona, New York, Poland, Turkey, and the Philippines. It’s amazing what we can get done together. By assembling the right team for the job we can often do a better job than a team that works under a single roof, and for less money. But after learning what I have learned in reading The World is Flat I am excited to try even bigger, better things.

One of the things that I worry about, however, is overproduction and overconsumation. One of the major arguments against globalization and outsourcing is that we don’t want to loose North American jobs. This argument assumes that there are only so many jobs to go around, and with the expansion currently happening in many of the places we outsource to, this is simply not the case. The increasingly affluent population in, for example, India, consumes things produced both there and in the west, so by moving some jobs to other countries we are actually creating a net increase in both jobs and consumption. This overconsumption can have a detrimental effect on the health of the planet, and while it is an economic truth that we are seeing, and most likely will continue to see, a net increase consumption, and therefore production and jobs, I’m not entirely sure that our planet can support having everyone in it live lifestyles like we currently do in North America. Something needs to change, and while Mr. Friedman does discuss this, I feel it needs deeper investigation. I’m assuming that Mr. Friedman’s next book, Hot, Flat, and Crowded, will deal more with these issues.

Since September, I have been commuting more, on a train, and therefore reading more. The World is Flat made me want to share what I am reading with as many people as possible, so this is the first post of many about books that I read. As I finish each book I’ll write about it here. These aren’t meant to be book reviews, I’m no literary critic, but personal reactions to what I read. There will be Amazon affiliate links in and at the bottom of the posts, but I’m not going to pump up a book that’s no good, it would just be nice to make a dollar or two on the books that are great. These posts are as much for my archives as for the world, but I would like to share some things, especially The World is Flat. There’s a fascinating revolution taking place, and I want to get even more involved than I am now.

The cover of The World is Flat
Want to read it yourself? Get it from one of these places and I’ll receive a small kickback:

Amazon.com (USA) Amazon.ca (Canada) Amazon.co.uk (UK)

Why the Keyboard is Here to Stay

There’s been a lot of fuss recently, (and not so recently), about multi-touch interfaces and alternatives to keyboard and mouse as input devices for computers, but I believe that the keyboard, at least, is here to stay.

The keyboard is the best instrument we have, and the second best instrument that I can think of, to get text quickly from my mind into a computer. It’s been around for about 181 years now, and while there are some strong arguments to change the way it works, there is no really good reason to get rid of it.

As Scott Berkun said the other day:

Most technology doesn’t change much. The wiring that powers your home, the plumbing that brings you water, the roads you go to and from work on, work in mostly the same way they always have. This is ok. Lack of upgrade is not a sign of failure.

He is right, and the keyboard belongs right in there with plumbing, elictricity, and roads. How else are we going to get ideas from our minds into a computer? (I have an idea, I will come to it shortly).

Multi-touch has been the darling of the UI world for a little while now, and we keep hearing about the possibility of multi-touch enabled full-size screens. BumpTop has released a version of their software, (which is really cool, by the way), that has multitouch support. Do you really want to spend your day at a desk or counter, with your arms extended in front of you touching a screen? Try it right now for sixty seconds. Just reach out and put your fingers in front of your screen. I’ll wait. Finished? How do your shoulders and arms feel? A little tired? Now imagine your whole workday like that. Yes, we will become accustomed to the feeling, and we’ll get more endurance in our shoulder muscles, but we’re not meant to spend eight hours a day with our arms out like zombies.

How about voice control? It works pretty well in Star Trek, but if you have ever had to speak for an extended period of time you will know that your voice can get tired and sore just as your shoulders and arms can. Even if voice recognition technology was good enough to correctly transcribe what we say every time, with the correct grammar, (and it’s not, as Fred Wilson’s Dictated Post clearly illustrates),we would still end up talking all day. Imagine what it would sound like in an office, and how would students take notes on their laptops? Because of voice fatique and noise levels, voice control is not a viable solution for entering large amounts of text, or for doing long periods of computer-based work.

Multi-touch and voice control are great for short messages and commands. Even my ancient Motorola lets me use a voice command to call my fiancée, but for entering a lot of text, or for long sessions of work, they suck.

What’s the solution? Thought control. Hook the computers up to our brains, then whatever we think will become what is written, or drawn, or whatever. Imagine the possibilities, no more typing, no more trying to draw something that you see in your mind using Illustrator, because your computer sees it too. Also, we won’t need computer screens because hey, if the computer can see what’s going on in our minds, surely it can show things to us as well. However, even if we include the Firefox, controlling a computer with my thoughts is still a dream and will remain a dream for many years to come. The solution for today is the keyboard. It lets us enter text and commands very quickly, often faster than we could write them using pen and paper. It lets us do so quietly. And it’s a worldwide standard.

Using Spaces to Work Around VMWare Fusion’s Limitations

It appears that when running Windows as a virtual machine in VMWare Fusion, (I’m using version 3.0.1), any windows programs that I am running with elevated permissions, (“run as administrator”), don’t appear in the OS X dock with Fusion in unity mode. What’s more, if I can see a portion of the window and I click it, it doesn’t come to the foreground.

My workaround for this, which worked very well, was to run Fusion in fullscreen mode in another Space. Then I was able to do my OS X testing in one space, flip to Windows to make changes very easily, (The default to move between spaces is ctrl + (arrow key), but I changed it to cmd + (arrow key) and it is much easier for me), and keep my E-mail & stuff open in a third space.

If you don’t have spaces active, in OS X 10.6 they’re in System Preferences > Exposé & Spaces > Spaces then just check the box that says “Enable Spaces” and adjust your shortcuts at the bottom of the window, if desired.

Test ASP.NET apps on your Mac with VMWare Fusion & DD-WRT

Today I needed to test and fix mac-specific bugs in a website that is written in ASP.NET, but I generally use a Mac. When I work on the ASP.NET site I boot into Vista using Boot Camp, and the rest of the time I spend happily in OS X. I needed a solution to run both at the same time, and on the same computer, (this is the only mac I have, but my development environment for the .NET site is on my Boot Camp partition). It was time to see if Virtualization has gotten any better. It has.

There are two reasons that virtualization is better: VMWare Fusion 3.0 was released, and I doubled up my RAM, (now at 4GB). With these two changes, and Aero turned off on the Windows side, Vista runs ok under VMWare Fusion on my ageing Macbook Pro. Now to see changes made in Vista from OS X.

The simplest way I found to make this happen was to use some of the DHCP features DD-WRT on my router to assign a static IP address to my virtual machine and to map a URL to that IP. I’ll do this in steps:

  1. Before starting your VM in VMWare, go to the settings for the VM > Network and choose “Bridged” then open the advanced section and click the button to generate a MAC address. Copy the generated MAC address.
  2. To to Services > Services in your DD-WRT web interface and in the DHCP Server box assign a static IP to the Mac address you just copied
  3. In the DNSMasq box enter the following:address=/the-url-you-want-to-map-to-the-vm/THE.IP.YOU.JUST.SET entering, of course, the real values.
  4. Hit Apply and Save at the bottom of the page
  5. Start up your VM
  6. Make sure that Windows Firewall is set up to let HTTP connections through
  7. Type the URL you created in your browser in OS X and you should get the web page served by Windows
  8. Now, there should be a way to make this work without the router, using NAT network mode for the VM and some hosts file edits in OS X. I’m going to try to figure out how, but for now I just need to get some bugs fixed in the .NET app. If anyone has any ideas how to make this happen without involving a router let me know, (or blog about it and leave a note in the comments).