Jump to content

Wikipedia:Reference desk/Archives/Computing/2018 April 21

From Wikipedia, the free encyclopedia
Computing desk
< April 20 << Mar | April | May >> April 22 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


April 21

[edit]

Adobe Reaper help, Windows.

[edit]

I've been receiving .PDF files of images where they blank out certain parts, like with a black square or rectangle.

How do you remove those?

When I 1st open the file, I see the image in it's entirety for a split second, and then the blank covering cover up.

I read in a newspaper there was a trick to remove them. :/

Thanks. 67.175.224.138 (talk) 03:37, 21 April 2018 (UTC).[reply]

You can look here and here. Ruslik_Zero 08:35, 21 April 2018 (UTC)[reply]

zip

[edit]

I'm on Ubuntu and I'm trying to use zip to zip up these two files:

/home/user/target/a
/home/user/target/b

such that I end up with a zip file in /home/user/ containing:

target/a
target/b

One limitation is that I'm only given the absolute path of the input files, and I would prefer to keep using the absolute input paths to keep things clean. (I'm invoking zip from a script and not from a shell)

So far I've tried two approaches:

zip -r /home/user/result.zip /home/user/target

produces the following zip file, which is highly undesirable due to the excessive paths:

/home/user/target/a
/home/user/target/b

The second approach uses the -j flag to drop the paths:

zip -j -r /home/user/result.zip /home/user/target

But this creates a Tarbomb unfortunately, with the zip looking like this:

a
b

What's a good solution?

I'm open to using other compression utilities as well, as long as it's able to produce a zip file. Mũeller (talk) 13:31, 21 April 2018 (UTC)[reply]

Just drop /home/user:
  cd /home/user
  zip -r result.zip target/
--Wrongfilter (talk) 14:28, 21 April 2018 (UTC)[reply]
Thanks for the response. Yes, that would be the solution if I'm running the command in a shell. But I'm invoking zip from another program, so unfortunately I'm forced to supply absolute paths for everything. Here's the Python that I'm invoking zip with:
      process = subprocess.Popen( ["zip", "-r", "-j", filename + ".zip", filename] )
Of course I could have Python spawn a shell, have the shell navigate to /home/user/, then invoke "zip -r result.zip target". That would work, but I'd prefer to keep the shell out of it to keep things simple. Mũeller (talk) 23:53, 21 April 2018 (UTC)[reply]
If you're willing to use tar then try the following:
         tar cvf result.tar -C /home/user target/
--Wrongfilter (talk) 06:40, 22 April 2018 (UTC)[reply]
You don't need the shell to set a process's "current working directory". CWDs are a process thing managed by the OS on a per-process basis, not a shell thing. This says you can pass a CWD to Popen which I guess is equivalent to doing cd in a shell. 92.230.39.123 (talk) 06:43, 22 April 2018 (UTC)[reply]
Passing in the correct CWD solved the problem. Thank you very much for the help, you two. It's much appreciated. Mũeller (talk) 09:10, 22 April 2018 (UTC)[reply]
Similarly, if it was more convenient for the rest of the script, you could also choose to set the script's own CWD before starting the subprocess. I don't do Python, but in either Perl or C you'd do chdir("/home/user"); (and, of course, check whether it succeeded). --69.159.62.113 (talk) 20:50, 22 April 2018 (UTC)[reply]