I am trying to serve a PNG file as an attachment. This is working fine on my CentOS 8 development machine, but when I deploy it to a RedHat 7 machine the file has extra bytes in the downloaded file. For example, viewing the PNG file in an emacs buffer, the original file shows:
\211PNG^M
but the downloaded file shows
\302\211PNG^M
and there are \302 entries throughout the downloaded file.
Again, this corruption occurs only on the RedHat 7 machines.
I check the file byte count on the server process and it has the correct value. It appears these \302 entries are being added by the server.
The server process is a Perl script, and I'm using a regular print statement to output the image file contents.
The UTF-8 encoding of Code Point 0211 (0x89) is 0302 0211 (0xC2 89). You are encoding the image using UTF-8 for some reason. Don't :)
Related
Using the excellent https://github.com/laurent22/rsync-time-backup I backup a Mac to a drive in Windows. To achieve this, I FUSE mount the Windows drive to the Mac
I see rsync-time-backup
correctly finds the previous backup folder (backup/day-x) so that it can hard link when it creates a new backup folder (backup/day-y)
correctly transfers only the changed files (Total file size: 4.1G bytes vs Total transferred file size: 100M bytes)
But here are the odd things I found:
when I run WinDirStat to find the total size of the entire backup directory "backup/", I expected 4.1G
4G (for day-x) and
100M (for day-y).
Instead, I found 8.1G
4G (for day-x) and
4.1G (for day-y).
when I run ls -lHi, on the Mac Terminal, I don't see the link count greater than 1
So, why is it that even though only a fraction of the files are transferred, the size of the Windows drive is huge?
I have installed on my RedHat machine:
(py36_maw) [rvp#lib-archcoll box]$ tesseract -v
tesseract 4.1.0
leptonica-1.78.0
libjpeg 6b (libjpeg-turbo 1.2.90) : libpng 1.5.13 : libtiff 4.0.3 : zlib 1.2.7 : libopenjp2 2.3.1
Found SSE
I try to run, per what docs I can find, to produce pdf output:
(py36_maw) [rvp#lib-archcoll box]$ time tesseract test.jp2 out -l eng PDF
read_params_file: Can't open PDF
Tesseract Open Source OCR Engine v4.1.0 with Leptonica
Warning: Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 275
That takes 10 seconds and produces file out.txt with fine OCR to text conversion evident.
However, it tries to read a file called PDF, but I cannot figure how to get PDF output.
I have read various docs, the most promising seeming to be advising to edit the config file, but the only docs I can guess are relevant, by googling 'tesseract 4.1 config', list many 'config' variable names, for older versions of tesseract, but none of which seems to indicate I can specify producing pdf output, much less specifically for tesseract 4.1.
How can I invoke tesseract 4.1 (using libopenjp2 2.3.1) via CLI to produce pdf output from my jp2 input file? Bonus question: how can I get it to produce both txt and pdf output in one run?
Robert
After more surfing and digging, assuming the reader also has done some and knows what TESSDATA_PREFIX is used for by tesseract, here are the steps that worked for me:
Download the pdf.ttf file from: https://github.com/tesseract-ocr/tesseract/blob/master/tessdata/pdf.ttf
Copy pdf.ttf to your directory $TESSDATA_PREFIX and make sure that variable is exported to your shell.
TIP: Use command: tesseract --print-parameters # to discover defined variable names you can use in your own config file
Go to your dir with the test.jp2 file and create file config with these lines.
tessedit_create_pdf 1 Write .pdf output file
tessedit_create txt 1 Write .txt output file
(Note: or you may be able to put the config file in the TESSDATA_PREFIX directory as well and let it always be the default. Not tested.)
Run in that dir:
$ tesseract test.jp2 outputbase -l eng config
Verify your success: it runs and produces files outputbase.txt and outputbase.pdf. The txt file looks good and the searchable pdf looks and works OK in a pdf viewer, that is, you can search and find text strings.
Hope this helps someone else!
The Bitvise SSH Client version history states that v8.15 supports directory mirroring:
The graphical SSH Client and sftpc now support recursive directory mirroring. A directory and all of its subdirectories and files can be synchronized either in the upload or download direction.
I can find it in the GUI, but I can't find how to do using sftpc.exe. There is no mention of mirroring in sftpc.exe -help.
How can I do directory mirroring from the command line?
You point out a tangential design issue in sftpc: getting help for SFTP commands requires you to use sftpc interactively and connect to the server. You can then get help from the interactive prompt.
This is inconvenient, so I opened a feature request for us to make the interactive help available from the command line, as well.
The help text you are looking for is as follows - for the put command:
sftp> help put
USAGE: put local-path [remote-path] [-bg | -fg] [-s] [-o] [-r]
[-f] [-noTime] [-m=mode] [-dm=mode] [-mirror [-erase]]
[-b | -lf | -std | -tlf | -t]
DESCRIPTION: Upload file.
PARAMETERS:
-bg Start (queue) upload in background.
-fg Start upload in foreground.
-s Include subdirectories (recursive).
-r Synchronize file content. If synchronization is not available,
resume existing incomplete files using a heuristic resume.
Heuristic resume MAY result in an inconsistent destination file
if the destination file content has been modified in the middle.
-o Synchronize file content. If synchronization is not available,
force existing file to be overwritten. If -r is also specified,
heuristic resume is tried first.
-del Remove local file after successful upload.
-f Assume remote-path is a file (not a directory)
-noTime Do not synchronize file modification times.
-m=mode Set the access mode for remote files to 'mode'.
-dm=mode Set the access mode for new remote directories to 'mode'.
If directory already exists, access mode will not be changed.
-mirror Mirror local-path to remote-path. Local files that do not exist
remotely will be uploaded. Remote files that are different than
their local versions will be overwritten.
-erase With -mirror, erase remote files that are not present locally.
FILE TRANSFER MODE - if present, overrides mode selected with "type":
-b Upload files as binary; no conversions.
-lf Auto-detect text files. In text files, replace CRLF with LF.
Binary files are unaffected.
-std Auto-detect text files. Upload text files using the SFTP v4+ text
file transfer mechanism. Binary files are unaffected. Not
available when SFTP version 3 or lower is in use.
-tlf Upload all files as textual. Replace all CRLF bytes with LF.
-t Upload all files using the SFTP v4+ text file transfer mechanism.
Not available when SFTP version 3 or lower is in use.
And for the get command:
sftp> help get
USAGE: get remote-path [local-path] [-bg | -fg] [-s] [-o] [-r]
[-f] [-noTime] [-lit] [-mirror [-erase]]
[-b | -lf | -std | -tlf | -t]
DESCRIPTION: Download file.
PARAMETERS:
-bg Start (queue) download in background.
-fg Start download in foreground.
-s Include subdirectories (recursive).
-r Synchronize file content. If synchronization is not available,
resume existing incomplete files using a heuristic resume.
Heuristic resume MAY result in an inconsistent destination file
if the destination file content has been modified in the middle.
-o Synchronize file content. If synchronization is not available,
force existing file to be overwritten. If -r is also specified,
heuristic resume is tried first.
-del Remove remote file after successful download.
-f Assume remote-path is a file (not a directory).
-noTime Do not synchronize file modification times.
-lit Treat remote-path literally (not a wildcard pattern).
-mirror Mirror remote-path to local-path. Remote files that do not exist
locally will be downloaded. Local files that are different than
their remote versions will be overwritten.
-erase With -mirror, erase local files that are not present remotely.
FILE TRANSFER MODE - if present, overrides mode selected with "type":
-b Download files as binary; no conversions.
-lf Auto-detect text files. In text files, replace LF with CRLF.
Binary files are unaffected.
-std Behaves same as -lf when downloading. Not available when SFTP
version 3 or lower is in use.
-tlf Download all files as textual. Replace all LF bytes with CRLF.
-t Download all files using the SFTP v4 text file transfer mechanism.
Not available when SFTP version 3 or lower is in use.
I hope this helps!
I don't normally monitor Stack Overflow, so please feel free to call my attention by opening a support case with Bitvise if you need me to look at something else.
I recommend also using the latest Bitvise SSH Client version. Currently, this is 8.35. It's free of charge for use in any environment, and we try to ensure that each version is a strict upgrade that does not introduce new difficulties. We want there to be no reason to stay behind. :-)
I am trying to analyse my raw GNSS data on the GNSS Analyser app from here https://github.com/google/gps-measurement-tools. The installation guide includes the following step:
4.2 gunzip installation
The automatic ftp code inside GnssAnalysis will download ephemeris zip files, and attempt to
unzip them using gunzip.
Download gzip.exe from here http://ftp.gnu.org/gnu/gzip/gzip-1.9.zip
Extract the files from the zip file, rename gzip.exe to gunzip.exe
Move gunzip.exe to somewhere in your Windows path (type path in the Windows
Command Prompt to see what your path is, typically you will find a directory
C:\Windows\system32 and you can put gunzip.exe there.)
However, upon downloading gunzip, I cant find a gzip.exe file, and hence tried renaming the gzip.c and gzip.h file instead. It did not work and I got this error when attempting to process my own raw data.
I have just tried and got success to import DB from a backup file:
gzip -d < C:\Users\my-user\Downloads\my-db-backup.sql.gz | mysql -u root -p MY_DB_NAME
I am running windows 2003 server. I had no problems doing a dw_1.saveas for a pdf until about 2 weeks ago when the hosting company decided to do a software update on the server. Now when I do a save as the file size is 0 kb. Any ideas?
I was also getting 0 byte files, running PB Classic 12.5.1 build 4541 on Windows 7 Enterprise SP1 64 bit. Based on the comments of both previous answers, I installed 32 bit Ghostscript 9.1 to default location, verified that the registry entry was not there, then installed 64 bit Ghostscript 9.1 to default location, saw the registry values were there, then modified the registry to point to the 32 bit installation directory as follows:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\GPL Ghostscript]
[HKEY_LOCAL_MACHINE\SOFTWARE\GPL Ghostscript\9.10]
"GS_DLL"="C:\\Program Files (x86)\\gs\\gs9.10\\bin\\gsdll32.dll"
"GS_LIB"="C:\\Program Files (x86)\\gs\\gs9.10\\bin;C:\\Program Files (x86)\\gs\\gs9.10\\lib;C:\\Program Files (x86)\\gs\\gs9.10\\fonts"
Save As PDF using Distill is now working.
Edit 2: Another cause I've seen is mis-matched PowerBuilder DLLs and PBDs. Make sure that the runtime DLLs and PBDs on the server are the same as the ones on the machine where the app was built.
Edit: I re-read your question. A zero byte PDF usually indicates that PowerBuilder couldn't find GhostScript. Check the registry as described below, and check the folder GhostScript is installed in. Re-running the GhostScript installer should fix it. I'll leave the rest of the troubleshooting info in case anyone else needs it.
If you're using Distill, the problem could be that the server configuration was changed to require signed drivers. If so, you'll have to install the "Sybase DataWindow PS" printer with a signed driver. I find the 'HP 8150 Series PS' driver works pretty well. I wrote up directions in Saving a datawindow as PDF in PB 10.5.
You might get a useful error message if you try to print to Sybase DataWindow PS from Notepad. Another possibility is that the Registry entries that PowerBuilder uses to find GhostScript got clobbered. We had that on a couple of workstations. Here's what I have for Ghostscript 8.60 (The GhostScript installer creates these entries):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\GPL Ghostscript]
[HKEY_LOCAL_MACHINE\SOFTWARE\GPL Ghostscript\8.60]
"GS_DLL"="C:\\Program Files\\gs\\gs8.60\\bin\\gsdll32.dll"
"GS_LIB"="C:\\Program Files\\gs\\gs8.60\\lib;C:\\Program Files\\gs\\fonts;C:\\Program Files\\gs\\gs8.60\\Resource"
I used Process Explorer to troubleshoot problems with PowerBuilder's Save as PDF functionality.
I had the same problem (PDF with 0 KB size) when I use Windows 2003 Server 64 bits and I resolve my problem like shown here :
=> At first, when I install Ghostscript 32 bits version, I see no entries in the Registry.
=> When I install a Ghostscript 64 bits version, there is no problem in the Registry, entries are created, but the system doesn't work (PDF is generated with 0 KB size)
=> I create a new directory with Ghosscript 32 bits version and I change the Registy entries
=> And then I uninstall the 64 bits version.
=> AND NOW, EVERYTHING IS OK !
Used Ghostscipt versions : gs904 for the 32 bits version and gs910 for the 64 bits one.