remote desktop using both monitors without additional software

Liam Westley had a very interesting post today where he mentioned using the /span property on mstsc (Remote Desktop client) to enable dual screen remote desktop.  One of the things I hate about remote desktop when I connect to my work machine is that I can only use one monitor, this solves the problem.

To activate this, you need to run mstsc from the command problem:

C:WindowsSystem32mstsc.exe /span

More information can be found on technet where it says the switch “Matches the Remote Desktop width and height with the local virtual desktop, spanning across multiple monitors if necessary”

One annoyance, any window with the position set to centre screen will end up in the split between my two monitors.

Hope you find it useful…

Technorati Tags: ,

Entity Framework Tools – Refreshing model with schema changes

image One of the main problems with Linq to SQL was the fact that you couldn’t easily refresh your diagram to take into account schema changes.

I was really pleased to see that in the Entity Framework tools they have the ability to update model from database.  Simply right click the NorthwindModel.Store in the Model Browser and click the option to update.

You then have the ability to Add, Update or Delete items from your model.

image

However, not all is same it seems….

I created a model with all the tables from my database. I then later went back and removed all the entities apart from Customer, Order and Order_Details. After selecting to update my model, I unticked the Add checkbox as I didn’t want anything being added.  I then wanted to uncheck the other tables which I wasn’t interested in but got the error “Items for update and delete cannot be checked or unchecked”, this was a bit odd but fair enough.

So I clicked finish and it added all of the removed entities back into my model!  Not what I expected to happen at all.

To make matters worse, the column I dropped was still in my table! I tried to add a column and that didn’t appear either until I deleted and re-added the table.

Anyone have any ideas on the expected behaviour of this feature??

Entity Framework – New model wizard closes when generating from database

Tonight I was taking an in-depth look at the Entity Framework bits.  After creating my C# console application, I went to add the new ADO.NET Entity Data Model. After adding the item, I selected that the model should contain objects generated from database.  After clicking next, the dialog closes – not great!

Next step was to generate the model manually, however this also gave me a type initialise exception,  finally after closing VS2008 it crashed and gave Vista’s lovely error reporting messages.

The solution was a quick reinstall of the Entity Framework Tools CTP 2 soon shorted it out, it either didn’t install correctly or I didn’t install it (which is strange as I had the templates installed inside VS). 

DDD Ireland

If you haven’t heard, there is going to be a DDD Style event in Ireland called – wait for it – DDD Ireland.  Most of the agenda is now on the site, I will be going over to do my Red Green Refactor! session.

Abstract:

“Starting to unit test your first project is difficult, where to start? What to test? How do you even get started? In this session, Ben starts from scratch and implements an ASP.net 2.0 application using test driven development techniques. The application will have to deal with real world situations such as databases, web services and even some users! Ben will demonstrate how to design the application for testability and how unit testing and mock frameworks can make your life easier and your tests less fragile. At the end, will the tests go green?”

Should be a great weekend, can’t wait! Hmm, will this class me as an international conference speaker? :)

Site – http://www.dddireland.com/

Technorati Tags: ,

ReSharper 4.0 EAP – First nightly build 729

image EAP for ReSharper 4.0 is open so I thought I would post my initial impressions. On their blog, the announcement adds this comment:

That is, not fully fledged tool, but rather our current development bits. Which could be very well broken, buggy, hanging, slow and useless at times. We will not take any responsibility if the tool wipes out all your source code!”

You have been warned.

Download it from here: http://www.jetbrains.net/confluence/display/ReSharper/ReSharper+4.0+Nightly+Builds

The release notes contain information on all the current features:

http://www.jetbrains.net/confluence/display/ReSharper/ReSharper+4.0+EAP+Notes

Linq and partial methods are not currently supported, but the other features still make this worth it.

I initially installed this as an upgraded from 3.1.  Sadly, my 3.1 License is not acceptable as I got it before 20/12/2007 so I have to use the 30 day free evaluation. Not sure what is going to happen after 30 days with the EAP? Addin loaded, everything seems to be working.

Running over the menu’s I notice two new features, Profile Unit Tests which I guess will link into dotTrace – I wonder if this will profile the code being unit tested, or the unit test themselves…. I don’t have dotTrace installed so this option was disabled :(

In the options, they now also have Code cleanup profiles which are executed via Ctrl+E, Ctrl+C.  This allows you to define rules based on how you want to clean up your code (remove this, reformat code, optimise using etc).  Nice to be able to do this via a single command.

Various improvements to Intellisense improvements, it now understands var and Extension methods are detected and work well.

Annoymous types support is included. Given this code:

var o = new {Values = new string[] {“One”, “Two”, “Three”}};

If I put my cursor just before new, I get the option to create a named type.  This creates internal class of the class of your method:

public class AnonymousClass
{
    public string[] Values { get; set; }
}

public void Test()
{
    var o = new AnonymousClass() {Values = new string[] {“One”, “Two”, “Three”}};

You can also view view recent edits (Ctrl+shift+,) which then tells you the classes and methods you have recently changed and allows you to go to them which is cool.  Not sure if this is new, but it’s cool and I only just found it.

However, it’s not prefect. Couldn’t find any help, lucky I did find the release notes which answered all my questions.

  1. One or two bugs – http://www.jetbrains.net/jira/browse/RSRP-58041 After a while I just told it to ignore this exception as it was annoying me. (NOTE: This has been fixed in build 730 – the joy!)
  2. prop shortcut is not there for creating automatic properties.
  3. Automatic Properties doesn’t appear to be great,  didn’t tell me at various points when I expected to such as the following code.  Would have expected it to offer me to convert them for me. 

public string name;
public string address;
public int Age { get { return age; } set { age = value; } }

I’m sure there is more, but this is a good first build.  Can’t wait for some more…

Technorati Tags: , ,

Project White: Automated UI Testing

After using WaTiN, I have been thinking about UI Testing for WinForms, if it’s possible and if it’s even worth it. On the MbUnit mailing list I posted some syntax for an approach to WinForms and I had some good ideas, I brought up the subject again at Alt.Net.UK and while people have had success using WaTiN, they didn’t seem that interested in WinForm testing. I know others had been talking about WPF Testing during the day and problems with it.

As it happens, I read on Jeremy Miller’s blog that Thoughtworks have released ‘Project White’ which is a UI Testing framework for WPF, WinForms, Win32 and SWT (Java) and works based on Microsoft’s UIAutomation library and windows messages. Sounds promising so I decided to take a closer look, this post just discusses me playing around with the framework and a simple form to get an understanding of how it works.

Firstly, I created a standard Windows Forms application with just a single form. First test – does it display?

The form looks like this:

image

Using White and MbUnit, the test looks like this:

private const string path = @”……White_HelloWorldbinDebugWhite_HelloWorld.exe”;
#1 [Test]
public void ApplicationLaunch_NoArgs_Form1Displayed()
{
Application application = Application.Launch(path); #2
Window window = application.GetWindow(“Form1″, InitializeOption.NoCache); #3
Assert.IsNotNull(window);
Assert.IsTrue(window.DisplayState == DisplayState.Restored); #4

application.Kill(); #5
}

#1 We need to define the path to our executable. This is fine if you know your always going to be building into the same folder (both test and live assemblies), bit difficult when you have separate output directories.
#2 I then use White to execute the exe
#3 Once the application has launched, we get the form displayed as an object. This works based on the form’s title – in this case, Form1
#4 I then check the Window state to see if it has been displayed
#5 Finally, I close the application.

That’s a very basic test. Let’s add some functionality and explore the framework in more depth. What happens if the framework cannot find the form?

[Test]
[ExpectedException(typeof(Core.UIItems.UIActionException))]
public void ApplicationLaunch_NoArgs_Form2NotDisplayed()
{
Application application = Application.Launch(path);
Window window = application.GetWindow(“Form2″, InitializeOption.NoCache);
application.Kill();
}

White will attempt to find a window called Form2, if the timeout expires it throws the UIActionException. This is the same if it cannot find a control on the form.

To make this more interesting, I created an additional form with some buttons and labels.

image

The first button has a simple action, when you click it the text of the button changes to be Hello World!!. We can then create a test for this as follows:

[Test]
public void ButtonClickable_btnClick1_ChangesText()
{
Application application = Application.Launch(path);
Window window = application.GetWindow(“White Hello World”, InitializeOption.NoCache);



Button button = window.Get

Alt.Net.UK – Post Conference Roundup

This weekend was the Alt.Net.UK conference in London and I’m really pleased to say that it was a huge success.  A huge thank you to everyone who attended, I think the official count was 53, as it was you guys who made it the success it was.  Another huge thank you goes to Michelle, Sam and Danni from Conchango who was on hand throughout the day providing food, drinks and generally being great!  Another huge thank you to Red Gate who put money behind the bar on the Friday night and providing three licenses for the .Net Developer Bundle, CodeBetter for sponsorship and finally TypeMock and Roy Osherove who provided three licenses for Typemock Isolator Enterprise Edition.

altnetboard On the Friday, the evening started with a quick welcome and everyone introducing themselves to the group, it was great to see such a wide variety of backgrounds and technology sectors.  After everyone had been introduced, people suggested sessions which they would either like to attend or would like to speak about.  Most of the sessions where based around MVC, Rest, TDD, ORM, DSL so had a good mix for everyone to get stuck into. In total I think we had about 80 sessions suggested with some topics which I really wasn’t expecting, but interesting non the less. All of the sessions where put on post-it notes, stuck onto a whitewall and generally put into loose categories.

Photo by Mike Hadlow – http://mikehadlow.blogspot.com/2008/02/altnet-uk.html

After this, we went to the bar.  This was a great chance to unwind and get to know everyone in an informal way.  There was a great atmosphere, the tab lasted a while and everyone appeared to be really enjoying themselves and have some great conversions over a couple of beers.  I had some interesting chats with Red Gate users, what they like and areas we could improve. A very good night indeed.

Saturday was the main day of the conference. I had a little trouble getting started due to one to many beers the night before (Will I ever learn?), but all of the sessions where allocated rooms and time slots, a quick cup of tea and we broke off into sessions.  The conversation quickly got started and everyone was sharing their views on topics such as REST vs SOAP, IoC, TDD, Dynamic Languages and coding standards. Though out the day there was an amazing buzz, everyone seemed to be enjoying themselves while in the breaks I had a good chat with various people around the place on some really interesting topics. From the people I spoke to, everyone said they had a great day and were really pleased that they had the chance to attend.  Once it was over, we went to another bar to continue the conversation.

The conference will never be a replacement for the more traditional events such as DDD, but it’s great to have a chance to sit down with like mined people, have a few beers and talk about what’s important to you and just see what everyone else is doing.  I had an amazing weekend, really enjoyed meeting everyone and I’m really happy to have been a part of it.

As for when the next one is, well you will just have to subscribe to my RSS to find out…

News River – http://newsriver.altnetuk.com/

Google Group – http://groups.google.com/group/altnetuk-discuss?hl=en

Conference Wiki – http://www.altnetpedia.com/London%20Alt.Net.UK%202nd%20Feb%202008.ashx

Technorati Tags: ,,