I am establishing a kermit connection to my target via a ~/.kermrc file as suggested...
set line /dev/ttyUSB0
set flow-control none
set carrier-watch off
set speed 115200
connect
... But I periodically must unpower the target, which then changes the ttyUSB enumeration, which means I need to change the USB enumeration in the ~/.kermrc file.
My question is, is there a way to dynamically populate the USB line number without modifying the ~/.kermrc. If I remove the 'set line /dev/ttyUSB' and attempt to populate via command-line like this...
kermit -l /dev/ttyUSB0
... the ~/.kermrc file is read first and the command-line line configuration is not respected, so you receive errors that a line number must be set before setting the additional options in the ~/.kermrc.
Thanks in advance for response.
Related
I'm using the Nintendo 64 emulator, Mupen64Plus.
It has a file called mupen64plus-ui-console.exe used to launch games through command-line. It also accepts keyboard shortcuts to perform commands, but it is limited.
Mupen64Plus Commands/Functions
This wiki page shows a list of all commands that can be called, I think from the mupen64plus.dll.
RUNDLL32
I read how to pass commands to a dll like this:
RUNDLL32.EXE <dllname>,<entrypoint> <optional arguments>
Calling a Command with RUNDLL32
I'm trying to call M64CMD_STATE_LOAD with cmd.exe, to load a save file.
Info from Wiki:
Command Functions Prototype m64p_error CoreDoCommand(m64p_command
Command, int ParamInt, void *ParamPtr)
ParamInt Ignored ParamPtr Pointer to string containing state file path
and name, or NULL
This command will attempt to load a saved state file. If ParamPtr is
not NULL, this function will load a state file from a full pathname
specified by this pointer. Otherwise (ParamPtr is NULL), it will load
from the current slot.
I have the Mupen64Plus emulator running a game. I then open cmd.exe and paste in this line.
RUNDLL32.EXE "C:\Path\To\mupen64plus.dll", CoreDoCommand M64CMD_STATE_LOAD 1 "C:\Path\To\MySave.m64p"
Problem
It accepts the command, I get no errors, but the save file isn't loaded.
Questions
Are the arguments being passed wrong?
Does the mupen64plus.dll not have hooks into the currently running mupen64plus-ui-console.exe?
Is it loading the save file into nothing?
Is it not possible to do it this way?
Is there a way to specify a list of variables to be saved in the output file at runtime and not in jmeter.properties file?
I am currently specifying the list of variables to be saved in sample_variables, in jmeter.properties file, but this does not allow specifying different set of output variables for each JMeter script, unless I keep updating jmeter.properties file.
You can pass sample_variables (as well as any other property) via -J command line argument like:
jmeter -Jsample_variables=foo -n -t script1.jmx
jmeter -Jsample_variables=bar,baz -n -t script2.jmx
Also, as per Managing Properties chapter of JMeter User manual:
When you need to modify jmeter properties, ensure you don't modify jmeter.properties file, instead copy the property from jmeter.properties and modify its value in user.properties file.
See Apache JMeter Properties Customization Guide article for comprehensive information on different JMeter properties types and ways of working with them
I am not aware of the way to change sample_variables at runtime. The only workaround I know of is to have BeanShell Listener (or alternatively one of the programmable sampler/pre-/post-processors), which writes into its own file. E.g.:
String filename = "myfile.txt";
String message = "At " + System.currentTimeMillis() + " data is " + vars.get("myVar");
FileOutputStream f = new FileOutputStream(filename, true);
PrintStream p = new PrintStream(f);
this.interpreter.setOut(p);
print(message);
f.close();
You can also add conditions when the variable should be saved (e.g. only after specific sampler or only when the value have changed). From my experience the solution with BeanShell Listener is not expensive resources-wise, since it will be 1 thread regardless of number of running threads. Solution with programmable pre-/post-processor is usually more expensive, unless you only save variables rarely.
Running a script to get a file from SFTP server, however this is recurring job and should still succeed if no file exist, is there an option I can specify?
option batch on
option confirm off
option transfer binary
open sftp://server -timeout=60
password
get /File/2_04-28-2015.txt D:\Files
close
exit
Getting this result:
Can't get attributes of file 'File/2_04-28-2015.txt'.
No such file or directory.
Error code: 2
Tried setting failonnomatch:
winscp> option failonnomatch on
Unknown option 'failonnomatch'.
You cannot tell WinSCP to ignore absent file, when using a specific file name.
But you can check the file existence prior to the actual download.
Easy alternative hack is to use a file mask (note the trailing *) and set the failonnomatch off:
option failonnomatch off
get /File/2_04-28-2015.txt* D:\Files\
(if you are getting "Unknown option 'failonnomatch'", then you have an old version of WinSCP).
Have you tried using MGET instead of GET? It shouldn't fail, just not transfer anything if there's nothing there.
In tcl how to get the data from one file location and to run that data using TCL code .
for example
In the folder 1 there is config file ,i want to get the informations of config file and i want to execute the information that is present or not,
If the configuration file contains Tcl code, it's just:
# Put the filename in quotes if you want, or in a variable, or ...
source /the/path/to/the/file.tcl
If the file contains Tcl code but you don't trust it, you can use a “safe interpreter” context. This disables many commands, giving a much more restricted set of capabilities that you can then add specific exceptions to (with interp alias):
# Make the context
set i [interp create -safe]
# Set up a way for the context to let the master find out about what to
# really set
interp alias $i configure {} recordConfiguration
proc recordConfiguration args {
puts "configured with $args"
}
# Evaluate the script (note that [source] is hidden by default) in the context
$i invokehidden source /the/path/to/the/file.tcl
# Dispose the context
interp delete $i
If the file isn't Tcl code, you have to parse it. That's a substantially more complex matter, so much so that we'll need to know the format of the file before we can answer.
If you are trying to read data (like text strings) from a file then you'll have to open a channel for that particular file like this:
set fileid [open "path/to/your/file.txt" r]
Read open manual page.
Then you can use gets command to read data from the file through the channel fileid .
I've noticed a couple of oddities when dealing with named pipes (FIFOs) under various flavors of UNIX (Linux, FreeBSD and MacOS X) using Python. The first, and perhaps most annoying is that attempts to open an empty/idle FIFO read-only will block (unless I use os.O_NONBLOCK with the lower level os.open() call). However, if I open it for read/write then I get no blocking.
Examples:
f = open('./myfifo', 'r') # Blocks unless data is already in the pipe
f = os.open('./myfifo', os.O_RDONLY) # ditto
# Contrast to:
f = open('./myfifo', 'w+') # does NOT block
f = os.open('./myfifo', os.O_RDWR) # ditto
f = os.open('./myfifo', os.O_RDONLY|os.O_NONBLOCK) # ditto
Note: The behavior is NOT Python specific. Example in Python to make it easier to replicate and understand for a broader audience).
I'm just curious why. Why does the open call block rather than some subsequent read operation?
Also I've noticed that a non-blocking file descriptor can exhibit two different behaviors in Python. In the case where I use os.open() with the os.O_NONBLOCK for the initial opening operation, then an os.read() seems to return an empty string if data is not ready on the file descriptor. However, if I use fcntl.fcnt(f.fileno(), fcntl.F_SETFL, fcntl.GETFL | os.O_NONBLOCK) then an os.read raises an exception (errno.EWOULDBLOCK)
Is there some other flag being set by the normal open() that's not set by my os.open() example? How are they different and why?
That's just the way it's defined. From the Open Group page for the open() function
O_NONBLOCK
When opening a FIFO with O_RDONLY or O_WRONLY set: If O_NONBLOCK is
set:
An open() for reading only will return without delay. An open()
for writing only will return an error if no process currently
has the file open for reading.
If O_NONBLOCK is clear:
An open() for reading only will block the calling thread until a
thread opens the file for writing. An open() for writing only
will block the calling thread until a thread opens the file for
reading.