2009/09/29

Notepad++ a great quick editor for Windows

I've been looking for a free (as a beer) good text editor for Windows, specially for quick editing or viewing a file while navigating. Notepad is "free", but too simple (I know Notepad is not free, but once you have Windows installed you don't have to pay for it separately) and there are really wonderful text editors like UltraEdit but they're not free. JEdit is very powerful and free, and with all the plugins you can download for it you can have almost all the functionality you need, but its startup is a bit slow (at least with the minimal set of plugins that I use); if I must work with an ant file for some hours it pays off, but if I'm only navigating through a directory and making very small and fast modifications to a file, it is too much for me.

Searching through the Internet I found this super text editor called Notepad++. It is open source (GPL), it is blazingly fast and it has a great set of features, from which I would emphasize:
  • Syntax highlighting and syntax folding (syntax highlighting can also be user defined)
  • Autocompletion
  • Multidocument and multiview
  • Powerful search/replace, including regular expression search
  • Full drag and drop
  • Bookmarks
  • Macros (you can record sequences and play them back)
I've been using it for some weeks and I can say it rocks! It's my current Windows quick editor. It can even update quite frequently the view of a log file, not as smoothly as the Unix command "tail -f", but enough for my needs.

It is not such a discovery, though. Once I installed it I saw with surprise that some of my colleagues had been working with it for some time. So if you haven't heard about it and you need a quick editor for Windows, take a look at it!


2009/03/17

Dokan: Filesystem in userspace (FUSE) for Windows

As Wikipedia explains, a filesystem is a method for storing and organizing computer files and the data they contain to make it easy to find and access them.

There are many different filesystems, like ext3 (Linux) or NTFS (Windows), only to name a few. These filesystems allow the usual and necessary file operations we do every day: creating, copying, moving or deleting files or directories, listing directories or showing the content of files. We usually do these operations with "real" files and directories of a hard disk or a USB device, but nothing prevents us from doing them on other kind of systems which have not been prepared from the beginning to be used as filesystems in an operating system. An example of this system would be an FTP server. It clearly organizes like a filesystem, with directories, files, attributes of files and so on. So it would be possible to access an FTP server like a hard disk using your favourite file explorer if you were able to mount a "virtual" filesystem which connects automagically to the FTP server and lists the root files and directories when you go to the root of the filesystem, it deletes a file in the FTP server when you delete it in the filesystem and so on.

In fact, this is not new at all. In Linux, there exist currently many different "virtual" filesystems you can mount to ease the access of different types of resources, be them local or remote. What is more, Linux has a package called FUSE (Filesystem in Userspace), which allows mounting your own filesystem without having to make a device driver and compile it. FUSE is based on callback functions you have to implement that will be called when the different operations are invoked from the operating system. There exist a lot of language bindings for FUSE, so you can write your filesystem in Java, C#, Haskell, TCL, Python and many more (besides C or C++, which would be the expected languages for such a low level based feature). With FUSE, writing your own filesystem for Linux can be a much easier task.

But what about Windows ? A Windows port of FUSE has not existed for a long time and, from what I know, nothing similar was available as open source. But on May 2008 a project called Dokan was released as open source (LGPL). This project is the equivalent of FUSE for the Windows platform. You can download it from here. It has bindings for Ruby and .NET. In Yukoba's blog you can find very interesting contributions that enhance this project, like a Java binding (JDokan), MemoryFS (a filesystem on memory) or JSFlickerFS (a filesystem for managing Flicker albums, written in Javascript).

So if you need to write your own virtual filesystem in Windows, you have no excuse...give Dokan a try!

2009/02/01

HTML crosslinked documentation from source code files

I know that modern IDEs can navigate through source code files very easily. But...what if I want to browse through source code files in my Palm TX ? Netbeans, Eclipse and other IDEs are not available for it, but I can read HTML pages offline easily with Plucker. Maybe I simply don't want to open an IDE only to browse the source code, without actually coding.

There are tools that can generate HTML pages from source code, so you can browse through them easily. They can even beautify the code with syntax highlighting and (this is my favourite) provide links between the different elements of the documentation. So, when you browse class Foo and it extends from BaseFoo, you can simply click on the word BaseFoo and you navigate to the class BaseFoo, and so on.

I've been searching for tools of this kind and I found some of them.

I like Doxygen a lot, it can make a wonderful and complete documentation of the source code, including this crosslinking source code navigation. It can optionally use another tool called htags to include the source code with this crosslinking navigation (instead of its own system). And this little tool attracted my attention...htags. It is an extremely simple and fast yet powerful tool that can generate HTML crosslinked documentation from source code.

If you have a Linux (or other *nix), you can simply install htags with a package manager, the whole package where it belongs is global. If you use Windows, you can download global from this site. There are other binaries in the download page of global.

With htags you can go to the source code root directory, write:

htags -g

...and that's all! You have your browsable crosslinked HTML documentation in a directory called HTML. I have tested it with Java files, but it supports other languages as well (C, C++, Yacc, PHP and Assembler).

If you want more features (like class diagrams, Javadoc-style complementary documentation, more flexibility with configuration, etc.), you can use Doxygen. It also supports more languages (C++, C, Java, Objective-C, Python, IDL, Fortran, VHDL, PHP, C#, and to some extent D). But if you only need plain source code with syntax highlighting and crosslinked navigation, give htags a try!