Please click this logo to help me get on their beta program:

Xobni outlook add-in for your inbox








28/3/2008

NxtGenUG Fest 08 Registration is open

Filed under: General — Oliver Sturm @ 2:07 pm - 4 months ago

Here’s the Fest08 page, and there’s a paragraph on registration right at the top. I’ll be doing a new session there, called “Handling data in F#”.

Last year this one-day event was great, I’m sure it’s going to be another day full of fantastic content this year. “Data today, data tomorrow” is the motto this time - a great idea, I think, since almost everybody works with data in some shape or form these days. So, I hope to see you there!

Are you in Ireland next week? I am! Come along and win!

Filed under: General — Oliver Sturm @ 11:49 am - 4 months ago

I’m going to be in Galway, Cork and Dublin next week.

In Galway, I’ll do a WPF session for GMIT students on Monday afternoon, and “Functional Programming in C# 3.0″ in the evening at GAMTUG. If you want to be there, follow this link for all the details!

On Tuesday I’m going to be in Cork, delivering a WPF session again. Here’s the link for that one - hope to see you there as well! The video is actually about my WPF introduction, but if there’s enough time, I might well do the longer “WPF in business applications” talk instead. We’ll see.

Wednesday I move on to Dublin, where I’m going to meet up with a lot of other people for the fantastic IMTC conference. They still have room and the speakers list is impressive, so if you can make it to Dublin for April 2-4, or even for one of the days (sessions are 3rd and 4th), I’d recommend this! My sessions are on Thursday, I’ll be doing an introduction to LINQ as well as Functional Programming in C# 3.0.

During all my sessions I’ll be giving away complimentary Developer Express licenses! (Well, I’ll talk to the organizers to prevent p****ing them off, but I would like to do that at every session.)

27/3/2008

Who puts IPv6 entries in my hosts file?

Filed under: General — Oliver Sturm @ 8:27 pm - 4 months ago

I just had a weird problem - for some reason IE wouldn’t run my XAF (eXpressApp Framework) web applications (ASP.NET) anymore. At first I suspected some sort of installation problem, since I’d just installed the new 8.1.1 version, and not long ago this used to work just fine. But for some unrelated reasons I uninstalled and reinstalled, and the problem was still the same.

In the URL for the application, I tried replacing “localhost” with “127.0.0.1″ and I found that this solved the problem. I ping’d localhost and I noticed that it was using ::1 as the address instead of 127.0.0.1 - the IPv6 equivalent. I looked in my hosts file and there was an entry in there, combining ::1 with localhost. Removing that entry solved the problem.

Now, this is a bit weird… I actually thought I didn’t even IPv6 enabled at all, which would have explained why connections to ::1 wouldn’t work. But I found that it was in fact active - not sure why, I believe I switched it off at some point. Pinging ::1 is not a problem. So why can’t IE connect to it? And who added the ::1 entry to my hosts file recently? Or was it previously working in spite of that entry?

Bizarre Windows network stuff… see, that’s why I still love Linux for my servers. Text based config files that never suddenly change automatically. Great.

23/3/2008

F# - Things I learned today

Filed under: General — Oliver Sturm @ 8:33 pm - 4 months ago

I was playing around a bit today with F#, trying to write some real code that interfaces with WPF. Here are a few things I found - very much a “note to self” thing, but if you happen to be interested, please comment or ask.

Number 1 - implementing interfaces that include events is a PITA

I was trying to implement INotifyPropertyChanged, which contains the event PropertyChanged. Eventually I found a working description in this forum thread. I’ve now implemented the interface and a helper method to fire the event like this:

  interface INotifyPropertyChanged with
    member x.add_PropertyChanged(handler: PropertyChangedEventHandler) =
      x.notifyPropertyChangedHandlers <- (Delegate.Combine(x.notifyPropertyChangedHandlers, handler) :? > PropertyChangedEventHandler)
    member x.remove_PropertyChanged(handler: PropertyChangedEventHandler) =
      x.notifyPropertyChangedHandlers <- (Delegate.Remove(x.notifyPropertyChangedHandlers, handler) :? > PropertyChangedEventHandler)
	
  member private x.PropertyChanged(propertyName) =
    x.notifyPropertyChangedHandlers.Invoke(x, new PropertyChangedEventArgs(propertyName))

Hm… my stupid blogging system apparently likes those smileys that crept into the code sample above. That’s the downcast operator being used where the smileys appear… colon, questionmark, greater than. Sorry about that.

No idea whether this is the best way - at this point I found for the first time that documentation is currently badly lacking… no mention of anything like this in any official place I could find, nor in Don Syme’s or Robert Pickering’s books (the latter wrote the forum reply at least <g>). Was this forgotten? What’s worse than having no docs is that there are so many outdated examples around that I spent half the time trying something that obviously didn’t work any longer because the approach had been revised.

Number 2 - class syntax has a lot of weird restrictions

Yeah, well… weird is perhaps not the right word, I admit. But it certainly seems weird, since they’ve just invented two entirely different sets of valid elements for classes with implicit construction sequences and those without. Basically I had a class that was instantiated with a Window reference and hooked up to an event from that Window. Handling that event, the class was performing a calculation and then it was supposed to fire a property changed event.

Now, to fire the event correctly, of course I need a reference to the current instance, which for some reason is only available in members (those that use the “member” keyword), not in function values created using the “let” keyword. The reason for that is probably that the “let” elements are only valid in an implicit initialization sequence and as such they’re practically part of the constructor code. Still, it took a while for me to realize that, since in most languages there’s a reference to the current instance available in the constructor - it’s probably a good idea not to have that reference in the constructor, since it prevents calling members before initialization is complete.

Anyway, so my event handler for the Window event had to be a member itself, not just a function value as I’d had it before. The problem was that in this case I needed a reference to the current instance to even hook up the event, which wasn’t available to me because I was using a construction sequence.

There is a syntax for explicit constructors that allows creating a reference to the current instance. This is still implemented cleanly, because the syntax requires that first a constructor (not necessarily the same one) has to run and initialize all values, before the additional block is executed that can access the current instance. Using that syntax in conjunction with my initialization sequence wasn’t really working, so I had to convert my class entirely to using just an explicit constructor. That involves getting rid of all “let”s, using “val”s for all fields, can’t use in-place initialization and so on…

So, just in case anybody reads this who’s in a discussion mood - I’m aware that in the end it’s all my fault :-) But it is pretty hard to figure out how this all works, I didn’t find it to be well documented anywhere, and the compiler messages are really crappy about half the time.

Number 3 - Buggy behaviour of the “new() = { … } then …” syntax

This is the syntax I referred to before. In general it works fine - only I found that the compiler is really anal about the formatting of the expression, at least in #light syntax mode. I tried it without the #light at some point and found that it was actually more tolerant - but I had other trouble with that (doesn’t warrant an entry here since I didn’t investigate in depth - basically my “class” and “end” keywords allegedly didn’t match up whatever I did) and so I switched back to #light. In the end I got it working by formatting like this - all sorts of variations easily break things.

  new(state: int) as x =
    { state = state;
      blah = "hi" }
    then
      x.state <- x.state * x.state

Number 4 - class type eating up “do” block behind it, in spite of indentation

I had my main code file formatted along these lines:

type MyClass =
  ... stuff in my class
	
[<STAThread>]
do
  ... stuff to get my app running

That’s what I had the whole time, and I guess an important detail might be that I had a “do” block in my class while I was using the implicit initialization sequence. Later I removed the “do” block, and when I finally got everything to compile without errors (that stupid formatting thing with the new() above took me quite a while), suddenly my application wasn’t doing anything at all anymore! I placed a breakpoint on the first line of the app start block and execution didn’t even get there.

I found the source of that problem by looking at the compiled app with Reflector. Surprisingly, my startup method was entirely empty, and the code in that “do” block, even though clearly indented to live outside the class, had been pulled into a static constructor for the class. Wow. I haven’t had the need yet to actually create a static class constructor in F#, but my guess is that it uses a similar syntax. Anyway, given the indentation it seems pretty clear to me that in this case this shouldn’t happen. Well, who knows…

Anyway, I fixed the problem by adding “class” and “end” to the class type, so my code looks like this now:

type MyClass = class
  ... stuff in my class
end
	
[<STAThread>]
do
  ... stuff to get my app running

Oh yeah - and why did I have that class in the same file in the first place? Well… I’ve previously blogged about some weird things with namespaces in F#, and apparently that wasn’t the end of it. I tried to move the class into a different file and put it into an explicit namespace, but whatever I did, the compiler insisted that it couldn’t see the class in that block of code that becomes the startup method of a Windows application. Yes, I had an “open” line in that file of course. Another thing to investigate further, since I have no plausible idea what was going on there.

18/3/2008

F# - The thing with the namespaces

Filed under: General — Oliver Sturm @ 9:42 pm - 4 months, 1 week ago

I just spent a little while hunting down an interesting problem in a little F# app. I had a bunch of code in a single file and I was going to structure it a bit and move certain parts into separate files. I started out from some code like this:

namespace Sturm.MyNamespace
	
type ICommandLine = begin
  abstract member Parts: string list
end
	
type IPlugin =
  abstract member CanHandle: ICommandLine -> bool
  abstract member Handle: ICommandLine -> unit
	
type blah =
  val mutable dummy: int
  interface IPlugin with
    member x.CanHandle(commandLine) = false
    member x.Handle(commandLine) = x.dummy <- 1
  end
  new() = { dummy = 0 }

Yeah, I know - useless code. The point is that there are dependencies between the three types. So I was trying to move the interfaces into a different file, and suddenly the type blah couldn’t find the interfaces anymore. Interesting.

The solution to this is simple, but looks a bit stupid. At the start of my new file, I had of course repeated the namespace declaration namespace Sturm.MyNamespace, but that is not enough. Even though that puts all the types in the same namespace, it is still necessary to explicitely open the namespace as well, if you’re going to access elements that have been defined elsewhere for the same namespace. So I need this header in the file with the class type:

namespace Sturm.MyNamespace
open Sturm.MyNamespace

While I can see the logic behind that, it doesn’t seem like a very useful approach… perhaps I’ll figure out the reasons later, right now I’m glad I’ve found a solution.

17/3/2008

Vista spooling/printing delay - new problems

Filed under: General — Oliver Sturm @ 10:07 am - 4 months, 1 week ago

I recently posted about this issue I was having with a weird delay when trying to print and I thought I’d found a solution to it. But now I’ve discovered that the solution was responsible for new problems… particularly when trying to print large files (not large by numbers of pages, but by content - big scanned images or things like that), I’m suddenly getting error messages every time about timeouts.

I haven’t spent too much time trying to fix this issue, but switching the printer port back to the RAW protocol provided an immediate workaround - the delay is back, but I can print whatever I want. Pretty interesting, as I’ve printed probably a hundred documents since I first switched to LPR. No idea where this comes from… I guess I’ll just switch the protocols selectively until I find time to hunt down a real solution.

Update: I just noticed that even with the protocol set to RAW, it doesn’t work every time - it used to work just fine, no idea what happened…

Registrations are open for DDD Ireland and DDD Scotland!

Filed under: General — Oliver Sturm @ 10:01 am - 4 months, 1 week ago

Roughly based on the original concept for the Developer Developer Developer day, both Ireland and Scotland are getting their own DDDs for the first time in 2008. Some slight differences in organization, but great content and speakers nevertheless - see the agendas here for Ireland and here for Scotland. May 3rd (Ireland) and May 10th (Scotland) are the dates, and I’m sure it’s going to be great!

Find the registration page for DDD Ireland here and the one for DDD Scotland here. Hope to see you all there!

14/3/2008

What’s wrong with the Vista start menu?

Filed under: General — Oliver Sturm @ 3:35 pm - 4 months, 2 weeks ago

I’m really undecided about the Vista start menu… since I’ve started using Vista, I’ve had several different approaches for running applications:

  1. Some applications run automatically when I log on to Windows
  2. Some applications I run manually after most logins, like e.g. Outlook. I have icons for those in the Quick Launch toolbar.
  3. I use SlickRun to run those applications I use most regularly, but which are not running all the time. The Quick Launch toolbar also has icons for some other things that I run occasionally - often enough so I want to have the accessible, but seldom enough to make me think I’m going to forget the name of a SlickRun command if I were to create one for them.
  4. I use the Start Menu with its Search functionality to run things that I use rarely.

I see how this doesn’t seem like an intuitive system, but it actually is for me.

Now, the Start Menu on Vista is really weird… it has this nice Search feature, which is very useful, but occasionally I can’t remember what the name of some item is, so I actually expand “All Programs” - and that’s where things start to go wrong. The Start Menu is so horribly slow that it’s practically unusable - it sometimes takes 20 seconds or so to expand a folder in the All Programs list. Why? No idea. I’ve been noticing the same thing on a previous Vista installation on a different machine, so it doesn’t seem to be related to my installation. It certainly has to do with the number of applications installed, but then the old Start Menu always coped with that just fine and certainly my 160GB laptop hdd can’t be home to the Vista installation with the largest number of installed apps in the world, can it?

Another thing is that even with SP1 installed, working in the Start Menu is something that sometimes crashes Explorer. Again, no idea why - it happens either when clicking around in the All Programs hierarchy, or when entering a Search term and looking through the result list. It almost seems that it’s most related to the duration I have the Start Menu open, since I don’t think it happens when I just open it, quickly select something and close it again.

I tried switching back to the Classic Start Menu, which has a nice effect on performance the list of installed apps fills the entire screen, but at least it comes up within 2 seconds or so. But the Classic Start Menu doesn’t have any features, not even those it should have according to the Options dialog - apparently it’s supposed to “store and display a list of recently opened programs”, but it doesn’t. It also doesn’t show top-level Administrative Tools, Computer or Network entries and it doesn’t support Search.

As a result, both Start Menu implementations are really unusable, though for totally different reasons. Why don’t they ever get it right?

I know there are other launcher applications out there (apart from SlickRun), but I’ve found those lacking in simple ways - I don’t want such an app to take up a lot of memory if it’s going to be running all the time, and the command features that SlickRun has are really the absolute minimum of what I need. OTOH, SlickRun doesn’t support working with the Start Menu content, which seems like a pretty useful and simple idea. Perhaps some other tools do? If I ever find time, this would be something to look into. If you know something I don’t, please comment and tell me!

DevWeek session, slides and samples and info

Filed under: General — Oliver Sturm @ 11:47 am - 4 months, 2 weeks ago

Thanks to everybody who attended my session at DevWeek! I hope you liked it, I certainly had a lot of fun doing it.

First of all, here’s the download of slides and samples from the session: Functional Programming in C# 3.0 (718950 bytes)

Second, I’ve had a little thought about that example I was asked about during the session. It was one of the methods in the first basic example, and it looks like this:

public static IEnumerable GetAllMembersFunctional( ) {
  return AppDomain.CurrentDomain.GetAssemblies( ).SelectMany(
    assembly => assembly.GetTypes( ).SelectMany(
      type => type.GetMembers( )));
}

The question about it is whether this is a “real” functional implementation of the functionality or not, given that GetAssemblies returns information that changes dynamically outside my own function. I first pointed out in the session that the example was of course about the implementation of the method, not necessarily about whether or not you would want to implement a function that does precisely this same thing, especially if you subscribe to the “pure” theory of functional programming.

The more important thing about this came to my mind a bit later, but it depends a little bit on perspective. From the perspective of the guy who implements this method, I could say “Of course this is entirely valid - I’m simply calling other functions to return information to me (even though those functions don’t take parameters, so perhaps the source of the data is just a little suspect). I’m not the one who makes the decision to actually retrieve the information from what might be considered unreliable shared storage.” On the other hand, the function in question (GetAssemblies) is a function from my “runtime libraries”, in the form of the .NET framework, and it could equally well be said that I have to be aware of the nature of such functions and whether or not they do something I don’t want to do, and perhaps make the decision not to use them.

In the end it all comes down to discipline again. Modern functional programming, especially when applied to real world problems, is rarely “pure”. There’s sometimes a necessity to deal with shared data and external state to solve real-world problems. Modern functional languages recognize that and provide the means to do it, thereby removing restrictions and pushing the problem back into the area of discipline. There are small steps being taken to remind you of that choice you made, like the fact that you need special keywords in F# to create mutable variables. But if it’s your choice to try to live without shared state, it’s also your responsibility to adhere to that choice as much as you can, and decide sensibly about situations where you can’t.

London .NET user group slides and samples

Filed under: General — Oliver Sturm @ 11:31 am - 4 months, 2 weeks ago

So here they are, the slides and samples of that Functional Programming in C# 3.0 session. My apologies for the slight delay - I already received a few emails about it - but my flight home was cancelled yesterday and everything was a bit chaotic.

Functional Programming in C# 3.0 (718950 bytes)

Have fun!

11/3/2008

Testing Sony Vaio support, the conclusion

Filed under: General — Oliver Sturm @ 12:34 pm - 4 months, 2 weeks ago

The computer arrived back here yesterday, with a new motherboard and a screen cleaning cloth in apology for my troubles. Allegedly it had also been “thoroughly cleaned”, but I don’t think so - it wasn’t extremely dirty anyway, but the dust that gathers on the sides of the keys (the keyboard is a bit weird that way, hard to describe) was still there.

Anyway, and more importantly, the computer worked. So good work on that, Sony, and the turnaround was good as well!

For some reason the support guys apparently found they had to restore the hdd to it’s factory state though - I don’t quite understand which part of replacing a motherboard necessitated that step, but there you go. Acronis TrueImage (great product, btw!!) spent a few hours restoring my complete disk image, and after that the system was running just fine again.

One thing I noticed was that Windows thought it was no longer activated on the machine - presumably because of the mobo exchange. I only noticed by chance though - three days to go before activation - and that’s not good. I might have been somewhere without an internet connection in three days, when suddenly my Windows stops working… why don’t they display a large notification dialog in such a case?

So, to summarize - it took one week from contacting Sony support to getting back the fixed device, plus the additional work required to get everything back the way it was. I’m not really disappointed by this, but still it has to be said that even in this most positive of outcomes there’s still a lot to be desired.

10/3/2008

Testing Sony Vaio support, part 3 - machine is on its way back

Filed under: General — Oliver Sturm @ 12:21 pm - 4 months, 2 weeks ago

There was a bit of a confusion last week, when the DHL guy didn’t have all the details - apparently the Sony guys were expecting the machine to come in the next day and when it didn’t, they called me to ask why the pickup had gone wrong. Well, I had already received the receipt from DHL by then and I called them to tell them so, but by that time they had already received the machine and it was scheduled for repair. That was Thursday last week.

I went to Germany for Cebit on Friday, and in the late afternoon I received an SMS telling me the machine had been shipped back! No further information though. I tried tracking the package on my BlackBerry, but found that the DHL tracking website doesn’t find a BlackBerry web browser worthy of accessing that info. Tracking on the computer was somewhat impaired by the fact that while they’d sent me that SMS, I didn’t have the same info as an email. Hm. Also, even though I had a case number from Sony, I wasn’t able to find any status info about the case on their support page - I do have an “eSupport” account there, but the case wasn’t listed in there.

Anyway, tracking tells me that I should receive the package today (Monday 9th), so I’m hopeful - assuming everything’s really fine with the machine, that would be a pretty good turn-around.

6/3/2008

WPF talk at Scottish Developers

Filed under: General — Oliver Sturm @ 11:34 am - 4 months, 3 weeks ago

My talk yesterday at Scottish Developers in Edinburgh went fine - the meeting wasn’t huge, but I had the impression that the topic was interesting to everybody. If you were there, thank you again, and please feel free to contact me if you come up with questions!

Here’s the download of slides and samples from that event:

BusinessAppsWithWPFScottishDevs.zip (1229546 bytes)

Update: I noticed that the slides were not in the download - my apologies about that, it’s corrected.

4/3/2008

Microsoft shows us how to retire data

Filed under: General — Oliver Sturm @ 5:17 pm - 4 months, 3 weeks ago

Microsoft has come up with a good example of how you should handle the process of deprecating data.

Have a look at my MVP profile here.

You’ll see that in a lot of profile entries for speaking engagements, the string “RETIRED — DO NOT SELECT” is shown. Why is that? Very simple: at some point the selection “.NET”, for instance, was a valid one, but now it had to be changed. Of course there are approaches to retiring data that would have left the old strings in place, but then those mechanisms introduce considerable overhead in the data gathering process. As the strings that are shown now also include the old strings, there was no conceivable reason not to go the easy way.

Thanks to the unknown delevoper/db admin who published this great sample!

Basta Spring 2008 slides and samples

Filed under: General — Oliver Sturm @ 4:37 pm - 4 months, 3 weeks ago

I apologize for the delay - with my computer dying and everything, it took me longer than it should have to make my slides and samples for the Basta sessions available here. They should also be available here (but aren’t, yet) and each delegate will get sent a CD sooner or later - that’s as much info as I have.

Anyway, here are the downloads for my sessions (some of them together with Ian Cooper):

C# 3.0 Workshop - Everything you need to know about C# 3.0 (1551978 bytes)

Einfuehrung zu C# 3.0 (1168992 bytes)

C# 3.0 - Interessante Use Cases ausserhalb von LINQ (644553 bytes)

Extensible LINQing (402259 bytes)

The future of C# and other .NET languages (838316 bytes)

Next Page »

Powered by WordPress
© Copyright 2005-2008 Oliver Sturm