Archive for July, 2006
Virtual Waterloo Records Stickers
What do you get when you combine ajaxy scriptaculous goodness with traditional Austinite slacker wit? Virtual Waterloo Records Stickers of course.








Try it out and let me know what you think.
Timeline Archive View For WordPress
As I promised, here’s a how-to for adding the Simile Timeline widget to your wordpress blog:
First you need to save a copy of this file: timeline-xml.php to your wordpress root directory.
Next edit your wordpress header template and make it look like the following:
At the end of the HEAD element:
... <script src="http://simile.mit.edu/timeline/api/timeline-api.js" type="text/javascript"></script> </head>
And the top of the BODY element:
<body onload="onLoad();" onresize="onResize();">
<div id="my-timeline"
style="height: 150px; border: 1px solid #aaa; font-size:9pt;">
</div>
<script language="JavaScript">
var tl;
function onLoad() {
var today = new Date();
var eventSource = new Timeline.DefaultEventSource();
var bandInfos = [
Timeline.createBandInfo({
eventSource: eventSource,
date: today.toUTCString(),
width: "70%",
trackGap: 0.0,
intervalUnit: Timeline.DateTime.DAY,
intervalPixels: 100
}),
Timeline.createBandInfo({
showEventText: false,
trackHeight: 0.5,
trackGap: 0.2,
eventSource: eventSource,
date: today.toUTCString(),
width: "30%",
intervalUnit: Timeline.DateTime.MONTH,
intervalPixels: 200
})
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
var tl = Timeline.create(
document.getElementById("my-timeline"),
bandInfos);
Timeline.loadXML("{your-wp-root}/timeline-xml.php?" +
Math.random(), function(xml, url) {
eventSource.loadXML(xml, url);
});
}
var resizeTimerID = null;
function onResize() {
if (resizeTimerID == null) {
resizeTimerID = window.setTimeout(function() {
resizeTimerID = null;
tl.layout();
}, 500);
}
}
</script>
<div id="wrapper">
...
Where your-wp-root is the URL to the root of your wordpress installation.
Let me know if this does/doesn’t work for you or if you have suggestions to improve it.
How I Write Web Apps in .Net (Without Losing My Mind)
I’m not actually a Microsft .Net developer, but I play one at work. I’m one of a growing number of Windows by Day/Mac or Linux by night developers. We should probably form a support group. Over the years I’ve done Java, then PHP, then Java again, then .Net, then Java, Java, .Net, Java and now I’m working on a web-based application using .Net. I’m not the world’s biggest MS fan, but believe it or not I haven’t lost my mind (yet). I will now share my secrets with you.
J2EE Lessons
Back when I was doing J2EE work, all the framework hype was focused on EJBs. In practice, EJBs were horribly broken and badly suited to most applications that serve lots of simultaneous users. But man did they sell the shit out of that idea. I got a stack of books on the subject and all I remember is that “passivation == death” Since all of the marketing dribble made it sound like EBJs were the wave of the future people used them. Of the two main J2EE containers (Web and EJB), only the web container was actually useful. Many projects shelled out big bucks for WebLogic (or -GASP- WebSphere), and tried to make EJBs work, but gave up and wrote their own business logic/persistence frameworks. They ended up paying for the EBJ container but only needed the web container. They could have just downloaded Apache and Tomcat for free (and written their own business logic/persistence frameworks) and saved themselves the miserable journey down EJB road, and back.
Or if they were smart/lucky and (way) ahead of the curve maybe they used ATG Dynamo.
Anyways I bring up this ancient history because the same kind of confusion about what to use and what not to use happens in .Net. Some things look like they would be useful but turn out to be poison. At least with .Net there’s only one platform vendor’s bullshit to wade through.
So I’ll start off with what I avoid, just to get that out of the way.
What I Don’t Use
Web Framework
I don’t use aspx – The whole code-beside .aspx/aspx.cs thing sucks because you end up with a lot more files than you actually need. It’s also a shitty separation of view and control logic. Don’t ask MS about it though- they’ve got loads of tutorials on how to make toy apps with aspx, but don’t show you what happens when you try to satisfy larger, real-life sized requirements with it.
Persistence
I don’t use ADO.Net – not even using a database, actually. Tried NHibernate on a previous project, and like most Object Relational Mappers it gets really chatty with the database. Network latency times lots of db requests = death by a thousand cuts. Ended up scrapping the o/r mapper and wrote pages so they’d call one stored procedure per page request, and the stored proc would return a heterogenous result set conaining all of the data elements needed to render a page. Some day I may write more about how that worked. It wasn’t particularly fun, but it was a tremendous scalability improvement.
IDE
I don’t use most of Visual Studio 2005. Contrary to what the ad copy tries to make me believe, I don’t think of Visual Studio as a fully integrated WYSIWYG web development platform. It’s a text editor and a debugger, and it can run MSBuild from a menu. Using it for anything else (like visual html design) leads to madness. The refactoring tools are pretty much useless aside from the most trivial examples.
What I Do Use
Web Framework
MonoRail. It’s Rails for .Net in name more than in spirit. It uses reflection to map URL paths to method names and request parameters to method parameters automagically. Code HAS to go into controller classes since the views are written in NVelocity. It has some simple control structures but for anything more complicated than a foreach loop, you pop back up to C#. Nice way to do MVC.
Persistence
db4o. Not sure how well it’s going to scale, but coding to it is a friggin breeze compared to ADO.Net or NHibernate (or JDO, or TopLink, or iBATIS).
Other Stuff
Fiddler HTTP Proxy: I do a lot of ajax-y stuff, which pretty much makes using a debug http proxy mandatory. The Fiddler docs make it sound like it only works for IE, but it will indeed work with firefox- you just have to set up tools -> options -> connection settings -> manul proxy settings and point it at localhost:8888.
Firefox: Shouldn’t have to say it, but it really is a better than IE6. I do constanly switch between IE6 and Firefox to make sure my code works in either, but the Firefox debugging features keep me over in Firefox most of the time. I use the Firebug and Web Developer extensions on a regular basis. Venkman is a javascript debugger that I use on a less frequent basis but it has saved my ass on more than one occasion. When I run into javascript problems on IE6, it means praying that Visual Studio can kick up the Script Debugger in the right place. That doesn’t happen often. More often I have to resort to window.alert(“made it to line 117″);
TestRunner/NUnit: I’m not a sonofabitch about writing unit tests, but this thing is really handy. Just right click anywhere on your unit test source code in Visual Studio and run or debug a single test fixture.
Nant: It may not be long for this world, with MSBuild catching up in the “embrace and extend copy open source java tools” cycle. Turns out that calling MSBuild from Nant isn’t all that uncommon after all.
Build automation: CruiseControl.NET Nothing like hearing “Alright, who the hell broke my unit tests???” from multiple people across the office two minutes after you commit your changes.
Version control: Subversion. It doesn’t hook into Visual Studio (that I know of) so I end up going out to explorer to do updates and commits, but I heart Subversion much more than I ever hearted CVS. I never, ever hearted SourceSafe. I hearted Perforce briefly on an open source project once but nobody I’ve worked for so far wanted to pay for it.
And that pretty much sums up the set of tools that keeps me sane in .Net.
See, it’s 1:30 in the morning and I’m writing about how it keeps me sane. So you know it’s true.
C#/.Net Web Guy Developer Needed
If you’re in Austin and looking for a new web dev gig, please check out these job postings.
We’re hiring for a senior developer position on a C#/.Net Web application.
Senior Software Engineer (C#)
We’re looking for the you! Must be able to be bend software with your mind, create hugely scalable web sites, program like the wind, and not get dizzy while confronted with two huge 20†monitors. We use a lot of C#, .NET, MonoRail, Indigo. We like to drink beer and eat CheezIts.
Requires a minimum of 2 months of C# development(6 years preferred) and substantial previous server-side development work in Java or C/C++. Experience with XML, SQL, and web services is required.
Yesterday I interviewed a guy who didn’t know the difference between HTTP GET and POST. I wasn’t the one who asked him that question (I didn’t bother) but someone else did. The reason this is a good interview question is that you run into it no matter what language or framework or OS you develop with. All web applications deal with HTTP. So the fact that he wasn’t proficient in C# isn’t a big deal, but regardless of which language you use you should be aware of some very basic HTTP details.
In case you don’t know:
The difference between GET and POST is the difference between a web spider fucking up all the shit on your website by following GET links that modify server state (GET links should be idempotent actions), and and not having a spider fuck up your web site because state-changing operations are safely hidden behind POST methods.
GET is cacheable.
POST is not.
GET is bookmarkable.
POST is not.
You can hit reload on a GET request all you want without getting warnings from your browser.
If you hit reload on a POST, you get this:
As in, “Do you really want to order another Mercedes on your credit card? Because that’s what the request you’re trying to reload will do.”
You can upload a file with POST but not with GET.
Knowing any one of these things about GET and POST is a satisfactory answer when I ask this in an interview. If you have read and understood this, or knew it before hand, I ask again:
If you’re in Austin and looking for a new web dev gig, please check out these job postings.
* Standard disclaimer: I do not speak for my employer blah blah blah.
Traffic Picture
I don’t quite know what I’m going to do with this thing yet, but I wanted to make a picture out of website traffic. If you are viewing this for the first time, you will notice that the word “YOU” appears somewhere in the image below:
You have been assigned a random color and x,y location on this image. Each person sees “YOU” in a different location. Every time you view the image (or this page, which contains it), your circle will become one pixel larger. Right now it’s just one pixel so you probably can’t see it. Every person who views this image gets a randomly placed and colored dot that will grow every time they view the image.
But wait, there’s more. I made it so you request the image by identifying a particular tag. The one in this post is tagged with “cricketschirping.com” I’ve posted a few on myspace with other tags. The idea is that you tag the photo based on where you put it.
Whenever you see one of these other images, your particular color and x,y position will be the same across all of them. However, the diameter of the circle representing you will be proportional to the number of times you’ve visited the particular page where the image appears.
What does this mean? I don’t quite know yet. I just wanted to see what would happen. Obviously if you have the same kinds of traffic patterns as another person’s page, your image will be similar.
You can also get a rough picture of the amount of repeat vs one-time visitors. More big dots means more repeat traffic. Lots of small dots means lots of people came to it once but never came back.
It’s ugly because I made it with php and the image library for it sucks. The alpha blending in particular is all kindsa jacked up. Alpha channel values are 0-127, with 0 being opaque and 127 completely transparent. WTF???? And antialiasing? Forget it. Maybe there’s some other imaging lib you can use with php but the built-in one is pretty bad in my opinion.
TimeLine
I hacked up a new view of my archives using TimeLine, an ajaxy-DHTML widget from MIT. It’s that set of gray bars up at the top of the page. It might not have finished loading yet but soon you should see purple dots representing posts on this blog. Click and drag either the lighter or darker bar and you can scroll around. Click on a dot and you get an excerpt of that blog entry and a link to the full post.
I like viewing archives this way because it conveys not just the order of the posts, but also the changes in frequency of posting. You can instantly see if I’ve been posting a lot lately or if this is the first in a while.
I’m not sure I’ll keep it, but what do you think?
I have some other ideas for it:
- some kind of indication of comment activity. I’m thinking a duration line extending from the earliest comment to a post until the latest.
- add events from my upcoming.orgaccount
Problems/Limitations:
- Currently it just loads the last 100 posts.
- Some points in time have a lot of posts around them, so they pile up and run over into the lower band, making them un-clickable.
- The date is always set to today, so when you click on a post it reloads the timeline and it’s back at today even though you might be looking at a post from weeks ago.
I will post the source code soon, which reminds me. I need to find a source-code formatting plugin for wordpress. I tried using a CDATA section but php still tries to execute the php code of the example. Anyone know of a way to tell PHP to not execute a block of what looks like php, just display it?
Interview With the Embryo
From Embryo Ventriloquism: Not Just Almost A Googlewhack (in response to Sen. Sam Brownback‘s recent speech in which he played the part of an embryo and asked the Senate, “Are you going to kill me?”):
Interview With The Embryo
It was a strange thing, the other day; there I was, in the scientific laboratory, talking to an embryo. It had a small voice, like an angel crossed with a kitten, and it explained to me how it wanted to be killed.“I’m doomed anyway,” it said nobly, drawing what passed for shoulders up so it stood up straight in the test tube. “It’s not like I was destined for life; I’m a spare, made just in case some other embryo fails, or I was donated by some other couple. Fact is, there aren’t enough wombs to go around to take all of me and my brethren, and we have decided to make something of ourselves.”
“But… that’s such a sacrifice…” I stammered.
“We would be garbage otherwise,” it commanded me. “You brave souls donate your organs so that others can live – and so we throw ourselves into the breach to donate our whole bodies for the betterment of mankind! We want to do it! It’s the only rational thing to do!”
“You embryos,” I said in an awestruck hush. “You’re so much better than we petty humans.”
“It’s what Christ would have done,” they told me.
“But…” I protested. “You could become humans. Fully-fledged children. Isn’t that a temptation?”
“It might be,” the embryo said, a half-formed tear in its half-formed eye. “But the truth is, we embryos are very sad.”
“And why is that?”
“The Republicans,” it said. “We’re kings and queens of mankind to them, but once we emerge from the womb they don’t care about us any more. Don’t they understand that we embryos grow into children who must also be nurtured? Many of our would-be parents are toiling for minimum wage, either making $5,000 below the poverty level or working two jobs to get by… And suddenly, we’re neglected. Our education suffers. Why would we want to come into a world that’s governed by people who hate what we will become?”
“It’s as if the Republicans loved the caterpillar, but hated the butterfly,” I said.
“Yes. Better to give ourselves to the betterment of mankind. If one man will ever walk partly because of me, then I will have done more than I would have ever been able to do for humanity under the Bush administration.”
“You are wise, tiny embryo,” I said, and watched with a gasp as it grew tiny angel wings and flew into the waiting arms of science.
If You’re Feeling Significant
You really should see Population: One.
Wikimapia
Neato: Austin, Wikimapia-style
And a shout out to H-Town.