Thursday, September 27, 2007

Trevor is unlocked

Trevor W is blogging. Take a look over at
Trevor W has unlocked his brain and will shortly be pouring forth the cream of the content from within. Available at, Trevor is well versed in many technologies available from DeveloperExpress and is particularly keen on their XPO and XAF technologies and we should begin to see the gems of information pour forth soon.

Well done Trevor....

I have a feeling I'll be reading your blog for some time to come.

Friday, September 14, 2007

DX_Contrib, MoveIt, PaintIt and UnusedVariables all added to DXCorePlugins

The sourcecode to DX_Contrib, MoveIt, PaintIt and UnusedVariables has now been uploaded to
These projects (DX_Contrib, MoveIt, PaintIt and UnusedVariables) are all still somewhat in flux.

I'm trying to get around to making sure that the cache employed by each of them for paint purposes is kept up to date.

This seemed originally to have some performance issues and I am trying to move towards a background threaded mechanism for keeping said cache up to date.

The problem seems to be that each time I approach this system looking to see if I Can improve it, it takes almost all my spare time to analyse what I have done to date. so that I seem to have very little time left to actually improve it.

This of course smacks of poor documentation/commenting. Therefore I have checked the entire set of projects into

At least this way everyone can see where things have reached.

I am by no means giving up on these projects though. I intend to start going through the code making damn sure that I comment things as I go this time ;)

New project: DX_Sample

I have added DX_Samples to

DX_Samples was created in response to a question on the DX_Plugin newsgroup asking for
"a quick example of how I might go making an action that auto-creates regions around any properties that are not already in a region."

DX_Samples contains a plugin called RegionWrapProperties which wraps *all* properties in a class in a region. This is clearly not *exactly* what the original poster asked but we'll get there.

In the mean time we now have a suitable project for creating reference examples about how things can be done, without necessarily needing to create *full* examples.

Wednesday, September 12, 2007

Coderush EmbedParenthesis Tip

Idea by Neal Culiner... Configuration workaround by Mark Miller....
Coderush contains a feature called "Embed Parenthesis". this feature allows a user to select a portion of their code and to then type either '(' or ')'.

At 19:20 this evening (According to my newsreader) Neal Culiner suggested on the Coderush forum that it would be good if the existing EmbedParenthesis feature could be made somewhat more intelligent. He suggested that the caret should be placed either left or right of the final expression dependant on which of the 2 keys had been pressed in order to activate said function.
This is particularly useful as, Neal pointed out, for vb programmers who regularly highlight small expressions and wrap parenthesis around them so that we might CInt, CStr or CType.

I would also be sensible to use this to wrap an expression in any function call which passes such an expression.

"Great" said I "Add that to the support center and I'll track it too".

By 20:20 Mark Miller had spotted the conversation and posted a solution which required no new distribution of Coderush as all could be done with the existing version.

For those not willing to click through and read Mark's version, the solution is simple and elegant.
Simply create 2 'Selection\Embedding' entries. One for ParensCaretOnLeft and another for ParensCaretOnRight. Each should be the 5th type of SelectionEmbedding

For ParensCaretOnLeft, the Top line should be...
...and the bottom line should be...

This should be suitably changed for ParensCaretOnRight

Then just change the existing bindings for Shift+9 and Shift+0 in "IDE\Shortcuts" to trigger the "Embed" rather than "EmbedParenthesis" and give each a parameter of either
'ParensCaretOnLeft' or 'ParensCaretOnRight'

You should now be good to go.

Tuesday, September 11, 2007

Write your own Dynamic Template

How do you write your own custom Dynamic-Template for CodeRush?
CodeRush 2.0 introduced the concept of Dynamic-Templates which I blogged about some time ago here. However I don't think I ever went into any detail about how you make your own.

Well the process is fairly simple.

To show you how this is done I will give an example.

Lets create a new template that will spit out code like...
Throw New ApplicationException
Throw New System.InvalidCastException
Throw New System.IO.FileNotFoundException

...based the specifics of your mneumonic.

The first step is to create a Dynamic List.

Follow these steps to get to the Dynamic Lists options page:

1. From the DevExpress menu, select "Options...".
2. In the tree view on the left, navigate to this folder:


3. Select the "Dynamic Lists" options page.

Now we would like to create a "neutral" list, because this list should be available to all language types.

(Note: This is not technically true. I would prefer to make this list available to only and C#, but for now there is no way to do this other than to duplicate the list for these types. This will not matter too much as we will only be creating templates that use this list in VB.Net and C# anyway)

To do this we must ensure that the language dropdown reads "neutral".

Next we will right click the "Lists" list in the center column of the options screen and select "New".

You will next have to fill out 3 boxes with values for Name, Variable and a Comment.

Name should mean something to you, and it is what will appear in the previously mentioned "Lists" list once you save. I typed "Exception Types" in this box.
Variable is the suitable variable name in which DXCore will store the user/developer's selected item. I typed "Exception" here.

...and Comment is just a comment. I guess you should write a comment here :)

Once saved, your list is ready to be filled. This is accomplished by adding items on the right-hand side of the options dialog.

Each item added requires a mnemonic and a value.
We will add the following items

a - ApplicationException
ic - InvalidCastException
fnf - FileNotFoundException

Then we can push "apply" and our list is saved.

So how do we use this list in a sensible way?

This is the easy part.

Navigate to the "Editor\Templates" options page and create a new template. I'm going to do the VB one for now so I'll select VB.Net from the language dropdown first.

This template will need a special name. You need to use a special syntax within the name to indicate where DXCore should allow the user to substitute one of the mneumonics we created earlier.

We will call our Template "tn?Exception?".

What this means is that our Template will be triggered by the letters 't' , 'n' and any mneumonic from the Dynamic-List.

The expansion of our template will be:-
Throw New «?Get(Exception)»
The '«?Get»' is a StringProvider. StringProviders are available to insert from the right-click context menu in the expansion box. The '(Exception)' is the parameter for the StringProvider. In this case the phrase '«?Get(Exception)»' retrieves the string held in the "Exception" variable placed there by the trigger mneumonic.

Once this little gem is saved, you should be able to trigger your 3 expansions with any of the 3 phrases 'tna', 'tnfnf' or 'tnic'

The great thing is that you can add additional exception types to the "Exception Types" Dynamic-List at any time and they will also work with the template we have defined.

So now you have some simple mneumonics to help throw exceptions.

Sunday, September 09, 2007

Minor CR_WorkBench update.

CR_Workbench now Autoloads and Autosaves.
Yes CR_WorkBench now has an option "AutoLoad and AutoSave" vailable from "DevExpress\Options\ToolWindows\WorkBench".
This will cause your WorkBench to save each time you close your solution.
It will (kinda obviously) attempt to load a WorkBench each time you open a solution.

This new functionality added in revision 18 of DXCorePlugins

Wednesday, September 05, 2007

URL Mistake

It seems I have been quoting the wrong Urls in my previous DXCorePlugin posts.
I have now corrected the posts themselves but if you use an rss reader to view this then you might have already downloaded an earlier version.

Essentially I published Urls which required a login in order to gain access the the resources.

The correct Urls are

CR_Contexts added to DXCorePlugins

I have added a new plugin (CR_Contexts) to DXCorePlugins to add a few new contexts to DevExpress's IDE Tools

The new plugin provides 3 new Clipboard contexts called 'Clipboard Contains (Literal)', 'isMultiLine' and 'Clipboard Contains (RegEx)'

All found underneath 'Editor\Clipboard'


This source available via GoogleCode and Subversion.
CR_Contexts available from
Common code available from

QuickTemplates added to DXCorePlugins

Just a quick note to tell those who are interested that I have added my QuickTemplates plugin to DXCorePlugins
Yup, QuickTemplates is now available as a part of DXCorePlugins.

This source available via GoogleCode and Subversion.
QuickTemplates available from
Common code available from


CR_Workbench is a DXCore plugin which provides you with a toolwindow to store references to commonly used files.

CR_workBench gives you a toolwindow into which you can drag/drop files from either Solution Explorer or Windows Explorer.

All files placed on the WorkBench can be Double-Clicked to load them into the editor

The WorkBench has a context menu which allows loading and saving it's list to and from a file called [Docs and Settings]\[You user name]\Local Settings\Application Data\WorkBenches\[Solution Name].sln.wrk"

The only real point is to allow you a window which does not contain the whole breadth of files in your solution. If you save your workspace (I'm thinking of adding Autoload/Autosave) then you can close all documents prior to saving your solution and thus receive a much faster start-up next time studio loads this solution.

This source available via GoogleCode and Subversion.
WorkBench available from
Common code available from

Tuesday, September 04, 2007

GoogleCode - DXCorePlugins

And so I have created a GoogleCode repository for an open source project called 'DXCorePlugins'.

I created 'DXCorePlugins' because I wanted a better way to manage my open source plugins for DXCore, CR and R!.

I irks me that I don't do as much work on said plugins as I would like to. I came to the conclusion that it was all the management that was becoming awkward.

Creating versioned code...
... to make versioned assemblies...
... and building versioned zip files with both source code and binaries.
... updating web pages to reference said zip files and explain the purpose of each.

... trying to keep track of 'issues', 'bugs' and 'feature requests'

It's all management which distracts from the fun part.... making a cool plugin which does something to help people in their daily coding lives.

So I decided that I had to move the source code off my machine and into a repository of some kind. We use CVS at work but are thinking of moving to SubVersion. so ideally this would be a good chance to get to know said source control software on something less mission critical.

So I needed hosting of an open source project which ideally allowed SubVersion access to the repository of code.

2 obvious candidates: SourceForge and GoogleCode. This does not make a definitive set but this is a hobby project after all. I didn't want the research to take over my life.

It should be noted that I did consider Codeplex but decided against it because of what appeared to be a bias toward MS SCC API. To me MS SCC API shouts SourceSafe and I've been stung there before. Now I know that this is an unfair judgement, but ours is a small company and we cannot afford to spend too much time on micro-management so the fewer pieces involved, the better. I simply saw Subversion as a natural evolution of CVS and therefore when I saw that I would need to introduce additional pieces( some kind of SSC - Subversion bridge) I basically ruled out Codeplex then and there.

Now... to say that I was then left with SourceForge and GoogleCode is also something of an unfair statement. A more accurate statement would have been..."I was left with GoogleCode and, if I really had to, SourceForge".

You see, SourceForge has, for me, been the slowest of experiences. Accessing a SourceForge has always been like returning to the days of dial-up connections. It makes me wonder if this isn't the method they use to connect their servers to the internet. Now in fairness, I have been led to believe that this is not the case for everyone. many people apparently find SourceForge a very reasonable resource. however I am apparently not in that position. So from day one, If I could run without SourceForge, I was going to...

And therein lies my one regret. If not for this one issue I would simply have added my code to the CRPlugin project on SourceForge. I would recommend that these projects definitely be checked out.

And so unless GoogleCode was to provide and major stumbling blocks, I was going to use it.

So how does one create a project on GoogleCode?

Well it turns out it's really easy. Just show up at and declare the Name and Licence of your project. That's essentially all there is to it. True you'll need an account with google, but who doesn't have a GMail account these days anyway.

The hard part was choosing a Licence for the project.

Now originally I wanted to specify do anything you like with the code except sell it (I wanted to encourage giving back to the community) but I realised I was spending way too much time considering the licence when... In truth, I didn't really care what people did with the code as long as they don't blame me for something it might do by mistake.

I stared at the list and their definitions for ages before I finally gave in and asked for help.

Trevor Westerdahl rescued me and pointed me in the direction of the MIT licence. Indicating "An MIT license is about as "open" as a license gets. It essentially protects the writer form any in there are no warranties of any kind, but allows for selling, copying, redistributing, etc."

It sounded good to me, and so there you have it. is up and running with it's first project 'CR_WorkBench'.