need some help quickly
HI Hope this is the right place for this, I am new. I have a spec to create a (dual screen) framework application that 1 displays mp3, flash, jpegs etc. on top screen 2: displays buttons on bottom screen which alter image when a key is pressed. The hardware is a dell pc basically, no mouse and the keyboard is a simple 8 key pad that outputs numbers 1-8 (I think but can be mapped). I am looking for the best way to create this and tools to use etc. The system is basically an information kiosk like you see in airports etc. the presentation screen on top may show several borderless frames containing differing media. Hope you can help - any thoughts welcome I am willing to pay for some help. -- http://mail.python.org/mailman/listinfo/python-list
Need some help here
Hello. Unfortunately, I am in need of money to pay my credit card bills. If you could spare just $1, I would be grateful. I have a Paypal account. [EMAIL PROTECTED] I swear this will go to my card balances. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
I need some help
hello, I'm completely a newbye, I've started studying python since 3 weeks and now I need to write a small program that reads the id3 tags from the mp3 contained inside a cd, and then print them into a simple text file, I hope it's possible to do this, and I hope you can help me too. thanks alot and sorry for my bad english but I'm italian Dany -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help quickly
Am Tue, 14 Dec 2004 04:46:24 -0800 schrieb Allan Irvine: > HI > > Hope this is the right place for this, I am new. I have a spec to > create > a (dual screen) framework application that > > 1 displays mp3, flash, jpegs etc. on top screen > 2: displays buttons on bottom screen which alter image when a key is > pressed. What operating system do you use? Please choose a better subject next time. "need some help quickly": I don't think the application you are looking for is done quickly. Thomas -- Thomas Güttler, http://www.thomas-guettler.de/ -- http://mail.python.org/mailman/listinfo/python-list
RE: need some help quickly
Allan Irvine wrote: > Hope you can help - any thoughts welcome Here is the best place you can get help for your problem: http://www.catb.org/~esr/faqs/smart-questions.html Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list
Re: Need some help here
Frank Drackman wrote: > "Kareem840" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Hello. Unfortunately, I am in need of money to pay my credit card >> bills. If you could spare just $1, I would be grateful. I have a Paypal >> account. [EMAIL PROTECTED] I swear this will go to my card >> balances. Thank you. >> > > Sell your sperm, we don't want you to reproduce. > > f-u set -- lsmft -- http://mail.python.org/mailman/listinfo/python-list
Re: Need some help here
"Kareem840" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello. Unfortunately, I am in need of money to pay my credit card > bills. If you could spare just $1, I would be grateful. I have a Paypal > account. [EMAIL PROTECTED] I swear this will go to my card > balances. Thank you. > There's this clown in Africa that will help you, please contact him. -- http://mail.python.org/mailman/listinfo/python-list
Re: Need some help here
Kareem840 wrote: > Hello. Unfortunately, I am in need of money to pay my credit card > bills. If you could spare just $1, I would be grateful. I have a Paypal > account. [EMAIL PROTECTED] I swear this will go to my card > balances. Thank you. > And I need to get a bus. I mean literally. It's the best. So chip in a few cents, will you? [EMAIL PROTECTED]'s the address. I swear I will use it to buy a bus. wildemar (sorry to be a jerk, I'm tired but can't sleep; too many money woes) -- http://mail.python.org/mailman/listinfo/python-list
Re: Need some help here
di wrote: > "Kareem840" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Hello. Unfortunately, I am in need of money to pay my credit card >> bills. If you could spare just $1, I would be grateful. I have a Paypal >> account. [EMAIL PROTECTED] I swear this will go to my card >> balances. Thank you. >> > > There's this clown in Africa that will help you, please contact him. > > Post your bank account details and i will transfer my nigerian inheritance to you..honest!!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Need some help here
Kareem840 wrote: > Hello. Unfortunately, I am in need of money to pay my credit card > bills. If you could spare just $1, I would be grateful. I have a Paypal > account. [EMAIL PROTECTED] I swear this will go to my card > balances. Thank you. > I accidentally sent $2, could you please refund the extra dollar to [EMAIL PROTECTED] No, thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Need some help here
"Frank Drackman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] : : "Kareem840" <[EMAIL PROTECTED]> wrote in message : news:[EMAIL PROTECTED] : > Hello. Unfortunately, I am in need of money to pay my credit card : > bills. If you could spare just $1, I would be grateful. I have a Paypal : > account. [EMAIL PROTECTED] I swear this will go to my card : > balances. Thank you. : > : : Sell your sperm, we don't want you to reproduce. erm can i just point out the flaw in your suggestion frank... -- http://mail.python.org/mailman/listinfo/python-list
Re: Need some help here
In comp.unix.solaris Kareem840 <[EMAIL PROTECTED]> wrote: > Hello. Unfortunately, I am in need of money to pay my credit card > bills. If you could spare just $1, I would be grateful. I have a Paypal > account. [EMAIL PROTECTED] I swear this will go to my card > balances. Thank you. Better idea. Sell your computer. Or your organs. -- http://mail.python.org/mailman/listinfo/python-list
Re: Need some help here
"Kareem840" <[EMAIL PROTECTED]> writes: > Hello. Unfortunately, I am in need of money to pay my credit card > bills. If you could spare just $1, I would be grateful. I have a Paypal > account. [EMAIL PROTECTED] I swear this will go to my card > balances. Thank you. If you have a story of unusual personal hardship that led to the balances, share it--you may get more response. If you're just a usual idiot without the discipline to live within their their means, get a job, or if you have one, get a better one and dig yourself out of the whole you've created for yourself. Otherwise, we'd all just be enabling you to be an idiot again, we'd all be a dollar poorer, and you'd be no wiser--just with a better credit score for a time. If you're just seeing how many folks will give you money without any good reason (i.e. not a scam, just an internet beggar), hey, enjoy. If you're a clever sociology graduate student doing a pootentially interesting thesis on various responses to an anonymous plea for money on the internet, kudos. I bet it'd be an interesting study. Best Regards, -- Todd H. http://www.toddh.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Need some help here
The money's on the way! "Kareem840" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello. Unfortunately, I am in need of money to pay my credit card > bills. If you could spare just $1, I would be grateful. I have a Paypal > account. [EMAIL PROTECTED] I swear this will go to my card > balances. Thank you. > -- http://mail.python.org/mailman/listinfo/python-list
Re: Need some help here
"Kareem840" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello. Unfortunately, I am in need of money to pay my credit card > bills. If you could spare just $1, I would be grateful. I have a Paypal > account. [EMAIL PROTECTED] I swear this will go to my card > balances. Thank you. > Sell your sperm, we don't want you to reproduce. -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help
"dammix" <[EMAIL PROTECTED]> writes: > > I'm completely a newbye, I've started studying python since 3 weeks and > now I need to write a small program that reads the id3 tags from the > mp3 contained inside a cd, and then print them into a simple text file, > I hope it's possible to do this, and I hope you can help me too. Several different people have written modules to help you read (and write) ID3 tags. http://id3-py.sourceforge.net/ http://pyid3lib.sourceforge.net/ http://news.tiker.net/software/tagpy Pick one you like! Tim -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help
Tim Heaney wrote: > Several different people have written modules to help you read (and > write) ID3 tags. On a related topic, I have a Perl module that reads MP4/AAC tags - http://search.cpan.org/~jhar/MP4-Info/ - that I'm considering porting to Python. But before I start, is anyone aware of an existing Python module to read MP4/AAC tags? Jonathan. -- http://mail.python.org/mailman/listinfo/python-list
need some help with threading module...
Hi all, This is the first i post in this newsgroup, i hope my english is not too bad... Let's get straight to the point ! I have a little probleme using threads in my little training example : I wish to create two threads in my application, one thread (the subject) will increment a variable, and another thread (the controller) will print a message saying "i am waiting..." or someting like that, until the counter of the first thread reaches 10 or higher. It will query the first thread object about the value of that counter in a while loop until that counter reaches 10 or higher... Here is the code i wrote (it doesn't work): from threading import * class Subject(object): def __init__(self) : self.counter = 0 t = Timer(0.1,self.doIteratingStuff) t.start() def incrementCounter(self,n=1) : self.counter = self.counter + n def doIteratingStuff(self) : for i in range(10) : self.incrementCounter(4) print "the counter is now", self.counter def count(self): return self.counter class Controller(object): def __init__(self, objectToControl) : self.controlled = objectToControl self.th = Thread(target = self.stopCounting) def start(self): self.th.start() def stopCounting(self): i = 0 #while(1): for i in range(10) : print "###> waiting... ", i i = i + 1 if self.controlled.count() >= 10 : print "it is ten" return class Application (object) : def __init__(self) : pass def launch(self) : self.sub = Subject() self.control = Controller(self.sub) self.control.start() a = Application() a.launch() Of course, the indentations are lost since i copied this code from my emacs on linux, and then paste it on my outlook express (i don't have the net on linux :(...). The probleme with the code is that the controler thread never stops !! that's why the while loop is now commented and replaced by a for loop... I wish the problem is clear for all and that somebody can give some help ! Thanks for all and merry x-mas and blablablah. Yacine Chaouche, France. -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
> Thanks for all and merry x-mas and blablablah There is no X in Christmas, and blablablah should read Happy New Year! >Of course, the indentations are lost since i copied this code from my emacs >on linux, and then paste it on my outlook express (i don't have the net on >linux :(...). I have had problems with whitespace being stripped before, but I just cannot understand WHY would you post KNOWING it was missing indents. Fix-it repost and maybe someone might help you. Hth, M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
I think it is more suitable in this form... from threading import * class Subject(object): def __init__(self) : self.counter = 0 t = Timer(0.1,self.doIteratingStuff) t.start() def incrementCounter(self,n=1) : self.counter = self.counter + n def doIteratingStuff(self) : for i in range(10) : self.incrementCounter(4) print "the counter is now", self.counter def count(self): return self.counter class Controller(object): def __init__(self, objectToControl) : self.controlled = objectToControl self.th = Thread(target = self.stopCounting) def start(self): self.th.start() def stopCounting(self): i = 0 #while(1): for i in range(10) : print "###> waiting... ", i i = i + 1 if self.controlled.count() >= 10 : print "it is ten" return class Application (object) : def __init__(self) : pass def launch(self) : self.sub = Subject() self.control = Controller(self.sub) self.control.start() a = Application() a.launch() Thanls for all. Yacine Chaouche, France. -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
Just a warning! Threads and newbies don't mix well, many pitfalls and hard to find bugs await you. I would avoid using threads if at all possible. Now we have all that over lets see some code. py> import threading py> class Test(threading.Thread): ...def run(self): ... x = 0 ... while x < 10: ... print x ... x += 1 ... print " Ending" Use it like this: py> Test().start() There are other ways to do this, but you need to do a web search on threading.py , there are many examples out there. hth, M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
I found your object-oriented approach, while admirable, a little muddled. So rather than modify your code, I simply took the paragraph you wrote describing the scenario and wrote my own.[1] Instead of having the Controller query the Subject (not exactly plausible), I had it wait for a signal (threading.Event) as set by the Subject. You could also have it query a queue, as that is a generally accepted and thread-safe object to use, but for this purpose I chose an event and a global variable. (I'm aware that some would look down on this, but I didn't see a problem, as it was only modified by one thread amd printed by the other.) Daniel Bickett NOTES: [1] Google killed my whitespace (as spaces _and_ tabs...) in the previews, so I pasted it on Nopaste: http://rafb.net/paste/results/KilM6t70.html -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
Hi everybody, "Daniel Bickett" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] > Instead of having the Controller query the Subject (not exactly > plausible), I had it wait for a signal (threading.Event) as set by the > Subject. You could also have it query a queue, as that is a generally > accepted and thread-safe object to use, but for this purpose I chose an > event and a global variable. (I'm aware that some would look down on > this, but I didn't see a problem, as it was only modified by one thread > amd printed by the other.) > > Daniel Bickett Your approache is a little different, since the subject is responsible of emiting a signal/event to the controller. I wish to avoid this situation. The reason is that i want to write an application where the model (the system) is completely unaware of the view and the controller. This way, i could easily change the way the model and the view interact, while the code of the model remains unchanged. I don't know if this is possible, that's why i'm trying to solve this problem with threads ! and hope someone could help me :) Thanks to all. -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
"M.E.Farmer" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] > Just a warning! > Threads and newbies don't mix well, > many pitfalls and hard to find bugs await you. > I would avoid using threads if at all possible. Indeed :). But how will i learn using threads if i avoid using them :) ?? > Now we have all that over lets see some code. > > py> import threading > py> class Test(threading.Thread): > ...def run(self): > ... x = 0 > ... while x < 10: > ... print x > ... x += 1 > ... print " Ending" > Use it like this: > py> Test().start() Your example is interristing...somehow this is not exactly what i want to realise. I have exposed the problem in an earlier reply... Thank you all. Yacine Chaouche -- France. -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
chahnaz.ourzikene wrote: > "M.E.Farmer" <[EMAIL PROTECTED]> a écrit dans le message de news: > [EMAIL PROTECTED] > > > Just a warning! > > Threads and newbies don't mix well, > > many pitfalls and hard to find bugs await you. > > I would avoid using threads if at all possible. > > Indeed :). But how will i learn using threads if i avoid using them :) ?? That was the point , you probably don't need them, and if so avoid them. If you want to learn how to use them , go for it! That is an excellent reason to mess with them, it was just a warning because you WILL be bitten by them, just a matter of time ;) > > Now we have all that over lets see some code. > > > > py> import threading > > py> class Test(threading.Thread): > > ...def run(self): > > ... x = 0 > > ... while x < 10: > > ... print x > > ... x += 1 > > ... print " Ending" > > Use it like this: > > py> Test().start() > > Your example is interristing...somehow this is not exactly what i want to > realise. I have exposed the problem in an earlier reply... > Yacine Chaouche -- France. I should have mentioned this was an attempt to show you how to make a thread 'exit' after it reached 10. You are having problems with the controller class, please look again at what I gave you this as an example. Did you run it? It was specific to your question. You were having problems making the controller exit. It should explain where you are lost, notice I inherit from Thread and not object, notice a much simpler way to write the thread You also mention the MVC pattern. If you are trying to implement MVC with threads you are going about it the wrong way ;) Hth, M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
Hi, I fixed the code, it runs under Linux but not under windows 0_o ??! i guess windows and Linux do not handle threads the same way. However, i don't have the result i excpect. Please have a look here : ## In this little program, i'm trying to find a way to yield data from a thread within another ## thread, where both threads are NON-COOPERATIVE. ## To do so, i imagined an application launching two threads : a subject (to yield data from) ## and a controller that will try to yield data from the subject. The controller has a link ## with the subject, so he can call his methods and ask him to return the desired data. ## ## The problem is that it appears that on windows systems, this program idles and crashes after ## some seconds. On linux systems, this program runs but not the way i figured : the two threads ## seem not to run in parallel... ## ## Look at the controller code : his job is to call the subject's methode "count()" and compare ## the returned data to a threshold he's exepcting to reach. If the count method of the subject ## returns a number less than threshold, than the controller loop again (in a recursive function) ## until the subject's count method returns a number greater or equal to threshold or the recursive funtion ## runs "limit" times ( to avoid unlimited recursive calls ). ## ## Now look at the subject code : his only job is to increment a counter in a recursive methode. ## This counter is retrieved within the controller code via the count() methode of the subject. ## When that counter reaches "threshold" (defined in the controller), the controller returns. ## ## Execute the following code to see the result. You'll find someting like this under linux : ## ##> controller waiting... 0 loops ##> controller waiting... 1 loops ##> controller waiting... 2 loops ##> controller waiting... 3 loops ##> controller waiting... 4 loops ##> controller waiting... 5 loops ##> controller waiting... 6 loops ##> controller waiting... 7 loops ##> controller waiting... 8 loops ##> controller waiting... 9 loops ##> controller waiting... 10 loops ##> controller waiting... 11 loops ##> controller waiting... 12 loops ##> controller waiting... 13 loops ##> controller waiting... 14 loops ##> controller waiting... 15 loops ##> controller waiting... 16 loops ##> controller waiting... 17 loops ##> controller waiting... 18 loops ##> controller waiting... 19 loops ##> controller waiting... 20 loops ##> controller waiting... 21 loops ##> controller waiting... 22 loops ##> controller waiting... 23 loops ##> controller waiting... 24 loops ##> controller waiting... 25 loops ##> controller waiting... 26 loops ##> controller waiting... 27 loops ##> controller waiting... 28 loops ##> controller waiting... 29 loops ##> controller waiting... 30 loops ##> controller waiting... 31 loops ##> controller waiting... 32 loops ##> controller waiting... 33 loops ##> controller waiting... 34 loops ##> controller waiting... 35 loops ##> controller waiting... 36 loops ##> controller waiting... 37 loops ##> controller waiting... 38 loops ##> controller waiting... 39 loops ##> controller waiting... 40 loops ##> controller waiting... 41 loops ##> controller waiting... 42 loops ##> controller waiting... 43 loops ##> controller waiting... 44 loops ##> controller waiting... 45 loops ##> controller waiting... 46 loops ##> controller waiting... 47 loops ##> controller waiting... 48 loops ##> controller waiting... 49 loops ## controller : limit of recursive loops reached : ## threshold 20 never reached ## Subject : the counter is now 0 ## Subject : the counter is now 1 ## Subject : the counter is now 2 ## Subject : the counter is now 3 ## Subject : the counter is now 4 ## Subject : the counter is now 5 ## Subject : the counter is now 6 ## Subject : the counter is now 7 ## Subject : the counter is now 8 ## Subject : the counter is now 9 ## Subject : the counter is now 10 ## Subject : the counter is now 11 ## Subject : the counter is now 12 ## Subject : the counter is now 13 ## Subject : the counter is now 14 ## Subject : the counter is now 15 ## Subject : the counter is now 16 ## Subject : the counter is now 17 ## Subject : the counter is now 18 ## Subject : the counter is now 19 ## Subject : the counter is now 20 ## Subject : the counter is now 21 ## Subject : the counter is now 22 ## Subject : the counter is now 23 ## Subject : the counter is now 24 ## Subject : the counter is now 25 ## Subject : the counter is now 26 ## Subject : the counter is now 27 ## Subject : the counter is now 28 ## Subject : the counter is now 29 ## Subject : the counter is now 30 ## Subject : the counter is now 31 ## Subject : the counter is now 32 ## Subject : the counter is now 33 ## Subject : the counter is now 34 ##
Re: need some help with threading module...
chahnaz.ourzikene wrote: > Hi, > > I fixed the code, it runs under Linux but not under windows 0_o ??! i guess > windows and Linux do not handle threads the same way. > > However, i don't have the result i excpect. What did you expect? This is what it did on win 2000/python 2.2.3 ##> controller waiting... 0 loops ##> controller waiting... 1 loops Subject : the counter is now 0 ##> controller waiting... 2 loops Subject : the counter is now 1 ##> controller waiting... 3 loops Subject : the counter is now 2 ##> controller waiting... 4 loops Subject : the counter is now 3 Subject : the counter is now 4 ##> controller waiting... 5 loops Subject : the counter is now 5 ##> controller waiting... 6 loops Subject : the counter is now 6 ##> controller waiting... 7 loops Subject : the counter is now 7 Subject : the counter is now 8 ##> controller waiting... 8 loops Subject : the counter is now ##> controller waiting... 9 loops 9 Subject : the counter is now 10 ##> controller waiting... 10 loops Subject : the counter is now 11 Subject : the counter is now 12 ##> controller waiting... 11 loops Subject : the counter is now 13 ##> controller waiting... 12 loops Subject : the counter is now ##> controller waiting... 13 loops 14 Subject : the counter is now 15 ##> controller waiting... 14 loops Subject : the counter is now 16 ##> controller waiting... 15 loops Subject : the counter is now 17 ##> controller waiting... 16 loops Subject : the counter is now 18 Subject : the counter is now 19 ##> controller waiting... 17 loops Subject : the counter is now 20 controller : threshold 20 reached Subject : the counter is now 21 Subject : the counter is now 22 Subject : the counter is now 23 Subject : the counter is now 24 Subject : the counter is now 25 Subject : the counter is now 26 Subject : the counter is now 27 Subject : the counter is now 28 Subject : the counter is now 29 Subject : the counter is now 30 Subject : the counter is now 31 Subject : the counter is now 32 Subject : the counter is now 33 Subject : the counter is now 34 Subject : the counter is now 35 Subject : the counter is now 36 Subject : the counter is now 37 Subject : the counter is now 38 Subject : the counter is now 39 It seems to be what you were trying to do. M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
M.E.Farmer wrote: chahnaz.ourzikene wrote: Hi, I fixed the code, it runs under Linux but not under windows 0_o ??! i guess windows and Linux do not handle threads the same way. However, i don't have the result i excpect. What did you expect? This is what it did on win 2000/python 2.2.3 ##> controller waiting... 0 loops ##> controller waiting... 1 loops Subject : the counter is now 0 [...] Subject : the counter is now 38 Subject : the counter is now 39 It seems to be what you were trying to do. Could be the OP is using Cygwin, which won't support threading by default and will give very confusing results just-a-guess-ly y'rs - steve -- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/ Holden Web LLC +1 703 861 4237 +1 800 494 3119 -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
Steve Holden wrote: [snip] >Could be the OP is using Cygwin, which won't support threading by >default and will give very confusing results Thanks Steve, Well your guess was better then mine :) I didn't know Cygwin did not support threads by default , I will have to remember that. Why do you suppose he is having problems with this on Linux? I am not on a Linux box to test it. M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
M.E.Farmer wrote: Steve Holden wrote: [snip] Could be the OP is using Cygwin, which won't support threading by default and will give very confusing results Thanks Steve, Well your guess was better then mine :) I didn't know Cygwin did not support threads by default , I will have to remember that. Why do you suppose he is having problems with this on Linux? I am not on a Linux box to test it. M.E.Farmer I believe he said it runs under Linux but not under Windows. Since you (?) showed it does work under Windows, I guessed Cygwin. regards Steve -- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/ Holden Web LLC +1 703 861 4237 +1 800 494 3119 -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
"M.E.Farmer" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] > What did you expect? This is what it did on win 2000/python 2.2.3 > ##> controller waiting... 0 loops > ##> controller waiting... 1 loops > Subject : the counter is now 0 > ##> controller waiting... 2 loops > Subject : the counter is now 1 > > > Yeah, looking to the trace i can easily say you have executed it from IDLE, because IDLE is so slow that threads can have IRQs. Try to execute it directly from a shell under windows, and you will see that the Subject thread has much more CPU time thant the Controller thread. Because Subject does his job in a loop, and have no sleep call inside its code. Controller sleeps a while to let Subject run a little on the CPU. Now try to run it under Linux directly from the shell and you'll have much more time for Subject and very less for Controler. If you run it from IDLE it can be a little more parallel. Now there's a strange behaviour on my machine when i run my script within IDLE under Windows : IDLE idles and never stops runnig !! i ran the same script from a shell and it's all perfect... Very strange.. Yacine Chaouche -- France > It seems to be what you were trying to do. > > M.E.Farmer > -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
"Steve Holden" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] > Could be the OP is using Cygwin, which won't support threading by > default and will give very confusing results > > just-a-guess-ly y'rs - steve Nice try :), but nope :). Yacine Chaouche -- France. -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help with threading module...
Yacine, I didn't run it from Idle . I don't use Idle ! I wrote my own IDE when I first started programming in Python, that is what I used(it does execute scripts from the shell ;) What you are seeing is exactly what I was talking about threads and.. dare I say it... bugs . Be sure to look at the post on c.l.py that were marked 'Problem in threading'. I am probably wrong , I am not a thread expert by any means, but I think that you are having a problem with the fact that threads can return out of order. Different OSes handle it differently. As always take it all with a grain of salt, and read more docs. Check into queue it is in the standard lib. By the way, I reread your post and still think that threads are not the way for you to go you really need to search for 'python MVC'. It may just enlighten you. M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list
Need some help to understand Python program..
Hi,,, I am very interested about the following Python program, but I am very beginner on Python.. I do not understand this algorithm,, I would appreciated if you give me this algorithm to some other popular programming language. filename="Karp.py" from __future__ import nested_scopes import bisect class _Num: def __init__(self, value, index): self.value = value self.i = index def __lt__(self, other): return self.value < other.value # This implements the Karmarkar-Karp heuristic for partitioning a set # in two, i.e. into two disjoint subsets s.t. their sums are # approximately equal. It produces only one result, in O(N*log N) # time. A remarkable property is that it loves large sets: in # general, the more numbers you feed it, the better it does. class Partition: def __init__(self, nums): self.nums = nums sorted = [_Num(nums[i], i) for i in range(len(nums))] sorted.sort() self.sorted = sorted def run(self): sorted = self.sorted[:] N = len(sorted) connections = [[] for i in range(N)] while len(sorted) > 1: bigger = sorted.pop() smaller = sorted.pop() # Force these into different sets, by "drawing a # line" connecting them. i, j = bigger.i, smaller.i connections[i].append(j) connections[j].append(i) diff = bigger.value - smaller.value assert diff >= 0 bisect.insort(sorted, _Num(diff, i)) # Now sorted contains only 1 element x, and x.value is # the difference between the subsets' sums. # Theorem: The connections matrix represents a spanning tree # on the set of index nodes, and any tree can be 2-colored. # 2-color this one (with "colors" 0 and 1). index2color = [None] * N def color(i, c): if index2color[i] is not None: assert index2color[i] == c return index2color[i] = c for j in connections[i]: color(j, 1-c) color(0, 0) # Partition the indices by their colors. subsets = [[], []] for i in range(N): subsets[index2color[i]].append(i) return subsets N = 50 import math x = [math.sqrt(i) for i in range(1, N+1)] p = Partition(x) s, t = p.run() sum1 = 0L sum2 = 0L for i in s: sum1 += x[i] for i in t: sum2 += x[i] print "Set 1 sum", repr(sum1) print "Set 2 sum", repr(sum2) print "difference", repr(abs(sum1 - sum2)) Thanks for you help... -- http://mail.python.org/mailman/listinfo/python-list
need some help in reading error message
I need some help in reading error message: which line has problem? line 233? or line 37? Thank you. $ ./read2.py log.xml Traceback (most recent call last): File "./read2.py", line 233, in ? parser.parse(open(inputFileName)) File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 109, in parse xmlreader.IncrementalParser.parse(self, source) File "/usr/lib/python2.4/site-packages/_xmlplus/sax/xmlreader.py", line 123, in parse self.feed(buffer) File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 216, in feed self._parser.Parse(data, isFinal) File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 311, in start_element self._cont_handler.startElement(name, AttributesImpl(attrs)) File "./read2.py", line 37, in startElement openTable(self, "BlockGrouperExecuter input", self.type) AttributeError: LogHandler instance has no attribute 'type' -- http://mail.python.org/mailman/listinfo/python-list
Re: need some help in reading error message
<[EMAIL PROTECTED]> wrote: > I need some help in reading error message: which line has problem? line > 233? or line 37? > > Thank you. > > $ ./read2.py log.xml > Traceback (most recent call last): > File "./read2.py", line 233, in ? > parser.parse(open(inputFileName)) > File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", > line 109, in parse > xmlreader.IncrementalParser.parse(self, source) > File "/usr/lib/python2.4/site-packages/_xmlplus/sax/xmlreader.py", > line 123, in parse > self.feed(buffer) > File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", > line 216, in feed > self._parser.Parse(data, isFinal) > File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", > line 311, in start_element > self._cont_handler.startElement(name, AttributesImpl(attrs)) > File "./read2.py", line 37, in startElement > openTable(self, "BlockGrouperExecuter input", self.type) > AttributeError: LogHandler instance has no attribute 'type' Line 37: specifically, self is an instance of LogHandler, and it does not have any attribute named "type". Alex -- http://mail.python.org/mailman/listinfo/python-list
I need some help with a regexp please
Hi, I am trying to get a regexp to validate email addresses but can't get it quite right. The problem is I can't quite find the regexp to deal with ignoring the case [EMAIL PROTECTED], which is not valid. Here's my attempt, neither of my regexps work quite how I want: [code] import os import re s = 'Hi [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] @@not [EMAIL PROTECTED] partridge in a pear tree' r = re.compile(r'[EMAIL PROTECTED]@\s]+\.\w+') #r = re.compile(r'[EMAIL PROTECTED]') addys = set() for a in r.findall(s): addys.add(a) for a in sorted(addys): print a [/code] This gives: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] <-- shouldn't be here :( [EMAIL PROTECTED] Nearly there but no cigar :) I can't see the wood for the trees now :) Can anyone suggest a fix please? Thanks, Tony -- http://mail.python.org/mailman/listinfo/python-list
I need some help with a regexp please
Hi,My $0.02:re.compile('^\w+([\.-]?\w+)[EMAIL PROTECTED]([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|intl|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$')I picked it up from the Net, and while it may be not perfect (you've got lots of reply's telling you why),it's good enough for me.Good luck,Sorin-- http://mail.python.org/mailman/listinfo/python-list
Coin-operated kiosk written in python -- need some help...
Greetings, I posted a few days back and didnt get much of a response, so I figured I would post again with more detail. I am running gnome under fedora core 4. I want a kid to be able to drop a quarter into a coin slot and get 15 minutes of time on an account that has "restricted" Internet access via the firefox web browser. We are experimenting with different ways to allow kids to safely surf the web during school hours while recovering some of the cost for bandwidth. I have written a python program that detects the coin drop and adds 15 minutes to a gui written in tkinter. The gui contains 2 buttons and the usage time. I need a way for my gui to display from machine bootup until shutdown and through multiple logins and logouts of the web browsing account. I am familiar with kiosk setups but I dont know how to code my python program to display its gui at the login screen and continue running through multiple sessions of users logging into and out of the internet acct. I thought making my kiosk program a daemon would work, but I cant get the gui to display at the login screen and then there is the problem of having the press of a button on my gui enter username and password information. Basically, I envision the following sequence of events... 1) Machine is turned on and boots up 2) My kiosk is started (maybe as a daemon) 3) The daemon uses Tkinter to display its gui with the buttons and time 4) User drops coins and time on gui is incremented 5) User presses the start button 6) My program logs the user into the Internet account 7) Secure firefox is started 8) My program starts counting down the time on the gui 9) When the time reaches 0, the user is logged out When the user presses stop on my gui, they are logged out The user can drop more coins at any time during the session to prolong the session 10) Timer resets to 0 awaiting the next customer to drop coins Any help on how to display my gui and log into an account using python would be much appreciated. Cheers -Jon -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
codefire wrote: > Hi, > > I am trying to get a regexp to validate email addresses but can't get > it quite right. The problem is I can't quite find the regexp to deal > with ignoring the case [EMAIL PROTECTED], which is not valid. Here's > my attempt, neither of my regexps work quite how I want: > > [code] > import os > import re > > s = 'Hi [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] @@not > [EMAIL PROTECTED] partridge in a pear tree' > r = re.compile(r'[EMAIL PROTECTED]@\s]+\.\w+') > #r = re.compile(r'[EMAIL PROTECTED]') > > addys = set() > for a in r.findall(s): > addys.add(a) > > for a in sorted(addys): > print a > [/code] > > This gives: > [EMAIL PROTECTED] > [EMAIL PROTECTED] > [EMAIL PROTECTED] <-- shouldn't be here :( > [EMAIL PROTECTED] > > Nearly there but no cigar :) > > I can't see the wood for the trees now :) Can anyone suggest a fix > please? > > Thanks, > Tony '[EMAIL PROTECTED](\.\w+)*' Works for me, and SHOULD for you, but I haven't tested it all that much. Good luck. -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
On 2006-09-21, codefire <[EMAIL PROTECTED]> wrote: > I am trying to get a regexp to validate email addresses but > can't get it quite right. The problem is I can't quite find the > regexp to deal with ignoring the case [EMAIL PROTECTED], > which is not valid. Here's my attempt, neither of my regexps > work quite how I want: I suggest a websearch for email address validators instead of writing of your own. Here's a hit that looks useful: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66439 -- Neil Cerutti Next Sunday Mrs. Vinson will be soloist for the morning service. The pastor will then speak on "It's a Terrible Experience." --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
codefire wrote: > Hi, > > I am trying to get a regexp to validate email addresses but can't get > it quite right. The problem is I can't quite find the regexp to deal > with ignoring the case [EMAIL PROTECTED], which is not valid. Here's > my attempt, neither of my regexps work quite how I want: > > [code] > import os > import re > > s = 'Hi [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] @@not > [EMAIL PROTECTED] partridge in a pear tree' > r = re.compile(r'[EMAIL PROTECTED]@\s]+\.\w+') > #r = re.compile(r'[EMAIL PROTECTED]') > > addys = set() > for a in r.findall(s): > addys.add(a) > > for a in sorted(addys): > print a > [/code] > > This gives: > [EMAIL PROTECTED] > [EMAIL PROTECTED] > [EMAIL PROTECTED] <-- shouldn't be here :( > [EMAIL PROTECTED] > > Nearly there but no cigar :) > > I can't see the wood for the trees now :) Can anyone suggest a fix > please? > The problem is that your pattern doesn't start out by confirming that it's either at the start of a line or after whitespace. You could do this with a "look-behind assertion" if you wanted. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
Hi, thanks for the advice guys. Well took the kids swimming, watched some TV, read your hints and within a few minutes had this: r = re.compile(r'[EMAIL PROTECTED]@\s]+\.\w+') This works for me. That is if you have an invalid email such as tony..bATblah.com it will reject it (note the double dots). Anyway, now know a little more about regexps :) Thanks again for the hints, Tony -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
codefire wrote: > Hi, > > thanks for the advice guys. > > Well took the kids swimming, watched some TV, read your hints and > within a few minutes had this: > > r = re.compile(r'[EMAIL PROTECTED]@\s]+\.\w+') > > This works for me. That is if you have an invalid email such as > tony..bATblah.com it will reject it (note the double dots). > > Anyway, now know a little more about regexps :) A little more is unfortunately not enough. The best advice you got was to use an existing e-mail address validator. The definition of a valid e-mail address is complicated. You may care to check out "Mastering Regular Expressions" by Jeffery Friedl. In the first edition, at least (I haven't looked at the 2nd), he works through assembling a 4700+ byte regex for validating e-mail addresses. Yes, that's 4KB. It's the best advertisement for *not* using regexes for a task like that that I've ever seen. Cheers, John -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
John Machin wrote: ... > A little more is unfortunately not enough. The best advice you got was > to use an existing e-mail address validator. We got bitten by this at the last place I worked - we were using a regex email validator (from Microsoft IIRC), and we kept having problems with specific email addresses from Ireland. There are stack of Irish email addresses out there of the form paddy.o'[EMAIL PROTECTED] - perfectly valid email address, but doesn't satisfy the usual naive versions of regex validators. We use an even worse validator at my current job, but the feeling the management have (not one I agree with) is that unusual email addresses, whilst perhaps valid, are uncommon enough not to worry about -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
Ant wrote: > John Machin wrote: > ... > > A little more is unfortunately not enough. The best advice you got was > > to use an existing e-mail address validator. > > We got bitten by this at the last place I worked - we were using a > regex email validator (from Microsoft IIRC), and we kept having > problems with specific email addresses from Ireland. There are stack of > Irish email addresses out there of the form paddy.o'[EMAIL PROTECTED] - > perfectly valid email address, but doesn't satisfy the usual naive > versions of regex validators. > > We use an even worse validator at my current job, but the feeling the > management have (not one I agree with) is that unusual email addresses, > whilst perhaps valid, are uncommon enough not to worry about Oh, sorry for the abbreviation. "use" implies "source from believedly reliable s/w source; test; then deploy" :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
John Machin wrote: > Ant wrote: > > John Machin wrote: > > ... > > > A little more is unfortunately not enough. The best advice you got was > > > to use an existing e-mail address validator. > > > > We got bitten by this at the last place I worked - we were using a > > regex email validator (from Microsoft IIRC) ... > Oh, sorry for the abbreviation. "use" implies "source from believedly > reliable s/w source; test; then deploy" :-) I actually meant that we got bitten by using a regex validator, not by using an existing one. Though we did get bitten by an existing one, and it being from Microsoft we should have known better ;-) -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
Yes, I didn't make it clear in my original post - the purpose of the code was to learn something about regexps (I only started coding Python last week). In terms of learning "a little more" the example was successful. However, creating a full email validator is way beyond me - the rules are far too complex!! :) -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
Dennis Lee Bieber wrote: > On 25 Sep 2006 10:25:01 -0700, "codefire" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >> Yes, I didn't make it clear in my original post - the purpose of the >> code was to learn something about regexps (I only started coding Python >> last week). In terms of learning "a little more" the example was >> successful. However, creating a full email validator is way beyond me - >> the rules are far too complex!! :) >> > > I've been doing small things in Python for over a decade now > (starting with the Amiga port)... > > I still don't touch regular expressions... They may be fast, but to > me they are just as much line noise as PERL... I can usually code a > partial "parser" faster than try to figure out an RE. > If I may add another thought along the same line: regular expressions seem to tend towards an art form, or an intellectual game. Many discussions revolving around regular expressions convey the impression that the challenge being pursued is finding a magic formula much more than solving a problem. In addition there seems to exist some code of honor which dictates that the magic formula must consist of one single expression that does it all. I suspect that the complexity of one single expression grows somehow exponentially with the number of functionalities it has to perform and at some point enters a gray zone of impending conceptual intractability where the quest for the magic formula becomes particularly fascinating. I also suspect that some problems are impossible to solve with a single expression and that no test of intractability exists other than giving up after so many hours of trying. With reference to the OP's question, what speaks against passing his texts through several simple expressions in succession? Speed of execution? Hardly. The speed penalty would not be perceptible. Conversely, in favor of multiple expressions speaks that they can be kept simple and that the performance of the entire set can be incrementally improved by adding another simple expression whenever an unexpected contingency occurs, as they may occur at any time with informal systems. One may not win a coding contest this way, but saving time isn't bad either, or is even better. Frederic -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
Frederic Rentsch wrote: > If I may add another thought along the same line: regular expressions > seem to tend towards an art form, or an intellectual game. Many > discussions revolving around regular expressions convey the impression > that the challenge being pursued is finding a magic formula much more > than solving a problem. In addition there seems to exist some code of > honor which dictates that the magic formula must consist of one single > expression that does it all. hear! hear! for dense guys like myself, regular expressions work best if you use them as simple tokenizers, and they suck pretty badly if you're trying to use them as parsers. and using a few RE:s per problem (or none at all) is a perfectly good way to get things done. -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
> for dense guys like myself, regular expressions work best if you use > them as simple tokenizers, and they suck pretty badly if you're trying > to use them as parsers. :) Well, I'm with you on that one Fredrik! :) -- http://mail.python.org/mailman/listinfo/python-list
Re: I need some help with a regexp please
> I still don't touch regular expressions... They may be fast, but to > me they are just as much line noise as PERL... I can usually code a > partial "parser" faster than try to figure out an RE. Yes, it seems to me that REs are a bit "hit and miss" - the only way to tell if you've got a RE "right" is by testing exhaustively - but you can never be sure They are fine for simple pattern matching though. -- http://mail.python.org/mailman/listinfo/python-list
RE: Coin-operated kiosk written in python -- need some help...
I've done a similar app, but it keeps a gui up awaiting a timeclock punch. You need to tackle this in phases: 1. what os and get the gui to start at bootup. 2. start a separate thread that reads/blocks on the coin. you need more specific questions to get better help -Original Message- From: Jon Monteleone [mailto:[EMAIL PROTECTED] Sent: Thursday, August 18, 2005 11:15 AM To: python-list@python.org Subject: Coin-operated kiosk written in python -- need some help... Greetings, I posted a few days back and didnt get much of a response, so I figured I would post again with more detail. I am running gnome under fedora core 4. I want a kid to be able to drop a quarter into a coin slot and get 15 minutes of time on an account that has "restricted" Internet access via the firefox web browser. We are experimenting with different ways to allow kids to safely surf the web during school hours while recovering some of the cost for bandwidth. I have written a python program that detects the coin drop and adds 15 minutes to a gui written in tkinter. The gui contains 2 buttons and the usage time. I need a way for my gui to display from machine bootup until shutdown and through multiple logins and logouts of the web browsing account. I am familiar with kiosk setups but I dont know how to code my python program to display its gui at the login screen and continue running through multiple sessions of users logging into and out of the internet acct. I thought making my kiosk program a daemon would work, but I cant get the gui to display at the login screen and then there is the problem of having the press of a button on my gui enter username and password information. Basically, I envision the following sequence of events... 1) Machine is turned on and boots up 2) My kiosk is started (maybe as a daemon) 3) The daemon uses Tkinter to display its gui with the buttons and time 4) User drops coins and time on gui is incremented 5) User presses the start button 6) My program logs the user into the Internet account 7) Secure firefox is started 8) My program starts counting down the time on the gui 9) When the time reaches 0, the user is logged out When the user presses stop on my gui, they are logged out The user can drop more coins at any time during the session to prolong the session 10) Timer resets to 0 awaiting the next customer to drop coins Any help on how to display my gui and log into an account using python would be much appreciated. Cheers -Jon -- http://mail.python.org/mailman/listinfo/python-list --- The information contained in this message may be privileged and / or confidential and protected from disclosure. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and deleting the material from any computer. --- -- http://mail.python.org/mailman/listinfo/python-list
Re: Coin-operated kiosk written in python -- need some help...
Thanks Fred, The OS I am using is linux distro fedora core 4 (RH, version 10 I think). The first question I have is exactly as you mention in 1. I need to have the gui running from machine bootup to shutdown. I wrote a bash daemon init script to turn my program into a daemon, but it doesnt seem to work. I used the standard bash daemon init script that exists in /usr/local/docs as a template. The script doesnt work correctly, so that is my first problem. But, assuming I get the script spawning my program as a daemon, the question becomes...will my Tkinter gui show up on the gnome presession screen (login screen) or do I need to add special code in .xinitrc or some other file to make it display? Your 2nd suggestion is already done. My program detects the coin drop in a separate thread. I do not have any problems running the program once I am logged into the Internet account. So, currently my specific questions are: 1) How do I make my gui display at the login screen (we can assume I get the program spawning as a daemon) 2) How do I get a push of the start button on my gui to login the user to the Internet account Cheers -Jon - Original Message - From: "Sells, Fred" <[EMAIL PROTECTED]> To: "Jon Monteleone" <[EMAIL PROTECTED]>; Sent: Friday, August 19, 2005 5:01 AM Subject: RE: Coin-operated kiosk written in python -- need some help... I've done a similar app, but it keeps a gui up awaiting a timeclock punch. You need to tackle this in phases: 1. what os and get the gui to start at bootup. 2. start a separate thread that reads/blocks on the coin. you need more specific questions to get better help -Original Message- From: Jon Monteleone [mailto:[EMAIL PROTECTED] Sent: Thursday, August 18, 2005 11:15 AM To: python-list@python.org Subject: Coin-operated kiosk written in python -- need some help... Greetings, I posted a few days back and didnt get much of a response, so I figured I would post again with more detail. I am running gnome under fedora core 4. I want a kid to be able to drop a quarter into a coin slot and get 15 minutes of time on an account that has "restricted" Internet access via the firefox web browser. We are experimenting with different ways to allow kids to safely surf the web during school hours while recovering some of the cost for bandwidth. I have written a python program that detects the coin drop and adds 15 minutes to a gui written in tkinter. The gui contains 2 buttons and the usage time. I need a way for my gui to display from machine bootup until shutdown and through multiple logins and logouts of the web browsing account. I am familiar with kiosk setups but I dont know how to code my python program to display its gui at the login screen and continue running through multiple sessions of users logging into and out of the internet acct. I thought making my kiosk program a daemon would work, but I cant get the gui to display at the login screen and then there is the problem of having the press of a button on my gui enter username and password information. Basically, I envision the following sequence of events... 1) Machine is turned on and boots up 2) My kiosk is started (maybe as a daemon) 3) The daemon uses Tkinter to display its gui with the buttons and time 4) User drops coins and time on gui is incremented 5) User presses the start button 6) My program logs the user into the Internet account 7) Secure firefox is started 8) My program starts counting down the time on the gui 9) When the time reaches 0, the user is logged out When the user presses stop on my gui, they are logged out The user can drop more coins at any time during the session to prolong the session 10) Timer resets to 0 awaiting the next customer to drop coins Any help on how to display my gui and log into an account using python would be much appreciated. Cheers -Jon -- http://mail.python.org/mailman/listinfo/python-list --- The information contained in this message may be privileged and / or confidential and protected from disclosure. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and deleting the material from any computer. --- -- http://mail.python.org/mailman/listinfo/python-list
Re: Coin-operated kiosk written in python -- need some help...
Jon Monteleone <[EMAIL PROTECTED]> wrote: > The OS I am using is linux distro fedora core 4 (RH, version 10 I think). > The first > question I have is exactly as you mention in 1. I need to have the gui > running from > machine bootup to shutdown. I wrote a bash daemon init script to turn my > program into a > daemon, but it doesnt seem to work. I used the standard bash daemon init > script that > exists in /usr/local/docs as a template. The script doesnt work correctly, > so that is my > first problem. But, assuming I get the script spawning my program as a > daemon, the > question becomes...will my Tkinter gui show up on the gnome presession screen > (login > screen) or do I need to add special code in .xinitrc or some other file to > make it > display? > So, currently my specific questions are: > 1) How do I make my gui display at the login screen (we can assume I get the > program > spawning as a daemon) Assuming Gnome and GDM as a display manager, you can access the login display by setting the environment variable XAUTHORITY=/var/lib/gdm/:0.Xauth before starting your Tkinter-script. That environment variable specifies the file where the MIT authorization cookie for the X11-session is stored. If Gdm is not used, the file is going to be somewhere else. > 2) How do I get a push of the start button on my gui to login the user to the > Internet > account I think there is some kind of support in Gdm to support auto-login, but personally I would suggest not using Gdm at all. You could start X11 separately from your script, then open your Gui on the display, and start gnome-session (with a proper userid) on the same display after the user has paid. (Though you need to be careful with security so that the user can't bypass your system.) You would propably get better advice from some Linux or Gnome -specific forums. From a Python viewpoint you basically just need to know that the python-process running your Gui can access the X authority file specified in the above mentioned environment variable. -- http://mail.python.org/mailman/listinfo/python-list
Don't use regular expressions to "validate" email addresses (was: I need some help with a regexp please)
"John Machin" <[EMAIL PROTECTED]> writes: > A little more is unfortunately not enough. The best advice you got was > to use an existing e-mail address validator. The definition of a valid > e-mail address is complicated. You may care to check out "Mastering > Regular Expressions" by Jeffery Friedl. In the first edition, at least > (I haven't looked at the 2nd), he works through assembling a 4700+ byte > regex for validating e-mail addresses. Yes, that's 4KB. It's the best > advertisement for *not* using regexes for a task like that that I've > ever seen. The best advice I've seen when people ask "How do I validate whether an email address is valid?" was "Try sending mail to it". It's both Pythonic, and truly the best way. If you actually want to confirm, don't try to validate it statically; *use* the email address, and check the result. Send an email to that address, and don't use it any further unless you get a reply saying "yes, this is the right address to use" from the recipient. The sending system's mail transport agent, not regular expressions, determines which part is the domain to send the mail to. The domain name system, not regular expressions, determines what domains are valid, and what host should receive mail for that domain. Most especially, the receiving mail system, not regular expressions, determines what local-parts are valid. -- \ "I believe in making the world safe for our children, but not | `\our children's children, because I don't think children should | _o__) be having sex." -- Jack Handey | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Don't use regular expressions to "validate" email addresses (was: I need some help with a regexp please)
Ben Finney wrote: ... > The best advice I've seen when people ask "How do I validate whether > an email address is valid?" was "Try sending mail to it". There are advantages to the regex method. It is faster than sending an email and getting a positive or negative return code. The delay may not be acceptable in many applications. Secondly, the false negatives found by a reasonable regex will be few compared to the number you'd get if the smtp server went down, or a remote relay was having problems delivering the message etc etc. >From a business point of view, it is probably more important to reduce the number of false negatives than to reduce the number of false positives - every false negative is a potential loss of a customer. False positives? Who cares really as long as they are paying ;-) -- http://mail.python.org/mailman/listinfo/python-list