Useful Equation

Observe the following:

1) Comedy = Tragedy + Time
2) Code = Caffeine + Time

The two statements are demonstrated as true by a combination of Portal 2 and your average software shop.  Bonus points for being a software developer who’s played the game. But I digress.

Assuming equations 1 and 2 are correct, then it can be proven that having too much fun while consuming caffeine will result in bad code using the following:

3) Comedy + Caffeine = Code + Tragedy

In conclusion, do not code under the influence of video games and energy drinks.

Posted on March 12, 2012 at 7:34 pm by Steve Konves · Permalink · Leave a comment
In: Development

Back to the drawing board


do
{
ViewDrawingBoard(newIdeas);
}

Posted on March 5, 2012 at 9:54 am by Steve Konves · Permalink · Leave a comment
In: Uncategorized

An Even Better .NET Regular Expression Tester

For a long time, I have been a fan of Derek Slager’s “Better .NET Regular Expression Tester”. But as an avid user of Visual Studio, I have gotten used to using F5 to quickly debug code; however, when using Derek’s tester, F5 refreshes the page and I loose all my work. Thus, I have created an “even better” tester in Silverlight which evaluates the input text against the pattern in real-time as well as displaying error messages about malformed patterns. Check it out.

Install Microsoft Silverlight

This project is available on CodePlex at slregextester.codeplex.com.

Posted on January 28, 2012 at 9:28 am by Steve Konves · Permalink · Leave a comment
In: C#, Development, Regex Tester, Silverlight

New Project Idea: Internet Based Grammar

It you have ever spent any time online, you have probably spent some time browsing comments – forum comments, new article comments, other comments.  I will give every reader the benefit of the doubt that they have only ever posted useful, constructive, pertinent things in comment thread or have held their tongues.  However one thing you will notice is that every discussion will always digress to a comment about grammar, at which point what ever the objective validity of the subject being discussed, all previous comments are in error and thus completely null and void.  Could you imagine if people interacted like this in real life?

Cashier: “That comes to $45.63.  Please swipe your card and enter your PIN number”

Shopper: “YOU ABSOLUTE STUPID MORONN CANT YOU SEE THAT YOU, OBBVIOUSLY ARE A TOTAL MORON, AND ARE, IN FACT, A MORON!!!!!!!!!111ONE!!!! ITS NOT PIN NUMBER ITS JUST PIN YOU ARE SO STUPID!!!!!!!”

Cashier: “Why do you always yell at me in caps lock every time that you come through my line?  Every time you shop here you do it.  Do you need a key bored that is not broken?”

Shopper: “ITS NOT BORED ITS BOARD!!!1 BORED IS WHEN YOU DONT HAVE ANYTHING LEFT TO DO IN YOU’RE MOMS BASEMENT!!!!!!!!  YOU ARE SUCH A MORON!!!!”

Cashier: “Shoptard its not you’re its your.”

As sad as this type of interaction is, the amazing thing is that, for the most part, the rules of grammar being thrown back and forth are correct.  Every day thousands upon thousands of entries are added to the world’s largest grammar repository and, so far, are going unused.  Enter the new idea: Internet Based Grammar.

Overview:

Basically, the system would scrape websites for comment threads and identify potential misuses of grammar.  (btw that’s the easy part as they are so ubiquitous)  Then the service would identify later comments that discuss the former misuse.  The results would be distilled into a tentative rule and added to a database.  Common patterns in the database would could then be compiled as a thorough grammar rule book.

Feel free to comment on this post.

Posted on January 11, 2012 at 10:25 pm by Steve Konves · Permalink · Leave a comment
In: Projects

Namespace change issues with Silverlight RIA Services

Problem

Recently, at my job, we have implemented a naming convention across all .Net projects.  In the process of updating some old projects to the new naming convention, I ran across an issue that did not prevent the solution from building, but gave a pesky runtime error. InitializeError #2103 – Invalid or malformed application - Code# 2103 Invalid or malformed application: Check manifest.

Solution

The problem lie within the fact that the Silverlight project references the Services project in the Properties/Silverlight tab.  For whatever reason, using F2 (Refactor->rename) does not change this reference.  To resolve the issue, simply re-select the RIA Services project from the dropdown and you should be good to go.

Nerd Cred

(none available at this time)

Posted on January 5, 2012 at 11:02 am by Steve Konves · Permalink · Leave a comment
In: Development, Silverlight

Bots y u no leave me alone?

My blog has been live for over a month, I have more than four posts, and don’t apologize for not writing, but still the only comments have been from bots.  Am I really that boring?

Posted on December 13, 2011 at 9:09 pm by Steve Konves · Permalink · Leave a comment
In: Uncategorized

Bind to DataContext property from within a DataGrid

Problem

Consider the following DataGrid:

<sdk:DataGrid ItemsSource="{Binding LineItems}" >
    <sdk:DataGridCheckBoxColumn Binding="{Binding IsValueTrue }" />
</sdk:DataGrid>

The DataGridCheckBoxColumn assumes that the objects contained in the collection “LineItems” each have a boolean property named “IsValueTrue” which will be displayed in the column for each record.  However, if you want to bind to a property on the ViewModel, you would reference the “LayoutRoot” in the binding:

<sdk:DataGrid ItemsSource="{Binding LineItems}" >
    <sdk:DataGridCheckBoxColumn Binding="{Binding ElementName=LayoutRoot, Path=DataContext.IsViewModelValueTrue}" />
</sdk:DataGrid>

This works great for basic columns, but, for whatever reason, it does not work within a DataGridTemplateColumn.  Consider the following DataGrid:

<!-- NOTE: This is incorrect -->
<sdk:DataGrid ItemsSource="{Binding LineItems}" >
  <sdk:DataGridTemplateColumn>
    <sdk:DataGridTemplateColumn.CellTemplate>
      <DataTemplate>
        <CheckBox IsChecked="{Binding ElementName=LayoutRoot, Path=DataContext.IsViewModelValueTrue}" />
      </DataTemplate>
    </sdk:DataGridTemplateColumn.CellTemplate>
  </sdk:DataGridTemplateColumn>
</sdk:DataGrid>

The checkbox will display as unchecked regardless of the value of IsViewModelValueTrue.

Solution

In the interest of time, the solution provided by my man Sergey Barskiy and is located at: http://dotnetspeak.com/index.php/2010/05/elementname-binding-inside-silverlight-datagrid/.  Actually, I don’t know him from Adam, but his solution worked.  Sergey, if you ever read this, feel free to link to my blog. :)

Extra Nerd Cred (and ad)

Visit the link above via my own new url shortener: konv.es/TLpTy4.

Visit the link you’re on now with: konv.es/ocKxQ1.

Posted on November 28, 2011 at 2:23 pm by Steve Konves · Permalink · Leave a comment
In: C#, Silverlight

Media Center PC won’t sleep through the night

Problem

I had a issue with my Media Center PC waking up randomly in the middle of the night.  While that might be expected of a young child, I do not allow that from my computers.  It turns out that there is a scheduled task associated with Media Center that updates the TV guide.  By default that task is allowed to wake the computer from sleep.

Solution

  1. Open up Task Scheduler and navigate to the Media Center configuration: Start > All Programs > Accessories > System Tools > Task SchedulerTask Scheduler Library > Microsoft > Windows > Media Center
  2. Right-click on “mcupdate_scheduled” and select “Properties”.
  3. Select the Conditions tab.
  4. Uncheck “wake the computer to run this task”.
(People with kids: what is the comparable command for children?)

Extra Nerd Cred

To find out why your computer last woke (this is how I determined it was the Media Center scheduled task) run “powercfg -lastwake”

Posted on November 28, 2011 at 8:47 am by Steve Konves · Permalink · Leave a comment
In: 1337 h4x

konv.es is now live

When I found out that the domain name was available, I had to pick it up.  I put together a simple url shortener which is currently hosted at the domain. Right now, it only performs basic url shortening.  I the future, I plan on adding accounts and tracking.

One more thing …

It also is configurable to rick roll random click-throughs.  I thought that would be a nice touch.

Check it out: konv.es

Posted on November 23, 2011 at 11:13 pm by Steve Konves · Permalink · Leave a comment
In: ASP.Net MVC, konv.es

Godaddy subdomain url rewriting

Problem:

Adding a subdomain to a hosting account with Godaddy creates a folder within the hosting root.  By default, this folder is named the same as the subdomain, but it is editable.  The issue lies within the fact that if you reference the folder, without the subdomain, you get the same site.  Therefore, navigating to blog.stevekonves.com, stevekonves.com/blog, or blog.stevekonves.com/blog all yield the same result.  The blog.stevekonves.com/blog/… address is displayed when the user navigates from the subdomain’s homepage.   This can cause issues for an MVC application which is looking for specific “folders” for routing.

Solution:

Add the following section to the site’s web.config file.

<rewrite>
  <rules>
    <rule name="Remove Virtual Directory">
      <match url=".*" />
      <action type="Rewrite" url="{R:0}" />
    </rule>
  </rules>
</rewrite>

All this does is “rewrite” the URL with itself. This causes URL Rewrite to add the original URL (the one with no folder name) to a ServerVariable which is used by ASP.NET MVC to generate other URLs.

This hack shamelessly stolen from Godaddy’s support forums: http://community.godaddy.com/groups/web-hosting/forum/topic/asp-net-mvc-routing-issue/

Posted on November 23, 2011 at 8:09 am by Steve Konves · Permalink · Leave a comment
In: ASP.Net MVC, C#