Tuesday, November 14, 2006

NantShell

So following my last post I decided to get of my butt and see if I could make something to fill the need.


So....I've created this little program 'NantShell' which is basically a console app designed to evaluate commands entered and respond.

If the command entered is not recognised, then NantShell assumes that I am trying to specify a Nant 'Target' for it to run.

So it looks through it's list of directories and scripts to see if it has any target whose name matches the command entered (Note: command/target name match process is case sensitive.)

Well that was the start anyway. :)

Since then I have added a bunch of features to help make things easier.

1.> NantShell has it's own built-in help available by typing 'help' or '?'

2.> NantShell has commands for adding namespaces* (xml), scripts(*.build) and directories(with scripts in) to it's environment.

3.> NantShell has it's own config file (NantShell.config) (Crappy custom rubbish for now as I'm lazy. Yeah go figure :)) to list out namespaces*, directories and script-files which will be preloaded in to the environment at startup.

So basically the system understands that you want to run Nant targets but that you are way too lazy to want to create batch files or other launch mechanisms to trigger them.

Further, you might have these Targets spread over many files and have many Targets within each file.

So NantShell builds, what amounts to, a Path (or list) of (script) files which it is willing to search through each and every time you ask it, looking for the precious target you said it would find somewhere in there, and then it executes it for you.

Wow I'm sure there should have been more punctuation in there

*Note: Namespaces, in this context, are things which need to be removed from the DocumentElement of a XMLdocument before my XPath stuff would work :)

Yeah it's a hack because I am, for the moment at least, too lazy to work out why this doesn't work.

(Since I know next to nothing about xml namespaces, (and I was feeling impatient) I just thought
Screw It!... I'll just remove them.
and what do you know.... it worked :) )


So give me some feedback.

What do you think?

Oh yeah and does anyone know how I might embed this in a toolwindow for DevExpress's CodeRush?

Thursday, November 09, 2006

Nant Runner/Console

I seem to be accumulating a lot of NAnt files which require arbitrary periodic running...
I was thinking the other night about how many NAnt files I seem to have with targets which do highly useful things when run without requiring any params.

RestoreDemoDatabase
RegenerateNantXSD
GoMakeMeACoffee <-- yeah I wish

It occurred to me that it would be really good if I had a sort of dos-box *interactive* nant console application.

This app would be launched with an optional list of build files.

I could interactively ask it to load further build files and then I could execute targets by name.


So I could just Type the name of a target and it would run.

Sounds like something PowerShell could do.

or perhaps just a simple .net console app.

I've never made an interactive console app before (I guess you might call this a shell of sorts)

Can someone point me in the direction of a small example?

What do ya'll think of this as an idea anyway?

NantShell.... yeah I like the sound of that



The Nant .XSD ( schema)

Jay Flowers sent me an email this morning, to remind me that you can recreate the NAnt XSD(Schema) at any time by running the 'nantschema' task.....Jay Flowers reminded me of nant's very clever built in 'nantschema' task which will create an xsd (named however you like) containing the schema for the entire suite of NAnt tasks present your copy.

This means that if you have downloaded NantContrib or have created your own tasks, then the 'nantschema' task will reflect over these and include them in the xsd it creates.

As Jay says you can have visual studio give you this information back as intellisense by setting the default namespace of your build file to the generated xsd.

Jay also gave a link to a good 'HowTo' which covers pretty much all you need to know

Thanks for the mail Jay

:)

Nant Task - Call2

Is anyone else sick of being unable to pass parameters to a Nant 'Call' task?


I am thinking about writing a new "Call2" Nant task. It would work like 'Call' but treat all extra attributes as properties to create or overwrite prior to execution of the referenced task.

It would effectively allow me the following shortcut:

Instead of....
-------------------------------------------------------------



-------------------------------------------------------------

...I would be able to type ...

-------------------------------------------------------------

-------------------------------------------------------------

For me at least this will be quite the time saver.

Is this a waste of time?

Has someone else already done this?

Is it already in NAnt somewhere under a different name?

I'd be glad to hear anyone's opinion on the subject.

If you're interested in this task, drop me a line at my GMail address or post in the comments.


Templates in the Template editor (revisited)

So after a bit of thought (and some help from the relevant forum) I've come up with a way to use templates in the Coderush Template Editor.
You'll recall my post some several minutes ago where I declared that it would be really useful to be able to execute a template whilst editing another template.

You'll also recall (because it really wasn't so very long ago) that CodeRush, at the time of writing, does not support this.

Well I've found a solution. It's not perfect by any means but it does help quite significantly. It turns out that AutoHotKey mentioned in a previous post is nearly perfect for the job.

It cannot do 'Selection Embedding', but it can do simple text replacement based on HotStrings.

A HotString is like the key sequence that might trigger a CodeRush Template.

In this case, the simple scripts of...
-------------------------------------------------------------
:*?:<<::«
:*?:>>::»
::field::«Field»
::fieldstart::«FieldStart»
::fieldend::«FieldEnd»
-------------------------------------------------------------
... create 5 HotStrings which expand suitably from one form to another.

Thus << becomes «
and >> becomes »

The difference is that these templates are system-wide and will work in any textbox or word processor.

However there is much that these Templates cannot do.

There is no Linked Identifiers, No simple «Field» switching and I don't appear to be able to set a location for the caret to finish up at.

So while these HotStrings are very useful for setting up «cursor»_«BlockQuote» and «FieldStart»-«FieldEnd» combos, they are entirely incapable of replacing them.

Still they are useful.

Some CodeRush Template Editor Ideas

As my last post indicated, I've been playing around a lot more with CodeRush's 'Template' facility.
In my recent attempts to create all kinds of CodeRush templates, I have come across a few... items which could stand a little improvement in the template editor.

1.> «Cursor» and «BlockQuote» have little icons to represent them but «FieldStart» and «FieldEnd» do not.
I'm finding that I am using these 2 little gems more and more all the time and it's getting quite annoying to have to reach for the mouse in order to select these.

2.> My next thought was simple (like so many of them). I could create a template to create the phrases and so ease my task.
except that the template editor does not consider itself part of the IDE and as such cannot run templates within itself.

3.> One common situation is one where you have a prospective template in which you hope to embed several 'fields'. These should have temporary wording in place of each with a «FieldStart»-«FieldEnd» pair around each. Further, the first of these should have a «Cursor»-«BlockQuote» pair around the outside of it so that it becomes the initially selected field.

This leads us to a situation where one would like to do either of the following:

a.> Highlight some text and use a 'Selection Embedding' to wrap the text in a «FieldStart»-«FieldEnd» or a «Cursor»-«BlockQuote» combination or perhaps even both.

Or

b.> Click «Cursor», Select «FieldStart»,Type Some Text, Select «FieldEnd» and Click «BlockQuote»

The first case is simply not supported. I have raised it as a suggestion and am waiting to hear an answer from the support center

The second case works (Sort of). What I mean is that currently there is a bug (in my opinion) wherein after one selects an item from the dropdown list of commands, the cursor in placed to the left of the inserted command (rather than to the right).

Thus the insertion of further commands without first manually reseating the cursor, result in the commands being chosen in the order 1, 2, 3 and yet appearing in text as 3, 2, 1.

Initially it is hard to observe this behaviour because although the caret's virtual position appears to be to the left, the caret itself is not visible because the focus is on the command dropdown.

I believe that this bug is responsible for people creating templates like:

-------------------------------------------------------------
SomeText«Cursor»«FieldStart»Field«BlockQuote»«FieldEnd»EndText
-------------------------------------------------------------

...when they meant to create...

-------------------------------------------------------------
SomeText«Cursor»«FieldStart»Field«FieldEnd»«BlockQuote»EndText
-------------------------------------------------------------

Then (without noticing that something is amiss) they wonder why (and in some cases ask tech-support/newsgroup residents why) their template doesn't work.

This is a minor bug but I felt that since they seem so few and far between, I should mention it to prove that I am unbiased in things DXCore based :)


Wednesday, November 08, 2006

Nant Templates

Some Nant CodeRush Templates I've created. Available to all.
I've been doing a lot of work with Nant recently and quite frankly there is nothing quite so annoying as having to type all those angle brackets. I just don't know how a c# guy puts up with having to do that sort of thing all the time :P

Thankfully CodeRush makes this a lot easier. Within seconds I had created several useful templates which, as usual, I have chosen to share with the rest of you.

Aren't you all so very lucky :P

The file is available here


Update(09 Nov 2006) Jay Flowers points out that I have made no mention of just what templates I created (DOH!)

So.....
FYI: Templates include:- Property, Target, Copy, Delete, Exec, mkdir as well as a few aliases to help with some default uses. These should import into a Template folder of Custom\NAnt.

Also included is my most used template $ which expands to ${} with the caret in the brackets.

On closer inspection I don't seem to have included a 'Project' Template which would be good. I'll have a look at adding that.


Friday, November 03, 2006

Bugzilla?!?! You gotta be Sh*tting me

It's been suggested that I look into BugZilla..
Ok.. So I've just been to look at...

http://www.bugzilla.org/docs/win32install.html

Holy crap but that's complicated.

That's just the sort of time I don't have.

The reason I mentioned FogBugz is that although it costs money (and yeah I already approached Joel for a freebie Single-User Support-the-Open-Source-Movement edition. But that wasn't going to happen.), It is very simple to setup and it is very intuitive to use.

How do I know this? Well my company (erm well ... the one I work for) bought a copy of FogBugz a few months back for our own use and I have to say it's wonderful. Not perfect (what is?) but really very good.

But hey, asking people for donations is still a bit lame I know. So I tripped out to the Bugzilla site and well how should I put this....?

I tend to judge the maintainability/security(and in fairness flexibility) of something by how many parts it is made up of and how long those parts take to setup initially.

Shall we say that Bugzilla was clearly developed with the *nix style user/developer in mind.


I couldn't in clear conscience install that software on any machine which wasn't mine unless I was spending all day every day learning about just how it worked so that I could be sure it didn't have any gapping security holes in it.

It might very well have none. I freely admit that it probably doesn't.

But I'd much rather stick to something based on MS SQL server and IIS.
(Probably because I know a little about how they work)

Oh and if I didn't mention it already, My company had already volunteered to host this little project for me (back when I asked Joel for a copy) as long as I could give them reasonable assurances as to the security, Lack of conflicts and generally not mashing up their machine for them.

With Bugzilla I'd have to spend far too long trying understand enough to appease my conscience.

Any other ideas?


Bug Reports (and Donations :P)

With work on my plugins being so sporadic, it's sometimes difficult to keep track of what I should be working on next....
Yup its my own fault really. I asked people to contact me anyway and anyhow but in truth the best way to submit bugs and feature requests is simple.

Just send them to my Gmail address RoryBecker[At]Gmail[Dot]Com
I will then file them and deal with them as well as I can in order.

Of course if anyone wants to fund me a copy of FogBugz ( which would solve all of these issues) then feel free to donate some money:













(I believe FB costs around $120 total :P )

But for now, my GMail address is probably best for reports.


Visual Studio hotfixes available without contacting support!!

From the DailyGrid 1005 - Mike Gunderloy (my delayed congratulations by the way Mike), News that the VS.Net team are making VS.net hotfixes available for download without having to go through product support.

Thursday, November 02, 2006

DX_ContextContrib now available

My first Context-Providing plugin created to fill a need first suggested by Dan Avni in the DevExpress's Coderush newsgroup

In response to a post by Dan Avni in DevExpress's CodeRush newsgroup, I've created a new but very simple plugin which provides the developer with 3 new contexts.

Editor\Clipboard\IsMultiLine
Editor\Clipboard\Contains Literal
Editor\Clipboard\Contains RegEx

Dan's post required the first of these and I just decided to add the others for the fun of it :)

The addition of IsMultiLine allows us to create a duplicate of the 're' Template and change it so that it detects that the Clipboard string is Multi-line and therefore place this string, not in the region name, but as the region body.

The template...
--------------------------
#Region "«Caret»"
«Paste»
#End Region
--------------------------
.... seems to work great :)

Assuming of course that you tick the right contexts

Duplicate the original template (and name it 're' also) then change the body of the duplicate to the above code and add the (Clipboard)isMultiline context. Further you can either assign a negative isMultiline requirement to the original or alternatively move the priority of the new template above the old one.

Questions... comments

Again I hope this helps someone :)