MIX '11 — Day 1

Today was the first day of the conference proper. As such, there were keynotes and sessions.

Keynote the First

IE 9 got a big pile of praise from the presenter and then they ran some demos with IE 9 side by side with Chrome to show off IE's hardware accelerated rendering with the obvious subtext being "Look at us, we're faster than the fast guys!", but here's the thing:

  • You and I both know that the demos are contrived to make IE look good (So pointing and laughing at Chrome is both childish and a bit of a lie).
  • If IE actually stops being a pain in the ass performance-wise, that will be worth ten-thousand fishbowl demos.
  • Time will tell whether or not anyone ever actually builds applications where the performance of Chrome/Firefox ever becomes a problem the way IE's performance has been in the past.
  • IE performance is still going to be an issue until I can count on people using IE 9 rather than 7/8. Everybody is already using Chrome 10 and in a couple month everybody will be using Firefox 4. The same can not be said about IE 9.

After the self-congradulatory back-patting over IE 9, Scott Guthrie and Scott Hansleman came out and talked about:

  • ASP.NET MVC 3 Tools Update: It comes with jQuery 1.5, Modernizr and RoR style scafolding generators.
  • Entity Framework 4.1: Code first (generate SQL schema from POCO objects).
  • Nuget

They did a demo consisting of building a CRUD admin app and front end for Hanselman's podcast. Throughout, I couldn't help but think that code first entity framework stuff and the auto-generated scafolding were like django's models and admin interface from five years ago, except not quite as good. Given that I like django's stuff, having ASP.NET MVC steal ideas from it and RoR is probably a good thing for ASP.NET, but it does kind of raise the nasty question of "Why the hell aren't you writing stuff in django?" rather than lighting a fire in my heart to work with the ASP.NET stack.

After the demo they brought out a guy to talk about Orchard CMS. I'm only mentioning this because they threw up a big slide saying "Orchard is great because it works with Wordpress, Drupal, Joomla, etc, etc, etc", which seemed kind of weird, 'cause it kind of feels like they were saying: "This is great 'cause it runs PHP!"

Designing Infographics for Web Applications

This was the first actual session I attended of and it was great. Des Traynor talked about making infographics of the "showing data in your application" rather than "get to the top of Hacker News" variety. A couple of points he touched on:

  • Making infographics is hard. Sometimes it's really hard to beat the simplicity, clarity, adaptability, etc. of text.
  • 3-D charts have a bad habit of making it easy to lie (with shout outs to Tufte's data-ink/chart-junk ideas).
  • Clarity is the goal first and foremost. Making the graphic clever/interesting are only secondary goals and if you need to make sacrifices it's in these.
  • People are great an comparing the lengths of lines and not so much anything else (width, area, colour intensity, quantity, etc).

Node.js, Python and Ruby on Windows Azure

This was something of a show-and-tell presentation. The basic message was "You can totally get Ruby/Python/Node running on Windows Azure... though, you'll have to rolll up your sleaves and get your hands dirty."

UX Lightning Talks

This is the first Lightning Talk session I've been to. It was pretty cool. Topics included:

  • Delightful Eperiences
  • 21 Century Design
  • Goodbye mouse — Hello touch.
  • Lessons in Design

Evening Session

  • Ask the Experts: I drank a free beer and listened to people complain about the fact that ASP.NET isn't quite as shiney as Rails, then I left.
  • I ate a different steak. It was delicious.
  • I walked the strip and saw the fountains at the Bellagio do their thing.

MIX '11 — Day 0

Today was bootcamp day with the conference proper starting tomorrow. I went to two sessions: HTML5 and jQuery.

HTML5

  • Stephanie Rewis talked about HTML 5, CSS 3 and assorted JavaScript APIs (geolocation, web workers, local storage, etc.).
  • Dive into HTML5 felt like it covered a lot of the same material (... which isn't that surprising given that both the book and the talk are introductions to HTML 5).
  • Modernizr, When can I use..., and html5shim all got shout outs.

jQuery

  • Some dude from Microsoft talked about jQuery. I don't really feel like it covered any new ground as far as I was concerned and I think it overlooked one key feature: docs.jquery.com. jQuery is easily one of the best documented projects around and that is part of what makes it so great.
  • Event delegation is important as binding/unbinding hundreds or thousands of event listeners can be expensive.
  • jQuery.live() is still awesome. .live() is a feature I learnt about way back in 2009 at StackOverflow Dev Days... but it came up in this talk and it is still awesome.
  • I'm a little excited about jQuery Mobile. Of course, I haven't actually used a whole lot of jQuery UI and I'm a little nervous about the whole "Let's make it look like an iPhone!" thing that's going on.

Evening Sessions

  • I ate a ridiculously large steak. It was delicious.
  • I went to see Penn & Teller. As a fan of Bullshit!, it was really cool to see them perform live. There was more magic and (only very slightly) less pontification.

The World Ends at Steeles

"Have you ever met somebody who wasn't from Toronto?"

"What kind of question is that? Of course I have."

"Okay who? Specifically?"

"Uh... lots of people. What about Kate? She's Chinese."

"As Torontonian as you or I. Toronto General, just like you actually."

"You asked her where she was born?"

"Yes, this is important."

"Okay... what about her parents?"

"Princess Margrat and Mt. Saiani."

"What about her grandparents. I mean somebody in her family has to be from China..."

"They were really noncommittal about that."

"Fine, what about Tom? He's from Calgary."

"His dad is. He just says he's from Calgary so he can get away with wearing a cowboy hat."

"Well there you go. His dad is from Calgary."

"Have you ever met his dad?"

"No. I mean... After what he did at Amanda's place, Tom and I have barely ever even spoken to each other..."

"Well I haven't met him either so his dad doesn't count."

"Look, this is ridiculous. Of course, there are people who aren't from Toronto."

"Have you met any of them? How do we even know they exist?"

"This is insane. What about all of the people on TV... They can't all be fake."

"Notwithstanding the fact that everybody on TV is fake in one way or another, have you met anyone from a TV show or someone who works on them and is really sure about where they come from?"

"No, but..."

"Have you ever even been outside of the city?"

"My parents don't have a car..."

"Mine don't either. I've never even been west of Jane. As far as I know, it could be a wasteland out there."

"Well, it kind of is, but that's beside the point. What about the planes? You've seen them flying over. They have to be going some where. They couldn't possibly be just for show."

"Do you know anybody who's been on one?"

"Andrea went to Disney World last March. There you go, Florida is clearly not in Toronto..."

"No she didn't."

"She didn't what?"

"Go to Disney World. Her parents were going through a divorce and she lost her shit and stopped coming to school for a while. When she got it back together she said she went to Disney World so people wouldn't find out."

"How do you know that?"

"People found out. Besides, doesn't Disney World seem kind of lame, I mean..."

"Look, the GO Train goes to Barrie and Barrie is clearly not Toronto."

"Have you ever been to Barrie?"

"No. Why would I go to Barrie? It's like four hours away."

"Exactly. Have you ever met anyone who's been? I mean... I've heard of people who commute from Barrie."

"No. I haven't met anyone who commutes from Barrie."

"Okay... What about Markham? Do you know anybody from Markham?"

"No. I don't know anybody from Markham."

"Fine, let's go. Grab your jacket."

"What?"

"We'll take the TTC to Finch and walk to Steeles."

"I don't want to go to Finch, it's far away."

"I don't want to either, but we have to. Neither of us know a single person who isn't from the city, so we have to go to Steeles. That's all there is to it."

"It's like an hour away..."

"I know, let's go."


"Last stop Finch. Connection to York Region Transit and go fuck yourself this is the middle of fucking nowhere."

"Wow, those subway announcements are mean."

"Yeah, but they're not wrong. Let's go find Steees."

"Are you sure you want don't want to take a bus, it looks like it's kind of far."

"No, I don't want to wait for a fucking bus... It couldn't possibly be that far."


"Okay, turns out it actually was kind of far, but that big intersection up ahead should be Steeles..."

"Alright, take a look: giant intersection, Markham, Vaugh. They exist. You dragged me all the way out here for nothing. Are you satisfied?

"Then, again something's not quite right. Take a look at this. Holy. Fucking. Shit. It's a painting! Markham is a backdrop.

"I can't believe it. You were right."

Eventlet is Awesome!

Eventlet is an asynchronous networking library for Python which uses coroutines to allow you to write non-blocking code without needing to perform the normal mental gymnastics that usually go along with asynchronous programming. There are a bunch of async/event-driven networking framworks (eventmachine, node.js, tornado, and twisted to name a few), and their defining characteristic is that they use select/epolll/kqueue/etc. to do I/O asynchronously. Asynchronous I/O is cool because when done correctly it allows your server to handle a much greater number of concurrent clients than the one-OS-thread-per-connection approach. Furthermore, since you're using co-operative rather than preemptive multitasking, you can safely update shared data structures without locks, which makes it a lot easier to write correct code.

Anyway, eventlet is pretty cool. If you like Python and you're interested in async programming, you should check it out. After all, anything that reduces the incidence of Heisenbugs is worth a look ;)

Proxymachine in 55 Lines

Since they're so specialized, playing with this kind of library requires a specific kind of project. Consequently, I decided to put together a "Hello Word!" version of Proxymachine. Proxymachine is a proxy built on eventmachine that lets you configure it's routing logic using Ruby. Don't get me wrong, Proxymachine is awesome and way more production ready than this. That being said, it's still friggin' cool that I could put togther a pale imitation of Proxymachine in less than 100 lines thanks to eventlet:

import functools
import eventlet

CHUNK_SIZE = 32384

class Router(object):
    def route(self, addr, data):
        raise NotImplemented

def merge(*dicts):
    result = {}
    for d in dicts:
        result.update(d)
    return result

def forward(source, dest):
    while True:
        d = source.recv(CHUNK_SIZE)
        if d == '':
            break
        dest.sendall(d)

def route(router, client, addr):
    blocks = []
    while True:
        block = client.recv(CHUNK_SIZE)
        if block == '':
            raise Exception('Failed to route request: "{0}"'.format("".join(blocks)))

        blocks.append(block)

        route = router.route(addr, "".join(blocks))
        if route is not None:
            print "Forwarded connection from {0} to {1}".format(addr, route)

            server = eventlet.connect(route)
            for block in blocks:
                server.sendall(block)

            eventlet.spawn_n(forward, server, client)
            forward(client, server)
            return


def start(router, **kwargs):
    defaults = {
        "listen": ('localhost', 8080),
    }

    config = merge(defaults, kwargs)
    print "Listening on:", config['listen']

    eventlet.serve(
        eventlet.listen(config['listen']),
            functools.partial(route, router())
    )

Roulette: A router in ten lines

The logic here is laughable, route inbound connections to either localhost:9998 or localhost:9999 depending on whether the remote port is divisible by two, but the point is that the routing logic could be anything. We're writing Python here. We could look stuff up in a database, or check the phase of the moon or y'know, do something useful.

import roulette

class Router(roulette.Router):
    def route(self, addr, data):
        if addr[1] % 2 == 0:
            return ("localhost", 9999)
        return ("localhost", 9998)

roulette.start(Router,
    listen = ("localhost", 80)
)

Even More Snow

At this rate, no one is going to believe me when I say New York doesn't get very wintery ;-)

/blog/entries/2011/01/27/even_more_snow/snow1-5b657673a6f6.min.jpg /blog/entries/2011/01/27/even_more_snow/snow2-423d1674e032.min.jpg /blog/entries/2011/01/27/even_more_snow/snow3-bacd7da07970.min.jpg /blog/entries/2011/01/27/even_more_snow/snow4-080e81fc3f38.min.jpg /blog/entries/2011/01/27/even_more_snow/snow5-681d1e7524d3.min.jpg