Wednesday, June 17, 2009

Focus

Another Lucius Seneca quote:

No one persuit can be successfully followed by a man who is preoccupied with many things

What are the things that you are preoccupied with? How many things do you have on the todo list in your head? How many of them have you gotten done lately? If you're like me then you have a big list floating around your head where things drop on and off of the mental checklist and you never really get to most of the things on there. Write it down! Use a text document on your computer, send yourself an email, start a google document, or even good ol' pen and paper. Just get it out of your head so you can focus on things one at a time without worrying that you're going to forget something.

Tuesday, June 16, 2009

Yesterday my boss forwarded a resume to myself and several of the people on my team. The candidate has a ton of experience doing projects similar to what we're doing and would likely be a good fit. Reading through the previous positions on his resume and then his education I realized that he's been working as a programmer as long as I've been alive (I'm 27). I find the thought that I might still be sending out resumes in 20 years is horribly depressing.

I started reading through On The Shortness Of Life an essay by Lucius Seneca last week here and there while waiting for things to build/install and when eating my lunch. Tim Ferris had a blog post about it and that got me interested. Anyhow, It has me thinking a lot about my time and the fact that it's a limited commodity, the fact that I'm giving up much of the lives of my children for work, and priorities. Here are a few excerpts that I've found particularly insightful:

So it is - the life we receive is not short, but we make it so, nor do we have any lack of it, but are wasteful of it . . . life is amply long for him who orders it properly.

"The part of life we really live is small." For all the rest of existence is not life, but merely time.

Are you not ashamed to reserve for yourself only the remnant of life, and to set apart for wisdom only that time which cannot be devoted to any business? How late it is to begin to live just when we must cease to live!

your vices will swallow up any amount of time. The space you have ... escapes from you quickly; for you do not seize it ... but allow it to slip away as if it were something superfluous and that could be replaced.

Been a while

It's been a while since I wrote anything and for that I apologize. A couple months ago I tool a job for a company called Advaiya in Bellvue WA. The commute is a little painful but that stability is rather nice. We'd gotten to the point where I needed to either get other clients or get a real job. Health insurance was killing us and we were pretty tight on funds in general. In hindsight I should have taken care of health insurance and switching out to an HSA but never did.

So, I'm back in the office again. I'm not sure what the future of this blog is and I never posted much or developed any significant level of readership to the best of my knowledge (if you're reading this now don't think that statement means I don't care about you :) ). I might keep writing in it as starting a real job again makes me remember how much I dislike the 9 to 5 thing. The sort of rhythm you get into where you have to fill up 8 hours before you can go home is strange. Can't I get the same amount or even more done faster? If I do the same/more work faster/smarter should I be done and head home? These are things that I'm pondering.

If you have any ideas for the future of this blog please comment.

Wednesday, January 28, 2009

IIS7 and url escaping

First off, sorry I'm such a slacker. Posting to this blog hasn't been one of my top priorities. I have a lot of draft posts that I've started or dropped a few thoughts into and never returned to. I'll work on getting through those. Enough of that.

I've been working on a community that's hosted on Community Server off and on for a while now. Recently my primary client upgraded the test environment server over to a new box with a new version of the OS, SQL Server, and IIS. This has caused some problems with some problems here and there but most of those were taken care of easily. One weird one was that the tagging system in Community Server wasn't working quite right anymore. Single token tags such as "foo" would work as expected however multi token tags "foo bar" were no longer working and I was getting a page not found error. After a lot of digging around I discovered the issue:

IIS6 treats "+" and "%20" in a url the same however IIS7 does not. Community Server uses "+" to indicate spaces in their tag url
s. So for a single token tag you have something like:

[url]/tags/foo/default.aspx

and for a multiple you have:

[url]/tags/foo+bar/default.aspx

At the suggestion of a developer I know I tried replacing the "+" w/ "%20" and low and behold it worked fine. The solution to this issue is to allow double url escaping by adding the following to your web config inside of the System.WebServer element:

<security>
    <requestFiltering allowDoubleEscaping="true" />
</security>



Blog Post on Breaking Changes on IIS7:
http://learn.iis.net/page.aspx/381/aspnet-20-breaking-changes-on-iis-70/

Community Server documentation on this issue here:
http://docswiki.communityserver.com/wikis/cs20085docs/configuring-iis7-for-community-server.aspx

Friday, April 11, 2008

Javascript onUnload and postback

So I just ran into an interesting scenario. I have a custom control where I need an event to fire before postback but I don't want to have to add an OnClientClick event in every page that uses the control. In fiddling with the javascript onunload event I found that oddly enough the unload event fires after postback to my aspx page. The solution? Use onbeforeunload instead:

window.onbeforeunload = unload;

function unload() {
alert("unload");
}

Wednesday, April 2, 2008

Asp Uploader Control Weirdness

It's been a while since my last post and I apologize for that, I need to post more often because I tend to run across interesting things to post about. I'm just lazy.

I ran into an issue the other day when working on a SharePoint site that had me confused for a while. For some reason when you access the Uploader.PostedFile.InputStream property twice (even when setting the Position in the file to zero manually upon setting up a new reference to it and wrapping things in a using statement) the second time you read it you’ll get an empty file. Which is fucked up.

Anyhow, I fixed that by accessing the Uploader.PostedFile.InputStream property in one of the instances where I wanted to access the file but didn't actually need an input stream. I haven’t really been able to make sense out of why it works this way but not the other but whatever. Life goes on.

Friday, January 11, 2008

GDI and Ampersand Rendering

Yesterday I spent a while tracking down a bug in a library that I wrote a while back. One of the things that the library is used for is drawing text in fonts that aren't web safe to be used as headings and whatnot. So if I want the phrase "Out Of Office" drawn in whatever font I just created (this isn't actually a real use case) I can just upload the ttf file to my fonts directory on the server and use the control to generate an image dynamically that will fit the space. The tool even provides caching so after a string with a given set of params has been requested N times it caches it and will load the image from the cache upon future requests. But enough about that.

The bug I tracked down yesterday was related to the ampersand character and the fact that for some reason when the string I wanted to draw contained the ampersand character then no text was being drawn. I wouldn't get any exceptions or anything I just wouldn't get any text. The result image was just the background color I'd requested the size that the text would require if it was in the image. Without the ampersand char it worked as expected.

In GDI when you go to draw a string via Graphics.DrawString you can optionally display hot keys (meaning underlining a specific key to specify that it's a shortcut visually). When I'm drawing a string I'm passing in a StringFormat object which contains some formatting information (horizontal alignment and such). One of the properties of StringFormat is HotkeyPrefix which is used to set the Hotkey functionality for the string (Hide, Show, or None). Now you might think that simply setting it to None (which is the default btw) would result in no Hotkey formatting being considered when rendering the string. But you'd be wrong.

After a great deal of trial and error I got the ampersand to render when I replaced each ampersand with 2 ampersands (an escape of sorts) and then set HotkeyPrefix to Hide. Why this worked I'm not sure and it's kind of counterintuitive but whatever. That's how I fixed it.

Monday, December 17, 2007

Seattle Startup Weekend

The next Startup Weekend has been announced and it's in Seattle. I've been somewhat involved in helping to get things going and am really excited to see how it turns out. The event will be Jan 25-27th. More details to follow.

You can register for the event or read up on what startup weekend is at the Seattle Weekend Announcement. It will likely fill up quickly.

Saturday, December 15, 2007

You know the fun Restart Now/Restart Later Windows pop-up that shows up when you have updates that you need to install? The one where if you click later it will just pop up again in a few minutes? I'm term serv'ed into a server that I don't have administrator rights on and it popped up. Only since I don't have shutdown/restart rights the restart button is grayed out. Since I have no choice in the matter why does the freakin thing even show up?

So I just drag the little window off to the edge of the screen where it will sit quietly and not bother anyone anymore.

Thursday, December 13, 2007

Creating Something Beautiful

I was catching up Joel Spolsky's blog earlier and he had a series of posts containing the transcription of a talk he gave at Yale (part 1, part 2, and part 3). The posts are long but I thought they were worth reading. In particular there were two things he touched on that I thought were interesting.

Testing
In part 1 he talks about testing and the fact that there's no realistic way you could have automated tests cover everything. He argues that at the very core the only thing you can do is check to ensure that one program behaves like another or according to a set of tests. Those tests however can't possibly cover everything that needs testing.

He gives an example of the move at Microsoft to more of an automated test process and the rumored laying off of testers who don't know how to code to bring in SDETs who can program those automated tests. He points out that those tests can't test a number of things that require someone actually look at the product such as whether thing were laid out in an orderly and logical fashion and whether the product has a feeling of continuity.

You can test a lot of things through automated testing but there's always going to be a need for someone with a sharp eye to go through and make sure everything is ship shape.

In-House Programming
In part 2 he writes about why an in-house programmer sucks. He gave three reasons and they are all very good but the one that really struck me was the second:

"So, the number two reason product work is better than in-house work is that you get to make beautiful things."

Numbers 1 and 3 are that you never get to do things the right way and that at a software company your business is software so there's more incentive for the company to treat developers like rock stars (and who doesn't want to be treated like a rock star now and again).

Number 2 stood out to me because it struck a chord somewhere and reminded me why I started getting interested in programming. I wanted to create something cool and useful and beautiful.

I played guitar for a long time and I didn't do it to pick up chicks (though I may have used it in that way a time or two), I did it because I wanted to create something. I wanted to write something that would touch someone or cause someone to open up their eyes to a new perspective or challenge an existing perspective. I wanted to create something beautiful. I used to sit and play for hours, now I only play around on the guitar here and there when my son (who is 18 months old on Saturday) points to it and either wants to watch me play and dance a bit here and there or wants to sit in the case after I've pulled the guitar out.

Currently I'm working on various small (on a scale of all development undertakings) projects. Some of them are pretty cool (like the one I'm working on now that I'll post about once it launches) and some of them aren't as cool (like forms). Though I can still work towards creating flexible and elegant solutions. In the grand scheme of things they may not be groundbreaking or hugely significant but they're still opportunities for elegance.

Someday I'd like to create something beautiful and significant. And I will.