Monday, October 24, 2011

How to strip comments from a c# file

To strip single-line comments from a c# file, do the following:
  • Press {control} H to launch the quick replace dialog
  • In the "Find what:" dialog, enter //.*$
  • Expand "Find options"
  • Check use and select regular expressions
This doesn't work for multi-line comments, but it will rip out all the annoying MS template comments.

Sunday, March 20, 2011

Jeff's Ultimate Tool List

I'm just going through the process of reinstalling windows to fix a visual studio problem that I can't seem to work around.  As I'm reinstalling my favorite applications, I figured this would be a good opportunity to write them down.

Jeff's list of can't-function-without apps

AutoHotKey - Allows me to remap keystrokes and create handy macros.  My all-time favorite is my development signature, mapped to ~ (JVD 2011-03-20)


AxCrypt - Simple encryption program that allows me to safeguard my private documents.

Chrome - It just feels like a better browser than IE.  The integration of Google Docs, calendar and gmail are excellent, and I like the chrome extensions a lot more than the IE or Firefox counterparts.

Foxit Reader - Fast unobtrusive replacement for the Adobe Acrobat Reader.

NotePad++ - Notepad++ is just a really good notepad replacement.  It has excellent macro support, is unobtrusive, customizable and supports a long list of add-ons.

Microsoft Security Essentials - Simple free Virus/Malware protection.  It's given me a little grief on older PCs lately, but it's mostly painless and works great.

Paint.Net - Freeware easy-to-use graphics editing software.

Peazip - Freeware compression utility.  It's a little obtrusive if you don't take out all the send-to functionality on startup.  I don't love the program, but it saves me from needing a WinZip or WinRar.

PDF Creator: - Lets me create PDFs by printing.  This replaced CutePDFWriter for me because it allows me to batch print jobs together into a single PDF.  That's very handy when I have 4 images I want to write to a single PDF.

SetPoint - I like to remap my side mouse keys to CTRL and ALT.  That gives me easy access to the modifiers without taking my hand off the mouse.  SetPoint lets me do this for the Logitech mouse.

TeamViewer - Free (for personal use) remote control software that works well both over the internet and on the local network.  


Utorrent - Torrents.

Windows Virtual PC - Virtualization is incredibly handy for a number of reasons.  I prefer to use Windows Virtual PC over VMWare simply because it runs better on Windows.  I can't quantify it, but VMWare always felt clunky.  Window Virtual PC feels like a very natural integration into the windows environment.


WindowSpace - This is more-or-less a beefed up version of the Windows 7 snap functionality.  It lets me snap to other windows, snap to top, bottom and corners.  It's also got a long list of keyboard hooks which lets me move my windows around without touching the mouse.  It's not freeware, but well worth the $20 IMO.

WinDirStat - Shows you what's eating up all the space on your hard-drives.  Invaluable when you need to clean up.

Wednesday, December 2, 2009

Oracle handy BLOB to VARCHAR2 conversion

I do love Oracle for the things it does incredibly well under the hood, but it continues to amaze me how hard it is to do the simple things.

We've got a blob column in our database that we used to store settings in an XML format.  Yeah it could have been a CLOB, but that's not the way it was done.  No big deal right?  I'll just cast it as a VARCHAR2.

SELECT CAST( XML AS VARCHAR2)
FROM USER_CONFIG

Nope.  Casting doesn't understand blobs.  You have to use DBMS_LOB.SUBSTR

SELECT DBMS_LOB.SUBSTR( XML, 4000, 1)
FROM USER_CONFIG

Nope again.  That gives me a return value of '123oij21o3ij12o3ij12o3ij12o3ij12'... the binary representation of my XML file.  Why?  Because DBMS_LOB assumes you'd never use a BLOB for a string.  CLOBs are for strings!  You can only convert BLOBs to RAWs.

Fine, fine.  I'll just cast the RAW into a VARCHAR2.

Of course, you can't just cast it using CAST... you have to use the UTL_RAW package.

SELECT UTL_RAW.CAST_TO_VARCHAR2( DBMS_LOB.SUBSTR( XML, 4000, 1 ))
FROM USER_CONFIG

Love it!

Tuesday, September 22, 2009

I'm not sure a blog is the place to put all this, but I do play with an awful lot of neat stuff (well I think it's neat)... and I have a rotten memory, so I love documenting what I've worked on, so future-Jeff can find it.


I like to think of myself as a can-do guy, but at the end of the day, I want to feel good about my code.  Well written code pays dividends over and over in maintainability and expandability.  

I'm a huge believer in loose-coupling.  Each code block should have the least possible number of dependencies.  You don't need goto's to produce spaghetti code, all you need is a high number of dependencies.


My current interests:
  • .Net 
  • Web applications
  • CSS
  • jQuery
  • Model driven design.  I'm currently learning Eric Evans' "Domain Driven Design" patterns, but more generic than that, I believe the model layer (or business layer) should be the driving force behind application development.
  • Unit testing - I believe in testing all code in the smallest units possible.
  • Design by contract
  • Relational databases (Oracle, Sqlite, MsSql, MySql)
  • Database optimization.