Friday, December 31, 2010

How To Skip The Usual New Years Blogging

No predictions.

No year goals.

I'll follow my needs and wants through the year and where I end up I'll be happy with.

Tuesday, December 28, 2010

How To Give Twisted a Friendly Zero-Step: Part 1

Zero-Step: n. The first impression and actions of a user's exposure to a new tool, before actual research and use of the details.

I'm not as involved with or using Twisted as much I'd like, but I still pay attention and I care about the project. I understand its strengths and its weaknesses and I want to see it used in more cases where it is the best tool for the job. There is a obvious and recently publicized problem with Twisted and the Zero-Step.

Why do people go to twistedmatrix.com for the first time?

Usually, it probably isn't to read the documentation or start investigating open bug reports. First time visitors are looking to solve a problem and the first thing that has to be impressed on them is if Twisted actually solves that problem. This is actually a really big problem in this case, because there are so many problems it can solve. How do you present that image without boring lists of functionality and supported protocols?

The most obvious use-case for Twisted is probably for HTTP setups, while another important angle is probably people looking to test it out with something simple and pointless like an IRC bot. While an IRC bot is boring to a lot of us already familiar with the details, it is a very common introduction people make for network programming.

What kind of timeout can we expect on their willingness to read before getting the gist of it?

Not much, probably. Certainly, it takes more upfront investment in personal time and energy than a lot of people care to make. It would have to be obvious and prominent at the front page how to get a quick introduction that gives you an idea if Twisted is what you're looking for. The most obvious section you'll see now is What is Twisted? with one link in bold that will stand out to a new visitor, sending them to the Twisted Core Documentation. This is a really boring looking page, with no styling, lots of parts with names people won't understand, and an 11-part finger tutorial. This is not an approachable presentation.

The whole section needs replaced with something more eye catching and it needs to lead to a new section of the site that exists just to impress those new eyes. "If you want to get started with Twisted, the first thing you should do is read the Twisted Core Documentation" is too much to ask new comers who have no idea if this is what they're looking for and often don't have time to read that much documentation to make the call, because they've already got a problem with a deadline or simply have a limited amount of free time to pursue the interest on their own. I think there can be a sentiment to just let these facts weed out the less motivated, but it serves to cut out too many who would do the project some good.

How can you get the greatest number of readers to continue interest in Twisted with only one page view to convince them?

If you can fit it in without scrolling, then even better. Being lax enough to allow some scrolling to grok the whole introduction, can you get people intrigued enough to sit through more complete readings of the docs, put up with difficulties getting started and adjusting their way of thinking, and dealing with a relatively steep learning curve?

In Part 2, I'll continue my previous post about Django influencing the presentation of Twisted. Hopefully we can come up with some ideas to make the approach to Twisted less frightening for new users.

Monday, December 27, 2010

How To Limit Application Trust

Why is it when I see an application in the Chome Web Store I see a little notice about what permissions the app will have, and I'll see a similar list of permissions before installing an Android application?


Why is it that I don't see something more like this?


How To Push Your Habit Building Onto Technology

I use desktop alerts to keep myself organized through the day, in various ways. There are things i want to do repeatedly and I don't have a good track record with keeping good habits, so I have found some ways to make tools fill in the gaps for me. There are some specific examples i can give. I have been using the great site 750words.com for almost a year, and I love it. I write nearly every day, and I'm getting better at that habit all nthe time. usaully I only miss it when something interrupts me. I remember with something better than an email reminder or a note on my calendar each day, which both i can build a habit to ignore. I use an alert program, which is KAlert in my case, but any alert program should work the same. Every morning at 5AM, it spawns a google chrome window opening the 750words.com write page, and so I wake up and sit down to my computer every morning to find the page already open with a blank page and a blinking cursor, and I start writing. I don't have to remember, and I don't have an alert I can easily ignore. I just find myself sitting in front of exactly what I need to do, every morning.

It works nice, give it a try. I use a similar alert to prompt me for hourly journal entries for mood tracking, and work start/stop times, among other things. If I can represent it as a URL, I don't need to remember it, because my computer is an supplement of my brain.

Saturday, December 25, 2010

How To Tease Everyone On Christmas

This project may never become a serious thing, but it is fun. I intend to write an introductory post on the project, but for now I just want to post two code examples that should peek some interest.

# counter.py
from trapdoor.extension import Extension, Factory

class Counter(Extension):

    value = 0

    @Extension.method()
    @Extension.returns(int)
    def get(self):
        self._result = self.value

    @Extension.method()
    def incr(self):
        self.value += 1

counter = Factory(Counter)

and,

// counterdemo.js
WindowManager.createWindow();

document.write('<input id="a" />' +
'<br />'+
'<input onclick="window.t = window.t - 100;" name="faster" value="faster" type="button" />'+
'<input onclick="window.t = window.t + 100;" name="slower" value="slower" type="button" />'+
'<input id="t" />');

var t = 500;
var globalcounter = counter.create();

function update() {
    $('#t').val(typeof globalcounter.get);
    $('#a').val(globalcounter.get());
    globalcounter.incr();

    window.setTimeout(update, t);
}

window.setTimeout(update, t);

The result is a simple desktop app.

Sunday, December 19, 2010

How To Influence Twisted With Django

This is probably taken as the concept for a horror novel by many, but bare with me as I am going somewhere productive with this line of thought. There are a number of valuable ideas in Django, even if they aren’t original. I think some of the concepts could be interesting if applied to Twisted. We can’t start over, but maybe we could bridge the gap.

The Project

A “Project” is a very vague concept that we all start when we’re doing something new, but in a system like Django it is a codified piece of the framework. What a project is, how it is structured, and where its boundaries lie are all documented carefully. This provides an obvious starting point and creates a wonderful sense of consistency from one project to the next.

The Application

Within a Django project one or more Django applications are combined, and each application provides a unit of reusable functionality. This might consist of DB models and views to aid in tagging objects, providing search indexes, or generating thumbnails from uploaded photos. Like the Project itself, the application is documented by Django in terms of its boundaries and structure.

If Twisted Took A Page From the Django Book?

I think we can make a case for borrowing these concepts and patterns. The running theme is breaking large things up into reusable chunks and defining the boundaries and interactions in ways that we can connect them largely via configuration. Can this work with Twisted? I think it can, in specific areas.

We can probably borrow the Project unit directly, add a script to every project that runs twistd and loads commands, like the manage.py in Django. A standard settings module to configure a project is an obvious choice.

At the next level we would configure smaller, reusable parts the project would bring together. Instead of a urls.py, we might define a ports.py, which we use to map the interfaces we listen on and the services that handle them.

I think we can’t map “Application” to any one concept, but need a variety of types of reusable things. That is fine and Django does the same. We talk about apps all the time, but we also have Request Middleware, Context Middleware, etc. Twisted has a lot of room for configurable middleware.

This is certainly something that deserves more thought.

How To Avoid the Fear of Overkill

Something I read today in a Javascript forum gave me pause to think about broader attitudes in developer tools and libraries.
I love jQuery, but if this is all you want to do, jQuery is overkill. 

Javascript libraries are great if you want to do a lot of things, or one really complicated thing, but if you're just doing something small and simple, just write the javascript code. arandomgeek
I respectfully disagree.

Of course, people say this about a lot of other libraries and I defend against this stance in, more or less, all of these cases. I have heard it about Python and things in the standard library, about jQuery, about Django and Twisted, and about any language that isn't C. The common thread here is someone feeling that, as they are not using every or many parts of a tool, they should not use it for the one or two things it could be useful for. These people suffer from the Fear of Overkill.

I can summarize the argument against this very simply.

It would be overkill for you to write the entire tool for the one or two uses you have. It would also be overkill for you to write a bad version of the one or two uses, when you could use what already exists. It is not overkill to simply use what has already been provided to you.

Tuesday, November 30, 2010

Ducks In A Row

I'm trying to "get all my ducks in a row" as the saying goes. I've got a lot of standing projects, some personal and some professional and many straddling a line between those two.

As part of the process of figuring out what I need to do, I need to figure out what I want to do. I've got a broad range of things demanding my time and a broader range of things I'm wishing I could put my time to. There simply isn't enough of me to go around.

I see so many others around and they seem so much more productive than me. Where do you find the time? How do you do it? I've obviously got some missing element I need to find.

The plan at hand is a simple set of actions.

  • Track my time 24 hours a day. This keeps me focused, especially for non-billable hours.
  • Decide on each standing project if I can do anything. If not now, archive it. If never, delete it.
  • Write every morning. Write more whenever I have something on my mind.
There are things I wish I had time for that I never will. I never sketch any more and I haven't picked up the guitar in a decade. I'll focus on what I can accomplish so that I don't have time to feel bad about the things I cannot accomplish.

Sunday, October 17, 2010

Amazon Review: Triple Town

Triple Town is the first released game on the Amazon Kindle. I was really excited to try this out, and I'm happy to be one of the first to write a review. Now, I know there are going to be a lot of nay sayers about the obviously lacking computing power of a device like the Kindle, which was designed to be lower power and function to read books, not run games. However, we should all be very familiar with the rules about limits in design: they can push us into greater heights. Is Triple Town the end all of gaming? Of course not. Is it a damn fine game that I'm happy to spend some time with? Absolutely.

Triple Town is what you get if you strip an RTS to its core and make into something of a puzzle game. Danc has a great write up on the design limits that needed to be worked around and where a game like this fits into a map of what works and what simply isn't fun, and finds a snug little place for itself.

Honestly, I'm loving the game. Not just as a neat novelty to have a game on my Kindle, but as a game that I am honestly hooked on as soon as I started playing! The game play is pretty simple and based on a casual match-three, but replacing the usual gems or abstract shapes with units in a town-building game. You plant grass and match them up to make flowers, which you match to make bushes, etc. You can defeat enemies by trapping them, turning them into tombstones, which you can match up to build churches, cathedrals, and more. You have to do a lot of planning to keep room on the board to work with, while also keeping blocked off areas for traps. I like to think I've figured out some strategies that are working pretty well.

I do have my complains. For example, the match-path you need to build a house, in a game about building a town, is grass, flower, bush, tree, logging, and finally the house. It takes more work to build than anything else I've found in the game, and that bothers me just from a perspective of presenting the theme of the game. I think the logging or the flowers could have been cut. I also would have liked to see the highscores online, so I know if I'm doing good or just suck.

Overall, if I was a game reviewer I'd be giving Triple Town a 4/5 and I certainly recommend anyone with a Kindle to grab a copy for only $2.99 at the Amazon store.

Saturday, October 16, 2010

jQuery Plugin: ClipExpand


This is my son standing under the Flying Speghetti Monster. This is a nice photo, but maybe I want to zoom in on just my son. Further, maybe I want to do this on the client-side, not on the server-side.

There are a number of reasons I might want to do this. The most obvious is displaying a thumbnail that expands into the full photo. Rather than load two images, we can load a single one, crop the image to get the thumbnail, and expand it into the full image when the user wants to see it.


We might start by looking into the CSS clip property, but we'd run into an immediate problem: the result is just floating in dead-space! The image will be clipped as we specify, but this only hides the clipped areas and leaves the image otherwise in-place.

A better solution is to take the original layout of the image and reposition and resize it and adjust the clip, so that the region we specify by the clip property is expanded to fit the full size of the space we gave for the image.

This means we can define a simple thumbnail CSS class, and specify a height and width, then by specifying the portion of the image that makes up the thumbnail, they'll be generated and adjusted automatically. This is what the clipexpand() plugin does.

You can see an example usage below. You can grab a copy at the github downloads page for my phototagger app, which this grew out of.




Thursday, July 22, 2010

Paper Rock Scissors: Day 3

Now we're demonstrating how fun interfaces can be built without the use of Flash. This is a growing importance, as open web technologies like HTML5 and CSS3 become more supported and capable, and as devices like Android phones and Apple iPads are more widespread, where Flash is un- or under-supported and web technologies are increasingly useful for performance. The prototype of Paper Rock Scissors worked, but we need something that actually looks nice.



This is what I came up with a couple hours of messy around. It doesn't take much to clean up a web game, though it can take a lot more to make it really polish and appear shiny. That is true of any design.


The theme has a few threads that tie it together.

Your are represented by a blue glow, on your score and on your selections. The enemy is represented by a red glow, so the progress of the game is clear without overloading it with any textual messages or any heavy graphics. I've notched the selections, like cards pulled away to mark your choice. Thanks to new implementations of CSS3 transform rules, we have great possibilities we can employ. You really know when a selection lost.

Oh no! Their rock beat your scissors. Too bad.

The player doesn't even need any introduction or instructions. You won't know when the game first loads who is blue and who is red, but the first thing you'll see is you own click making a choice glow blue, and you'll know through experience. Learning by discovery trumps a rule book any day of the week. This is enforced when the scores start reflecting the game, and you can see who is who without any of the labels the game originally had.

I did need to put some more information into the game. Maybe you glanced away when the other player made their pick and missed the animation. You'll want some log of the moves that happened. Still, I didn't want this to clutter up the screen and the chatlog made the most obvious sense to put it, already being a sort of timeline. You probably want the last one or two game events that happened, not the older ones, so I think a nice looking solution was found: the game messages fade as they get older, and the chat content stays visible, uncluttered. The result looks really nice after a few rounds of chat and play.

I'd rather play a game with a stranger while I chat. Maybe I've stumbled upon something more fun than Omegle.
Yesterday I wrote about the little tech-demo Paper Rock Scissors game I prototyped in the morning. Today, I've replaced its crude AJAX polling with a comet solution, cleaned up the UI, and added a real-time chat for the players, in about two hours this afternoon.
You can try it out with the other readers of the blog right now. Give it a try, if anyone else is around.

Give it a try and play with the other readers.



Monday, July 19, 2010

Blink

EDIT: Please don't do this.

The <blink> is back.

Thankfully, for you Firefox users, this won't work.

All of my webkit using readers see a blink tag, doing its blinking, which webkit does not implement. This is all thanks to an evil snippet of CSS:


@-webkit-keyframes blinkit {
    from { opacity: 1.0; }
    50% { opacity: 0.0; }
    to { opacity: 1.0; }
}
 
blink { -webkit-animation: blinkit 500 linear 0 infinite normal; }

We can use our powers for good or for evil.

Sometimes, evil is just fun!

EDIT: This might not work for everyone, even in webkit browsers. It works less reliably when I actually post it, but it is still fun!

Sunday, July 18, 2010

Paper Rock Scissors: Day 2

Yesterday I wrote about the little tech-demo Paper Rock Scissors game I prototyped in the morning. Today, I've replaced its crude AJAX polling with a comet solution, cleaned up the UI, and added a real-time chat for the players, in about two hours this afternoon.
You can try it out with the other readers of the blog right now. Give it a try, if anyone else is around.




Very simple. Nothing flashy. The point was to show off how comet can improve a project that needs it.

The prototype yesterday had a 500ms interval updating the game state, so twice a second it would ask the server if the score changed, if the other player made a move yet, etc. This is a terrible way to make multi-user interactions! The server would quickly get bogged down by all that polling and anything other than Paper Rock Scissors would take a lot more fine-grained polling than 500ms, increasing the load a lot. The solution, in HTTP land, is that we replace several polls per second with a single poll that waits for as long as it can, and only returns a response to the browser when the server wants to send a message. In some techniques, we can even stream multiple such messages in one very long connection. Brilliant? It is actually a very old technique, as far as the web is concerned. One interesting thing is I had used this a lot many years ago, in my Twisted days, where it had been implemented as part of Nevow many years ago. I'm glad to see it finally catching on.

This implementation uses Node.js and the Faye implementation of the Bayeux protocol, an open spec about how multiple machines can pass messages around via comet techniques. Faye doesn't implement all of this, but it implements enough. This is a subscribe-publish system, so what I've done is dropped the interval and instead, whenever either player does something, they publish a message on a per-match channel they both subscribe to. This is also used to carry chat messages. The clients both subscribe to the channel, and publish this tick when something happens, signaling the other player to update from the server. It is still pretty simple, but it works pretty well for being simple. The message handling is as easy as this:

faye_client.subscribe("/prs/matches/" + match_id, function(message) {
  if (message.chat) {
    chat.add_message(message.chat)
  }
  game_update();
});


$(".weapon").click(function() {
  faye_client.publish("/prs/matches/" + match_id, {heartbeat: true});
}

Easy, isn't it? Faye pushes every message published to all the subscribers of the channel for us. The actual game server isn't even involved in this part (but it could be).

Setup of Faye is as easy as fetching Node.js and Faye sources, and building them quickly. Both are new enough that you won't find them in apt or yum, but they are so simple that I can include a tutorial right here.

The original instructions are at the nodejs.org website, but can be summarized easily.

git clone http://github.com/ry/node.git
cd node
./configure
make
sudo make install

Bam. Done. Easy? Move on to installing Faye.

git clone http://github.com/jcoglan/faye.git
cd faye
sudo gem install jake hoe eventmachine
sudo gem install em-http-request rack thin json
jake

Now you've got the node.js module in faye/build/ which you can put anywhere.

sudo mkdir -p /usr/local/nodejs/modules/
cp build/faye-node.js /usr/local/nodejs/modules/faye.js
export NODE_PATH=$NODE_PATH:/usr/local/nodejs/modules/

And now all that is left is to build a Node.js server using Faye, with a simple file faye_server.js


var Faye   = require('faye'),
    server = new Faye.NodeAdapter({mount: '/'});


server.listen(8000);

That was the easiest one yet.

Check out Faye and Node.js for more information.

Saturday, July 17, 2010

Paper Rock Scissors: Day 1

I’m building a Facebook game.

Now, don’t worry, you haven’t lost me to the giant beast, my friends. No, I’m just doing a little project, for fun, to both test and demonstrate a number of technologies. I figured something really simple, like Paper Rock Scissors, would be the perfect target.

I have the game playable in about three hours this morning. I have more work to do. The point of this is to demonstrate a number of technologies I am trying to push as an expertise, because they are all things we know well and which I think are ready to have their day in the sun, so I can see a lot of need for this coming in. Even such a simple game is demonstrating all of these things.
  • A comet server to push events to the game client in the browser
  • HTML5 to build a game UI that is flashy, but without Flash
  • Housing a web app as a Facebook app, for promotion and integration purposes
  • Utilizing HTML5 for mobile gaming platforms
Today, I have a playable prototype that matches up players, updates their scores, and manages the games. There isn’t much UI outside of that. It has some problems, but you can play it and have fun. I’m going to tackle each of the things above in a separate post, but for today, this is what we’re starting with and it will look a hell of a lot better when everything is done.

Thursday, May 20, 2010

A Conversation About The Tedious Details of Creative Work

I just thought this conversion should be preserved for posterity.

ldleworker: indeed
I just need to fucking press through the general CSS refactor, then I can go back
I really can't stand this for much longer
also thanks for helping me figure that out

ironfroggy: when i am stuck doing something i dont like that is a required part of the job which I do because of the parts I do like, I think about old school painters
as in, pre-photography portraits
a painter did so much more than paint, back then. They carved and stained the wooden frames, and they crafted their brushes
they mixed paints from powders they ground up from various sources to produce the pigment
they stretched cloths over the skeleton to make the canvas from hand
they build their own easels, even.
the point is, we look at "they painted" and we forget how much support work that required, and we're in the same boat.

ldleworker: Yeah but at least when they are making their own brushes or carving their own easels physics worked the same no matter where they were standing.

Wednesday, April 14, 2010

Bad UX or Bad Advertising?

Have you ever had the situation where you can't tell if an annoyance on the part of some software is caused by bad user experience design or bad marketing decisions? Of course, we could make a case that all marketing decisions are, by definition, user experience decisions. Still, I am left to wonder today when I made the usual move to click on a webpage background to focus my browser and inadvertently clicked on an advertisement I was not interested in.

I clicked on the margin of the page, which is my usual habit:


What I didn't realize was that a simple scroll upward would have revealed this about the margin:


Oh, you sneaky sneaky Visual Studio 2010 ad!

So, which was it?

Tuesday, April 13, 2010

Someone Do This So I Don't Keep Wanting To

I'd like to say it is for lack of time, but the blame is equally (at least) on the shoulders of a lack of motivation. This is the blame for why all these little ideas never get made. Here are a few things I would love to do/make, but would even more so love for someone else to have already done. There are things I really want to build, because I am excited about building them. There are other things I really want to build, because I am excited about using them. For the second group, I'd just as soon find that someone else will, is, or already has built it.

Del.icio.us Bookmark Post Generator

I'd like to collect and blog the links I find throughout the day, but I can't find a good non-manual way to do it. The method I blogged previously didn't really pan out, unfortunately. I want a web app that I can give my del.icou.us account and have link posts generated for me, with options.
  • Minimum and maximum links to include in a post
  • Minimum and maximum time to pass between posts
  • Email, auto-post to Blogger/Wordpress APIs, or manually generate

Todo Sync

We have lots of places where we track things to do, between our bug trackers and websites like Remember the Milk and Evernote. I'd love a tool that can collect and synchronize these in controlled ways. I want bugs assigned to me added to RTM and I want checkboxes from Evernote notes added, as well.

User-Script Online Editor

It makes sense, as low impact as userscripts are, they should be editable and forkable on the sites that host them. This sounds simple, right? I started to write this, but just haven't found the time to finish it. Do you?

Monday, April 12, 2010

I Will Not Blog About The iPad

I am only posting this to create a sense of public commitment to me against my continual urge to write something completely meaningless about the iPad, just to join in with everyone else.

Monday, April 05, 2010

Using Exploits To Improve User Experience: A Test Case

Many of us know about the neat trick you can do with the common blue/purple colors (without styling) of links, depending on which have been visited or not by the user. Obviously a UX plus to know what you've already seen, but we eventually realized this information could be exploited to learn all sorts of personal information about a user, simply by visiting one site that flooded the page with links to different places and inspected the colors. Recently, Mozilla announced the start of finally solving this problem.

This kind of makes me sad, and I'll tell you why. My first thought when reading the news was to come up with an idea to use this exploit for good. This is only "good" if you like wasting free time, which it has the potential to do.

Announcing, from PanTechnoCo, Always Always New: the link sharing service that only shows you new links.

Keep in mind, this isn't a product, but a toy. I just wanted to play around with the idea. You can post links and you can follow links. The site will show you all links you haven't visited yet, even if you visited them without following links from itself. If you had enough people to keep populating this thing, and you just kept reading, you could be in trouble.

Sunday, April 04, 2010

An Introduction To Vagrant

I spent my Sunday afternoon familiarizing myself with a tool who's Getting Started page has been sitting in my Evernote tickle file for a couple weeks. This is one of those many projects that fall under the ever widening category of "Stuff I Wanted To Do, But Am Glad Someone Else Did It So I Can Just Use It And Get On To The Next Thing." If you use virtual machines as part of your development process, or want to, and especially if you already use the excellent VirtualBoxVirtualBox, then Vagrant is certainly worth looking at.

The Setup (for Vagrant 0.2)


Now, the docs might need some updating and they seem to assume you're already a Ruby user, so they're missing a few dependancies that such a person would just happen to alread have. This is what I did, as an Ubuntu user who didn't even have Ruby installed. I'm also adding Virtualbox's Karmic repository to provide VBox 3.1, which Vagrant requires.

sudo apt-get install rubygems libxslt-dev openssl-ruby
sudo gem install vagrant
sudo bash -c 'echo "deb http://download.virtualbox.org/virtualbox/debian karmic non-free" >> /etc/apt/sources.list'


My machine installed Vagrant to /var/lib/gems/1.8/ so I added /var/lib/gems/1.8/bin/ to $PATH.

Each Vagrant box you build should have its own directory for configuration and should be run from their, so you can create a test project now.

mkdir test-vagrant && cd test-vagrant

Also, there are reports of issues on some 64-bit machines and I couldn't get the base image to run, but the Ubuntu Karmic image is running fine for me, so this got me started with my first Vagrant box:
vagrant-box add karmic http://files.vagrantup.com/contrib/karmic.box
vagrant init
vagrant up

The Point, What Is?

Why do this? What is the value in being able to quickly build, run, and clone virtual machines? Here are a few ways I'm already using them and will use them (more) with a tool like Vagrant to make it nicer.

  • Keeping a definitive base of my development environment. I always have an image of a machine that I consider my minimum requirements for whatever project I might be working on. This is an Ubuntu image with all the tools I use, my vimrc and my virtualenv/pip shortcuts, etc. When I start a new project, I clone this image and add to it.
  • Making my specific environments reproducible. This one I have tried and can now start doing seriously with Vagrant. For any project, I can maintain a script to build a development environment on top of my base. The benefits are two part. First, I can keep a clean record of what is required to work with a project. Second, when a change is made to my base, I can rebuild my development environment for all of my projects instantly. (Well, I can issue the command instantly, but I'll probably each lunch before its done!)
  • VirtualBox images can be portable. It might even be possible to move suspended images, but I'm not completely sure about this, yet. If it turns out to be something I can do, I'll be able to suspend a project on my desktop, running the box off a USB key, and then resume it on my laptop in the park. Even if I can't do this, I can still build identical environments on multiple machines, for myself or for other developers.
  • Replicating production and building local staging setups, machine the setups I have at Linode and EC2, will become something I can do with a minimal effort. I'm going to save a lot of time deploying to clones of my production machines running right here under my desk.

UPDATES:
April 5, 2010 - Added links to Vagrant and VirtualBox websites. Added step to include repository for VirtualBox 3.1

Wednesday, March 31, 2010

Ways Django Can Import Things

How many ways can django import a module?

Grep is hard for this.

In .py files

"import (.*)\..*"
"from (.*)\..* import .*"
"patterns\(['"](.*)['"]"
"url(r?['"].*, ['"](.*)"


In INSTALLED_APPS and other settings.

Am I missing any? Better question: Why do I have to wonder if I'm missing any?

Saturday, March 27, 2010

Bookmarks for March 26, 2010


Friday, March 26, 2010

Good design is... - 52 Weeks of UX

Good design is innovative.

Good design makes a product useful.

Good design is aesthetic.

Good design makes a product understandable.

Good design is unobtrusive.

Good design is honest.

Good design is long-lasting.

Good design is thorough down to the last detail.

Good design is environmentally friendly.

Good design is as little design as possible.

—Dieter Rams

Posted via web from See Calvin Develop

Sunday, March 07, 2010

How To Understand Wavelets

I got acquainted with developing against the Google Wave Preview last week, and I'll be doing more of it this week. There are still many gaps in the documentation and in the public understanding of what exactly is going on in a lot of cases. This post is halfway between an introduction to Wave development and a story of my personal hurdles in my first experiments working with it.

One of the first things you'll find in the Wave documentation is a diagram I have reproduced here. This diagram is wrong.


You're going to notice something when you look at this diagram and play around with Wave itself, the web client. You're going to realize you have no idea what the difference between a Wave and a Wavelet is. You don't seem to be able to even see the term "Wavelet" appear anywhere in the application! What's more, everything the API docs describe a Wavelet as is what the UI seems to call a Wave. This was really confusing to me and I know I'm not the only one confused.

It took me a little bit of time to get the perspective to understand what I missed. Correcting my diagram with that information produces this:


See what was missing there? The missing piece was the all-too-subtle connection, not between Wave and Wavelet, but between individual waves. The official documentation diagram places the waves in parallel and mislead me to look in the wrong mindset for the distinction between Wave and Wavelet in the presentation context.

So how does this pan out in the user interface of Wave? Private replies. A private reply to any blip/reply will create a new Wavelet with two participants: the creator of the blip you reply to and yourself. (Actually, you can create a single-participant child wavelet if you reply to yourself privately.)

I'd like to try some experiments and see if and how the interface would present setups like a child wavelet with completely different participants from the parent wavelet. I'm investigating the use of these as sort of hidden data channels in a Wave. For example, the Robot I am developing might store some auxiliary data about the waves it gets used in via private replies to itself. 

Now, since I'm probably going to be spending a good bit more time with Google Wave in the weeks to come, I expect to document more of the things I'll learn along the way. If you're interested, let me know what you're doing or thinking about doing with Wave.

Saturday, February 13, 2010

How To Count Your Day

I have been making an attempt to record my day. I'm doing this for a number of reasons. I want to know how my moods change through the day, when I'm happy or not, when I'm feeling motivated, and when I'm being productive.

To facilitate this, I have a spreadsheet on Google Docs called "Daily Me" and I've built two sheets. One tracks daily and one tracks hourly. This is what I'm tracking.

Daily:
  • When I wake up
  • Weight
  • How many of my morning exercises did I do?
  • How many of the things I want to do every day did I do? This includes morning pages, sketching, picking up my guitar, reading, and writing.
  • When I go to sleep
Hourly:
  • Mood
  • What am I doing right now?
  • 1-10 scales on how happy, depressed, energetic, and motivated I feel at the moment
  • "Productive" which I mark yes or no. I consider being "productive" doing whatever it is I feel I should be doing right then. This is the thing I try to keep in the green and use everything else to improve.
You might think this could get disruptive. I don't have to do it hourly, so that is only a maximum. I use KAlarm, and your OS has or can have another app for reminders. Every hour it launches a Spreadsheet Form in a new window to let me enter things and get back to whatever I'm doing.

I use this for other daily things. It asks me every day if I've done my exercises, tells me when to check my e-mail (not so I remember to, but so I don't check it too often), and other things.

Overall, I find this is helpful. I like being kept honest, even if its just with myself. I pay more attention to if I'm doing what I should be doing at any given moment, but I don't have to put too much into it and get distracted from those very things. Later, I can look back and find patterns. Even without looking into it deeply, filling it out and thinking about what's going on and how its affecting my day to day helps me improve my understanding of myself and how to do more with every day of my life.

Monday, February 08, 2010

DeferArgs on GitHub

A time ago I wrote a library called DeferArgs and I used it when I was still in Twisted code every day. I no longer have that fun, but I was reminded of the code and decided to throw it onto GitHub for anyone who cares for it.


http://github.com/ironfroggy/DeferArgs

An example usage, where foo could take any deferreds and would be called when they all fire.

@deferargs
def foo():
    assert False
@catch(AssertionError)
def onAssert(error): 
    print "OOPS"     
@catch()             
def onOthers(error): 
    print "I WOULD BE REACHED FOR ANYTHING NOT CAUGHT ABOVE."
@cleanup                                                    
def _(r):                                                   
    print "The result was: ", r

 

Tuesday, January 12, 2010

How To Beg For Suggestions

I added a Skribit widget to the right side of my site. If you have any thoughts about anything I should write about, give me a suggestion!

Friday, January 08, 2010

How To Write Your First Jetpack Extension

I've been meaning to this for months, and I just kept putting it off. So many other things going on, so I didn't think I had the time. I decided to take a look this morning, finally, and put in the energy required to try this cool looking stuff out.

Took me ten minutes.

If you don't care about writing a Jetpack extension, but you have Jetpack installed, you might want to try out what I wrote. "Twitter, Who Am I?" is the name and making your currently-logged-in user at twitter.com obvious is the game. You'll get a nice label above all the pages, so you don't accidentally follow Ashton Kutcher with your business account.

The tutorial is fantastic, so I'm not going to try and rewrite or replace it, but I do want to make some comments about the process of getting into this. Firstly, the tutorial on the website is the same as that in the about page, but crippled. Same text, no interactive features. The tutorial built into Jetpack lets you edit and try out the samples, and the website uses the identical text without those features. It still tells you to push the install button, which doesn't exist. Use the about page.

It isn't obvious enough from the website how to get started. You can get to the tutorial and documentation, but none of it makes it obvious what to do with the stuff when you write it. The documentation for actually installing and distributing seems hidden. Again, the about page comes to the rescue. I'm going to assume they expect you to install Jetpack, get the about page up after the restart, and look at that stuff right away. If you don't, you're going to get lost.

Go to the about page and click the "Develop" tab. This will give you the install and deploy overview, as well as an editor you can test code from without installing the jetpack permanently.

I don't know if anything will come of it, but I created a subreddit for any interested parties.

Tuesday, January 05, 2010

Top Ten Science and Technology Predictions for the 2010's

Looking at Science and Technology over the next year is one thing, but its far more fun and far easier to make wild guesses that cover the next decade!
  1. There will be at least one machine capable of carrying out a phone conversation that passes the Turing test. This is bigger than it sounds, because you can fail the Turing test and still be smarter than a lot of people, these days. The end of the decade will likely see annoyingly friendly automated phone services and websites, first as terribly novelties and slowly as useful, subtle additions to our user interfaces. When you click the wrong thing in Firefox and mutter, "Ugh, not that!" and it corrects it for you, you'll finally stop finding it annoying.

  2. Automated photo and video manipulation is going to get weirdly good. I mean, this stuff is going to creep you out. People will delete their ex from entire collections of videos and photos without a trace, like they never existed (not a bad thing). Weird, is inserting people into photos and videos. What takes a skilled artist to craft with stock, original media, and a wacom table today, we'll have it toy web apps in a few years. The technology is already here, and it only needs to improve and become more accessible. Both are inevitable.

  3. Combinations of nano-materials and solar cell advancements are going to make cheap, compact water filtration devices cheap enough to mass produce and distribute among the third world. Clean water will stop being something requiring a civil infrastructure to provide, and become something that requires only a cheap, donated pump with an integrated filter.

  4. Between eye and head tracking cameras and ever cheaper display technologies, billboards are going to start preaching to us. Literally.

  5. Broadband won't be an option.

  6. Rosie is going to be in our houses. Dyson is revolutionizing vacuums and doing equally impressive things all over the board. I expect to see combination vacuum/sampoo units within five years and to see them self-propelled and operating within the decade. They'll part in a charging unit with a drainage hookup near you washer and drier and clean while you're at work.

  7. Recycling is going to become digestion. Our garbage is already a huge problem and tiny solutions are going to start making inroads. Custom bred bacterial strains, nano-materials to filter and break down petrochemicals and other difficult materials, and plasma generation facilities are going to combine to get a bigger buck for our garbage. Hopefully this will mean we can stop paying them for the gold they haul away from our homes.

  8. Google (and other search engines, if anyone catches up) is already working on the natural questions being queried, like "What is Mel Gibson's top grossing movie?" It's only a matter of time before the next generation, seeing those questions get results, responds with even more natural queries right after it, "No, I meant the other guy." and the engines are going to have to follow the queries and start having conversations about what we're looking for. Context is going to be key and the context is going to be broad and personal.

  9. We'll still be using HTML and Javascript.

  10. We'll hit a roadblock on storage capacity, but it will have been driven so far down in cost and size that the paradigm will completely shift. We'll shift away from a monolithic storage units and into storage pools. We'll replace machines with a large drive or an array with a multitude of microstorage units (micro in size, storing petabyte or more each). We'll add "bits" to the pools when we need more space and toss out defunct hardware, if they aren't extremely reliable and long lasting. The storage will be replicated and spread out over the collection, much like a local distributed storage network. The same technology will scale between machines and locations.

Monday, January 04, 2010

Top Ten Science and Technology Predictions for 2010

I made a few long-term predictions in conversations over the past week about science in the next century. Focusing on only the next year is much more challenging. Also, I'll be proven wrong much more quickly.
  1. Mass market CPU/GPU hybrids are going to make netbooks and tablets very viable machines. HDMI outputs will make them powerful docked machined, capable of replacing a laptop realistically. Intel might have dropped the ball, but Nvidia's Tegra chips are going to prove this in the early half of 2010.

  2. Cheap DNA tests are going to be a noticeable social problem. We're going to see numerous news items this year about disgruntled parents trying to prove some fear with a few stolen strands of hair and a self-addressed envelop from a shady testing company. The legal and social implications aren't going to be pretty.

  3. At least one eBook reader will be released with color support in the US market. TMOS displays will appear in netbooks and phones. Our display technologies will continue to dive in cost and energy usage.

  4. Solar technology is going to hit a cost that will begin to make it a selling point for new housing development. There are likely to be new tax breaks for home's built or renovated with solar panels on the roof tops. This won't lessen the demand for the energy grid, but will slow its growth. The social idea of what a house is will begin to absorb energy production along with gutters, fake window shades, and central air.

  5. Bio-Fuel from algae will start to compete with soy and corn fuel in the sustainable fuels market. At least one company will start to sell commercial and possibly consumer targeted units for self-run fuel production. There are already such units available for breaking down biowaste, and a unit containing algae tanks is a sure attempt to be made.

  6. Google will begin public launches of plugin support for their major applications, starting with Google Spreadsheets' plug-in beta moving out of the sandbox and into Google Docs Labs. These plug-ins will run on AppEngine and be able to integrate with other products to extend and customize them in ways that aren't feasible for Google to do for the entire market. Don't expect to see a plug-in custom sorting your search results, but aside from Spreadsheets, I would expect Docs, Gmail, and possibly Picasa.

  7. The Google Nexus One phone will release and it will not be impressive. It will essentially be a shinier development phone mass-produced to give them better sample sizes for new experiments.

  8. The first commercial production trials of vat-meat will begin. People will be grossed out, but they won't ask if it's already being put in their hot-dogs or not.

  9. IPv6 will not be used much more than it was in 2009.

  10. No one will use public/private key signing, but they'll still complain about spam all the time.
You can see my list of other and upcoming 2010 predictions.

Sunday, January 03, 2010

My Top Ten Goals for 2010

Call them New Year's Resolutions or whatever else you want, but we all should have some goals and we should lay them down. Of course, I'm not sure if its better or worse to make these goals public. I'm just doing what feels natural.

  1. I'm going to move this blog away from Blogger and Blogspot and self host. I've spent the last couple days building a new server, for personal and future business use. I really like the setup I've built to launch and manage a bunch of domains easily. It should be a piece of cake to set up, but migration I'll have to look into the details on.

  2. I will launch up to ten websites in 2010. Some of them will be very small and nifty. Some of them will be undertakings and hopefully profitable.

  3. I'll put more focus to my "Personal Brand" and to my business as an actual business, rather than a dude who does stuff for cash. I won't let that business face become cold, however.

  4. I will read 50 books. This one is tougher, because I know I keep loosing track of my goals when I try to read more often. If I set page-a-day goals, I can get books into my regular cycle of media consumption again. I'm restarting and completing the Wheel of Time series, first.

  5. I will write at least one book. This includes the editing, so I hope to finish more rough drafts, as well. I used to write constantly, and I never do it anymore. This blog is evidence of that, but I don't only mean technical writing. I miss writing fiction as much as I miss writing it.

  6. I will paint at least one painting. I haven't painted anything for a decade.

  7. I will relearn how my guitar can relax me. I'll probably submit some recordings to Sound Bush.

  8. I will do science with my son. We will get shirts that say so.

  9. I will write a JetPack extension.

  10. I will finish and submit the patches to the dozen or so projects I've made internal modifications to in 2009 without time to clean up.
You can see a list of my other and upcoming 2010 predictions.

2010: A New Hope

I couldn't have chosen a cheesier headline. I'm breaking my "How To ..." pattern of titles, but I figure this is probably for the best, and when better to make a refreshing change? I still want to post more How To articles, but I don't need to stick with the pattern for everything. It gets difficult to twist some titles into the right shape, anyway.

Prediction posts are always a big thing the week before and after January 1 and years ending with 0 always have even more of them. Why should I miss out on a great meme that only comes around once a decade? I'm going to mix it up a bit and give you more than a top ten predictions on some random topic:

Developing Upwards presents,

My Top Five Lists of Top Ten Predictions for 2010

This originally was written "My Top Ten Lists ...," but damn if I don't wanna do that!

I apologize for anyone who just let out a huge groan. You can skip them, if you want. The plan is to post one Top Ten Predictions list a day. I'll update the list linking to them here. I had a few conversations about predictions over the last week, and I really wanted to write them all down in one place.
This post is about a bit more than just some predictions and hand waving. This is also about a commitment: I need to commit to this blog more. This isn't some stupid blogger mentality that blogging is inherently awesome and should be the main focus of everything I do and make me lots of money. The facts are simple.

When I blog more, I am happier. The posts give me a means to reflect on what I've been working on and iron out thoughts that would only bounce around in my skull, otherwise. Getting things down on (virtual) paper gets them out of the destructive cycle of constantly bothering me. I think we should all commit to solidifying our thoughts more often.

Allowing title flexibility is a part of that. I'm not going to force myself to blog, but I'm going to put more into this than I used to. I hope to do more than that. The name change a while back was one part of a project that never got off the ground. I'll be moving this blog somewhere I can control the software and do things I can't or don't like the facilities for in Blogger.

I'll talk more about that in a post with more solidified thoughts.
I write here about programming, how to program better, things I think are neat and are related to programming. I might write other things at my personal website.

I am happily employed by the excellent Caktus Group, located in beautiful and friendly Carrboro, NC, where I work with Python, Django, and Javascript.

Blog Archive