Geeks With Blogs
Path Notes of a Kodefu Master blog June 2009 Entries
Embrace the Dark Side
I’m trying to win the grand prize for June on Community Credit, and I get 5000 points for linking to there. Here’s what I’m trying to win! Embrace the Dark Side Embrace the dark side every day with this animated Darth Vader USB hub. His eyes light up red as he moves his head from side to side and performs his trademark heavy breathing. Push button activation or select random intervals throughout the day. Plug a peripheral in and Vader activates to the sound of a light saber Remember, if you’re writing ......

Posted On Tuesday, June 30, 2009 10:58 PM

One Public Type Per File
I remember when I started working on this particular project a few months ago. When I looked over the code for the first time, I noticed something funny about the cs files. Each cs file contained multiple public types. In the extreme cases, there were dozens of public classes in one file. I brought it up with my new teammates, and one person claimed that he liked to keep related classes in a single file. I mentioned that I find it more difficult to find what I’m looking for in the solution tree, ......

Posted On Tuesday, June 30, 2009 4:54 PM

Prevent Crawlers On Your Data Service
At ConvergeSC 2009, an attendee asked me to describe how to prevent crawlers from trolling your ADO.NET Data Service. I explained as best as I could, but I felt like a blog post might make it more clear. To a bot, your data service looks like any other site on the web. Sure, it’s reading either Atom, POX, JSON, or some other bizarre format you’ve concocted, but it’s still data coming down through http and discoverable via links. There are ways to prevent a bot from crawling, but information available ......

Posted On Monday, June 29, 2009 4:20 PM

Prevent Crawlers On Your Data Service
At ConvergeSC 2009, an attendee asked me to describe how to prevent crawlers from trolling your ADO.NET Data Service. I explained as best as I could, but I felt like a blog post might make it more clear. To a bot, your data service looks like any other site on the web. Sure, it’s reading either Atom, POX, JSON, or some other bizarre format you’ve concocted, but it’s still data coming down through http and discoverable via links. There are ways to prevent a bot from crawling, but information available ......

Posted On Monday, June 29, 2009 4:01 PM

The Lounge
I am honored to have joined the Lounge Advertising Network! Now, I know you’re thinking, “Why would someone be honored to join an ad network?” I would answer that with “look who else is in this network.” The Lounge picks only the top Microsoft technology blogs… blogs by influencers both online and off. To be counted among them is indeed a cool thing.Note: Cross posted from KodefuGuru. Permalink ......

Posted On Monday, June 29, 2009 3:08 PM

Tracking Items in Solution Explorer
Have you ever debugged a large project you didn’t create? If so, you’ve probably gotten lost in the vast jungle of code that was once some poor programmer’s paradise. This vast jungle is full of cannibalistic tribes and wild animals waiting to tear you to pieces. Your only hope for survival is your ability to navigate the solution tree, relying on your wits to circumvent the illogical paths of code that “Go To Definiton” has guided you down. Luckily, Visual Studio 2008 will provide you a guide if ......

Posted On Friday, June 26, 2009 2:28 PM

Ease The Pain of Office Interop
If you’re a C# developer who has tried to do Microsoft Office programming, you know how much of a pain it can be. Most of the methods require tons of parameters, and you end up needing to pass tons of Missing.Value argument around. If you haven’t done this before, it’s easy to get started writing Office programs. First, make sure you have Office installed. Second, add a reference in your project to the Office application you want to automate. Now, add the appropriate using clause (using Microsoft.Office.Interop.Ex... ......

Posted On Tuesday, June 23, 2009 12:40 PM

SQL Server 2008 Installation Fail
I was setting up a SQL Server instance on my co-located server, but a series of events led me to uninstall it and reinstall it a few times. The final time through, it detected the original reporting services database, so I cancelled the installation and deleted the SQL Server folders. At that point I spent the next hour or so trying to make SQL Server get past the setup bootstrap installation. The setup program told me everything was okay before it began the installation. The problem was, the installer ......

Posted On Sunday, June 21, 2009 2:52 AM

Refactor ForEach to AddRange
Here’s a refactoring I used to do some minor cleanup today. The programmer was iterating through a dictionary to add values to a list. No logic was contained within the iterator. public void AddCodes(Dictionary<int, string> indexedCodes) { foreach (var code in indexedCodes.Values) { Codes.Add(code); } } This can be simplified by using the list’s AddRange method. public void AddCodes(Dictionary<int, string> indexedCodes) { Codes.AddRange(indexedCodes... } If you’re reassigning, this ......

Posted On Friday, June 19, 2009 3:31 PM

SmallBasic 0.5
I happened to notice the SmallBasic 0.5 release announcement and decided to take a look at it. The question going through my mind was, “why do we need yet another Basic programming language?”Note: Cross posted from KodefuGuru.
Permalink

Posted On Wednesday, June 17, 2009 8:47 AM

Rebuilding TFSWarehouse
I was tasked today with fixing the reporting in Team Foundation Server. The Team System cube either does not exist or has not been processed.Note: Cross posted from KodefuGuru.
Permalink

Posted On Tuesday, June 16, 2009 5:36 PM

Enable CLR in SQL 2008
I added an assembly and created clr functions on my SQL server only to receive the following error when I tried to excute them. Msg 6263, Level 16, State 1, Line 1 Execution of user code in the .NET Framework is disabled. Enable &quot;clr enabled&quot; configuration option....Note: Cross posted from KodefuGuru. Permalink ......

Posted On Tuesday, June 16, 2009 11:59 AM

Kevin Jones at Tech Ed North America
I sometimes hang out with Kevin at Code Camps in the Virginia area, so I thought I would post this video of his perspective on Windows 7, Silverlight, and being an MVP.Note: Cross posted from KodefuGuru.
Permalink

Posted On Monday, June 15, 2009 6:24 PM

Four New Azure Videos
Four new “How Do I” videos on Azure have been added to MSDN. Check them out! Leverage Concurrency in Windows Azure Table Storage? Windows Azure table storage is designed to support many users at the same time. In this session, you’ll learn how Windows Azure table storage supports concurrency, and you’ll learn a few strategies to help you deal with any concurrency violations. Use Paging in Windows Azure Tables? To improve application usability, many applications need to support viewing data page-by-page. ......

Posted On Monday, June 15, 2009 11:32 AM

Don’t Instantiate Then Assign
Here’s an example of some bizarre code I’ve seen recently. I’ve changed the variable names, but this is what the developer was doing. Customer customer = new Customer(); customer = customers[response.Customer... The first line is completely unnecessary. If you instantiate an object, then assign the object to another instance, the first instance sticks around and eventually gets collected. However, there’s no reference to it. You can never use that instance. Here’s how it should look. Customer customer ......

Posted On Monday, June 15, 2009 9:10 AM

ref on Reference Type?!
I recently came across a piece of code that had almost every parameter for every method marked with the ref keyword. This keyword is primarily used to pass a value type by reference, but this one even had reference types marked with the keyword. This made me wonder, why exactly would you ever want to pass a reference type as a ref parameter? Read More ......

Posted On Friday, June 12, 2009 4:30 PM

Refactor to Array Initializer
Taking advantage of language features can make sleeker, easier to maintain code. One of these language features are array initializers. Have you ever created an array, then assigned each element in the array? This incurs many lines of code with no tangible benefit. Check out this code from the NameMangler class in LINQ to XSD. Read More ......

Posted On Wednesday, June 10, 2009 12:39 PM

Structs Structs Structs

It appears that my blog post on Friday wasn't saved. This is kind of bizarre. You can catch back up on it at my website.

Stop Using Structs Everywhere

And I posted a follow-up today:

More On Structs

Posted On Monday, June 8, 2009 1:31 PM

DynamicAttribute
We've all been told to think of a dynamic object as a regular object but with dynamic behavior. Kevin Hazzard peeked behind the curtain to show that the compiler is actually doing a lot with that keyword; it isn't just an object. It does change the type to an object, but then it builds CallSites everywhere that object is referenced. These CallSites handle the calls to the dynamic language runtime. That's great, but we have an object. How does a consumer of your class library know that a property ......

Posted On Thursday, June 4, 2009 5:18 PM

PDF From Web in AxAcroPDF
If you've ever needed to host a PDF in a windows form application, the easiest way to do so is by using the ActiveX control provided by Adobe Acrobat. Accessing it is easy: Right click the toolbox, select Choose Items, select COM Components, then check Adobe PDF Reader. The Adobe PDF Reader control now shows up in your toolbox under the General tab. You can move this to a different tab by dragging and dropping. If you drag this to your Windows Form, it now acts like a regular control. Its default ......

Posted On Wednesday, June 3, 2009 5:52 PM

Edit Object in Properties Pane
When creating a designer for Visual Studio, you may want to allow editing in the properties pane. This took me a while to figure out how to do, because the terminology wasn't quite what I expected it to be. Here's how I accomplished this task. The window pane that hosts the designer implements IVsWindowPane. This interface contains a method called SetSite, which will provide a pointer to an object that implements IServiceProvider. I instantiate a ServiceProvider and assign this to a ServiceProvider ......

Posted On Monday, June 1, 2009 7:05 PM

Copyright © Chris Eargle | Powered by: GeeksWithBlogs.net