Feeds:
Posts
Comments

Posts Tagged ‘System’


Yesterday I had to change a few assemblies in one of my projects, the website previously mentioned, and when I tried to build I had an error that looked like this:

Parser Error Message: Could not load file or assembly 'BLToolkit, Version=4.0.2.1066, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

So, how to solve this problem? Where can I find the public key?
I did some thinking and asked around a little here at work but no one had any idea. It can’t be that hard, I thought to myself and after googling I quite quickly came to stackoverflow and was quickly led to reflection. What better tool to use than Roeders Reflector? (which I notice is no longer free).

So, I load up the dll in the reflector and am faced with the following:
Find public key by using Reflector

Quite simple really.

Read Full Post »


The setting
At work I got tasked with continuing maintenance and development of a web site. It uses asp.net, runs on .net framework 3.5 and was a horrible mess. All the code is in one file referenced by codebehind in the aspx-file. About 80% of the labels, grids, buttons and other components are named such things as Label1, GridView3, WebImageButton12.

Setting out
When I started I had the above project dumped in my lap. I had not worked with web development before, there was no handover and the one responsible had moved to London (I work in Sweden).
The first weeks I set out to try to understand the application and the incredible amount of noise, inconsistency and redundancy that it contained.
Time went by, I decided to finally get going with Unit Testing and started with reading The Art of Unit Testing to get the theory and some practical examples. After this I thought I was good to get going on Unit Testing and started a little in my own projects in Ruby. But still, there was this small threshold to get over.
Meanwhile I started reading Working With Legacy Code and after getting through the first two chapters I had broken down what little resistance there was left. Now I would get this monster under test.

So, I downloaded nUnit two days ago and started up. Well, I tried. I spoke to my good friend who has worked with Unit Testing for several years. I ran into some problems and asked him and when I said “It’s a website” he commiserated with me. So, I have to break the functionality out of the codebehind-file and test the buisness logic outside of the website and only use the codebehind to put things on the page. Since I’m in the middle of the release rush it’ll have to wait sadly.

However, when the release is over I’m unit testing this thing.

More to come when I get to it.

Read Full Post »


When I started learning Ruby and realized that a unit test framework was already included in the language I decided very quickly to learn TDD and unit testing. As I looked at examples of how to do this in Ruby I came across Autotest, a tool for continous testing. Each time a source file is saved the tests are run. Pretty sweet indeed.

So I guess, in the spirit of Ruby, that it was just to use the line

gem install ZenTest

and then all is good. Automatic unit test runner here I…
Ok, that didn’t work out all that well.

It seems there needs to be a program called diff.exe installed there aswell. Download it here.
Remember to set the PATH so that diff.exe can be found like so:


set path=%path%;C:\Program Files (x86)\GnuWin32\bin\

(replace the last line with the path to your installation).
Also make sure that the environment variables are set in windows.

Set environment variable

I had to restart windows after this to get it to read the path and environment variables and after this autotest worked as it should.

I also like to add the following line in the .autotest-line:

require 'autotest/timestamp'

to get the following timestamp which makes it much easier to keep track of where the reports start and where they end.

Time stamp makes it easier to keep track

A small note: if you happen to get the “Unable to map class XXX to a file” follow the answer that I got from the developer of Autotest (Ryan Davies, thanks for the help!):

You can either rename your files to match the standard or you can teach autotest your naming scheme in your .autotest using Autotest mapping API. `ri Autotest` for more details.

Read Full Post »


There’s no neat and nice way of clearing the irb console as it seems.

There is a way however.

Put the following in a file called utilities.rb.

module Utilities
  def cls
    system 'cls'
  end
end

Then put the following lines into the project where you want to clear the irb console.

require_relative 'utilities.rb'

include Utilities

and use the cls function thus

Utilities.cls

Note: This only works on Windows machines.

Read Full Post »