January 14, 2010
@ 03:38 PM
Today at work we ran into an issue where we needed to convert nullable DateTime values to UTC time values. Of course this can't be done if there isn't a value present. Most programmers first thought is to wrap this in an "if" statement. There is a much easier way. Here is a code example:

   DateTime? testDate = DateTime.Now;

 

   DateTime? newDate = testDate.HasValue ? TimeZoneInfo.ConvertTimeToUtc(testDate.Value) : testDate;


With this code, if there is a local time value, it will be converted with no Exceptions being thrown.




 
Categories: Csharp

January 14, 2010
@ 01:46 PM
You might want to think again or send this article to your CIO:

http://ayende.com/Blog/archive/2010/01/14/my-java-experience.aspx



 
Categories: Development | Link

January 11, 2010
@ 06:39 PM
I hope everyone in southern California is planning to attend this years first SoCal Code Camp in Fullerton on 1/30 - 1/31. It's always a great time and lots of free training! 

I will be presenting the following sessions and I hope you will attend. Also, check out my new .NET discussion site called DotNet Army!

For those of you who can't make it to the conference, I will be recording all of my sessions and posting them here.

Code Camp T-Shirt

Back-2-Basics: Exception & Event Instrumentation in .NET

This session will instruct any level of programmer on how to easily use tracing that is built into .NET to log and analyze Exceptions and events that occur during application runtime. This is invaluable to fix bugs that only happen while the application is running. .NET TraceListeners will be discussed in detail along with how to write your own custom TraceListeners. I will also discuss and provide code for my centralized exception/ event logging system that allows applications at customer sites or on multiple servers to log to central database. Developers or technical support personal can then view these entries via an ASP.NET web site. Note: You must be present to receive code for this presentation. Free USB thumb drive for everyone!

Slides: Back-2-Basics - Exception & Event Instrumentation in dotNET.pdf (956.92 KB)

Back-2-Basics: .NET Coding Standards For The Real World

This session will guide any level of programmer to greater productivity by providing the information needed to write consistent, maintainable code. Learn about project setup, assembly layout, code style, defensive programming and much, much more. We will even go over some real in production code and see what the programmer did wrong in "What's Wrong With this Code?". Code tips are included to help you write better, error free applications. Lots of code examples in C# and VB.NET.

Slides: Back-2-Basics - dotNET Coding Standards For The Real World.pdf (1.21 MB)

Please rate my talks by going to: http://speakerrate.com/dotnetdave

Pictures and Video

SoCal CodeCamp Fullerton - 2009


 
Categories: .NET | Code Camp | dotNetDave | Back-2-Basics

December 28, 2009
@ 12:19 PM
If you live in the San Diego area, dotNetDave (a.k.a. David McCarter) will be teaching a 6 week Fundamentals of the .NET Framework course at the University of California, San Diego Extension beginning on Wednesday 1/6/2010 from 5:30pm to 10:00pm. For more information and to enroll, please click here.


 
Categories: .NET | dotNetDave

December 13, 2009
@ 11:41 AM

If you are interested in added Bing.com maps into your web sites, check out the SDK's below:

Bing Maps AJAX Control SDK 6.2

This software development kit (SDK) provides programming reference and how-to topics for getting started with the Bing Maps AJAX Control.

Bing Maps Web Services SDK 1.0

This software development kit (SDK) provides programming reference and how-to topics for getting started with the Bing Maps Web Services

Bing Maps Silverlight Control SDK

This software development kit (SDK) provides the binaries and programming reference for the Bing Maps Silverlight Control.


 
Categories: AJAX | ASP.NET | Link | Web Services

December 13, 2009
@ 11:37 AM

If you are interested in learning how to use Visual Studio Tools for Office in Visual Studio 2010, check out this series of training videos on the Channel 9 web site: http://channel9.msdn.com/learn/courses/office2010/


 
Categories: Link | VSTO | Training

November 20, 2009
@ 02:29 PM

By default IIS is not installed on Win7 (if you are developing ASP.NET applications. You will need to go into the Control Panel, then go to "Turn Windows features on or off" then select "Internet Information Services" then Ok.

I then ran my web app that included a WCF service and the service didn't work. I went into IIS manager and no where was .svc mapped. I also could not find a way anywhere in the configuration setup to turn this on (as in previous versions). I then found out I needed to go back into the Windows features and add this capability as seen below:

I hope this saves you some trouble.


 
Categories: IIS | WCF | Win7

November 17, 2009
@ 11:02 AM

The November update of the Windows Azure Platform Training Kit has been released. The Azure Services Training Kit includes a comprehensive set of technical content including hands-on labs, presentations, and demos that are designed to help you learn how to use the Windows Azure platform including: Windows Azure, SQL Azure and .NET Services. The November release includes new and updated labs in addition to information about Microsoft Codename “Dallas”.

To download go to: http://bit.ly/AzureTrainingKit


 
Categories: Azure | Link | News

November 13, 2009
@ 11:49 AM
I hope everyone in southern California is planning to attend this years SoCal Code Camp in San Diego on 11/21 - 11/22. It's always a great time and lots of free training!

I will be presenting the following sessions and I hope you will attend. Also, check out my new .NET discussion site called DotNet Army!

Building nTier Applications with Entity Framework Services

Learn how to build real world nTier applications with the new Entity Framework and related services introduced in .NET 3.5 SP1. With this new technology built into .NET, you can easily wrap an object model around your database and have all the data access automatically generated or use your own stored procedures and views. Then learn how to easily and securely expose your object model using WCF with just a few line of code using ADO.NET Data Services. The session will demonstrate how to create and consume these new technologies from the ground up. Lots of code!

Slides: Building nTier Applications with Entity Framework Services.pdf (2.88 MB)
Demo Code: EntityFramework.zip (859.84 KB)


dotNetDave's Favorite Programming Tools

This session will focus on my favorite Visual Studio add-ins and other tools that makes programming faster and easier. I will focus on tools that are either free or very affordable. Tool categories include Writing Better Code (easier, faster and correct the first time!), Code Helpers, Documentation (helper and creation), General Utilities and more. These tools are designed to impress your boss and get you home at a reasonable time. Packed full of demonstrations and very few PowerPoint slides! Licenses for some of the 3rd party products I will be demonstrating will be given away (over $1,100 worth), so be sure to attend and bring a business card!

Slides: dotNetDave's Favorite Programming Tools.pdf (1.82 MB)

Building Rich & Interactive Web Applications with ASP.NET AJAX

Learn how to build rich web application interfaces using ASP.NET AJAX and the ASP.NET AJAX Control Toolkit. This new technology makes programming JavaScript into your ASP.NET pages easy, increasing the power and functionality of your applications, reducing round trips to the server, and making it easy to consume web services for dynamic content. In this session you will be introduced to the new client and server controls for ASP.NET and Java Script to learn how to build a rich Web 2.0 experience for your users.

Slides: Building Rich & Interactive Web Applications with ASP.NET AJAX - 2009.pdf (2.36 MB)
Demo Code: AdventureWorksAjax.zip (803.65 KB)

Why You Need .NET Coding Standards (2009)

This session will guide any level of programmer to greater productivity by providing the information needed to write consistent, maintainable code. Learn about project setup, assembly layout, code style, defensive programming and much, much more. We will even go over some real in production code and see what the programmer did wrong in "What's Wrong With this Code?". Code tips are included to help you write better, error free applications. Lots of code examples in C# and VB.NET.

Slides: Why You Need .NET Coding Standards-2009.pdf (3.8 MB)
Demo Code: CodingStandards.zip (245.54 KB)


Pictures and Video

SoCal CodeCamp Fullerton - 2009

Pictures & Video from This Years Code Camp:

Pictures from past SoCal Code Camps:

Video from past Code Camps:


 
Categories: ADO.NET | AJAX | ASP.NET | Code Camp | Csharp | Defensive Programming | Development | dotNetDave | Entity Framework | Generics | LINQ | VB.NET | VS.NET | WCF

Please join me at the ASP.NET SIG of the San Diego .NET User Group December meeting to check out my session titled Why You Need .NET Coding Standards (2009). This session will guide any level of programmer to greater productivity by providing the information needed to write consistent, maintainable code. Learn about project setup, assembly layout, code style, defensive programming and much, much more. We will even go over some real in production code and see what the programmer did wrong in "What's Wrong With this Code?". Code tips are included to help you write better, error free applications. Lots of code examples in C# and VB.NET.

Food arrives at 6pm, Q&A and announcements start at 6:30 and my session starts at 7.

Hope to see you there!

Slides: Why You Need .NET Coding Standards-2009.pdf (3.8 MB)
Demo Code: CodingStandards.zip (245.54 KB)


 
Categories: .NET | Csharp | Defensive Programming | dotNetDave | VB.NET

The Windows® API Code Pack for Microsoft® .NET Framework provides a source code library that can be used to access some new Windows 7 features (and some existing features of older versions of Windows operating system) from managed code. These Windows features are not available to developers today in the .NET Framework.

Click here to download.


 
Categories: Link | Windows

Microsoft has announced with the release of Beta 2 of Visual Studio 2010 that the target release date is March 22, 2010. For the press release go to: http://www.microsoft.com/presspass/press/2009/oct09/10-19vsfinalstretchpr.mspx



 
Categories: .NET | Link | News | VS.NET

The Visual Studio 2010 and .NET Framework 4 Beta 2 you can download it by going to the link below:

http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx


 
Categories: .NET | News | VS.NET

Since many applications (like Smart Clients) use the internet to send/ retrieve data, it's a good thing to check to make sure the user has access to the internet before making your call. This will prevent connection exceptions. The code below first checks to make sure the user even has a network connection, then tries to ping up to three web sites to see if the ping is successful (of course you can change the sites to your linking or add more). The good thing that this code does that most other code I saw when researching this, is that it does not rely on an exception to determine that an internet connection is not available. Therefor it's much faster!

C#

public bool GetIsInternetConnectionAvailable()

{

   var success = false;

 

   if (NetworkInterface.GetIsNetworkAvailable() == false)

   {

      return success;

   }

 

   string[] sitesList = { "www.google.com", "www.microsoft.com", "www.mycompany.com" };

 

   try

   {

      using (var ping = new Ping())

      {

         foreach (var url in sitesList)

         {

            var reply = ping.Send(url, 300);

 

            if (reply.Status == IPStatus.Success)

            {

               success = true;

               break;

            }

         }

      }

   }

   catch (Exception ex)

   {

      Trace.WriteLine(ex.Message);

   }

 

   return success;

}


VB.NET

Public Function GetIsInternetConnectionAvailable() As Boolean

   Dim success = False

 

   If My.Computer.Network.IsAvailable = False Then

      Return success

   End If

 

   Dim sitesList As String() = {"www.google.com", "www.microsoft.com", "www.mycompany.com"}

 

   Try

      For Each url In sitesList

         If My.Computer.Network.Ping(url, 300) Then

            success = True

            Exit For

         End If

      Next

   Catch ex As Exception

      Trace.WriteLine(ex.Message)

   End Try

 

   Return success

End Function


Tip By: David McCarter


 
Categories: Csharp | Network | VB.NET

September 30, 2009
@ 12:36 PM
Check out the new Windows Embedded preview! Now you can code embedded devices with VB.NET!

http://www.microsoft.com/windowsembedded/en-us/default.mspx



 
Categories: Link | News | Embedded

September 29, 2009
@ 02:37 PM
If you live in the San Diego area, dotNetDave (a.k.a. David McCarter) will be teaching a 6 week Fundamentals of the .NET Framework course at the University of California, San Diego Extension beginning on Wednesday 9/30/2009 from 5:30pm to 10:00pm. For more information and to enroll, please click here.


 
Categories: dotNetDave