Two clips: Yor and Onion fire cause

In this clip, The Onion sets thing straight on who started a devastating fire. And in this clip from The Spoony Experement, we get a nice review of Yor – The Hunter From The Future. Enjoy! (I did.)

Market it as more primitive than it really is?

The Sweex digital photo frame MM008 v2 is a great little product, but one thing puzzles me. All the specifications and documentations that I have found on it, states that the display is 480×234 pixels. Anyone who has viewed a 480×234 picture can see that this is not the case. It took me a while to count the pixels on the display, but now I am under the impression that it actually has 480×270 pixels. That is 17.280 pixels more! Why would you ever want your potential customer to think that the product has less capacity than it actually has? And don’t get me started on the time I spent on counting pixels by producing strange pictures in different sizes with special patterns to detect if and how the photo frame interpolated the picture. Phew.

The one and only jukebox

I am very exited about my new jukebox. For perfect playback, it is implemented as an addon to WinAmp. WinAmp is free, and I can take care about the playback later (if ever). It is intended for use on parties, and it prevents that one person picks all the music.

Of all players that I could have chosen for making an addon to, why WinAmp? Because of the output plugin called SqrSoft Advanced Crossfading! A superb and very intelligent crossfader! If you haven’t got it, get it!

So, why crossfading?

If you allow a blank space between songs, people that attends to the party will do one (or both) of the following:

  • Fiddle with the stereo.
  • Go home.

Crossfading prevents this. Check out for the download, it will be posted soon.

Leonard Cohen

I samband med att Leonard Cohen släppt en ny liveskiva med tillhörande dvd har jag bestämt mig för att lyssna in mig lite på honom. En kollega ser till att jag får låna.

Företaget har ny hemsida ute! Jag hoppas inte reklambyråns folk blir irriterade på att vi gick igenom hur den renderades, utan plikttroget åtgärdar så att det blir bra. Jag tycker vi har lyft oss, och den nya logotypen håller på att sjunka in. Den syns bättre på håll, och den är lite futuristisk.

Shadowing

One feature that I use every day, really every day, in Visual Basic is shadowing. Like the keyword “new” in C#, it is used to override a method that is not overridable, but unlike the new keyword, shadowing replaces all overloads of a function in the base class. This is so very usefull. Imagine that you are designing a custom dialog, and you want certain arguments to be passed to the ShowDialog function. Create e shadow of  it, and code that calls ShowDialog must pass the arguments you have specified in the shadow. It could look like this:

Public Shadows Function ShowDialog(ByVal Owner As IWin32Window, ByVal EntityID As Integer) As DialogResult

This is the one thing that I really miss in C#.

PhotoName improvements, May 2009

Added: A checkbox is displayed that allows you to only load images that haven’t been renamed yet. This saves loading time for the application. PhotoName doesn’t really know what images that has been renamed, it uses a simple RegEx to determine the format of the filename, and if it doesn’t match, the image is loaded.

The same RegEx is used to determine if the image should be default checked for renaming or not.

If you have a previous version of PhotoName installed, it must be uninstalled first.

Download PhotoName here.

The differences, part 2

Visual Basic 9 and C# 3.5 has much in common, and I suspect that they will differ more in the future. I have pointed out some current differences, like completion lists, object initializers, deep XML support and declarative events.

A few more VB-specific features:

Properties with parameters is an odd feature. By creating an object with parameterized properties you can give the impression that the object has different object with indexers as members. Properties with parameters can not be accessed from C#. A property with two parameters can look like this:

Public Property MyProperty(ByVal X As Integer, ByVal Y As Integer) As String
    Get
    End Get
    Set(ByVal value As String)
    End Set
End Property

The My namespace in Visual Basic is an extensible namespace with hierarchical arranged functions. It is loaded with function to manage sound, file transfers and other handy things, and you can extend it by simply creating hidden modules under the My namespace.

Optional parameters in functions is a feature that has been around in Visual Basic for a long while, that will be available in C# version 4. This shows how to only pass the sixth parameter to a function:

DoSome(, , , , , 55)

Aditionally, you can clarify by naming the argument. This example also calls the sixth parameter (called B in this example):

DoSome(B := 55)

Named arguments will also be available in C# 4, with slightly different syntax (loose the colon).

The differences, part 1

Visual Basic and C# is mainly the same thing today. I imagine that Microsoft have a slightly different vision on what they the languages to be, and these differences might be even more clear in future versions. Version 9 of Visual Basic has a few features that C# 3.5 is missing, and the reason for the missing features, might be that Visual Basic has a higher focus on RAD, while C# has a higher focus on reusability.

Completion lists are used to point out a palette of default values for a new object instance. Object initializers allows the programmer to set properties of an object at instantiation. Deep XML support provides design time support for XML and declarative event handling provides design time support for events.

More differences are explored here.

Back to FF

Since I just gave up Google Chrome (there is nothing wrong with it – it has a great script engine) and moved back to Firefox, I just had to try out some new addons. This post is made using Deepest Sender, so in a while I will be able to say whether I like it or not. Seems to do strange things with my post. I have just installed Power Twitter that added some new buttons to the Twitter site, thanks for that. I have also just uninstalled the TwitterBar since accidental clicks lead to strange tweets. Apparently, TwitterBar was designed for the I-only-click-on-something-when-I-really-really-mean-it kind of person.

The downsides of going back: Where do I make the setting that tells Firefox to stat on the current tab, when I middelclick on a shortcut? It stays when I middleclick on a link! And yes, Chrome is much faster.

Completion lists

Completion lists is one of the nice features that you can use in Visual Basic 9 to help programmers to initialize objects. In a way, this works like enumerations, but enumerations are really named integer values, and a completion list can consist of custom types. To create a completion list, just make an extra class that consists of the templates that you want to have in your completion list. Each item (implemented as a member in the extra class) in the list is represented by a static (shared in VB) object of the same type as the object that it will be able to initialize. For this example I will create a completion list for my custom point class.

Public Class Point

	Private m_X As Integer
	Private m_Y As Integer

	Public Sub New(ByVal X As Integer, ByVal Y As Integer)
		Me.m_X = X
		Me.m_Y = Y
	End Sub

	Public Overrides Function ToString() As String
		Return Me.m_X.ToString() & " * " & Me.m_Y.ToString()
	End Function

End Class

This is the completion list (referred to earlier as the extra class):

Public NotInheritable Class MyListOfTemplates

	Public Shared ReadOnly Property Spaghetti() As Point
		Get
			'Initialize and return one template item.
			Return New Point(10, 10)
		End Get
	End Property

	Public Shared ReadOnly Property Strawberry() As Point
		Get
			'Initialize and return one template item.
			Return New Point(20, 20)
		End Get
	End Property

	Public Shared ReadOnly Property Darwin() As Point
		Get
			'Initialize and return one template item.
			Return New Point(150, 200)
		End Get
	End Property

End Class

At this point, I can create a point from a template, like this:

Dim P As Point = MyListOfTemplates.Spaghetti

I already have the enumeration functionality, but no special help from the code editor. This picture shows what I can expect:

To make the magic happen, connect the point class to the template list, using a remark containing the name of the template list. The remark must start with three apostrophes, like this:

''' <completionlist cref="MyListOfTemplates"/>
Public Class Point

Now, the code editor knows what to suggest when you declare a new point, as shown here.