The involuntary designer

Posted Friday, September 09, 2011 9:25 PM | Feedback (1), Filed Under developement Web

In web development design is often the main force driving the project, then comes content, functionality followed by technology. Sure, the first thin the visitors see when they come to a web page is the design of the start page. In 3 seconds the visitor has judged the site by the look and feel of the site. The way the menu is composed, if the information they seek is one of the first things they see, and so on. The first page tells you much about what you can expect of the web site. But what happens after that?

When working with small to midsized projects much effort is put on the design, the look and feel of the site. The start page is carefully put together, and then the main pages are laid out. The designer delivers some pages containing the big picture. Of course the design is flawless, all pictures align, the articles are just the right length, and tables are static and so on. And when you get the designs everything is just perfect, until you start coding. Questions start creeping upon you, first there is just a question like “how do I handle this content if the editor doesn’t provide the content”, in this case you could just not display the control, but then the design may break. Once you tackle that minor design bug you jump right to the next task, a data entry form. Again the designs is beautiful, without error messages or follow up screens, and yes here is when the next question you already knew would come “what should happen if there is an error when posting this form”.

I suppose you already guessed where I’m going. More often than not, designs (and also requirements) are like Swiss cheese, nice and round on the outside but filled with holes when you cut them open. They lack all those things that must be in place for the user to have a good user experience and interaction with the site. So there you sit, in front of your screen, having to make a on the fly design decision, one of those things programmers sometimes shouldn’t be allowed to do.

So how do we get through this? There are several ways to tackle this dilemma; the best would be to educate the designers so that they also take interaction design in consideration when creating the UI. Or even better, to have a designer with web coding background and/or a genuine interest in web. But that’s not always the case.

A quicker one is to have a dedicated and experienced interaction architect. A person that thinks in personas, work flows and creates wireframes for others to follow. A person that creates use cases that follow a red line thru ought the entire design and workflow, and that can be used to test the application with automates UI tests.
The role of the interaction architect is far underestimated, they not only facilitate the work of the designer by giving them a rough canvas to get started from, but they also fill all those holes in the cheese. And when those interaction gaps are filled the work for us programmers get so much easier, not just because all those questions get answered but because we can focus on our part. Create great code, good UI tests and the best part, we don’t have to do the work that someone else would do so much better.

How to resolve Performance counter registry hive consistency check SQL Server 20008

Posted Thursday, February 03, 2011 10:46 PM | Feedback (8),

Today I was trying to install a new version of SQL Server 2008 R2 into my dev box that my current customer has handed me. First of all I need to do an upgrade because when I first got the PC I installed Visual Studio 2008, which by default installs SQL Express 2005. To do an SQL upgrade install you must run the installation from a command prompt and administration rights with this command setup.exe SKUUPGADE=1 if you don’t your upgrade will fail.

Anyway my setup failed for a whole different reason. After doing some next next clicking the setup got to the Setup Support Rules and all checks passed with exception to the cryptic error of Performance counter registry hive consistency check.

This issue seems to affect users with a non English version of the OS. I run a Swedish Windows 7 version. The only way to resolve this issue is to hack the registry. I found these steps from by Scot Ma in a msdn forum.

Use this program to find out what LICD your system have.

Here is the code it uses. If you have the .NET compiler you can create a console application and cpmpile your own.

using System;
using System.Globalization;

namespace CurrentSystemLICD
{
    class CurrentSystemLicd
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Your LCID: " + string.Format("{0,3}", CultureInfo.InstalledUICulture.Parent.LCID.ToString("X")).Replace(" ", "0")); 
            Console.WriteLine("Press any key to exit");
            Console.ReadLine();
        }
    }
}

2) Once you figure out which key it is (my key for my Swedish Windows7 is 01D). Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib and copy the whole 009 folder, edit the exported .reg file and change the 009 value to your own LCID. Then import the edited file.

Open the text value of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\Counter and scroll to the second last line. You will see a number like this, write down the number. This is the Last Counter number the system uses

e.g.:
11838
Cumulative Guest Run Time

3) do the same for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\Help and write down the number. This is the Last Help number the system uses

e.g.:
11839
The guest run time represents the number of microseconds the .....

4) Now go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\Last Counter. Put the number from (2) as the new value of Last Counter

5) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\Last Help. Put the number from (3) as the new value of Last Help

After following these steps I managed to get my installation going.

Good luck!

Web service reference changed when upgrading project from VS2008 to VS2010

Posted Thursday, June 10, 2010 3:00 PM | Feedback (2), Filed Under .NET Web Visual Studio Buggs Visual Studio 2010 Web Services

When we recently upgraded our project from VS 2008 to VS 2010 everything went just fine. The project was converted and the conversion log didn't report any errors. Two days ago we deployed our web application to the production servers, that's when the problems started to show up.
The application couldn't connect to several services. The error was that the Web Reference URL to the services had been changed from https to http. We hadn’t caught this error in our test environment because the https restriction was not there in that environment.
WsHttpsToHttp

So if you have converted a project from Visual Studio 2008 to Visual Studio 2010 and you have any web service references that goes to a https endpoint, be sure to check that it hasn’t been changed to https.

I have filed a bug report to the Visual Studio team at Microsoft, so if you get the same problem go there and vote it up, then maybe we can get a solution to it sooner then later.

EPiServer Community cache notification

Posted Thursday, June 03, 2010 8:08 AM | Feedback (7), Filed Under .NET developement EPiServer Cache notification EPiServer Community

Yesterday we ran into an odd problem with our load balancers. To give you some history, we use EPiServer Community to handle users and store user attributes. The application works in both http and https depending on where on the site you are at the moment.

You can imagine the look on our faces 
huu

We had just deployed our application to a load balanced test environment when the application started to act strange. The problem was that when we saved attributes to a users profile in http the attributes where not updated when going into a part of the site that ran under https. At first we thought that our services where badly configured. As it turned out, we where being sent to different servers depending on the protocol we where using, if we used http we where served by server 1 but when we went to a https page we were served by server 2! The load balancer that should have used sticky sessions was obviously not doing it’s work. But that is a hole other can of worms. That lead us into suspecting that there was a cache not being invalidated correctly. We used the EPiServerRemoteEventsListener tool to check if the  EPiServer Cache notification was running as it should. And it did.

After some digging we found that the episerver.common.config file is the key to all caching goodness. The key parts are the cache section. This section should look the same in all servers that are going to be part of the cache notification network.

<episerver.common>
  <siteHosts>
    <add name="Default" hostUrl="*" connectionStringName="EPiServerCommon" />
  </siteHosts>
  <sites>
    <site hostName="Default">
      <cache defaultProvider="EPiServerCacheExpirationProvider">
        <providers>
          <add name="EPiServerCacheExpirationProvider" type="EPiServer.Common.Cache.CacheExpirationProvider, EPiServer.Common.Cache" />
        </providers>
      </cache>

As all other major bugs, we found ours in a very small but significant part of the configuration

<replication>
  <subscriber serverName="WebServer1" siteName="MySite" port="4123" alternatePort="4321" broadcastAddress="10.130.251.255" />
</replication>

Server 2

<replication>
  <subscriber serverName="WebServer2" siteName="MySite" port="4123" alternatePort="4321" broadcastAddress="10.130.251.255" />
</replication>

It turns out that we had the same value for serverName in all servers. The name is as it says the actual DNS name of the server as you would have called it if you where to remote into it. In the other hand, the siteName attribute should be set to the same value in all servers, the same for port, alternatePort and broadcastAdress,  which by the way we couldn’t find any documentation on whether we could change it to another address, the same goes for EPiServers own cache notification.

Anyway after changing this setting the app started to work as expected. We where still being redirected to different servers on protocol basis but the cache was being invalidated correctly at both servers.

Visual Studio hangs when opening certain files

Posted Sunday, January 17, 2010 11:33 PM | Feedback (5), Filed Under Web Visual Studio Buggs Tips

Today I’ve restarted Visual Studio 2008 some 8 or 9 times, oh, did I say restarted, I meant killed the devenv.exe process. The reason of this is that on every one of those occasions I was opening a .aspx or .master file in my web project, when Visual Studio suddenly freezes and stops responding.
I could explain how I felt but it wouldn’t be suitable for minors reading this.

Since I have never experienced this before and my laptop has an SSD drive my first thought was that some memory banks where getting corrupted. I threw away that thought when I, without any problems could open the same file in Notepad++ and gVim. So it was back to MS.
I finally found an old post from 2009 that hinted that a component installed called "Microsoft Visual Studio Web authoring Component"  could be the crook behind all evil. I actually don’t have a clue of what good this component does, if any, for me it was most bad.

Anyway I uninstalled the Microsoft Visual Studio Web authoring Component and my headache was gone.

!!! The bundled mysql.rb driver has been removed from Rails

Posted Monday, January 11, 2010 12:43 AM | Feedback (12), Filed Under Ruby Rails MySql

So I’m trying to get the Rails rake db:migrate command to work and just getting the same output each time

“!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql."

After tearing my hair, installing and reinstalling the MySQL 2.8.1 gem goggling for answers for an hour I finally found the answer that helped me. The in the reply from by Hao Zhao, he pointed out that the 2.2.2 version of Rails does not support the MySQL 5.x client!

The solution to this is this:

  1. Download an older version of the MySQL client library from  http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll
  2. Copy the downloaded file to c:\Your Ruby install folder\bin


That’s it! I could go mad right now but I’m too happy to finally have found this.

In my case I didn’t have that file at all, thus the “mysql.rb driver has been removed” warning. !It’s not the gem that is missing, it’s the driver! Bad rails bad!
I hope this can help some others in despair.

Btw my system is a Windows 7 x64 with MySQL 5.1, Rrails 2.3.4 and mysql-2.8.1-x86-mswin32.gem

SQL Server Manager select and kill process query

Posted Wednesday, November 25, 2009 3:16 PM | Feedback (6),

Who is hogging the database process? This question can be hard to answer if you don’t have the right tools to view the Activity monitor. I got recently this problem.

SQL is an amazing language and MS SQL server can give you answers to about anything threw SQL queries. The query that answered my questions was this:

SELECT db_name(dbid) as DatabaseName, count(dbid) as NoOfConnections,
loginame as LoginName
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid, loginame

this query will show you a table over the databases, the number of active connections and the logins that are using them. After that you can run another query to kill all connections to a specific database like so:

DECLARE @DatabaseName nvarchar(50)
SET @DatabaseName = N'myDatabaseName'
--SET @DatabaseName = DB_NAME()

DECLARE @SQL varchar(max)
SET @SQL = ''

SELECT @SQL = @SQL + 'Kill ' + Convert(varchar, SPId) + ';'
FROM MASTER..SysProcesses
WHERE DBId = DB_ID(@DatabaseName) AND SPId <> @@SPId

-- SELECT @SQL
EXEC(@SQL)
DEALLOCATE my_cursor

There are some other tricks at http://www.kodyaz.com/articles/kill-all-processes-of-a-database.aspx.

Create GUID tool for Visual Studio

Posted Tuesday, September 29, 2009 9:32 PM | Feedback (15), Filed Under .NET developement Visual Studio

@rewdboy a coworker had a small problem earlier today, he just couldn't find the good old Create GUID application that is packaged with Visual Studio.

The tool has not been removed from the IDE it’s still there. It depends on what development type you have chosen. You may remember the first time you start Visual Studio after installing it prompts you asking what type of development you are planning to do. There are six choices, the one that I know has the Create GUID tool is the Visual C"# Development Settings, If you went with Web Development Settings you are missing this feature.

Import and Export Settings Wizard

There are two ways of getting hold of this nice tool. The first one is to reset all your IDE to the C# Development settings.

To do this just go to Tools -> Import and Export settings and then mark the Reset all settings radio button in the wizard after that you can chose between the settings above.

This may be ok if you have just installed Visual Studio. But if you have been working with it for some time and have customized and tweaked it to perfection you may want to go for the second approach.

And that is to just add the command button to your toolbar. This is probably the preferred way to do this. But it’s not that intuitive. Here is how:

It’s just as you normally would add a tool to the toolbox Tools –> Customize

Tools-Customize

Then we come to the not so intuitive part. The Create GUID tool is hidden as External Command 1. Just drag the control to your toolbar and voala! 
Why they have chosen to hide it this way we may never know. But now you know how to get it.

Tools Customize Commands 

Highlight current line Visual Studio custom theme

Posted Friday, September 18, 2009 4:12 PM | Feedback (5), Filed Under .NET developement Refactoring ReSharper

A nice feature of ReSharper, besides all refactoring goodness, is the ability to highlight the current line. That is the line where the caret is, is highlighted. This makes it so much easier to get back and find where you last left off or where the search result is when searching around in Visual Studio.

If you have ReSharper it’s easy to do this. Just go to ReSharper’s options menu ReSharper –> Options. And from there go to the Editor menu and select “Highlight current line”

image

If you have a customized color theme like I do, then you can change the default highlight color by going into Visual Studio’s own Options menu, Tools –> Options, and then change the Item background color for the ReSharper Current Line.

image

Here is the result for my theme.

image

By the way if you like this theme you can download it from here. It also contains the Dina font by Jørgen Ibsen. A font that is made for readability. The theme is a modded version of Oren Ellenbogen's Dark Scheme.

Enjoy!

Plans are useless, but planning is indispensable

Posted Friday, September 11, 2009 10:41 AM | Feedback (8), Filed Under developement

This is just a short post but with a big statement made by Dwight D. Eisenhower:

“I have always found that plans are useless, but planning is indispensable.”

This statement was valid in that time and is still relevant. We as developers know that there are only three things that are certain in life, death, taxes and changing requirements.

So to remind me I’ve made a small desktop background with this wise words. Grab a copy if you like it.

Plans_are_useless_thumb