Tuesday, October 30, 2007

Unescaping strings in the Immediate window (C#) when debugging

Ever get annoyed at the unfriendly strings the Visual Studio debugger prints when running a C# project in the IDE?

Here's a creative solution courtesy of Daniel Cazzulino's Blog:

At debugging-time, if you ask for any string variable value you get it escaped, which isn't very useful. You can't copy/paste to a text editor to save to a file and check how it looks like, for example. A trick I use all the time is issuing the following command in the Command Window - Inmediate:

System.Diagnostics.Debugger.Log(0, "", theTextVariable) You will get in the same window, the unescaped string, including any tabs, CRLF, etc.

Read the original at http://weblogs.asp.net/cazzu/archive/2004/02/10/70658.aspx

Data Compare in Visual Studio 2005 for Database Professionals

I recently discovered a little "gotcha" when using the Data Compare feature Visual Studio 2005 for Database Professionals*: it silently ignores data in any table that lacks a primary key.

Now I would never accuse you of creating tables without primary keys, ;-) but you just might inherit a database in such a condition. Seriously though, many developers (including me) often leave PKs off their join tables, since they're usually composed of nothing but foreign keys anyway. If that's you too and you plan on using the Database Professionals tools for Visual Studio, just remember you'll have to go back and add those primary keys. It's a good habit to get in anyway, since it forces you to be explicit about your unit of uniqueness for joins, e.g. you have to consider whether you need an identity column or can simply create a PK across one or more of the FK columns.



* If you do SQL development and aren't familiar with this great set of tools, check 'em out! This setup considerably eases three essential database tasks: (a) Getting your object definitions under source control, (b) comparing schemas and migrating changes between environments, and (c) comparing data between environments and applying the diff from one server to another.

Visual Studio 2005 Team Edition for Database Professionals Add-on for Visual Studio 2005 Team Suite Edition
http://www.microsoft.com/downloads/details.aspx?familyid=7DE00386-893D-4142-A778-992B69D482AD&displaylang=en

Microsoft® Visual Studio® 2005 Team Edition for Database Professionals Service Release 1
http://www.microsoft.com/downloads/details.aspx?familyid=9810808c-9248-41a5-bdc1-d8210a06ed87&displaylang=en

Microsoft® Visual Studio® 2005 Team Edition for Database Professionals Power Tools
http://www.microsoft.com/downloads/details.aspx?FamilyID=DA3F11AD-BD54-4EDA-B08C-4DF84DF0D641&displaylang=en

Friday, October 26, 2007

SVN Integration in Visual Studio with AnkhSVN

On the heels of the aforementioned fantastic tool SVNOneClickSetup, I discovered AnkhSVN, a Visual Studio add-in that integrates Subversion version control.

Get it here:
http://ankhsvn.tigris.org/

These two tools combine to make a version control solution that's incredibly easy to configure and use. I've never used Subversion before in my life, and within 20 minutes I remotely set up my home server, had 2 projects in my repository, and had 2 remote client PCs connected and able to check out & commit. Try doing that with a VSS 6.0 or 2005 server setup.



The problems I ran into were pretty minor; Tortoise doesn't like to copy folders recursively when dragged into a repository from Windows, and getting VS & Ankh to recognize version control bindings didn't work exactly like I thought it would. Before you jump in, here are a few tips to get you past the initial snags you might encounter:

  1. AnkhSVN's Visual Studio integration magically seems to work better if you install the latest version of TortoiseSVN first.
  2. When you install SVNOneClickSetup, do let it create the default project that it wants to. Name it something like "ProjectTemplate" and leave it exactly the way the installer creates it; it will created tags, branches and trunk subdirectories for you.
  3. When you want to create a new project, first use Tortoise to make the directory: hit Start -> Run -> [ svn://your.svn.server:3690/ ] (or whatever port you're running it on). In the TortoiseSVN browser, right-click your "DefaultProject" folder and select "Copy to." Enter svn://your.svn.server:3690/YourNewProjectName.
  4. Now open your solution in Visual Studio; right-click the solution node in Solution Explorer, and select Ankh -> Add solution to Subversion repository.
  5. Put the solution at svn://your.svn.server:3690/YourNewProjectName/trunk.
Now when you want to fetch a solution onto a new PC, use Visual Studio, selecting Tools -> AnkhSVN -> Checkout a repository directory. In SVN, "checkout" means something more more like "get latest" does in VSS or TFS. Now Ankh should spot the bindings when you open the solution. Use "lock" on a file to do what VSS & TFS mean by "checkout." However, editing doesn't require locking; locking will just block check-ins ("commits") by other users.

Enjoy!

Subversion (SVN) on Windows finally made easy

I've wanted to start running my own Subversion server for the longest time but never found the time to wade through the convoluted Windows installation procedures. Now I don't have to, thanks to SVN1ClickSetup:
http://svn1clicksetup.tigris.org/

It is really this easy:
1) Run the Svn1Click installer
2) Configure your router to forward port 3690 to the SVN PC.
3) Profit!

Wednesday, October 24, 2007

My Most Essential Free Software Applications

This is a list of the free Windows apps I take everywhere with me.


Text editors, notepad replacements with syntax highlighting, auto-indenting & more:

Notepad2: http://www.flos-freeware.ch/notepad2.html (SDI)

Notepad++: http://notepad-plus.sourceforge.net/uk/site.htm (tabbed MDI)



WinZip replacement – extracts every compression format, including tar, bz, zip, rar, lzh, iso, arj, cab, 7z and more, and compresses to most formats as well:

7-Zip: http://www.7-zip.org/



FTP Client – Does most ordinary FTP tasks, handles secure ftp (SFTP), and has a server available in addition to the client:

FileZilla: http://filezilla-project.org/



PDF Viewer – lightweight and fast, just what you need and nothing you don’t:

Sumatra PDF: http://blog.kowalczyk.info/software/sumatrapdf/



PDF Maker – virtual printer driver that lets you create PDF files via the print menu from within any program:

PDFCreator: http://sourceforge.net/projects/pdfcreator/



Sandboxing / Virtualization Layer – lets you run programs in a sandbox having its own registry and filesystem, so no persistent changes can be made to your PC. Note: I'm not thrilled about Altiris being acquired by Symantec, but so far SVS hasn't seemed to suffer from Symantecitis...

Sandboxie http://www.sandboxie.com/
Altiris SVS http://www.altiris.com/Products/SoftwareVirtualizationSolution.aspx



Hardware Emulator / Virtual Machine -- allows you to run a virtual machine "computer" as an application, like when you want to run Windows on top of Linux or vice versa, or any time you need a specific environment that's isolated from your main PC.
http://www.vmware.com/download/server/


ISO Manager
– create .iso file images of CDs or DVDs, make a CD or DVD from an .iso image, make an .iso image of a set of folders/files which can later be burned to a disk, all from the context-menus in Windows Explorer:

ISO Recorder http://isorecorder.alexfeinman.com/isorecorder.htm


Virtual CD-ROM/DVD-ROM Emulator – mount an .iso file on your hard drive or USB drive or network, and Windows will treat it like another CD/DVD drive:

Daemon Tools: http://www.daemon-tools.cc/dtcc/download.php


Full-featured CD/DVD Burner & image recorder:

CDBurnerXP: http://cdburnerxp.se


Video Player – lightweight player can play DVDs, .iso images of DVDs, streaming content, just about any video file you throw at it, and even has a built in http server you can use to stream video with:

VideoLan: http://www.videolan.org/vlc/


Audio Player – lightweight player that handles all the audio formats that WMP doesn’t, including open-source formats like .ogg and .flac. Very plain, small footprint, but can be customized to look how you want if you get the “ColumnsUI” plug-in. Also rips CDs, optionally using the LAME MP3 encoder.

Foobar2000: http://www.foobar2000.org/



Image Editor: Aims to become a complete replacement for PhotoShop; right now it’s not quite there, but still the best free image editing software I’ve seen:

PaintDotNET: http://www.getpaint.net/index.html



Video Converter – converts almost any audio or video format to any other; lets you crop videos, adjust colors and cut off portions of the beginning or end while transcoding:

MediaCoder: http://mediacoder.sourceforge.net/



Web Browser – no list of free software would be complete without Firefox, the lightweight, faster, more customizable and more-secure alternative to Internet Explorer:

Mozilla Firefox: http://www.mozilla.com/en-US/firefox/

As of this writing, the Opera Browser is at its 9.5 beta release, and it's quite nice; check out the unique "Speed Dial" homepage feature, and if you can never have enough screen real-estate for your browser, hit F11 to check out its corner-to-corner fullscreen mode:

Opera Browser: http://www.opera.com/products/desktop/next/



Office Suite – complete replacement for Microsoft Office as free, open-source software that runs on any platform (Windows, Linux, Mac, etc.):

OpenOffice http://www.openoffice.org/



Antivirus – even the free version of their antivirus is quite capable, and it uses far less system resources than Symantec, McAffee or TrendMicro.

AVG Free http://free.grisoft.com/



Peer-to-Peer client, Gnutella network (like LimeWire):

FrostWire is the free, open-source counterpart to LimeWire pro: http://www.frostwire.com
If you enjoy FrostWire, you can get new features a bit sooner by purchasing LimeWire Pro; they's good peeps over dar, they've done quite a bit of good work on this P2P client.


BitTorrent Clients:

Azureus: http://azureus.sourceforge.net (full featured)

uTorrent: http://www.utorrent.com (aka Micro-torrent, literally “µTorrent”)

BitTorrent: http://www.bittorrent.com (slim)



Privacy, Anonymity and Security-enhanced web browser – encrypts all your traffic (including the domains and IP addresses you request), and routes it through a network of onion-routers, so no middleman – including your ISP – can sniff or log your traffic:

XeroBank http://xerobank.com/xB_browser.html



Portable Applications – all the basics like Instant Messaging, Email, Office, Antivirus and Web Browsing, but everything’s been modified to run from a USB stick withoutneeding any installation:

PortableApps http://portableapps.com/



File Wiper – Securely erase sensitive data

Eraser http://www.heidi.ie/eraser/



Text, File and Email Encryption – cross-platform PGP-compatible tool to allow secure data exchange:

GPG: http://www.gnupg.org/

The FireGPG extension for Firefox lets you encrypt, decrypt and sign data in web pages, and as a bonus, integrates right into GMail. http://firegpg.tuxfamily.org/


Whole Drive Encryption – allows you to mount a file, a partition or a whole disk as a separate drive in Windows, and encrypts/decrypts data on-the-fly while the drive is mounted. Data is unreadable when not mounted with the correct password.

TrueCrypt http://www.truecrypt.org/

Google adds IMAP to GMail

Looks like Google finally added IMAP to GMail, along with a feature that maps GMail labels to IMAP folders.

The "lack of folders" was the biggest objection I got when moving clients into a hosted GMail / Google for Domains setup. This will be a welcome feature.

Check out the IMAP behavior chart to see how GMail handles synchronization details.