Wednesday, December 28, 2011

MySQL Error Nr 1045: Access denied ... (using password: YES)

If you opt to reinstall MySQL, the following error is probably what you'll find upon reinstalling and finishing the MySQL Instance Config Wizard:

The solution is to not only uninstall MySQL, but also remove (a) the directory where it is installed, and (b) the directory where it keeps its settings. On Windows 7, the latter can be found at C:\ProgramData\MySQL, or C:\Users\All Users\MySQL which is the same thing. Once these are removed, proceed to reinstall MySQL, doing a detailed configuration (from the MySQL Instance Config Wizard) to reset the root password. If you miss any of these steps, you might need to uninstall and reinstall again.

Wednesday, December 7, 2011

Search using Google, or Google

When installing the Google Chrome browser, you are asked to choose which search engine you want to use directly from the browser. This might seem to allow fair competition, although there is obviously no mention of Bing. What I found funny, though, is that two out of four choices are Google.

Monday, October 17, 2011

NetBeans squashed button bug

For a while I've been having a problem with NetBeans 7.0.1 which is sometimes creating buttons that look squashed, like a sausage. I haven't noted a pattern that causes this bug to occur, but I finally found a solution. You have to Clean and Build Main Project (Shift+F11), and then the buttons will render correctly when you run the project.

Saturday, October 8, 2011

SQL String Concatenation in Informix, MySQL and SQL Server

Like selecting the top N rows, syntax for string concatenation is DBMS-specific. The following are examples for Informix, MySQL and SQL Server.


select name || ' ' || surname
from customer;


select concat(name, ' ', surname)
from customer;

Note: the MySQL concat() function can accept any number of arguments.

SQL Server

select name + ' ' + surname
from customer;

Friday, October 7, 2011

How to build the Boost libraries

The Boost libraries for C++ are distributed in source form, and can be easily built by following these instructions. From the Boost root directory, simply run the following two commands:


Tuesday, October 4, 2011

Run as different user, in Windows 7

Here's a little gem from a friend of mine. In Windows 7 we all know how to right click and "Run as administrator". But how do you run a program as a different user, perhaps as an administrator on a different domain? The answer: when you Shift + Right click, you get an additional "Run as different user" option.

Thanks, Microsoft, for hiding stuff from us. You really know all about usability.

Monday, October 3, 2011

SQL Top n Rows in Informix, MySQL and SQL Server

Different dialects of SQL allow you to obtain the first n rows, resulting from a query, in different ways. The following are examples in Informix, SQL Server, and MySQL. Tip: to get the last n rows, simple switch the order by clause (from ascending to descending, or vice versa).


select first 5 *
from customer;


select *
from customer
limit 5;

SQL Server

select top 5 *
from customer;

HTML Access Keys

The HTML accesskey attribute is very useful usability feature that is reminiscent of shortcut keys in standard desktop applications. This allows you to define particular key combinations for your navigation links (e.g. Shift+Alt+H for Home). Originally, these access keys used the Alt key, but they would clash with the browser menu (which also uses the Alt key, by convention), so they were changed to use Shift+Alt in most browsers.

Firefox, Safari, Chrome and Internet Explorer use Shift+Alt for access keys. The first three will follow the link when you press the key combination, while IE (always the black sheep of browsers) will just focus it, so you have to press an additional ENTER to follow the link. I don't know what the developers were thinking. What's the point of just focusing a link?

It is up to the site to make the access keys evident, often by underlining the particular character that triggers the link - a convention typical of application menus. However, by pressing the Shift+ESC key, the Opera browser brings up a full list of access keys in a particular page, even if they are obscure. Subsequently pressing the access key character (e.g. Shift+ESC+H) will trigger the link.

Juicy Studio has a really good article on the topic.

Saturday, October 1, 2011

uCertify PrepKit Review


We live in a competitive world. This is evident at every level, from technology giants like Microsoft and Google wrestling with one another for market share, to technology professionals fighting to get that prestigious new job with that particular company. The ones who make an extra effort to distinguish themselves from the rest are ultimately those who win. Certifications are one way of gaining this edge over the rest.

Today, hundreds of certifications exist, and they cover just about every IT job, including support, analysis, development, management, security, and much more. Many people choose to attain a certification in order to gain and demonstrate expertise in a particular subject, sometimes leading to promotions and/or pay rises as well. However, obtaining a certification is a difficult goal that requires long-term commitment, and in doing so, one must have access to the right preparation material.

Some people attend a course to prepare for a certification, while others opt to teach themselves through books and other material. There are also many commercially available preparation engines that serve not only to teach the subject, but also to serve as mock exams. This is very useful because free mock exams are usually very hard to find or non-existant, and having a feel for what the exam will be like is very important. Ultimately, there is no single correct way of preparing oneself, and a combination of learning methods may be the best solution.

This article reviews uCertify's PrepEngine, which is one such preparation engine. The PrepEngine allows you to use one or more PrepKits, each of which provide learning and test materials for a particular certification. This review is based on the MCTS: Windows Application Development with Microsoft .NET Framework 4 (C#) PrepKit. However, uCertify has PrepKits for just about any certification you can think of doing.


The main screen for the particular PrepKit you are using is called the Dashboard. The preparation materials are organised into four categories for easy access. At the top are two tabs: Practice Test and Study Helper. Practice Test incorporates the PrepEngine's test engine, that will allow you to take a variety of tests in order to gauge your level of preparation for the real certification exam. Study Helper allows you to navigate through pages that teach you each topic you need to know, in a step-by-step manner.

Beneath these two tabs is the Enhance your understanding section. The resources in this section are more intended for when you have already covered the material required for the certification, and need to consolidate that knowledge before taking the exam. Finally, the Track your progress section lets you monitor your progress and determine your readiness to take the exam.

The Dashboard is simple and intuitive. A small thing that could have been done better is the list of features on the right part of the Dashboard. When you get used to the product, you will ignore them, so about half of the screen space is wasted. The Study Helper and Track your progress sections could be placed on the right, allowing instant access to all the product's features without scrolling or tabbing. Hints about the features could still be provided in the form of a random tip, either at startup or in a corner. However, I will point out that this is a very minor usability issue and in no way detracts from the product's rich feature set.

Although I will go over each category separately in this review, you will actually be going from one to another all the time. For example, going over the Exam objectives (Enhance your understanding section) is a good place to start, after which you can take a Diagnostic test (Practice Test section) or go over the study material in the Study Helper section. The flexibility of uCertify is that you can do things in any order you want, and everything is customisable for your convenience.

Study Helper

The Study Helper is a collection of learning resources organised by exam objective. Each chapter explains the exam objectives, covers each topic, and lets you take short quizzes (with answers provided) to see that you've grasped the concepts. Navigation is easy by using the buttons in the panel at the bottom, and keyboard shortcuts enhance the product's accessibility.

A little glitch I noticed is that although the Prior (Back) button is disabled when you're at the beginning, the Next button remains enabled when you're at the very end. This happens not just in the Study Helper section but throughout the PrepKit.

Enhance your understanding

The resources in this section are quite varied, so I'll go over them briefly. Exam objectives, as I noted earlier, is a good place to start, because it gives you a general overview of all the topics you need to know. You can get this same information at the beginning of each chapter in the Study Helper section, but here it is available all in one place.

Flash cards are cool way of assessing your knowledge without having to take a whole test. Basically you are asked questions which are the same as the topic titles from the Study Helper chapters. After you write what you think is the correct answer, you can check your answer against the Study Helper material there and then. One thing I noticed, however, is that the Dashboard says that there are 167 flash cards, when in reality there are only 155.

Study notes also give you access to the Study Helper material, using a different view. Like with flash cards, the Dashboard says there are 167, but in reality there are 155. 167 is actually the total number of study notes, articles, how to's and study tips combined, so the PrepEngine evidently has got some of its numbers wrong.

Now we come to the Articles. After seeing 155 study notes and flash cards, there are... 2 articles? And both about LINQ, which is just a tiny part of this MCTS? The articles are intended as technical articles written by industry experts, and they do go into some depth, but the choice of topics could have been better. Even the dog below has something to say about this (image borrowed from here).

The Study tips contain general information about the certification aside from the curriculum itself, including background information about the exam, test procedures, and checklists for the skills you need. I'm saying "checklists" because there were two study tips that were exactly identical except for the tense of the initial verb (see below).

The How To's are step-by step guides to configuring specific things in Visual Studio.

Practice Test

This section is probably the most important part of the PrepEngine. You can read a book to prepare for the MCTS, and it might even have a CD with a mock test or two. However the PrepEngine's test engine is much more flexible and will allow you to test your knowledge in the particular certification you are following.

There are several different types of tests you can take. The diagnostic test is a quick test that gauges your general ability before you actually get serious about learning all the certification material. Most of the questions are multiple choice, but then you also get some weird stuff like the above, and the results screen incorrectly shows that you've answered them, even if you skipped them. Also, you get tired very quickly of every question saying that you work at uCertify.

Then you get practice tests among other things. These aren't different at all from the diagnostic test, and the PrepEngine's greatest strength is that you can customise the tests as you like. By using learn mode, you can see the correct answer and an explanation for each question as you go along, right after you answer. Tests can also be customised by topic, by the amount of time you have available, etc. There are also useful features that let you tag questions, write notes about them, etc.

While these tests will help you, and while uCertify does guarantee that you will pass, always keep in mind that these aren't the questions you will see in the exam. Certification exams keep their questions secret, and the best that software like this can do is try to come close based on the exam objectives. Passing a practice test in no way means that you'll do great in the certification exam.

Track your progress

This section gives you statistics about your progress. Since your test progress is always tracked, even when you take a test just to look at how it works, my progress looks pretty awful:

Nonetheless, this is good because you can monitor your strengths and weaknesses by topic or by test. This allows you to prioritise by focusing on the topics you are not so good at.


uCertify's PrepKits pack quite a lot of useful material to help you achieve the certification you want.. The PrepEngine is built with usability in mind, and it is easy to find the information you need. There are several little bugs throughout the product; however none of these significantly affect the preparation experience. While it is always a good idea to compare features with competing products before acquiring something like this, uCertify's PrepKits are no doubt a good choice to complement a book and/or course in helping you sharpen your skills and go through the exam with confidence. As I already mentioned, however, certification tests are ultimately very different from mock tests, so you should never be overconfident.


Some companies deploy and use their software within the company itself. This is known as dogfooding, and Coding Horror has a pretty good article about it. Dogfooding is pretty useful to let a software product undergo day-to-day use (for proper testing) before it is released to clients.

Saturday, September 17, 2011

Windows 8 Bootup: Unexpected error 0xc0000225

The unveiling of Windows 8 this week has had mixed reception. Nonetheless, the reease of the Windows 8 Developer Preview has sparked curiosity among fans and skeptics alike. I am no exception.

Upon installing the Windows 8 Developer Preview under VirtualBox, though, the following error appeared:

Error 0xc0000225, very helpfully explained as "An unexpected error has occurred", prevents the Windows 8 installer from booting. Fortunately, however, getting it to run is simply a matter of enabling IO APIC from the Settings -> System screen. This blog post shows how it's done.

Tuesday, May 17, 2011

Ubuntu resolution in VirtualBox - revisited

Apparently it isn't enough to install the guest additions in order to get a proper resolution in Ubuntu under VirtualBox. A further necessary step is to use the vboxmanage tool (from the command line) to adjust the resolution as follows:

vboxmanage setextradata "VMname" CustomVideoMode1 AxBxC

where OSname is the name of your virtual machine as it appears in VirtualBox, AxB is your resolution, and C is your colour depth. For example, the command to adjust the resolution on my laptop is:

vboxmanage setextradata "Ubuntu 10.04 LTS i386" CustomVideoMode1 1366x768x32

Restart Now, or Restart Now

The saga of Microsoft's dumbass message boxes is back in the Visual C# Express 2010 installer.

Putting aside the annoyance of having to actually restart in this day and age, the "Restart Later" button is present or disabled, leaving you no option but to either restart or leave the prompt in the way.

Sunday, April 24, 2011

Getting started with OpenGL on Windows

This post describes how to set up OpenGL in Windows. It uses Microsoft Visual Studio 2008 Professional Edition, and has been applied to Windows 7 Home Premium and Windows XP x64 SP2.

The first thing to do is download GLUT. From there you reach GLUT for Windows, which is what you need to download. The zip file contains glut32.dll, glut32.lib and glut.h, which you need to place in their correct places. glut32.dll needs to go in C:\WINDOWS\system (system32 won't work, and neither will placing it with your executable). glut32.lib needs to go in Visual Studio's lib folder (C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\gl - you will need to create the gl folder), and glut32.h goes in the include folder (C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include).

Good, so now we set up a C++ project to try it out. Launch Visual Studio 2008. Go to File -> New -> Project... and create a Visual C++ project (Visual C++ -> General -> Empty Project). So now the project has been created but it is still empty so you still see the VS2008 start page. Go to the Project Properties (either by right clicking on the project in Solution Explorer and selecting Properties, or via the Project menu then Properties).

Set the Configuration field at the top left to All Configurations. In the treeview, go into Configuration Properties -> Linker -> Input. In Additional Dependencies, insert "opengl32.lib glu32.lib glut32.lib" (without quotes, as is, separated only by spaces). glaux.h is deprecated so you can just leave it out.

Finally, create a main.cpp file (Add -> New Item..., then C++ file; name it main.cpp), paste some sample code, and press F5 to run it.

 That's it. Hopefully this saved you the frustration I went through during the initial setup of OpenGL.

Saturday, February 26, 2011

Getting Started with Microsoft Visual Studio Lightswitch Beta

The newest addition to the Microsoft Visual Studio family is Lightswitch - a new take on the IDE allowing business applications to be built faster than ever. Lightswitch uses the model of such applications being based on data tables and screens, and the provision of standard functionality (e.g. field validation) that developers spend countless hours rewriting every time, to speed up the development process.

Aside from the standard functionality provided, customisation (e.g. custom validations) is possible using the normal C# or Visual Basic code we are all used to. Additionally, the look and feel of applications can be changed through a simple dropdown box, and may be adjusted on the fly even while debugging applications.

The Lightswitch website provides information, screenshots and videos on what Lightswitch is all about. The Lightswitch Developer Center provides several resources to get started, including a download of the beta itself.

Actually getting up and running with the Lightswitch beta can be a bit tricky. Paul Patterson's blog post goes through the difficulties encountered in setting up Lightswitch. A forum post deals with removing WCF RIA Services for Visual Studio 2010 through the registry (since the uninstall does not actually cleanly remove it), which is necessary before installing the Lightswitch beta.

Tuesday, February 15, 2011

Adjusting Ubuntu resolution in VirtualBox

I had a problem when installing an Ubuntu 10.10 image in VirtualBox because the screen resolution was remaining at a tiny 800x600, barely allowing room for a single terminal window.

The following commands install the guest additions which are necessary for running Ubuntu at full resolution:

sudo apt-get update
sudo apt-get install build-essential linux-headers-$(uname -r)
sudo apt-get install virtualbox-ose-guest-X11

Thanks goes to Gilbert Galea for providing the above solution.