No Free Time

Because my therapist says I need to let things out

Archive for the ‘Uncategorized’ Category

How to get the screen dimensions across all monitors in WPF

Posted by andrewmyhre on August 21, 2008

I seem to be needing this code in every WPF I start at the moment, so here it is in a nice reproducable form. You need to add references to System.Windows.Forms and System.Drawing in order to do this though. Shame that dependency is required – I don’t see how getting screen information is strictly related to forms, so it’d be cool to be able to do this without requiring the System.Windows.Forms reference.

Anyway, stick this somewhere in your app (I put it in the App class and assign it to a static member):

27 private static Rect GetTotalScreenArea()

28 {

29 Rect screenArea = new Rect();

30 foreach (Screen s in Screen.AllScreens)

31 {

32 if (s.Bounds.Height > screenArea.Height)

33 screenArea.Height = s.Bounds.Height;

34

35 screenArea.Width += s.Bounds.Width;

36 }

37 return screenArea;

38 }

So my App.xaml.cs looks like this:

1 using System;

2 using System.Collections.Generic;

3 using System.Configuration;

4 using System.Data;

5 using System.Linq;

6 using System.Windows;

7 using System.Windows.Forms;

8

9 namespace MyProject

10 {

11 /// <summary>

12 /// Interaction logic for App.xaml

13 /// </summary>

14 public partial class App : Application

15 {

16 public static Rect TotalScreenArea;

17

18 protected override void OnStartup(StartupEventArgs e)

19 {

20 TotalScreenArea = GetTotalScreenArea();

21

22 base.OnStartup(e);

23 }

24

25 private static Rect GetTotalScreenArea()

26 {

27 Rect screenArea = new Rect();

28 foreach (Screen s in Screen.AllScreens)

29 {

30 if (s.Bounds.Height > screenArea.Height)

31 screenArea.Height = s.Bounds.Height;

32

33 screenArea.Width += s.Bounds.Width;

34 }

35 return screenArea;

36 }

37 }

38 }

Posted in Uncategorized | 2 Comments »

Neat video

Posted by andrewmyhre on July 16, 2008

Posted in Uncategorized | Tagged: | Leave a Comment »

Nice reference for LINQ to SQL samples

Posted by andrewmyhre on June 29, 2008

Check out this page for a nice collection of LINQ to SQL samples:

http://msdn.microsoft.com/en-us/vbasic/bb688085.aspx

The samples are only available in C# though so far as I can see…

Posted in Uncategorized | Leave a Comment »

New Regime

Posted by andrewmyhre on June 6, 2008

Boy, the weeks have really flown by.

Lately I’ve been working on a WSS 2007 project which has been keeping me quite busy. I’ve been learning a great deal about Sharepoint development but I’ve been recording my learnings in the form of documentation rather than blog posts. My co-worker Scott Cowan has been keeping a thorough blog though. Initially my point of view was that I was being invested in to learn this stuff, so to broadcast my knowledge as I gained it would be ethically murky. But I’ve changed my mind about that now, so from now on whatever I learn I’ll post.

I’ve also been working on my CMS recently, trying to get it into shape so that it doesn’t disgust me anymore. It’s like a love-child I concieved during a more irresponsible time in my life and it’s turned out not only to be a time-suck but also just disappointing. I’m really trying to dig in, improve, refactor and rerelease. But I’m happy with the key features and with time and effort I think it will become a good product.

I hosted my blog for a while on it, but I switched because the features I wanted to include in my blog would have taken my too long to implement when I could just sign up for a free one and set it up in a few minutes. That was a good time but now I’m getting more serious about finishing the project I’m going to migrate back to my CMS. I realise now that in the long run I actually want my blog to be hosted on my own software, so to avoid messing up people’s bookmarks andRSS subscriptions (20 people a day and counting!) I’m going to cross-post everything I blog on the wordpress site to my original site. That way when the switch finally happens most of the content will just be there. It’s going to be annoying but hopefully I’ll find a way to automate it.

I managed to get a beta license for ping.fm so it’s going to be cool playing with that. It was really, really hard to get the license (hint: just email them and ask).

I’m also in the process of shifting my hosting from www.enom.com to DiscountASP.Net. So far they seem really cool – pages load in a heartbeat whereas enom was dead slow, and my sites are running on a Windows Server 2008 box. I can manage things like Http Handlers through my IIS7 Management Console, and it’s bliss! They also answer questions promptly which is a huge bonus.

Also I have a Nokia N82 on it’s way to me. It’s about time I had a smartphone and I’m super excited about building some J2SE apps. I have a couple of ideas for things I want to try out.

And I’m using www.rememberthemilk.com, it’s actually really good.

Posted in Uncategorized | Leave a Comment »

More on WAPs and WDPs

Posted by andrewmyhre on May 12, 2008

Here’s a very interesting post: http://undocnet.blogspot.com/2007/12/web-application-project-2008-still-not.html

Currently I’m having trouble with MVC projects. I’ve given up trying to use a WDP so I’ll have to write my own /rip off a web.config replacement task.

Right now I’m getting a weird error though:

(CoreTestConfiguration target) ->
TESTTOOLSTASK : warning VSP2013: Instrumenting this image requires it to run as a 32-bit process. The CLR header flags have been updated to reflect this.
TESTTOOLSTASK : warning VSP2013: Instrumenting this image requires it to run as a 32-bit process. The CLR header flags have been updated to reflect this.
MSBUILD : warning MSB6006: “MSTest.exe” exited with code 1.

Bizarre! Interestingly this error happens when I run the team build project using msbuild on my development desktop.

Posted in Uncategorized | Tagged: , , | 2 Comments »

This is too scary

Posted by andrewmyhre on April 18, 2008

Man trapped in elevator for 41 hours:
http://disembedded.wordpress.com/2008/04/14/madness-trapped-in-elevator-car-30/

And if you can’t be bothered reading the story, here’s a time-lapse film of the whole ordeal:

http://www.snotr.com/video/1078

Posted in Uncategorized | Leave a Comment »

Weird

Posted by andrewmyhre on April 11, 2008

I mis-typed and browsed to http://www.silverlight.com/showcase today. That domain is hosted by Apple?

Posted in Uncategorized | Leave a Comment »

But

Posted by andrewmyhre on April 9, 2008

But I he replies because he’s super-cool, and Twitter is cool, and not because I’m special. Just so that’s clear.

Posted in Uncategorized | Leave a Comment »

What’s cool

Posted by andrewmyhre on April 9, 2008

What’s cool is that I can send Scott Hanselman a message on Twitter, apropros nothing, and he’ll reply. That’s cool.

Posted in Uncategorized | Leave a Comment »

The right way to install SQL Server 2005

Posted by andrewmyhre on April 8, 2008

When you install SQL 2005 DO NOT choose to start the SQL Server and SQL Agent services. If these are running when you install the service pack you will have to reboot (or manually shut them down yourself – save yourself the bother).

SQL Server 2005 Service Pack 2 is cumulative – meaning you do not have to install SP1.

Posted in Uncategorized | Leave a Comment »