The true cost of an outage….

Written by Brad Foley. Posted in General

So, I was shopping around, at work, i know i’m a horrible person. But what i needed was a simple timer light switch for my outdoor lights.

I did a search on Google. I came up with the first link of course being home depot, i click and this is where i end up.

Home Depot Outage

A simple outage display, so i clicked on the link from Lowe’s and purchased my switch. Mind you this is only $40.00, but how many times has this happened???

Upgrading Environments

Written by Brad Foley. Posted in General

Today I completed the upgrade of my VMWare ESXi server from 5.0 to 5.1. This will allow me to run Windows Server 2012 VM’s to test and develop against. I guess I was a little behind the times.

Now on a side note, the environment upgrade was super easy. I simply downloaded the ISO from VMWare, burned it to a disc, stuck the DVD in the drive, and the upgrade went off with 3 key strokes and a bit of waiting. No issues what so ever. Way to go VMWare.

What’s Been Going On

Written by Brad Foley. Posted in General

Well, over the past few months, a lot of exciting things have been happening in my world of Development.

As you may already know, Microsoft has passed along Commerce Server to a new partner, see previous post about that. I have been working closely with the team over at CommerceServer.NET, and I am very excited about things to come. They have a very aggressive road map and have engaged some of their key partners for feedback. I have had the opportunity to sit on several conference calls and have meetings with their product teams and management and it seems there is more drive behind the product now then their ever was before.

So what can I report on the new product, not much, things are changing rapidly, but I encourage those who are interested to keep checking back here for more information. As I receive solid information I will forward it along.

With that being said, I’ve decided that I’m going to split my interests, before I was doing e-commerce both professionally and for fun. I think it burned me out a little bit. So I will continue to speak and offer my public sessions on e-commerce and CommerceServer.NET, however I’m going to start focusing my fun side on my interests in the cloud. I am currently working on some integrations for Commerce Server with cloud components, such as search, n-tier cloud based solutions, and PCI compliant cloud hosting. I will post more on these as I get them operational.

Other than that, things have been going well, and expect to see me back on the speaking circuit soon.

Commerce Server Error 16389 From The Profile Context

Written by Brad Foley. Posted in Commerce Server

I’m just writing this quick little trouble shooter, because there doesn’t seem to be much on the net about it. And I always seem to forget to do it.

So after doing some database restores and moving things around, I always seem to forget to change the profile partition connection string.

It’s quite simple… Open the Commerce Server Manager…

image

Right click on the SQLSource and modify the connection string to where your profile database is actually located.

 

Stack trace:    at Microsoft.CommerceServer.Interop.Profiles.ProfileServiceClass.Initialize(String sConfigStore, String sCatalog)
   at Microsoft.CommerceServer.Runtime.Profiles.ProfileContext..ctor(String profileServiceConnectionString, String providerConnectionString, String bdaoConnectionString, DebugContext debugContext)

Searching a Database for Columns

Written by Brad Foley. Posted in SQL Server

This is just a quick little post on a useful query that I find myself using quite often. It allows me to search a database for a column using a LIKE statement. For example here I am searching the database for all columns (from both tables and views) that contain the word catalog.

select * From INFORMATION_SCHEMA.COLUMNS 
Where COLUMN_NAME like '%catalog%'

Just thought I would Share…

A Simple Method to Clone an EntityObject

Written by Brad Foley. Posted in .NET Development

 

I’ve just come across a problem where I needed to clone an Entity and add the duplicate value to the context only changing one property. I don’t know where I got this from originally, but I’ve made tweaks to it, and it works like a charm.

public static EntityObject Clone(EntityObject entity)
        {
            var type = entity.GetType();
            var clone = Activator.CreateInstance(type);

            foreach (var property in type.GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.SetProperty))
            {
                if (property.PropertyType.IsGenericType && property.PropertyType.GetGenericTypeDefinition() == typeof(EntityReference<>)) continue;
                if (property.PropertyType.IsGenericType && property.PropertyType.GetGenericTypeDefinition() == typeof(EntityCollection<>)) continue;
                if (property.PropertyType.IsSubclassOf(typeof(EntityObject))) continue;

                if (property.CanWrite)
                {
                    property.SetValue(clone, property.GetValue(entity, null), null);
                }
            }

            return (EntityObject)clone;
        } 

This is a simple method that could even be made an extension method. Enjoy!

A Very Simple Introduction to the Task Parallel Library (TPL) in C#

Written by Brad Foley. Posted in .NET Development

So many times I have shunned away from doing Async programming. Most commonly because the programs that I write are simple and needed in a hurry. Even though using Async would have allowed for a better user experience and better performance. I never have been a fan of the current Async programming models, however TPL has caught my eye. So lets look at a few quick examples…

So, in my first example I have two simple web services that get the same data from different sources. Neither is particularly reliable or fast, so what I want to to is to hit both at the same time, and take which ever one comes back first, that way I can provide the best user experience. I’ve done this through a simple console application.

 static void Main(string[] args)
        {
            List<Task> tasks = new List<Task>();
            CancellationTokenSource cancelToken = new CancellationTokenSource(); 

            string result = String.Empty;

            Task t_MethodA = Task.Factory.StartNew(() =>
                {
                    result = Services.GetResultsMethodA();
                    cancelToken.Token.ThrowIfCancellationRequested(); 
                },cancelToken.Token);
            Task t_MethodB = Task.Factory.StartNew(() =>
                {
                    result = Services.GetResultsMethodB();
                    cancelToken.Token.ThrowIfCancellationRequested(); 
                },cancelToken.Token);

            tasks.Add(t_MethodA);
            tasks.Add(t_MethodB);

            Task.WaitAny(tasks.ToArray());
            cancelToken.Cancel(); 

            Console.WriteLine(result);
            Console.ReadKey();
        }

Now for you windows programmers, lets look at a quick WPF example where were doing to do a simple Async call to grab some data, and place it in a text box for the user to later manipulate.

private void button1_Click(object sender, RoutedEventArgs e)
        {
            button1.Content = "Processing...";
            button1.IsEnabled = false;

            Task t = Task.Factory.StartNew(() =>
                {
                    System.Threading.Thread.Sleep(5000);

                }).ContinueWith(o => 
                {
                    button1.Content = "Process";
                    button1.IsEnabled = true; 

                },TaskScheduler.FromCurrentSynchronizationContext()); 
        }

Using this method the user can still access the user interface because the UI thread isn’t locked, and will allow them to update other fields, do other processing, and avoid the “(not responding)” dialog we’re all custom to.

Now something new, because I think retyping is annoying, I’m putting my samples solution on CodePlex located here.

Why Microsoft Was Smart To Abandon Commerce Server

Written by Brad Foley. Posted in Commerce Server

Being a Microsoft Commerce Server MVP, when I got the news that Microsoft was transferring development of Commerce Server to a partner, Ascentium, I was at first a little disappointed. I have been working with Commerce Server for a few years, and have really grown to like the product and its extensibility. So being that I am not a man of many words, lets sum this up into a simple advantage/disadvantage list.

Disadvantages

  • Subscription based licensing (Not a big deal for most companies, but for capital based accounting, not so good)
  • Won’t be covered by Microsoft’s 10 year support lifecycle
    • You’ll have to keep your platform a little more current (I know a lot of sites still using Commerce Server 2000)

Advantages

  • Substantial decrease in cost
  • More aggressive release cycle (I would expect every 6 months or so)
  • Not bound by Microsoft’s development policies
    • We should start seeing integrated components like PayPal, Amazon, etc..
    • Faster releases
    • Better testability with releases
    • Improved delivery format
  • More personal experience for partners and developers
    • When dealing with the non-Giant firms, your relationship is more personal and valuable
  • Ascentium has committed to delivering the product and has a great road map

Reasons

This is only speculative but here’s my take. I imagine several higher ups in Microsoft sat in a room and realized simply that there weren’t many new Commerce Server customers, why?, because the product was becoming dated. So, what to do, this is what I would have done… (And what I believe they did…) Well, we can transfer the development of Commerce Server to a partner, for all the reasons above, and keep a good enterprise e-commerce platform that runs on the Microsoft Stack, and we’ll still get the licensing revenue for Windows Server, SQL Server, BizTalk, and possibly SharePoint. All is all, a good decision on the part of Microsoft, whether it went down this way or not.

Summary

So in summary, while there are few disadvantages, I feel the advantages far outnumber the negative. One key thing that was never listed on either side was customer perception. This could swing either way, many customer are comfortable with the Microsoft product lifecycle and even depend on it. Other customers however, feel that Microsoft wasn’t allowing them to be competitive, falling behind the competition. Being that Commerce Server is still being developed by the same “people” as it was before, the product will be the same strength.

Working With Databases In Visual Studio Without SQL Server Installed

Written by Brad Foley. Posted in .NET Development, SQL Server

When you get the following error after trying to connect to a database in Visual Studio 2010.

—————————
Microsoft Visual Studio
—————————
Could not load file or assembly ‘Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91′ or one of its dependencies. The system cannot find the file specified.
—————————
Simply download and install the following components.

Microsoft SQL Server System CLR Types – http://go.microsoft.com/fwlink/?LinkId=123721&clcid=0×409

Microsoft SQL Server 2008 Management Objects – http://go.microsoft.com/fwlink/?LinkId=123708&clcid=0×409

Microsoft SQL Server 2008 Native Client – http://go.microsoft.com/fwlink/?LinkId=123717&clcid=0×409

I run into this quite a bit when working on client provided developer workstations and they don’t find the need in installing a local SQL Server or the management objects.

The other alternative is to simply download and install SQL Server Management Studio.

ODAC Released with Entity Framework and LINQ Support

Written by Brad Foley. Posted in .NET Development

Oracle Data Access Components Released with Entity Framework and LINQ Support

The production version of ODAC 11.2 Release 4 (11.2.0.3) has arrived for Entity Framework and LINQ developers! It includes 32-bit and x64 versions with the option of using an automated installer or xcopy deployment.

The release incorporates Oracle Database client 11.2.0.3, which can access Oracle Database 9.2 and higher. Oracle supports Entity Framework and LINQ with Microsoft Visual Studio 2010 and .NET Framework 4, including Entity Framework 4.1 and 4.2.

ODAC New Features List