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.

Informix

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

MySQL

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:

bootstrap
.\b2

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).

Informix

select first 5 *
from customer;

MySQL

select *
from customer
limit 5;

SQL Server

select top 5 *
from customer;