Is it possible to invoke pstops manually from command line? - cups

I am trying to learn how CUPS is implemented.
I see that the first step in the chain is to submit a PS to the pstops filter, which takes the PPD and shall return another PS for pstoraster.
I have read the source code for pstops but it is not very commented and I am struggling to:
understand if launching pstops from command line specifying a PS file is possible at all.
understand which shall be used for the rest of parameters:
job-id
user
title
copies
options
understand specifically where shall I include the path to the PPD file of the printer that is intended to be used later.

Related

How to run HtmlUnit.jar in terminal/command line?

I am searching for a way for testing my webpage using the command line.
My intentions are
check an anchor tag is present on the page
check the anchor tag href is pointing to the correct(pre-defined) web link
Check the anchor tag text is the pre-defined one
I should be able to check other tags also like img, script, etc.
After searching, I came across htmlUnit.jar. But I am not getting any proper link on how to run this in the command line.
Will I be able to pass the test cases to the jar file? If so, please guide me
What is the syntax to run this htmlUnit.jar file in the terminal? I am unable to find any useful documentation
Please help if I can achieve my goal by this file
HtmlUnit is a library, you have to write your own program using HtmlUnit for your use case.
Another option is to use Wetator (www.wetator.org).
Wetator is
based on HtmlUnit
runs from the command line
can perform the different asserts you like to do
generates a nice report (and also a return code if at least one assert fails)
(Ok, i'm the person behind HtmlUnit and Wetator so maybe i miss some other option)

How to convince VS code to accept # as comment in JSON files?

We have special files that contain JSON data mixed with # comments.
I figured I need to enhance Code's json.settings file with:
"files.associations": {
"*.ourextension": "jsonc"
}
but then I discovered that jsconc is about JSON data with // comments.
Is there a convenient way to get VS code to accept # comments in JSON data?
Edit: VS code recognizes the jsconc language, it gives me this error message:
And it also accepts // comments:
adding the // got me a green first line, and now the second line gets the first error (because starting with #).
If you use the Change Language mode command (or click on the language indicator on the status bar) you can select "jsonc JSON with Comments".
I think this is only auto-detected when the extension is .jsonc.
NB. JSON with comments uses JavaScript style single line comments: from a \\, outside a string literal, to the end of line.
To support some different comment indicator would require a new language mode (and an extension to add it).
A distinct non-answer: it might be possible to add a such a new language definition, but it would require quite a bit of work. I also had a quick look if I could simply change the corresponding config json file for jsonc that ships with VS code, but that file is rather complex, and would probably be overridden with the next VS code update.
Thus a straight forward workaround. Two scripts to replace one command style with the other:
#!/bin/sh
# a helper script that turns all # into //
# with the syntax that works for sed on MAC OS
for file in "$#"
do
sed -i '' -e 's,#,//,g' $file
done
Not exactly convenient, but fast and robust, given our specific requirements.

Labview pop up requesting folder/file

I just encountered an issue with a Labview project.
Background
The software in question is usually a standalone application, but for the sake of debugging purposes we found a way to run it in the Labview environment with the source files.
Issue
When we press the run command (which is not broken btw), it starts processing the files I guess, and at some point a folder explorer will pop up without further detail on what it is requesting. We have been trying to select the MAIN folder (where the MAIN.VI is), the SOURCE folder which contains all the VIs and subVIs of the project, but either way it just updates a log tab with the text "The application has stopped"(which I assume is due to us not selecting the correct file/folder).
I guess my main questions are,
Is there a way to tell what this pop up is expecting us to select?
Are there known function blocks which could be asking for a file/folder path?
Additional information*
A couple of months ago, someone knew this path and we have run it correctly, but he just forgot it, so that is why I am certain that it works this way. It runs in a Labview 13 environment.
Any help is greatly appreciated.
Greetings.
Try searching the VI Hierarchy by name for likely culprits:
Open a VI or project and select View»VI Hierarchy to display the VI
Hierarchy window.
Initiate a search by typing the name of the item
you want to find anywhere in the window. As you type the text, the
search string appears, displaying the text as you type. LabVIEW
highlights one item at a time whose name begins with the search
string.
If there is more than one item with a name that begins with
the search string, press the Enter key to search for the next item
that matches the search string. Press the Shift-Enter keys to find
the previous item that matches the search string.
I'm pretty sure all the LabVIEW primitives that can display a file or folder dialog have either file or folder in their names but if that doesn't help you could also try save or write.
If you find more than one result, set breakpoints on them before running the code. When execution reaches the breakpoint it will halt and highlight the breakpoint position; you can then use the Step In / Step Over to check whether that's the node that triggers the dialog (and the Pause button to continue execution if not).

Verify a Tif with ApprovalTests

I have been asked to update a system where header information gets injected into a tif via a 3rd party console application. I don't need to worry about that bit.
The part I have been asked to look at it the merge process that generates the header information.
The current file generated by the process is assumed as correct, before I make any changes, so I want to add this as an approved result, from that I can then check that the changes I make will alter the file as expected.
I thought this would be a good opportunity to look at using ApprovalTests
The problem I have is that for what ever reason the links to the videos are considered corruptible (Possibly show me kittens jumping into boxes or something, which will stop me working, which ironically means I slow down my work done because I cannot see any help videos).
What I have been looking at is the Approvals.Verify and Approvals.VerifyFile extensions.
But what appears to be happening is confusing me.
using VerifyFile creates a received file, but the contents of the file are just a line the name of the file I have asked it to verify.
using Verify(new FileInfo("FileNameHere")) does not appear to generate the received file that I need to flag as approved, but the test does return saying that it cannot find the approved tif file.
I am probably using VerifyFile completely wrong and might be looking at using Verify wrong as well.
useful info?
Might be useful to know, that as this is a legacy application, running as a windows service, I have wrapped the service in a harness that allows me to call the routines, so the files are physically being written elsewhere on the machine outside of my control (well there is a config, but the return of the service I call generates a file in a fixed location if it is successful). I have tried copying that into the Unit Test project, but that doesn't appear to help.
Verify(File) and VerifyFile(string) are both meant to verify an existing file. As such they merely setting the received file to the file you pass in. You will still need to move/approval/create the approved file.
Here is the pseudo code and process.
[UseReporter(typeof(DiffReporter), typeof(ClipboardReporter)]
public void TestTiff()
{
string tif = YourProcessToCreateTifFile();
Approvals.VerifyFile(tif);
}
[Note: if you don't have an image diff installed, like TortoiseDiff, you might want to use the FileLauncherReporter]
Run this, once you get the result, move the file over by pasting your clipboard into a cmd window.
It will move the temporary tif to your test directory with the name ClassName.TestTiff.approved.tif
After that the test should pass until something changes.
Happy Testing!

Erlang: calling rr(?MODULE) from beam executable?

I'm not entirely sure how to define an Erlang function within an Erlang module. I'm getting the following error:
11> invoke_record:invoke().
** exception error: undefined function erlang:rr/1
From this simple code trying to invoke the rr(?MODULE). from within the beam executable in order to "initialize" records so that it doesn't need to be called from the shell every time.
-module(invoke_record).
-export([invoke/0]).
-record(process, {pid,
reference="",
lifetime=0
}).
invoke() ->
erlang:rr(?MODULE).
The command rr("file.hrl"). is meant to be be used only in shell for debugging purposes.
As other users highlighted in their answers, the correct way to import a record (or a function) contained in a .hrl file within your erlang code consists in using the command -include("file.hrl').
Once you have included the .hrl file in your code (and usually in a module based on OTP behaviours this is done after the -export(...) part) you can refer to the Erlang record (or function) without any problem.
rr is a shell command. You cannot use it it compiled code.
http://www.erlang.org/doc/man/shell.html
If your intent is to read many record definitions in the shell, in order to facilitate the debug, you can write a file containing all needed include statements and simply invoke rr once in the shell.
in rec.hrl:
-include("include/bank.hrl").
-include("include/reply.hrl").
and in the in the shell
1> rr("rec.hrl").
[account,reply]
2>
I didn't find any way to execute this automatically, when starting the VM.
When working on a project, you can gather all necessary includes and other command line arguments that you want to use for that particular project in a plain text file. After having made the plain text file, you can start your shell:
erl -args_file FileName
where FileName is the name of the plain text file. Note that all command line arguments accepted by erl are allowed. See also erl Flags in the ERTS Reference Manual