Sunday, December 30, 2012

Qt 4.8.4 and MinGW Quick Start

The following are instructions for installing Qt and compiling a demo application using the MinGW toolchain:
  1. Download the Qt 4.8.4 libraries installer here.
  2. Run the installer. If a warning message about the version of the w32api.h file appears ignore it and continue the installation (my install is version 3.17 and appears to work fine).
  3. By default, the installer does not add the Qt toolchain to the PATH. Instead, it provides a custom command prompt environment called the "Qt 4.8.4 Command Prompt"; launch this command prompt from the Start menu.
  4. Now we can try compiling an example; from the Qt command prompt, navigate to C:\Qt\4.8.4\demos\textedit.
  5. Execute the command qmake; this should generate a makefile.
  6. Build the example using the command make.
  7. If everything goes correctly, textedit.exe should now exist in the debug directory; launch the demo application.
That’s it! Your machine is now ready to build Qt apps using MinGw.

Saturday, December 22, 2012

Vim Zoom Hack

When writing large documents with a text editor, it is sometimes useful to zoom out and get a high-level view of the file (I believe Sublime Text has a feature called minimap that does this). This functionality can be added to gVim with a simple vimrc addition (to my knowledge, this will not work with regular Vim).
Add the zoom out command with the following: noremap <Leader>zo :set guifont=courier_new:h4<CR>

Add the zoom in command with the following: noremap <Leader>zi :set guifont=courier_new:h10<CR>

Adjust the font type and normal size as desired. Not the most elegant method but it works. Please note that split window sizes may be affected during the zooming process.

Saturday, December 1, 2012

PopPage

Recently, I had a need for a very lightweight static website generator. The idea was to have Asciidoc and Pandoc handle the markup to HTML conversions while the generator would simply apply the HTML content to a Jinja2 template. The result was PopPage, a simple command-line driven website generator. It plays nicely with native Windows batch scripting and I plan on providing a few examples in the GitHub repo shortly.

Docopt

While browsing YouTube recently, I stumbled upon a video about a great third-party Python module called Docopt. It greatly simplifies writing command line utilities; instead of writing custom logic using the standard library optparse or argparse modules, you simply write the usage docs for the utility and Docopt handles the parsing. Check out the documentation; there are some great examples that really showcase the power of this module.