Syndicate content


Can I create an INDEX to accelerate a SELECT MIN(IF(...)) in MySQL?

I have a table with a few columns, two of which are integers, one of which can be NULL in which case the other integer is to be used in my query.


If `col2` is NULL, then use `col1`. As is, there is how my query looks like:

SELECT MIN(IF(col2, col2, col1)) AS smallest FROM my_table LIMIT 1;

In other words, I need to get the row with the smallest integer, but if one column is NULL, I want to use the other column value.

On a very small sample, the query is still very fast, but the real version is not unlikely to have thousands ...

Recover name of message registered with RegisterWindowMessage()

Today I was confronted with an error in a process that would run in the background and slowly fill up the Windows message queue when it should have been dormant.

I looked at the messages that were being processed once the process woke up and the message number was 0xC10C or so. Nothing in the software has such a number. So I looked around and found out that the message was one of those created using the RegisterWindowMessage() function. (This is wrong in that application since the messages are never used from external applications, but oh well... that does not change the basic problem.)

So, ...

My JavaScript code does not get the correct widget size, why?

As I am developing a set of pages for a customer, I ran in an intersting problem: my JavaScript function could not properly define the sizes of a box.

That box is heavily tweaked with the CSS assigned to it, as well as all of its neighbors. So I thought that may have something to do with it.

What I hadn't realized so far is that the ready() function of jQuery() is called once the script that includes it is ready (as in loaded) and not once the document as a whole is ready (done loading, i.e. onload event.)

With that knowledge it was easy to understand that I was actually finding myself ...

Classes in JavaScript (from complex objects to proper classes)

When creating objects (commonly called JavaScript classes) in your JavaScript code, you want to use the prototype. This is the only clean way of doing it. In JavaScript, you can create objects on the fly, but those are not considered safe.

Quick and Dirty

The quick way is to create an object directly. This works, but it has potential problems with used against a powerful optimized such as the Google Closure Compiler.

All the Quick and Dirty examples can make use of this in their myFunc examples. However, the closure compiler will warning about all of them because it doesn't know for ...

Copy files between a guest (virtualbox) and the host

I use VirtualBox and had a problem with copying files between my host (main computer on which you boot your computer) and the guests (virtual computer that you run on your host).

The fact is that it is all explained right here:

There are a few steps as follow.

Install the Virtual Box Tools

Install the Virtual Box Tools (called Guest Additions) on your guest; these tools allow your guest to communicate with the host to allow files to be written in a directory on the host.

To install those, it should be as easy as using the ...

Changing the Time format in your Thunderbird on Unity (Ubuntu 12.04)

That took me forever because I could not find the place where my Unity icons where to edit them in order to add the necessary LC_TIME definition. This being said, it's relatively easy except that you have no real control over the exact formt, only the locale.


I created a file named starter under my thunderbird folder, if you don't have such (because you're using the stock version of thunderbird) then you may want to create a bin folder as in:

mkdir ~/bin

The starter file is just a text file with a shell script like this:

export ...

Setting up an array of JavaScript functions in jQuery

Today I worked a bit with jQuery to create an advanced form. Advanced just because it is tabbed and appears in a pop-up, nothing too major really. Maybe later I'll add some tests to validate the data being entered before someone can submit the form...

In any event, I ran in a problem which was to create a set of click callback functions (event handlers) and each of which should make use of a different index. So... I have 4 tabs and each one has a number: 1, 2, 3, and 4.

Say I call each one of these numbers #tab1, #tab2, #tab3, and #tab4. Now I want to create a click function on each one ...

1 New MS-Windows Installation Update for a whole week?

For a week now I have had a warning when shutting down saying that there was yet another update to install on shutdown...

I did not really check on it for that long, but today I decided to check the auto-update as I was running the computer. There was the installation ready to be run. So I clicked on the button to start the installation.

After a moment, the installation process stopped with a really weird error:

Error message: Code 13EC, it's an unknown error.

It's funny that any programmer would create an error that the computer cannot figure out... Way beyond me.

This being ...

Multi-level lists in MS-Word... The new way!?

Okay, it has been a little while now, but each time I just have to search forever to find out how to create a multi-level numbering list.

By default, a list will appear as this:

1. Chapter

    1. Section

        1. Sub-Section

Which may work for you, but in many cases you want to have all the list numbers appearing in your section and sub-sections as in:

1. Chapter

    1.1 Section

        1.1.1 Sub-Section

Okay, so that in itself it actually very easy, but it used to be that you could ...

Drupal blocks all disappeared!

Today I had an interesting experience... all of a sudden, all the blocks of a given theme disappeared.

It has been working just fine for months, so I really wasn't sure what the heck it could be.

The fact was that the theme was called the same as the module (as I work for a given client, I tend to do that...)

At some point, I must have added a function with a specific name and that would influence the theme. The result being blocks going bye bye!

I checked and the block content is computed just fine, the problem is the theme('block', $block) call. Although the ...

Syndicate content Syndicate content

Diverse Realty

Diverse Realty Team

Want a New Home?
Want to Sell Your House?

Call Alex at
+1 (916)
220 6482

Alexis Wilke, Realtor
Lic. # 02024063

Cory Marcus, Broker
Lic. # 01079165


Terms of Site Index

Find the page/content you are looking for with our index.