Thursday, December 4, 2008
Commercial addendum addendum
Pretty sure it's not real... but... real Cook County (Chicago) phone number...
site: Jones Bigass Truck Rental & Storage
via: Geekologie
Friday, November 28, 2008
Rickrolling tastes funny
What arguably could be considered the best moment in parade history.
I know he’s lip-synching, but he showed up. You wouldn’t get this from any other guy.
Also, Cheese!
Best Commercial Addendum
Yes, this continues to be the best commercial ever created…
However, a VERY honorable runner up goes to this commercial (tap hit: Kent) -
My Cats
As if anybody cared. These are the cats I know I know… these are the cats I know.
This, above, is Dusky. She’s a Maine Coon who loves foods, chirping, T.O.Y.S. and laser pointers. Here’s Dusky chasing her tail with a piece of yellow yarn tied to it.
And, below, is my kitten Putita. Her name is a dirty Spanish word that fits her well.
She really is a bitch-cat. I picked her up off the mean streets of Tucson, delivering her from a harsh life of kangaroo mice and little birdies for sustenance. She hates strangers and voyeur cats, and she beats up on her kitten friends. She’s a sweetheart, but very particular about who gives her the lovin’.
My Milwaukee
What am I supposed to make of this?
via: http://www.thisismymilwaukee.com/
P.S. Must watch the whole thing. There's payoff.
Monday, November 17, 2008
Wednesday, November 12, 2008
"Famous" ventriloquism
First, there's "ventriloquist". You're one step below "mime". At least the mime has the good sense to not pretend somebody else is telling his unfunny shit.
Then, more importantly, there's "famous". This bothers me in two ways. First, it means he's actually making money doing this shit. That makes me angry at him. Second, it means there are people who like his antics. That makes me disappointed with America.
He's not funny, and he's not good at it. It's well known that there are tricks to speaking without moving your lips (replacing m's with n's, p's with t's), hopefully seamlessly enough. But, one would assume that after something like 2 decades becoming all famous at this, he'd at least be good at it... or funny.
I'm all for some good racial humor. ESPECIALLY some good terrorism humor. But this just doesn't even try to be funny... or good at ventriloquism.
This guy showed up at my high school senior party (or maybe it was sometime in college... I don't know... I've swiss-cheesed my memory a bit since then), but I distinctly remembering him bombing hard, except when his little Jalapeno buddy said "on a stick". And that marks the moment I started to hate this man and resent the entirety of his efforts in life.
I've seen better ventriloquists... but I've also seen more entertaining sleeping cats.
Guess who has another special on Comedy Central this weekend? Enjoy!
Wednesday, November 5, 2008
It's over!!!
Or, is it? Good luck folks. I hope all the change and hope you get hopes the change you need to hope for the future of the changing hope.
I hung around with a lot of people tonight yelling "we won!!!!" It went so far as to the playing of Queen's "We are the Champions"... and it makes me wonder whether the quotes should go around "we" or "won"... "We"? Well, Obama, for sure, won. "won"? Well, something happened to this "we," or else they wouldn't be partying.
I live near Seattle, and hung out downtown tonight, moving from bar to bar. Everywhere I went, I heard the same thing... exhuberation. I was at one bar holding a Obama congratulations party where the Queen song came on. One man stood up in front of the screen during the McCain conceeding speech, thumbs down, trying to shut down John's last moments of the campaign. He was ushered away, but not out, and not exactly booed. At another bar, a couple were gloating over the victory. Driving from place to place, I heard honks and screams and howls... saw signs and dancing.
I voted for Bush twice. I think it's safe, at this point, to admit that. The first time was an understandably subdued reaction, bled out over a month, relief that the Clinton administration was over. The second time was merely a feeling of relief tht John Kerry wouldn't be taking over at a critical time. Never fist-pumping, high-fiving, horn-honking, party-throwing excitement. It's new to me to see people so personally vested in the success of a candidate.
I think what made the evening fun (aside from the amazing company I held) was the schadenfreude thought of the disillusionment they're going to be feeling someday soon. I can't seperate the feeling from that of your favorite sports team winning the BIG game. But your team leaves the field and goes to Disney World. This isn't a contest, it's an interview and a hiring. This matters.
I want to think that America will be a better place over the next 2 years. The natural business cycle should be swinging back during this time. And, I don't want to be in the position the liberals have been in for the last 8 years, where bad news for America meant good news for the party (though, it seems to have worked). But, I'm fully expecting some really bad policy decisions down the line here and I expect some scratched heads. Even Vice President Elect Biden agrees that we'll be left wondering.
Congrats, Obama. I truly hope your change is for the good, not for the change.
Saturday, October 25, 2008
Monday, October 6, 2008
Don’t Mock Me
Michael and I came up with something pretty cool for mocking in unit tests.
So, you have a class:
public class Thing
{
public int Do() { return 1; }
}
And you want to mock it because “return 1;” really means “call off to a web service that won’t be there during unit testing”. Obviously, the traditional creating of that whole Interface/Class set thing so you can return a mock version of it sucks (maintenance). Also, you don’t want to put code in your production code which is specifically test code. So, how about we let our unit test project have its own derived version of the class? Then it can override the methods that call out with some simple stubs.
public class Thing{
public virtual int Do() { return 1; }
}
public class MockThing : Thing
{
public override int Do() { return 0; }
}
Getting closer, but now there’s still the problem of instantiating our class instead of the original. How about we just get in the way of instantiating the class when in test mode?
public delegate Thing GetThingInstanceDelegate();
public class Thing
{
protected Thing() { }
public virtual int Do() { return 1; }
protected static GetThingInstanceDelegate _getInst =
() => new Thing();
public static Thing GetInstance()
{
return _getInst();
}
}
// located only in your unit test project
public class MockThing : Thing
{
/// <summary>
/// Temporarily used to force static constructor
/// </summary>
public static void Initialize() { }
static MockThing()
{
_getInst = () => new MockThing();
}
protected MockThing() : base() { }
public override int Do() { return 0; }
}
Now, to call it from your production code:
Thing thing = Thing.GetInstance();
System.Diagnostics.Trace.WriteLine(thing.Do().ToString(), "DoThing");
The cost you pay is a slight performance hit due to using delegation for instantiation (who cares?), a little more complexity and readability trouble, that Initialize method and opening up your design for extension where it probably shouldn’t be allowed.
These can be mitigated as such:
· The performance hit of a delegation is nothing compared to the hit of calling a service over the web. Forget about it.
· Complexity can be commented, and the boilerplate stuff really can be in a base class of Thing if it requires no other base class.
· The initialize method can be skipped as long as there’s a way of triggering the static initialize… which can be done through a marker interface (or attribute) and forced in a method, using reflection, triggering all those classes.
· The opened up design can be mitigated somewhat using visible internals and some other trickery, but this is still a much smaller hit to the design than building all your objects as class/interface pairs.
Nifty?
Friday, September 26, 2008
WA Gov Race
Washington is clearly a pretty blue state. It's known for its hackey-sack flacking douches, and its Pacific Northwest liberal attitude (which I'm coming to love).
It's undeniable that it's a liberal haven, and I moved right into the heart of it.
Though, my first sunlight day here, I went to the Issaquah Target for supplies, and I saw a guy wearing a Club Gitmo t-shirt. It was comforting. I even complemented him on it and he was very cordial. I knew I could never get far from my people. I even quickly found 3 AM stations playing nothing but conservative talk.
Fast forward a couple of years, and we're in the latest gubernatorial race between incumbent Christine Gregoire and Dino Rossi. It's one of the more brutal races in the nation right now. You know how I know? Because I watch Wheel of Fortune and Jeopardy every night, and I have to see both groups' campaign's ads.
Here's a little sample of fucked up:
Dude... seriously... dude...
A couple of days ago, I decided to respond to this YouTube entry, and I was greated with this. They never approved my comment.
Rossi's response:
This isn't the best response, but it at least underscores the dishonesty of one side...
President Bush only banned federal money supporting the destruction of embryos, but never made any prohibitions against private research. There have been incredible advances in the use of adult stem-cells in the areas of disease research in the last year or so. There's enough science here that embryonic should be pretty much off the table. It's a very early field, but there's enough promise to stop demonifying somebody for holding out for a non-destructive method.
Thursday, September 4, 2008
PAX!
So, that's it. PAX is over and we're left with nothing but memories.
My favorite memories, in no particular order:
1) I got to hug Felicia Day and get it on film
2) OMG, I hugged Felicia Day
she was really quite a sweetheart.
3) I saw Felicia and Jonathan Coulton singing "Still Alive"
4) I shook hands with StepTo after he sang a rousing Pearl Jam song on the Rock Band 2 stage
5) During the Friday night concert, I enjoyed the hell out of the 1Ups and Freezepop until some mulleted and hugely bearded sweaty bastard showed up and wanged my friend in the tit, and then the Douchebag Train busted onto the scene dropping off a bunch of 16-year-old sweaty high-school dance fuckers... and all of them started hopping and mosh-pitting in front of us. Horribley horrible, but memorable.
6) I met the EvAv crew. Hi guys!
7) I got into the background of an entire G4 show (XPlay, was on around 8PM Tuesday... replayed this weekend as "PAX Day 1"). Morgan Manjaw is WAY better looking in person (despite the pancake makeup), and I probably look like a total tool trying not to stare at her ass for a half hour.
8) Snagging a bar table at Gordon Biersch 3 minutes after showing up (shunting a 1.5 hour wait). Yay garlic fries!
9) Best pizza ever at Bill's Off Broadway
10) Getting nailed for 40 bucks on a $7.00 parking spot because I wrote 12 instead of 16 on a make-shift envelope.
That wasn't meant to be a top-10 list, but 10 seemed like a great spot to stop writing.
Saturday, August 9, 2008
Beijing Opening Ceremony Oddity
I watched the entirety of the opening ceremony, and this was an amazing, tear-extracting spectacular. Each of the performances was more amazing than the last, leading up to the most amazing torch lighting ever.
Then again, I've never really watched the opening ceremonies before... or really much Olympics in general... But this is a very exciting time for a country who has taken some pretty drastic measures to put a spit-shine on their little country.
All that said, tell me I'm not the only one who noticed this.
Notice something a little odd about the little guy's flag? He's an amazing little boy, with quite the story of heroism and duty in the face of the Sichuan earthquake. I can't believe he'd have a political agenda, and I'm not even sure that flying a flag upside down in China has the same connotation it does here... but still.
Perhaps just shoddy manufacturing quality at the old flag factory?
Sunday, July 27, 2008
My logging technique is supreme
So, thought I'd share my awesome logging technique in .Net. Here's your basic super-dumb program... a main method that calls into "MyMethod" and writes a value out to the screen entered by the user (which must be an integer).
class Program
{
static void Main(string[] args)
{
MyMethod(Console.ReadLine());
}
public static void MyMethod(string value)
{
try
{
Console.Write(Int32.Parse(value));
}
catch (Exception)
{
Console.WriteLine("That wasn't a number...");
}
}
}
So, you want to log/trace your method entries and method exits. Here's the naive approach:
class Program
{
static void Main(string[] args)
{
MyMethod(Console.ReadLine());
}
public static void MyMethod(string value)
{
Logger.LogEnter("MyMethod");
try
{
Console.Write(Int32.Parse(value));
}
catch (Exception)
{
Console.WriteLine("That wasn't a number...");
}
Logger.LogExit("MyMethod");
}
}
public class Logger
{
public static void LogEnter(string methodName)
{
Console.WriteLine(string.Format("Enter {0}", methodName));
}
public static void LogExit(string methodName)
{
Console.WriteLine(string.Format("Exit {0}", methodName));
}
}
What sucks about that? Well, you've written your method name 3 times! Plus, you have to assure that your catch logic captures all cases and never returns early. That's a very limiting approach.
The next approach, using the stack frame:
class Program
{
static void Main(string[] args)
{
MyMethod(Console.ReadLine());
}
public static void MyMethod(int value)
{
Logger.LogEnter();
{
Console.Write(Int32.Parse(value));
}
catch (Exception)
{
Console.WriteLine("That wasn't a number...");
}
Logger.LogExit();
}
}
public class Logger
{
public static void LogEnter()
{
System.Diagnostics.StackFrame frame = new System.Diagnostics.StackFrame(1);
Console.WriteLine(frame.GetMethod().Name);
}
public static void LogExit()
{
System.Diagnostics.StackFrame frame = new System.Diagnostics.StackFrame(1);
Console.WriteLine(frame.GetMethod().Name);
}
}
Well, that's pretty cool, and solves one of the above problems (of writing your method name over and over), but aside from being an INCREDIBLY expensive call going into the stack frame, you're still stuck with making sure you don't leave your method early. Sure, you can mitigate that with proper use of a try/finally block... but you're about to be bitten by something FAR worse: your compiler and your Jitter. Guess what... they know better than you once in release mode. They're going to do all sorts of crazy-smart stuff like sometimes optimizing out your method altogether. This approach is going to work just fine in debug mode, but once you go release, you're going to find out that your little method is going to (without your control) optimize out your method depending on its complexity. Now, your stack walk is going to be completely wrong and your logging is going to write out "Main" when you expected "MyMethod".
So, balancing out all the problems, what's a good approach? Well, I have one.
class Program
{
static void Main(string[] args)
{
MyMethod(Console.ReadLine());
}
public static void MyMethod(string value)
{
using (Logger.Enter("MyMethod"))
{
try
{
Console.Write(Int32.Parse(value));
}
catch (Exception)
{
Console.WriteLine("That wasn't a number...");
return;
}
}
}
}
public struct Logger : IDisposable
{
private string _methodName;
public static Logger Enter(string methodName)
{
Logger logger = new Logger();
logger._methodName = methodName;
Console.WriteLine("{0} enter", logger._methodName);
return logger;
}
public void Dispose()
{
Console.WriteLine("{0} exit", this._methodName);
}
}
Wow... So, now, when you enter your method, you just have one copy of your method name... good tradeoff. And, no matter how you leave your method, you're going to get your method enter/exit thanks to the IDisposable pattern + a using block.
So... why a struct? Well, let's say you're in a high-performance application and somebody really has a bug-up-their-butt about object instantiations on the heap... well, guess what... this gets allocated on the stack, and gets cleaned up when you leave this scope. Oh! But there's a hole in my logic! When I cast to an IDisposable in at the end of the using block, it gets boxed and dropped on the heap! Oh, but yay, we have smart people over in the compiler... This dude looked through the IL and I verified that what he put forth is true. Straight-up callvirt on the Dispose function in the case of structs. Brilliant.
http://haacked.com/archive/2006/08/11/TheUsingStatementAndDisposableValueTypes.aspx
So, here's the overall usage of this awesomeness, including inline tracing, for good measure:
class Program
{
static void Main(string[] args)
{
MyMethod(Console.ReadLine());
}
public static void MyMethod(string value)
{
using (Logger logger = Logger.Enter("MyMethod"))
{
try
{
logger.Trace("Before parsing");
Console.Write(Int32.Parse(value));
logger.Trace("Parsed successfully");
}
catch (Exception)
{
Console.WriteLine("That wasn't a number...");
logger.Trace("Found a bad number");
return;
}
}
}
}
public struct Logger : IDisposable
{
private string _methodName;
public static Logger Enter(string methodName)
{
Logger logger = new Logger();
logger._methodName = methodName;
Console.WriteLine("{0} enter", logger._methodName);
return logger;
}
public void Trace(string operation)
{
Console.WriteLine("{0} : {1}", _methodName, operation);
}
public void Dispose()
{
Console.WriteLine("{0} exit", this._methodName);
}
}
You can expand upon this amazingly simple, and low-impact method of doing effective logging and tracing of your methods where the only compromise is keeping track of your method name in one place, conveniently very close to the actual name of the method. What you gain is one very effective logging and tracing technique. What amazes me is that I've seen resistance to this method. Sigh...
Monday, July 7, 2008
Regional Vindication
Thank you, Jeff
I've long been an opponent of the over-use of regions in code in Microsoft's IDE. It serves a unique purpose of hiding undesirable code, but it also serves the cost of hiding undesirable code.
So few developers know when to use this sort of uber-comment correctly. I've always felt that comments, themselves, often serve as a cover for bad code. I've actually seen regions used to separate out test functions by developer who implemented them. I put a stop to that quickly in code review.
Distracted... I saw a spider coming down from the ceiling in front of the TV (watching The Big Bang Theory) and I did something messed. I grabbed him by the web up high, and carried him at arms-length to the toilet where I flushed him into his new sanitary sewer home.
So, yes. Regions. From some unknown project in coding land.
Seriously... how is that useful? They even spent time counting the stars to line up properly in somebody's IDE.
I'd love to see the line numbers on that file. I'm guessing that the "Properties" section has half a dozen public properties, 3 public fields, and a couple private members. Constructor has one vestigial empty constructor. Methods has 19 private functions, and 2 newly-public ones. 2 private variables are now public members.
My semi-educated guess here is actually not that far off. The details are not important, but it points to a maintenance nightmare... not to mention readability. Look at that code and tell me what it does. You have exactly the name of the class to go by. No comment on the class.... Why not a quick grep of the method names for help?
My modus operandi is to see a new code file and hit Ctrl-M,O. This reduces the class down to its most basics: the class name, its properties and the methods. If all that doesn't fit on 2 pages of scrolling, your class is too big. It does too much. It's not one cohesive functional thingy. If I can't describe it in an elevator pitch... or if it has, in the name something like "manager", "utilities", "common", "tasks"... it's doing too much. Regions are a poor-man's organization.
I believe, at this point, the languages facilitate a class definition that can be inferred from a glance. Comments should compliment the code, not explain what should be clearly visible. I'll get into, later, the use of comments externally, as well is within a function.
Silverlight Streaming Service
Via ars Technica
The program is the first time a Windows Live service that gives access to the Microsoft adCenter Publisher platform has been opened to developers. The selected participants will become adCenter Publisher account holders, as the account provisioning into the ads platform is done directly when they decide to enable ads in their SLS-based video playback options.
US testers who fill out a W-9 form have the opportunity to make money from their videos with this pilot program. The video content uploaded to Silverlight Streaming plays back with contextual ads relevant to the playback experience, based on keywords provided.
So, if you've got a blog, and have some movies you run, and you don't want to use YouTube (understandable given the latest court decision), you have a great option, with a couple bucks coming your way. Go ahead and sign up. We made it REAL easy, and you've got a great shot of getting in if you have a site that can pass the smell test.
White Ninjas
Of course, the original White Ninja:
Friday, June 20, 2008
Bob Log III
Now, I've seen this guy live. He's a real hoot. Bob Log III is a Tucson favorite, playing straight, down-home slide guitar with his own percussion, a real treat to see. Turns out he's a real nice guy off stage too, not afraid to say hi to a fan who recognizes him without his trademark helmet.
He introduces himself:
"Bob Log the third, one-man band, Tucson, Arizona. Heyeeeh! Lemme introduce the band to ya. On cymbals, left foot. Over here on the bass drum we got right foot. Shut up! This is my left hand that does all the slide work, right hand does the pickin'. My mouth hole does most o' the talkin'. And you're looking at my finger."
If you live in Tucson, or he's coming to your area, go on and see him live. If not, do what you can to find some of his music or look up a video or two on teh youtube.
Sunday, June 1, 2008
Breakfast Cake
So, Gabe brings the idea to me to make "Breakfast Cake." He was inspired by breakfast casserole a few weeks ago, and intrigued by the concept of bringing more inappropriate things to breakfast time. It's a good thing the Idea Man lives with the Implementer.
This thing is chock-full of breakfast...
Started off with thawing some frozen Italian sausage Brown up that sausage a bit That looks plenty good Chop up some red, yellow and orange peppers That's a colorful bunch Some awesome sharp white cheddar Cheese is grated The missing ingredients... including cake pans. Also, these are not my World of Warcraft cards. Gabe is back with the groceries 8 eggs, 2 cups of Bisquick, 2 cups of milk, whisked briskly Add peppers And onions And Italian sausage Stir it all together... but this doesn't seem done yet... Ah, bacon. Now we're on the right track. Let's just stir that in Don't forget that cheese. Add about a handful or two Tough as it may be, stir away. This is about where the doubts start creeping in. Add some spices (garlic, cumin, oregano, white pepper, paprika, red pepper, kosher salt) Whisk whisk whisk! Mmmmmm, that's a beautiful bowl of vomit.
The kitten is uninterested. Pam up some of those brand new cake pans Scoop the vomitous blobs into the cake pans Yeah. Plan on eating that later. Cover in tin foil, throw in the oven at 375 for, like, an hour. May as well go mow the lawn Cakes are getting close, time to start getting going again. Time to cook up that country gravy. Yeah, it's packets, but we're not puritans around here. Instead of 2 packets and 4 cups of water, we used 2 packets, 1 cup of water, 2 cups of milk and an egg... for some reason. Breakfast wouldn't be breakfast without beer and coffee This is looking good. The toothpick comes out clean. No cooling rack, but we have super cheepo pans OMG OMG OMG! This is about the point where we realized that this may actually be possible. You're basically looking at a stiff enough quiche to support another layer. Touch. Sproing. More bacon, fried up in the microwave, chopped and mixed with some onions to sauté. The other, thicker cake half came out just as beautiful as the first. Time to begin the 'icing' process. The country gravy thickened up awful nicely. The bottom half is covered with a nice healthy layer of country gravy. Time to add a layer of Italian sausage. Beautiful. Here's that bacon and onions. We'll throw that into the middle layer. Oh, don't forget the cheese Just want to bake this up for about 5 minutes to melt the cheese and get things gellin' a little It looks good! Transfer it to its final serving place Take the top half, flip it and cover with another layer of 'icing' Sammich the whole works together Mmmm, cake burger The icing process begins More icing Doesn't that look great? The cat, still, could not care less Let's seal that last little bit up Now Kayla comes along to work the decoration tip. Plastic baggie, filled with remaining gravy, with a corner cut out. Squirt squirt Pretty pretty Took the remaining peppers and softened them up a bit over low heat for decoration Oh my god that's a cake Well, we have remaining sausage. At this point, we're just playing with our food Decorating crew Holy hell Is so pretty. And packed full of delicious. Adding the peppers and bacon for a little color. Top it off with some Red Hot for color, and we're golden Enjoy it while you still have arteries, you fools Winnar. Time to cut it. Is this actually going to work? That is a damned cake. Dish up! It's only 6:30PM and we're already having breakfast! This looks surprisingly like a cake. No baking and bacon experience would be complete without Michael. So we had him drive up from Issaquah to join us. I am literally filled with joy in cake form Apprehensive girl is apprehensive. Gabe is less apprehensive. The remainder so far.
It was delicious. It was so so delicious. This was a day I feel I can be proud of forever. I can die knowing I've accomplished something great in this world. I'm assuming it'll be tonight when my heart realizes the futility of trying to keep up with my taste buds.