Syndicate content


Display a line number in a table (i.e. subform of records)

I was ask by a customer to add line numbers to each entry in a table shown in an invoice.

The concept is pretty simple, but really, how do you do that properly in MS-Access?

Microsoft actually has a solution (see link below) and it comes down to writing a function that counts the number of items from that item's current position to the beginning of the table (i.e. going backward). It works, it is just really bad if you have very large invoices since it will tend to slow down as you start getting many items.

There is the function, we can see the counting in the do until near the end ...

[ODBC Driver Manager] Data source name not found and no default driver specified

As I was working on a MS-Windows installation, I ran in this weird error: Data source not found and no default driver specified...

This was output when I was running the following in a command line prompt:

osql -E

The result should have been an MSSQL prompt instead!

The problem on the computer was that I uninstalled MSSQL 2005 that was automatically installed by Visual Studio C++ and was not compatible with our application, so I first uninstalled that but that uninstallation is really not proper. It leaves a LOT of things behind.

After that I installed MSSQL 2014 which was reported as ...

Repair a Cassandra Cluster

I use the Cassandra database cluster system to manage a new set of websites and once in a while I start getting many errors and the website stops working altogether.

When that happens, it is likely that Cassandra broke something in the temporary tables that it holds. The only way to go past that problem is to clear those tables. Until then, it will fail over and over again (they really would need some euristic to auto-clean up even if it means that you're losing some data.)

The command to repair the database, really quick, is as follow:

nodetool scrub snap_websites files

Note that ...

Bad move for PHP unpack()! So unpack() stopped working?

Today I noticed many errors on one of my websites. Looking closer into it, I noticed that the code for the mo_references Drupal module stopped working.

It took me some time, especially because the code seemed to work just fine as all the files could easily be displayed.

Actually, that was not the case. The unpack() character 'a', which I used, was transformed from a simple string that gets trimmed, to all the characters, including the NULL characters. Ouch! Now we have to use the 'Z' character instead.

I use it to unpack() a tar file by loading 512 bytes of data in a ...

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

Getting Ubuntu to playback DVDs

In order to playback a DVD you need to make use of commercial encryptions (also called codecs.) Actually Ubuntu calls them "non-free". The reality is these are patented and protected so people cannot just ripoff a DVD. Which is not true at all since pretty much any computer can play DVDs and thus can copy all the data. Anyway, because Ubuntu is by default for free software, it doesn't include all the necessary DVD stuff. This being said, they provide 100% of all the necessary code, pre-compiled and all you have to do is install it all with apt-get as follow.

(You must be root to ...

WNetAddConnection2 function, how to


I just faught for a few hours trying to get the WNetAddConnection2() to work in my program and found out two things that I did not see explained anywhere in the documentation...

Folder that Works

I'm not too sure whether that's a new thing at the company I worked in to implement this function or whether that's every time, although I've seen other posts on the Internet with the same sort of path so I would imagine that this is a "normal" Microsoft network feature.

The fact is that to connect you have to use the name of the server followed by some ...

Using QDateTime to output a date string and UTC

As I'm working on a server I need dates in UTC. By default, the QDateTime object generates dates in local time.

How do you change that? There is a toUTC() but my input data is already UTC so using toUTC() would mess up the date and I'd get the same result anyway.

The idea is actually pretty simple. The toUTC() creates a QDateTime object in UTC mode. This is done like this:

QDateTime utc(QDateTime().toUTC());

Now the utc object is in UTC mode and can be used with your Unix dates as in:


and the string output can be generated with toString() as in:


Thunderbird: Trash/Junk Folder Is Full

Yesterday I got a surprise. My junk email stayed in my Inbox instead of going to my Junk folder... Why?

The automated function doesn't give you any error. It just doesn't do anything.

When I tried to mark a message as junk, that's when I got an error message saying...

Your Junk Folder is Full

Wow! I looked again... but I knew. It was still FULLY empty. Hmmm...

Looking around I found a post on some random website saying that the limit of a folder was 4Gb. Okay. But my folder is EMPTY. I look for any other Junk folder, just in case another one was filled up. Nope. All empty! (I ...

Quickly saving an image to disk without extra library

Often, when I work with some form of graphics, I do not have a handy library to save the image buffer I'm working with in a file on disk. In most cases, when I want to do that, I make use of the Targa format. This is very easy to save since the header is very simple (18 bytes) and the data can be saved verbatim. Plus, many tools, such as the Gimp, can read the result at once.

Here is my C code to do so. It will work in C++ also. It should be easy to tweak for other languages such as C#.

  unsigned char hdr[18]; // the targa file header
  FILE *f;

  memset(hdr, 0, sizeof(hdr));  ...
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.