Silverlight not working in Firefox

Another long-running issue on my dev machine solved today. I never got the Silverlight plugin to work in Firefox. With every upgrade of either Firefox or Silverlight I hoped that the issue was solved, but no. Today, I finally found the solution here. Yes, it really was that simple.

When going to the Microsoft Silverlight page at microsoft.com/getsilverlight, it would always nicely report that it was installed and had the newest version. Also, browsing about:plugins would report everything being in order. However, no pages using Silverlight (like nos.nl that features a Dutch online news and sports tv channel) and more recent, this bytes.com interview with my hero Anders Hejlsberg) would ever work. They would simply remain blank or show a banner that links to the silverlight install page… which would tell me it was already installed. Of course, I could quickly Show this page in IE, but it bugged me nonetheless. Lees meer over dit bericht

Following twitter without twitter (using rss)

Having no twitter account myself (yet?), but still wanting to follow some of my friend’s and colleague’s tweets, I always subscribed to the matching RSS feeds from MS Outlook.

Since a twitter update somewhere last year, it has gotten a lot harder to get the right url for the feed, since it is no longer displayed directly on the page.

Today, I found this post describing as much as three different methods of acquiring a working url to a user’s twitter stream as an rss feed. Works great!

The case of the blank Visual Studio properties window — part 2

Earlier this year I suffered from a case of a Visual Studio properties window that appeared to get “stuck” in the middle of developing an application. It would show up blank and the only way to get it to work was to fix the project and restart Visual Studio (not just close and reopen the solution). For more details, please read the first article.

Blank Properties window in Visual Studio

Although I haven’t written about it, after applying the solution from the first article, my problems weren’t entirely over. Every once in a while, the properties window would get stuck again, and after tweaking the .xsd file a little or reverting it to a previous revision, I could get it to work again. But I never got the feeling that I really understood what I was doing. It would just work sometimes, or not. I even got hesitant to make any changes to the dataset, unless absolutely necessary. But it only happened on that single solution.

Until last week. In an entirely different solution, all of a sudden the properties window was blank again. It’s subtle, you don’t always notice immediately and because of that I could not simply undo the last the thing I did. This solution contained a dataset file too, so after cursing a little (I admit) the first thing I did was revert that and reapply the changes one by one. But this time, that didn’t work. I reverted the dataset to points way before the property editor got broken but still nothing. It was starting to look like the dataset file being the solution was not a generic one, but just the solution for that first project. This time, it was something else. Lees meer over dit bericht

Error when compiling .resx file – Attempt to load a program with an invalid structure

I have seen this before and fixed it, but ran into it again today and could not remember what is was. When compiling a WinForms application in Visual Studio 2010, I got an error message stating “Kan bestand of assembly (…) of een van de afhankelijkheden hiervan niet laden. Poging om een programma te laden met een onjuiste indeling. ” (Roughly translated, “Can not load assembly (…) or one of its dependencies. Attempt to load a program with an invalid structure.”).

When double-clicking the error, it points to a base64-encoded piece of a resx-file, in this case an image stream for an image list.

This is a bug in Visual Studio 2010 that has not yet been fixed. See here on Microsoft Connect.

The workaround suggested by Pellet21 works for me in the mean time. I’ll copy it here to save myself from Googling for it next time:

Workaround
1.    Open Form in Designer and make needed GUI changes. Close designer and save
2.    Compile project and receive RESX compile error (only forms with Imagelist should have this problem)
3.    Double-click resx compile error to open resx file.
4.    Scroll to top of imagestream.
5.    Edit the top line of the Image stream:
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
TO
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
6.    Close and save resx file and recompile.
**NOTE: the only difference are the characters at end “j00LjAuMC4w’ to “j0yLjAuMC4w”

This needs to be done EVERY TIME you open the form in Designer mode.

Issuing SVN commands from UltraEdit

Now I am getting used to having VisualSVN around when I am editing from Visual Studio, or the Subversion integration Delphi has (although that is broken since I upgraded to svn 1.7), I sometimes miss it when editing other kinds of files from my favorite UltraEdit text editor. While googling around to see if there was some kind of plugin available (apart from upgrading to the full blown UEStudio, which I don’t need), I found this blog post from Rob. He describes how to use the Tools Configuration menu to issue svn commands. Nice! But it gets even better if you scroll down to the comments where Daniel explains another syntax that fires up the TortoiseSVN dialogs instead of the svn command line. I like that even better!

I’ve quickly configured my UltraEdit installation likewise. Thanks to both Rob and Daniel. For my own reference if I later forget how I did this, here’s a copy of Daniels description of his setup:

TortoiseProc.exe /command:commit /path:”%f”
TortoiseProc.exe /command:update /path:”%f”
TortoiseProc.exe /command:diff /path:”%f”
TortoiseProc.exe /command:log /path:”%f”

I’ve also produced nice 16×16 .bmp icons via a simple screen capture of the context menu icons Tortoise uses for these command, to use as the command icons in my UltraEdit toolbar.

Since each of these displays a dialog I’ve selectedd Program Type “Windows Program” (although I don’t think it matters), and unselected Save Active File for the SVN Show Log command (not a requirement to show the SVN log). None of these have the Capture Output option selected.

Initializing a combobox to a blank value might be harder than you think

Combobox troubles again today. No matter how hard I tried to have Comboboxes in my dialog form to initially display blank (SelectedIndex = -1), as soon as the dialog was displayed, the combos would always show the first item in the List that populated it. Despite being set to -1 explicitly. It was driving me nuts.

When created at runtime using a List as DataSource, getting this (empty combos) might be harder than you think

The situation: I had a dialog form that should have a variable number of comboboxes on it, determined at runtime. So the form had an Init method where I dynamically added the comboboxes, and set its DataSource to a List of items (directly, no BindingSource). The form also has a LoadData method, that sets the SelectedIndex of each combo to the actual value from the data, or to -1 of it was unknown or uninitialized at that time. This was to be able to make the combo appear blank instead of preselecting the first item, which was undesired. The caller of the dialog executes Init(), LoadData() and finally ShowDialog().

I was expecting a blank combobox, but it showed the first item in the list preselected. I triple checked that the SelectedIndex was correctly set to -1 at the end of LoadData(), but as soon as the form was displayed, it was 0. What the *** happened there in between and “who” was secretly setting my property!? Lees meer over dit bericht

SVN Commit failed, access forbidden

Yesterday I had to commit a project to a fresh and new repository on a Subversion server (VisualSVN Server). So I checked out an (empty) working copy, inserted the files, and committed. The files were added, but immediately after that, TortoiseSVN complained: commit failed (details follow): access to ‘/svn/(RepoName)/!svn/act/(someguid)’ forbidden.’ Errr… what?

Commit failed, access forbidden -- but I do have write access?

So I verified with the server admin that I had read and write permission, which was the case. Googling for answers turned up a possible suspect: casing of the repository name. Turned out my casing was different than what the admin had created. RepoName should have been Reponame (example, of course). With the wrong casing in the svn url, I was able to do checkouts, updates, browse the repository and everything else… but not commit.

So if you ever encounter an error something like this, check your casing. Even on Windows filesystems.

BTW: check out the improvements in the updated TortoiseSVN 1.7, impressive.

Edit (26-01-2012): As Steve pointed out in the comments, the unexpected case sensitivity is not limited to the repository name. Also check the domain part of your user’s logins.

Keeping a modeless window accessible from a modal (dialog) window

In a C# WinForms application I was working on, users were effectively working with two more or less independent windows: one they worked in, and another that showed documents and other info they need to do that work. The problem was that when they were in a dialog, for example one to assist in creating a new object, the window holding the documents with info on the object was not accessible because the dialog is modal.

You can have the dialog take ownership of the document window, but that means also it will always be on top of it, which would be inconvenient.

So I borrowed a trick from my Delphi days that I found here. You only need to do a small Windows API call from your code. I added this code to utility class called FormsUtil, but you could of course put it anywhere that’s convenient to you.


[DllImport("user32.dll")]
private static extern bool EnableWindow(IntPtr hwnd, bool bEnable);

public static bool EnableWindow (Form form, bool enable) {
    return EnableWindow(form.Handle, enable);
}

This allows you to, in the dialog form, attach an event handler to the Shown event:

private void NewObjectForm_Shown(object sender, EventArgs e) {
    if (this.Modal) {
        var viewer = GetReferenceToDocumentViewerForm();
        FormsUtil.EnableWindow(viewer, true);
    }
}

Now the document viewer window is accessible from the “new object” dialog.

Tip: be careful if you ever choose to use EnableWindow(formX, false). It will disable that form completely, including not being able to close it.

SP1 for SQL server 2008R2 brings back Intellisense to SMSS

Yay! Installed Service Pack 1 for SQL Server 2008 R2 today. Among other fixes, it brought back IntelliSense support in SQL Server Management Studio, which had been broken since I installed SP1 for Visual Studio 2010 on that machine.

SSMS Intellisense is back!

So those of you that were bothered by the same issue, are advised to install the service pack as soon as you can.

SyncEdit for implementation/interface member parameters

When I am editing a method (procedure/function) of an object, I sometimes need to add a parameter or change some. Now in Delphi code, as you probably know, you often have to do that twice: once in the implementation, and once in the interface of the unit (and make sure it matches…).

The Change Parameters dialog - do you ever use it? Too cumbersome imo.

Of course you can use the change params refactoring (Ctrl+Shift+X), but personally I find it too cumbersome to use the dialog to change something that could much easier be typed. And did you notice that your cursor has to be on the method name, not the parameters that follow it, for the refactoring to even be enabled? Blegh. It just breaks my ‘flow’… Lees meer over dit bericht

Follow

Get every new post delivered to your Inbox.