Wednesday, September 9, 2009

Update on Development Progress

Well the past few months have been consumed with releasing our external product to market. That was complete about a month ago and I took a couple of weeks to recharge the batteries. The past couple of weeks have been spent coding. It's a nice change to be able to write code all day at work in lieu of other things. I completed two projects over this time period.

Project 1 - Toolkit with Plug-in Framework

This project is a shell application the implements plug in features using C# and Interfaces. Each plug-in is a "tool" that used by someone internal to the organization. It is going through UAT this week and I am hopeful for the results

Project 2 - Redesign Existing Functions for improved user interaction

This project is to redesign some existing functionality to make more user friendly and less ambiguous. This is production code so a fair amount of effort, design, and unit testing was involved.

While I always give best effort when coding I do feel an extra "effort" being put into code that is going to be released to thousands of users.

All in all I am happy with my progress thus far and feel I am well on my way to achieving my goal of full time software developer.


Some items I plan to focus on over the next couple of months include:

- Agile Development Best Practices and Implementation
- TDD and BDD
- Usage of C# and Interfaces
- Usage of C# and Delegates
- Regular Expression building and Usage
- Optimizing SQL performance through query optimization and tuning for SQL and Oracle

That should keep me busy for a while.

Monday, July 13, 2009

Get Identity after SQL Insert Command

The following code will allow you to execute an insert command and retrieve the identity of the inserted record in a single method. The use of (ID = SCOPE_IDENTITY()) will prevent any triggers from providing incorrect ID results that can be obtained when using @@Identity.



public static int ExecuteIdentityInsert
(string connection,
string commandtext,
string tablename,
Dictionary<string, string> parameters)
{
SqlConnection con = new SqlConnection(connection);
string getIdentityCommandText =
(";SELECT ID FROM " + tablename + " WHERE (ID = SCOPE_IDENTITY())");

Object result;
using (con)
{
con.Open();
// Add query to retrieve inserted command id
SqlCommand com = new SqlCommand(commandtext+getIdentityCommandText, con);
if (parameters != null)
{
foreach (KeyValuePair<string, string> pair in parameters)
{
com.Parameters.AddWithValue(pair.Key, pair.Value);
}
}
try
{
result = com.ExecuteScalar();
}
catch (Exception ex)
{
throw;
}
}
return Convert.ToInt32(result);
}

Friday, June 12, 2009

Reflection over the past year

The past year has been an interesting journey for me. After many years of searching I finally found what I want to do with my career. I have fallen in love with software development and I like to think I am good at it. Software is more than just writing code, it is oh so much more. Between the planning, creating, testing, deploying and on going support it can be a bit hectic. I started my journey as the end user, then moved to support. I am now testing and writing tools and small applications.

I have learned so much in the past year but the biggest thing I have learned thus far is that I have so much more to learn. I have a passion for learning so this is perfect. This will keep me hungry for more while my company benefits from the tools and knowledge I gain during this never ending quest for knowledge.

Given my path I bring a unique perspective to software design. Through my end user and support years I have come to learn what bothers users the most and also what they like. This has led me to focus on user interaction and methodology to provide users the best possible interaction with the software. I find that many times developers tend to think about the end user but only when it's convenient. When times are tough and code has to be churned out to meet deadlines - the user is usually the last person considered in terms of UI design and interaction. This is a practice the software community as a whole needs to change.

I am very lucky to have the opportunity to work with such a great team. There are many great people on my team from Support to QA to Development. Each person genuinely cares about the product and we all strive to make it better. We also have management buy in for most if not all of the things we do (methodologies, etc). This environment is rich with knowledge from MANY experienced developers and I get as much information from them as possible. I love sharing ideas and thoughts to help build my "arsenal" of tools.

Current Focus

While my ultimate goal is full time software development I am still in quality assurance and have learned many new techniques for testing software. The biggest concept I have taken away thus far is automation. Nothing beats end to end automation. From building the code to deploying to setting up sample data to installing and then ultimately running automated tests. Nothing is more comforting than walking in to the office in the morning to a collection of GREEN tests.

I have a long road ahead of me but I have the desire, the tools, and the team around me to make this journey.

I'm so excited......

Saturday, June 6, 2009

Data Comparison Tool

In the course of my job I have to validate numerous amounts of data. We have many processes that transfer data between databases to provide flexibility for our clients. In doing so we must support MS Access,MS SQL, and Oracle. Due to the complex nature of this task and the differences in how these database engines perform - it is very difficult to ensure they are all acting the same. So I have identified the problem - and developed a custom solution for it.

The outcome of this is a custom application that uses our existing DAL to compare two databases (regardless of platform). Some of the logic from this tool was based on an existing tool we had to compare single queries.

Setup:

1 Solution, 3 projects, and NUnit.

I wrote the main class as a DLL that can be used with a form, console, or integrated into an existing application. To test this - I used NUnit. This turned out to be the best method. With the console output available in NUnit and this being primarily a testing tool - I left the other options for later and just use NUnit to run my tests. I love it when I see green!!!

How it works

First it gets a list of tables from each database and compares them
Then it compares the rows counts for each table
If that passes, then it compares the row data. This is the tricky part. Since Access, SQL, and Oracle all handle identity inserts differently, it's hard to just sort on ID. To handle this I sort and attempt a compare on each column (in a data table in memory) for each table. I then walk through each data row and compare the contents. There are some fall back checks to handle other differences such as how numbers and bits are handled between the platforms.

In the end - I can move data from one platform to another, perform the same functions in each database, and then compare the databases very quickly with high confidence.

For a database with 300 plus tables I can run a complete test in under a minute with the databases in the same office.

Time Saved:

Before App - 30 minutes per test with less than 50 percent coverage
With App - 1 to 2 minutes per test with 100 percent coverage.

Horraaayyyy for automation!!!!

Sunday, May 17, 2009

How to install Oracle 11g on Windows 7

The following will guide you to install the Oracle 11g client software on a Windows 7 RC operating system. By default it will fail as it lists the operating system as 6.1 and the latest supported is 6.0.

To bypass - change the refhost.xml file located in the following directory:

C:\Users\tsells.TS\Desktop\win64_11gR1_client\client\stage\prereq\client

Note the additional XML entry below in bold. Add this and save the file. Now you will be able to install.

<CERTIFIED_SYSTEMS>
<OPERATING_SYSTEM>
<!--Microsoft Windows 2000-->
<VERSION VALUE="5.0"/>
<SERVICE_PACK VALUE="1"/>
</OPERATING_SYSTEM>
<OPERATING_SYSTEM>
<!--Microsoft Windows XP-->
<VERSION VALUE="5.1"/>
<SERVICE_PACK VALUE="1"/>
</OPERATING_SYSTEM>
<OPERATING_SYSTEM>
<!--Microsoft Windows 2003-->
<VERSION VALUE="5.2"/>
</OPERATING_SYSTEM>
<!--Microsoft Windows Vista-->
<OPERATING_SYSTEM>
<VERSION VALUE="6.0"/>
</OPERATING_SYSTEM>
<!--Microsoft Windows 7-->
<OPERATING_SYSTEM>
<VERSION VALUE="6.1"/>
</OPERATING_SYSTEM>

</CERTIFIED_SYSTEMS>

Monday, April 27, 2009

Status Update

Well it's been a while since I have posted so I thought I would provide an update. I finished the Database Creation Tool with WPF and it turned out great. For my data binding issues I was able to work around that. I had my UI in WPF which was bound to an object with a help class that managed the data flow between the object and the database. I also incorporated some stored procedures to handle all of the settings being inserted.

I was recently working on a feature for our production application which is now finished. It turned out well and was a good learning experience.

Currently I am tidying up some development utilities and creating a c# console application to assist me in generating large data sets for performance testing. To simulate relevant data I found that using a custom app along with our existing DAL was the easiest and quickest way to create "real" and useful data.

We are coming up on a release now so the coding will be scaled back for a couple of months until that is out the door.

TS

Monday, March 16, 2009

Old Habits Die Hard - So I'm not going to start them..

I consider myself a strange breed when it comes to software development. While I am not writing software full time yet I am developing utilities for our teams to use during the course of development, QA, and support for our product. I started in support and moved my way into QA and my next step will be development. I am leaning towards middle tier / database development as this what I currently enjoy the most.

During this process I am doing as much as I can to build my foundation so I can be a great software developer. In building my base I am reading as much as possible from as many sources as I can find. One thing that I feel I do very well is usability. My first experiences with software were from the end user perspective being a system's / network administrator and running my own personal business for 3 years. I have come to realize many users don't have a clue when it comes to technology. As software developers we must make software as easy to use as possible while doing the following three things.

  1. Guide the user during the use of the software so they don't make mistakes (prevent mistakes when possible)
  2. Don't make the user feel stupid when they do make a mistake (show them how to fix it)
  3. Make the user interface FUNCTIONAL.
Since I am "green" as one would say I constantly seek advice / comments / criticisms for the applications I write. I want as much feedback as possible so I can incorporate this into my skill set moving forward. My goal is to NOT develop the bad habits from the start so moving forward I don't have to try and break them to keep progressing and growing as a developer.

Of all my readings two books have really stood out for me.

GUI Bloopers 2.0 by Jeff Johnson
The Inmates are Running the Asylum by Alan Cooper

If you are reading this post and you haven't read these books - I would recommend ordering them and reading them. It will definitely make you a better software developer.

WPF and Data Binding - STUMPED :o(

Well my first attempt at Data Binding didn't go to well with WPF. I had a data source that had 7 different SQL server tables being used for two way binding. I was able to link each field as needed directly but to get them all to bind together against a single entity did not go so well. To get more details check out the following post....

Click Here


For now I will just use an object to gather the data and link the text fields to the object. I have to do some validation anyway so this will probably be the quickest route.

I will defeat this eventually.... :o)

Sunday, February 22, 2009

Oracle Database Management Tool - New and Improved

FINISHED!!!!

Over the past couple of months I have been working on an Oracle Management tool to help manage Oracle Database Servers in a Windows environment. The tool morphed into a decent sized application with over 10,000 executable lines of code. It is written entirely in C# utilizing the ADO.NET classes for data access.





Upon opening the application a login screen is presented. The database connections are populated automatically from the tnsnames file being used by Oracle.


The application has the concept of roles which are determined based on what system privileges a user has on the Oracle Database server. These roles determine what features are available in the management tool.


Below are the features of the application:

Query Editor

This area lets a user execute standard SQL queries against any user with parameters. The results come back as an output window (number of records affect, returned, updated, etc) and select statements return a data grid.










The ability to add parameters is also available. Parameters are detected automatically using the : or @ designated syntax.





Create User



Here one can create a user very quickly by typing in the user's name, password, selecting a tablespace and give the user roles. The radio buttons on the left are the most common used in our environment and automatically select the related oracle system privileges. The privileges are loaded from the oracle database dynamically. There is validation for the username and password (existing, length, character usage).



Edit User

Edit user is similar to create user. Here one can change a user's password, default tablespace, roles, and view the current roles / privileges assigned to a user.





















Delete User

Delete user allows one to remove one or more users at a time. Due to the cascading options with oracle users this can be time consuming so the ability to select - click delete - and leave to complete is extremely useful as a time saver.










Import Dump File

Importing dump files for Oracle can be time consuming and painful. There are many requirements to importing a dump file and syntax rules for command line options that must be followed. To make this process easy now one must create a user via the Create User feature, browse to a dump file and click import.

This feature is only available when the application is run directly on the Oracle Server as it requires the Import Utility provided from oracle (imp.exe).

There are certain checks in place to ensure this will work without errors occurring. There is also a log file created. It is scanned after the import has completed and prompts a user to open it if errors are detected. It will not let you import if there are tablespace conflicts and will notify you of what needs to be changed.


Export Dump File

Exporting a dump file also must be run directly on the database server. This option exports the dump file with standard options enabled and then opens up the file location as to where the dump file / log file were created.






TableSpace Management

The tablespace management section lets you create tablespaces, view details about the tablespaces, and add datafiles to the tablespaces.

Create Tablespace

This feature makes creating tablespaces a breeze. This isn't a widely used feature but will be helpful for development groups. Viewing tablespace data and adding datafiles also make tablespace management simple but effective. Note that all naming for data files is automatic and conforms to oracle standards.





System Information


System information provides a basic snapshot of the host operating system as well as the database server OS environmetn information. The parameters sections (Get Buttons) return parameters from the Oracle Database server.








Help

There is a help file in .mht format that describes each feature in detail as well as provide common Oracle best practices, troubleshooting methodology, and Oracle Database logical design.




Retrospective

This was my first major development project. While I bounced some conceptual ideas off some of my colleagues I did not seek any assistance in writing the code. This was a great learning experience for me. I am now extremely comfortable using C# / Winforms / ADO.NET. I gave a demo of my product to a development team (a group of highly experienced developers). They were all pleased with the tool and provided great feedback for me to use moving forward. The hardest part for me during the development of this tool was to find the time to do it. I started the tool on November 22nd and finished it January 28th. Not too bad considering I took two weeks off in December.


My next project:

Create a new tool the facilitates an automatic daily creation of multiple databases across multiple database platforms for testing and development purposes. I already wrote one of these programs a few months ago but it needs additional features. After looking at the code I wrote then - I realized it would be better to start fresh and create an application worthy of upgrading and progressing. This tool is about 30 percent complete and has the following major sections:
  • Customized data model (database) created using Visual Studio Database Edition (Data Dude) with 16 separate tables all with strict foreign and unique key constraints
  • UI Management tool for setting up database creation plans
  • Console Application to execute the database creation plans
  • Unit Tests (of course we can't forget these!!!!)

Once finished - I will post a snapshot of the UI and a retrospective of this process.

Monday, January 19, 2009

How to remote debug with Visual Studio without debugging tools installed on remote machine

If you need to debug a remote machine and do not have any type of debugging tools installed you can launch the Visual Studio Remote Debugger console via a UNC path back to your Visual Studio Instance.


Steps


1) Ensure you have the latest code base in VS and the latest debug build (must have .PDB files).

2) Launch Visual Studio

3) On the remote machine - launch the Remote Debugging Utility via UNC path back to your machine

Example \\myMachine \Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x64\msvsmon.exe



Note: This file will differ based on installation type and OS (32 / 64 bit).

4) Launch the application to debug

5) In Visual Studio Under Tools select Attach to Process


6) In the following screen put in the machine name of Remote System you are connecting to and hit refresh




7) Now select the application and click attach.



You should now be able to debug without installing any tools on the remote system.

Thursday, January 1, 2009

A new direction for the New Year

Over the past month or so I have been doing a lot of work on the Oracle Tool from my previous post. I totally redesigned the tool and turned it into a major player which I will have finished some time this month. I have decided that I want to learn at least one new programming language each year. Since 2008 was a year for Java to start with and then slam home C# with ADO.net I need something new and different for 2009. I looked at a few languages including Perl and Javascript. Now is the time to make the decision - and the choice is....


Ruby (Gems, Rails, etc).

Why Ruby? Well it is an old language with a new twist (Rails) and is becoming more popular. Plus it's not Windows proprietary. I am not anti-Microsoft by any means - Bill Gates has put many a dollar in my household over the years. My goal is to become as well rounded a programmer as possible. This to me means variety across multiple language types, platforms, OS's, etc.

So now that I have my language set - what development environment to use? I asked a couple of people who have programmed in Ruby and their preferences were Linux and Mac. Well I don't own a MAC and haven't used Linux in over a year. So linux it is :o). I chose Ubuntu 8.1.0 Desktop for this. I like Ubuntu and it has great reviews from others.

To start with I setup a virtual machine with Ubuntu on my desktop here at home. This beast is a quad core, 8 gigs of ram - more than a TB worth of space (raided) so I am good on resources. I am primarily Windows based so I don't have the heart yet to convert my main machine to Linux just yet. Well the setup went well and I was suprised at how many of the command line commands I had remembered, and forgotten :o). After setting up / updating / and configuring the OS I installed my development tools. I choose to install NetBeans 6.5 as well as Eclipse. Both are good IDE's and Netbeans has great interaction with Ruby. I also added MySQL which I haven't used in a few years. I will be using SubVersion for my source control and even found a nice little script on the net (haven't tested yet so I am not posting yet) that will backup you repositories, zip them, and copy them out to another drive.

Note: I haven't chosen a plain text editor as of yet - not sure which I am going to use but will determine in the next few weeks.

So now that my VM is setup to develop I am going to spend the next few months getting into Ruby / Linux / MySQL and some web development. This will keep my interest for a while at home as I continue to improve my C# skills at work.

I'm so excited - I can't wait to build my first app. Oh wait - I have to go away for a family vacation this weekend so it's going to be a few extra days :o|.