Nope, this is not the way to impress me

[Update: I was contacted by SlickEdit support. They provided the patch for me, updated the forum post to contain the correct support address and were generally very friendly. Lesson learned: wait a day or two before posting ,-) I’m leaving this post up anyway, since it’s an accurate description of the events and my impressions yesterday.]

Today I was working on some Flex code, popped over to StackOverflow and saw an ad for SlickEdit. Curious, I cliked the ad to refresh my memory about the product, and I noticed they boast Vim-like input. That makes me instantly want to like an editor. Even better, they offer a plugin for Eclipse, SlickEdit Core. I’ve been less than pleased with ViPlugin, my current Eclipse-Vim provider, because it doesn’t want to play ball with Flex too well, and it has an irritating bug where a blank line at the end of a document causes the cursor to always revert to the top of the file, no matter what I do. (Note to self: the plugin has been updated.)

Anxious to try how SlickEdit works, I installed the plugin. It bugged me about getting a trial license key, which went relatively smoothly. The editor itself seemed fast, the Vim-emulation felt comfortable, but opening a MXML file still popped up the Flex editor, and I couldn’t figure out a way to change that. Instead of working through all the options, I searched Google for an answer, and found a forum posting saying they have a patch that improves Flex integration, and provides breakpoints and suchlike to the SlickEdit editor. Considering the debugger is a feature I end up needing (more often than I’d like), I was suddenly very interested. The posting said to email their support for the patch. So I did, and this is what I got:

We were unable to match your email with the subject “Flex Builder support for SlickEdit Core?” to an open case in our support system. If you were replying to an existing case, please include the case number (in the format of CAS-#####-####) in your subject line. If you wish to open a new case please submit your request using the in-product mechanism:

  • From within SlickEdit® 2008 via Help > Contact Product Support
  • For SlickEdit® Core for Eclipse™ you can do this via Help > SlickEdit Support Web Site and click on the "Open a Support Case" link
  • For SlickEdit® Tools for Microsoft® Visual Studio® you can do this via SlickEdit > Contact Product Support

Alternatively, if your product is not running you can submit your request on the SlickEdit Website at http://www.slickedit.com/supportcase/ Thank you,

SlickEdit Product Support

The tone is polite, but what the… can’t you guys accept regular email without making me jump through hoops? I was evaluating the product for work, and while at home I can spend time doing stuff like blogging about things that bug me, at work I really should be working. So if you make it hard for me to evaluate your product for my day-to-day needs, odds are I’m not going to.

Now, you could make a fair case by noting that I usually buy single licenses, rarely buy anything that exceeds 200€ in price and so on and so forth. But I really wanted to like the product, and I had already decided that $99 really wasn’t a bad price at all.

You could also say, well, this patch is for existing customers only. Fine, if that’s the case, then you’re not the company I want to do business with. If I can’t make your product work for me, that’s pretty much the end of the story right there.

I tend to advertise products I do like with considerable vigor – I’ve managed to sell a bunch of ReSharper licenses on JetBrains’s behalf. Too bad the JetBrains Seeder program was established after I had done so…

… anyway. Here’s the deal: I’m always looking for good tools at prices I can easily afford to pay myself. When I find them, I want a web site that displays the features in an easily navigable way, a payment processor that is secure and easy, a license system that either doesn’t exist at all or will provide the license for me straight after the payment has been verified, and a company that actually wants to do business with me. Take one or more of those away, and your product needs to be seriously amazing and/or mandatory for something I’m doing before I cough up the dough.

In the meantime, I’m still in the market for a good Vi/Vim plugin for Eclipse, preferably one that plays nice with existing editors.

[edit]

It occurs to me that SlickEdit support is probably in another time zone (duh), so perhaps I’ll be getting a reply during the night. If that’s the case, I’ll happily re-evaluate the situation. Even so, the email response I got gave me the feeling that I had done something wrong, and that they wouldn’t contact me unless I re-submitted my request through another means.

Changing the version of an assembly reference on the fly

Today I wrote a small wrapper for the Quartz.NET scheduler library to integrate it into a project I’m working on. The project has been using MySQL Connector/.NET version 5.1 for its database needs for a while now, and I was intent on storing the Quartz scheduler jobs in the same database, using the same library.

Quartz comes with a pre-configured set of ADO.NET providers. It allows you to set the connection string, user name and whatnot, but what it doesn’t allow you to do is override the class names it uses to instantiate the ADO.NET provider classes. That’s a bit strange, since near as I can tell, it contains a mechanism that could allow that.

That, in itself, wouldn’t be a problem. But we were using MySql.Data.dll version 5.1.3.0 and the embedded property file in Quartz.dll specified version 5.1.6.0.

API-wise I suspected that nothing remarkable had changed, and that we’d be able to use 5.1.3.0 – in fact, my colleague had successfully recompiled Quartz from source to use that version, and everything had worked. But I really didn’t want to include the Quartz sources in our build, we have more than enough projects already.

I had a recollection that there is a mechanism that allows to change the assembly on the fly, but I couldn’t recall what it is. So I began to type my question at StackOverflow, and lo and behold, one of the suggested already-asked questions had a comment that mentioned Assembly Binding Redirection. That rang a bell, I followed the link, and no more than two minutes later I had managed to force Quartz to use the version of MySql.Data I wanted it to use. It’s this simple:

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="myAssembly"
                              publicKeyToken="32ab4ba45e0a69a1"
                              culture="neutral" />
            <bindingRedirect oldVersion="1.0.0.0"
                             newVersion="2.0.0.0"/>
            <codeBase version="2.0.0.0"
                      href="http://www.litwareinc.com/myAssembly.dll"/>
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

I suppose I should qualify this post with a “be sure you know what you’re doing if you use this.” You need to be sure that the substituted assembly obeys the contract of the original, otherwise you will likely break things.

This is a powerful mechanism to have, and since I had forgotten it once already, I thought I’d document it here to make sure it doesn’t happen again. .-)

Holy crap, Delphi is alive and kicking

Holy crap, it looks like CodeGear is actively doing Good Things to keep Delphi alive! Apparently, Delphi 2009 supports anonymous functions:

Not only that, the language (Object Pascal) has finally woken from its stagnated state and is getting increasingly modern. It now implements, for instance, closures (anonymous methods) which is quite rare for a non garbage collected language.

Now, while the first paragraph should convey my excitement about the development, that alone isn’t quite enough to bring Delphi back to the front lines. I’ve used several versions of Delphi (5, 6, 7, 8 and 2006), and since version 6, seen quite a few problems with the tools and libraries. First of all, Delphi 7 deprecated a number of components without providing a migration path – only to introduce the very same components in source code, the demos folder of all places.

Delphi 8 was half-baked. The IDE was buggy, the forced migration to .NET was a bad idea, and the company quickly reversed their direction with Delphi 2005. A bug we discovered for Delphi 8 still existed two major versions later in the 2006 edition. When I finally figured out the steps to trigger it and reported it to Quality Central, I got no response. Eventually, the bug was closed with the response: “feature has been removed.”

Oh, and one of the crowning moments: I phoned Borland’s Finland offices to ask a licensing question, only to be told that they don’t handle those issues. At all.

After a history like this, CodeGear needs to pull some serious stunts to regain credibility. Evolving the language is not a bad start.

Reading up more on CodeGear’s latest, Delphi for .NET seems to be resurrected as Delphi Prism, powered by a compiler from another vendor, RemObjects software. What I find notable is that the RemObjects Oxygene compiler has boasted support for Mono since I first saw it. In fact, cross-platform applications running on OS X and Linux, courtesy of Mono are a feature highlight.

Now, if CodeGear can manage to nurture the community of Delphi developers in a way that matches the .NET and Java communities, things could be looking up.

Welcome back, Delphi!

Things I didn’t know (or remember) about the C# using statement

Declaring disposables outside the using statement

The first thing that surprised me was that you don’t have to declare the IDisposable in the using statement. Maybe because something like this:

public class Foo : IDisposable 
{
	Bar bar = new Bar();
	
	public void Dispose() 
	{
		using(bar)
		{
			bar.DoSomething();
		}
	}
}

doesn’t quite feel natural to me. However, MSDN does mention that this usage is possible, so I shouldn’t be surprised. I came across this one when trying to avoid writing a try/finally pair to dispose of a member variable inside a Dispose method.

Multiple IDisposables in a single using statement

While browsing the documentation for the using statement, I came across this gem:

Multiple objects can be used in with a using statement, but they must be declared inside the using statement, like this:

using (Font font3 = new Font("Arial", 10.0f), 
           font4 = new Font("Arial", 10.0f))
{
    // Use font3 and font4.
}

I’m beginning to wonder where it was I learned the using statement from, given that I really didn’t know this is supported. Granted, I learned my C# basics when the language was version 1.0, and while the older reference does have an example of this usage, it’s not as clear as the current version. Still, lacking this knowledge meant that I’ve (ab)used braceless blocks to achieve the same effect:

using (Font font3 = new Font("Arial", 10.0f))
using (Font font4 = new Font("Arial", 10.0f))
{
    // Use font3 and font4.
}

which not only is questionable in terms of syntax abuse, but also more verbose than the better way.

Variables declared inside a using statement are read-only

This one is courtesy of ReSharper’s background compilation. I was cleaning up code that opened a database connection twice by moving the opening statement to the outer scope and converting a try/finally pair to a using statement, when I got this message (I’m futzing with File.Open here purely for illustrative purposes):

ReSharper showing an error when trying to assign to to a variable declared inside a using statement

This makes a lot of sense, but is still somewhat surprising, given that C# does not have a way to declare read-only local variables. Another thing that seems a bit inconsistent to me is that when the declaration is outside the using statement, the compiler doesn’t mind if you assign to it:

When the declaration is moved outside the using statement, reassigning is possible again

which doesn’t make so much sense to me. I’m sure there’s a reason, but when I read that, I’m thinking whatever is assigned to foo before the using statement will be disposed of. I’m fairly sure that isn’t the case when reassigning is allowed.

So if I didn’t know this about the using statement, how well do I know C#?

I thought I knew the C# language pretty well, since it has been my primary tool at work for quite some time now. Turns out I was really, really wrong. I think I’m going to get a C# 3.0 language reference book just to go through the different aspects of the language and see if there are other places where I’ve missed something obvious.

The bigger question is, how can I ever hope to master even this one language, if details like this have eluded me for over four years, especially since C# is evolving rapidly.

Friday miscellany

Synchronicity strikes again. A couple of days after I write about what I think is the responsible way to refactor, Raganwald’s del.icio.us link feed coughs up a post titled “Refactoring yourself out of business” from a blog by a chap named Eric Ries. Choice quotes:

They asked for my advice, and we went through a number of recommendations […] I thought we were having a successful conversation. Towards the end, I asked when they’d be able to make these changes, so that we could meet again and have data to look at together. I was told they weren’t sure, because all of their engineers were currently busy refactoring. You see, the code is a giant mess, has bugs, isn’t expandable, and is generally hard to modify without introducing collateral damage. In other words, it is dreaded legacy code. The engineering team […] is taking several weeks to bring it up to modern standards, including unit tests, getting started with continuous integration, and a new MVC architecture. Doesn’t that sound good?

I asked, "how much money does the company have left?" And it was this answer that really floored me. They only have enough money to last another three months.

I have no doubt that the changes the team is currently working on are good, technically sound, and will deliver the benefits they’ve claimed. Still, I think it is a very bad idea to take a large chunk of time (weeks or months) to focus exclusively on refactoring. The fact that this time is probably a third of the remaining life of the company (these projects inevitably slip) only makes this case more exaggerated.

[…]

We’re always going to have to live with legacy code. And yet it’s always dangerous to engage in large refactoring projects. In my experience, the way to resolve this tension is to follow these Rules for Refactoring:

  • Insist on incremental improvements.
  • Only pay for benefits to customers.
  • Only make durable changes (under test coverage).
  • Share what you learn.

I can’t help but notice the bulleted list looks a lot like what I was suggesting. .-)

Now, I’ve butchered the quote from Eric’s entry (sorry!) to save some space, so if my previous rant resonated with you, go read the original text – it’s far more comprehensive, and well-written.

Next up, TechCrunch has a story on why googlers quit. All is not well in the land of milk and honey. My, one might even conclude that it’s silly to expect a single employer to be the be-all, end-all workplace for every top notch techie. Really I’m just enjoying some schadenfreude, given that I suck too much to ever pass the Google hiring bar. ,-)

Back on the topic of refactoring, I’ve had an analogy in mind for a while now, between programming and cooking. Obviously, the cooking itself is the programming, but if you’ve prepared anything remotely interesting, you know the dirty dishes, cartons, plastic wrappings and ingredients you no longer need quickly accumulate into a big mess that makes the actual cooking hard. Kind of like legacy code. So continuously cleaning up after yourself is kind of like continuously refactoring while you add features.

I’m not saying that analogy really helps me when I’m programming – I already have a certain mindset for it. However, what I don’t like is cleaning up, and thinking about chores as tiny little refactorings in my home helps a bit.

How geeky is that? .-)

PuTTY, Vista and the annoying security warning

I’ve been living for months now with the annoying security warning generated when you open an executable you just downloaded, such as PuTTY.exe. From time to time I’d try to uncheck the “Always ask” checkbox only to have it return on the next run, and periodically I’d search for the anwer.

Turns out there are two ways of getting rid of the warning. First is to use the installer version of PuTTY. But I had done that already. And true enough, it didn’t used to happen until I downloaded PuTTYtray, which didn’t come in the installer.

The only way to fix things is to open the file properties window while it’s in the original download location and unblock the executable. How very annoying.

Fortunately, all my browsers store the downloaded files in the same, default location, which is C:\Users\myusername\Downloads. So I moved the file there, and ta-da, the unblock button appeared in the properties window.

 

This is one of those times I really have to say a feature of Vista sucks, big-time. I mean, security-wise it’s a good thing that verifications like this are done, but UI-wise it’s insane to hide the option if the file is moved and not tell about it in any way, shape or form.

Obviously the information about the original location of the file is stored somewhere, otherwise the button couldn’t have appeared when I moved it there. Hence the UI should at the very least tell me what is wrong, and where I need to move the file to fix things. Something like this, perhaps:

UI concept: the file properties dialog with information about the problem

The wording and placement of the message could and should be improved, but the key things are: something is not right – there is something about this file you need to know. This is why it’s happening – you shouldn’t have to guess at what’s wrong. And most importantly, this is what you can do about it. Armed with that information, I can make the informed decision on what, if anything, I should do about it.

I’m sure Raymond Chen can give me a dozen reasons why this is technically impossible, or a bad idea security-wise. Still, if the UI is going to refuse to obey me, it should let me know why and let me know how I can fix it. This is making my computer so secure I can’t use it properly either.

Software that doesn’t pull its weight

A moment ago, I decided I’d play around with ASP.NET MVC for a while, mostly just to try out the Spark view engine and see if it actually is as elegant as it looks. I fired up Visual Studio, and then remembered that I should probably install the new Release Candidate of ASP.NET MVC too.

I downloaded the installer, ran it, and got this:

An older version has already been installed. I could remove it for you, but instead I'll just throw an error in your face!

First of all, having an earlier version installed is an error? Are you saying I shouldn’t have tried the beta?

Second, just what exactly is preventing you from offering a button that says something to the effect of “replace with this version”, runs the uninstaller quietly and then installs? Why bother making a big deal out of this?

Third, if that’s too much work, could you at least please offer me a quick way to access the uninstaller? Instead, now I have to open up Explorer, groan in exasperation, dig up control panel, go to Add/Remove Programs and remove it myself, then close the error and re-run the installer.

And the feature isn’t even called Add/Remove Programs in the Vista default control panel view:

It says "Uninstall a program", not Add/Remove Programs

Of course, since this product is targeted at developers, the people encountering this error will probably have the good sense to locate “Uninstall a program”. But if this is a general installer feature, which I think it is, I can imagine a less computer literate user might not dare to disobey the message like that.

I’m sure it’s easier to fail and let the user deal with it. But damn it bugs me. I haven’t even begun to evaluate the actual product, and already it has given me a bad impression. Good thing I’m still inclined to like the framework itself.

 

Now that I think about the error a bit more, I’m pretty sure I’ve actually done the same deed – packaged an IE extension in an installer that would throw precisely the same error if it was already installed, which meant upgrading required an uninstall. Damn! Now I’m angry at myself too.

Beating procrastination

I’m a terrible procrastinator. I put off all sorts of things all the time, because I’m tired, I don’t feel like it or I just don’t have the time. However, I seem to always have enough time and energy for the things I do like, so I’ve come to suspect that maybe I’m trying to fool myself.

Procrastination is a weird thing. You delay the bigger reward of having accomplished your task in favor of the small-to-the-point-of-nonexistent reward of… not doing it. It wouldn’t make any sense at all, if we weren’t hard-wired to prefer the immediate reward over the long-term reward.

It’s also something that accumulates quickly. You should make dinner but you can’t because first you’d have to wash the dishes which would require you to empty the cupboard where the dry dishes from the last round are, and so on, and so forth. It applies to everything. First you procrastinate, and before you know it, you’re shaving yaks.

The only cure is to break the loop: find the determination to do one of those accumulated things. That may lead to a feedback loop that goes the other way: you feel accomplished, energized and ready to tackle the next task, too.

I find that lists are useful in getting things done. Writing down the first two or three things, the things I actually have to do, and then continuing the list with the things I don’t want to do is a great tactic. Once I cross off the first items from the list, I often end up having enough momentum to tackle at least one, sometimes all of the tasks I had been avoiding.

Unfortunately, all it takes is a little slip-up, and then you’re down that road again: I’m too busy to write a list etc…

The periods when it does work, for me, seem to happen at times when I’m breaking other bad habits too. For instance, in the last few days I’ve cooked proper meals several times, washed the dishes as soon as there’s space for them, and even exercised on the Wii Fit. Which is something, by the way, of which I will NOT provide pictures.

Today I’ve managed to clear my list for the most part, and I’d still have time to exercise my programming muscles for a bit. I just don’t really feel like doing it. However, there’s one last episode of Blackpool left for me to watch…

1 3 4 5 6 7 11