Blog Home  Home Feed your aggregator (RSS 2.0)  
What did you learn today? - Tuesday, January 06, 2009
Phil Denoncourt's Technology Rants
 
 Tuesday, January 06, 2009

The 1st New Hampshire Code Camp is being help Saturday, Feb 28th at Daniel Webster College.  Registration is now open at http://www.thedevcommunity.org/.  We're looking for developers or DBAs to present at this event.  We're also looking for component vendors or recruitment firms to sponsor the event with giveaways, or to help cover food costs. (Contact me - phil@denoncourtassociates.com or Pat Tormey)

I love going to code camps, I always learn a lot about technologies that I don't get to use in my day-to-day life.  It's nice to network with other developers, learn what problems they're running into and how they're solving them.  The manifesto describes it best: By and For the Developer Community, Always Free, No Fluff...

With the economy in apparent decline, a lot of you developers are looking for ways to make yourselves more marketable.  According to ToastMasters International, presentation skills are "crucial to success in the workplace".  Code Camps are a great way to start refining your speaking skills.  Nobody expects a polished speaker.  All we're looking for is someone to show us some code, help facilitate a conversation, or show us something new.  If you get nervous when you speak in front of people and that's deterring you, partner up with a buddy to deliver the talk with you. Presentations should go about an hour, and budget time for dialog/Q&A.

Here's how to register to speak at the NH Code Camp:
1) Create an account at thedevcommunity.org, or sign into your existing one.
2) Complete a Speaker Registry profile
3) On thedevcommunity.org 's home page, click the submit a presentation link next to Code Camp New Hampshire
4) Repeat (as necessary)

Looking forward to seeing you all there...

Tuesday, January 06, 2009 1:35:57 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Development | DotNet | Speaking Engagements  | 
 Thursday, November 06, 2008

I'll be giving a talk on implementing Speech Recognition in .NET this Saturday.  There will be 24 presentations delivered at the code camp.  Register to attend the code camp here.

Adding Speech Recognition to your Application

Since version 3.0, the .NET framework has built in support for speech recognition. It is easy and straightforward to use. You will learn how to use the speech recognition capabilities of .NET. We'll talk about the capabilities of the speech recognition classes. And we talk about best practices and lessons learned.

Thursday, November 06, 2008 4:14:19 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Speaking Engagements  | 
 Wednesday, October 08, 2008

There really is a single instance of a static field per appdomain.  It kind of says this in the C# language reference, but not very explicitly.  This knocked me around a little because I had assumed that there was a single static field per type within an appdomain.  I had a base type that had a dictionary as a static field and assumed that each class that derived from it had its own instance of the static field.  Not so…

Look at the following test code:

using System;
using System.Collections.Generic;
using System.Text; 

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            baseClass.AStaticValue = 3;
            inheritedClass.AStaticValue = 4;
            Console.WriteLine("baseClass {0}", baseClass.AStaticValue);
            Console.WriteLine("inheritedClass {0}", inheritedClass.AStaticValue);
            Console.ReadLine();
        }
    }
 
    public class baseClass
    {
        public static int AStaticValue = 0;
    }


   
public class inheritedClass : baseClass
    {

    }
  }
 }

I expected the results to be
baseClass 3
inheritedClass 4

Instead, the output is
baseClass 4
inheritedClass 4

So unless you decorate the field with ThreadStatic or ContextStatic attributes, static means just one in an appdomain.  Remember that when you are inheriting from objects that have static fields, there’s only one instance of that static field.

Wednesday, October 08, 2008 8:08:08 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Development | DotNet  | 
 Thursday, July 24, 2008

Jul 24th NOTE: the New Night!

SilverLight with John Papa.. Special INETA Event!

Silverlight enables developers to use their .NET and XAML skills to develop Rich Internet Applications and to build data driven Silverlight applications that communicate with multi-tier architectures.

This session will show how to build Silverlight 2 applications that communicate with and consume REST services and use LINQ to XML to manage XML content, show the various data binding techniques, and show how to use WCF to talk to various middle tier services including custom entity models and the Entity Framework.

 

John Papa is a Microsoft C# MVP, INETA speaker, consultant with ASPSOFT, speaker, author, and trainer who specializes in professional application development with Microsoft technologies including VB, C#, .NET and SQL Server.

 

John has written over 60 articles and authored several books on data access technologies including ASP.NET, WPF, Silverlight, ADO.NET, XML, and SQL Server. He can often be found speaking at industry conferences such as VSLive and DevConnections, and viewed on MSDN Web Casts.

 

John is currently working on his upcoming book titled Data Services with Silverlight 2 by O'Reilly due out in December 2008.

Go to NHDN.com for more information

Thursday, July 24, 2008 3:30:22 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]    | 
 Wednesday, July 23, 2008

Part of the .NET 3.0 release was the System.Speech namespace.  This gives you easy access to powerful speech capabilities.  Text to Speech, Speech Recognition, and Dictation are all part of this library.  I've tried speech recognition every 5 years or so, and it has always worked, but it never allowed me to work faster than just using my keyboard.

As a consultant, I work on a variety of different machines.  Sometimes just my laptop, sometimes my laptop with an external monitor, and other times a dual monitor system.  Pictured below is how I set it up on my laptop. 

Most panels are auto hide so that I can maximize the amount of space to view the code.  Getting to the solution explorer means I have to take my hands off the keyboard, and go to the mouse to select the tab.  There are keyboard shortcuts, but I either don't remember all of them, or they don't work in all types of documents.

Since speech recognition is so easy to use with the system.speech dll, and Visual Studio addins aren't rocket science either, I built an addin that enables speech recognition within Visual Studio.  Basically, the addin maps a list of words, that when recognized, execute a command in the Command Window.  So, when I need to quickly look at the task list, I don't have to remember the keyboard shortcut, or mouse to it.  I just speak "Task List".  When I need the toolbox, I say, "Toolbox".  I didn't get into dictation, because I don't think it is efficient to speak "for space open parenthesis int i space equal space zero semicolon i less than items period count semicolon i plus plus close parenthesis open curly brace..."

I uploaded the source and an installer here on CodePlex.  Because (I think) Visual Studio 2005 only works with addins written in .NET 2.0, this only works for VS 2008.  Try it out and let me know how it works.

 

Wednesday, July 23, 2008 7:13:18 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]   DotNet  | 
 Tuesday, June 10, 2008

Me either.  See here in the C# Language Reference.  This means you can overload the operators for your classes.  The example on MSDN talks about classes that have a true, false, or null (neither true nor false) state.  You could also create a type that can be both true and false.

Overloading operators can lead to code that is difficult to read.  You should only overload operators when it makes sense to do it.  If it is unclear what “if (myType)” means, don’t overload the operators.

I wrote a small rules engine for a company a while back and this would have been helpful.  Supplemental rules were implemented as separate classes so that they could be dynamically strung together in different orders as the business logic changed.

Here’s a contrived sample using the true/false operators:

    public class Customer
    {
        public string CustomerName { get; set; }
        public string EmailAddress { get; set; }
        public decimal OutstandingBalance { get; set; }
    }

    public class CustomerIsGoodRule
    {
        
        public CustomerIsGoodRule(Customer customer)
        {
            this.Customer = customer;
        }

        Customer Customer { get; set; }

        public static bool operator true(CustomerIsGoodRule theCustomer)
        {
            return (theCustomer.Customer.OutstandingBalance <= 0);
        }

        public static bool operator false(CustomerIsGoodRule theCustomer)
        {
            return (theCustomer.Customer.OutstandingBalance > 0);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            Customer c = new Customer();
            c.CustomerName = "Joanne Doe";
            c.EmailAddress = "joannedoe@mailinator.com";
            c.OutstandingBalance = 25;

            CustomerIsGoodRule cigr = new CustomerIsGoodRule(c);

            if (cigr)
            {
                SendNewCatalog();
            }
            else
            {
                SendNewStatement();
            }
        }
    }

One thing to keep in mind is that if you provide a definition for true, you must also provide one for false.  Also notice that the logical negation operator (!) was not overriden, so a statement like if (!cigr) fails to compile.

Tuesday, June 10, 2008 12:04:08 PM (GMT Standard Time, UTC+00:00)  #    Comments [2]   Development | DotNet  | 

I haven’t taken the time to upload the materials yet, so thanks to Steve Coombes for hounding me about it.  Here are the files:

Powerpoint Presentation

Source Files/Demo

Tuesday, June 10, 2008 12:00:56 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Speaking Engagements  | 
 Friday, May 09, 2008
In case you haven't heard...  Notice the new location in Nashua.
 

New Hampshire Dot Net Users Group is back just in time for Microsoft’s latest releases of Visual Studio

We’ll be meeting In our new home at

6:00-8:30 May 15th

Eaton Richmond Center room 100

Daniel Webster College

The Guest Speakers will be

Phil Denoncourt

Overview of the AJAX control toolkit:

AJAX is an way to make websites more interactive and responsive.  It's powerful and easy to use.  The AJAX control toolkit is a set of controls that use AJAX and wrap common UI scenarios.  Cascading dropdowns, Auto completing textboxes, in-page popups, hovering menus and dynamically populated textboxes are some of the controls we'll go over.  No AJAX experience is required.

And Pat Tormey will be presenting

What’s new and important in VS 2008 with a little bit of WPF and Expression Suite

Stay tuned to http://www.nhdn.com for details and register up for notices…

Friday, May 09, 2008 12:21:02 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]   Speaking Engagements  | 
 Monday, April 21, 2008

I'm going to be taking this next week, so I thought I'd post my study notes as I assemble them.

  • May include but is not limited to: using the ConnectionStringBuilder; leveraging the ConfigurationManager; protecting the connection string; using Security Support Provider Interface (SSPI) or SQL Server authentication; correctly addressing the SQL Server instance; managing “User Instance” and AttachDBfilename

The ConnectionStringBuilder objects allow for an abstract way of building a connection string for ADO.NET.  There is a good writeup on the data access blog showing basic usage.  There is a SqlConnectionStringBuilder, OleDbConnectionStringBuilder, OdbcConnectionStringBuilder, and an OracleConnectionStringBuilder.

The ConfigurationManager has a specific section for storing connection strings and the ConnectionStrings property to manipulate them.  See this article on MSDN for more information.  An area that doesn't get much attention is that the Connection string configuration can be stored in a separate config file.  See the section titled "Using external configuration files" to see how to use the configSource property.

MSDN has an article on securing configuration strings.  An important part to pay attention to is encrypting connection string information stored in config files.  Scott Forsyth has a post on using aspnet_regiis to protect web.config files.  Daruish Tasdighi has an article at codeproject about protecting the contents using the ConfigurationSection.ProtectSection / UnprotectSection methods.

  • Manage connection objects.
    May include but is not limited to: managing connection state, managing connection pool; implementing persistent data connections; implementing Multiple Active Result Sets (MARS); encrypting and decrypting data

Managing connection state.  I think that is knowing that there are methods on the connection object to open and close the connection.  The connection will be closed when the connection object is disposed.

There is a great post by Sijin Joseph about connection pooling with all the different connection objects.  I wasn't aware that there is no connection pooling with ODBC using the managed providers.  Also interesting was that connection pooling for SQL Server was disabled while debugging in Visual Studio.  Another thing to be aware of is that when using Integrated Security for SQL Server, the domain/user is added to the list of things that need to match for a connection to be reused.

To have a persistent data connection, you disable connection pooling and keep the instance of the connection object around.  The connection will remain open until the connection object is disposed or the close method is used.

Eric Moreau has a post on using MARS.  It is only supported in the SQL Server and Oracle managed providers. 

You can encrypt/decrypt the data passed from the client back and to the database server by adding the Encrypt keyword to the connection string for SQL Server or using the Encrypt property on the SqlConnectionStringBuilder.

  • Work with data providers.
    May include but is not limited to: limitations, behaviors, performance, installation issues, deployment issues; ODBC, Microsoft OLE DB, SqlClient, managed providers, third-party providers, native providers

I guess this is a nice way of saying, "Know everything about ADO.NET".  Some of the things I'm aware of are the just because you have a managed provider available, you still need the native dll libraries.  Oracle, for example.  The client needs the oracle client libraries in order to connect to Oracle.  I mentioned some of the shortcomings of ODBC above in regards to pooling.  A great source for third party data providers can be found at the mono project (Firebird, MySql, SQLLite, PostgresSQL, Mimer, Sybase..)

  • Connect to a data source by using a generic data access interface.
    May include but is not limited to: System.Data.Common namespace classes

The common namespace is the abstract definition for all data providers.  You would use this when you aren't sure which data provider your application will ultimately use.  Using the DbProviderFactory you can instantiate objects for a specific data provider.   Suman Chakrabarti has a post showing how to use the DbProviderFactory class.

  • Handle and diagnose database connection exceptions.
    May include but is not limited to: implementing try/catch handlers

Joydip Kanjilal has a post on handling exceptions in ADO.NET.  If you catch a SqlException, you would examine the number property to determine the root cause of the problem.

 

Next -> Section II Selecting and Querying Data

Monday, April 21, 2008 11:50:36 AM (GMT Standard Time, UTC+00:00)  #    Comments [1]   Certifications  | 
Copyright © 2010 Phil Denoncourt III. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: