Thursday, July 2, 2009

Essential freeware for Windows

Summary: List of my favorite freeware tools and utilities.

The lists of my favorite freeware for regular users and developers have been getting out of hand lately, so until I find a better method, I'll use this post to keep track of the FREE Windows tools and utilities that I consider the best for various tasks.

When assessing the tools, I prefer software that:
  • is totally free: no shareware, not limited to home use (although, home-use restriction is fine in some cases, such as for anti-virus software);
  • works across corporate firewalls (for internet connections);
  • supports Unicode (international character sets);
  • offers multi-lingual interface (mostly interested in Russian);
  • comes with an installer (okay, lack of installer will not kill it, but it's really nice to have).
Here is the list of my favorite freeware:

Media Players

Best Audio Player: AIMP
Pros: highly customizable; clean interface; good sound (with enabled equalizer); no ads; Unicode support; multilingual interface; can be minimized to system tray; rips CD tracks to audio files (including MP3); records streaming audio; converts audio files between different formats (MP3, WAV, OGG, WMA, etc); edits ID3 tags (ID3v1, ID3v2, etc). Cons: slight startup delay; some customization options are confusing.

Best Video Player: Media Player Classic Home Cinema
Pros: comes with internal codecs; plays practically any video format; easy to launch video from a file, folder, or CD/DVD; no ads. Cons: May require some external codecs; codec settings may need to be tweaked on less capable systems; cannot raise volume above 100% (some players allow you to do this); somewhat outdated interface.
Alternatives: Splash Lite (great for playing HD videos; does not hog the system; excellent sound; but free version does not play contents of folders, such as VIDEO_TS); KMPlayer; VLC Media Player (somewhat problematic playback of the VIDEO_TS folders); GOM Player; SMPlayer; PotPlayer (forked from The KMPlayer).

Media Editors

Best Video Editor: Avidemux
Pros: converts between various video formats; instant preview of changes; easy to adjust cropping settings; simple to use filters; color/saturation/brightness adjustment; displays file video/audio encoding data. Cons: two versions of UI (GTK+ and Qt4) are confusing; toolbar buttons do not show tooltips; terse descriptions of available options and settings.
Alternatives: VirtualDub.

Best Video Converter: Format Factory
Pros: supports multiple video formats; easy to use; produces reasonably good quality video; reasonably fast; allows conversion of multiple files. Cons: some options are confusion (not clear how picking one option affects other options, e.g. when cropping video it's not clear whether the aspect ratio will be applied to the cropped video or the original video); it would be nice to have simple editing tools (such as exposure, lighting, etc).
Alternatives: XMedia Recode (easy way to add external audio tracks, subtitles, etc. without re-encoding); Any Video Converter (free version; easy YouTube downloads); WinX Video Converter; MP4Tools (splits and joins MP4 files without re-encoding and loss of quality); MPEG Streamclip (supports trimming and joining videos, but requires you to install QuickTime); Quick Media Converter HD, Kastor - Free Video Converter, Hamster - Free Video Converter; Freemake - Free Video Converter; Video to Video Converter; MediaCoder.

Best Movie Maker: HitFilm Express
Alternatives: DaVinci Resolve, Shotcut, Lightworks, VSDC.

Best Audio Editor: Audacity
Pros: many features; easy to use (once you get familiar with the interface); records streaming audio; trims silence; reduces background noise; imports/exports audio files from/to various audio formats; mixes tracks; adds sound effects (bass boost, etc); Unicode support; multilingual interface. Cons: outdated look; does not come with LAME MP3 encoder (must be installed manually); cannot edit MP3 natively (need re-encoding); some menu options are not standard (e.g. Edit - Preferences).
Alternatives: Free MP3 Cutter and Editor (simple tool for basic operations: cut, change mono to stereo/streo to mono, fade in/out).

Best Audio Tag Editor: Mp3Tag
Pros: supports MP3 tags and other metadata (ID3, Vorbis Comments, APE); renames files based on the tag information; supports cover art; works on multiple files; Unicode support; multilingual interface; retrieves metadata from external sources (Amazon, freedb, etc); can convert ID3 tags between different encoding schemes (Unicode, Cyrillic, etc). Cons: populating metadata from external sources is a bit awkward; no control when converting between ID3 encoding schemes (it also changes file name).
Alternatives: MP3Nity (need to try; has adware).

Best Audio Repair Tool: MP3 Diags
Pros: performs diagnostics; corrects problems (wrong song length, etc); can't think of any other tool with the same capabilities. Cons: may be a bit complex for some; confusing interface (where is the Open Folder dialog?); have not been updated in a while.

Best Audio Converter: AIMP 2 Tools (Converter & Recorder)
Pros: supports conversion between multiple audio formats; supports album formats (APE, etc); easy to use; multi-lingual interface. Cons: discontinued.

Codecs

Best Codec Pack: Shark 007
Pros: the only codec pack you need to install. Cons: 64-bit version must be handled (installed/uninstalled) separately; must launch program as Administrator; upgrade requires uninstallation; cannot ninstall from the Add or Remove Programs (must do via the Uninstall button in the application itself); configuration settings can be confusing; installer always installs Bing toolbar.
Alternatives: K-Lite; CCCP.

MP3 Tools

Best MP3 Splitter: mp3DirectCut
Pros: splits, trims, crops audio files; no-destructive cut, copy and paste; automatic track splitting (by timed intervals); keeps ID3 tags. Cons: cannot adjust interval-based auto-cues to fall on to silent pause.
Alternatives: MP3 Cutter and Editor (very simple interface; allows cutting, changing volume, fading in and out, changing from mono to stereo and from stereo to mono; but no Unicode filename support); Wave Editor.

Best MP3 Merger: MP3 Album Maker
Pros: simple operation; reversible merge. Cons: I haven't used it much, so can't think of any.

Best MP3 Volume Normalizer: MP3Gain
Pros: lossless normalization; can be reverted back to the original. Cons: does not support Unicode file names; functionality is a bit confusing; I'm not sure how it handles clipping.

Disk Tools (CD/DVD)

Best DVD/Blu-Ray Ripper/Transcoder: VidCoder
Pros: best tool to convert video disks or folders (VIDEO_TS, BDMV) to video files; supports data compression, re-sizing, and other basic editing features; allows customization of audio tracks and subtitles; automatically detects the correct stream for Blu-Ray media. Cons: does not break copy protection from commercial disks.

Best DVD Ripper: DVD Shrink
Pros: decrypts (breaks copy protection from) many DVDs; removes region code; rips video to an ISO file or VIDEO_TS folder; can compress ripped video to fit on a standard 4.7 GB DVD; allows removing of unnecessary data (audio/video tracks). Cons: cannot decrypt some latest DVDs.
Alternatives: DVD Decrypter (decrypts most DVDs that DVD Shrink cannot); DVDFab HD Decrypter (haven't tried, but seems good); AmoK DVD Shrinker (does not remove copy protection, but claims to "[shrink] DVDs up to one fifth of the original size without any noticeable quality reduction").

Best CD Ripper: fre:ac
Pros: detects album info (song titles, albums, artists, etc); can customize file names based on ID3 tags; writes ID3 tags; built in converter supports many audio formats (MP3, AAC, WMA, Ogg Vorbis, FLAC, and more); full Unicodes support for both ID3 tags file names; multilingual interface.

Best CD/DVD Burner: ImgBurn
Pros: creates image file (such as ISO) from a disk (CD/DVD); writes image file to disk; verifies disk readability; compares disk to image file; checks quality of drive and media (requires DVDInfoPro); lots of customization option (burn speed, etc). Cons: does not offer a single-step disk copy.
Alternatives: Ashampoo Burning Studio Free 6.76 (also version 2009); BurnAware Free; CDBurnerXP; Exact Audio Copy; InfraRecorder; StarBurn Free.

File Tools

Best File Search: xSearch
Pros: can run ad hoc when needed (unlike integrated desktop search tools); allows searching for text in files (including Unicode text); multiple text search options; fast search. Cons: no installer.

Best Hex File Editor: HxD Hex Editor
Pros: can load really huge files (tried it on ~1 GB files); extremely fast; low memory footprint. Cons: it would be nice to have pure text view (without hex display).

Best File Compression: ZipItFree
Pros: handles Unicode filenames nicely; password protection; support multiple compression formats; intuitive interface. Cons: non-standard UI elements; no command-line support; cannot create self-extracting executable files; installation program offers a number of crapware; somewhat intrusive ads in the main application window.
Alternatives: WinMount Free Edition (handles Unicode nicely; can mount ZIP files as virtual drives; cannot make self-extracting executables; does not support file encryption); 7-Zip (non-intuitive interface/workflow; ugly UI; problems handling Unicode file names); PeaZip (uses 7-zip engine; confusing interface/workflow; problems handling Unicode file names).

Best File Renamer: Rename Master
Pros: file filtering; preview of results; can use file properties (timestamps, audio tags, image tags, etc); scripts for commonly used renaming options; undo changes; integrated explorer. Cons: GUI is not very polished.
Alternatives: Advanced Renamer, ReNamer; Ken Rename; and more.

Best File Synchronization (automatic sync): DropBox
Pros: 2 GB of free space (+ more via referrals); automatic backups; handles corporate firewalls; tracks file changes. Cons: cannot delete old file revisions; works only with one parent folder; does not seem to work with auto-proxy configuration scripts (need to explicitly define proxy URL).
Alternatives: Syncplicity (2 GB of free space; can complement DropBox; manages standard folders, such as My Documents; can customize what get synced); SpiderOak (2 GB of free space); SugarSync (5 GB of free space).

Best File Synchronization (manual sync): Microsoft SyncToy
Pros: It just works. Cons: None.
Alternatives: FreeFileSync.

Best Online Backup: Mozy
Pros: 2 GB of free space; automatic backups; uses encryption. Cons: can't say if there are any.
Alternatives: iDrive (2 GB of free space; similar to Mozy); Zoolz Home (free space is only offered via promotions, but if you manage to find one, you may be able to get 100 GB of storage for free).

Best File Eraser: Eraser
Pros: simple interface; Windows shell integration. Cons: none.
Alternatives: CyberShredder.

Best Virtual Drive Mounter: Virtual CloneDrive
Pros: supports various image file formats (ISO, BIN, ZIP); supports Unicode file names; Windows shell integration; does not require a reboot; can make compressed (ZIP) files; can decompress compressed (ZIP) files. Cons: does not mount compressed archive [ZIP] files.
Alternatives: Gizmo Drive (does not like Unicode characters in file names); MagicISO Virtual CD/DVD-ROM; Total Mounter; StarBurn Free; Pismo File Mount; ISODisk; WinCDEmu; WinMount Free Edition (free edition has severe file size limitations).

Best Photo Duplicate Finder: Awesome Photo Dupliate Finder
Pros: easy to use; fast.

Best Media Thumbnail Generator: Media Preview
Pros: it works.

Graphics and Photo Tools

Best Vector Graphics Editor: Inkscape
Pros: clean interface. Cons: manual does not load; used the program very few times, so can't say much.

Best Image Editor: GIMP
Pros: feature rich; bit editor; editable text layers; photo enhancing. Cons: non-standard menu options; some operations are non-intuitive and/or more complex than they should be.
Alternatives: Paint.NET (does not support editable text layers); PixBuilder Studio.

Best Photo Editor: Picasa
Pros: easy-to use; great for most basic photo enhancing operations; includes photo organizer; collage maker. Cons: some basic tasks, like cropping to certain size or aspect ratio or changing size, require more work than they should.
Alternatives: Photoscape (includes screen capture utility; allows batch editing and renaming; and more); virtualStudio (has a few nice touches; red-eye correction needs improvement); IrfanView (free for personal use only); PhotoFiltre; RealWorld Paint; JPEGView.

Best Photo Cropper: JPEGCrops
Pros: extremely easy to crop for preset sizes (such as 4x6); preview; lossless cropping; batch mode. Cons: none.

Best Photo Resizer: Fotosizer
Pros: simple resizing process for popular formats; batch operation; can lock aspect ratio. Cons: none.
Alternatives: Image Resizer (part of Microsoft PowerToys for Windows XP); Photo Magician (will install bloatware if you select the options during installation).

Best Screen Capture: Gadwin PrintScreen 4.4
Pros: easy to use, no-frills program; can capture mouse cursor. Cons: no built-in image editor; no annotation capability; does not detect non-rectangular or shaded windows' borders; development work on free version has stopped.

Best Graphics Editing Plugins: Google Nik Collection
Pros: professional grade tools; work with Photoshop, Lightroom, and Apreture. Cons: looks like Google is abandoning this offering.

Office and Business Apps

Best Office Suite: OpenOffice
Pros: supports Microsoft Office 2007 formats; multi-lingual interface; traditional toolbar (no ribbon); extensions. Cons: not as feature-rich as Microsoft Office; interface is somewhat outdated.
Alternatives: LibreOffice and IBM Lotus Symphony are based on OpenOffice.org source code, but are reported to be better; SoftMaker Office 2006; GoOo (based on OpenOffice, but claims to run faster); Kingsoft Office Suite.

Best Text Editor: Notepad++
Pros: supports Unicode; multi-lingual interface; built-in spell checker; syntax highlighting (for many programming languages); ability to run external tools (for example, when editing a VBScript file, you can execute it directly from the editor); search and replace options (supports regular expressions); text bookmarking; line numbering; multi-document interface; option to set as default text editor; loads huge files fast. Cons: some problems with regular expression-based search and replace.
Alternatives: PSPad (seem to be abandoned; chokes when loading really big files); Q10 (minimalist, full-screen, spell checker, and more).

Best Scanner: NAPS 2 (Not Another PDF SCanner 2)
Pros: save output as image or PDF; supports multi-page PDF; can crop, rotate and make other image adjustments; OCR capability; works with different scanners.

PDF Tools

Best PDF Reader: Nitro PDF Reader
Pros: fast; light; fills and saves forms; exports text an images; adds content to PDF files; allows typing over PDF documents. Cons: more editing capabilities would be nice; some protected PDF forms (e.g. U.S. Government naturalization forms) fail to open (probably via a custom script).
Alternatives: PDF-XChange Viewer; Expert PDF Reader.

Best PDF Reader (for PDF forms): FoxIt Secure PDF Reader
Pros: allows saving of PDF forms with entered data when Acrobat Reader does not allow it; open documents that other reader fail (e.g. U.S. Government naturalization forms). Cons: does not support typing over PDF text.
Alternatives: Nuance PDF Reader (requires email and registration).

Best PDF Writer: Primo PDF
Pros: converts many file formats to PDF; works as a printer driver; can append and merge PDF documents; works in remote desktop (over terminal session). Cons: text quality of the converted PDF file may be worse than original.
Alternatives: doPDF (does not work in remote desktop).

Best PDF Tool: PDFill PDF Tools
Pros: Can merge, split, reorder, rotate, crop, and do more with PDF files. Cons: Outdated interface.
Alternatives: PDF Split and Merge; PDF Rider; PDForsell.

Language Tools

Best Dictionary: Lingoes
Pros: Dictionary, glossary, and more; translates to/from many languages; pronounces words. Cons: plugin for PDF files does not work with Adobe Acrobat Reader (but it works with FREE PDF-XChange Viewer).
Alternatives: 1-Click Answers; WordWeb.

Security Tools

Best Anti-Virus: Microsoft Security Essentials
Pros: native integration with Windows; light, yet capable; multi-lingual interface (based on the language of the operating system); automatic updates; resident execution. Cons: initial scan takes too long; not as effective as some alternatives (according to some reports).
Alternatives: Avast! Home Edition (if not for the need to re-register it every year, Avast! would be my best choice); AVG Anti-Virus Free Edition; Avira AntiVir Personal.

Best Password Manager: LastPass
Pros: web-based (no need to sync data between multiple computers); integrated with Firefox and IE; form auto-fill; grouping; search; support for custom properties; can import data from other apps (Firefox, KeePass Password Safe, etc); can export data. Cons: occasional connectivity errors in Firefox (when connection is fine); interface could be more polished; problem logging on to my Live/Bing cashback account (I have several Live/Bing accounts and something just did not work; I had to switch from Firefox to IE and not use LastPass).
Alternatives: KeePass Password Safe (for multi-computer synchronization, it can be used along with file synchronization tools).

Best Disk Encryption: TrueCrypt
Pros: treats a virtual partition (encrypted file) as a disk; works with flash (USB) drives; can encrypt full or part of a disk. Cons: cannot auto-grow encrypted partition; need to read instructions to understand how to encrypt removable disks (such as flash drives).

Desktop Tools

Best Screen Saver: Analogy
Pros: fascinating; elegant; simple; shows current time. Cons: none.

Best Audio Output Switcher: Audio Switch
Pros: makes it easy to switch audio output device.

Best Screen Saver Disabler: Caffeine
Pros: temporarily disables screen safer (e.g. when watching videos). Cons: no installer.

Best Clipboard Manager: Ditto
Pros: keeps track of text and image-based clipboard entries; allows pasting plain text with one key press; single step to access clipboard history menu; permanent items; under active development. Cons: none.
Alternatives: ArsClip; ClipX (may require a hack); xNeat Clipboard Manager (supports text only); CLCL (hasn't been updated in a while).

Best Taskbar Sorter: Taskbar Shuffle
Pros: supports drag-and-drop; light-weight. Cons: none.

Best Task Manager: SystemExplorer
Pros: displays full paths of the running processes; shows command-line parameters; checks suspicious processes against the VirusTotal database; passes process information to Process Library; shows network connection information (which processes are connected to which addresses over UDP or TCP/IP); displays startup data (which applications are loaded at start-up); displays list of open files and file owners (which process holds open handle to which file); displays loaded DLLs and their host processes (press CTRL+F and enter the name of a DLL in the SystemExplorer Search window); can export info from every tab; can be configured as a default task manager. Cons: when configured as default task manager, cannot start Windows Task Manager; cannot show threads per process; Performance window shows a single graph for multi-CPU systems; controls in the Performance window do not get resized correctly.
Alternatives: AnVir Task Manager Free (shows prompts when new applications are added to Windows startup); Process Explorer.

Best Program Launcher: Launchy
Pros: automatically detects new applications; small footprint; clean interface; plugins; skins. Cons: defining catalog filters is a bit confusing.

Best Sticky Notes: Stickies
Pros: elegant by default; appear on desktop; can auto hide; transparency effects; rich-text support; hyperlink support. Cons: none.
Alternatives: Sticky Notes.

Best Volume Control: MKN VolWheel
Pros: controls volume via mouse wheel. Cons: no option to mute/unmute; spotty Windows 7 support (sometimes works, sometimes does not).
Alternatives: Volume2; Volumouse.

Best Desktop Organizer: HideDesktop
Pros: hides all icons on desktop when desktop is not in focus. Cons: no installer.
Alternatives: AutoHideDesktopIcons.

Communication and Collaboration Tools

Best Chat Application: Google Talk
Pros: minimalist (in a good sense); uses Google account info; takes fewer resources than other apps (such as Skype); informs about incoming Gmail messages; can transfer files; works across corporate firewalls; multi-lingual interface. Cons: none.
Alternatives: Meebo (web-based, Firefox add-on, and Windows app versions; supports AIM, Yahoo!, Google Talk, MSN, ICQ, and other protocols; consolidates all chat applications and account in one; clean interface).

Best Video Chat Application: Skype
Pros: everybody is using it; works well; user discovery. Cons: annoying sounds (always need to disable); runs at startup by default (always need to disable).
Alternatives: Google Video Chat; Microsoft Messenger.

Best Desktop Sharing Tool: Team Viewer
Pros: easy set up; can run on-demand; authorization is based on session secret (session ID and password); works on Vista; auto-update. Cons: none.
Alternatives: Ammyy Admin; Microsoft SharedView (per Privacy Statement: "This Service may only be used within the United States of America"); Adobe ConnectNow (web-based; no installation; organizer must have an Adobe account, participants do not; max of 2 participants + organizer).

Internet Tools

Best RSS Reader: Feedly (web-based)
Pros: web-based (stays in sync across multiple computers); quick preview of unread posts; nice interface; mark as favorite. Cons: no integrated search.
Alternatives: FeedDemon (some people swear by it); The Old Reader (outdated interface).

Best FTP Client: FireFTP (Firefox add-on)
Pros: light-weight; works across corporate proxy servers; easy to set up. Cons: requires Firefox.
Alternatives: FileZilla; net2ftp (web-based).

Best Podcast Receiver: Juice
Pros: automatically downloads podcast audio files; easy to set up; multi-lingual interface. Cons: cannot be minimized on startup; development work seems to be halted.

Developer's Tools

Best .NET Decompiler: ILSpy
Pros: works as promised. Cons: No installer.
Alternatives: dotPeek.

Best Java Decompiler: JD-GUI
Pros: works as promised.

Best Screencast Recorder: Screencast-O-Matic
Pros: easy to use; can add music. Cons: The free version is limited to 15 minute recording; some non-essential limitations in the free version.

If you have suggestions for applications or categories, please leave a comment.

See also:
Scott Hanselman's 2014 Ultimate Developer and Power Users Tool List for Windows
LifeHacker: Windows APP Directory
Gizmo's Freeware Editors' Choice List

Tuesday, June 23, 2009

How to test XSL transformations

Summary: Brief overview of several tools that can be used for testing XSL transformations.
UPDATE: If you program in Visual Studio, you don't need any additional software for testing XSL transformations. Visual Studio allows you to test and debug XSLT better than any other tool I tried. If you don't use Visual Studio, please read the rest of this post.
I recently spent several days redesigning XSL templates that our application uses to generate email messages. To get the job done faster, I needed a FREE tool that would help me edit XML files and test XSL transformations. [Note: I'm not against commercial software, but I did not want to get into the licensing mess, since other team members would also need to use the tool.] Microsoft's recommendation to create an ASP page for testing XSL transformations seemed like an overkill, so I looked elsewhere.

Had I checked StackOverflow earlier, I would've learned that Visual Studio 2008 offered all features I was looking for. Alas, I trusted Google more, so I started by trying out the tools that I found first:This is how these tools stacked up for me.

XML Notepad 2007 is a free utility offered by Microsoft. To preview XSL transformations in XML Notepad 2007, you first need to open the XML data file.


Then switch to the XSL Output tab, specify the XSLT file, and click the Transform button.


Although, XML Notepad 2007 is great for previewing XSL transformations, it is not very usable for editing XML documents. The editor does not seem to offer an option to edit the source and I found the built-in XML-specific editing features awkward to use. Another limitation of XML Notepad 2007 is that it does not allow opening more than one XML file at a time. It also considers the XML file to be the primary file for the transformation (other tools let you specify the XSL file for the XML file, as well as the XML file for the XSL file).

XML Copy Editor has been recently updated. I tried version 1.2.0.4 which was released in April 2009.


XML Copy Editor lets you edit the source of XML/XSL files, but generating previews takes a couple of steps. Once you load the data XML file, select the XML - XSL Transform menu option, and the tool will prompt you to enter the location of the XSLT file. After you specify the XSLT file, XML Copy Editor generates a temporary output file, which you can preview in an external browser by clicking the Browser toolbar button. I did not like this multi-step operation and the need to switch between two applications, so I moved on.

WMHelp XMLPad (v. 3.0.2.1) turned out to be the tool I used most. At first, I could not figure out how to automatically generate HTML preview after transformations (the tool kept opening the source of the transformed XML file). Eventually I determined that I needed to include the <xsl:output method="html"/> element in the XSL file and preview started to work.


To generate the preview, you need to specify the XML file for the open XSL file (there are a few gotchas here), and then simply click the Debug current stylesheet toolbar button.


Once the preview tab appears, you can switch between the Source and Preview modes. The tool can also open the preview page in an external browser, but I found the internal preview option more useful. WMHelp XMLPad keeps your options (such as mappings between XSL templates and XML files) in the styledata.xml file in the same folder as the XSL files. Although I found WMHelp XMLPad useful (which was before I discovered the capabilities of Visual Studio), it has a decent number of annoyances including the following:
  • Help page does not work; causes error "Not Found - The requested URL /doc/XmlPad/Welcome.htm was not found on this server."
  • Text editing features are really crippled. Tabs are not predictable: sometimes pressing Tab moves cursor by 8 positions, sometimes it moves by one position; you never know. If you select a block of text and press Tab, the selected text will be deleted. Shift+Tab (moving selected block to the left) obviously does not work.
  • The editor lets you place cursor anywhere. For example, you a line is 10 characters long, you can click on position 25 (a typical text editor would not allow this), hit Enter, and the editor will insert 15 new space characters at the end of the line.
  • For some reason the editor leaves a number of blank lines at the end of the document.
  • I already mentioned the need to define the output method in XSL files to auto-generate HTML previews.
  • Auto-complete issues. Say you are entering an <a> tag in front of the word link. The auto-complete feature will turn your text into the following: <a></alink>link. Also, auto-complete uses the Enter key as a selector; pressing Tab will just insert a tab character (or whatever space characters the editor decides to use).
  • Pressing the Home key moves the cursor to the beginning of line instead of the first character of text.
  • The File - Open option does not allow opening multiple files (although, you can drag and drop multiple files from Windows Explorer and the editor opens them fine).
  • You cannot perform searches across multiple files.
  • A highlighted word does not get automatically entered in the Search dialog, so you need to type it in.
  • To see transformation properties (such as XML source file), the cursor must be moved to the top of the XSL file. The properties also gets disabled if you open a read-only file.
  • Right-click clears text selection, so you can't copy or cut selected text using a context menu.
  • Debug toolbar occasionally disappears.
  • Switching between open files showing transformation previews causes losing the previews.
  • Changing the source XML file for a template, results in the preview tab displaying XML text instead of the preview.
  • It would be nice to be able to open a new tab (with an empty document) by double-clicking empty space in the tab area (a'la Firefox).
  • There are occasional errors (for the most part, the errors are not serious, although once I had to restart the program).
Despite all these annoyances, I found WMHelp XMLPad quite useful.

Xselerator was the last free XML editor I tried and I did not like it at all. First, it does not have an installer, so I had to go through the motions of creating folders, extracting files, defining shortcuts. Having done this I started the program and immediately encountered an error: "CoCreate failure on IAltovaApplication. Error: Class not registered." Apparently, the tool expects the AltovaXML engine to be installed. It would be nice if there were an indication of this requirement somewhere (installer?). The error does not seem to affect functionality, but still... Anyway, some people praise Xselerator, so you may want to give it a try.

If I were to test XSL transformations in future, I would stick with Visual Studio, but if you're looking for a free alternative, see if any of the applications I described fits your needs.

Monday, June 15, 2009

My.Utilities Class Library

Summary: Helper utilities library that some .NET developers may appreciate.

For several years, I have been compiling a library of utility/helper classes reused across multiple projects. You may recognize some of these classes if you read my published articles, but there are several classes that have not been released to the public, yet.

Here is a brief description of the most useful classes in the library (and there are more):
  • BaseForm
    I derive all my web form classes from this class. This classed extends the functionality of System.Web.UI.Page by offering many handy features, such as easy time localization (automatically converts time from GMT/UTC to local time on the client and vise versa; for additional information read It's About Time), invoking JavaScript pop-ups from code-behind, quick enabling/disabling/showing/hiding page controls, setting/getting session parameter in/from a cookie, retrieval of data values from form/query string, deep search for controls, and more.
  • AppProcess
    Loads a named assembly from a non-standard path (assuming that you specify alternate paths).
  • ExceptionInfo
    Generates formatted error messages for different type of exceptions based on various parameters and exception types, retrieves messages from inner exceptions and database error objects (for additional info, read Dissecting Error Messages).
  • Helper
    Okay, I agree: this is not a good name... Anyway, this class makes it easy to check for empty objects of different data types. For example, you can check for empty or null array in a single statement (if (Helper.IsEmpty(myArray)) instead of having to check for null first, and then for the number of elements in the array.
  • WindowsService
    Simplifies implementation of Windows services. Other classes in the same namespace (My.Utilities.Services) make it trivial to write periodic tasks (daily, weekly, etc) that Windows services normally perform (for additional info, see Implementing Windows services in Visual Studio 2008).
  • DataHelper
    Converts database values to standard .NET types, so you do not have to worry about special handling of DBNull values.
  • Name
    Makes formatting of people's names based on the available name parts easier, e.g. John F Kennedy, Jr; Kennedy, John F, Jr; John F Kennedy; Kennedy, John F; John Kennedy; Kennedy, John; etc.
To see the description of all classes in the library, download the help file:
My.Utilities.chm
This help file covers all classes, methods, properties, etc., and even offers a few samples.

If you are still interested, you can download the library project:
My.Utilities Class Library Project (Visual Studio 2008)
Just keep in mind that I started writing this library around 2001/2002, so some functionality could've been improved had the technology -- nullable types, generics, etc. -- been available at the time. Also, the general disclaimer applies: use at your own risk.

I hope this helps someone, but if you run into any issues, please let me know.

Thursday, April 23, 2009

Security Hall of Shame: Lenovo

Summary: What is wrong with password rules at Lenovo?

The winner of today's Security Hall of Shame Award in the category Stupid Password Rules (subcategory: We want you to think that we support strong passwords, but we don't, ha-ha) is... Lenovo.

When you register at Lenovo IBM Shareholder Purchase Program, you are not allowed to specify the password (not sure why, but whatever). Once you submit the registration info, you will receive an e-mail with your user name and random password (not that smart to send password along with user name, but whatever). Now the logical step is to change the password to the one you can remember, so you click the My Account link (not easy to find on the page, but whatever), and then click Change Account Information (would be better to separate security info -- user name, password -- from regular account info -- address, phone, etc. -- but whatever).

Okay, let's change the password. This is not a financial site, so make a new password, which is:
  • 8 characters long, with
  • upper-case letters,
  • lower-case letters, and
  • a number.
This should be good enough, so save changes... and... o-ops, error:
"The password is too simple. It must contain at least two numbers."
Hmm, among the passwords I use, none of them has two numbers, but let me try this:
  • 9 characters long, with
  • upper-case letters,
  • lower-case letters,
  • a number, and
  • a special character.
This one complies with most password security guidelines, so save changes... and... da-ang:
"The password contains special characters. Only letters (a-z) and numbers are allowed."
Hmm, okay let's try this:
  • hello123
Save changes... and... no hay problema. Bravo, Lenovo! You know your security.

Now, kids, remember that Lenovo will lose its Security Hall of Shame Award when it changes password rules to:
  1. allow special characters (such as: +-*#@!~&%), and
  2. not require two numbers (this is not a bad rule, but it's not common).
See also:
What is strong password? by Webopedia
Strong passwords: How to create and use them by Microsoft

Wednesday, April 22, 2009

Technobrief #7

Summary: Recent findings of software, articles, tips, podcasts, and more.

ArticlesBooks
  • Almost Perfect by W. E. Peterson (a story of the rise and fall of WordPerfect Corporation from the author's point of view; free online/PDF version)
Browser add-ons, bookmarklets
  • Ask & Record Toolbar lets you download, record and convert all kinds of Internet Video and Audio, right from within your browser.
  • PriceProtectr browser toolbar helps you monitor prices, keep track of your purchases, and get rebates when prices drop.
  • Readability bookmarklet removes clutter around text on web pages making it easier to read.
  • Web Development Helper browser extension for Internet Explorer that provides a set of tools and utilities for the AJAX and ASP.NET developers.
Humor
  • From ManagementSpeak by Bob Lewis:
    ManagementSpeak: Work space will be designed to create an environment that promotes teamwork and effectiveness, while improving space utilization.
    Translation: We’re going to cram twice as many employees into the same floor space.
Quotes
  • From How to Do Things Your Customer Didn't Ask For by Jurgen Appelo:
    "The underpromise, overdeliver principle tells us that we should manage our customer's expectations in such a way that we are able to deliver more than the customer asked for."
  • From How to be a program manager by Joel Spolsky:
    "There are so many development organizations where specs are a monument to mindless bureaucratic paperwork that entire movements sprung up organized around the idea of not writing specs. These people are misguided. Writing a functional specification is at the very heart of agile development, because it lets you iterate rapidly over many possible designs before you write code."
  • From Make It Simple vs. Do It Simple by Jurgen Appelo:
    "It's a complicated thing to build stuff that is simple. It's a simple thing to build stuff that is complicated."
  • From Out with objectives, in with technique? by Bob Lewis:
    "Measuring employees is a bad idea because employees have a remarkable talent for gaming the system. They can: Work the system so the numbers look good; behave in ways that make the numbers look good while circumstances deteriorate; or just falsify the data outright. I pointed this out once in an executive meeting, and one of the participants recommended firing any employee who would behave this way. Interesting concept, as I was referring to a very large number of American CEOs."
Software
  • Avidemux is a free video editor designed for simple cutting, filtering and encoding tasks.
  • Greenshot creates screenshots.
  • Ken Rename is a capable a multi-file rename utility.
  • RichCopy offers comprehensive file copying capabilities.
  • SEAMonster can resize images with minimal pixel loss (see seam carving).
  • Starter is an application startup manager which also provides extended process info (similar to Task Manager), as well as service and driver manager.
  • UnlockMe enables you to delete, move or rename files or folders that are temporarily locked by other processes.
TipsTutorialsVideos/podcastsWeb tools
  • AlternativeTo suggests alternatives to popular applications.
  • AnyClient is a web-based file transfer application that supports all major file transfer protocols including FTP/S, SFTP and WebDAV/S.
  • StyleNeat organizes and standardizes your CSS in a structure that makes it easier to define page areas and see how they relate to each other.
  • When is Good offers an easy way to find out when everyone is free for your next meeting or event.

Convert a string to a table in T-SQL

Summary: Transact-SQL function that converts a string of comma-separated numbers to a table of integers.

Here is a common SQL programming scenario. Your code receives a string holding comma-separated values (CSVs), such as IDs of records stored in a table (say "98,256,17,34"). Now it needs to retrieve these records from the database. How do you do this?

[Note: For the sake of simplicity, I use a comma-separated value (CSV) holding numbers, but the string can contain other values, such as dates, or other strings, which can be separated by semicolons or other delimeters.]

Option #1. Use EXEC (not recommended).
The obvious option would be to generate a dynamic SQL query and execute it via an EXEC statement. For example, you can do the following:
USE AdventureWorks

DECLARE @ProductIDs varchar(256)
DECLARE @Query      varchar(256)

SELECT @ProductIDs = '1,350,400,440'

SELECT @Query =
'select
  ProductID,
  [Name],
  ProductNumber
FROM
  Production.Product
WHERE
  ProductID in (' + @ProductIDs + ')'

exec(@Query)
There are two major problems with this approach. First, generating the query -- in this example it's a SELECT query, but it can be any query -- as a string will degrade readability: you will lose syntax highlighting and IntelliSense (if you're using a new SQL Server 2008 IntelliSense feature or some other third-party tool, such as SQL Prompt). Second, and even more important, this approach is prone to SQL injection attack. Even if you use a command parameter to pass a comma-separated value (CSV) to the stored procedure, since you're simply appending it to dynamic SQL, you must make sure that it does not contain suspicious characters. Whether you do it in T-SQL code or in the application code (C#, or whatever), it's a hassle.

Option #2. Convert string of values to a table of values (recommended).
A better alternative would be to convert the CSV to a table of numbers (again, I use numbers in this example, but the values can be of any type). You can accomplish this with the help of a user-defined function (UDF), such as this one:
CREATE FUNCTION [dbo].[ConvertCsvToNumbers]
(
  @String AS VARCHAR(8000)
)
RETURNS
  @Numbers TABLE (Number INT)
AS
BEGIN
  SELECT @String = 
    LTRIM(
      RTRIM(
        REPLACE(
          ISNULL(@String, ''), '  ' /* tab */, ' ')))

  IF (LEN(@String) = 0)
    RETURN

  DECLARE @StartIdx       INT
  DECLARE @NextIdx        INT
  DECLARE @TokenLength    INT
  DECLARE @Token          VARCHAR(16)

  SELECT  @StartIdx       = 0
  SELECT  @NextIdx        = 1

  WHILE @NextIdx > 0
  BEGIN
    SELECT @NextIdx = CHARINDEX(',', @String, @StartIdx + 1)

    SELECT @TokenLength =
      CASE WHEN @NextIdx > 0 THEN @NextIdx
      ELSE LEN(@String) + 1
    END - @StartIdx - 1

    SELECT @Token = 
      LTRIM(
        RTRIM(
          SUBSTRING(@String, @StartIdx + 1, @TokenLength)))

    IF LEN(@Token) > 0
      INSERT
        @Numbers(Number)
      VALUES
        (CAST(@Token AS INT))

    SELECT @StartIdx = @NextIdx
  END
  RETURN
END
Now you can reference this UDF in a query, such as:
SELECT
  ProductID,
  [Name],
  ProductNumber
FROM
  Production.Product prod,
  dbo.ConvertCsvToNumbers(@ProductIDs) numbers
WHERE
  prod.ProductID = numbers.Number
In addition to improving readability and security, this method lets you treat data contained in the CSV as a regular table. If you want to try this approach, you can download the script generating the UDF, which is more robust than the listing above (the script sets the permissions and contains code for repeated compilation):See also:
How To: Protect From SQL Injection in ASP.NET

Friday, April 10, 2009

Best of MIX09

Summary: My favorite presentations from the MIX09 conference.

If you are interested in design and web technologies, but did not have a chance to attend MIX09 (the annual Microsoft conference focusing on design and web technologies), here are some of the free online presentations that I would recommend.

Best talks

If you do not have much time, just watch just these two presentations (they both focus on design):
  • Web Form Design (74:36)
    by Luke Wrobleski, Senior Director of Product Design, Yahoo!
    This session focuses on the most common design mistakes and introduces 10 best practices for web form design. The presentation covers such topics as form organization, alignment rules, input validation, using help and tips, progress indicators, error reporting, and more.

  • Ten Ways to Ensure RIA Failure (39:34)
    by Anthony Franco, President, EffectiveUI
    Great (and short) talk focusing on what NOT to do in web design and development. My favorite points include:
    "If you're looking to fail, trust developers to make good design decisions."
    As well as:
    "If you're looking to fail, value the process over the product."
The following presentations mostly focus on design, development, deployment, and security:

DesignDevelopmentDeploymentSecurity
  • Securing Web Applications (75:30)
    by Eric Lawrence, Security Program Manager (Internet Explorer), Microsoft
    This talk is more about IE 8 features, but it still raises a few interesting points about web application security.