Wednesday, September 14, 2011

Windows 8... what's the point?

So I'm one of the few .5 million that downloaded win8.

"I get what Microsoft is up to, after getting pounded the last 6 years for not having a touch capable operating system to run on phones & tablets, they are finally trying to show they can remain relevant in the consumer space".

So I braved the technology preview, installed it to a VHD, suffered tears and blood, found some problems with the object located between the screen and the chair, but I finally succeeded. And as promised, the experience windows 8 delivers is definitely up a level from its predecessors.

However, as I let it all sink in and head to sleep in my comfy bed, I get this overwhelming feeling that says. So what was the point?.....

Let me explain myself, though I get all that Microsoft is doing to stay relevant, neither the new Metro UI nor the base operating system deliver anything that has not already been done before. And for all their bells and whistles, I feel it is all extra baggage.

The more I think about it, the more I think that Google got it right, all we need today both in the corporate and the consumer space, is a web browser.

Goognight.

Monday, July 25, 2011

Enterprise Deployment Scenarios with VS2010

Figured I'd share this information and suggest that if you are working in an enterprise environment and are doing deployments for asp.net the old fashion way. You start following Vishal and comment on his blog as he will be putting some good info out on how to do Enterprise Deployments with VS2010.

http://vishaljoshi.blogspot.com/2011/07/documenting-key-end-to-end-deployment.html

Monday, February 28, 2011

The Social Enterprise

I'm sure that at one point or another Microsoft and will do what they do best, copy catch up with facebook and bring some of that social goodness to the enterprise through their Sharepoint Collaboration Platform. In the mean-time how about taking a look at some of these abuzzing platforms that are bringing the Social Enterprise to a Corporation near you now.

yammer.com
Chatter
Jive
Cubetree (SuccessFactors)
theFlowr

Thursday, February 24, 2011

New Opportunities

It's been a bit hectic as of late. A lot going on in both my personal and professional life. But, it can be summarized as follows.

New Apartment + New Car + New Job = New Opportunities

As things settle down I'm sure I will ramp up once again on posting. For now, I'm back to finding the right paint for my closet interior...

Tuesday, February 1, 2011

TFS Excel Reports Date Filtering Resolved

Back in September of last year I blogged about an issue I was facing with the task burndown excel report and workbooks that ship with TFS. http://thebasilet.blogspot.com/2010/09/tfs-2010-task-burndown-excel-report-not.html

Brian Harry & Aaron Bjork from Microsoft were very helpful in lending their help to troubleshoot this issue. However, until last week we were ready to give up hope. That is until I stumbled upon the solution thanks, to some comments Aaron made.

Here's the deal, the excel filtering issue I was observing from TFS is actually a bug in Sql Server 2008R2 Analysis Services and is described here
http://support.microsoft.com/kb/982850/


It can be resolved by applying one of the Cumulative Updates on Sqlserver2008r2.
http://support.microsoft.com/kb/981356

Wednesday, October 27, 2010

TFS 2010 Team Build & ClickOnce Deployment

***Update***
Here is the template, if you'd rather just use it.



************

If you've searched and searched for an out of the box solution to deploying Click Once applications using Team Build 2010 you are in for some disappointment. There isn't one.

However, here are 5 easy steps to get this working. There are multiple ways to achieving a workable solution, have in mind that this solution worked for me, but might ultimately not help you. YMMV

The default build template works something like this.


It downloads the source code from the TFS server into a local agent workspace. It then executes a build using msbuild.

The solution I came up with introduces an extra step between download and compile to introduce configuration management (Production config file vs Test config file, etc). I also hijacked the compile sources step and induced msbuild to publish the click once app. So it will look something like this. The following blog post will come in really handy http://www.ewaldhofman.nl/post/2010/04/20/Customize-Team-Build-2010-e28093-Part-1-Introduction.aspx


Pre-requisites

Install a codesign certificate under the local profile of you build service account.

Step 1 New Template

Create a copy of the default build template. I called mine ClickOnceDeploymentTemplate.xaml.
The default build template is checked into your source control repository under
$[Team Project]\BuildProcessTemplates\DefaultTemplate.xaml
After you've created a new template don't forget to check it in. Let us verify that it works by using it in one of our own build definitions. Step 2 Add some parameters

I followed Part 2 of the blog post series linked above and added a couple of new parameters to support what I had in mind.

PublishDir : This is the unc path to the location where you want to publish the app
PublishUrl: This is the url the .application file will use for the install/update fields
SourceConfigFile: Version control path of app.config file you want to replace for deployment
DeployConfigFile: UNC path to the app.config file you will use for deployment
ManifestCertificateThumbprint: This is the sha1 hashcode of the codesign certificate that is locally installed under build service account profile.

You can verify the parameters by refreshing the build definition you saved.


Note: If you want, you can add some meta data to your parameters so that they display better in the build definition dialog box by opening the metadata parameter

Step 3 lets find the config file we want to replace

Locate the "Get Workspace"activity. This activity is responsible for downloading the source code from the version control repository. It is located under:
Process > Sequence > Run On Agent > Initialize Workspace

a)
We need to add a variable named LocalConfigFile. This variable will hold the file path to the local app config file on the build server.
b) We will also add a ConvertWorkspaceItem activity. This new activity will convert our version control path to the config file specified in our SourceConfigFile argument to a local workspace path held by the LocalConfigFile variable.

Step 4 lets replace it

We will need to add an invoke process activity to replace the app config file from our DeployConfigFile argument. To the location pointed by our LocalConfigFile variable.

Step 5 Publish

We will hijack the compile step of the template to tell msbuild to publish and sign the click once app. To do this we must first locate the "Run MSBuild for Project" MSBuild activity. It is the last activity before the tests are run. The path is too long to even try and write out. We will edit the CommandLineArguments property of this activity. We will replace its contents with the following:

String.Format("/p:SkipInvalidConfigurations=true {0} /Target:Publish /property:PublishDir={1} /property:PublishUrl={2} /property:InstallUrl={2} /property:SignManifests=true /property:ManifestCertificateThumbprint={3}", MSBuildArguments, PublishDir, PublishUrl, ManifestCertificateThumbprint)



What we are essensially doing is telling msbuild to go ahead and publish the app to the specified publish directory and sign it with the selected certificate. Save this template and you are done.

Tuesday, October 19, 2010

TFS 2010 Excel Report Dashboards Error: "Unexpected callback response! 400 Bad Request

Recently while migrating some Team Portals to a new Sharepoint Server, I started receiving the following error when accessing the excel report dashboards:

"Unexpected callback response! 400 Bad Request
Bad Request - Request too long"


There is a blog post by Grant Holiday http://blogs.msdn.com/b/granth/archive/2010/08/13/sharepoint-2010-error-http-error-400-the-size-of-the-request-headers-is-too-long.aspx that describes the error.

The original cause for the error is linked from his blog and it is somewhat of a mind stretch to understand. But from a practical point, the error was occurring due to a difference in setup between our old sharepoint server and the new one. The old server was using NTLM and the new one had been configured for kerberos.

Wednesday, September 29, 2010

TFS 2010 Portal Customization Warning

If you are customizing the SharePoint portal for TFS 2010 here is a small warning/tip.

If you are dealing with the "Work Item Summary" web part beware that if you rename the underlying team query for it.

IE8 will become unresponsive, prompt weird error messages, and your team portal will refuse to load again. A colleague of mine experienced this issue this morning, and we were scratching our heads for a bit before finally arriving at a solution.

TFS 2010 Task Burndown Excel Report not showing any data?

This is a quick tip to those of you that are struggling to get any data to show up onto the Task Burndown excel report in the TFS agile 5.0 dashboard.

For some reasons unknown to me, the date filter on the "Date" row label is filtering all dates, even though it is configured to filter "This Month."




I was able to select the dates I wanted without the filter and show the report however that was still a little frustrating.

To fix this instead of using "Date" dimension for the row label is used a "Date Set > Last 4 Weeks" which has a similar effect to "This Month"

Thursday, July 1, 2010

Intersection of NUnit . MSTest and ONEWAY>

So here I am going down the TFS road and get to the intersection of MSTest and NUnit. I have always taken the NUnit road, but the MSTest road looks promising. So I start going down that path but soon realize, that only the entrance was pretty and everything else, road, sidewalks, buildings were in bad condition.

Let's stop talking figuratively, MSTest as an unit framework is still lacking compared to NUnit. Most of its value actually stems from the native integration with TFS. I was poised to make the roadtrip back to the intersection when google and some smart people came to the rescue.

http://alsagile.com/archive/2010/03/09/stop-the-war-between-nunit-and-mstest-make-them.aspx

Thanks to this link, I was able to continue using the awesome syntax I'm used to and take advantage of microsofts MSTest integration to TFS.

Wednesday, June 9, 2010

the 2010 Batch

I was recently tasked with bringing up a installation of Team Foundation Server 2010 here at work. I believe we have now navigated most of the technical roadblocks and are moving ahead just fine.

When I started this task I expected like any other Microsoft software. TFS would have dependencies with other MS technologies. What I had not realized is how much more dependencies the 2010 batch of technologies has than any other previous incarnation.

Take this as a cautionary tale dear reader. If you are embarking in the adoption of the any 2010 batch of MS technologies, be aware that they work best with one another and not so much across the year barriers.

Tuesday, March 2, 2010

It takes a lot to Wow6432Node me

For those of you that recently have switched over to a 64bit Windows OS. I'll make it short. If you are trying to look at registry keys using Microsoft.Win32.Registry class. You will find that the code that used to work on 32bit machine will no longer work.

Take this for example if you are looking for a key on the following path
HKLM\Software\foobar
You will not find it because it will actually be searching the path below.
HKLM\Software\Wow6432Node\foobar

I'm sure there are tons of reasons (good reasons at that) of why things were done this way. I don't really care, this code smells.

Monday, December 14, 2009

Darwinian Economics ;)

When Darwin proposed his theory of evolution and survival of the fittest he was right in more than one way. In today's market the only businesses that survive are those that are able to adapt to the uncertain economic conditions. In such an environment we as IT Professionals share a similar fate, we must be fast, agile & able to adapt. For, it is us the IT professionals that must support the constantly changing aspects of the business. It is with these thoughts in mind that I've continuously worked towards developing those traits that would allow me to be agile and effective under any circumstances.
As a Software Architect and Technical Lead, I've tried to position myself in a way that allows me to be quickly effective in a variety of projects. Jumping from the project a to project b and now to project c, here are some of my thoughts regarding what the those traits needed for such an environment are.

1. Thinking of Reusability: When I take on any project, I always think to myself how do build it so that I can leverage it in the future. It is with this idea that I've been able to accumulate a framework and a set of proven patterns and practices that allow me to hit the ground running when I approach new projects.
2. Taking the Initiative: One of the challenges that comes with reusability is that reusability lends itself to stagnation. Therefore to avoid this fate, I'm always taking the initiative in adapting the frameworks, patterns and practices I've developed to newer technologies and patterns that would give me greater reusability.
3. Building the Right Team: Having the right team is as critical to the project as having the business requirements. Without the right team, any project would be in jeopardy. So what makes the right team? To me the right team is built around trust and mutual respect. It is composed of team members that I would trust to make the right choice in my stead. Hence, when I conduct interviews I rarely focus on candidate's particular skills. Instead I'm always focusing on the choices he would make.
4. Scope Management: When it comes to achieving success and raising the victory flag it is important to know what it means to succeed. Defining a scope that allows you succeed is what I've been stressing we strive for in the projects I've worked on. The correct feature set that gives the biggest bang for the buck to the business at the right time is what defining scope is all about.
5. Agile Development Methodologies: Agile development are methods that I've tried to follow in order to gain the most and mitigate risks associated with a changing business. These methods include the focus on building bench strength and communal ownership from the beginning of a project, as well as a focus on iterative delivery of small feature sets. The methods allow for more accurate estimation of feature delivery as well as providing the ability to shift focus should the situation arise. It also plays in very nicely with our maintenance transitioning strategy and operational risk countermeasures strategies because bench strength and communal knowledge are at the core of Agile development.

Friday, November 6, 2009

Entity Framework & Lazy Loading

For the last 2 years I've read and read the EF team swearing by their design decision to turn lazy loading off by default. Heck they even went the extra mile to change the name and obscure the option (Deferred Loading anybody?).

I just found out, that the latest CTP has lazy loading on by default and guess what? it is actually called "Lazy Loading"...

I don't know about you, but I find all this somewhat irritating. Albeit, a bit vindicated. :D

Thursday, July 30, 2009

NHibernate, Oracle & Clobs

If you are starting to work with NHibernate and Oracle you will definitely go through a lengthy stressful process of denile, understanding and acceptance.

So here I will share a bit of knowledge that will make that process a bit less stressful.

If you are working with clobs/nclobs and oracle you may or may not have encountered the following error when using the microsoft provided system.data.oracleclient

ORA-01461: can bind a LONG value only for insert into a LONG column

This error is not very helpful and goggling it will most likely result in topics regarding oracle patches and the like. In reality this is a bug with the microsoft oracle client driver. The driver mistakenly infers the column type of the string being saved, and tries forcing the server to update a LONG value into a CLOB/NCLOB column type. The reason for the incorrect behavior is even more obscure and only happens when all the following conditions are met.

1. when we set the IDbDataParameter.Value = (string whose length is : 4000 > length > 2000 )
2. when we set the IDbDataParameter.DbType = DbType.String
3. when DB Column is of type NCLOB/CLOB

Unfortunately NHibernate 2.0's default behavior is to do exactly the above, making it quite more likely to run into this ugly bug when using nhibernate and oracle.

It is also unfortunate that the issue has indeed been raised with the NHibernate community but has been closed as external. http://nhjira.koah.net/browse/NH-465

I pretty much figure that since Microsoft has decided to pull their driver from the .NET framework in the future, they wont fix this external issue, so it becomes the burden of the developer to work around this ugly bug. So without much further ado here is the way I've gotten around fixing this issue.

I created a custom driver and inherited from the Oracle client driver where I override as follows.

/// <summary>
///
Initializes the parameter.
/// </summary>
///
<param name="dbParam">The db param.
///
<param name="name">The name.
///
<param name="sqlType">Type of the SQL.
protected override void InitializeParameter(System.Data.IDbDataParameter dbParam, string name, global::NHibernate.SqlTypes.SqlType sqlType)
{
base.InitializeParameter(dbParam, name, sqlType);

//System.Data.OracleClient.dll driver generates an exception
//we set the IDbDataParameter.Value = (string whose length: 4000 > length > 2000 )
//when we set the IDbDataParameter.DbType = DbType.String
//when DB Column is of type NCLOB/CLOB
//The Above is the default behavior for NHibernate.OracleClientDriver
//So we use the built-in StringClobSqlType to tell the driver to use the NClob Oracle type
//This will work for both NCLOB/CLOBs without issues.
//Mapping file will need to be update to use StringClob as the property type
if ((sqlType is StringClobSqlType))
{
((OracleParameter)dbParam).OracleType = OracleType.NClob;
}
}


I will try reopening this issue with the NHibernate commiters and see if it now warrants an update.

Friday, January 25, 2008

Dynamically Extending Objects in C# - Part 1

So you've finished your domain model, it is looking beautiful and performing great, but the business throws a curve ball. They need to add a couple of new fields critical to their needs, and it needs to happen yesterday.

Sure, this is not the hardest thing to do in most applications. Whip out, the mapping files, add the field to the xml, db & object and you are done.

However, this is not always the case. For example, I've recently been working in a system that does a lot of cross schema data manipulation, through batch processes and triggers. What this means is that adding a field is no easy affair. I add the field in a upstream schema/object model and then I modify the routines that move it downstream to the next schema/object model and downstream, and on, and on.

Well the idea here mostly applies to Windows Forms but it could also apply to Web Forms. By making use of the System.ComponentModel namespace, we can extend our business object's meta data at run-time and change the behavior of our databound controls.

In this manner I can add new properties to any existing type at runtime and get these to be automatically picked up by the UI controls bound to that type. Consequently, I can have the plumbing laid out in expectancy of DEFCON 1 type scenarios.

So how does it work?

If you've poked around the System.ComponentModel namespace you've probably stumbled upon this beautiful diamond named TypeDescriptor. It has methods like GetProperties(), GetEvents(), etc. TypeDescriptor basically wraps some of the System.Reflection basic constructs and adds various extensibility points which are used by controls when databinding.

For our purpose I'll concentrate in the GetProperties() method which returns a PropertyDescriptorCollection. A PropertyDescriptor exposes all the basic metadata information about a property like, PropertyType, Name, etc, along with other information like DisplayName and Description. It also has some methods to Set and Get the value of the property for an instance.

So how can we leverage this property descriptor to do our bidding? Let's say for example you have a grid bound to your object. In this case let's say it is an Infragistics UltraGrid (since I know this works in this grid). Let's take a simple scenario and say that I want to change the column names in my grid dynamically. The grid obtains the databound object column names by making a call to TypeDescriptor.GetProperties() and checks the DisplayName for each of the object's properties. Well what I want to do is obtain the name of the columns from somewhere other than the attributes on the object.

public interface IPropertyMetaDataService
{

string GetDisplayName(Type componentType, string propertyName);
...

}

Implementing this interface allows me to get a display name for a type/property name combo.

public sealed class MetaPropertyDescriptor : PropertyDescriptor
{

private PropertyDescriptor innerPropertyDescriptor;
private IPropertyMetaDataService PropService { get { return ... ;} }

public override string DisplayName
{

get
{

string displayName = null;

displayName = PropService.GetDisplayName(

innerPropertyDescriptor.ComponentType,
innerPropertyDescriptor.Name);

return string.IsNullOrEmpty(displayName) ?

innerPropertyDescriptor.DisplayName :
displayName;

}
}
...

}

And, by inheriting from Property Descriptor I can override the behavior of my databound components. Voila, now with a little more boilerplate code I can get my grid to display column names from my PropertyMetaDataService.

In the next part I'll discuss a couple more interesting things that can be done using this technique.

Thursday, January 24, 2008

The road less travelled

A couple of guys have been bugging me @ work to start a blog.

A blog technical in nature, though not guaranteed to be, about many different things that interest me as a developer. I hope this blog will keep company to people that are traveling the same road I am.

So without much further ado, here it is, the first post and first step of many to come (hopefully).