Wednesday, February 27, 2008

int vs Int32

int iViaKeyword = 0;
Int32 iViaClass = 0;

The above two lines of code declare the same exact Integer variable. Back in the VB6 days for example an Integer was 16 bit but in today's world in both VB.NET and C# the int Keyword represents a signed 32bit  integer.

So what is the difference, why have the two ways to declare the same exact thing? Lets examine both of our options in more detail to try and figure this out.

Comparing: Int32 to Int

Int32 is defined in the documentation as a Struct (System Namespace) that represents a signed 32bit integer.

Int instead is defined as a Keyword that points to the Int32 Struct and therefore also holds a signed 32bit integer.

Given this information both seem identical and can be used interchangeably. For example one could says iViaClass = iViaKeyword from our code above and get no errors nor a message that requests an explicit type conversion in C#. For all coding purposes these two are exactly the same.

To me personally this is a bit confusing as an implementation and I would have gotten ride of the int Keyword, but perhaps given the legacy comfort developers have typing int into their IDE this could perhaps explain its existence.

Int32, Optimized for the processor?

As for using Int32 vs. Int16 or vs. Int64 various documentation state that an Int32 is optimized by the compiler for the processor and therefore should be used in most cases where it wont overflow.

I do have to question this though now that 64 bit processors exist, does that mean that Int64 would be more optimized on a 64bit platform? I am not sure of this answer and will look into it later.

Coding for Change

I have seen some discussions in forums that argue when you type Int32 you guaranty that your code will target an Int32 no matter what, as this is a specific implementation. Using the Int keyword does not necessarily come with this guaranty as one day Microsoft might change the Int keyword to mean Int64 as it once changed Int from 16 to 32.

To me such a breaking change seems unlikely but one can never be 100% sure and I would give this argument some validity. If I was building a system that needed to stand the test of time I would consider following this advice.

Closing

I look forward to your feedback and any comments or corrections. Even this simple concept in .NET has a lot of depth and I look forward to any discussion that this might spawn.

SkyDrive is Live

I am a little late with getting this into my blog but Microsoft has announced that SkyDrive is now out of Beta.

For those of you who don't know SkyDrive is Microsoft's free online hard drive through their Live.com product line.

One immediate improvement is the storage space that went from One gigabyte to Five gigabytes. This is a nice amount of free storage but do note there is no way to upgrade the disk space at this time.

One thing that still bugs me though about this product is the inability to move files once something is uploaded. This seems like a standard enough of a feature to be (still) missing from the product at launch. Over time though I'm sure this service will improve as its competitors such as GDrive are right behind it (At least if you believe the rumors).

Unsafe Keyword

Today I was looking at the source code of Jon Skeet's blog post: Visualising the Mandelbrot set with LINQ - yet again. What interested me (out of all things) is a block of code with the keyword Unsafe.

I never used Pointers in C# and therefore had no clue that you needed to use the Unsafe keyword block around anything that had "unsafe code", which included Pointers in his case.

image

This is another good example of why looking at source code is so important, even when its not your own or of immediate work importance. You never know what you will learn.

For more interesting source code I would recommend Scott Hanselman's Code Series on his blog, that can be found by clicking here.

For more information on Unsafe keyword, check out this MSDN page: http://msdn2.microsoft.com/en-us/library/t2yzs44b.aspx

Tuesday, February 26, 2008

4.8 Earthquake hits UK

An earthquake measured with a magnitude of 4.8 shook parts of the UK at 0:56 this morning

To all my friends in the UK, I hope all is well.

For more information, go here: http://news.bbc.co.uk/2/hi/uk_news/2275158.stm

Sunday, February 24, 2008

Server Error: Posting to Blogger using Live Writer

Today while Posting to blogger using Live Writer I got this annoying error:

blogger error postingThis seemed very odd as I did not think I was doing anything different, perhaps Blogger was down?

I invested a Little and found no known or obvious issues with Blogger. I then decided to restart Live Writer, and yet again no luck

Finally It hit me, if I scroll down in the error box it had one very important piece of information (see bold below):

The server reported an error with the following URL:

http://www.blogger.com/feeds/6464718258414775904/posts/default

400 Bad Request

Invalid category term

It seems that my choice of Q&A in the Categories option was not valid for blogger, it did not support the &. Changing it to QA instead worked and my post went through.

This is a good lesson to everyone: when you get a message box with an error scroll down and read everything!

smile_sarcastic

Q&A: Virtual Dedicated Server and Blogger Visitor Tracking

Today a former colleague of mine emailed me with a few questions. To answer them I have decided to put together this blog post as I believe the answers might help others as well.

Virtual Dedicated Server

His first question focused on my mention of Virtual Dedicated Server. To summarize I have recently leased a VDS from GoDaddy.com. While this is higher in price then simply using shared hosting it does give me a lot more control and options of what I use the server for.

To manage the VDS I simply Remote Desktop into it using the standard windows client and manage the machine as if it was a real dedicated server. Prices starts at around $42.00/month and more information can be found by clicking here.

I setup my VDS with .NET 3.5 runtime and configured three websites I am prototyping so far without issue. This is a great option with maximum flexibility but minimum support from the hosting provider.

Blogger Visitor Tracking

His second question focused on how I track visitors to my blog. The answer here depends on the statistic we are talking about:

Daily Visitors. For tracking visitors to the various blog entries I use Google Analytics. To use this service you simply register with Analytics for free with your Google account and they provide you with a small amount of HTML to embed into your site. Once the HTML is embedded they starting tracking visitors and provide updates every 24 hours. You can even setup email's daily or weekly in PDF (and other formats) of your statistics which is very convenient.

The instructions for inserting Google Analytics HTML into blogger is well documented and can be found on sites like andywibbles.

RSS. Additionally I track how many people subscribe to my RSS feeds by using FeedBurner. Feedburner is a great free service (recently purchased by Google) that allows you to replace your standard Blogger RSS feeds with a special URL that then tracks statistics. The full instructions can be found here on the FeedBurner FAQ for Blogger.

Closing

I hope these answers are helpful to my colleague and anyone else who stumbles upon this post. If anyone has any additional questions please don't hesitate to contact me directly.

Friday, February 22, 2008

Dmitry @ Microsoft

Well friends its official, starting today I am on the payroll of Microsoft Corporation. I will be working with consulting services to provide support for NYC based customers with some expected travel.

This is something I always wanted and am proud to join a company I believe in. In my opinion Microsoft has the best development platform on the market and its suite of supporting frameworks is extremely impressive (and growing). Anything I can do to help spread and make this technology work for our clients will be my pleasure.

The sense that I get by talking to existing staff is that this position will challenge me and at the same time provide a powerful learning experience. I believe I am up for the challenge and definitely have the enthusiasm to face it.

Thursday, February 21, 2008

SQL-CLR - www.sqlclr.com coming soon

In a recent project I had the opportunity to work with SQL-CLR technology inside of SQL Server 2005. It was a very wonderful experience and I really enjoying using .NET inside of SQL Server.

(lets get this out of the way: Yes many times SQL-CLR is a bad approach, but its a tool like any other and should be used with precision and clear intent)

Unfortunately I found no good single resource on the topic except for the MSDN Forum (which is very good). Even the links in the forum were broken and the moderator was too busy on SQL Server 2008 release to worry about the community. This is fully understandable but at the same time I believe hurts this technology greatly. Without good resources people will not approach it as quickly and this could perhaps be part of the problem leading to a slow adoption rate for SQL-CLR.

Instead of simply complaining about the problem I decided to invest some time into a small side project called SQLCLR.COM. This website which will be located at http://www.sqlclr.com will feature all the resources links (sites, forums, podcasts, screencasts, etc), FAQ and any news related to this specific technology. It will be a niche site, but with a clear purpose.

Hopefully with a resource (inspired by http://www.iis.net) dedicated to SQL-CLR we can finally get some traction on moving this technology forward.

Your Feedback

In an attempt to gain feedback I have also posted in the official SQL-CLR MSDN Forum at the link below. Please show your support if you believe in this idea.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2884649&SiteID=1

What is Mono?

In my continued effort to know "a little bit about everything" I have now made an effort to get at least a summary understanding of what Mono is bringing to the .NET platform toolkit. What got me started on this specific topic was .NET Rocks show #313 titled "Miguel de Icaza and Geoff Norton on Mono". This was a great introduction to what Mono is all about and I highly recommend everyone listening to this episode.

The Basics

Mono provides the necessary software to develop and run .NET client and server applications on Linux, Solaris, Mac OS X, Windows, and Unix. Sponsored by Novell (http://www.novell.com), the Mono open source project has an active and enthusiastic contributing community and is positioned to become the leading choice for development of Linux applications - Source: Mono Project Website

After listening to the podcast my next stop was the Mono Project website. The above quote is taken directly from the front page and does a good job at summarizing what Mono is: A cross-platform implementation of .NET technology by Novell corporation.

Why is Mono Needed?

The big advantage of working with .NET is its languages and supporting Framework. As a developer if you enjoy using the .NET API and language syntax (such as C#) to build application then Mono offers you a very interesting opportunity to use exiting skillsets to build applications or libraries that span the bigger operating systems.

Who Makes Mono?

Mono is currently funded by Novell corporation and is greatly supported by a large scale community effort.

Microsoft has also started to collaborate with the same team on making Silverlight available on more platforms, this project is called Moonlight. Microsoft though plays no current large role in Mono itself.

What are the Tools?

As a .NET Developer the first thing I am curious about when looking at Mono is what development IDE's are available. There seem to be a lot of tools and options in this
area but the two integrated development environments that stand out are as follows:

  • MonoDevelop is the development IDE for Linux. It was originally a port of SharpDevelop and supports C# and other languages. This seems like a mature product since Linux was the original targeted platform of Mono
  • CoCoaSharp is the new development IDE for Macintosh. It is a newer addition to the family and is therefore should be treated as a work in progress (Mistake on original post)

Mono's libraries and compilers also support command line so an IDE is optional.

What about ASP.NET Website Development?

Mono supports building and deploying applications on Apache. This is accomplished through Mod mono which is a module for Apache to enable ASP.NET functionality on this platform.

Conclusion

It is extremely positive for me to see others make such an effort to bring .NET technologies and styles of development to other platforms. My post here is just a small subset of information available and therefore to truly understand the full scope of Mono check out their official website found at: http://www.mono-project.com/

Other Good Resources

Wednesday, February 20, 2008

IIS 7.0 - Security and Performance

iis 7 new Windows Server 2008 comes with a new version of IIS, version 7.0. Ever since IIS 6.0 I have been very happy with the platform and while its not perfect it is typically stable and secure.


In my continued attempt to learn about upcoming technology I listened to IIS 7.0 Security and Security Features podcast on TechNet Radio. This podcast brought out a few interesting facts that I wanted to share in summarized format:

Enhancement

  • The Architecture of IIS 7.0 is built from the ground-up with Security as a primary concern
  • You can install IIS with only the components required to run the content you will be delivering. Therefore if you run just a static site you can configure it to not even have any ASP, PHP, ASP.NET or other more complex extensions installed. Therefore even if there an exploit in one of these sub-systems it wont impact your customized installation
  • Configuration data is no longer globally accessible. In IIS 7.0 the main configuration is only accessible to administrators and subsets of it are created at run-time and provided to the applications in very limited and scope specific chunks. This will help ensure that applications do not "peak at" configuration settings out of their intended scope
  • The interface has been improved to help you configure IIS. This will be especially welcomed due to the added complexity of the new component based architecture
  • IIS has been tuned to run a large amount of applications at one time without degrading performance. This is not necessarily a performance improvement in the typical sense but instead an optimization for stability and increased server capacity

What you wont be getting

  • IIS 7.0 does NOT bring any performance improvements, it wont serve your pages faster. Anything they gained in performance (pages per second) they lost through the additional security and architecture enhancement

Warning for ASP.NET Developers

  • If your using in-process session state watch for settings that control the new "dynamic idle threshold". This could reset your application pools loosing your session state a lot quicker then you expect as it would change dynamically based on load. Its fully configurable but you need to be aware of it

The podcast has a lot more information then this, but these are the items that stuck for me personally. I really look forward on working with this new platform.

Want to learn more?
For more information I encourage everyone to check out http://www.iis.net/, the official IIS website.
Also you can play with IIS in a virtual lab by visiting this URL: http://technet.microsoft.com/en-us/bb499672.aspx

Tuesday, February 19, 2008

Building The "Right" Solution

ASP.NET vs. SmartClient

About a year ago I was 100% positive that SmartClient* architecture was the way to go for a system I was tasked with building. The requirements called me to build it using ASP.NET but I knew it would be the wrong approach and not provide the interface and performance enhancements the users were looking for.

Making the case for such a drastic change was not easy, people were comfortable with ASP.NET and deploying Windows Applications brought back to many bad memories of installation and maintenance nightmares. Most of the bad memories were simply “legacy ghosts” and not real issues with the approach I was suggesting, a SmartClient.

Being fairly focused on delivering the best solution and experience for my users I decided to peruse getting approval for my architectural approach. After some consideration the best strategy I found was to build a series of prototypes supported by presentations that made my case.

Enter the Prototype

The first series of prototype’s and demos focused on User Interface enhancements and easy deployment/Maintenance using ClickOnce technology (hence the SmartClient references). During my demos of these prototypes it was clear the a Windows Application with in-memory caching, powerful and responsive grids, combined with the “feel” of a Windows App served the interface requirements very well.

Deployment was also an impressive “one click” implementation as long as the machine had sufficient rights to install an App and the .NET Framework. One concern we had to overcome is that many machines did not have the .NET Framework 2.0 preloaded. To solve this we merely had our field technicians deploy the Framework to all computers that needed it, while others simply self-installed it using an FAQ we provided.

(Admittingly the desktops Framework deployment and maintenance was not a huge issues since we controlled all the users desktops involved, there were not that many of them and Citrix was our backup.)

Another major concern we had to overcome was connectivity. The application had to be responsive on the various users desktops/Physical locations while querying web services located in our server farm out of NYC. To test this I created a simple application that would check the rate at which data was transferring between the client and the web services back-end. This test application was executed from all the key locations around the country and we found no significant latency issues to be concerned with.

Its Deployed and it Works

Today the users of this application enjoy a powerful interface of a locally installed full fledged windows application and they are happy with its usability and performance

On the IT side the SmartClient ClickOnce upgrade model is working without issue keeping the pressure off our technicians.

This is exactly the kind of success story that makes .NET a powerful platform with hundreds of solutions and options to meet the requirements of the business while at the same time making the end users and IT pros happy.

Special Thanks: My Development Team

This application would NOT have been successful if it was not for the hard-work and good coding put into it by my local development team and our our-sourced resources. While I pushed for this approach they are the ones who made it possible in the end. Thank you guys, you know who you are.

(* The concept behind SmartClients if anyone is unfamiliar is a Winform Application that is deployed to user’s desktops using ClickOnce technology. ClickOnce then maintains the application at the latest published version automatically either on start-up or shutdown of the application, depending on configuration. This of course is a simplified explanation and you can get all the details here: SmartClient FAQ)

VARCHAR(MAX)

Last week my projects Data Architect introduced me to a new SQL Server 2005 feature called VARCHAR(MAX). This new MAX keyword allows a specific column to be VARCHAR type but support an unlimited number of characters (well not unlimited, but up-to around 2 gigs).

The advantage of MAX vs. lets say TEXT is the VARCHAR(MAX) data type works with intrinsic string functions that do not work on the TEXT or IMAGE data type. (examples: replace, substring, etc)

Also MAX is supported by NVARCHAR and VARBINARY. It might be supported by other types as well, but this is all I am aware of.

In general I find this to be a very interesting concept, but it should be used carefully. There are MANY good reasons to define strict VARCHAR field lengths and therefore this feature should not be abused. I also recommend good communication between the database designers and the development staff that will consume the data store to ensure they understand the methodology behind using VARCHAR(MAX) and make appropriate decisions in both interface and back-end designs.

If the summary here interests you to explore this feature further then visit the links below as they provide a lot more detail on the subject.

Using MAX data types in SQL Server (A good article by Adam Machanic)
http://searchsqlserver.techtarget.com/tip/1,289483,sid87_gci1098157,00.html

Steve Wright's Post on Issues with SSIS and VARCHAR(MAX)
http://blogs.conchango.com/stevewright/archive/2006/01/20/2686.aspx

An interesting post on SQL Authority: How to enforce limits on Varchar(MAX) using constraints
http://blog.sqlauthority.com/2007/06/01/sql-server-2005-constraint-on-varcharmax-field-to-limit-it-certain-length/

Monday, February 18, 2008

Automatic Properties Screencast on BetterKnowaFramework.com

For the last few months I have been working on another Website called Better Know a Framework. This site will be hosting various Screencasts created by me and others I am collaborating with. The idea is to provide short 5 to 15 minute long presentations on various .NET related topics.

Today is a big occasion for this Website as we just published our first Screencast on Automatic Properties in C# 3.0, featuring Jon Skeet as the host.

I look forward to your feedback as we learn how to create the best possible Screencasts in both content and recording quality. Our first one is not perfect, but its a big step forward.

Special thanks to everyone who provided me with feedback and advice as I was working towards our first recording, you know who you are!

View it: Automatic Properties in C# 3.0

(Also visit Jon's blog at: Jon Skeet: Coding Blog)

Sunday, February 17, 2008

Visual Studio 2008 Article in QBS magazine

Today I found a blog post on Daniel Moth's website regarding his Visual Studio 2008 Article in QBS magazine.

The article is an excellent summary of Visual Studio 2008 highlights and unique attributes. I highly recommend everyone who does not yet have a strong understand of the new environment take a look at it (You know who you are).

Link: VS2008 Article for QBS magazine

(The link above goes to Daniel's blog, which can then take you to a PDF version of the article)

Enjoy!

Saturday, February 16, 2008

Visual Studio 2008: Title Tag in MasterPage

Today I figured out an annoying problem and want to share the resolution with you. This is not a bug, its just a behavior if not realized quickly can cause minutes (or worse) of frustration.

Problem - Title Tag being overwritten with "Untitled Page"

I created a master page for my ASP.NET 3.5 powered Website using Visual Studio 2008. I set the <title>My Title</title> in the head as normal.

image

I then built multiple Web Content Forms that held my actual content for the various pages. (Web Content Forms is basically a page that uses the Master Page as the root style definition, I really don't like the name they used, but that's not my decision LOL)

Everything was working fine until I noticed my title in Internet Explorer during testing which said "Untitled Page". This couldn't be, I was sure I had set the Title to a different value.

Looking in the Master Page sure enough the <title> tag existed and looked valid. This didn't make sense.

I then looked into the new ContentPlaceHolder for the HEAD (which is a new feature of VS 2008), since I thought perhaps something in there on my individual pages was overwriting the masterpage definition of the Title, again no luck.

Solution

After a few more minutes I had realized my stupidity, the individual pages page element at the top (<%@ Page) has an attribute called Title, and it was set to: Title="Untitled Page"

Mystery solved, this was overwriting my masterpage definition. Removing this attribute all-together from the underlying pages fixed the issue.

This was something really stupid and I hope this post saves someone a few minutes of their life.

smile_shades

IIS 6.0 and .NET 3.5 Website Configuration

Currently I am in the middle of developing a few of my own Website projects. While the projects themselves are not important (and will be announced later) I am going to start posting any of my experiences in setting up these sites in the Virtual Dedicated Server which I have now leased.

I took the approach of my own Virtual Dedicated Server to have the most control over how these websites are setup and because it will be a good re-learning experience. I used to be involved with web deployments a lot, but recently my regular work projects have steered me clear of this area, its time to change that.

.NET 3.5 Running in IIS 6.0

One of my first challenges was the need to deploy my first .NET 3.5 framework websites into this freshly installed virtual server. By default, my server had only .NET 1.1 installed and nothing enabled for IIS extensions.

To change this I first downloaded and installed the .NET 3.5 runtime. Then, I proceeded to download and install the .NET 2.0 runtime to have both on the server.

The Puzzle Begins

During the 2.0 install though I got an error that said "Setup cannot continue because this version of the .NET Framework is incompatible with a previously installed one.  For more information, see http://support.microsoft.com/support/kb/articles/q312/5/00.asp"
image

This puzzled me at first but I did get the general hint, installing the .NET 3.5 runtime somehow already put the .NET 2.0 runtime in place. I didn't think it worked like this from the beginning, but obviously I was mistaken. To look at this situation further I entered the IIS 6.0 Web Service Extension tab and found another strange thing, only ASP.NET 2.0 and 1.1 were registered for Allow/Prohibited status.

image

My Theory

My theory is that ASP.NET 3.5 must still run on the core 2.0 libraries (or something went really wrong with my 3.5 install). To further test my theory I published and installed my first .NET 3.5 websites into IIS with the settings  shown above and it seems to be working.

Its also worth noting that looking under the ASP.NET tab of Website Properties it also does not show .NET 3.5 as an option, instead 2.0 and 1.1 are available just like in the extensions screen.

image

Solution?

I will continue to investigate this but it seems that once the framework 3.5 is installed simply allowed .NET 2.0 to run will do the trick for 3.5 websites

If anyone has any further information on this I would appreciate a reply to this post or an email.

Wednesday, February 13, 2008

FTP Task - Setting Password through code

One of the things I had to do today was set my packages FTP Task server password from my C# driver application. This is possible but it took me longer to figure out then it should have, even with the answer in front of my eyes. The following sequence is what I did in the end to make it work and I hope it saves someone else time in the future.

(The steps below assume you understand how to execute an SSIS package from code and merely indicates how to set the FTP Task password)

Setting Password from C# Code (Details)

  • Create an Application object and load your package as normal using LoadPackage() method
  • Once the package is loaded, use the following line of code to create a connection object that will link to your FTP connection manager. (FTP Connection manager actually needs the password, not the FTP task itself)

ConnectionManager ftpCon = YourPackageObject.Connections["Your Connection Name"];

// "Your Connection Name" is the name property of your FTP Connection Manager

  • Next, use this line of code to set the password to any string you want, as indicated below by the words "YourPasswordHere"

ftpCon.Properties["ServerPassword"].SetValue(ftpCon, "YourPasswordHere");

Notice how in the line above the password is set by configuring the ServerPassword Property. Also note how your passing the created FTP connection in the SetValue, only then passing in the password as an unencrypted string with the next value.

Caution: Storing FTP passwords in plain text is not a good practice. Please make sure you keep them encrypted and only unencrypted them when pushing into the SetValue property.

If anyone has problems getting this to work, please dont hesitate to contact me.

Special Thanks

Special thanks to Kutijevac on the SSIS forum for helping put together the code described in this post. I am merely hoping my post makes his content a bit easier to locate and consume. See below for a link to the original post:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=122756&SiteID=1

Tuesday, February 12, 2008

%1 is not a valid win32 application - SSIS Error

Today I had another first with SQL Server Integration Services, I had to execute a batch file.

To accomplish this I placed an Execute Process Task on my design surface and set its WorkingDirectory and Executable properties to form a valid pointer to my test.bat file. This was an empty batch file meant as a placeholder until i made the real one.

Right-clicking on tasks at the Control Flow level lets you run them individual (As a test), and this was perfect for my goal: to see if this approach individual task worked.

Upon execution though my output had the following error "%1 is not a valid win32 application".

Problem: %1 is not a valid win32 application

This error can occur for a few reasons, many times because you are providing a path to a folder that contains spaces, but does not have quotes around it. Example: C:\My Development Env\MyProject\RunMe.Bat.

I assumed this was the case and proceeded to place quotes around the WorkingDirectory value. This did not work as the new error told me this directory did not exist.

Frustrated I started to Google for a solution. After some time I did not find anything that solved my particular problem. I was stuck.

Solution

When I hit a wall like this I typically try to take a step back, look at the basics. In this case doing so brought a realization to me, what if this error can mean something else? What if the batch file being empty (yes totally empty) was the issue? I opened up the batch file, added one basic DOS command(DIR in this case) and executed the task again. Doing so worked perfectly resolving my issue.

So here is a lesson, don't try to execute empty batch files using SSIS. I hope this saves someone else 15 minutes of their life.

DelayValidation Option in SSIS

As most of my "loyal" audience already know I am currently working on a project using SSIS for ETL. I have never worked with SSIS before this project so it is definitely a learning experience.

Problem

One recent problem I encountered was a difference in how my package behaved when executed using a C# driver application instead of the Development IDE (Visual Studio).

While using Visual Studio SSIS packages can be executed in a debug mode, and my package was working perfectly. The steps (slightly simplified) involved:

  • Executing an FTP task to download a file
  • Running a DataFlow series of tasks that read the contents of the downloaded file and uploaded it into SQL Server
This is a fairly simple sequence, but it did not work once I would execute the package from my C# driver. (Basically using the Object Model exposed by SSIS to run the package from custom code, in this case my Unit Test scripts)

The error would occur on the second step, the DataFlow would fail because the file was missing. This made perfect sense since in my analysis of the package I noticed no FTP commends were sent to my development FTP server, meaning the file was not being downloaded. (Now again, everything worked perfectly when executing the same package using Visual Studio).

Solution

Thanks to an idea I had and some direction from the forum (see special thanks below) i was able to figure out that the DelayValidation option by default was set to False, which attempted to validate that the file existed before ever running the FTP Task.

To resolve this I simply set the DelayValidation setting at the DataFlow level to True. This resolved my issue and now the package works from both my driver and the IDE.

My only frustration is why did this even work from the IDE? One would expect things to work the same in debug as it does at run-time but i guess this is not the case. I really dont have a full understanding of SSIS so that could definitely be the problem here.

Special Thanks

I want to thank jwelch for pointing me in the right direction on the SSIS forum. It feels really good to know the community is there to help me through this learning experience

My Post: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2827234&SiteID=1

Sunday, February 10, 2008

Getting started with WMI in .NET

WMI Overview

Being a Software Engineer first and an IT person second I never find servers as interesting as the software that they run. The big change for me is when I bring the two together in a project. One such project did exactly this by allowing me to interface with a core server services called WMI to automate parts of a deployment process.

What is WMI? Here is the definition found on the Wiki page:

A set of standards specifications that allow for management information to be shared between management applications

Combine this interface with the ability to use it directly from .NET code makes for some interesting possibilities. Imagine being able to query remote servers for Environment variable data, Disk Driver statistics, Running process information, or any of the other useful statistics exposed through WMI.

WMI though can be very complex to implement properly but the basics are simple. For example to query for information like Environment Variables on a remote server:

  1. Create a ConnectionOptions object and specify a set of credentials if your connecting to a remote box (you don't need credentials if your connecting locally)
  2. Create a ManagementScope object providing it the name of the machine which will be in your "scope" and provide the ConnectionOptions object you created earlier
  3. Create a ObjectQuery object and specify your query, for example: select VariableValue from Win32_Environment where name = "SystemRoot"
  4. Create a ManagementObjectSearcher object by providing it the ManagementScope and ObjectQuery. Once created you would simply execute the Get() method and get your
    ManagementObjectCollection collection that can be iterated through to retrieve
    ManagementObject with the actual data.

WMI can also be scripted from JScript, command-line or tools like FinalBuilder, PowerShell, etc. This extends WMI automation beyond just the development group letting other savvy IT professionals to manage their system without our assistance.

Getting Started with WMI for .NET Developers

Recommenced Learning Path

To get started with WMI in .NET 2.0 I would recommend the following steps:

  • First read up on what WMI is from a more complete source then this blog, like this Wiki article:

WMI Wiki Page: http://en.wikipedia.org/wiki/Windows_Management_Instrumentation

  • Second learn about WMI's query language WQL as its very useful to query information out a remote server:

WQL (SQL for WMI): http://msdn2.microsoft.com/en-us/library/aa394606.aspx

  • Third learn all about the .NET WMI implementation and check out the various code samples on the MSDN library:

MSDN: WMI .NET Overview: http://msdn2.microsoft.com/en-us/library/ms257340(VS.80).aspx

Other References

WMI is extremely useful in various scenarios and I hope this reference post helps you get started.

Friday, February 8, 2008

Integration Services Package: VB.NET Install not required for scripting components

I am currently working at a new client and the desktops dedicated to me and my co-worker are still being configured. In this process I was asked what tools I wanted installed and for Visual Studio 2005 I specified C# as a required template. For VB.NET though i said it was as optional (but preferred) install.

My co-worker immediately questioned this, "but how will be be able to create code under the Script task in SSIS packages?". This was a good question but the answer is VB.NET is not required. The Integration Services Project supports something called "Visual Studio for Applications" that seems automatically installed once the SSIS template is installed. (Business Intelligence Project > Integration Services Project Template to be exact)

I even confirmed this by showing him how it opens perfectly in code-view even without C# or VB.NET installed (we already have C++ / the SSIS templates on our machines for VS 2005).

Thursday, February 7, 2008

Google Custom Search Engine (aka CSE)

Custom Search

Google and Microsoft search engines now offer a neat feature that allows you to setup a custom search engine that is limited to a specific set of sites. Here are the links to both options:

Google Custom Search

Live Search: Macros (Why is this so hard to find in Live.com Maybe its just me...)

Google Custom Search & This Blog

Today I decided to add this search feature to my blog (as can be seen implement at on the top-right of this page). I have used CSE before and was quickly up and running. For configuration I added only my site to the "Included sites" list and configured the search engine to "Search only included sites" mode.

While this configuration worked and only returned my site in the  results it did do something I HATE about searching blogs, the front page was returned as a result item.

Why Do I hate this? Because typically the front page is a moving target. All posts have their own pages, but the front page changes each time someone posts, while the individual links stay fairly static. This is very frustrating especially when Googling for something only to find that the link it should be on does not have it, as other content has pushed it down but Google has not caught up. I can also think of good reasons why this is not something Google can easily fix, but it bothers me nonetheless.

Personally id love to turn off "front page searching for blogs" in some sort of setting, but no such setting exists yet :(.

Giving this problem some thought I came up with a work-around for my own blogs search engine. Here is a screenshot of the "Sites" tab in my CSE:

image

In the example above I have added the root URL of my blog as an excluded site, while leaving the same URL on the included sites list. This does exactly what I expected, it returns only the actual individual post pages ignoring the front page.

While few could benefit from such a configuration I do believe this technology in general is excellent and the flexibility in CSE is fairly impressive. Check it out for yourself!

Tuesday, February 5, 2008

The Software Architect - Man of Mystery

I am a big fan of Hanselminutes, a podcast by a Microsoft employee focusing on topics related to developing software on the Microsoft Platform. His show often features very interest personalities and episode #90 was no exception as it focused on Dan Appleman, a famous writer and now consultant in the .NET space.
 
The show touched many interesting subjects but the quote: "The job of a Software Architect is to keep the project from failing" really stuck in my head. This one line holds much significance to me as I have always believed that Software Architecture was more then UML diagrams or pushing a particular technology. Instead I believe the concept represents all facets of a solution that simply includes the design as one of those element. The show once again reflected this detail in the following quote:
 
Architecture is not design, instead design is a subset of Architecture. Architecture is the full life-cycle of the problem
 
Honestly it felt good to have two people I look up to in the industry speak about Architecture in the way I have always seen it. It has been my very unfortunate experience to see many projects fail because the Architect and designers above me didn't add the needed value their positions allowed for. Instead I have seen people muddled in the kinds of irrelevant details that sweep up good intentions and lead to destroyed projects.
 
The reality is projects don't typically fail from bad technology, architecture or people. Instead they fail because of bad specifications, poor direction, bad design, poorly trained engineers and/or management. Software Architects must try to prevent this from happening and simply use the power of talking and thinking about the problem instead of heading towards an aimless goal
 
Again this quote says exactly what I am thinking, all of these areas above are the key to any projects success. Technology is important, but as an example even something as mundane as a poor initial direction can destroy a project in the end no matter the technical innovation.
 
In closing I will once again reflect something I hold extremely true: If you don't find a way to add value as an architect to your business or customers then you will not bring anything different to the table then an out source company can do (and can do it cheaper). This is yet another key mind set to be in, the global economy has changed things and we need to step-up.
Solve the problem, save the customer money, make the solution maintainable and the referrals will make up for the immediate losses
 
Scott referenced this as "Architecting for referrals" which is something all Architects and consultants should strive to do and is the prefect closing to my thoughts in the subject.
 
As always, I look forward to any comments.
disclaimer: The word quote is used loosely above, please listen to the show (episode #90) for yourself to get a word-by-word transcript

Monday, February 4, 2008

IIS 5.1: Unexpected error 0x8ffe2740 occurred

errorToday for the first time since I had rebuilt my home machine something I was developing accessed my local IIS 5.1 instance (running in Windows XP sp2). Normally I would use IIS very often but recent events have kept me away from web development.

In this particular case I was not even doing real web development, instead I was experimenting with the Publish feature for ClickOnce publishing options of Windows Applications. Something seemed odd as trying to publish would lock up Visual Studio, so I decided to investigate if IIS was even working properly.

I entered Internet Information Services MMC and noticed IIS was not started. I attempt to do so manually and got this error:

Unexpected error 0x8ffe2740 occurred.

My gut told me, something must be running in Port 80. From experience strange errors in IIS tend to be related to such a problem (as two applications cannot run on the same local port due to binding issues).

As my next step to confirm this I entered the event log viewer and found the following problem reporting by W3SVC (W3SVC is IIS), here is a screenshot:

error in event log

Notice the words "service could not bind instance 1", this confirmed what I had suspected. I immediately went into web site properties and changed port 80 to 81. The service now started just fine.

To be thorough with my assumptions I also Googled the original message and found the following KB article that supports my thoughts behind this problem, here is a link:

http://support.microsoft.com/kb/816944

Tomorrow I will spend a few minutes and figure out what has taken over port 80 as id like it back for IIS.

smile_teeth

Dependable Software, Unbeatable Prices!

Certainly everyone's profession has a tool-belt of essential items and Software Engineering is no different. While between Visual Studio and Windows itself Microsoft provides some great out-of-the-box tools and extensions it is still useful to install additional free software that will extend your experience.

What follow is a partial list of my own essential applications:

 Paint.NET

image

Sooner or later most IT professional have to modify or create graphics files. Photoshop has long been the dominant application in this area even for simple operations (but has always been overkill). Paint.NET changes this landscape and provides an amazing alternative.

Paint.NET was created by Rick Brewster and a team of dedicated contributors. This package has many of the powerful features available in professional software but with one big advantage, its free and quick to download.

What also interests me is that it is built in .NET, which makes a great demonstration of .NET technology. I now use this software exclusively for all my image editing needs.

Firefox

image

First I want to express that I am a BIG fan of Internet Explorer, and 7 is a very nice step forward including things such as Tabbed Browsing.

That being said Firefox cannot be avoided and many times comes in very handy.

One Example of its usefulness: I recently started experiencing strange locking issues with IE7 and GMAIL and until I can resolve it Firefox is providing a problem-free environment for me to continue accessing my email.

Also if you design webpages you should definitely test them with Firefox to insure they display and function correctly as this browser has fairly good market penetration.

Windows Live Writer

writer_screenshot

If you write blogs on a Windows machine and don't use Live Writers then your definitely missing out. This powerful word editor for blogs is an amazing (and free) piece of software.

I give this tool full credit for helping me lunch my own blogging adventure by making it possible without all the horrible user experiences I had with web-based WYSISWG publishing editors.

From inserting images easily to spell checker to actually getting formatting right after publishing, this tool does it all.

.NET Reflector

image

If you program in .NET this is a tool you should be familiar with. One of the big advantages (and security disadvantage) of any component or executable built in CLR is it can be de-compiled. This simple but effectively utility allows you to do so in a graphical interface and can be very handy to see what is actually going on inside of an assembly.

Play with this tool yourself and you will be very impressed in how detailed of a view it can give you.

(If a component is obfuscated this program wont work as far as I know)

PIDGIN

imageYahoo, MSN, AIM, Gmail, the list goes on. Instant Messaging is huge and the amount of options is overwhelming.

Luckily software such as PIDGIN allows you to integrate all of these messaging services into one GUI, making it all bearable. Other software exists to do the same (such as Trillian) but this product is free.

I personally use PIDGIN to stay in touch with all my friends without running a dozen IM clients on my machine without issue.

SourceGear: Diffmerge

imageSooner or later most engineers need to compare two files side-by-side for differences. Many packages exists to do this and Diffmerge is one of these products. From my experience Diffmerge compares files very efficiently and is totally free.

 

For more great software options for developers I recommend you guys check out Scott Hanselman's comprehensive and famous Tools List. I look forward to any additional suggestions as reply to this thread.

Friday, February 1, 2008

In case you missed it - Recent News

These two stories are definitely worth any geek's attention:

 Microsoft bids $45 billion for Yahoo

2008-02-01t115429z_01_nootr_rtridsp_2_news-microsoft-col

While Yahoo would immediately add to Microsoft's eye-ball count, I am somehow skeptical on the long-term benefits. Acquiring such a large company is NOT going to be easy and Yahoo could very quickly turn into a drain on the company they will have a hard time shedding.

Also lets not forget the competition that already exists between Microsoft current products (which they are pushing strongly) and Yahoo offerings. Does one side get abandoned?

 Cable Break Causes Wide Internet Outage in Asia and Middle East

ALeqM5jbmJSjDdZN_S9ac7cCholmiHsyvA

What can I say here, don't leave all your eggs in one basket? But seriously, we should never forget how fragile the Internet is.