Render PDF Error in Quarto - dvipdfmx:fatal: Unable to open - latex

I am using Quarto and trying to create a PDF. When I render the PDF for the first time everything is fine. However, when I made a change and tried to render the PDF a second time I got the following error:
restricted \write18 enabled.
entering extended mode
dvipdfmx:fatal: Unable to open "AWS_Architecture.pdf".
No output PDF file written.
compilation failed- error
I have found that if I rename the .qmd file that fixes it, but that is not ideal (e.g. AWS_Architecture.qmd --> AWS_Architecture2.qmd). Even when I delete all of the files in the folder and start over using the same original name "AWS_Architecture.qmd", I still get the error and the PDF does not create.
Looking into the logs I found this.
LaTeX Warning: Label(s) may have changed. Rerun to get
cross-references right.
Error 1 (driver return code) generating output; file
AWS_Architecture.pdf may not be valid.
Below is the basic code for reference, nothing special.
---
title: "AWS Architecture"
format: pdf
---
## AWS Architecture
![](images/AWSArchitecture.png)

I believe that the error was arising because I was working out of Google Drive for desktop folder. This error does not occur when the working directory is set to a local folder on the PC.

Related

WebView.LoadHtml file access error Android 30 Xamarin

I have a Hybrid app I rebuilt after setting the Target Android version to API 30, per a new warning that Google now requires this, and am trying it on a Tablet with Android 11. Originally following an old hybrid sample app, my app copies files from the resources to the file system. This seems to work, as no exceptions are thrown from the File operations. The first thing it does is display a splash screen from an HTML file copied from the afore-mentioned resource copy, using the LoadHtml function of a created WebView, and giving it a URL formatted like this:
file:///data/data/com.mycompanyname.myappnameandroid/files/Content/Splash.html
LoadHtml doesn't throw an exception, but then the screen displays an error message referencing this path and the error "ERR_ACCESS_DENIED". This file does reference CSS files copied to the same directory (referenced like "<link rel="stylesheet" href="site.css" />
" in the HTML header). It will continue on to display the main app pages, but it apparently failed to load CSS files and so forth, as all the styling and scripting is missing. What do I need to change to make this work?
Searching, I find talk of "Scoped Storage", but I can't make any sense of it. I'm hoping there is a simple fix.
There is a simple fix. Add the following to your set up of the WebView:
webView.Settings.AllowFileAccess = true;
Apparently the default changed from true to false.
Thanks to this posting for the clue: Load file into webView with scoped storage

Errno::EACCES upon deleting a file (on Windows 10)

There are a number of similar questions, but none of the answers worked for me.
I'm running Rails 6.0.3.2, Ruby 2.6.6, and SQLite3 on Windows 10 version 2004 (19041.388). I followed the Getting Started guide on the official Rails site to install Ruby on Rails and and everything should be up to date.
I can delete the files normally, and I'm logged in with an administrator account — not that it should be necessary.
I'm new to Ruby and Rails, so detailed answers would be appreciated.
Code
Here's what causes the error:
def destroy
book = Book.find(params[:id])
begin
File.open(book.cover_url, 'w') do |f|
File.delete(f)
end
rescue Errno::ENOENT
end
book.destroy
redirect_to books_path
end
What this does it first delete the cover image for a book and then delete the book itself from the database.
Errors
The error screen:
If the picture doesn't load, here are the error messages:
Errno::EACCES in BooksController#destroy
Permission denied # apply2files - D:/Projects/Web/RoR/ecommerce/app/assets/images/covers/circles_scaling_anim_positioning.png
File.delete(f) is the culprit.
Attempted Solutions
The only actionable answer I could find for Windows was this,
which advocated adding a 'lib' gem, but it did not work at all.
I also tried changing file mode from 'w' to 'wb+', but that didn't
work either.
EDIT 2: As per Dave Newton's suggestion in the comments (if that's what he meant), I moved the image storage directory outside the 'app' folder; to 'public/uploads/covers'. It hasn't worked either.
EDIT 3: I copied the delete code to a new script in another directory entirely and tried it on a sample file. I got the same error. In other words, the problem is not with Rails but Ruby (or my OS).
I called rm on the file from the terminal and that worked just fine, so I don't know if it's a file permissions problem.
EDIT: I checked the file in question and though it still remains, it's 0 bytes large now, so I presume it was overwritten by empty data. However, the rest of the code that should've execuded on destroy — i.e. the destruction of the object in the databse — seems not to have run, because the object is still in there.
The file handling enforced by the operating system is different on Windows compared to most UNIXy operating systems (such as macOS, Linux, or the various BSDs).
On the UNIXy operating systems, the file entry in the filesystem is just a pointer to the "real" file stored on disk. There are other possible pointers, such as a file handle when the file is opened by a process, or a hardlink (i.e. a different filesystem entry pointing to the the exact same file). The file exists on disk as long as there is at least one valid pointer to that file.
As such, on UNIXy systems, you can delete (or rename / move) a file from the filesystem while it is opened from a process. The file itself will only actually be deleted once the last filehandle is closed.
Windows however is more strict in this regard by default. It will not allow to delete a file as long as there is any process which has a file handle on the file (i.e. if any process has opened the file). This explains why you can't delete the file while you have a filehandle on it
With that being said, since Ruby 2.3.0 there is a flag you can set when opening the file which instructs Windows to allow deleting (or moving) the file while it is opened:
# the flags for the normal 'w' mode
file_mode = IO::WRONLY | IO::CREAT | IO::TRUNC
# Add flags to allow deleting (or moving) the opened file
file_mode |= IO::BINARY | IO::SHARE_DELETE
File.open(book.cover_url, mode: file_mode) do |f|
File.delete(f)
end
Note that the IO::SHARE_DELETE flag is only taken into account for files opened in binary mode (rather than text mode) take this into account when working with this opened file. On UNIXy systems the IO::SHARE_DELETE is ignored.
There is some documentation of the various flags available.
As a final remark: I assume that your code is a shortened example where you have left out some code actually interacting with the opened file in addition to deleting it.
If all you want is to delete the file, there is no need to opened it first. Just delete it with File.delete(book.cover_url). Alternatively, if you you don't care for any errors (such as if the file doesn't exist in the first place, you can also use FileUtils.rm_f(book.cover_url).
Changed the code to this...
begin
File.delete(book.cover_url)
rescue Errno::ENOENT
end
...and it works now. No opening any files; just File.delete(URL).
If anyone knows why the original version didn't work, or why it's so commonly suggested, please post an answer or comment on this answer.

Error Generating PDF file w/ Wicked-PDF Ruby Gem

I have a Ruby on Rails back-end service that takes individual PDF documents and combines them into a consolidated PDF - app uses Wicked-PDF ruby gem for generation.
When the PDF is viewed through the browser's default document viewer for PDF, the full document is visible. However, when the document is downloaded and viewed through Adobe Reader or Acrobat, only a part of the document will be fully rendered and then I receive an error "Problem reading this document (14)" with all of the remaining pages turning into small blank thumbnail-like pages, almost like it is corrupted - however, it is not corrupted because it is fully viewable in the browser.
The error has occurred on multiple documents in inconsistent locations, so it seems like it might be related to the particular document being compiled into the full PDF document, but haven't been able to isolate the cause.
Has anyone else encountered this issue w/ the Wicked-PDF package gem?
We identified that the issue was actually in the combine_pdf gem we were using to do the document compilation. The error is caused when two or more documents share the exact same content, ie. they are the same file, regardless of their file name. We are now commparing each document to all others before compilation to ensure that it will not generate an error.

ImageMagick failes to read a JPEG image

I've been using ImageMagick 6.9.0 for some time, and had setup some Railo scripts using it on a Windows Server 2008 R2 Standard Edition machine a while back. I know that they worked at the time. I just tried to run them on a new set of images now, but ImageMagick is failing on the very first command:
<cfexecute name="#Application.ImageMagickRoot#\identify.exe" variable="imgResult" timeout="60" arguments="-format ""%w|%h"" ""#attributes.infoFullPath#""" />
The error returned is:
identify.exe: RegistryKeyLookupFailed `CoderModulesPath' # error/module.c/GetMagickModulePath/662. identify.exe: no decode delegate for this image format `JPEG' # error/constitute.c/ReadImage/501.
I've never seen anything like this. So I checked and saw that there is a new version out, and downloaded IM 7.0.1. I tried running the above command again with no changes, but this time pointing to the 7.0.1 install folder. This resulted in a different, but similar, error:
identify.exe: unable to load module 'C:\ImageMagick-7.0.1-Q16\modules\coders\IM_MOD_RL_JPEG_.dll': The specified module could not be found. # error/module.c/OpenModule/1275. identify.exe: no decode delegate for this image format `JPEG' # error/constitute.c/ReadImage/505.
I looked in the directory in the error and there is a file named IM_MOD_RL_jpeg_.dll there.
The images that I'm trying to work with are all different, and I've cycled through 50 or so during testing. But all are between 4 and 10 megapixel photos exported from Photoshop CS5 Camera Raw to jpeg format. I've tried fiddling with the case of the drive letter and the file extension without success. A sample path to one of the images is:
c:\galleries_incoming\50\69\01 - Getting Ready\DSC_0001.JPG
I'm unsure what to try next. I tried running this command per an old message on the IM forum to get a list of my decode delegates:
convert -list configure
But IM tells me that configure is not a valid list option. In any case, it sounds like installing new decode delegates is something that requires a recompile, and I've just been relying on precompiled binaries (which I would assume would at least be able to read a jpeg).

Installing applications OTA

I have a system set up to download jad files on users' Blackberries, but it only works intermittently, and seemingly randomly. If the user clicks on the link within their BlackBerry browser, 95% of the time on the first try an error message will pop up saying there was an HTTP 500 error (which our server never returns).
Viewing the details of this message within the blackberry browser, it says nothing but java.lang.nullpointerexception which, again, could not have come from our server (running apache/php).
However, if the user clicks on the link a few more times, or navigates away and goes back to that page, it suddenly works. No change on the server, it just shows the application install screen. Unfortunately, this doesn't always work; sometimes the error 500 just keeps showing up.
The link is rather long (containing an sha hash as a token as part of the URL), but I would think that a long URL would either always be broken or always work, not work intermittently.
The link uses a php script to download the jad and cod files. Linking to the files directly rather than using the script seems to work more often (I haven't determined if that also ever has an error 500 or not), but I can't find any issues with the headers. The content type is set correctly and, like I said, if the headers were an issue, I'd think it would either always work or always break.
Any clues?
You may be able to shed some light on the problem by looking at the event logs, which you can get using JavaLoader:
javaloader -u eventlog > event.log
Search for NullPointerException within those logs and you'll be able to see what's causing it.
I can't explain the intermittent behaviour, but I had a similar situation where I was getting the java.lang.NullPointerException in the browser details. Unfortunately, the Event Log (as dumped by javaloader.exe) or by viewing on-device using Alt-L-G-L-G didn't show the exception.
(I'm using bb-ant-tools and JDE 4.6.1.) When the signature tool ran, I noticed that there were two .cod files being signed and I can see both of them inside the .jar file the compiler creates. But the output written was a single .cod file of size 92306 bytes that was not a .zip of smaller .cod files. The compiler somehow was not able to create a .cod that contained siblings. For comparison, compiling the project with JDE 5.0.0 created sibling .cod files that were able to be loaded over OTA.
My project included an .mp3 file of 53542 bytes which I happened to not require. After removing it, the 4.6.1 compiler outputted a single .cod and I was able to successfully download it via OTA.

Resources