Parse Excel file using Go on OS X - excel

I'm trying to read Excel file with GoLang (even not .xlsx) and by using several libraries can't have success in it. The libraries just crashes on OpenFile stage with such error:
zip: not a valid zip file
Libraries which I tried to use:
https://github.com/tealeg/xlsx
https://github.com/tealeg/xlsx2csv/
There were some others too, but they were crashed during
go get Name-of-Lib because of some Dll problems.
Any ideas? Is it because I'm trying to do in under MacOS or by some other reason?

The libraries you are trying to use 1, 2 support only newest Microsoft Excel format which is actually a zip with xml documents. Therefore you get error: zip: not a valid zip file. Those can be used on your MacOS, but first you need to convert the old XLS files into XLSX files. You should be able to convert them with LibreOffice in headless mode like described other question, you can run a process from your code.
The other libraries are failing with "dll" errors because they must be linked against Windows Dynamic Link Libraries. As so, they are not usable on your MacOS.

Related

Boost thread library version mismatch

I've created a managed C++ log parser application using C++ vectors and Winforms. I want to add multithreading and Boost seemed like a better option than Winforms BackgroundWorker because I want to be able to execute my existing C++ function with each thread. I installed Boost multiple times following multiple different tutorials (lastly this one: https://levelup.gitconnected.com/the-definite-guide-on-compiling-and-linking-boost-c-libraries-for-visual-studio-projects-c79464d7282d) and I still have the same issue when I try to #include <boost/thread.hpp>
Error LNK1104 cannot open file 'libboost_thread-vc143-mt-x64-1_78.lib'
I don't know why it's looking for this library when I have Boost 1_79 installed not 1_78. My .lib file also has "mt-gd-x64" not just "mt-x64". I've already specified the correct file path to the library in Project->Properties->Linker->General->Additional Library Directories. I've also tried installing Boost via Visual Studio 2022 NuGet Package Manager. The lib file in that folder is also slightly off. "vc120" instead of "vc143". I've even tried changing the .lib file name to match the file name in the linker error exactly but when I do that I get more errors like LNK1104 cannot open file 'libboost_chrono-vc143-mt-x64-1_78.lib'
Do I just need to delete all my Boost files and download version 1_78 and try again? Why is Visual Studio looking for the wrong file name when it compiles? Is my #include statement wrong?
I ended up solving this problem by downloading boost 1_78, building it, and specifying that folder instead or the 1_79 folder. If anyone might know why the program was looking for 1_78 instead of 1_79 feel free to respond Also big thanks to George Gkasdrogkas who wrote the tutorial that worked best for me on how to install Boost. Tutorial is linked in the question :)

Sqlite on Python 3 with Spatialite and full support for spatial indices (i.e. rtree)

This is the scenario:
I am using Python 3 (3.6 through 3.8 on Windows 10, using Pipenv and vanilla Python) to create an SQLite file with Spatial support and several triggers based on Spatial Indices.
Creating the database and adding records works just fine after loading Spatialite
conn.enable_load_extension(True)
conn.load_extension("mod_spatialite")
However, adding spatial links with code such as below
SELECT CreateSpatialIndex( 'nodes' , 'geometry' );"""
returns the following error
updateTableTriggers: "no such module: rtree"
I tried compiling the rtree extension following some recommendation from
Compiling SQLite RTREE in MSVC?
and using VS 2016 (16.4.2).
But I get all sorts of errors when trying to load that in SQL (Might not be compiling it properly, but I tried multiple things and nothing worked). My best attempt was a successful compilation using pretty much the instructions I referred to above, but when I attempted
p.conn.load_extension("libSqliteRtree.dll")
I got
sqlite3.OperationalError: The specified procedure could not be found.
I am really at loss here, as there seems to be very little discussion on this topic everywhere I looked. A few questions that come to mind are:
Are the specific compilation instructions/tricks/compiler versions that I should be using?
Is it even possible to compile and load rtree in Python 3 using the standard sqlite3 library?
Is this particular to Windows?
Are there alternative SQLite Python packages that could do the job (I didn't find any on PyPI)?
It is critical, however, that the solution works across different platforms.
I was just having the exact same problem, with Python 3.8 x64. I believe the problem was that the sqlite3.dll file inside my Python's installation DLLs folder had been compiled without RTREE enabled (https://sqlite.org/rtree.html).
To resolve this I visited the SQLite website, downloaded the .zip with the latest sqlite3.dll for Windows x64 (hoping RTREE would be enabled on that version, because I tried compiling it on my own and it didn't work), and swapped the old DLL in the DLLs folder with the newly downloaded DLL from the website. The RTREE error was gone! Detailed steps below:
Access https://sqlite.org/download.html and choose the "Precompiled Binaries for Windows" of your system. Mine was x64 because I was running Python x64. Download the .zip and unzip it.
Find your Python's installation folder (the folder which contains the python.exe you're running), and open the DLLs folder. You'll see there is a file there called sqlite3.dll. That's the one that comes with the Python installation.
Copy the sqlite3.dll from the unzipped folder in step 1 and paste into the DLLs folder, click Yes to substitute the file in the DLLs folder for the new one. That should solve the problem.

How to read excel into Julia?

I need to read an excel file into Julia. I tried the package "ExcelReaders". However, the package requires additionally the Python or the xlrd package. Although it uses the conda.jl package to install these dependencies automatically, I keep on running into different installation problems. Is there a simple way to read excel into Julia? Has anyone tried the Taro.jl package?
There is only one pure-Julia v1.0-compatible Excel reader available:
XLSX.jl
It has no dependencies on Python or Java. Install it from the package manager by typing ]add XLSX in the console, then load it with using XLSX. Here is the tutorial document.
The Taro.jl package works well to read excel into Julia. You can install the package with Pkg.add(Taro). Once the package is installed, you can load it with using Taro; Taro.init(). You can use Taro.readxl() to read excel files. The following post provides a somewhat nice tutorial on how to read excel files in Julia using Taro.jl:
https://economictheoryblog.com/2018/01/03/how-to-read-an-excel-file-in-julia-language-an-example/
Taro works pretty well (even if I say so myself). You need java installed on the machine, but after that, Pkg.add(Taro) will install all the dependencies for you. And, I think you'll have better luck with Taro with more complex excel files.
If you are fine with saving in the ods format, you could also use the OdsIO.jl package.
It uses a python module (ezodf) as well, but it should install it automatically in both Windows and Linux when you install OdsIO.jl.
If you can save as a .csv then CSV.jl works well.
The ExcelReaders package is also available
https://github.com/davidanthoff/ExcelReaders.jl

Error with accessing one fuction in pywin32 or win32com from python 3.3.5

I've generated a win32com wrapper for a DLL and I'm trying to access it. It works except for one function called ReadPipeBytes. It works on two of my other machines but I'm using a different python version. This is the error:'' object has no attribute 'ReadPipeBytes'. I copied over the same dll to the other machine (its a driver, I have the same hardware I'm trying to access.) I did a compare on the wrapper files and they are almost identical except for the python versions they were generated with and the 3.3.5 generated version doesn't put u'FunctionName' where the 2.7 version does. If I copy over the wrapper file to the machine that doesn't work I get the same error (and/or the dict file).
1) Why would the version of python make a difference in reading this one particular function when the other function work fine (its not the wrapper?
2) How can python fail to use the function called readpipebytes when the other functions work and when I'm using the same files that I do on my other machines?
When you use com the language you are accessing it from needs the same "bittedness" as the com .dll or control. So If you have a 32-bit control or com dll you have to have a 32 bit win32com.

C++ Creating a standalone library in linux and using it in another program

I'm trying to create a shared library for Linux such that:
other programs can use its functions and its objects
the code is not visible to final user
What i did is create a shared library with Eclipse. This library uses pthreads.
I generated .so and .lib. The .lib is in LIBRARY/Lib while the .so is in LIBRARY/Release.
Then i created another project which should use this library and i gave the path of the .lib file and the path of the .h file which only contains the inclusions of all the necessary .h of the library.
All seems working but when i run the program it crashes. When debugging it I receive the following message:
Can't find a source file at "pthread_mutex_lock.c"
Locate the file or edit the source lookup path to include its location.
What's wrong? Can someone help me please?
EDIT: I changed nothing and now I have a different error, some lines before the previous:
Can't find a source file at "random.c"
Locate the file or edit the source lookup path to include its location.
other programs can use its functions and its objects
the code is not visible to final user
These two goals directly contradict each other, and achieving both at the same time is impossible on Linux.
If some program can use your library, then I can write a new program that can do so as well.

Resources