Hi,
This is my first post to the list, I hope somebody can help me with this
problem. Apologies if it has been posted before but I have been internet
searching to no avail.
What I am trying to do is provide a simple method for a user to change a
config file, for a test suite.
The config file consists of a number of keys, eg. build number, target
device, etc.
What I would like to do is give the user a key, and the previous value
for that key.
The user can then accept the previous value or edit it on the line.
I have a method where the previous value of a key is presented to the
user and can be accepted if the user hits return. But as some of the
values are somewhat long, and the user may only need to change 1 or 2
characters, it would be a nice feature to offer line editing.
I can get the readline.set_pr e_input_hook() function to send text after
a raw_input prompt, but this text cannot be edited.
Thanks in advance for any help.
Paraic. 13 3941
Paraic Gallagher enlightened us with: What I am trying to do is provide a simple method for a user to change a config file, for a test suite.
My opinion: let the user edit the configuration file using his/her
favourite text editor. Someone configuring a test suite should
certainly be able to edit a text file.
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Sybren Stuvel wrote: My opinion: let the user edit the configuration file using his/her favourite text editor. Someone configuring a test suite should certainly be able to edit a text file.
Sybren
While I agree in principal to your opinion, the idea is that an absolute
moron
would be able to configure a testcell with smallest amount of effort
possible.
Moreover, I am curious as to whether somebody else out there knows if
there is a solution to the problem.
Paraic.
Paraic Gallagher enlightened us with: While I agree in principal to your opinion, the idea is that an absolute moron would be able to configure a testcell with smallest amount of effort possible.
Then explain to me why learning how to use your program to edit the
file is easier than using an already familiar program.
Moreover, I am curious as to whether somebody else out there knows if there is a solution to the problem.
Give a default answer that's chosen when the user presses enter
without providing an answer of his own.
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Paraic Gallagher wrote: Hi,
This is my first post to the list, I hope somebody can help me with this problem. Apologies if it has been posted before but I have been internet searching to no avail.
What I am trying to do is provide a simple method for a user to change a config file, for a test suite. The config file consists of a number of keys, eg. build number, target device, etc.
What I would like to do is give the user a key, and the previous value for that key. The user can then accept the previous value or edit it on the line.
I have a method where the previous value of a key is presented to the user and can be accepted if the user hits return. But as some of the values are somewhat long, and the user may only need to change 1 or 2 characters, it would be a nice feature to offer line editing.
I can get the readline.set_pr e_input_hook() function to send text after a raw_input prompt, but this text cannot be edited.
With the disclaimer that, as others have said, this may not be the best
user-interface choice:
import readline
readline.set_st artup_hook(lamb da: readline.insert _text(old_value ))
try:
new_value = raw_input()
finally:
readline.set_st artup_hook(None )
Note that, among other issues, this isn't threadsafe (but then, you
really shouldn't be doing console I/O from multiple threads anyway).
Hope this helps.
-- David
David Wahler wrote: With the disclaimer that, as others have said, this may not be the best user-interface choice:
import readline readline.set_st artup_hook(lamb da: readline.insert _text(old_value )) try: new_value = raw_input() finally: readline.set_st artup_hook(None )
Note that, among other issues, this isn't threadsafe (but then, you really shouldn't be doing console I/O from multiple threads anyway). Hope this helps.
-- David
Thanks David, this was exactly what I was looking for.
Paraic.
Sybren Stuvel <sy*******@YOUR thirdtower.com. imagination> wrote: Paraic Gallagher enlightened us with: While I agree in principal to your opinion, the idea is that an absolute moron would be able to configure a testcell with smallest amount of effort possible. Then explain to me why learning how to use your program to edit the file is easier than using an already familiar program.
You're assuming that the tester is already familiar with a text
editor. And then they would have to learn the syntax of the
configuration file, and the parameters available. A point-and-
drool interface requires no such learning.
--
\S -- si***@chiark.gr eenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
Sion Arrowsmith enlightened us with: You're assuming that the tester is already familiar with a text editor.
Indeed. Someone working on a test suite sounded like someone who knows
how to work with a text editor.
And then they would have to learn the syntax of the configuration file, and the parameters available.
True. Thorough comments and a clear syntax help a long way.
A point-and-drool interface requires no such learning.
But that's not what you get with raw_input().
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Hi all, I am trying to convert a hexdecimal value to a char using this code:
print ' %c ' % int(0x62)
this works fine, but if I want to do this:
number = "62"
print ' %c ' % int("0x" + number)
I get an error:
Traceback (most recent call last):
File "<stdin>",l ine 1, in ?
ValueError: invalid literal for in(): 0x62
How can I convert a string "0x62" to int/hex without this problem?
Thanks!
Ognjen Bezanov enlightened us with: Hi all, I am trying to convert a hexdecimal value to a char using this code:
print ' %c ' % int(0x62)
This is an integer ^^^^
this works fine, but if I want to do this:
number = "62" print ' %c ' % int("0x" + number)
This is a string ^^^^^^^^^^^^^
How can I convert a string "0x62" to int/hex without this problem?
In [0]: exec('num=0x%s' % '62')
In [1]: num
Out[1]: 98
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JKop |
last post by:
What's the difference between them?
Take the following:
#include <iostream>
struct Blah
{
int k;
|
by: **Developer** |
last post by:
Been reading some of the Marshal doc and am a little confused.
Anyway, I've been using the following and it works OK.
Public Declare Auto Function SHGetFolderPath Lib "shell32.dll" (ByVal hWnd
As Integer, _
ByVal nFolder As Integer, ByVal nToken As Integer, _
ByVal dwFlags As Integer, _
|
by: planetthoughtful |
last post by:
Hi All,
As always, my posts come with a 'Warning: Newbie lies ahead!'
disclaimer...
I'm wondering if it's possible, using raw_input(), to provide a
'default' value with the prompt?
I would like to include the ability to edit an existing value (drawn
from an SQLite table) using a DOS console Python app, but my gut
|
by: David Greenberg |
last post by:
Hi
When we installed SqlServer2000 we left the default collation name
(Sql_Latin1_General_CPI_CI_AS).
The user defined databases we created afterwards were defined with a
different collation name in order to be able to accept the character set
we use, Hebrew.
We are looking into switching DTSs that we use to copy data from our
main system ,...
|
by: shapper |
last post by:
Hello,
How can I check if a parameter, for example "name", is available in a
QueryString?
I need to create a default value if the parameter is not available.
Thanks,
Miguel
| |
by: Sankalp |
last post by:
Hi,
I am using VB 2005. My application has many data bound controls. The
connection is stored in the app.config file.
I want the application to start with a default connection string and
while during the runtime, the user can click on a button and change the
connection string without exiting the application.
I would really appreciate...
|
by: SammyBar |
last post by:
Hi all,
I'm trying to convert the xml obtained from a XmlReader object into a UTF-8
array. My general idea is to read the XmlReader and write into a
MemoryStream. Then convert the MemoryStream bytes into utf-8.
MemoryStream ms = new MemoryStream();
XmlTextWriter xmlWriter = new XmlTextWriter(ms, new UTF8Encoding(false));
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |