Re: [Tutor] Python installtion

2019-01-13 Thread Stephen Nelson-Smith
Hi, On Mon, Jan 7, 2019 at 11:11 AM mousumi sahu wrote: > > Dear Sir, > I am trying to install python 2.7.10 on HPC. Python 2.6 has already been > install on root. I do not have root authority. Please suggest me how can I > do this. Sorry - I replied to you directly, by accident. Take 2, with r

Re: [Tutor] Debugging a sort error.

2019-01-13 Thread Stephen Nelson-Smith
Hi, On Sun, Jan 13, 2019 at 8:34 AM wrote: > description.sort() > TypeError: unorderable types: float() < str() So, fairly obviously, we can't test whether a float is less than a string. Any more than we can tell if a grapefruit is faster than a cheetah. So there must be items in description

[Tutor] Sorting a list of list

2015-06-05 Thread Stephen Nelson-Smith
As part of my league secretary program (to which thread I shall reply again shortly), I need to sort a list of lists. I've worked out that I can use sorted() and operator.itemgetter to sort by a value at a known position in each list. Is it possible to do this at a secondary level? So if the ite

Re: [Tutor] League Secretary Application

2015-05-30 Thread Stephen Nelson-Smith
Hullo, On Sat, May 30, 2015 at 3:49 PM, Laura Creighton wrote: > > 2. How do you receive your data now? Do you want to change this, > perhaps extend the capabilities -- i.e. let people send an sms > with results to your cell phone? Or limit the capabilities ("Stop > phoning me wit

[Tutor] League Secretary Application

2015-05-30 Thread Stephen Nelson-Smith
Hello, I'm the league secretary for a table tennis league. I have to generate a weekly results report, league table, and player averages, from results cards which arrive by post or email. The data is of the form: Division: 1 Week: 7 Home: Some Team Away: Different Team Player A: Fred Bloggs Pla

Re: [Tutor] Ideas for Child's Project

2015-01-07 Thread Stephen Nelson-Smith
Hi Danny, On Tue, Jan 6, 2015 at 10:07 PM, Danny Yoo wrote: > On Tue, Jan 6, 2015 at 1:46 PM, Stephen Nelson-Smith > wrote: > > You might want to look at Bootstrapworld, a curriculum for > middle-school/high-school math using programming and games: > > http://w

[Tutor] Ideas for Child's Project

2015-01-06 Thread Stephen Nelson-Smith
Hello, My son is interested in programming, and has dabbled in Scratch and done a tiny bit of Python at school. He's 11 and is going for an entrance exam for a selective school in a couple of weeks. They've asked him to bring along something to demonstrate an interest, and present it to them. I

[Tutor] Making Regular Expressions readable

2010-03-08 Thread Stephen Nelson-Smith
uot; % (lines,) print "There were %s lines with missing Site Intelligence cookies." % (no_cookies,) It works fine, but it looks pretty unreadable and unmaintainable to anyone who hasn't spent all day writing regular expressions. I remember reading about verbose regular expressi

[Tutor] Modules and Test Suites

2009-12-29 Thread Stephen Nelson-Smith
f not, is there a better way than having all the tests in the same place as the rest of the code? S. -- Stephen Nelson-Smith Technical Director Atalanta Systems Ltd www.atalanta-systems.com ___ Tutor maillist - Tutor@python.org To unsubscribe or c

[Tutor] Trying to send a URL via XMPP

2009-12-10 Thread Stephen Nelson-Smith
gt;> xmlns='http://www.w3.org/1999/xhtml'>>> href='http://rt.sekrit.org.uk/rt3/Ticket/Display.html?id=#77'>Ticket #77 >>> updated.")) But every time I just receive the raw html Any idea what I am doing wrong? S. -- Stephen Nelson-Smith Technic

[Tutor] Monitoring a logfile

2009-12-01 Thread Stephen Nelson-Smith
Varnish has a dedicated (but not always) reliable logger service. I'd like to monitor the logs - specifically I want to check that a known entry appears in there every minute (it should be there about 10 times a minute). What's going to be the best way to carry out this kind of check? I had a lo

Re: [Tutor] Iterable Understanding

2009-11-23 Thread Stephen Nelson-Smith
Martin, >    def __iter__(self): >        while True: >            for logline in self.logfile: >                heappush(self.heap, (timestamp(logline), logline)) >                if len(self.heap) >= self.jitter: >                    break >            try: >                yield heappop(self.he

[Tutor] Replace try: except: finally:

2009-11-20 Thread Stephen Nelson-Smith
ot;Disconnecting from %s..." % denormalize(key), connections[key].close() if state.output.status: print "done." How should I replace this? S. -- Stephen Nelson-Smith Technical Director Atalanta

[Tutor] Why are these results different?

2009-11-19 Thread Stephen Nelson-Smith
I'm seeing different behaviour between code that looks to be the same. It obviously isn't the same, so I've misunderstood something: >>> log_names ('access', 'varnish') >>> log_dates ('20091105', '20091106') >>> logs = itertools.chain.from_iterable(glob.glob('%sded*/%s*%s.gz' % >>> (source_dir,

[Tutor] Readable date arithmetic

2009-11-18 Thread Stephen Nelson-Smith
I have the following method: def get_log_dates(the_date_we_want_data_for): t = time.strptime(the_date_we_want_data_for, '%Y%m%d') t2 = datetime.datetime(*t[:-2]) extra_day = datetime.timedelta(days=1) t3 = t2 + extra_day next_log_date = t3.strftime('%Y%m%d') return (the_date_we_want_da

[Tutor] Use of 'or'

2009-11-17 Thread Stephen Nelson-Smith
A friend of mine mentioned what he called the 'pythonic' idiom of: print a or b Isn't this a 'clever' kind or ternary - an if / else kind of thing? I don't warm to it... should I? S. ___ Tutor maillist - Tutor@python.org To unsubscribe or change sub

Re: [Tutor] Do you use unit testing?

2009-11-16 Thread Stephen Nelson-Smith
ons? > > Just looking for input and different angles on the matter, from the > Python community. > -Modulok- > ___ > Tutor maillist  -  tu...@python.org > To unsubscribe or change subscription options: > http://mail.python.org/ma

Re: [Tutor] proxy switcher - was Re: I love python / you guys :)

2009-11-16 Thread Stephen Nelson-Smith
Evening, > Yes, you can, but not this way.  I'm guessing the op was changing his mind > back and forth, between having two files, one for reading and one for > writing, and trying to do it in place.  The code does neither/both. Well, just neither I think! I didn't check if 'rw' was possible. My

Re: [Tutor] proxy switcher - was Re: I love python / you guys :)

2009-11-16 Thread Stephen Nelson-Smith
Hi, >> When i use our company's LAN i set my proxy variable by hand in .bashrc. >> There are 4 files to insert proxy variable: >> >> in ~/.bashrc, /root/.bashrc, /etc/wgetrc and /etc/apt/apt.conf. >> >> The last one is actually rename e.g. mv to apt.conf to activate proxy and mv >> to apt.conf.bak

Re: [Tutor] I love python / you guys :)

2009-11-16 Thread Stephen Nelson-Smith
Hello all, On Mon, Nov 16, 2009 at 6:58 AM, Stefan Lesicnik wrote: > hi, > > Although not a question, i just want to tell you guys how awesome you are! +1 I've been a happy member of this list for years, even though I've taken a 3 year Ruby sabbatical! I've always found it to be full of invalu

[Tutor] GzipFile has no attribute '__exit__'

2009-11-16 Thread Stephen Nelson-Smith
I'm trying to write a gzipped file on the fly: merged_log = merge(*logs) with gzip.open('/tmp/merged_log.gz', 'w') as output: for stamp, line in merged_log: output.write(line) But I'm getting: Traceback (most recent call last): File "./magpie.py", line 72, in with gzip.open('

Re: [Tutor] Iterable Understanding

2009-11-15 Thread Stephen Nelson-Smith
Hi Marty, Thanks for a very lucid reply! > Well, you haven't described the unreliable behavior of unix sort so I > can only guess, but I assume you know about the --month-sort (-M) flag? Nope - but I can look it up. The problem I have is that the source logs are rotated at 0400 hrs, so I need t

Re: [Tutor] Unexpected iterator

2009-11-15 Thread Stephen Nelson-Smith
> To upack your variables a and b you need an iterable object on the right > side, which returns you exactly 2 variables What does 'unpack' mean? I've seen a few Python errors about packing and unpacking. What does it mean? S. ___ Tutor maillist - T

Re: [Tutor] Iterable Understanding

2009-11-15 Thread Stephen Nelson-Smith
Hi Martin, Thanks for a very detailed response. I'm about to head out, so I can't put your ideas into practice yet, or get down to studying for a while. However, I had one thing I felt I should respond to. > It's unclear from your previous posts (to me at least) -- are the > individual log file

[Tutor] Should a beginner learn Python 3.x

2009-11-14 Thread Stephen Nelson-Smith
for him to work through - I must stress he has absolutely no clue at all about programming, no education beyond 16 yrs old, but is keen to learn. S. -- Stephen Nelson-Smith Technical Director Atalanta Systems Ltd www.atalanta-systems.com ___ Tutor mail

Re: [Tutor] Iterable Understanding

2009-11-14 Thread Stephen Nelson-Smith
Hi Wayne, > Just write your own merge: > (simplified and probably inefficient and first thing off the top of my head) > newlist = [] > for x, y, z in zip(list1, list2, list3): I think I need something like izip_longest don't I, since the list wil be of varied length? Also, where do these lists c

Re: [Tutor] Iterable Understanding

2009-11-14 Thread Stephen Nelson-Smith
Gah! Failed to reply to all again! On Sat, Nov 14, 2009 at 1:43 PM, Stephen Nelson-Smith wrote: > Hi, >> I'm not 100% sure to understand your needs and intention; just have a try. >> Maybe what you want actually is rather: >> >> for log in logs: >>  for l

Re: [Tutor] Iterable Understanding

2009-11-14 Thread Stephen Nelson-Smith
Hi, >> for log in logs: >>  l = log.getline() >>  print l >> >> This gives me three loglines.  How do I get more?  Other than while True: >> > I presume that what you want is to get all lines from each log. Well... what I want to do is create a single, sorted list by merging a number of other sor

[Tutor] Iterable Understanding

2009-11-13 Thread Stephen Nelson-Smith
I think I'm having a major understanding failure. So having discovered that my Unix sort breaks on the last day of the month, I've gone ahead and implemented a per log search, using heapq. I've tested it with various data, and it produces a sorted logfile, per log. So in essence this: logs = [

[Tutor] Iterator Merging

2009-11-11 Thread Stephen Nelson-Smith
. I've got the iterator merger in place too: >>> from imerge import imerge >>> imerge >>> imerge([1,3,4],[2,7]) >>> list(imerge([1,3,4],[2,7])) [1, 2, 3, 4, 7] What I'm trying to work out is how to feed the data I have - 6 streams of timestamp, ent

Re: [Tutor] Logfile multiplexing

2009-11-11 Thread Stephen Nelson-Smith
Hi, On Wed, Nov 11, 2009 at 10:05 AM, Alan Gauld wrote: > "Stephen Nelson-Smith" wrote >> >> I don't really want to admit defeat and have a cron job sort the logs >> before entry.  Anyone got any other ideas? > > Why would that be admitting defeat? Wel

Re: [Tutor] Logfile multiplexing

2009-11-11 Thread Stephen Nelson-Smith
Hi Kent, > See the Python Cookbook recipes I referenced earlier. > http://code.activestate.com/recipes/491285/ > http://code.activestate.com/recipes/535160/ > > Note they won't fix up the jumbled ordering of your files but I don't > think they will break from it either... That's exactly the probl

Re: [Tutor] Logfile multiplexing

2009-11-10 Thread Stephen Nelson-Smith
On Tue, Nov 10, 2009 at 3:59 PM, Stephen Nelson-Smith wrote: > On Tue, Nov 10, 2009 at 3:48 PM, Stephen Nelson-Smith > wrote: > >> OK, so now i've given it the full load of logs: >> >>>>> for time, entry in kent.logs: >> ...   print time, e

Re: [Tutor] Logfile multiplexing

2009-11-10 Thread Stephen Nelson-Smith
On Tue, Nov 10, 2009 at 3:48 PM, Stephen Nelson-Smith wrote: > OK, so now i've given it the full load of logs: > >>>> for time, entry in kent.logs: > ...   print time, entry > ... > Traceback (most recent call last): >  File "", line 1, in ? > Va

Re: [Tutor] Logfile multiplexing

2009-11-10 Thread Stephen Nelson-Smith
Hello, On Tue, Nov 10, 2009 at 2:00 PM, Luke Paireepinart wrote: > >> Traceback (most recent call last): >>  File "", line 1, in ? >>  File "kent.py", line 11, in __iter__ >>    if stamp.startswith(date): >> NameError: global name 'date' is not defined >> >> How does __iter__ know about date?  Sh

Re: [Tutor] Logfile multiplexing

2009-11-10 Thread Stephen Nelson-Smith
Hi, > probably that line should have been " ".join(line.split()[3:5]), i.e. > no self. The line variable is a supplied argument. Now I get: Python 2.4.3 (#1, Jan 21 2009, 01:11:33) [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2 Type "help", "copyright", "credits" or "license" for more inform

Re: [Tutor] Logfile multiplexing

2009-11-10 Thread Stephen Nelson-Smith
Hi Kent, > One error is that the initial line will be the same as the first > response from getline(). So you should call getline() before trying to > access a line. Also you may need to filter all lines - what if there > is jitter at midnight, or the log rolls over before the end. Well ultimatel

[Tutor] Logfile multiplexing

2009-11-10 Thread Stephen Nelson-Smith
I have the following idea for multiplexing logfiles (ultimately into heapq): import gzip class LogFile: def __init__(self, filename, date): self.logfile = gzip.open(filename, 'r') for logline in self.logfile: self.line = logline self.stamp = self.timest

Re: [Tutor] Logfile Manipulation

2009-11-09 Thread Stephen Nelson-Smith
On Mon, Nov 9, 2009 at 3:15 PM, Wayne Werner wrote: > On Mon, Nov 9, 2009 at 7:46 AM, Stephen Nelson-Smith > wrote: >> >> And the problem I have with the below is that I've discovered that the >> input logfiles aren't strictly ordered - ie there is variance b

Re: [Tutor] Logfile Manipulation

2009-11-09 Thread Stephen Nelson-Smith
lly fast enough, with potentially 12 other files Hrm... S. On Mon, Nov 9, 2009 at 1:35 PM, Stephen Nelson-Smith wrote: > Hi, > >> If you create iterators from the files that yield (timestamp, entry) >> pairs, you can merge the iterators using one of these recipes: >&

Re: [Tutor] Logfile Manipulation

2009-11-09 Thread Stephen Nelson-Smith
105.gz","[05/Nov/2009"),LogFile("c/access_log-20091105.gz","[05/Nov/2009")] while True: print [x.stamp for x in logs] nextline=min((x.stamp,x) for x in logs) print nextline[1].getline() -- Stephen Nelson-Smith Technical Director Atalanta Systems Ltd www.

Re: [Tutor] Logfile Manipulation

2009-11-09 Thread Stephen Nelson-Smith
Hi, >> Any advice or experiences? >> > > go here and download the pdf! > http://www.dabeaz.com/generators-uk/ > Someone posted this the other day, and I went and read through it and played > around a bit and it's exactly what you're looking for - plus it has one vs. > slide of python vs. awk. > I

Re: [Tutor] Logfile Manipulation

2009-11-09 Thread Stephen Nelson-Smith
Sorry - forgot to include the list. On Mon, Nov 9, 2009 at 9:33 AM, Stephen Nelson-Smith wrote: > On Mon, Nov 9, 2009 at 9:10 AM, ALAN GAULD wrote: >> >>> An apache logfile entry looks like this: >>> >>>89.151.119.196 - - [04/Nov/2009:04:02:10 +] &q

Re: [Tutor] Logfile Manipulation

2009-11-09 Thread Stephen Nelson-Smith
On Mon, Nov 9, 2009 at 8:47 AM, Alan Gauld wrote: > I'm not familiar with Apache log files so I'll let somebody else answer, > but I suspect you can either use string.split() or a re.findall(). You might > even be able to use csv. Or if they are in XML you could use ElementTree. > It all depends

[Tutor] Logfile Manipulation

2009-11-08 Thread Stephen Nelson-Smith
ll, awk etc in a big pipeline? The shell script kills the CPU * What's the best way to extract the data for a given time, eg - 2359 yesterday? Any advice or experiences? S. -- Stephen Nelson-Smith Technical Director Atalanta Systems Ltd www.atalanta-systems.com

[Tutor] CSS Minification

2009-11-02 Thread Stephen Nelson-Smith
Is there a Python CSS and/or javascript minifier available? I've got to convert some ant scripts to python, and ant has a minifier plugin that I need to replicate. Maybe Beautiful Soup can do this? S. -- Stephen Nelson-Smith Technical Director Atalanta Systems Ltd www.atalanta-system

[Tutor] Not Storing State

2009-02-27 Thread Stephen Nelson-Smith
Hi, This is both a general question and a specific one. I want to iterate over a bunch of lines; If any line contains a certain string, I want to do something, otherwise do something else. I can store state - eg line 1 - did it contain the string? no.. ok we're cool, next line But, I'd like

Re: [Tutor] Capturing and parsing over telnet

2008-11-30 Thread Stephen Nelson-Smith
Hi, > I effectively want something like c.read_everything() Looks like read_very_eager() does what I want. S. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Capturing and parsing over telnet

2008-11-30 Thread Stephen Nelson-Smith
Hi, > How about pexpect; > http://www.noah.org/wiki/Pexpect Ah yes - I've used that before to good effect. ATM I'm playing with telnetlib. Is there a way to read everything on the screen, even if I don't know what it will be? eg: c = telnetlib.Telnet("test.lan") c.read_until("name: ") c.write(

[Tutor] Capturing and parsing over telnet

2008-11-30 Thread Stephen Nelson-Smith
I want to write a program that connects to a TCP port using telnet, and issues commands, parsing the output the command provides, and then issuing another command. This might look like this: $ telnet water.fieldphone.net 7456 Welcome to water, enter your username >_ sheep Enter your password >_ s

[Tutor] Short Contract

2008-09-08 Thread Stephen Nelson-Smith
Hello, I'm looking for someone to help on a short contract to build a centralised blogging system. I want a planet-style aggregation of blogs, but with the ability to see and make comments on each individual blog, from the central planet page. Ideally, it would also have a little 'icon' mug-shot

[Tutor] Init Scripts

2008-07-04 Thread Stephen Nelson-Smith
Hello, I've been wrestling with some badly written init scripts, and picking my way through the redhat init script system. I'm getting to the point of thinking I could do this sort of thing in Python just as effectively. Are there any pointers available? Eg libraries that give process informati

Re: [Tutor] Web Stats

2008-06-11 Thread Stephen Nelson-Smith
Hello, >> This has to include resources which have not been visited, as the >> point is to clean out old stuff. > > Take a look at AWStats (not Python). Doesn't this 'only' parse weblogs? I'd still need some kind of spider to tell me all the possible resources available wouldn't I? It's a big

[Tutor] Web Stats

2008-06-11 Thread Stephen Nelson-Smith
Hi, I've been asked to produce a report showing all possible resources in a website, together with statistics on how frequently they've been visited. Nothing fancy - just number and perhaps date of last visit. This has to include resources which have not been visited, as the point is to clean ou

[Tutor] Sending Mail

2008-04-22 Thread Stephen Nelson-Smith
smtpserver = 'relay.clara.net' RECIPIENTS = ['[EMAIL PROTECTED]'] SENDER = '[EMAIL PROTECTED]' message = """Subject: HTTPD ALERT: %s requests %s connections Please investigate ASAP.""" % (rps, connections) session = smtplib.SMTP(smtpserver) smtpresult = session.sendmail(SENDER, RECIPIENTS, messag

Re: [Tutor] HTML Parsing

2008-04-22 Thread Stephen Nelson-Smith
Hello, > For data this predictable, simple regex matching will probably work fine. I thought that too... Anyway - here's what I've come up with: #!/usr/bin/python import urllib, sgmllib, re mod_status = urllib.urlopen("http://10.1.2.201/server-status";) status_info = mod_status.read() mod_st

Re: [Tutor] HTML Parsing

2008-04-21 Thread Stephen Nelson-Smith
Hi, > for lineno, line in enumerate(html): -Epython2.2hasnoenumerate() Can we code around this? > x = line.find("requests/sec") > if x >= 0: >no_requests_sec = line[3:x] >break > for lineno, line in enumerate(html[lineno+1:]): > x = line.find("requests currently being processed"

Re: [Tutor] HTML Parsing

2008-04-21 Thread Stephen Nelson-Smith
On 4/21/08, Andreas Kostyrka <[EMAIL PROTECTED]> wrote: > As usual there are a number of ways. > > But I basically see two steps here: > > 1.) capture all dt elements. If you want to stick with the standard > library, htmllib would be the module. Else you can use e.g. > BeautifulSoup or somethi

[Tutor] HTML Parsing

2008-04-21 Thread Stephen Nelson-Smith
Hi, I want to write a little script that parses an apache mod_status page. I want it to return simple the number of page requests a second and the number of connections. It seems this is very complicated... I can do it in a shell one-liner: curl 10.1.2.201/server-status 2>&1 | grep -i request |

[Tutor] [OT] Vacancy - python systems programmer

2007-11-15 Thread Stephen Nelson-Smith
All, I may shortly be in the position of being able to hire a python systems programmer for a short contract (1-2 days initially to spike an ongoing project). The ideal person will have the following: * Solid experience of Python for systems programming and database interaction * Familiarity wit

Re: [Tutor] NNTP Client

2007-11-13 Thread Stephen Nelson-Smith
On Nov 13, 2007 4:01 PM, Stephen Nelson-Smith <[EMAIL PROTECTED]> wrote: > >>> server = NNTP('news.gmane.org') > > What's wrong with that then? server, apparently:>>> s.group("gmane.discuss") ('211 11102 10 11329 gmane.disc

Re: [Tutor] NNTP Client

2007-11-13 Thread Stephen Nelson-Smith
On Nov 13, 2007 2:13 PM, Stephen Nelson-Smith <[EMAIL PROTECTED]> wrote: > ought it to be straightforward to write a client that does this task? Well: >>> server = NNTP('news.gmane.org') >>> resp, count, first, last, name = server.group("gmane.linux.re

[Tutor] NNTP Client

2007-11-13 Thread Stephen Nelson-Smith
Hello all, I wish to pull all the articles for one particular newsgroup to a local machine, on a regular basis. I don't wish to read them - I will be parsing the contents programatically. In your view is it going to be best to use an 'off-the-shelf' news reader, or ought it to be straightforward

[Tutor] VIX API

2007-10-11 Thread Stephen Nelson-Smith
Hello, Does anyone know if there are python bindings for the VMware VIX API? I googled for a bit, but didn't find them... How tricky would it be to wrap the C API? S. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tuto

Re: [Tutor] Fwd: Permission Report

2007-10-10 Thread Stephen Nelson-Smith
On 10/10/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > Stephen Nelson-Smith wrote: > > But if I want to run the same procedure on a remote host, and store > > the results in a dictionary so they can be compared, what would I do? > > What kind of access do you have to t

[Tutor] Fwd: Permission Report

2007-10-08 Thread Stephen Nelson-Smith
Sorry... -- Forwarded message -- From: Stephen Nelson-Smith <[EMAIL PROTECTED]> Date: Oct 8, 2007 6:54 PM Subject: Re: [Tutor] Permission Report To: Alan Gauld <[EMAIL PROTECTED]> On 10/8/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > Yes, os.walk and os.st

[Tutor] Permission Report

2007-10-07 Thread Stephen Nelson-Smith
Hello all, I have a tree of code on a machine which has been tweaked and fiddled with over several months, and which passes tests. I have the same codebase in a new virtual machine. A shell hack[0] shows me that the permissions are very different between the two. I could use rsync or something

Re: [Tutor] uncomprehension on RE

2007-09-20 Thread Stephen Nelson-Smith
On 9/20/07, cedric briner <[EMAIL PROTECTED]> wrote: > To let you know, I'm writing a script to generate bind9 configuration > from a nis hosts table. So I was trying in a one re to catch from this: > > [ ...] [# comment] > e.g: > 10.12.23.45 hostname1 alias1 alias2 alias3 # there is a nice com

Re: [Tutor] Finding even and odd numbers

2007-09-19 Thread Stephen Nelson-Smith
On 9/19/07, Boykie Mackay <[EMAIL PROTECTED]> wrote: > Hi guys, > > I have come across a bit of code to find if a group of numbers is odd or > even.The code snippet is shown below: > > if not n&1: > return false > > The above should return false for all even numbers,numbers being > represented

Re: [Tutor] uncomprehension on RE

2007-09-19 Thread Stephen Nelson-Smith
On 9/19/07, cedric briner <[EMAIL PROTECTED]> wrote: > Hello, > > I do not understand the behaviour of this: > > import re > re.search('(a)*','aaa').groups() > ('a',) > > I was thinking that the ``*'' will operate on the group delimited by the > parenthesis. And so, I was expecting this result: > (

Re: [Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

2007-09-19 Thread Stephen Nelson-Smith
On 9/19/07, Michael Langford <[EMAIL PROTECTED]> wrote: > I do think this is a good question for getting a sense of where a > person's understanding is. I wonder how much this understanding is a > pre-requistite for being a good developer... not too much I hope! > > A good developer is a very load

Re: [Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

2007-09-18 Thread Stephen Nelson-Smith
Michael Langford wrote: > Inheritance: Syntactic sugar that's not really needed to make a well > organized system. Often overused, especially by programmers in big > companies, beginning students of programmers, green engineers, and > professors. In practice hides a lot of data, often making behav

[Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

2007-09-18 Thread Stephen Nelson-Smith
Hello friends, Over lunch today some colleagues discussed a question they are using as a conversation starter in some preliminary chats in our developer hiring process. The question was: "Place the following three in order: Inheritance, Polymorphism, Encapsulation." They specifically did not de

Re: [Tutor] [OT] Urgent Help Needed

2007-06-06 Thread Stephen Nelson-Smith
On 6/6/07, Tim Golden <[EMAIL PROTECTED]> wrote: > You might want to mention the database (or databases) in > question. Given the short timeframes, people'd feel more > confident if it was the system they're familiar with. Sorry yes. We have an old (primitive) accounts system, which is basically

[Tutor] [OT] Urgent Help Needed

2007-06-06 Thread Stephen Nelson-Smith
Hello friends, I urgently need to get hold of someone who can help me with the closing stages of a database project - porting data from an old system to a completely rewritten schema. My lead developer has suffered a bereavement, and I need a SQL expert, or programmer who could accomplish the por

[Tutor] [OT] ETL Tools

2007-03-29 Thread Stephen Nelson-Smith
Hello all, Does anyone know of any ETL (Extraction, Transformation, Loading) tools in Python (or at any rate, !Java)? I have lots (and lots) of raw data in the form of log files which I need to process and aggregate and then do a whole bunch of group-by operations, before dumping them into text/r

Re: [Tutor] Parsing Word Docs

2007-03-09 Thread Stephen Nelson-Smith
On 3/8/07, Tim Golden <[EMAIL PROTECTED]> wrote: > Simplest thing's probably antiword (http://www.winfield.demon.nl/) > and then whatever text-scanning approach you want. I've gone for: #!/usr/bin/env python import glob, os url = "/home/cherp/prddoc" searchstring = "dxpolbl.p" worddocs = [] f

Re: [Tutor] How do to an svn checkout using the svn module?

2007-03-09 Thread Stephen Nelson-Smith
On 3/9/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > Did you find the pysvn Programmer's Guide that comes with pysvn? It has > this example: Ah.. no I haven't got pysvn installed... but will take a look. What I do have is: >>> import sys >>> import svn.core >>> import svn.client >>> import

[Tutor] How do to an svn checkout using the svn module?

2007-03-09 Thread Stephen Nelson-Smith
Hello, I want to do a simple svn checkout using the python svn module. I haven't been able to find any/much/basic documentation that discusses such client operations. This should be very easy, I imagine! What do I need to do? S. ___ Tutor maillist -

[Tutor] Parsing Word Docs

2007-03-08 Thread Stephen Nelson-Smith
Hello all, I have a directory containing a load of word documents, say 100 or so. which is updated every hour. I want a cgi script that effectively does a grep on the word docs, and returns each doc that matches the search term. I've had a look at doing this by looking at each binary file and re