Application Configuration Settings

One of the most common ways to store application setting is in the config file.  Below I will show examples of how to store configurations and their retrieval. AppSettings and ConnectionString Sections Include the appSettings and/or connectionStrings sections in  .config file for retrieval from your application. <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="MySampleKey" value="Sample value" /> </appSettings> <connectionStrings> <add name="DataSource" connectionString="Server=MyDevServer;Database=Northwind; Integrated Security=true;" providerName="System.Data.SqlClient"/> </connectionStrings> </configuration> C# code for getting the values var appsettingValue = ConfigurationManager.AppSettings.Get("MySampleKey"); var connectionStringValue = ConfigurationManager.ConnectionStrings["DataSource"] … [Read more...]

Global Data

Global data is accessible anywhere in a program.   Using global data is riskier than using local data. Here are some common problems with using Global Data: Problems with Global Data Unexpected changes to global data.  Since global data can be accessed anywhere, it can also be changed anywhere without the intent of doing so. Cannot concentrate on only one routine.  You have to concentrate on one routine and every other routine that uses the same global data. It's difficult to modularize your application. Usage of Global Data There are some situations when using global data is ok.  For example, configuration data is often used for an application using variables that you may want to change without recompiling and redeploying your code.  You can store application or user settings in a config file, database or windows registry. General Guidelines Create global variables only when you need to.  Always start with creating local variables first and expand scope as necessary. … [Read more...]

How to reduce your Comcast bill

Being in the technology field, I tend to want to have the latest and greatest of what's available.  For example, I have to have a high speed internet connection, latest cell phone with unlimited data plan, satellite TV with a great picture and lots of channels, etc.  All these bills add up and I knew I had to start cost-cutting somewhere. Eliminate your Home Phone bill When I came across this article, I was hooked on trying to reduce my Comcast bill.  It started with getting rid of Comcast Triple Play containing VOIP. How to switch to VOIP and ditch your home phone bill forever Since I have a high speed internet connection with Comcast, this was a no-brainer.  It’s a little bit of a pain to get setup.   But I have not had any issues with it and it’s been almost 2 years since first implemented. I also installed google voice on my cell phone.  It’s really nice being able to get voice messages anywhere I am.  I can also redirect my house calls to my cell if I want.  Love it … [Read more...]