Command-line installation of OpenVPN

OpenVPN’s installer allows for command-line based (silent) installation, but this feature is not actually documented explicitly anywhere. Here’s all I could find – hope this list will help someone in the same situation I was in.

Continue reading

Turn Your Box into a Dev Web Server

To turn your box into a dev web server is pretty simple, yet I’ve seen people struggling with this over and over again, so here’s a simple TODO list.

I won’t go over the likes of Apache installation, VirtualHost setup, .htaccess settings, etc. as you can find these online very easily, and might be specific to the needs of your project.

Most of the time I see people using localhost:8080 and a myriad of other ports to work on several sites locally; but you might as well work on http://www.myproject.com locally in just 2 simple steps:

  • Create a VirtualHost in Apache which goes by “the name” http://www.myproject.com, by including the following within the definition:
    <VirtualHost *:80>
        ServerName www.myproject.com
        DocumentRoot /var/www/myproject/
        # all the other options and definitions ...
    </VirtualHost>
  • “Register” the domain name locally – simply add the following line to your /etc/hosts file (on Windows, this file is typically located under [Windows]/System32/Drivers/etc):
    127.0.0.1    www.myproject.com

Now enable the VHost in Apache, restart Apache, and open http://www.myproject.com in the browser, and you’re ready to code off!

Note: The VHost name need not be a valid domain name – feel free to use myproject as ServerName and in /etc/hosts; just beware that some browsers will try to search for “myproject” instead of opening the local site. In such case, type in the whole http://myproject.

IE Certificate Error with Signed Certificate

So, you’ve got your shiny new certificate, and your good old server. You’ve installed the certificate, chain or intermediate certificate, and all is nice and clean in FireFox, Chrome, Chromium, etc.

Then, your boss opens up his IE, and gets Certificate Error – “not issued by trusted certificate authority” and/or “issued for a different website’s address”. Of course, that’s a major pain, as IE – however bad, buggy and crappy it is – still holds majority of browsers market, as most computer users are incapable of installing a better browser.
Continue reading

How to change line height in NetBeans’ editor

After changing font size in editor in NetBeans 6.5, the line height (line spacing) all of a sudden grew to about 2 “normal lines”, and didn’t change back even when I returned to the original font size.

The only work-around I found was to edit manually the editor’s configuration file (since this option is not available via GUI).
The file org-netbeans-modules-editor-settings-CustomPreferences.xml can be found in ~/.netbeans/6.5/config/Editors/Preferences (on Windows, it’s in {install_dir}\ide10\config\Modules ). If it’s not there, change any editor settings in NetBeans IDE, and it’ll create it.

Open this file in your favourite text editor, and add the following code right before the last line (right before the </editor-preferences> tag):

<entry javaType="java.lang.Float" name="line-height-correction" xml:space="preserve">
    <value><![CDATA[0.7]]></value>
</entry>

And that’s it! Restart the NetBeans IDE, and all should look much better. Happy coding!

Another solution, thanks to Mark :

  1. Install sun-java6-jdk
  2. Uninstall open-jdk
  3. Reinstall NetBeans

Small guide to casting in C++

If you only want a guide to casting in C++, skip to the end of the article. If you want also a bit of technicalities for a better understanding of casting in C++, skip to the one but last section. If you want also a bit of my mind, read the article whole.

Continue reading

How to Open Console Window in a Win32 Application

When you create a basic main()-based application, you get the console window implicitly; but a typical WinMain()-based application does not open a console window – you have to allocate the console and to connect the I/O streams yourself.

Yet, this is not a thing you find described in manuals. Fortunately, it’s simple to do, and the code presented here can be used as-is in all your projects.
Continue reading

Simple Doxygen templates

This is a follow-up to previous tutorial, Simple guide to basic Doxygen usage.

Here are few simple templates that you might use for documenting your source; easiest use is with e.g. Visual Assist X, or any other tool that allows you to add predefined templates to your source code. I use these template with VAX and shortcut set to “/*!”, with short descriptive names, thus I don’t need to remember many shortcuts and have all at reach of 3 key-clicks. 😀

And we finish off with a small list of simple tips.
Continue reading