Category: Tools

To install, or not to install: that is the question

While most applications come with installer, there are many, that don’t. They are usually a single .zip, .rar or .7z file, that you can extract to some directory on your hard drive, and that’s it. They just work. One such example is NDepend, which comes only in this form. Many other applications, like Notepad++ give you choice: you can either get installation package, or a .zip file.

Each approach comes with its own set of advantages, and disadvantages. Zip/rar packages, are usually smaller downloads, and it definitely maters for people with dial-up connections. All depends on the particular application, but usually applications deployed via zip file don’t pollute your system, throwing their files and registry keys here and there. That means, that to uninstall that application, you simply delete its directory. Uninstalling installed application can be hard task, and often they don’t clean up everything, so you’re left with useless files, and polluted registry. There’s no rule for that, but more often than not, such programs leave something behind, and your system gets slower and slower.

On the other hand, using XCopy deployment is sometimes not an option, when application needs to put assembles in the GAC, check for existence of some files and so on. You might try to do this manually, but seriously – who would? Installer are user friendly, and shield you from mistakes. They will also create shortcuts for you in your menu start, on desktop or quick launch bar. In case of XCopied programs you have to do this manually.

exzi

Despite of that, I tend to prefer XCopy deployment. It gives me the feeling that I’m in control, whereas in installer have nasty habit of putting files not only to the folder I pointed to. To help myself with disadvantages of XCopy,  I created small utility called eXZI (XCopy Zip Installer) that will unpack the file to the folder I point to, and optionally create shortcuts to files I select. This way I get best of both worlds: fast and easy “installation”, and quick access to my program via quick launch or desktop shortcut, and control over where files are located. Desktop shortcut created by eXZI

I don’t attach source code to eXZI, because it’s just quick and dirty piece of code I assembled in several minutes, and it is not in a shape to be shown to the world. But if there will be interest in it, I may improve it a little bit and put it out as an open source project. I don’t know. Do you think it might be useful?

Which is why I love ReSharper…

ReSharper

Technorati Tags:

Upgrading Visual Studio trial to full version

Today I finally downloaded my MSDN version of Visual Studio 2008. Up ’till now I’ve been using trial version and I wanted to upgrade it before my trial period ends. So I burned downloaded ISO to DVD, started the disc, ran the installer, and saw this:vs_08_install

Apparently something went wrong with the burning, so I mounted the ISO as virtual drive, ran the installer and saw the same message box again.

Hmmm could I have downloaded corrupted ISO? I decided to give it last one shot, and unpack ISO with 7-zip. Surprisingly, when I opened the ISO with 7-zip instead of whole bunch of files, I saw… one. Single text file saying that this is UDF disk, and that  I needed compatible operating system to open it. I checked – Windows XP is compatible. In that case, maybe 7-zip is not? I tried WinRar, and it unpacked the whole thing successfully.

Then I ran the installer from unpacked folder on my disk, and… it worked, all files were copied, and installer loaded successfully. So I got ready for having to uninstall the trial version, in order to have it upgraded to full version, but to my surprise there was an option, next to usual Repair/Uninstall/Add-Remove-features stuff, saying – what else  “upgrade”. It then took half a minute to do its magic, and my trial is no longer a trial. The only indication that something happened was GhostDoc’s configuration wizard, that fired next time I opened the IDE. I’m very positively surprised.

Technorati Tags: ,

Regionerate your life

After much waiting (two and a half months!). Rauchy released the new version of his great tool Regionerate. New version brings many changes and bugfixes:

  • You can now choose how you want custom (created by Regionerate) regions to differentiate from other regions, by specifying custom prefix, wrapper, or usage of high ASCII character looking like space (read more here).
  • Older versions of Regionerate were leaving fragments of source code embedded within regions not created by Regionerate (not having Regionerate’ prefix to be exact) intact. Now you can make it also look into those regions (and remove them, putting their content into its own regions). No more manually removing VS-created regions for Interface implementations. You can also use this option to quickly strip all regions from a given source file. (read more here)
  • Regionerate now will regionerate your nested classes as well 🙂
  • And the most annoying issue for me: when you had string literals containing curly braces, Regionerate treated them as if they were not part of a string, which could break your code in a nasty way. It’s not the case any more, as you can read here.

There’s more, as you can read in official announcement.

Go and get it while it’s still hot.

Technorati Tags:

Desktop

Jeff Atwood in one of his recent posts stated:

If you’re really using your computer, your desktop should almost never be visible.

I think this is an overstatement. If you’re really using your computer, your desktop should be your command center. I agree with Jeff, that stuffing your desktop with lots of icons, shortcuts, documents etc is not basically a good idea. It makes your desktop a mess, and its hard to command if you have a mess in your command center.

myDesktopSmallI try, as a rule of thumb, to not exceed the number of 10 files on my desktop. Thanks to this I always have just the most important files slash documents, I currently work on. On the one hand, it helps me quickly see what I have going on, what reports I have to write etc. On the other hand, having more files, is a good indicator, that I probably try to do too many things at a time, and that I should do something about it.

Second thing (where I agree with Jeff) is using minimalistic, non-distracting wallpaper. It’s more a matter of personal preference than general rule, but I just want my desktop to be clean, and not to draw my attention while I want to focus on other things. Some (like Jeff) go that far, that they use plain desktop instead of some graphics, I on the other hand have this really cute, peaceful tree found somewhere on deviantART, which matches very well my custom Windows theme. I’ve been using both (wallpaper and theme) for years, which is also a non-distracting factor, since I got so used to them that I barely even notice them.

I also could not live without two small utilities called Rainlendar and Rainmeter. You can see them both in enclosed screenshot (click it to see it full-size). Rainlendar is on-desktop calendar with list of forthcoming events and to do list. Rainmeter can provide you with weather information, system info (CPU/memory utilization network traffic/disk information and more, all depending on the skin you’re using.

Thanks to them I can check my schedule straight from the desktop, check the weather without running any website, open any of my drives in Total Commander in one click, straight from my desktop, see the time without bringing taskbar on and even when I’m not close enough to read those small letters in tray. It makes me much more productive.

One more utility visible in the screenshot, is Launchy application launcher. That’s not basically a part of my desktop, but thanks to it, I don’t have to search through menu start to run an application.

Getting back the the main topic – desktop is the starting point of your work, so make it work for you as good as it can. There is no one-size-fits-all-solution for this, but try to find something that fits your needs. Not only those aesthetical, but functional as well.

Technorati Tags: , ,

MbUnit support in ReSharper

ReSharper is great. It (among other things) allow you to run your NUnit and CsUnit tests directly from Visual Studio. However, it doesn’t support MbUnit. There is a plugin created by Albert Weinert, but it’s still in its infancy and I think that this feature should be built directly into the tool. If you feel the same about it, go to JetBrains’ issue tracked and vote for this feature. Hopefully this will make them to move this feature from some undefined ‘future version’ to something nearer, like say 3.0.4…

Technorati Tags: , ,

About ribbon and user interfaces

There’s been some discussion on the blogosphere lately, especially after Patrick Smacchia’s posts on new interface for NDepend. Well, I’ve already said, that as much as I love this tool, it’s current interface leaves much to be desired. It’s a good thing that finally they are doing something about it, and in the direction I talked about in my first post (similar to Visual Studio). Only thing that surprises  me is that by default NDepend will have ribbon, but you (fortunately) will be able to go to options and change it to good old menus and toolstrips.

I’m not going to comment on NDepend team’ choice, instead I’d like to concentrate on other thing – is ribbon really something we should go for? I get it, Office 2007 has ribbon, so finally we have something new and fresh in stiff winforms world, so everyone eagerly wants to play with it. But I don’t really think ribbon is like any other winforms control. I think it’s simply not general purpose, like a button, combobox, or even toolstrip.

There are several reasons why Microsoft put ribbon in office. The most apparent one is target group. What is ribbon anyway? It’s a toolstrip with tabs and really big icons. The reason why Microsoft decided to build office’ user interface with it (the way I see it) is to make it easier for average secretary for whom computer is voodoo to use it. Instead of menus hiding option everything is right in front of her eyes, labeled, and with big shiny icons. That certainly makes it easier for starters to use it.

For advanced users however result is opposite. Advanced users do most of their work with keyboard shortcuts, and don’t care about big icons and descriptive labels under them. What they rather care about is: this big thing on top of my screen eats up lot of space on my monitor. This is especially important in tools where you want to have multiple windows open at once, and every pixel is worth gold.

There’s a reason why Microsoft didn’t put ribbon in VS 2008, and (again, the way I see it) that is exactly this: different target group. Visual Studio is targeted for advanced users who don’t care about big icons and who most of the time use keyboard shortcuts.

Another confusing thing about ribbon is its contextual nature. Like in Word when you click on a table, a tab on a ribbon pops out that lets you select options specific to tables, like add a row, add a column etc. That’s great, but two things first: There is absolutely NO reason why you couldn’t do it with menus and tools strips, and: in case of ribbon, it’s not an option: it’s necessity. Simply ribbon takes so much space that having those all tabs and groups open all the time would eat up space on whole normal monitor. or would require like 3 levels of tabs, that would be even more confusing than toolstrips. And the reason why (almost) no one is doing this with toolstrips and menus is that “Why hide it if there’s enough room for all of it?”.

I personally thing that over time we’ll see some applications with ribbon, as some applications can really improve user experience by leveraging ribbon, but vast majority of those will be targeted for non-computer people. I see ribbon simply as new toy people want to play with. It’s like, in one episode of Dot Net Rocks, if I recall correctly, it probably was about WPF, Carl’s and Richard’s guest said that back in VB3.0 days there were applications that had red forms, simply because they could. I guess what happens with ribbon now, is a similar thing.

Visual Studio 2005 broken with no reason…

The strangest thing happened to me today. I left my PC running yesterday when I left from work, I came today and started working only to find out that my keyboard shortcuts were not working. I went to Tools–>Settings and wanted to re-map my keyboard scheme, but instead of seeing Visual Studio Settings window, I saw “There was a problem and application will be terminated, do you want to send a report to Microsoft bla bla bla” window.

“Ok”, I thought, “shit happens”, I ran Visual Studio once again… Tools–>Settings… Error. Hmmm… maybe restarting Windows would help. Well, not really… I decided to try another approach. Tools–>Import and Export settings–>Reset Settings to default…. wait… NAH! “There was an error bla bla bla”.

To make long story short, I tried disabling/reinstalling plugins, I ran devenv /safemode I tried to log VS activity to see what the problem was (no help here).

Finally it looks like I’ll have my Windows and stuff reinstalled. But the most annoying thing about it is, that there is NO reason why this happened!

Technorati Tags: ,

How do You regionerate your code?

I’ve been using Regionerate for some time, and I’m addicted to it. Literally when I have to write some code on a computer that doesn’t have Regionerate installed I feel odd. This tool is simply pure honey and nuts. Only thing I would change is it’s default keyboard mapping (ctrl+R for running it), because it collides with Visual Studio/ReSharpers “Refactor” shortcut. So every time I install it I have to go to VS settings and change it to something else (alt+3 at the moment).

Main reason for this post however is not to praise Rauchy and his tool, but to talk a little bit about it’s customization capabilities. Regionerate is Xml driven, that is, its regioneration (strange word, huh?) settings are kept in a xml file. It comes with xsd so when you edit it in VS you’ll get intellisence, which is pretty sweat and will save you a lot of time.

The simplest possible  Regionerate settings file would look like this:

<CodeLayout xmlns="http://regionerate.net/schemas/0.6.3.8/CodeLayout.xsd">
    <ForEachClass>
        <CreateRegion>
            <PutFields>
            </PutFields>
        </CreateRegion>
    </ForEachClass>
</CodeLayout>

It creates a region and puts all fields into it, like below:

namespace Xtoff.Tmx.Helpers
{
    public class TmxLanguage
    {
        
        #region [rgn] Unnamed Region (1)
 
        private readonly string _value;
 
        #endregion [rgn]
 
        public TmxLanguage(string value)
        {
            _value = value;
        }
        public string Value
        {
            get { return _value; }
        }
    }
}

All fields were put in a single region, and all other members were left below. Hooray!. However I guess very few would be satisfied at this point.

Before we move on, however, there are a few facts to note.

First of all, regions name: [rgn] Unnamed Region (1)

[rgn] is a standard prefix for regionerate to mark it’s regions. It was introduced because without some kind of differentiator regionerate would break your manually created regions when regionerating your file. Thanks to this, it will only look into parts of your class that are not inside any region, or are inside a Regionerate-created region. You can change this prefix, or remove it. Keep in mind however, that then every region will be treated as a Regionerate-created region.

Next thing is region’s name. We didn’t set it, so Regionerate set it to default. I don’t have to tell you that you DO want to name your regions :).

And finally (1) indication how many elements is in a region. VERY useful when dealing with large files.

Next step would then probably be setting a name, and looking at other options we have.

If you go back to CreateRegion, hit space and wait for intellisence to come up you’ll be presented with 4 options:

Separating lines: Allows you to specify how many free lines you want Regionerate to leave between members in a regions.

ShowCount: Flag allowing you to turn of showing count of members inside of a region, defaults to true, and I don’t recommend changing it.

 

Style: this is one of the best and little known features.

Three valid options are Visible, Comment and Invisible. Visible is the default option, and it will wrap your code with a region like seen above

Comment will clean up your code but instead of enclosing it within a region it will only put a comment on top of all fields, like this:

        // [rgn] Unnamed Region (1)
 
        private readonly string _value;

Invisible, will clean up your code, but it woun’t put any regions not comments.

Title: sets the title for region 🙂

Going down the Xml tree, we can define what we want to put in out region. In our example we chose fields, but you can put basically every class member (field, property, method, event and so on), or inner region. You can do multiple Put* into a region.

Now we’re getting into really interesting stuff, that is defining filters for specific elements we want to put in a region. In the example above we chose to keep all fields in this region, but we could have come up with something much more sophisticated, like region for non serialized public fields with names meetings certain regular expression.

I won’t explain every single option in detail because there are so many that it would take too long. There are also diferences between types of elements (for example for Properties you can filter by accessors). In 9 cases out of 10 you will be able to create rules you want. You can’t create rules like “Region for methods that subscribed to some events” unles you have a naming convention for those, because it would require analysis on a higher level of abstraction, but nonetheless it’s pretty sweat.

And for those interested, I attach my Regionerate settings file.

Technorati Tags: , ,

NDepend – take high level view at your projects

In order to avoid accusation for doing crypto-advertisement, I honestly admit, that I have received for free professional licence for NDepend (worth EUR 299) from Patrick Smacchia (dev lead and inventor of the tool).

It’s kind of weird – I knew about the tool for some time, I even once downloaded its free version, but I got lost when I saw its interface and I didn’t actually play with it much then and I ended up thinking that it’s another crazy/fancy tool for PMs or whoever and I didn’t really see how I might benefit from using it. Then (actually not so long ago) I was listening to one of episodes of my favorite podcast Hanselminutes, and Scott was talking actually whole episode about this tool, and it was then when I realized what it really is about.

It is a really powerful tool, and I’m just diving into it. There are several screencasts that will help you familiarize with it, and I strongly recommend anyone interested in using it to start with screencasts. They are really informative, that is one thing, other is, that user interface in NDepend, is its weakest part. take a look at the screenshot.

ndepend1

You are flooded with information, and unless you know how to look at it, you’ll drown.  It’s simply too much on one screen. You can close some elements to make room for others, but it’s not really a convenient solution. Other really annoying limitation is inability to reorder elements. You only can choose between ordering  Metrics and Dependencies horizontally or vertically. I’d much rather see solution similar to Visual Studio or #Develop, with ability to drag and drop interface elements around, auto-hide them, and ordering with tabs.

Ok, I’ll save more grumbling for the next time. Now let’s move to the nice part that is more important. Ladies and gentlemen I present you CQL.  Truly – that is really wicked idea to query your own code. It’s the single most awesome thing/option/(?)  I have ever seen in a dev tool. And it’s not only something you can use – NDepend uses it internally to gather metrics, and you can open and edit it’s queries, for example:

// <Name>Methods too big (NbLinesOfCode)</Name> 

WARN IF Count > 0 IN SELECT TOP 10 METHODS WHERE NbLinesOfCode > 30

ORDER BY NbLinesOfCode DESC

// METHODS WHERE NbLinesOfCode > 30 are extremely complex and 

// should be split in smaller methods  

// (except if they are automatically generated by a tool).

This gives you names of (at most 10) your methods that have over 30 lines of code, in case of my little project there were three.

ndepend2 

You can see their names, some statistics like, number of IL instructions and get visual indication of (in this case) length of those methods (blue rectangles) compared with other methods in tested assemblies (gray rectangles). Red rectangle is currently selected method.

What I like about this tool the most however, is that it gives you great high level insight into your projects. In one glance you can literally see granularity of your code, and standard metrics that are ran when you load project give you indications about places in your code, that you possibly may be interested in refactoring (too long methods, methods with to many parameters, unused methods and members, stateless methods and classes and so on). It’s very powerful tool and I’m going to post more when I dive deeper into it.

Oh, and if you want to play with this tool, there is a free version that has very few technical limitations compared to professional version. You can grab it here. Have fun.

Technorati tags: , , , ,