Andy Edinborough

WARNING: Reading this blog may be hazardous to non-nerds ... and maybe them too

Reading Entity Framework Code First Objects from a Stored Procedure

Posted on November 1, 2010 in Code    Tagged entity framework code first c# t-sql Tweet This

I may be a nerd (that is, a geek who get’s paid), but I don’t enjoy writing stored procedures.  However, in working with the Entity Framework, I’ve found that doing complex and often repeated queries of my Entity Framework sets is rather inefficient.  My complete round-trip page loads (generate and execute query, then produce HTML) takes about 1,000ms on average.  So I wanted to replace this ugly query with a simple stored procedure—precompiled, ready to fire, and highly optimized for my specific query, while still having the ability to do ad-hoc queries.

So at PDC10 I made sure to talk to the EF boys and they pointed me to the System.Data.Objects.ObjectContext.Translate method.  This little bad boy will take a DataReader and create an enumerable of my objects from it—perfect.

Let’s walk through the “gotchas”.  In my example below, I have a class named Product.  I want to do… Read More →

Duck-Punching the jQuery UI Datepicker into a Date/Time Picker

Posted on June 23, 2010 in Code    Tagged datetimepicker datepicker jquery Tweet This

There are a TON of awful date pickers out there.  For a who’s who of the worst, check out Date Time Picker Competive Analysis.

jQuery UI’s Datepicker control is by far the best looking and most intuitive picker.  In light of maintaining a uniform UI, I wanted a date time picker that played on that control.  I found two:

  1. http://blog.w3visions.com/2009/04/date-time-picker-with-jquery-ui-datepicker/ – Integrates with Datepicker, but the UI is completely disjoined.
  2. http://engineeredweb.com/blog/10/4/jquery-date-and-time-pickers – The first one listed here is the one I had been using.  It integrated nicely with Datetpicker, but the author’s website is down now, and I found it was quite bulky and that it limited how you could use Datepicker—no inlining, no animation, etc.

So I created a duck-punched DateTimepicker that simply manipulates the Datepicker DOM element and functions to add the missing functionality:image

As you can see, I also added the ability to specify custom buttons… Read More →

Beautiful PNG Wait Indicator with Raphaël and jQuery

Posted on April 16, 2010 in Code    Tagged raphael jquery svg png Tweet This

UPDATE:  Please don’t read this post… It’s actually kind stupid.  :/  Now that IE supports 2D CSS tranforms, there are betters ways of handling this.

 

Can you believe that in 2010 we are still stuck  with using animated gif’s?  They support transparency, but not the alpha-channel.  So when you need to create a wait indicator that won’t have a specific background, you’re stuck with a pixelated look.

Recently, I wanted to create a beautiful wait-indicator to display while AJAX was loading.  I wanted to use PNG, but animated PNG’s don’t have wide support yet. Furthermore, PNG’s are fairly large, so an animated one would be orders of multitude larger.  I thought, “This is silly.  This is the image I want. ROTATE IT!”.  Seriously, what year is this?  1996?!

Enter Raphaël:

Raphaël is a small JavaScript library that should simplify your work with vector graphics on the web. If… Read More →

Custom .NET Remoting – Easier Than You Think

Posted on April 1, 2010 in Code    Tagged remoting c# Tweet This

The idea of implementing remoting will give most programmers instant heartburn.  Granted, I’m not an expert on all the existing remoting solutions, but I haven’t found one that works intuitively.

All the different solutions I’ve seen require just about double the code.  You write a method once, then write a wrapper for the method to implement remoting. 

Furthermore, they often require special handling to make sure the contextual variables are maintained.  For example, when I was working with CSLA recently, I was appalled to see:

customer = customer.Save();

The Save() method executes remotely, so the customer object that comes back has a separate memory reference.  Surely, we can get around this. 

So I set out to write my own.  I had 4 main goals.  I wanted to be able to:

// Remote any method with no code changes to the business object
Remoting.Execute(customer.Save);

// Executes remotely, and updates the object… Read More →

Getting Started with Yahoo and OAuth

Posted on January 29, 2010 in Code    Tagged c# oauth yql yahoo Tweet This

Yahoo doesn’t offer much help to .NET/C# developers when it comes to getting started with using their API’s and OAuth.  So I’ve put together a quick-hit starter pack.

  1. Yahoo! YQL Console
    This is fun for all ages!  I just get all giggly when I see all that Yahoo has made available through YQL (Yahoo Query Language).  You can use this tool to perfect your queries and figure out just what you want to accomplish.  As a supplement, you can check out the PDF Documentation as well as the online version.
  2. My Projects @ Yahoo Developer Network
    Once you’ve got your base application logic in place, you can request the keys you’ll need to communication with Yahoo using OAuth.  This will let you take advantage of the higher usage limit of 100,000 requests / day and 10,000 requests / hour.
  3. Simple C# OAuth Code
    Unfortunately, the C# OAuth libraries listed… Read More →

Microsoft Releases Bing without a "Search Provider"?

Posted on June 1, 2009 in Tech Watch    Tagged Bing Microsoft Open Search XML Search Tweet This

As my first post on my new blog, I'm pleased to say that Microsoft has finally released Bing, a "decision engine" that offers Google real competition.  But did they seriously just release a search-engine product with no Search Provider add-in for Internet Explorer?  Seriously?  This is a huge disappointment; I actually really like Bing.

Ironically, I was able to add Bing as my default search provider to Chrome, and Firefox very easily, but my only option for IE was to set it as my homepage.  I don't want to change my homepage.  I just want to set it as my default search provider...  I could write my own, but I've got to honest, I'm lazy and that sounds like a lot of work.

--- UPDATE ---
I received a tweet back from @bing saying that they're working on it.  I'm sure they want to do something fancy, but something that works… Read More →

© 2013 Andy Edinborough. All your rights are belong to me.