[Tutor] Windows Domain Authentication
Dear Tutors, I am about to start on a project that would reuse Windows Domain Authentication over XML-RPC in python. This may involve the rewrite of the XML-RPC client and server. Could someone point me in the right direction so that I can run from there. Cheers, Jacob Abraham __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Functional Programming
Also, much as I like python, it's not really suited to functional programming I'd modify that to say its not ideally suited to FP, but an FP style is certainly possible. Pyhon is adequate to learn the principles but it would be nearly impossible to write a real world solution using pure FP in Python. That said, functional programming is fun, and these days probably the best introductions are either SML books or Haskell. Or good old Lisp. And there are lots of good introductory tutorials for Lisp whereas the FP material tends to be very math oriented, if you don't have a strong math background it simply won't make much sense. I also think that having an understanding of functional programming will generally improve someone's code, but I would suggest that learning the ideas in a language where functional programming is the norm rather the exception is a good idea. The come back to python, and learn to undo your recursive instincts! This is good advice if you want more than just an appreciation of the concepts. If you want to try writing a real world application using FP then definitely try Lisp, ML or Haskell. But be prepared for a completely different division of your time over the project, much more time up front thinking about the specification of the problem, much less time debugging the functionality (the same amount of time debugging the detailed code though!) Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Windows Domain Authentication
Jacob Abraham wrote: I am about to start on a project that would reuse Windows Domain Authentication over XML-RPC in python. This may involve the rewrite of the XML-RPC client and server. Could someone point me in the right direction so that I can run from there. I'm not at all sure what you are asking for. Are you writing an XML-RPC system that authenticates clients via Windows Domain Auth, or an authorization server that exposes an XML-RPC API? Do you want to rewrite the XML-RPC client and server from the standard lib? If so the source for them is in C:\Python24\Lib or the equivalent (see xmlrpclib.py and SimpleXMLRPCServer.py). Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Windows Domain Authentication
Hi Kent I am trying to write a XML-RPC system that authenticates clients via Windows Domain Auth. I just wanted to know how best to go about doing this, since I come from a Linux background and am not familiar with the win32 API. I've just started looking at named pipes as a possible solution. Thanks. Jacob Abraham __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Logical Sorting
Hi, I am trying to sort a list of directories that correspond to kernel sources under /usr/src/linux. I wrote some code that gets a list like this: ['linux-2.6.9-gentoo-r4', 'linux-2.6.16-gentoo-r11/', 'linux-2.6.16-gentoo-r7/'] When I sort the list, I want it to go from oldest (lowest version) to newest, so the sorted list should look like this: ['linux-2.6.9-gentoo-r4', 'linux-2.6.16-gentoo-r7/', 'linux-2.6.16-gentoo-r11/'] The problem is that since the built in string comparisons compare character by character, so the sort puts 2.6.16 before 2.6.9, and -r11 before -r7. This is obviously not what I want. My question is: are there any modules or built in methods that will do a logical sort on a list like this, and sort it the way I want, or will I have to write my own sorting function? -- Evan Klitzke P.S. I know that the simplest way is just to use ls to sort by time, but it is not necessarily true that older kernel versions have an older time stamp :-) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Logical Sorting
On 7/7/06, Evan Klitzke [EMAIL PROTECTED] wrote: Hi, I am trying to sort a list of directories that correspond to kernel sources under /usr/src/linux. Err, this is under /usr/src... not that it is really pertinent to my question. -- Evan Klitzke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Is implicit underscore assignment documented?
Is implicit underscore assignment documented anywhere? I've seen reference to this, and it seems to be simply that, when Python interactively prints a value in response to a user entering an expression, that value is assigned to the variable _. As far as I can tell, the following transcript shows its workings: ActivePython 2.4.3 Build 12 (ActiveState Software Inc.) based on Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. _ Traceback (most recent call last): File stdin, line 1, in ? NameError: name '_' is not defined a = 0 _ Traceback (most recent call last): File stdin, line 1, in ? NameError: name '_' is not defined a 0 _ 0 a = 5 _ 0 a 5 _ 5 a = 5 _ 0 a 5 _ 5 #value unchanged, because a's value was not printed (the interpreter does not print None). ... a = 10 print a 10 _ 5 # value unchanged, because print is a statement, not an expression. ... Is this documented anywhere? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Logical Sorting
Evan Klitzke wrote: Hi, I am trying to sort a list of directories that correspond to kernel sources under /usr/src/linux. I wrote some code that gets a list like this: ['linux-2.6.9-gentoo-r4', 'linux-2.6.16-gentoo-r11/', 'linux-2.6.16-gentoo-r7/'] When I sort the list, I want it to go from oldest (lowest version) to newest, so the sorted list should look like this: ['linux-2.6.9-gentoo-r4', 'linux-2.6.16-gentoo-r7/', 'linux-2.6.16-gentoo-r11/'] The problem is that since the built in string comparisons compare character by character, so the sort puts 2.6.16 before 2.6.9, and -r11 before -r7. This is obviously not what I want. My question is: are there any modules or built in methods that will do a logical sort on a list like this, and sort it the way I want, or will I have to write my own sorting function? You don't have to write your own sorting function. You do have to write a function that extracts a key from a data item that will sort in the order you want. Here is a version that uses a regular expression to extract the four fields from the data, converts the numbers to integers, and returns a tuple of values that sorts correctly. It works with the data you show but it probably needs tweaks to be more robust, for example it will fail if the version is not three numbers or if the -rxx is missing. In [1]: data = ['linux-2.6.9-gentoo-r4', 'linux-2.6.16-gentoo-r11/', 'linux-2.6.16-gentoo-r7/'] In [2]: import re In [3]: def makeKey(entry): ...: m=re.search(r'-(\d+)\.(\d+)\.(\d+)-[^-]+-r(\d+)', entry) ...: if not m: return entry ...: return map(int, m.group(1, 2, 3, 4)) ...: In [4]: data.sort(key=makeKey) In [5]: data Out[5]: ['linux-2.6.9-gentoo-r4', 'linux-2.6.16-gentoo-r7/', 'linux-2.6.16-gentoo-r11/'] Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] how to post an event?
Hello, I am having a bit of trouble figuring out how to post an event. I attached my sample program. I assigned a button event to each button in the program. I want to post an event when the second button is pressed that executes the first button. thanks.Jeff Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.#!/usr/bin/env python #Boa:App:BoaApp import wx import Frame1 modules ={'Frame1': [1, 'Main frame of Application', 'Frame1.py']} class BoaApp(wx.App): def OnInit(self): wx.InitAllImageHandlers() self.main = Frame1.create(None) self.main.Show() self.SetTopWindow(self.main) return True def main(): application = BoaApp(0) application.MainLoop() if __name__ == '__main__': main() #Boa:Frame:Frame1 import wx def create(parent): return Frame1(parent) [wxID_FRAME1, wxID_FRAME1BUTTON1, wxID_FRAME1BUTTON2, ] = [wx.NewId() for _init_ctrls in range(3)] class Frame1(wx.Frame): def _init_coll_boxSizer1_Items(self, parent): # generated method, don't edit parent.AddWindow(self.button2, 1, border=10, flag=wx.ALL | wx.GROW) parent.AddWindow(self.button1, 1, border=10, flag=wx.ALL | wx.GROW) def _init_sizers(self): # generated method, don't edit self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL) self._init_coll_boxSizer1_Items(self.boxSizer1) self.SetSizer(self.boxSizer1) def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt, pos=wx.Point(467, 234), size=wx.Size(324, 386), style=wx.DEFAULT_FRAME_STYLE, title='Frame1') self.SetClientSize(wx.Size(316, 359)) self.button1 = wx.Button(id=wxID_FRAME1BUTTON1, label='button1', name='button1', parent=self, pos=wx.Point(10, 189), size=wx.Size(296, 159), style=0) self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button, id=wxID_FRAME1BUTTON1) self.button2 = wx.Button(id=wxID_FRAME1BUTTON2, label='button2', name='button2', parent=self, pos=wx.Point(10, 10), size=wx.Size(296, 159), style=0) self.button2.Bind(wx.EVT_BUTTON, self.OnButton2Button, id=wxID_FRAME1BUTTON2) self._init_sizers() def __init__(self, parent): self._init_ctrls(parent) def OnButton1Button(self, event): print 'hello' def OnButton2Button(self, event): event.Skip() what do I do here to post an event that executes 'OnButton1Button()' ? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Logical Sorting
On Fri, 2006-07-07 at 10:09 -0700, Evan Klitzke wrote: Hi, I am trying to sort a list of directories that correspond to kernel sources under /usr/src/linux. I wrote some code that gets a list like this: ['linux-2.6.9-gentoo-r4', 'linux-2.6.16-gentoo-r11/', 'linux-2.6.16-gentoo-r7/'] When I sort the list, I want it to go from oldest (lowest version) to newest, so the sorted list should look like this: ['linux-2.6.9-gentoo-r4', 'linux-2.6.16-gentoo-r7/', 'linux-2.6.16-gentoo-r11/'] The problem is that since the built in string comparisons compare character by character, so the sort puts 2.6.16 before 2.6.9, and -r11 before -r7. This is obviously not what I want. My question is: are there any modules or built in methods that will do a logical sort on a list like this, and sort it the way I want, or will I have to write my own sorting function? There is an rpm-python package that probably includes much of what you want. I have it installed, but never used it. It appears to be pretty light on documentation. I expect it is a python wrapper to a C library. You may find it easier to simply pick apart your data and sort the numbers numerically than wrestle with learning this package unless you have other RPM related tasks. -- Evan Klitzke P.S. I know that the simplest way is just to use ls to sort by time, but it is not necessarily true that older kernel versions have an older time stamp :-) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Logical Sorting
I did a Google search for python numeric sort and found http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/135435 It seems to do what you want. Marc --- Evan Klitzke [EMAIL PROTECTED] wrote: Hi, I am trying to sort a list of directories that correspond to kernel sources under /usr/src/linux. I wrote some code that gets a list like this: ['linux-2.6.9-gentoo-r4', 'linux-2.6.16-gentoo-r11/', 'linux-2.6.16-gentoo-r7/'] When I sort the list, I want it to go from oldest (lowest version) to newest, so the sorted list should look like this: ['linux-2.6.9-gentoo-r4', 'linux-2.6.16-gentoo-r7/', 'linux-2.6.16-gentoo-r11/'] The problem is that since the built in string comparisons compare character by character, so the sort puts 2.6.16 before 2.6.9, and -r11 before -r7. This is obviously not what I want. My question is: are there any modules or built in methods that will do a logical sort on a list like this, and sort it the way I want, or will I have to write my own sorting function? -- Evan Klitzke P.S. I know that the simplest way is just to use ls to sort by time, but it is not necessarily true that older kernel versions have an older time stamp :-) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Logical Sorting [Off-Topic]
On Fri, 2006-07-07 at 10:09 -0700, Evan Klitzke wrote: Hi, I am trying to sort a list of directories that correspond to kernel sources under /usr/src/linux. I wrote some code that gets a list like this: ['linux-2.6.9-gentoo-r4', 'linux-2.6.16-gentoo-r11/', 'linux-2.6.16-gentoo-r7/'] When I sort the list, I want it to go from oldest (lowest version) to newest, so the sorted list should look like this: ['linux-2.6.9-gentoo-r4', 'linux-2.6.16-gentoo-r7/', 'linux-2.6.16-gentoo-r11/'] The problem is that since the built in string comparisons compare character by character, so the sort puts 2.6.16 before 2.6.9, and -r11 before -r7. This is obviously not what I want. My question is: are there any modules or built in methods that will do a logical sort on a list like this, and sort it the way I want, or will I have to write my own sorting function? -- Evan Klitzke P.S. I know that the simplest way is just to use ls to sort by time, but it is not necessarily true that older kernel versions have an older time stamp :-) Or use ‘ls -v’. (I said it's “off topic” on the subject, sorry! It might escaped you, but ‘ls’ _does_ have a proper sort by version.) Ziyad. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Is implicit underscore assignment documented?
On Fri, 7 Jul 2006, Terry Carroll wrote: As far as I can tell, the following transcript shows its workings: Orri has privately pointed out to me that I have a copy-paste error in the transcript; but that aside, my question still is: Is this documented anywhere? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor