Setting up an automated pdf comparison on a server - python-3.x

Documentation is generated for every new build. I want to automate the process of comparing the new pdf with the old one and outputting the differences onto a text or image file. I also have the option of comparing large HTML folders or chm files(which is complicated as they are compiled files). How should I go about doing this? (I am looking for freeware Python tools)
I have looked into pdf-diff, a Python tool that does exactly what I want. But since I am working on a windows machine with no visual studio, when I try to install it using pip, I get the error "Unable to find vcvarsall.bat".

Related

How to print 2 excel tabs to PDF using python on Linux (not Windows)

I am working on Linux (Strictly Centos Type Linux) and using python3
I have some Microsoft Excel (xlsx) files that I am pulling from an FTP server, and I need to generate a PDF from 2 tabs having print formatted areas.
(I am using the word Print, because I cannot copy data to dataframe and create PDF from it. That will not suffice, as these are reports that have formatting. Hence they need to be printed to PDF)
I am unable to create a PDF out of it, on Linux.
AFAIK, win32com will not work on Linux. Also, I need the script to be automated without manual intervention.
Any help or suggested articles are welcome!
Thanks,
K3
This is not possible on a Linux distro as a copy of Excel must be fully installed and accessible. Otherwise, you can use the Win32 api (Need to have Windows).
https://pypi.org/project/pywin32/

PowerShell Script working with Excel COM Object buffering on different Clients

I created a fairly big PowerShell Script working with the Exce COM Object to Output Data it read into some .ini files.
I converted the Script to .exe with the Win-PS2EXE Programm.
When I start the Script on my Fujitsu PC it creates and then populates the Files.
When my Collegue uses it on his Lenovo, the files get created (So it can't be a filepath problem) but there isn't any data that gets written into them.
My Fujitsu
Windows Version 10.0.017134 Build 17134 (Everything is the Same)
PowerShell Version 5.1.17134.858 (Everything is the Same)
All Excels fully closed
No Clicking around when it's taking a while
Script version 3.8
Microsoft 360 Account with newest Excel
Same Excel File Used
His Lenovo
Windows Version 10.0.017134 Build 17134 (Everything is the Same)
PowerShell Version 5.1.17134.858 (Everything is the Same)
All Excels fully closed
No Clicking around when it's taking a while
Script version 3.8
Microsoft 360 Account with newest Excel
Same Excel File Used
The Script itself works. It was tested and debugged over multiple Months and it always worked (on multiple, different systems) with no Errors.
Where could the problem be or what could I try to do?
So, I don't know why or how, but the Excel itself is broken after I transfer it to his PC. (All Permissions etc. are set so that the excel works and everything.)
I copied the Data in the Excel into a new Excel File, which I transferred the same way again (Network Folders). This time it worked.
All in all, the Excel File itself has some Corruption. I may look into it and if I find a Solution I'm going to post it here.
For now I know the Script has no Error and works on all other Systems, but if anyone knows what could've caused the problem, I'd be grateful to know!

How to convert HLP files into CHM files

I need some help, I have some .hlp files and I want to convert it to .chm files, as .hlp files don't run on Windows 10.
How can I do that?
I see two or more solutions depending on your requirements:
Converting WinHelp (HLP) to HTMLHelp (CHM) or PDF
Running WinHelp files on Windows10
Convert WinHelp (HLP) to HTMLHelp (CHM):
A tutorial on my site gives a step-by-step description how to convert WinHelp (HLP) to HTMLHelp (CHM) on a freeware/shareware and "low budget" level. The conversion project example from the download section includes a working structure and example files.
You can of course use a helpauthoring tool (HAT) like Help+Manual, HelpScribble or any other HAT to convert existing WinHelp projects to HTMLHelp.
Run WinHelp on Windows 10:
WinHlp32 for Windows 10 restores the ability to open and view .hlp files on Windows 10.
WinHlp32 for Windows 10 6.3.9600.16411 (MajorGeeks) OR
see further information and the man's way below.
The WinHelp (.hlp) format has been around since the very early 1990s and is superseded by HTML Help 1.x (.chm). Microsoft strongly advise you move away from WinHelp about ten years ago. But for a test application it's running on my Windows10 machine like a charm.
But some heavy steps to fix the bygone WinHelp Viewer. Please note I don't speak of the HTMLHelp Viewer for *.chm help files here.
Following the solution steps depends on your Windows 10 Version (32 bit or 64 bit). To find out your system type (32 bit or 64 bit), Hold the Windows+R. Type msinfo32 in the Run dialog box that appears and Press Enter.
You know, trying to open a help file (*.hlp) results on a Microsoft Support page.Error opening Help in Windows-based programs: "Feature not included" or "Help not supported".
You'll find a download link for Windows 8.1 but you have to install in a special way for Windows 10 (Windows8.1-KB917607-x64.msu).
Start your command prompt as Administrator (Please NOTE - samples for German here)!
Extract the downloaded .msu file to a temp directory
md msu-extracted
expand Windows8.1-KB917607-x64.msu /f:* .\msu-extracted
Extract the contained CAB-File with 279 files in it.
cd msu-extracted
md cab-extracted
expand Windows8.1-KB917607-x64.cab /f:* .\cab-extracted
Depending on your language settings locate the matching MUI-File e.g. use "cs-", “de-” or "en-". People using the x86 variant need to run “dir x86de-.”
cd cab-extracted
Navigate to the given path for your language "... de-de ..." e.g.:
cd amd64_microsoft-windows-winhstb.resources_31bf3856ad364e35_6.3.9600.20470_de-de_1ab8cd412c1028d0
Here we'll find “winhlp32.exe.mui”. Now we need to replace e.g.
%SystemRoot%\de-de\winhlp32.exe.mui with our new file:
takeown /f "%SystemRoot%\de-de\winhlp32.exe.mui"
icacls "%SystemRoot%\de-de\winhlp32.exe.mui" /grant "%UserName%":f
ren %SystemRoot%\de-de\winhlp32.exe.mui winhlp32.exe.mui.w10
copy winhlp32.exe.mui %SystemRoot%\de-de\winhlp32.exe.mui
takeown /f "%SystemRoot%\winhlp32.exe"
icacls "%SystemRoot%\winhlp32.exe" /grant "%UserName%":f
ren %SystemRoot%\winhlp32.exe winhlp32.exe.w10
cd ..
dir *.exe /s
Find the right path starting either with amd64 or x86 and navigate
to it:
cd "amd64_microsoft-windows-winhstb_31bf3856ad364e35_6.3.9600.20470_none_1a54d9f2f676f6c2"
copy winhlp32.exe %SystemRoot%\winhlp32.exe
Edit:
You don't need to replace _none_ in the last cd command step (all single steps tested 2017-09-01 and 2018-08-24 and working on Windows 10).
There is a reset of the workaround described above after a main Microsoft Windows update.
Edit: (copied form comments, thanks to #dxiv)
An alternative to the last couple of steps is to copy the winHlp32 files entirely elsewhere, like C:\etc[\de-de], then re-associate ftype hlpfile=C:\etc\winHlp32 %1 at an elevated command prompt. This avoids clashes with sfc and future windows updates, and HLPs would still work when opened by association (double-click in explorer, or start old.hlp at the cmd prompt).
You can convert HLP to HTML, using a Chrome extension:
<< CHM, HLP Viewer and Extractor >>
Proposed by : https://ehubsoft.herokuapp.com/chmviewer
Well people, after a long time searching, my conclusion was: .HLP files can't be executed by Windows 8 and 10, just in Windows 7 and lower. .CHM files can be executed by Windows 8 and windows 10. SO, I had to create my new .chm file in Help Development Studio on Windows 10 to be executed by it. My old files .HLP became obsolete. It took so much time to do this but I learned so much about this type of files.
Finally, thank you for your contribution to my question.
You are a hero sir! I ended up using HelpScribble and using its Decompiler linked here.
Quoting their website:
If you have an existing WinHelp file without the HPJ and RTF source files, you can download the WinHelp decompiler to recreate the HPJ and RTF sources from the HLP file. Extract the files inside helpdc21.zip into a new folder. Then you can easily decompile any .hlp file from the command prompt, by typing: helpdeco helpfile.hlp where helpfile.hlp is the help file you want to decompile. The decompiler will generate the HPJ and RTF files, along with a series of bitmap files if the help file contains images. Use Project|Import Help Project in HelpScribble to import the help file.
That will extract the source files for the hlp file.
Lastly, simply import the resulting hpj file in HelpScribble. From there you can simply export to a html file with the option Make Flat Manual.
Boom. Done.

Creating a Python Project using Atom

I m trying to create a python project in Atom IDE. I downloaded and installed Atom and also some package like project_manager.
I am finding it extremely hard to get going.
My project would have a few python files in the code folder. Some data files in the data folder, etc.
How do I start this in Python. I goggled this as well but still finding it difficult.
P.S. I know how to create python files and run them using IDLE. Want to do my work in a more structured manner by creating a project and then being able to compile and run my files fast and easily.
Regards
Bonson

How to set up LIBSVM Matlab interface?

I am having problem with implementing LibSVM to MATLAB.
I am using MATLAB R2009a (I also have the latest version, R2012b, but I dont use that one)
I downloaded LibSVM package, libsvm-3.14 to my Windows 7 PC, which MATLAB and OCTAVE interface come together.
I extracted the folder I downloaded. Which, below, you can see the printscreen of what the folder has in.
Where should I put my libsvm-3.14 extracted folder ? Should I put it under "bin" folder of my MATLAB installed in the directory?
C:\Program Files\MATLAB\R2009a\bin
I did that, however, it didn't work out. I will be grateful if you help me clearly. I just read README file, but it's not clear to understand and there is no other instructions online on the internet.
For the time being, it does not matter where you put that folder. You'll have to compile the Matlab-MEX files, from the source code that resides in the matlab subfolder of your extracted libsvm package.
Below, I will call the libsvm-3.14 (for example: C:\libsvm-3.14) extracted folder ROOT (so replace ROOT wilth C:\libsvm-3.14 below).
So, fire up Matlab and, then, at its command prompt, type:
cd ROOT
cd matlab
make
Now, in the ROOT/matlab folder, you should have obtained two MEX files (with the .mexw32 or .mexw64 extension). These are the files that you will use from now on. You can discard the rest, except those files (and, maybe, some other generated libraries).
According to the Makefile (that is ROOT/matlab/make.m), the MEX files are called svmtrain and svmpredic (+ the extension).
So, next step would be to create a subfolder called libsvm/ under your's Matlab/toolbox folder, copy the two MEX files therein and, then, add that libsvm/ folder to the Matlab Path (not the Path of your system, but of your Matlab installation).
Then, by typing:
svmtrain
and
svmpredict
you should have the help (usage) of these two functions.
With the aid of #axeoth, here is the solution. I followed instruction files in matlab subfolder of extracted libsvm package. I downloaded and installed Microsoft Visual Studio 2010 and wrote 'mex -setup' on command window of MATLAB to choose a suitable compiler for mex (I use MATLAB R2012b in 32-bit PC, so I found supported compilers in this link http://www.mathworks.com/support/compilers/R2012b/win64.html) After then, I followed #axeoth's instructions. I changed the name of the folder to ROOT and moved it to Documents/MATLAB. I started MATLAB and on command window, I wrote these below "one by one"
>> cd C:\Users\HUstat\Documents\MATLAB\ROOT\matlab
>> cd matlab
>> make
then I copied everything obtained in ROOT/matlab subfolder. I created a new folder named libsvm under MATLAB/toolbox folder and pasted everything there. and then, I added that libsvm/ folder to the Matlab Path by using "Set Path" button on MATLAB R2012b. After then I wrote "svmtrain" and "svmpredict" so I got the helps of these two commands.
For those having major compiler problems I thought I'd leave some extra information on the subject of installing compilers. This was a frustrating problem I had an ended up contacted MATLAB for help. I would have commented in the above posts but I do not have enough "rep" so here it is:
I was unable to install Microsoft Windows SDK 7.1, whether via Microsoft Visual Studio 2010 or otherwise. I found out that this was because I had a certain version of Microsoft Visual installed (version 10.0.04... was the cause of the problem for me). The work around was to uninstall Visual, install SDK 7.1 independently and then re-install Visual after. The process is written up in greater detail in the link below:
http://www.mathworks.com/matlabcentral/answers/95039-why-does-the-sdk-7-1-installation-fail-with-an-installation-failed-message-on-my-windows-system
It may also be that you have the compiler installed but that it wasn't recognised until MATLAB "found" it. This happened to me after the re-install. To check if you have the correct compiler and "find" it run mex.getCompilerConfigurations('Any','Installed') to get a full list. Then do mex -setup using the SDK 7.1 choosing the C/C++ version over FORTRAN.
I know the question is answered already but hopefully this may help someone the same predicament I had.

Resources