Re: toy list processing problem: collect similar terms

2010-09-26 Thread livibetter
Here is mine for Python: l = [[0, 'a', 'b'], [1, 'c', 'd'], [2, 'e', 'f'], [3, 'g', 'h'], [1, 'i', 'j'], [2, 'k', 'l'], [4, 'm', 'n'], [2, 'o', 'p'], [4, 'q', 'r'], [5, 's', 't']] d = {} for idx, items in [(e[0], e[1:]) for e in l]: d[idx] = d[idx] + items if idx in d else items print d.values()

Re: Plain simple unix timestamp with an HTTP GET

2010-06-03 Thread livibetter
I forgot to mention I redirect stderr to /dev/null, because curl returns error code 56 to me with this message "curl: (56) Failure when receiving data from the peer" On Jun 4, 11:20 am, livibetter wrote: > This? > > hwclock --utc --set --date="$(datestr="$(curlhttp

Re: Plain simple unix timestamp with an HTTP GET

2010-06-03 Thread livibetter
dary expectations. > The number is supposed to be seconds since 1900, which is just as good > as seconds since 1970. > > Still hunting. Tho' maybe getting a bit off topic for a python msg > board :) > > On Jun 3, 8:36 pm, livibetter wrote: > > > > > I don

Re: Plain simple unix timestamp with an HTTP GET

2010-06-03 Thread livibetter
I don't know what tools do you have on embedded system, but I really don't think this has to be using Python. Here is what I would do on a normal desktop using your unique way to set up time: date -s "$(curl -s -I http://example.com | grep Date | cut -d \ -f 2-)" On Jun 4, 8:05 am, Ross wro

Re: Ann: Validating Emails and HTTP URLs in Python

2010-05-04 Thread livibetter
First, it's good to see a library has URL and email validator. But I found there might be a problem in your validator, the problems I found are these URLs: http://example.com/path http://example.com/path) http://example.com/path] http://example.com/path} By my understanding from RFCs, on

Re: Bullshit Generator

2009-03-29 Thread livibetter
This is fun. I tried to add speech synthesis on Linux, hope you don't mind. If you have speech-dispatcher [1] worked normally, you can replace the main program with # -- # main program # -- try: im

Re: v = json.loads("{'test':'test'}")

2009-01-25 Thread livibetter
On Jan 26, 5:12 am, gert wrote: > raise ValueError(errmsg("Expecting property name", s, > end))http://docs.python.org/library/json.html > What am I doing wrong ? You use wrong quotes, it should be wrapped by double quotes not single quotes. Read http://json.org/: "A string is a collection of

Re: Email Validation with domain

2008-07-02 Thread livibetter
> If you want to validate the domain, do a DNS lookup on the domain or > some such. I don't think there are standard modules to provide this > functionality included with python. You could try using the socket > module, and reading up on the relevant protocols, or making calls to > external progra

Re: UpdateLayeredWindow in pywin32

2007-04-17 Thread livibetter
I have found the cause "Please note that after SetLayeredWindowAttributes has been called, subsequent UpdateLayeredWindow calls will fail until the layering style bit is cleared and set again." from http://msdn2.microsoft.com/en-us/library/ms632599.aspx#layered But I still can't use winxpgui.Upda

Re: strange behaviour with keyword arguments and inheritance

2007-04-16 Thread livibetter
On Apr 17, 8:56 am, "matthewperpick" <[EMAIL PROTECTED]> wrote: > Check out this toy example that demonstrates some "strange" behaviour > with keyword arguments and inheritance. > > = > > class Parent: > def __init__(self, ary = []): > self.ary = ary > T

UpdateLayeredWindow in pywin32

2007-04-16 Thread livibetter
us/library/ms633556.aspx UpdateLayeredWindow Function Help from pywin32: http://aspn.activestate.com/ASPN/docs/ActivePython/2.4/pywin32/win32gui__UpdateLayeredWindow_meth.html My source code: """pyitctrl - OSD""" # Created Date : 2007/03/14 # Author: livibette