Archive

Author Archive

Idiot Driver 2.0

My FIRST thought is WHY did this TAKE so (expletive deleted) DAMN long?  All right, all right.  I’ll cut you some slack Microsoft.  You DID give me the App Dev account for FREE.  I’ll give you that.  PLUS, you’re making sure my code isn’t stealing somebody’s password or doing something malicious to their phone.

That’s the timely news.  But if we warp back to two weekends ago, I would have been throwing QUITE a few expletives towards Twitter.  It was rainy and overcast and was the perfect time to update Idiot Driver to 2.0 and apply the “metro” look to the main page.

I have a few custom controls that I wrote for the settings page that prompt for input.  The first one is just a single field with Ok and Cancel all placed on a modal background.  I can adjust THAT font size so it’s a bit bigger (I know, it should be even BIGGER – next version).  Most of the default text blocks are pretty small.  Call it programming for the blind.  Which I am.  Oh sure, I can SEE, but I need a powerful prescription to see WELL.  I added a small “drop arrow” to the metro button so it looks more like a drop down list.  WHY Microsoft didn’t make this style a default is beyond me.

This modal field was NOT wrapping the text and was seriously annoying so I fixed that.  AND I intercepted the “Back” button in the modal field so it wouldn’t dismiss the entire page and go back to the previous page or exit you out of the application.  If the modal is displayed, the first press of the back button will dismiss the keyboard and the next press of the back button will dismiss the field.  A minor technicality, but definitely a LOT less annoying.

Raj sent me some code that he found on the net which basically adds the tilt effect to EVERY control that can do it.  So I added these tags to the top of each page and it just WORKED.  I was pretty happy about that, but the highlight color is pure white which is pretty ugly.  Maybe not ugly enough to try to change it before the next release, but I’ll get to it.

xmlns:STK=”clrnamespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit”
STK:TiltEffect.IsTiltEnabled=”True”>

 I added <<MYTAG>> substitution which is similar to the <<TAG>> substitution but it replaces the <<MYTAG>> with YOUR license plate it you’ve defined it.

The name change was pretty easy too.  Just make sure that all or your application name references are changed (including the manifest).  By doing that, the name will change in the Windows Marketplace.  I think that’s what took so long with certification and then the subsequent publishing to the WM.

The thing that REALLY got me all steamed was the fact that Twitter changed their REST (Representational State Transfer) response.  Everything above, including the manifest change, took me about 3 hours.  I was all set to test things on thephone (versus testing on the emulator).  That means I had to re-authenticate with Twitter.  This is where things failed.  I was able to get to the Twitter Authentication page, but once I pressed OK the navigation events would trigger and the response came back compressed.  The code I had was definitely NOT expecting this and spit out some graphical characters in the error box.  This meant that TEXT was definitely NOT coming back from Twitter and I had a long road ahead of me to try to figure out what was going wrong.  I Bing’d a bit and found that Twitter had made an announcement a while back that they WOULD be doing this.  GREAT!  I just get my application out to the marketplace just in time for Twitter to change their
minds AGAIN.  Just like with the first Twitter hurdle, the posts are REALLY old and out of date.  Although I saw something that looked promising.  “All I had to do was set two properties in the request and everything worked!”  This was coming from some post.  So I tried it, and I got nothing.  I was still getting compressed data in the response.  I figured I was going to have to decompress it myself.

I ended up using a GzipInputStream in one of the libraries that I was already using.  There was quite a bit of setup because you have to take the “character” data and convert it to bytes.  Then put the bytes into a MemoryStream.  THEN hand the MemoryStream off to the GzipInputStream.  I tested it and I got “bad magic”.  No.  SERIOUSLY.  “Bad Magic” means that the first two bytes of the data were NOT correct.  Not the correct “magic” (or completely arbitrary) numbers that mean THIS data stream is “Gzip Compressed”.  For data that has been gzipped those magical first two bytes are 13 and 139.  The stream that was coming back from Twitter was 13 and 253.  I tried quite a few permutations of properties and spitting things out to the debug window and I could ONLY debug the stuff ON my phone.  PHUN!!

if (response.Headers[“Content-Encoding”] == “gzip”)
{
    // MAGIC: First byte (13), second byte (139)
    // BOGUS coming back from Twitter: First byte (13), second byte (253)

    byte[] bytes = StringToByteArray(content);

    //bytes[1] = 139;

    using (MemoryStream stream = new MemoryStream(bytes))
    {
        using (GZipInputStream gzipStream = new GZipInputStream(stream))
{
using (StreamReader reader = new StreamReader(gzipStream))
{
StringBuilder builder = new StringBuilder();

                while (reader.Peek() > -1)
                {
                    int theByte = reader.Read();

                    builder.Append(((char)theByte).ToString());
}

                content = builder.ToString();
}
}
}

    Debug.WriteLine(string.Format(“content = ‘{0}'”, content));
}

I tried different Gzip libraries that Hammock might recognize to NO avail.  SIX hours later I figured I needed to head back to Bing.

I ran across a thread on a Twitter API forum that took me back to CodePlex.  REALLY?  I had gotten just about every library from CodePlex so why not some SOURCE?  I grabbed the source for Hammock and SharpZipLib.  That didn’t work.  I was getting reference errors and the namespaces were out of whack.  More Binging…  I found https://github.com/GunioRobot/hammock and downloaded the source from there.   I scooped those pre built DLLs from the projects and plopped them into my project.  BOOM!  Object reference not set.  AGAIN!  REALLY?  I stepped through the code and bit and saw something out of alignment.  So I brought the Hammock AND SharpZipLib project into MY project and hoped for the best.  I ABSOLUTELY could NOT believe it.  All of the source compiled and loaded onto my phone.  It actually WORKED!!  I threw my arms up in the air.  TOUCHDOWN!!  WOOO!!  I could NOT believe it.  I was hopeful, but wasn’t expecting even THIS to work.  So if I initially had ALL of the source in my project then…   “All I had to do was set two properties in the request and everything worked!”

I apologize to my friends that aren’t nerds who actually stuck it out to the end of this.  My brain hurt for quite a few hours, at least YOURS can hurt for a few minutes reading this.  😉

Advertisements

What’s in a name?

I’ve gotten some feedback on the Crazy Driver application name.  My FIRST instinct was Idiot Driver.  I don’t know about YOU, but when I see somebody doing something stupid I say to myself “What an idiot”.  I didn’t think Microsoft would “allow” this name so I shelved it.   I should have gone with my gut.  I thought I’d try to go with a play on words “Tweet Tag”, but how many people use the slang Tag for a license plate?  I also did a search and found the site tweetag.com.  So the domain was already taken.  Stupid Driver?  Stoopid Driver? (Too close to Stoopid Monkey, the people that bring us Robot Chicken.)

I thought some more and looked on Twitter and found people using the hash tag #CrazyDriver.  I thought was pretty generic.  And went with it.  I did a cursory search and didn’t find anything with that name.  My Crazy Driver app is released at the end of March and lo and behold the Crazy Driver GAME is released at the end of APRIL!  WTF?  And NOW Microsoft sends out their copyright infringement letter.  Pretty coincidental, but I certainly DON’T want anybody infringing on MY copyrights so I don’t want to do it to them.

I’m thinking I want to go back to Idiot Driver.  I don’t see this app in any of the online stores.  I e-mail the Windows Phone Marketplace support about my dilemma and the guy replied “I don’t see why you couldn’t use that name.  I should pass.”  So I’m gonna do it.  All I have to do is change the APPLICATION_NAME constant in my app to “Idiot Driver” and then change those references in my submission.  Hopefully it’s as easy as that and the people would already downloaded the application will get their newly named application during the next update.

It’s not ALL about idiot drivers.  You might see some cool things and have something POSITIVE to tweet about.  By all means.  There’s a few positive system default tweets as examples.  Or create and save your OWN.  Play “Slug Bug” or “Out of State” or get help with license plates that you can’t decode.  Ok, so THIS one was EASY!

YOURMOM

#CO_YOURMOM

Thank you for you continued support.  The name may have to change again, but the app will keep getting better.  🙂

In the beginning…

 

Crazy Driver Tile

Crazy Driver Tile

So I wanted to just get this app OUT there. Out to the Marketplace. Yeah, yeah. I started a sentence with SO. SO SUE me. Oh wait. No. DON’T do that. I really wanted that voice-to-text API in place before I published, but I knew that there would be some pain in submitting my application. And there WAS.

I got the main page laid out. I needed a settings page. And an “About” page.

http://msdn.microsoft.com/en-us/library/hh184843(v=VS.92).aspx

In order to pass certification you need a way for people to contact you. That typically goes on the About page. I was going to use a pre-made About page DLL, but it didn’t really have the exact layout that I wanted so I created my own panoramic page and put everything in there.

I figured that I NEEDED a disclaimer page. I’ve already said it (in my previous post), texting while driving is STUPID. DON’T BE STUPID! That took some doing. Not the layout, but I needed to remove that page from the history so when you’re on the main page and you hit the back button you don’t go back to the disclaimer. THAT would be stupid too. So in the main page I added this to the Loaded event. I tried a TON of other stuff, but this is what worked the best.

// Remove the disclaimer page.
try
{
 if (((App)Application.Current).RootFrame.CanGoBack)
 {
  ((App)Application.Current).RootFrame.RemoveBackEntry();
  }
}
catch (Exception)
{
 // Eat this.
}

Finding the Twitter code was painful as well. I headed down the wrong path because I didn’t realize that Twitter CHANGED their API a while back. Uh Oh. That’s a BIG NO NO Twitter. But they’re so big that they just did it and HOPEFULLY it won’t change again. So I got all the old code laid in place and NOTHING worked, so I googled with bing some more. I finally found some REST code that worked. I didn’t KNOW it was going to work, but I thought I’d give it a shot. It uses the Hammock.WindowsPhone DLL and some other C# code.

Things STILL weren’t working, but I noticed that in the TwitterSettings.cs file I needed to setup some keys and you HAVE to head to https://dev.twitter.com/, create and register your application, and THEN you can get some keys. Paste those keys into your settings and you’re good to go.

I wanted to TRY to make some money with this thing so I thought I’d put Microsoft’s Advertising control on the bottom. But you need KEYS for THAT to work too.

https://pubcenter.microsoft.com/

I tested the final release state on my phone. I had been doing this all along, but deploying the debug version. So now I ran a few smoke tests against my app just to make sure the Twitter registration was working. The disclaimer would display and then not get in your way when you wanted to exit the application. I added a few new default tweets and then deleted them. You probably saw those test tweets. Ok. Probably not. 😉

I was READY to submit my application! WOOO! Of course you can only submit your application if you’re a registered developer (but you already knew that, right?) That’s 100 bucks a year, but I got my registration for free through the “30 Days to Launch” campaign.

The first page of submission you’ve got to have ALL these other icon sizes. WHAT? Oh geez. So I brought up Pixlr and sized up the icons. They looked like crap, but I figured I’d change them later. You’ve got to answer a few questions about pricing and distribution. I selected FREE and worldwide. A few more questions and I was ready to submit.

It took a few days after submission to get a certification failure notification, because a few of the Asian countries would find my app offensive. Hmmm. Was it my disclaimer page? DON’T BE AN IDIOT! Or one of my system default tweets that has the word “damn” in it? So I removed quite a few countries. Submitted again. And the thing passed a few days later.

AWESOME!! My FIRST Windows Phone app. WOOO!!

Version 1.0 was out the door at the end of March. And I was already working on version 1.5. I figured I’d call it 1.5 because only half of the app would be “metroized”. The settings page got the metro look and a few other annoying things were taken out. The disclaimer only shows up every 10 times. The default tweet “Select default tweet…” which was actually just the first row of the default tweets was ALWAYS in the editable tweet section. So THAT got removed. As part of the “metroization” I created a modal text field which has bigger text and auto selects the entire field when it pops up. This way you can just start typing if you want to replace the default hash tags. I cleaned up some of the icons and made the horn bigger and the twitter bird smaller. Does that bird have a name? Hmmm. Since I could only find REALLY low resolution pictures of the car horn icon I created my own using Paths in Blend. So now I can scale that horn up and down at will. I’m still keeping that dashboard themed icon when pinned. I think it makes sense using that main dashboard metaphor anyway.

The submission of 1.5 was a hell of a lot easier. I knew it would be, because when I resubmitted 1.0 all I had to do was make changes to the submission and everything else stayed the same. For 1.5 I dropped in the new screen shots and icons. Loaded the new XAP file. Clicked NEXT on quite a few screens and the thing submitted and then passed certification a few days later. WOO!

Version 2.0? This still won’t have the voice-to-text in it, but the main page will be “metroized” and the default state will be using the geo-location services from Bing! Yes, you have to get yet ANOTHER application key.

So PLEASE stick with me and you’ll see the little engine that could grow into a full-fledged application.

THANKS!!

Crazy Driver – Don’t be an IDIOT!

Don't be an IDIOT!

Crazy Driver Disclaimer

I thought I’d post the disclaimer a bit bigger than what’s in the Windows Phone Marketplace.  Plus, many people have asked me if I had a disclaimer. Yes.  Yes I do. I certainly don’t want to get sued because people are idiots.  If you haven’t had a close call trying to “quickly” reply to a text then you WILL.  It’s just like riding a road bike (or mountain bike).  There are those who HAVE wrecked and those who WILL.  And you MIGHT just want to be wearing that helmet because you never know when you WILL.  So my close call was with a curb.  I was going pretty slow and missed it due to my video game reflexes.  BUT!  You never know when there will be a kid right there on his skateboard or running to get a ball.  So it’s good NOT to do it.I’m excited for the voice to text to be available on the phone.  Hopefully it’s SOON!  Hello?  Microsoft?

That’s why I typically launch the SMS text application FIRST and try to say everything to a new text message.  It doesn’t have to be TO anybody, just so you’re able to “talk” to your phone.  Then cut and paste the snippet(s) into Crazy Driver and let that person HAVE IT!

Of course you don’t even have to be driving.  You could be the passenger while your mom or dad is driving.  I see that quite a bit under the #CrazyDriver hashtag.  Or you could be walking to your car in the parking lot and one of your co-workers tries to run you over.  That’s a good time to let them have it too.  Sorry Raj.

So go ahead and download the app, confirm that you’re NOT an idiot, and tweet to your heart’s content.

Crazy Driver 1.0

You know how it is.  You’ve got your to-go cup of coffee and you’re blaring KBPI on the radio.  Things are going smooth until you’re out of the neighborhood and down by the post office.  Then you see him behind you.  A big old pickup racing up behind you.  Apparently poor planning on HIS part BECOMES your problem.  He SLAMS on his brakes.  DUH!  We’re at a stoplight you dumbass.  The traffic slowly starts moving again right past the Walgreens.  Yeah, they’re EVERYwhere, aren’t they?  And just as you expect, the guy behind you cuts over and passes you in the right hand lane that just opened up.  But of course HE didn’t see the other guy pull out up ahead.  I’m expecting this.  You HAVE to expect this.  And he swerves into MY lane.  I glance at his license plate “DUMBASS”.  OK.  That’s NOT what it said, but it SHOULD have.  Or at least ID10T.  You raise your hands and yell some obscenities.  They’re GOLDEN.  But nobody heard you.  The guy in front of you is already flicking his cigarette out his window and has swerved back to the right.

That’s when it hit me.  I want to push a button on my phone and through the Blue Tooth integration in my stereo the radio mutes and a digitized voice comes across the speakers.  “This is Crazy Driver, what would you like to rant?”  I say “License plate D-U-M-B-A-S-S.  Ranting why the hell did you cut me off you idiot?!”  The app thinks for a second and then fills in the appropriate fields and parses out the tweet “Why the hell did you cut me off you idiot #CO_DUMBASS #CrazyDriver.”  I glance at my screen and the tweet is scaled up so I can read it on the tweet tile.  I’m good with that since I don’t feel like stopping at the next light to add the question mark and five exclamation points (remember the disclaimer?).  I hit the tile and it’s sent.  I feel better.  Not as good as activating a 0.50 caliber machine gun on my roll cage and blowing the guy off the road, but better.

So after signing up with Microsoft’s 30 Days To Launch event I got a free developer account and was able to publish Crazy Driver.  It didn’t take a whole lot to build, because I was able to find code on the net that did the tweeting.  But there was still some learning curve.  If I got my application to certification by a certain date then I could have won a new Windows Phone, but that didn’t happen.  I have a regular development job and I was working on Mass Effect 3 too.

Not bad for my first Crazy Driver blog post.  I’ll post what I’ve learned and where you can find the oAuth code since the first snippet of code that I found didn’t work and I had to Bing again.

Kinect Driven Projectors


Wouldn’t it be cool if there was a Kinect emitter on projectors?  No?  Ok.  So let me draw you a picture.  The Kinect emits a series of dots and the processor in the Kinect hardware can detect distances using those infrared dots.  So why couldn’t the projector that is toted around from conference room to conference room have a TRUE auto-adjust feature.  You’d push a button and the legs would move to adjust the screen size and height based on un-interrupted wall space.  The keystone could be measured along with any other rotation that would be needed.  At the push of a button everything would work in harmony to produce the BEST possible picture for the wall that you want to display on.

C’mon Microsoft, get with the program!  Where’s Johnny when you NEED him?

I LIKE this font.

THIS font I like. See how it reads like book? Now doesn't that feel like
you're reading a legitimate article?

So here's what I did. I ended up editing one of the old articles that converted
from the MSN Spaces. I switched to the HTML view and took the various styles in
the tag and pasted it into notepad. I compressed each span tag into one
and saved it into my blog.html template file. I closed out that file from
notepad and dropped it into the Visual Studio 2010 that I was running at the
time. C'mon. WHO uses notepad to edit HTML anymore? Really? Sure, in a
pinch. But there are MUCH nicer editors out there. I'm not saying that VS
2010 is the BEST, but it's what I'm used to.

Technically I'm using Word as my editor right NOW. But I'll paste
this into Studio and look at the HTML Word generates, which is a whole lotta
crap and stuff that Word Press doesn't care about and will just confuse it. I
tried that already for the previous article and it just wouldn't do it for me.
So I'll use Word for that red squiggly spell checking that I'm used to, that's
about it. THEN paste it into Notepad to strip out all of the bloated HTML
that Word puts in.  Copy THAT from Notepad and paste it into Studio
to check out the HTML and make sure that WP doesn't throw up all over it and
convert my post to something that looks like crap versus what I'm seeing now in
Word.

So if the planets align correctly then you'll be seeing this post in Times
New Roman and slightly grey. See? THERE! So now I can get on with
converting a few of my game reviews out of Outlook and post them here.