October 05, 2008

Real world bad UI

In the last few weeks, I happened to notice some confusing signage in places I'm at on a regular basis and thought it might make for an amusing blog post. Just like bad UI in a software application, these bits of signage/labels made me stop for a second and scratch my head:


I have a spot on the top floor of a parking garage in downtown Columbus, and all ramps are one-way. Here's the sign showing my way out. I guess they thought an arrow pointing the way out wouldn't give me enough information, so this not-arrow gives me the much more informative message that this is the way to not go for people going the direction I'm not.

Sometimes after a long day, I still have to pause for a millisecond when I see this sign. And this sign is not meant for the other guy, as he would have to have already come up the ramp to see that he shouldn't have.

Here are the elevator buttons I was using daily at the office:

Naturally, to go down, you can see that I pushed the top button.

In their defense, we are on the top floor, so the only way is down. So it looks like they just tried to reuse the same button panel as was on the other floors, only they decided to only mark the exceptional up button as down without marking the down button appropriately. Hope noone forgets they're on the top floor.

Share |

August 13, 2008

WCF Debugging in Visual Studio 2008

Debugging WCF Services is a lot easier in Visual Studio 2008. There is a WCF Service Host built-in to privately host WCF Services, as well as a built-in client that can be used as a test harness, and to view XML Requests and Responses. Here’s a quick walk-through on how to set up a quick sample WCF service, execute it using the client utility, and to create a simple console app that calls the service that will allow you to debug both client and server code without going through hosting the service in IIS, attaching to process, etc…
First, create a new WCF Service Project (File…New…Project -> Expand C#..WCF -> Select WCF Service Library)




The newly created project has a sample method GetData(int) that simply takes in an int, and returns a string. That’s the method we’ll be using. Now right-click the App.config file and select Edit WCF Configuration. This brings up a GUI view of the XML config file. Click the first “(Empty Name)” link that uses the binding wsHttpBinding.




This allows you to edit the Service Endpoint. Give it a name.




Save the configuration, now hit f5 to run the app. The WCF Test Client will launch. Double-click the GetData() method.




This brings up a test harness that will allow you to test the method. Enter a value for the Request Value and click Invoke. In a few seconds, the Response Value should display “You entered: [number]”.




OK, Now we’re ready to create a console client application that will call our service, and allow us to debug through client and server code. Add a new Console Application to the solution.




Right-click the newly created console app and select “Add Service Reference”. This brings up a dialog box that allows you to add a service reference. Click the down arrow next to the Discover button and select “Services in Solution”. Select your service in the dropdown and click Go, when it appears under Services, click OK.




Now go into the Main method of Program.cs in your console app. Add the following call to the referenced service:

ServiceReference1.Service1Client sc = new Service1Client();
Console.WriteLine(sc.GetData(11));

And set a breakpoint at Console.WriteLine.




Now you’re ready to start debugging. First run the service (F5), then start a new debugging instance of the console app. The debugger should now be stopped at your breakpoint in the console app. Step into the code (F11) and you will step through the GetData method in your service code.

When you finish stepping through your code, the console should display the return value.



A full Silverlight presentation of WCF Debugging is also available here.

Share |

August 11, 2008

Excel Extend series - all rows

I recently had to deal with very large (300K+ rows) Excel spreadsheets. I needed to add an additional column based on calculations of other existing columns. I was familiar with the extend series functionality of Excel for extrapolating a function over multiple rows, but what a pain to drag for 300,000 rows. There has to be an easier way to apply a function to all rows. So I Googled and found a nice easy way to Extend Series to all rows, just double-click the square in the bottom right corner of the column with the function applied and presto, the calculation is applied to all rows in the spreadsheet:

Create the function in row 1


You can extend the function to subsequent rows by dragging the square in the bottom right corner of the selected cell...



...or just double-click the black square, and the function is extended all the way to the last cell ie; the 17th row function is =a17*b17.



Special thanks to Phil for his help.

Share |

May 07, 2008

ReSharper 4.0 Initial thoughts

I just installed ReSharper 4.0 for the first time, & got a quick overview of a few of the features. After using it for about a week, here are my initial thoughts, and some of the features I find myself using a lot:

The configurable silent code clean up feature works really well and is a big time saver. The warnings and alerts are good for making simple errors/redundancies/unused elements jump out.

The find file and find type (ctrl+t, ctrl+shift+t) make it easier to navigate and open files, especially in a very large sln with many projects.

Extracting interfaces from existing classes is an improvement over VS - it actually makes the interface public and implements it in the class.

Finding alt+enter to add references/using directives to be a big time saver.

Share |

April 16, 2008

Contest Results

Here's a shot of the spreadsheet with the weights removed. Congratulations Slimtastics, especially Arnulfo and Steve.

Share |

February 13, 2008

Wii remote sensor problem & tech support Fonzie fix

We recently had one of our Wii remotes go bad - the problem first appeared while playing Wii bowling. The second remote worked fine until it came to releasing the ball - it never did, it now just always threw the ball backward no matter what. After checking all the usual suspects, batteries, sensor bar flush w/TV, etc... I called into Wii tech support (1-800-255-3700). The call dropped twice, but finally, the tech support person told me to:

a) Hold the Wii remote upside-down with one hand so all the buttons are facing the floor.

b) Smack the end of the remote with the power button from underneath with the other hand.

Now it works fine.

Share |

February 06, 2008

Adding a unique digg button per post using Blogger

Adding a digg button to your blog on blogspot is easy, and users can digg the blog, or even digg an individual post, provided they were drilled into a specific post. But what if you want your readers to digg any specific post from your main page? If you have a following, that's probably where they'll read it from, and a digg button on your main page will only take them to digging the blog in general. Basically, you'll want to have a button inside each posting with a digg_url that is specific to that post.

Here's a way I found to get it to work:

Go to your blog's admin page and select the Template tab
Select Edit HTML
Make sure "Expand Widget Templates" is checked
Look for the <div class="post-footer"> div tag
Inside that tag, add your digg button code
For the digg_url value us e <data:post.url/>(This template variable holds the actual url of each individual post)
Note: The code window will encode the quotes.

Here's some sample button code and more digg integration info if you need it.

...Of course if you use it, you have to digg me :)

<!-- digg button with post-specific url added - Dan Shultz -->
<script type='text/javascript'>digg_url = '<data:post.url/>'; digg_title = '<data:post.title/>'; digg_bodytext = ''; digg_skin = 'compact'; digg_window = 'new'; digg_media = 'image'; digg_topic = 'comics_animation';
</script>
<script src='http://digg.com/tools/diggthis.js' type='text/javascript'/>
<!-- end digg button code -->

Share |

February 01, 2008

XMLSerialization & null/empty elements

I recently ran into an issue where an application was serializing a .NET object and returning the XML, but not returning elements where the properties were null. The consuming client expected every element in the schema to be returned, so we needed to come up with the best way to generate XML containing all elements & nodes regardless of whether they contained data.

The first solution was to simply decorate the property with

[XmlElement(IsNullable=true)]

which makes sure the element is always generated. The resulting xml element contains the attribute xsi:nil="true" when it is null. That works just fine, but an even simpler solution is just to initialize the private variable behind the property to string.empty. That ensures that the property was always at least an empty string, rather than null. To the XmlSerializer, empty string means generate element. But if you require that the resulting XML has to include all properties, even true nulls, then decorating potentially null properties with the XmlElement IsNullable Attribute is the way to go.

Share |

January 17, 2008

BMI Calculator

BMI Calculator


- Height
- Weight
- BMI



Share |

January 10, 2008

.NET Tips and Tricks Open Spaces

The late session Thursday, I tried out Open Spaces for the first time - Sara Ford, who does the Visual Studio tip of the day ran a session on Visual Studio tips and tricks. She has a vast collection of tips, obscure keycodes and showed some of the coolest/most popular ones. They're all on her blog, but here are some of the ones I was unaware of and will incorporate into my daily routine:

Enabling Guidelines - registry edit that allows you to drag guidlines into the vs text editor

Under Tools.. Options.. Text Editor.. All languages.. General uncheck "Apply copy and cut if no blank lines" checkbox
This DOESN'T overwrite what's on your clipboard if you accidentally cut or copy twice by accident before you paste, and your cursor happens to not have anything selected. I do this all the time and I thought it was just me.

Ctrl+w = select current word

Right click find window to make it dockable.

Right click on file tab.. open containing folder opens win explorer to current file's folder.
Right click on file tab.. close all but this closes all other windows.
Right click on file tab.. full path gets the full file system path to that file.

ctrl-tab allows you to tab to all open files and windows windows w arrow key.

ctrl-alt-downarrow pops arrow on tab window to show additional unshown files.

Options.. startup, can specify new start page

ctrl-f2 goes to navigation dropdown + tab goes to 2nd drop down showing methods.

Any file menu + ctrl tab goes to first item in the standard toolbar

Customize toolbar window looks modal but is not.

LEFT Shift alt tabs to the first button in a toolwindow's toolbar (like schemas, solution windows)

alt-minus (with floating window active) and you can move it around with the up-down keys. I'm not sure how much I'll use it, but it gave me a chuckle.

Anyway, these are all available on her blog, but it was nice to have a session and get the cream of the crop. She also has a tip of the day gadget for Vista.

This was the only Open Spaces session I got to, but it's a cool addition to the conference sessions.

Share |

CodeMash FaceBook development session notes

Uses FBML, FBJS

Create FaceBook Developer acct
Developer mode

Submit application to attract users
Built in App statistics
Can host on your own server

REST API
Api_key, v, Format, Method, UIDs, Fields, Call_id, sig
Session_key (gotten by you from user)

Get session key by:
User can either log in to your app
Or user installs your app

Can use FQL (subset of t-sql, no joins) to access user data.

Viral Distribution
Notifications

FBML: No <EMBED> <fb:profile-pic> + uid displays user profile pic, <fb:multi-friend-input> renders auto-complete friends text box (used commonly)

client langs PHP, Java unofficial:Actionscript, Ruby

Share |

January 07, 2008

CodeMash 2008

Looking forward to another 3 days of information overload at CodeMash 2008.
My current itinerary
Last year's sessions were all great (non-marketing) information, and according to this year's synopses, it looks to be even better. This less-than-frequently-updated blog should have a plethora of fresh blogging material. Can't wait!

Share |