remove/delete svn folders

Since I’ve been using SVN and stumbled upon this technique I’ve also been using since then

This is one of the many (but easiest way) to remove SVN folders (.svn) recursively from a given folder. Effectively “unbinding a folder from SVN

Follow these easy steps: [more]

1) download this registry file : DeleteSVNFolders.reg (313.00 bytes) – see below notes for more information (security issues/verification and code source). I urge you to review them but if you don’t want to worry about the details and trust me enough then please go ahead and download.

2) double click on the file you downloaded

    you will be prompted to confirm that you really want to perform the action (differs depending on your OS). just continue and should all go well you will have a successful message/dialog

3) then to see it work go to the folder you want to remove the .svn folders from, then right click it

you should see the “Delete SVN folders” menu item

4) Click the said menu item and the .svn folders will be removed (there will be a command window that will show up displaying progress too – though if the folder structure is not that deep enough it might disappear very quickly).

 

And you’re done

** Notes

1) altering your registry not for the faint-hearted and you’d have to trust the author/publisher. In this case I do and I have been using it for years

    and if you could also look into it (edit e.g. notepad or text editor) and understand what it does if you want to make sure you’re not letting it do something you don’t want

    i have taken this from : Jon Galloway’s Shell Command – Remove SVN Folder and simply created the reg file to be downloadable (for those who are not so confident on how to deal with reg files)

Investing in a Quality Programming Chair

Been quite busy lately work and off work (research ofcourse primarily in urlrewriting) but I couldn't help but notice and comment on a post from CodingHorror/Jeff Atwood on this topic [more]

Read his post on Investing in a Quality Programming Chair

I could very much relate to this (not to mention that somehow I'm particular about productivity and ergonomics). Though don't get me wrong I can't afford 500$ chairs I do value ergonomics or at least in a simple way my comfort most especially those involving work. I have a Php 3000 Logitech MX 610 wireless mouse I'm comfortable with, fits my hand/palm well with curves and a bit inclined rather forcing my wrist to twist flat on the table. I also have a sort of wrist gel for my mouse (don't cost much but what some may still consider unnecessary). I also think of getting  a track ball mouse from time to time and will probably happen soon. There not much chair options here as I've gone to the malls or furniture shops but I'll probably save to get a better chair soon.

Ergonomics is not really something popular here in the Philippines (was looking for a good ergonomic keyboard before and all I can find is the common "A" shaped one – that's how ergonomic it can go here) but I hope it changes soon.

Comfort is subjective but be sure that you are not depriving yourself of it just because of the price. It does bring productivity or even just lessen worries/irritation and focus more on work. Not to mention that health is priceless. 🙂

Code Generation with MyGeneration

I had the chance to grab and have a short look at MyGeneration for a few hours over the weekend and I should say I'm quite impressed with the features that it has. [more]

In one of my previous companies we developed our own custom code generator to fit the company's standard process/way of doing things (or more accurately our boss' way of wanting to do things). Being tied to the company's own way of doing things it had a number of constraints such as relying on naming conventions in database tables, support for other databases and only supported generation of C# for the data access layer. Not to mention it's proprietary. The reason I mentioned this is that I think it is safe for me to say that I knew how hard it can be come up with a decent and flexible code generator which supports templates and doesn't require a recompile to even just change the layout of the output. The code generators I've mentioned earlier involved parsing the template and doing simple to complicated string replacements but when I saw MyGeneration, it's awesome.

Unlike custom code generators like the ones I've worked before (and other commercial generators) that is a little more close to one-click code generation though, MyGeneration is more of a text/file (could be code or not) generator which enables you to generate your output(s) given information of your database's meta/structure (tables, columns, indexes, primary keys, foreign keys, views, stored procedures etc) and controlled via templates. The templates can be written in C#, VB.NET, vbscript or jscript and it is in these templates that you say loop inside you table collections and generate your create/insert, retrieve/select, update, delete (CRUD) stored procedures. Did I mention that there are already a good number of templates for generating stored procedures and data access layers for for some known OR/M frameworks? And if they are not enough like and you would want more control over the generated text/code and you happen to know the languages above then go ahead and create your own templates.

You should really go over to the MyGeneration home and familiarize with it, download the stuff. There is also this one link to a video (in youtube and Google video) to get you started. Mind you the resolution of the video is very bad but it still got me through so it's really trivial.

Moving forward, there are already those available for generating CRUD stored procedures which although also includes generation of stored proc by PrimaryKey I needed more such as stored procedures for every index in the tables I selected. I was a bit hesitant since I don't really have the luxury of time but I modify a template anyway and after a few minutes (yes minutes) I was able to come up with one that fits my needs. Yes that's how easy it is and considering that I did it in vbscript (since I modified an existing vbscript template) rather than C# which I'm most familiar with. Anyways, for those interested here's the content of the modified template.

UPDATE 6/22/2008 : as promised uploaded *.vbgen containing the template (not just the actual content). Just drop it inside Templates/Microsoft SQL Server folder and you'd now see it in your Template browser.

Modified dOOdads template for stored procedures with select by indexes follows: RDG_SQL_StoredProcs.vbgen (18.75 kb)

Ohh did I mention that MyGeneration is open source (BSD license) so create as many copies and modify if you have to.

If you already have a code generation of you're own doing then I would still suggest looking into MyGeneration and see it's features and you're really in for a lot of learning. You could either move features of your CG to it and help the community maintain it or get some ideas to your own and credit MyGeneration for it.

If you have the budget then you might want to look into CodeSmith. It's text/code generator too, is commercial but there are templates (such as .netTiers) which aside from generating the code also generates the Visual Studio projects/solutions along with the data access layer. It is likely to give you the same control over generated output as with MyGeneration but I haven't really looked more into this since I'm not looking into a
commercial product as of the moment but will be sure to keep you posted
if I do. As of the moment CodeSmith has schema providers (allows you to look into and retrieve database meta information of MS SQL, Oracle and MySQL as of the current version) but MyGeneration myMeta API supports more providers and has more templates for non .NET code. You have the source code too so if you need to support a custom database/store that you have it is possible and likely relatively easy to create you're own meta provider for MyGeneration too.

Finally, for some people (including a part of me) who are more comfortable with having
much control over their code rather than generated you might hesistate but if you'll be the
one calling the shots on how it would be generated, how much different
could it be? Literally you could save hundreds of hours.

A more detailed comparison might be in place soon but have to get back to work 🙂 Hope you'd get a lot from MyGeneration and this post.


Resolve Namespace (Visual Studio, Resharper)

How do you "autogenerate" a "using" namespace for a class you typed in Visual Studio? Read along… [more]

I've seen a couple of presentations (in-person, online et al), webcasts etc where there the presenter typed a class name, highlighted by Visual Studio because the namespace cannot be resolved (no using directive or class was not prefixed by the correct a namespace – fully qualified name if that's the right term – though I think it applies to assemblies only).

Anyways, most if not all the time, what they do is add and type the using "directive" (not sure if directive is the right terms, if not then you may call it "usings") manually. There could be a some benefits this in presentations, like making the point clear that the namespace must be added (and what namespace it is). But if the audience are intermediate to advanced level, I think we can do away with it.  However, even in those cases, most are still doing it by typing manually.

I have nothing against this of course but for those who aren't that well versed enough of the numerous namespaces out there, the "resolve" feature in Visual Studio might save you a little time spent coding rather than finding which namespace it is in. Note however, that this only works if the DLL/assembly containing the namespace is referenced in the project. And the spelling and case sensitivity of the class is correct (at least for C#, not sure for VB). Even then, I'm sure a number of us knows the exact class name but not very certain about the namespace (or maybe we just want to save a little time, there's nothing wrong with that).

So to resolve the namespace in Visual Studio (2005, not sure about 2003 yet, but for sure 2008 has this too), here are the steps: (using StringBuilder as the class for this example)

1. Type the class name (make sure you type at the appropriate place/usage – otherwise, you might not be able to resolve properly if you have syntax errors around that area)

2. Right Click on the typed class name

3. context menu should appear and you should see a resolve context menu item (like the one below) 

4. Under the resolve context menu, you generally have two options. The one at the top (henceforth called "upper" option) will create a "using" directive on top of the you class file (something like what's in the image below)

Or if you choose the "lower" option, you Visual Studio would prefix your class with the correct namespace (if you have a reason not to use "using"). 

Also I did mention "generally two items". This is because there can be
more than two. Say if there are classes (with the same name) belonging
to more than one namespace. Each namespace will have a corresponding
menu item for the "upper" and the "lower" options.

So that's all ther is to it.

Finally, if you have Resharper (using v3.1 – and if you don't I suggest you give it a try) then when you hover over the class with the missing namespace you should something like:

Or as indicated in the menu that popped up, you can also place your cursor on the class then press Alt + Enter and the using directive will be added (not sure how to come up with the "lower" option in R#).

So there you have it. I believe one of the underutilized, simple yet productive features of Visual Studio. I suggest you try and use it and I wonder what reasons could make me think otherwise. If there is any.

Smile

[Copy To] and [Move To] Context Menu Items

I find it more productive to simply right click on a file/folder (or multiple file/folders) and be able to copy and move it/them to another folder rather than Cut/Copy, open the target folder and paste or even use Windows Explorer > turn the folder options (tree) on and drag/drop. How do you make it possible? [more]

Adding the copy to and move to context menu items is easy to find in Google (eg. here) but figured it's worth to have a note handy.

It's as simple as adding the following Registry keys:

Open your Registry Editor (eg. Start > Run > type "regedit" > OK, Go to: [HKEY_CLASSES_ROOTAllFilesystemObjectsshellexContextMenuHandlers]

To enable the Copy To Folder menu option create a new subkey called "Copy To" and set the (Default) value to "{C2FBB630-2971-11d1-A18C-00C04FD75D13}".

To enable the Move To Folder menu option create a new subkey called "Move To" and set the (Default) value to "{C2FBB631-2971-11d1-A18C-00C04FD75D13}".

Or download and run the following: CopyToMoveTo.reg (578.00 bytes) (** I suggest you open the file with notepad if you want to check and verify the changes it will be making)

Close your registry editor.

To try, right click on a file/folder (or multiple select). You should see the Copy To/Move To menu items:

Then selecting Copy To or Move To should result on a dialog box like these:

Go try if you haven't yet. I'm sure one way or another it will help make life easier for you.