A site devoted to discussing techniques that promote quality and ethical practices in software development.

Monday, February 13, 2012

Faulty LibreOffice Base MS Access Connectivity

Further to my last message reporting the bug in connecting LibreOffice Base (ver 3.4.5) in Windows to MS Access database, below are screen shot showing the bug.

For demonstrating this bug, I have created an very simple MS Access 2003 database as with a table called ListOfNumbers containing 20 records (numbers from 100 to 119) as shown here:


Having got the MS Access database, I then create a LibreOffice Base using MS Access connectivity as shown here:

 
Opening the ListOfNumbers in LibreOffice shows the missing first record showing only from 101 to 119, reporting only 19 records - one short! Notice the record that is missing.

The record is actually retrieved in the recordset, only not displayed. If you sort the record set in descending order, you will now see the missing last record (value 119) and the first record (value 100) is now displayed, as shown here:

That's the missing record is always the first record. This causes me to suspect that LibreOffice code fails to reconcile the differences in the bases of two different array convention; the Ole Automation Collection starts with 1 while the other more conventional one starts with zero.

Just to prove the MS Access is not faulty, I have created a different LibreOffice Base database but this time using ODBC connectivity with the MS Access ODBC driver and the result shown below reports no missing record.

 
Hence the only conclusion one can draw is a fault MS Access connectivity support from LibreOffice Base.

Thursday, January 19, 2012

Caveat in using LibreOffice Base to access MS Access Database

Microsoft's MS Office (Office XP) hostility to being deployed in a virtual machine has once again driven me to desert MS Office to use LibreOffice. It is not that it cannot be deployed in a VM but when one relocates the VM from one machine to another, MS Office's activation scheme rears its ugly head. Rather than re-activating, which only solves the problem temporarily, I have decided to ditch MS Office.

In so doing I have discovered a rather disturbing bug when trying to access MS Access (ver 2002) database from LibreOffice Base (ver 3.4.5).

In LibreOffice Base (Windows version 3.4.5), you can connect to MS Access directly using LibreOffice's driver or you can connect to MS Access via the MS Access ODBC driver.

The former connection technique seems to have some bug in handling the MS Access database and the latter technique using ODBC driver should be recommended, at least for this version. While the direct connection technique can open the database and access the tables and queries (they are all I have so far tested) producing seemly the right results. But on closer examination, it reveals some disturbing results.

The direct connection technique always reports one record less than what is the actual total number of records in MS Access. LibreOffice Access connector always does not show the first record of the result set. The missing record is always in the record set from the execution of the query. For example if the first column is your sequence number from 1 to whatever in increasing number.

If you sort that column in ascending order, record corresponding to sequence id 1 is not shown and the total number of records reported on the bottom of the view shows one less than what it should be. The record with the highest sequence number is the last record.

If you sort that column in descending order, the record with the highest number of sequence number is missing as it should now be the first record in the grid but now you will see the record corresponding to sequence number 1 as the last record. The total number of records is the same - one less than the actual number.

It does not matter whether you are querying a table directly or executing an Access Query, it always drops the first record of the result set in the grid. It seems the connector has an out-by-one bug or perhaps there are two index bases internally - one base zero and the other base 1 - and the program or driver fails to provide the correct mapping.

Now if you reconnect from Base to the very same database using ODBC connectivity by defining a ODBC Database source using MS Access ODBC driver. The above mentioned idiosyncrasy does not appear.

In conclusion: Do not use LibreOffice Base's MS Access connection driver; use ODBC connection technique to avoid missing record.

Thursday, November 10, 2011

Apple's way to fix iOS security vulnerability

Keep quiet and Shoot the messenger and this is a classic Security by Obscurity.

Charlie Miller recently found a security vulnerability in iOS and shows it on YouTube. This has embarrassed Apple.

I am wondering how many 'silent messengers' out there going about merrily exploiting holes without telling Apple. After this episode why would researcher bother to tell Apple, the ungrateful lot.

Sunday, October 16, 2011

Win 7 slow file copying to network drive - is it Win7 problem?

I was backing up files using RoboCopy from my Win7 (64-bit) home machine to a network drive mounted on an XP Prof machine and noticed it was awfully slow. A check of the Network Utilization in the Task Manager's Network tab revealed that it was clocking only 2-4% and no one was using the network except me.

When I was reading this thread seeking any solution to my problem, I never believed it was the fault of Win7. Why? When I was doing a similar operation using a Cat5e cable with my laptop, the network utilization was in excess of 98% constantly. Hence I knew it was not Win7, as blamed by the above thread nor my network.

I knew it must be hardware associated with this machine that exhibited the slowness. Thankfully experience told me not to follow the instructions posted on the Internet blindly or else I could end up in a worse shape than I began with.

It turned out the solution was simpler than many would have guessed and it was highly unusual but the signs were always there.

It was a faulty Cat5e that was used to connected this machine to the router. The cable did not exactly not broken. Only the transmit line must be hanging by the thread resulting in slow copy to the server but acceptable performance in copying from the server. What pointed me to this simple solution was the fact that I was using a totally different cable when connecting the laptop to the network.

Wednesday, September 14, 2011

Shame on Telstra Text Buddy for failing LUA Test

You think the largest telecommunication company in Australia will develop and release software that works in LUA. Sadly not.

Telstra has a bonus credit feature that allows their mobile pre-paid broadband user credit that they can use to send SMS messages. One of the two ways you can send SMS from the comfort of your computer is to use a Telstra developed program called Text Buddy (version 1.0), which looks like this:
Despite the fact that this program is only compatible with Windows XP, it demands administrator privilege to run. Bad!!!

I bet you any dollar that their developers do not use LUA development and they developed this program in Administrator account.

Thursday, August 25, 2011

Would I recommend NOOK for reading non-fiction materials?

I am grateful for receiving a color NOOK for Christmas and to avoid writing a review of a device with superficial experience, like many reviewers, I have decided to hold off writing a review of this device until I have adequate usage of it. Now more than 6 months of usage reading many technical eBooks I believe I have enough experience to write a review.

This review is from the usage and perspective of a reader of technical materials. Reading technical materials is very different from reading a novel and hence it is important if you are thinking of getting one of these devices, either NOOK or other similar device, make sure you have a good idea of what kind of materials you will be reading. Try it out with a DRM-free technical book.

If you are planning to use it to read technical materials, I will definitely not recommend you to buy a NOOK (color or not) for the reasons I list below. As a previous owner and long time user of a Fujitsu Tablet, I am no strange to this kind of keyboard-less device.

With no apology to Barnes & Nobles, I have not bought one single B&N DRM controlled eBooks for obvious reasons and probably never will. I bought all my DRM-free watermarked eBooks from InformIT, which is a great site for technical eBooks because you can get both ePub and PDF format for the one price; I can put the ePub version in my NOOK and the PDF version in my notebook. That's the wonderful benefit of using DRM-free books. This allows me to test the NOOK and to find which format is the best.

Here are the reasons why I believe a NOOK is a unsuitable reader to handle technical materials:
1) The extremely primitive and incapable user-interface is one of the root cause of problems elaborated below. It makes a mockery of having large storage capability allowing one to carry many books with you when the interface is so primitive that you cannot open several books at the same time, like you would with a physical books on your desk, and returning to the page you left off. This is a severe and fundamental oversight in the design.

In reading a novel, you will not never be reading several at the same time darting from one to another. Hence the ultra primitive user-interface is adequate for that purpose but is totally inadequate for anything else. It is a joy to use my PDF XChange-Viewer to read the PDF format of those eBook on my notebook.  

2) Even overlooking the problem mentioned in 1) above and reading just one book (ePub format) is also very frustrating. There is few technical book not containing notes (endnotes, footnotes, or bibliography) and all have provided hyperlinks to them. While it is so convenient to press the hyperlink to jump to the destination, you only have a few seconds of window of opportunity to jump back to where you came from. This is because the back button on the top middle of the screen disappears after several seconds. The time it is allowed to stay around is not even configurable but there is a setting to enable animate page turning.

Surely the developer of this device is not serious and placing animation ahead of functionality. Once that back button disappears, you have no way of bring it back. Returning to where you came from is a major hurdle. I often keeps a piece of scrap paper with my NOOK for jolting the page number.

3) Following on from 2), one wonders why someone would prefer to provide a slider bar to go to the required page when an edit box will be more functional particularly these touch device is so imprecise to allow one to move one page either way. Unless you remember the page number when you press that hyperlink, you will have a hard time finding your way back. As a result, it is a very frustrating device to use. I do not have such issue when reading the PDF on my PC as I can jump to a particular page by entering it into the text box.

It is definitely a sad case of cuteness trumping over functionality.

4) Its ePub reader cannot magnify diagrams at will and this is not only annoying but downright dysfunctional when reading technical materials full of diagrams and charts. Its PDF viewer can magnify but its ePub reader cannot.

5) Because it cannot retain your place in several books, it is very frustrating when using the NOOK as a device to replace physical books. You can do this comfortably on a notebook but not on NOOK.

I definitely will not recommend anyone to buy a NOOK to read technical materials.

Wednesday, August 24, 2011

Good way to study the effect of sgen.exe for XmlSerialization

SGen,exe is a tool from Microsoft to pre-generate a .Net assembly that writes the object to be serialized. There is no shortage of blog posts telling you how to use this, like this one and hence not repeated here.

We developer is often a doubting lot and wanting to know what magical power this sgen.exe has that claims to make some difference in performance or does it? Apart from pre-generating, much like NGen, an serialization assembly to avoid generating it on the fly, one wants to know what is in it and how it works.

The best way answer these questions and to study the output of SGen to convince yourself what it does and that it is indeed loaded is to include the following switches when generating:
  • /debug  - this produces the PDB file
  • /keep    - this keeps all the temporary files that were used in the process of producing the DLL. It is extremely useful because they (the .cs file) allows you to put break points in the generated code. It is also extremely educational to study them.
  • /force   - to force the generation. But would be better if you include /o to generate the files to a different directory and then you can delete all files in that directory before running sgen. In this way you are not accumulating the temporary files creating a very confusing situation.
Don't forget to put the *.XmlSerializers.dll and *.XmlSerializers.pdb into the run directory, otherwise it will not be found.

SGen basically generates derived classes of XmlSerializationWriter and XmlSerializationReader containing code to write your class members out to or read from the xml data stream. It uses an XmlWriter to write to and XmlReader to read from a XML document. If you study these classes, they share some similar methods.

Generating an Xml Document from class or regenerating it from document can be done in many ways. In fact, if study the generated files you will discover that there is really no magic when calling XmlSerializer.Serialize() and XmlSerializer.Deserialize(). Whether you called XmlWriter or XmlReader to handle your class's member yourself or by some generated code, the process is the same.

If these overheads of dynamic code generation and building or using SGen.exe too troublesome or does not meet your needs, you can cook your own with using various techniques and classes available in .Net


Blog Archive