What to do if a LibreOffice file is extremely slow

A colleague has a problem with a LibreOffice Calc file: it was extremely slow to open. It took just 10 minutes to open and then the computer is paralyzed. I tried to convert it to Excel, but even opening it with Microsoft Excel was extremely slow.

I tried to use the power of the cloud, putting it on Google Drive and then opening it with Google Sheets. Nothing to do, it freezes the browser!

I then saved the ODS (OpenDocument Sheets) file as FODS. The OpenOffice/Libreoffice files in fact, are zipped XML files.

A FODS file is simply the same ODS file, only not being compressed, you can open it with a text editor to understand what’s going on.

From here you can already see that something is not right. Compressed occupies 0.16 MB, not compressed 7 MB? Compression is not magic, to become so small, it means that the file contains lots of repetition.

In fact, here’s the problem. For some reason, there are hundreds of thousands of tiny, invisible text boxes in the file!

Unfortunately, however, it is not a contiguous block. There are hundreds of blocks scattered among “good” content to keep, select and remove them by hand is an operation that takes days!

Here comes xmlstarlet.

You download the Windows (or Linux) version and study the syntax with

xmlstarlet el yourfile.fods

and a very long list with the file structure will appear. As we saw in the text file, we have to get rid of this structure:

office:document/office:body/office:spreadsheet/table:table/draw:custom-shape

and we do it with:

xmlstarlet ed -d "office:document/office:body/office:spreadsheet/table:table-row/table:table-cell/draw:custom-shape" yourfile.fods > fixed.fods

Done! Now the file opens in very few seconds, again! You can save it again as ODS.

How much to fix a dent on a Tesla?

In an article on CleanTechnica, the author tells the story of the arrival of his new Tesla Model 3. Excited, unfortunately, he bumps into a pole during parking, making this dent:

https://cleantechnica.com/files/2018/05/IMG_3075-closeup.jpg

That’s too bad. It happens… How much will it take to fix it? 100 euros? 300 euros?

Well… despite the spare part costing 250 dollars, for the replace it you need to disassemble the entire front of the car, even the back of the car to disconnect the battery (for safety), then you need to recalibrate the proximity sensors for autonomous driving. For a total of THIRTY hours of work.

Then the piece must be repainted, but the metallic paint used is special and requires 3 coats, for other THIRTEEN hours of work.

With all this time needed for the repair so it was made a quote of $250 for spare parts and $6500 for labor.

Ouch! He was lucky because he had a total cover insurance, so he didn’t need to shell out all that money.