7. September 2011 14:30
I’ve been using Entity Framework a lot lately and it makes data access really nice. It’s fairly simple to use and maps all your tables to a .NET object model. However, just like any other library, it can be misused and have it’s own issues. I’ve been figuring some things out as I’ve been using it, so I thought I’d share a few tip and tricks that I’ve learned. Here’s the first one: Use “GetObjectByKey” when Querying for a Single data entity Take the following query: var person = (from p in con... [More]
Now that it's 2010, and over a year since the first Community Coding Contest came to an end, I'm thinking about running the contest again in 2010.
Last time it ran for 3 months and we had 6 really great entries. This time around I'm thinking that it may be better to accept entries for 6 months, and have the voting run for a full month. This will give much more time for entries to be submitted, and for people to work on their entries before submitting and/or voting begins.
These are just some i... [More]
8. November 2009 08:04
While working on the Virtual Router project, I’ve come across a need to be able to retrieve the IP Address and Host Name of a given machine on the local network when only the machines MAC Address is known. This took a bit of research to figure out, and eventually I stumbled across the “arp.exe” utility within Windows.
“arp.exe” uses the Address Resolution Protocol to provide functionality to add, delete or display the IP address for MAC (Media Access Control) addres... [More]
6. November 2009 10:10
It’s not very often that I need to build a Windows Service for a specific task, and it’s even more rare that I need to create an Installer (.msi) to install/uninstall the service. Well, the project I’m currently working on (http://virtualrouter.codeplex.com) requires me to 1) Install a Windows Service using a Setup Project, and 2) Start the Windows Service immediately after installation.
Create Setup Project for Windows Service
Just create a Setup Project within your Solution i... [More]
I just finished installing Visual Studio 2010 Beta 2 within a Windows 7 Virtual Machine running within Windows VIrtual PC and the Final/Finish screen of the installation wizard contains a weird, blue, Mac-style Button. Ok, I know it’s not exactly how the button are in the UI of Max OSX, but it’s much closer to that than it is to Windows 7 buttons.
The button looks so incredibly out of place, and I wonder who decided that it should be used, especially since it doesn’t match the... [More]
A few months ago I posted some code that I originally wrote back in about 2004… Well, I was looking through some more of my prototypes that I’ve written and I came across the following example of how to use the IProgressDialog Win32 Interface to harness the power of the Built-in Progress Dialog in Windows within your own .NET applications.
I have test this on WIndows 7, but it should work as expected on Windows XP and Vista. The MSDN Documentation for IProgressDialog says it’... [More]
I’ve been questioning here and there as to what happened to Managed JScript on the Dynamic Language Runtime. The most recent preview release is really old, and it has since been taken out of any further preview releases of the DLR, where as IronRuby and IronPython continue on. No More Managed JScript on the DLR? For some time I never really got any good answers. Well, it’s really sad to hear that apparently Microsoft decided to drop it completely. According the this link, a member on the DLR ... [More]
One of the things the Live Framework has to offer is a Local Live Operating Environment you can connect to so that you can Offline Enable your Live Framework Enabled Desktop Applications. I found the process of getting it to work a little tricky (especially since I was running Win7 Beta; I'll explain down further) so I've decided to write up a summary of my experience to help anyone else interested.
This was written using the Live Framework CTP.
Connecting to the Live Operating Environment
I've been working on an application recently that needs to be able to communicate through a router/firewall using TCP. I've read/heard a bit of information about NAT Routers and UPnP; the technoligies used in almost every router sold commercially. So, I knew that you could use the Universal Plug and Play (UPnP) features of the NAT Router to automatically open up the firewall via Port Forwarding to allow other computers on the Internet to connect directly to the one your application is running on... [More]
I'm currently building a desktop application that needs to store a bunch of data on the users computer, so I've decided to use SQL Server Compact 3.5 for this. There's only one problem, Visual Studio 2008 doesn't support using LINQ to SQL with SQL Server Compact. However, the .NET Framework does and there's a work around to get it working in VS'08 that I'll describe below.
In case you aren't aware of what SQL Server Compact 3.5 is, here's the short description that Microsoft gives on their webs... [More]
The Windows API (Win32) has the FlashWindowEx method within the User32 library; this method allows you (the developer) to Flash a Window, signifying to the user that some major event occurred within the application that requires their attention. The most common use of this is to flash the window until the user returns focus to the application. However, you can also flash the window a specified number of times, or just keep flashing it until you decide when to stop.
The use of the FlashWindowEx m... [More]
I was looking over some of the old prototypes I've written in the past, and I can across a Simple Port Scanner that I originally wrote in VB.NET 2003. I originally wrote this back in 2004 (I think), and even posted a compiled version on my website that I have since removed/deleted. So, since it's just sitting on my hard drive collecting virtual dust, I thought I'd post it here in case anyone else can find it usefull.
This Port Scanner implements Multi-T... [More]
I installed SQL Server Compact 3.5 x86 and started testing it out when I got a nice "Unable to load DLL 'sqlceme35.dll" runtime exception. This seems like odd behaviour for a clean install. In a fairly quick search I found an article on the SQL Server Compact Team Blog that covers a couple possible causes/solutions for this exception.
My Solution - Target x86 Only
Even though there are 5 possi... [More]
If you do a search on implementing a Single Instance application in WPF you'll get quite a few results. From what I've seen there are really only 2 solutions. One is really simplistic and the other offers more functionality; both of which are fairly simple to implement.
Method 1: Checking Existing Processes By Name
This is the simplest to implement. All you do is check if there is more than 1 running process with the same name as the current process.
Here's the code:
public partial class App : A... [More]
I've been lucky enough to get 2 free MSDN subscriptions over the last few years, so I've never needed to purchase Visual Studio, Office or SQL Server. The first MSDN subscription I won in a blogging contest back in 2006, and the second I got when I won the Microsoft MVP award earlier this year (2008). Before you start to think that I'm braging; just let me point out that I am very greatful for this. Below is a list/guide that I would follow if I wasn't so fortunate, and I'm not talking about sof... [More]
I just stumbled upon a really nice looking Ribbon control built for Windows Forms, and it's Free, Open Source! This control isn't perfect, but it does work nice and looks great.
Go check it out: "A Professional Ribbon you will use" by Jose M Menendez Poó
Originally, I started out as a Visual Basic developer, and have since moved mostly to C#. However, when doing consulting work, I do need to cross back and forth quite often. Here are a couple VB.NET tips that you probably aren't aware of if you're mostly a C# developer. Some VB.NET developers may not even know about then either.
Null Coalescing is really simple in C#:
// If "someValue" is Null then set "i" to 0 (zero) // otherwise set it to the value of "someValue" in... [More]
This project looks awesome, now if only I had a WebCam so I could test it out and start playing with it. Anyway, the new Touchless SDK (and it's Open Source!) brings the ability to have Multi-Touch input within an application without the user needing to actually touch the screen, all with the use of a standard WebCam.
Update 9/16/2008: After too long, I finally tried uninstalling SP1 and reinstalling it and that fixed the issue. I'm glad it's fixed now! I haven't seen any other suggestions for fixing this, and I first tried repairing the installation, but only an uninstall and reinstall fixed it. Hope this helps solves anyone elses headache with this issue.
A few months ago (back in February actually) I blogged showing how to use the new DataContractJsonSerializer to serialize your .NET objects to JSON... [More]
Yesterday, Microsoft released the final RTM release of SQL Server 2008. Finally, the long anticipated release of SQL 2008 is here. Unfortunately, the Express edition of SQL 2008 isn't available yet (and according to the previous link, it wont be until the end of August), but if you have an MSDN Subscription you can download any of the other editions today.
I'm currently installing SQL 2008 Developer Edition, and before the installation could proceed, it needed to install an update to the .NET F... [More]
There are a few services out there that serve up screenshots of any webpage for you to display on your website. One popular one is Kwiboo; this is the one that DotNetKicks uses. For some time now I've wondered what the easiest way to do this in .NET was, and today I stumbled upon the undocumented WebBrowser.DrawToBitmap method that makes this extremely easy to do.
By the way, I stumbled upon the WebBrowser.DrawToBitmap while taking a look at the source code for the WebPreview tool over at SmallS... [More]
This is the first release of a small, new project I created. This is just the first release of the project, and I'll keep adding more functionality to it if there is enough interest by me or others in the project. So, please post any comments you have in the project discussion area.
dotNetExt - .NET Extension Method Library
dotNetExt is a small Extension Method Library for .NET 3.5 that extends the BCL Types with helper methods that make simple tasks simpler. So far there are extensions for the ... [More]
Extension Methods are one of the coolest features that have been added in .NET 3.5. I've heard arguments that there is no reason to use them, and the only reason Microsoft added them is to enable the ability to buid LINQ. Well, I do not entirely agree with that statement; in fact, I have found a cool way to use Extension Methods to enhance the System.Enum object since it cannot be inherited. Even though Enum can not be inherited, it can be extended using Extension Methods. [More]
One question that I get fairly oftern is "How do I plot Zip Code boundaries on a map?". Well, the answer isn't simple, well at least it hasn't been. So, I've decided to write a series of articles going through the steps needed to obtain Zip Code boundary data, makes sense of it and plot it on a map. I'm not sure how many parts this series will be, but it'll probably be at least 3.
Where do I get Zip Cod Boundary Data From?
There are a number of campanies that sell geocode data that includes Zip ... [More]
Microsoft just RTM'd Visual Studio 2008 and .NET 3.5 last November and launched them in February. And, their already releasing a Service Pack? What could they possibly have to all fix in a Service Pack this soon? Well, actually they aren't just fixing stuff; they are adding a huge amount of functionality too. ScottGu has a long post about what's all in it here. I'm thinking that .NET 3.5 needed to ship, so they took out everything that just wasn't quite all the way there and are including it in ... [More]