Capture image from oscilloscope and store on PC using LabVIEW - labview

I am trying to remotely control an oscilloscope from Agilent (DSO-X 3034A) using LabVIEW. I want to take a screen capture and store it on the computer. I tried the following:
The commands inside the string are:
:SAVE:FILename "temp.png";:SAVE:IMAGe:FACTors ON;:SAVE:IMAGe:FORMat PNG;:SAVE:IMAGe:INKSaver OFF;:SAVE:IMAGe:STARt;
I get the following errors:
Thank you
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ EDIT ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I managed to save the image on the oscilloscope. I am currently trying to move it and save it on the computer instead. I tried the following:
However after writing the "HARDcopy" commands I get the following error:

Your header is undefined. Refer to the "Serial Communications" documentation in order to see what the instrument is expecting in the header. You should right click your string constant and do "\ Codes Display" so that if the documentation calls for a \n character, you're not accidentally sending a \ character followed by an n character.
Query Unterminated means you're not terminating the query as the instrument expects. It looks like you have a newline, but assuming you're using windows, it's possible that the instrument doesn't want the extra \r that is there by default. Again, you'll have to refer to the documentation to be sure.

Related

Paramiko, channel.recv(9999) causing confusion [duplicate]

I am using Python's Paramiko library to SSH a remote machine and fetch some output from command-line. I see a lot of junk printing along with the actual output. How to get rid of this?
chan1.send("ls\n")
output = chan1.recv(1024).decode("utf-8")
print(output)
[u'Last login: Wed Oct 21 18:08:53 2015 from 172.16.200.77\r', u'\x1b[2J\x1b[1;1H[local]cli#BENU>enable', u'[local]cli#BENU#Configure',
I want to eliminate, [2J\x1b[1;1H and u from the output. They are junk.
It's not a junk. These are ANSI escape codes that are normally interpreted by a terminal client to pretty print the output.
If the server is correctly configured, you get these only, when you use an interactive terminal, in other words, if you requested a pseudo terminal for the session (what you should not, if you are automating the session).
The Paramiko automatically requests the pseudo terminal, if you used the SSHClient.invoke_shell, as that is supposed to be used for implementing an interactive terminal. See also How do I start a shell without terminal emulation in Python Paramiko?
If you automate an execution of remote commands, you better use the SSHClient.exec_command, which does not allocate the pseudo terminal by default (unless you override by the get_pty=True argument).
stdin, stdout, stderr = client.exec_command('ls')
See also What is the difference between exec_command and send with invoke_shell() on Paramiko?
Or as a workaround, see How can I remove the ANSI escape sequences from a string in python.
Though that's rather a hack and might not be sufficient. You might have other problems with the interactive terminal, not only the escape sequences.
You particularly are probably not interested in the "Last login" message and command-prompt (cli#BENU>) either. You do not get these with the exec_command.
If you need to use the "shell" channel due to some specific requirements or limitations of the server, note that it is technically possible to use the "shell" channel without the pseudo terminal. But Paramiko SSHClient.invoke_shell does not allow that. Instead, you can create the "shell" channel manually. See Can I call Channel.invoke_shell() without calling Channel.get_pty() beforehand, when NOT using Channel.exec_command().
And finally the u is not a part of the actual string value (note that it's outside the quotes). It's an indication that the string value is in the Unicode encoding. You want that!
This is actually not junk. The u before the string indicates that this is a unicode string. The \x1b[2J\x1b[1;1H is an escape sequence. I don't know exactly what it is supposed to do, but it appears to clear the screen when I print it out.
To see what I mean, try this code:
for string in output:
print string

Access Token Curl

On this website:
https://developers.google.com/nest/device-access/authorize
Under Get Access Token
It says "Open a terminal and run the following curl command, replacing oauth2-client-id and oauth2-client-secret with the OAuth2 Client ID and Client Secret from your GCP Credentials, and authorization-code with the code you receive in the previous step:"
I have repeatedly input my oauth2-client-id, oauth2-client-secret and authorization-code. I copy and paste into the Terminal in Raspbian. It always says "Curl(3) URL using bad/illegal format or missing URL". Because I am copying and pasting all my information into the syntax, then copying and pasting the syntax into Terminal, I am at a complete loss for how to proceed.
Is something wrong with the Syntax that this Google document provided?
Google's recommended syntax is shown in the image and on the website I gave a link to.
enter image description here
.... made some progress here.
Rather than utilising the copy-code from Google, directly from the page, I copied and pasted onto "TextMate" and joined the 5 rows command into a single row.
I basically went at the beginning of each row (in TextMate) and backspace'd to the previous row, until the command was a single line one.
I then copied the single line command and pasted it into Terminal.
This is removing the previous error, at least the command is going through, I get most of the responses from the server.
I am still getting an error, which I am trying to figure out: "error" : "unsupported_grant_type".
The command includes "... grant_type=authorization_code..." within the command.

Display variables using CBC MPS input in NEOS

Am trying to use NEOS to solve a linear program using MPS input.
The MPS file is fine, but apparently you need a "paramaters file" as well to tell the solver what to do (min/max etc.). However I can't find any information on this online anywhere.
So far I have got NEOS to solve a maximization problem and display the objective function. However I cannot get it to display the variables.
Does anyone know what code I should add to the paramters file to tell NEOS/CBC to display the resulting variables?
The parameter file consists of a list of Cbc (standalone) commands in a file (one per line). The format of the commands is (quoting the documentation):
One command per line (and no -)
abcd? gives list of possibilities, if only one + explanation
abcd?? adds explanation, if only one fuller help(LATER)
abcd without value (where expected) gives current value
abcd value or abcd = value sets value
The commands are the following:
? dualT(olerance) primalT(olerance) inf(easibilityWeight)
integerT(olerance) inc(rement) allow(ableGap) ratio(Gap)
fix(OnDj) tighten(Factor) log(Level) slog(Level)
maxN(odes) strong(Branching) direction error(sAllowed)
gomory(Cuts) probing(Cuts) knapsack(Cuts) oddhole(Cuts)
clique(Cuts) round(ingHeuristic) cost(Strategy) keepN(ames)
scaling directory solver import
export save(Model) restore(Model) presolve
initialS(olve) branch(AndBound) sol(ution) max(imize)
min(imize) time(Limit) exit stop
quit - stdin unitTest
miplib ver(sion)
To see the solution values, you should include the line sol - after the min or max line of your parameter file.
If this doesn't work you can submit the problem to NEOS in AMPL format via this page. In addition to model and data files, it accepts a commands file where you can use statements to solve the problem and display the solution, for example:
solve;
display _varname, _var;
This post describes how to convert MPS to AMPL.

How to edit a device driver file(.sys)

How I can edit a device driver file (.sys) and I want to update the Report Descriptor file. I want to transpose the X and Y value of USB HID device driver. Please help me to transpose the X & Y value in an HID device.
use a binary editor, or if you are really careful, vi. note that whatever you do, leave strings exactly the same length or you will almost definitely crash your operating system.
assuming you are using Windows, good old debug.exe will work fine as a binary editor. the interface is a bit obscure though.
C:\Users\jc>echo bleah > test.sys
C:\Users\jc>debug test.sys
-e100
17DD:0100 62.31 6C.32 65.33 61.34 68.35
-w
Writing 00008 bytes
-q
C:\Users\jc>type test.sys
12345
on the line following -e100, I was typing the new values and hitting the spacebar; when done I hit <enter>.
You can use any static disassembler for Win32/Win64. This way you will better see the code instructions, function names, and be able to find your target easily (otherwise reading machine code directly it's for priviledged minds).
One example can be "PEBrowse Professional" (free) but there are many other out there. The one I cited is verified to open 64-sys of Win10.

Why do Golfscript examples use pop-and-discard at the start?

;'2706 410'
~{.#\%.}do;
From the GCD example.
It looks like the pop and discard at the start will do nothing, so why is it there?
The program starts with the contents of standard input at the top of the stack. The pop discards this unused input so that it is not printed when the program exits.
From the tutorial:
There is no explicit input command in GolfScript, instead when your script is executed, all input from stdin is read first and placed as a string onto the stack.
and:
When your script reaches the end. The contents of the stack are printed automatically.