tweesaic, My Mix10k Submission
2010-2-1
Last year I was very excited to see Microsoft's Mix 10k coding challenge but because of time constraints I wasn't able to finish an entry before the deadline. This year was threatening to do the same, but I managed to come down with a cold, work for 20 hours and squeak it in before the deadline.
So without further ado I present tweesaic, which (to my knowledge) is the first fully online photo mosaic creator. To use it, paste in an image you want generated and tweesaic will search twitter for tweets related to the 10k challenge, analyze the profile pictures associated with each tweet, and create a photo mosaic.
Here are some samples I've created with tweesaic:
My initial working version was 80k, so I was a little nervous about getting it down to size. The first four-fold reduction came easily, but getting it from 20k down to 10 was brutal. There were a couple a couple features that didn't make the cut:
- Doing image processing on a BackgroundWorker thread
- Saving a generated image, transitions and animations
- Error messaging was drastically reduced
- Buttons! (use the tab key instead)
The last is possibly the most painful omission; I had to remove the Xaml for submitting search terms and image urls. The workaround is to use the tab button to submit new search terms via the LostFocus event on each TextBox. I'm wondering if it would have been smarter to remove the logo and background gradients instead.
There are some features that I'm really glad I was able to keep in like using isolated storage for caching image data. That means mosaics will be generated faster the more you use the tool. I also like having the preview image up in the toolbar to let you compare how the mosaic looks versus the source image. The file upload feature is a convenient way to upload your own photos without hosting them (or to get around some sites which don't provide a cross domain policy).
Unfortunately, there are some bugs too. You can only upload ".jpg" images into the app, so you will have to rename any ".jpeg" extensions for them to work. Png image uploads work as expected. Also there is a bug in the image processing algorithm where an image with a high alpha component may get a higher match rating than a low alpha component. This will manifest itself on some dark regions that look unnaturally light because of the white background.
Play around with it and let me know what you think. To start, here are some images that you can copy paste into the url bar:



Special thanks to Nick Thiel for helping with the logo.
Why I Hate the Web
2010-1-8
I don't hate the web, that would be silly. But in a way, I do hate programming the web. This is kind of a odd statement since I am a Web programmer. This is more odd because if you asked me about my job I would say that I love it.
To explain what I mean I should back up a bit. I got my degree before my university had a proper web program. The internet was certainly around--it had been around for many years--but since all curriculum seems to be many years behind reality I was able to escape college having only taken one web programming course. In php. And I didn't do shit in that class. Anyway, I went through school thinking that I would be writing client applications in Windows Forms for the rest of my days and only when I had a degree and a crummy internship did I realize that maybe I had missed the point.
So now that I'm 4 years into Asp.net I find myself longing for Windows Forms again. That's not true, Forms were sloppy and I'm glad to see them go, but I do long for stateful programming. I'm tired of !IsPostBack. I'm tired of session timeouts and F5 and "To display the webpage again, Internet Explorer needs to resend the information you've previously submitted." I'm extremely tired of RequiredFieldValidators and RegularExpressionValidators and Labels and TextMode=MultiLine and AssociatedControlIDs. Every time I build a web form I weep.
It shouldn't be this way. I used to build houses and believe it or not there are people who still drive every nail into a house by a hand with a hammer and that's beautiful. Programming is not building houses. Beautiful programming is hiding the shit you hate in a class so that you never have to do it again. That's why I love it, and that's why I think Asp.net failed.
I'm not the first person to hate building webforms and I'm not the first person to try and hide that shit in a class so I never have to do it again. But me and everyone else can't seem to do it right. If I can get it to work right it's slow, if I get it fast it's either buggy or unmaintainable. If it's really clever it won't work in a shared hosting environment. Or it won't work without ViewState. Or it won't work without <form runat="server" />. If I want to buy someone else's solution it's still either slow or buggy or expensive (or all three, what we call in the biz The Trifecta).
Nobody can seem to figure it out in asp.net which is ironic because everyone can write a UserControl that works great. Hardly anyone can write a WebControl that works at all. Not if it's going to be templatable. Not with ajax. And especially not if that Ajax is going to have a graceful fallback and work with a script combiner. So 8 years after asp.net we still spend all our time writing user controls and copy pasting them as best we can. Every few months we try and turn that shit into a webcontrol and we fail.
So that's why I love Silverlight. I could kiss DependencyProperties and their corresponding OnPropertyChanged events. Not having to care when my data is loaded but knowing it will work is amazing. ControlTemplates that really do separate how it works and how it looks is phenomenal. I will never claim to be a great programmer but in Silverlight you only have to override two methods to create a custom panel. That makes me giggle. Sure I still fail miserably when I write new controls, but after each attempt I get a little bit closer to making something cool.
It may not be web programming, but it's close enough for me.
Blending and Brushes in Silverlight
2009-12-17
I'm in the process of converting a Flash site to Silverlight 3 and I just couldn't get the gradients right on my opacity mask. After talking to the flash developer he reminded me that he didn't use opacity masks but a multiply effect. I thought to myself "game over, Silverlight doesn't support blend modes."
I knew about SL3's support for custom shaders, but I was surprised to find Corey Plotts' library of blending effects for Silverlight, including Multiply. With Silverlight there are always caveats, and this has a fairly big one: you can only use VideoBrushes and ImageBrushes for effect inputs. That means in order for me to have a dynamic color applied to my blend I have to use the WriteableBitmap class to render my Grid's contents to a BitmapImage, then apply that to the MultiplyEffect as an ImageBrush. Will it work? It should, but I think I'll take a nice long winter break before I give it a shot.
Next up: Silverlight
2009-12-5
Just a quick update on the site. I'm working on a silverlight version that is nearing completion. I hope to show off some of the plane 3d effects in a new way. Expect to see it in 2010.
Until then, I may be posting a few thoughts about cool or peculiar things I've found in Silverlight 3 and 4 beta.



