A Blog by Scott Isaacs

Tag: Software Projects

Cropper and TinyPic

By now you may have heard about Cropper by Brian Scott (I’ve even mentioned it before).  It’s a nifty screen capture utility that I originally found linked from Scott Hanselman’s Ultimate Tools list.  I’ve used it a few times, and it’s pretty cool.  You can optionally choose to create thumbnails of each screen capture.

Well, Patrick Altman is a self-proclaimed Cropper fan, and he has written a nice little plugin for it.  His plugin will take a standard Cropper screen capture in PNG format and upload it to TinyPic.  Then it places the URL of the image into the clipboard for easy pasting into blogs, etc.  You should try it!  (Note:  This image was added using this method.)

One important thing to note, though: Patrick’s plugin is compiled against a previous Cropper BETA.  I had to use Reflector to disassemble it and recompile it.  I didn’t have to change anything — just a recompile.  If you don’t want to go through that hassle (or don’t know how), send me a quick note and I’ll forward you my recompiled version.  I don’t want to post it here because it’s not my code to post, but until Patrick has a chance to update it, or tell me to stop, I’ll share.

I do also have a couple suggestions for Patrick (which I sent him via e-mail earlier today):

  1. Right now, if Cropper is configured to create a thumbnail image, that image does not get uploaded to TinyPic.  That would be a nice feature.
  2. Because I really love my clipboard, I have found that I might use the Cropper -> TinyPic option, and then copy some other text before I paste the TinyPic URL someplace meaningful.  So I have suggested that he consider some type of log file.

But don’t let those two things keep you from trying this out.  I know I’ll be using it for a while.

Update: Patrick Altman has e-mailed me and said that he doesn’t use this plugin anymore, and that he has no plans to update it.  He said that I should feel free to update my decompiled version and redistribute it.  Well, I don’t exactly have a lot of spare time right now myself (more on this later…), but now I feel comfortable posting my updated DLL.  So here it is.  It works with Cropper 1.6.  If anyone wants to make updates to it, knock yourself out — just let me know if you come up with something useful.  🙂

Code Generator 1.1

If you’ve read the blog for a while, you might have seen my previous posts about a code generator I wrote.

As I’ve used it for a couple months, I’ve decided that I have a lot (LOT) of changes I want to make to it.  I’m not quite a genius yet (like all of the people at the Q# launch), but I’ve learned a ton since I first started writing this.

However, as things go, I haven’t had time to really re-engineer it.  It’s hard to take time to fix something that works, even though it doesn’t work as well as it could or should.  (Can I get an “Amen”?!)  So, in the meantime, I’ve just fixed a few bugs and made a few enhancements.  Most noticably, there is a progress bar at the bottom of the window now.

So anyway, for what it’s worth, here is the updated version.  Use it at your own risk, blah blah blah.

To see a “real” code generator, check out Codus by Sean McCormack from Adapdev Technologies.  Adapdev has a few good tools that have been released to the development community.  On a (sort of) related note, Sean will be speaking to the WI .NET Users Group on September 13 about Automated Testing for .NET.  You can register at the UG site.

IIS Util for XP Pro

Sometimes when developing web applications it is useful to have them live at the root of the web space instead of a virtual directory (which is the default for Visual Studio).  This is not always the case these days, but when I was still doing a lot of classic ASP development, I would often need this.  Since XP Pro only allows one web site (as opposed to Windows 2000/2003 Server, which allows multiples), I spent a lot of time loading IIS, going to the properties page, and changing the “Home Directory” for the web site.

Maybe it’s because my computer was crappy, or maybe there was too much other stuff in memory, or maybe it’s always this way, but IIS was slow to load, plus that seemed like a lot of clicks for something so simple.  So, a long time ago I wrote a simple utility in VB6 (to help me deal with this.  Then as I was learning .NET, I re-wrote it as a WinForms app (including the designer generated code, it’s all of 157 lines of VB.NET).  In a nutshell, it lets you choose a new folder to be the webroot on your local machine.  Additionally, it keeps a history of directories used (in a text file) so that you can easily switch back to another in the future.

For me, the main benefits were that it loads much quicker than the IIS console, and that there are not as many clicks needed, especially if you’re just switching back to a previously used web root.  But it’s far from perfect, so here are a couple ideas for possible future improvement (if I ever work on it again):

  • Also copy virtual driectory and IIS application settings when changing web roots.  Currently, only the web root itself is changed with this utility.  All virtual directories are left unchanged.  This may be good, or it may be bad, but there should be an option.
  • Build a more complete console, similar to IIS, based on something like Cassini.  This could allow multiple web applications to be running at the same time, each at the root of their own web site.  Of course, this will take away the simplicity that currently exists, so I don’t know how much I like this idea.
  • Possibly some integration with the HOSTS file.  I’m not sure what I would want here, but it might make sense.

So anyway, take it for what it’s worth.  Use it if you want.  As always, use it at your own riskHere is the ZIP download.  Aside from this post, there are no docs of any kind — you’re on your own.  If anyone is interested in source, I can supply that as well, or you can just use Reflector.  It’s pretty basic, but if you want to make any improvements (my ideas or your own), I’d like to see the result.

I rarely use this anymore, but it came to mind again recently, so I thought I’d post it in case it might be of use to someone else.

IE Stuff: Open Highlighted URL In New Window

This is something very small that I hacked out for myself a couple years ago.  It allows you to select an un-linked URL on a web page, such as “scottisaacs.com”, and easily navigate to it.  What you do is highlight the URL that you want to visit, right-click, and select “Open Highlighted Link in New Window”.

This will modify your registry and if you don’t know what that implies, then you probably won’t want to install this. 

Use this at your own risk! Here is the ZIP download.

Code Generation – ‘The EXE’

OK.  So last week I mentioned that I had been working on a code generator for myself.  For what it’s worth, I am actually posting the EXE here. 

Use this at your own risk!  Here is the ZIP download.

In the ZIP there are five files:

  • The EXE
  • A Help file (if you can call it that)
  • A default settings file
  • Two files used to infer the DB schema.  These came from CodeSmith.  If it is wrong for me to include these files, someone will tell me and I’ll have to remove them from the ZIP.  At that point, I’ll either add instructions to get them from CodeSmith, or write my own (UGH!).

Contact me if you have any questions.  I’m sure it’s still buggy.  It also has a number of limitations, such as:

  • It only works with SQL Server.
  • It expects only one Primary Key column.  In fact, I think it might be expecting a numeric auto number column.
  • It only generates VB.NET code.
  • There are likely a multitude of others limitations.

In short, this was for me.  It is written around my own “practices”.  It hasn’t been tested nearly enough to be considered solid, so don’t count on that.  I only use it as a starting point, and I can’t recommend that it be anything other than that for you.

That said, please try it if you want, and let me know what you think.  If anyone feels like writing some more thorough documentation, especially as it relates to the generated code, I’ll give you a copy of this app for free.  😉  Also, if you find that my generated code could use certain improvements, please send contact me to let me know.

For what it’s worth, it also runs from your USB drive, but then if you’re into .NET code, you probably expected that it would.

Update (2/28/2005): I have uploaded a new ZIP because I found a bug in the first version.

Code Generation

So over the last couple weeks I’ve spent a grand total of about 30 hours ironing out what I need from a code generator (screen shot).  It’s not as flexible as CodeSmith is (i.e., no templates), but it does what I want, and it does it every time.  Maybe someday after I add a few more “desired” features and work out more of the kinks, I’ll post the app and/or source up here.  (Translation: You’ll be lucky if you ever see it.)  The source isn’t pretty — it’s just basically a top down application that retrieves schema info from the database and does its best to turn that into VB code.

Anyway, it’s pretty basic.  What it boils down to is that you specify a SQL connection string and it generates the BOL and DAL code as well as the SQL stored procedures need to operate.  The generated code comes from a “template” that I built based on code from other generators, and code I hand-wrote that I wished had been generated.  There was a project at work where, over time, I ended up spending probably 30 hours just on this could-be-generated code alone.  Now that code comes out in about 10 seconds.  Obviously I still have code to write, but the tedious stuff is done.  Here is a brief list of what my code generator does and does not do.

Current Features

  • Generate BOL code (Base and Safe classes)
  • Generate DAL code (Base and Safe classes)
  • Generate SQL stored procedure script
  • Allows for saving and retrieving project settings to a “.genproj” file (I made that extension up myself.  What do you think?)

Possible Future Features

  • Generate Base and Safe classes for the test project (NUnit tests)
  • A simple WebForms data editing tool
  • A simple WinForms data editing tool
  • More options in the UI to select which items to generate on a table by table basis
  • Support for SQL Server views (in addition to tables)
  • Other features that I should have written down, but have since forgotten

Now that I have this code generator complete (with the exception of detailed testing), a friend sent me a link to this blog entry on his site.  It’s about CodeDom.  His blog links to this article on DevX.

I should have researched this first!

It looks like it would have been much more cumbersome to build my generator, but I could have built in to generate code in any language, and even compile it on the fly!  Hmmm.  Should I go back to the drawing board?  I probably should, but doubt that I will…

If you have any feature suggestions for my code generator, list them here as comments, and I’ll consider adding them.  My goal isn’t for this to become the super-awesome-generates-code-for-every-situation code generator.  I just want it to save me time on the normal, tedious, boring, everyday stuff!

Page 3 of 3

Powered by WordPress & Theme by Anders Norén