.net DevExpress

An easier way to populate XtraLayoutControl

[DevEx] has a nice UI layout control XtraLayoutControl that helps both designer and runtime user to design WinForms UI with ease.  One can even save and load layouts (again, both at design and runtime). This way end-user can customize the layout and perhaps persist his/her changes somewhere.

(picture taken from [DevEx] website)

While XtraLayoutControl is a real time saver and end-user source of customization happiness (not to mention that it brings down costs of development) it has some rough edges. Here are two features that can drastically improve:

  • visual inheritance support

Almost non existent. You can't change layout on derived forms. Unfortunately, dropping VI support, is a general trend inspired by [MS] itself (I posted a while ago here) and I am not sure how much can [DevEx] improve it. It would be nice to have an option to add and change items though.

  • design time support

XtraLayoutControl has great design time support, yet they are missing one feature: being able to create & bind items automatically, like VS2005's drag & drop from Data Sources window on to the form instance (did you actually know about this VS2005's feature?). So, if you have an entity with 30 properties you want to put on XtraLayoutControl you will have to work quite a lot. If you like to see this feature (and I bet [DevEx] is already working on it for some time) you can cast a vote here (issue CS19682).

Is there anything you can do to avoid there shortcomings? There is not much you can do to enhance VI support. But you can speed up layout building process. Here is what I am doing:

  1. Create a new Form
  2. Use VS2005 drag & drop from Data Source window to the form. It creates both labels and controls for me (you have to use Detail mode otherwise you'll end up with a grid). The nice thing here is that it creates [DevEx] controls by default. What's even better is that all of the controls are already bound.
  3. Drop a XtraLayoutControl on it and don't dock it.
  4. Drag and drop each control (leave label as is) on to the XtraLayoutControl and position it as you want.
  5. When you are done, delete labels and dock XtraLayoutControl  wherever you want.

This process saves me a lot of mouse actions and keyboard clicks. Do you have a better way?

UPDATE: [DevEx] confirmed that they are working on this feature. If you want to see what are they cranking just follow my suggestion report here (issue CS19682) and see their response.

Hardware Windows

Using not supported USB (2.0) devices on Vista

In the last post I spitted over HP for not supplying Vista drivers for one of their scanners I own. I won’t repeat my disappointment again, rather I’ll supply a solution. No, it is not buying a newer scanner from HP.

It is far easier – use [VMWare] Workstation 6.0 (currently in beta) that supports USB 2.0 devices. I tested and it works almost flawlessly. The only trick is that you have to attach USB device during Windows XP (yes, the guest is XP SP2) boot process – otherwise guest machine will freeze for some reason (it is in beta, so it is normal to have bugs). Also I am not sure whether USB 2.0 is supported in their free [VMWare] Player product.

It turns out that [VMWare] Workstation 6.0 is a very valuable solution for Vista upgrade situation, too (besides the obvious advantages) as you can use not supported USB 2.0 devices (and perhaps others) within a virtual machine hosted on Vista.

Hardware Windows

The arrogance of HP

In one of the latest posts I ranted about missing Vista drivers for some hardware I own. Among them is a HP DeskJet 3970 scanner. The topic of the post was “hey, why are those drivers late”. But I certainly didn’t anticipate the HP official statement. But let’s get back a few minutes.

From time to time I check missing-Vista-driver-hardware companies web sites whether there is a Vista driver made available. So I went to HP’s DeskJet 3970 drivers page and amongst drivers for older OS I saw both Vista and Vista x64 links. I almost couldn’t believe – HP made Vista drivers before Vista’s official launch. Wow. Of course I was being naive.

Here is the page that followed click on Vista drivers link:

(click on picture to see full size, here is a link to the page)

And pay special attention to this part:

…please consider upgrading to a newer HP product that is supported on Windows Vista.

How hard is to update a working Windows XP driver version to Vista? I certainly don’t think it is that hard or even hard at all. HP is obviously trying to squeeze some more money from their customers. And they are doing it with a huge arrogant attitude.

So, HP left me without support for not-so-cheap scanner. And they are even suggesting me to buy one of their newer models? Do I look like an idiot. OK, I could look like one since I bought their scanner in the past. But do I look like a total idiot? Would I buy from a company that doesn’t care about their customers? Would I buy a scanner “built” for Vista just to replace it with newer model when Vista SP1 comes out? And I am sure that this scanner is not the only HP device left behind.  I am also sorry to see HP, once a quality company, loosing the latest bits of credibility they have.

Dear HP, yes, I might buy a newer model, but certainly not from you.


Software protection collateral damage

While I don’t support piracy in any way, I am against aggressive software protection, too. Let’s take for example Windows XP. On one hand it takes days if not hours for pirates to crack the protection while on the other hand the built in protection might cause huge problems to legitimate users.

Check out this article:

IMO the only real protection is in added value (support, development) not in all sort mechanisms that causes all sorts of problems and pain to legitimate users. And beware, those protections can put your computer at risk, too, just remember Sony and its “root kit protection” for CDs.

Don’t worry, things are just getting worse. Vista is brining complicated DRM protections built right into its core.


Assembly Binding Log Viewer fixed window size

If you are somewhat serious about .net development you certainly know Assembly Binding Log Viewer utility (aka Fuslogvw.exe), do you? If you don’t, you should – it lists all assembly bindings (both successfull and failed ones, depending on settings). 

Now, while this utility is very useful it has a crappy UI. What person made Assembly Binding Log Viewer  window of fixed size (at this point I won’t mention the other great parts of UI)? I mean it is usually packed with data which is displayed in a tiny list – at the time when 20″ LCDs are more and more available.

Somebody need serious dogfooding and some lessons in UI. Or perhaps it is time to write a custom viewer.

.net ASP.Net

Visual Studio 2005 "kindly" starts an development server per project

I have a solution containing both WinForms and projects. There is nothing wrong with this. However, when I set a configuration that runs only a single WinForms project where all of the projects aren’t even marked for build and start debugging I still get an development server per project – that’s two development servers for me. Or better, that’s two useless, memory and CPU cycles wasting development servers running in background.

One would think that this is some sort of bug, so did I. But hey, no, this is by design:

Isn’t that generous from Visual Studio 2005 – to give me more than I asked for?

Anyway, I’ve reopened bug report:


Select Case ambiguity in VB.Net

Consider this piece of code:

Dim a As Integer = 0 Select Case a Case 0 Console.WriteLine("a") Case 0 Console.WriteLine("b") End Select Console.ReadLine()

As a C# developer I was pretty sure that this code will never get compiled. Of course I was wrong. I leave to you guessing which line gets executed.

Does this relaxed compilation makes sense to you? You don’t even get a warning of a clear error in your Select Case. Imagine you have bigger Select Case with a lot of Case lines. You can overlook ambiguity pretty quickly and your application will behave oddly. If you ask me, this feature is just calling for troubles.

If you wonder – C# won’t compile such code ever and this is the only right way of dealing with this issue. You’ll get pretty descriptive error on second case label:

Error 1 The label ‘case 0:’ already occurs in this switch statement …\Projects\WindowsApplication22\Form3.cs 22 22 WindowsApplication22

Compile time errors are best way to find the errors. Far better than your customers finding them.

.net DevExpress

CodeRush’s amazing References window

There is another compelling feature brought to us by [CR] 2.1.x version: References window combined with ultra fast “Find All References” feature. Find All References* is a faster version than VS2005′ feature with same name (note that [CR] supports VS2003 and I think 2002 too, thus it automatically gives you same functionality there).

While the feature is similar (albeit much faster), the output is much improved. For this purpose a new docking window, References window (found in DevExpress/Tool Windows menu) is used to display all references utilizing different fonts and color (perhaps it is just a bit too much colorful and font different) in the left window. Furthermore, it can display a piece of code around selected reference (see right window).

Did I mention that [CR]’ version is much faster? In fact it is so fast that another option is possible: Live Sync (in upper left corner of Reference window). Live Sync performs Find All References in real time, when you move your caret in source code so you don’t have to invoke it manually each time and you have all references display at all times. To show off [DX] included even performance information in References window status bar.

See [CR]’ Find All References in action (caret is positioned over calcEdit1 variable):

(click to see normal size)

Here is also a video of new features in [CR] 2.1.x.

Personally I find References window (Live Sync all the time) of a great help to me, an another must have feature, and [CR] even more of a tool one can’t live without.

*Find All References searches for all references to given variable or type in entire solution and displays the output in a separate docking window. Very handy feature.


Vista drivers and big companies

I have been running Vista x86 for a while now (since it went RTM). The only problem I am facing is the lack of drivers for certain hardware. Here is the list of devices that won’t work or their software won’t work for me under Vista x86

  • HP Scanjet scanner
  • ActiveCard/SmartTrust (not sure why my smartcard won’t work, apparently there are problems with driver)
  • [MS] Lifecam
  • Panasonic video camera (works, but its bundled software won’t work)
  • Samsung color laser printer (works with Vista’s drivers, but its driver won’t)
  • Gigabyte motherboard/video card (drivers for Vista are in beta, works with Vista drivers)

Why all the delay? Vista has been RTM for a while now and for a long time in beta. It is true that it isn’t selling yet, but hey, why don’t have drivers ready by now? They can’t say they didn’t know Vista is coming.

Seems that the bigger the company is the less flexible it is in providing new drivers. Gigabyte has at least beta drivers which makes it the best of the list, while the worst are HP and SmartTrust – their hardware won’t work at all.

On the other, bright, side there is Intel with its Matrix Storage drivers (RAID on their chipset) which were provided almost immediately after Vista came out.

.net DevExpress

Finally an improved debugger’s Step Into feature

Finally we got an improved VS’ Step Into feature. But what is wrong with actual one? Let’s see an example:

public static void Main() { SomeMethod(SomeField, GetSomeValue()); } private void SomeMethod(bool flag, int value) { ... } private bool SomeField { get { bool result = ... ... return result; } } private int GetSomeValue() { .... return number; }

Imagine you are positioned before SomeMethod gets invoked and you want to step into SomeMethod directly. Untill now you’ve got an annoyance here. The only option was to set a breakpoint at the beginning of SomeMethod and Step Over or run the code and wait for breakpoint being hit.

If you instead choose Step Into then you would step into each of the parameters being passed before stepping into SomeMethod, in my case a property and another method.  Highly annoying.

OK, there is also a DebuggerStepThrough attribute which you can apply at design time to a property or to a method. At the runtime the debugger won’t step into methods or properties decorated with this attribute. But this option is very rigid as you have to decide at design time and you can’t change it during execution. Plus it requires source code modifications.

So people have been waiting for direct step into (or whatever you want to call it) since the beginning of VS creation. No luck so far, [MS] apparently didn’t hear on this ear. Instead, fine [DevEx] folks decided to implement it by themselves and put the feature into the latest incarnation of CodeRush. Yes, by installing CodeRush 2.1.1 or newer you get direct step into through the Shift-Ctrl+F11 (configurable) shortcut. No more ad-hoc breakpoints, no more countless hours of stepping into just to get into the right method – hit Shift+Ctrl+F11 and there you go directly into the method you want.

If you are still undecided whether to install CodeRush or not, this is a perfect reason to install it. Besides this handy feature there is a lot, lot more that CodeRush brings you.