Microsoft has finally release pricing for the October 22nd release of Windows 7. Prices range from $119 to $319. From now until July 11th you can order Windows 7 for a 50% discount. See blog link below for more info.

Click here for more information.


 
Categories: Link | News | Windows

June 19, 2009
@ 10:14 PM
Deep Zoom Composer is a tool to allow the preparation of images for use with the Deep Zoom feature currently being previewed in Silverlight 2. The new Deep Zoom technology in Silverlight allows users to see images on the Web like they never have before. The smooth in-place zooming and panning that Deep Zoom allows is a true advancement and raises the bar on what image viewing should be. High resolution images need to be prepared for use with Deep Zoom and this tool allows the user to create Deep Zoom composition files that control the zooming experience and then export all the necessary files for deployment with Silverlight 2.

To download click here.


 
Categories: Link | News | Silverlight

Entity Framework samples have not been released in VB.NET! Check out the blog link below.

Full Blog Entry: http://blogs.msdn.com/vbteam/archive/2009/06/18/vb-entity-framework-samples-now-available-lisa-feigenbaum.aspx


 
Categories: Entity Framework | Link | VB.NET

I hope everyone in Arizona and southern California is planning to attend this years Desert Code Camp on 6/13 and SoCal Code Camp in San Diego on 6/27 - 6/28. It's always a great time and lots of free training! I will also be selling a limited number of my latest book "David McCarter's .NET Coding Standards" at my sessions for $12, cheaper than the web site (no tax and shipping), please bring exact change or check.

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, 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 from This Years Code Camp:

Pictures from past SoCal Code Camps:

Video from past Code Camps:


 
Categories: .NET | ADO.NET | AJAX | ASP.NET | C# | Code Camp | Defensive Programming | dotNetDave | Entity Framework | Generics | LINQ | VB.NET | VS.NET | WCF | Web Services

May 22, 2009
@ 02:36 PM
If you are a web developer, then Firebug for Firefox puts a wealth of web development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page. Check it out by going to:

http://getfirebug.com/


 
Categories: AJAX | ASP.NET | Link

May 21, 2009
@ 02:53 PM

As you might know I'm really picky when it comes to formatting code... heck, I event wrote a book on it! This even extends to T-SQL. I have worked at companies that had stored procedures that were formatted so poorly that I could not follow it at all. Thankfully I found a very cool web site called Instant SQL Formatter that does all the work for me... instantally! It will format T-SQL like this (generated by SQL Server Management Studio):

USE [Acme]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].EventLog_DeleteOld') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].EventLog_DeleteOld
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].EventLog_DeleteOld
AS
BEGIN
 DELETE FROM EventLog WHERE ([TimeStamp] < GETDATE() - 14)
END
GO

To this:

USE [Acme]

GO

IF EXISTS (SELECT *
           FROM   sys.objects
           WHERE  object_id = Object_id(N'[dbo].EventLog_DeleteOld')
                  AND TYPE IN (N'P',N'PC'))
  DROP PROCEDURE [dbo].eventlog_deleteold

GO

SET ansi_nulls  ON

GO

SET quoted_identifier  ON

GO

CREATE PROCEDURE [dbo].Eventlog_deleteold
AS
  BEGIN
    DELETE FROM eventlog
    WHERE       ([TimeStamp] < Getdate() - 14)
  END

GO

Very nice! There are lots of options (the T-SQL was formatted with just the defaults).

Tip Submitted By: David McCarter


 
Categories: ADO.NET | Link | SQL Server

If you are displaying text in a GridView control that contains line feeds, it won't display correctly. You would think that setting the HtmlEncode property in a BoundField would do the trick, but no! Nothing I did would work. Below is the only work around that I could find:

protected void EventLogMessagesGridView_RowDataBound(object sender, GridViewRowEventArgs e)

{

  e.Row.Cells[0].Text = e.Row.Cells[0].Text.Replace(System.Environment.NewLine, "<br/>");

 

}

If you have a better way, please let me know.

Tip Submitted By: David McCarter


 
Categories: ASP.NET | C#

Check out the new version of Visual Studio and .NET. Visual Studio 2010 and .NET Framework 4 focuses on the core pillars of developer experience, support for the latest platforms, targeted experiences for specific application types, and core architecture improvements.

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


 
Categories: Link | News | VS.NET

Lots of cool things were announced this week at TechEd 09. Below is a link to to them:

http://blogs.msdn.com/usisvde/archive/2009/05/15/roadmaps-for-major-products-announced-at-teched.aspx



 
Categories: .NET | News

May 12, 2009
@ 09:27 PM
Got to the conference center for the second day of TechEd a little after 9am and guess what... breakfast is over already! Come on... not all of us get up early enough to catch the first session or want to go. Breakfast stops at 8:30, way too early. Okay maybe I'm complaining too much but the only place to buy food in the entire Los Angeles conference center is a small Starbucks stand. I walked by and the line was HUGE (30+ minutes)  and it did not seem like they had any real food, only a few pastries. So I had to starve until lunch.

I caught the last of the "A First Look at WCF and WF in the Microsoft .NET Framework 4.0" session. Seems WF might actually be useful in the new version and it's changing to be totally based on XMAL... good! It can also be easily be exposed as a WCF service... excellent!

I then went to two pretty bad sessions that I had to walk out on, one on writing applications for Internet Explorer 8 (actually rated one of the lowest sessions at TechEd) and the other on IIS 7. Also went to a WPF session... nothing new here.

TechEd 2009 - Day 2

I noticed today (since I missed breakfast) that there are no snacks throughout the day this year. In years past there is always food out for the geeks to snack on (junk food and fruit). But the only snacks this year came late in the afternoon and the geeks descended on it like vultures! One attendee told me they stopped doing this last year. Come on Microsoft... geeks need special care and feeding! Oh, lunch actually managed to be worse today than Monday.

Today was my second day working in the C#/VB booth. Very slow which made my 3+ hour shift very long. I do wish that attendees took better advantage of this great opportunity to talk to MVP's and Microsoft employees at these booths.

TechEd 2009 - Day 1

I took advantage of the booths and walked over and asked someone about an Entity Framework problem a fellow co-worker was having. Got an excellent answer immediately from Alex James at Microsoft. Check out his blog at: http://blogs.msdn.com/alexj/


 
Categories: dotNetDave

May 11, 2009
@ 08:17 PM
It's been a long time since I have attended a Microsoft TechEd conference. Actually the last one I went to was in Orlando, FL in 2005! Usually I'm unable to go because the company I work for is not able to afford it. This year is no different, but I was able to hook up with Microsoft and "volunteer" in the VB.NET/C# booth in exchange for my ticket (more on that later). So like the last time I went, I thought I'd write down a daily account of my TechEd experience.

TechEd 2009 - Day 1

My day started off very late in the morning because I have been feeling under the weather. I had to go to the speaker room to pick up my shirts to work on the floor in the VB.NET/C# booth. I picked up my shirts and was dieing for some coffee. I asked the lady behind the table if I could grab a cup and she said NO! It's for speakers only. I told her I am leading a Birds of Feathers session but she still refused. It's not like any of the speakers were even getting coffee! Dang, what a way to treat a volunteer and someone running a session.

I was just in time for lunch which featured dry chicken. Yummy! LOL I had a very interesting discussion with a guy from an insurance company. Told me about the major internal application his company is converting from DB2 and Cobal to SQL Server and C#. Told me of their challenges of keeping both systems running during the transition. They have had 20 developers working on this project for three years now and they are just about to go live.

I decided to hit the vendor area before it got too crazy. Since I am a director of the San Diego .NET Developers Group, I hit up as many vendors for support including swag I can use for our raffle. So far this year all vendors are very supportive.

Then it was time for my first shift at the VB.NET/C# booth. Today my first booth mate was the very famous and TechEd speaker Scott Cate. Unfortunately, traffic was very slow. I don't think we talked to 5 people during our 2:15 - 6:00 shift. Made for a very long and boring shift. At least Scott brought his computer and worked on his talk for Tuesday.

During our booth duty, someone from Microsoft came over and informed Scott and I that the pants we were wearing were not acceptable! I now kindly refer to her as the "Pants Natzi". Both of us were wearing black jeans, not black khaki. Like geeks even care. Scott said he brought another pair, but I did not. I told her they said black pants and that was all I had. She said I had to go to Macy's and get a pair or they would not let me work (volunteer) the next day!!! I could not believe my ears. So I left the day early, went to Macy's and found only one pair of black khaki's that would even fit me (I'm 6' 4") for the hefty cost of $81! So if you want to stop by the booth this week and donate to my pants fund... the first person that does will get a copy of my latest book!

I learned that there are only 5,000 attendees this year, down from around 12,000. Out of those, there are only about 2,000 or less of developers.

After the conference I went to Geek Fest held at Lucky Strikes Lanes. Wow, I have never been to a bowling alley like this. It's more of a night club with the hottest waitresses and bartenders you have ever seen! Very fun place complete with pool tables, two bars, DJ and lots of lounging areas.

TechEd 2009 - Day 1

My day ended with coming back to my hotel craving some real food! After a crappy conference lunch and finger food at the party I needed a good meal. Surprisingly, at my small hotel called The Orchid Hotel, I had a very good steak and fries meal. Perfect to boost my energy for the second day tomorrow.

TechEd 2009 - Day 1

TechEd - Day 2


 
Categories: dotNetDave

A security issue has been identified that could allow an attacker to compromise your Windows-based system running Microsoft Visual Basic 6.0 Service Pack 6 and gain complete control over it. You can help protect your computer by installing this update from Microsoft.

To download, click here.


 
Categories: Link | News | VB

As part of the design phase of the SDL, threat modeling allows software architects to identify and mitigate potential security issues early, when they are relatively easy and cost-effective to resolve. Therefore, it helps reduce the Total Cost of Development.

http://msdn.microsoft.com/en-us/security/dd206731.aspx


 
Categories: Link | Security

If you need to serialize and deserialize your objects and persist them to disk, the the code below is an easy way to accomplish this. The GetObjectTypes function correctly detects types so that the serializer will do it's job correctly. Without this you could run into problems (as I did).

VB

    ''' <summary>

    ''' Deserializes from XML file.

    ''' </summary>

    ''' <typeparam name="T">Type</typeparam>

    ''' <param name="fileName">Name of the file.</param>

    ''' <returns></returns>

    Public Shared Function DeserializeFromXmlFile(Of T)(ByVal fileName As String) As T

        Return Deserialize(Of T)(My.Computer.FileSystem.ReadAllText(fileName))

    End Function

 

    ''' <summary>

    ''' Deserializes the specified XML.

    ''' </summary>

    ''' <typeparam name="T">Type</typeparam>

    ''' <param name="xml">The XML.</param>

    ''' <returns></returns>

    Public Shared Function Deserialize(Of T)(ByVal xml As String) As T

        Dim serializer = New XmlSerializer(GetType(T))

 

        Return DirectCast(serializer.Deserialize(New XmlTextReader(New StringReader(xml))), T)

    End Function

 

    ''' <summary>

    ''' Serializes obj to XML file.

    ''' </summary>

    ''' <param name="obj">The obj.</param>

    ''' <param name="fileName">Name of the file.</param>

    Public Shared Sub SerializeToXmlFile(ByVal obj As Object, ByVal fileName As String)

        My.Computer.FileSystem.WriteAllText(fileName, Serialize(obj), False)

    End Sub

 

    ''' <summary>

    ''' Serializes the specified obj to xml.

    ''' </summary>

    ''' <param name="obj">The obj.</param>

    ''' <returns></returns>

    Public Shared Function Serialize(ByVal obj As Object) As String

 

        Dim returnXml As String = String.Empty

 

        Dim serializer = New XmlSerializer(obj.[GetType](), GetObjectTypes(obj).ToArray())

 

        Using writer As New StringWriter(CultureInfo.CurrentCulture)

            serializer.Serialize(New XmlTextWriter(writer), obj)

 

            returnXml = writer.ToString()

        End Using

 

        Return returnXml

    End Function

 

    Private Shared Function GetObjectTypes(ByVal input As Object) As List(Of Type)

 

        Dim types = New List(Of Type)()

 

        Dim currentAssembly = input.[GetType]().Assembly

 

        Dim currentType As Type = input.[GetType]()

 

        'Query our types. We could also load any other assemblies and

        'query them for any types that inherit from the currentType

 

        For Each tempType As Type In currentAssembly.GetTypes()

            If Not tempType.IsAbstract AndAlso Not tempType.IsInterface AndAlso currentType.IsAssignableFrom(tempType) Then

                types.Add(tempType)

            End If

        Next

 

        Return types

    End Function

C#

        /// <summary>

        /// Deserializes from XML file.

        /// </summary>

        /// <typeparam name="T">Type</typeparam>

        /// <param name="fileName">Name of the file.</param>

        /// <returns></returns>

        public static T DeserializeFromXmlFile<T>(string fileName)

        {

            return Deserialize<T>(Microsoft.VisualBasic.FileIO.FileSystem.ReadAllText(fileName));

        }

 

        /// <summary>

        /// Deserializes the specified XML.

        /// </summary>

        /// <typeparam name="T">Type</typeparam>

        /// <param name="xml">The XML.</param>

        /// <returns></returns>

        public static T Deserialize<T>(string xml)

        {

            var serializer = new XmlSerializer(typeof(T));

 

            return (T)serializer.Deserialize(new XmlTextReader(new StringReader(xml)));

        }

 

        /// <summary>

        /// Serializes obj to XML file.

        /// </summary>

        /// <param name="obj">The obj.</param>

        /// <param name="fileName">Name of the file.</param>

        public static void SerializeToXmlFile(object obj, string fileName)

        {

            Microsoft.VisualBasic.FileIO.FileSystem.WriteAllText(fileName, Serialize(obj), false);

        }

 

        /// <summary>

        /// Serializes the specified obj to xml.

        /// </summary>

        /// <param name="obj">The obj.</param>

        /// <returns></returns>

        public static string Serialize(object obj)

        {

 

            string returnXml = string.Empty;

 

            var serializer = new XmlSerializer(obj.GetType(), GetObjectTypes(obj).ToArray());

 

            using (StringWriter writer = new StringWriter(CultureInfo.CurrentCulture))

            {

                serializer.Serialize(new XmlTextWriter(writer), obj);

 

                returnXml = writer.ToString();

            }

 

            return returnXml;

        }

 

        private static List<Type> GetObjectTypes(object input)

        {

 

            var types = new List<Type>();

 

            var currentAssembly = input.GetType().Assembly;

 

            Type currentType = input.GetType();

 

            //Query our types. We could also load any other assemblies and

            //query them for any types that inherit from the currentType

 

            foreach (Type tempType in currentAssembly.GetTypes())

            {

                if (!tempType.IsAbstract && !tempType.IsInterface && currentType.IsAssignableFrom(tempType))

                {

                    types.Add(tempType);

                }

            }

 

            return types;

        }



Tip Submitted By: David McCarter


 
Categories: Csharp | Generics | VB.NET | XML

March 28, 2009
@ 02:05 PM
Microsoft DreamSpark enables students to download Microsoft developer and design tools at no charge. Now, for the first time, Microsoft is giving its valuable software developer and design tools directly to students worldwide at no charge! This site enables students, like you, to download professional-level Microsoft developer tools to advance your learning and skills through technical design, technology, math, science and engineering activities.

DreakSpark


 
Categories: Link | News | Learning