| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Comments:
<ironfroggy> Eleaf: ive been walking Wolfman2000 through the implementation of a standard playing deck of cards, for a poker game he is writing. <ironfroggy> ive taken the opportunity to build code and plot for a series of python tutorials ill be writing, and maybe some future cl***es i want to look into starting. <Eleaf> cool <ironfroggy> http://deadbeefbabe.org/paste/525 <ironfroggy> Eleaf: we're using pastebin for versioning of the code :-) <Eleaf> awesome <Eleaf> can you do magic tricks with it? ;p <Wolfman2000> Don't push your luck <Eleaf> I think you probably could.. <ironfroggy> what kind of tricks? <ahmeni> 52 pickup! <Bison> anyone know where to find docs on setup.py? <ironfroggy> the internet <Bison> ... <ironfroggy> Wolfman2000: let me know when you get back, have somethings to go over. <ironfroggy> google it Bison <Bison> ...can't find it :( <ironfroggy> look for distutils documentation <Bison> okay <Bison> woohoo! <darkgreen> is PEAK or !TransWarp the way to go for AOP in python? <darkgreen> looks like PEAK. <kbrooks> what is aop? <ironfroggy> Aspect Oriented Programming <ironfroggy> the general idea as best as ive grasped is that things' behaviors are contextual to aspect in which you are using them. i dont really know what that means. <babbitt> is there a way to make a temporary file that is accessable by another application? <ironfroggy> babbitt: look at the tempfile module? <babbitt> ironfroggy, I did, it looks like everything there is completely locked down <babbitt> ironfroggy, oh..nevermind, its locked to user id, not process ID. I was wondering how they would have locked it to process ID <deltab> on unix, the tmeporary file could be deleted as soon as it's been created; then only the process with it open would have access <babbitt> yea, but I /want/ another process to have access to it :) <babbitt> but I"Ve got it now <babbitt> sorry for being stupid <cantares> how kann i break a long int in several 1 byte ints for packing it into a tupel? <sewi> hello, how to uninstall a python module after python setup.py install? <Erwin> cantares: Why would you want this? <deltab> babbitt: that's how it'd be done <deltab> cantares: is this for use on an IP address? <deltab> sewi: delete it <cantares> I habe a big tupel with around 4 million 1 byte ints, and i want to XOR that with some other data which is in my script inside a realy big long int O.o <sewi> deltab: but what if installation copied some other files than in /usr/lib/python2.4/site-modules/MODULE? <babbitt> this is wierd, I'm using XMLRPC and a string keeps getting sent back to me double-base64 encoded <deltab> cantares: why do you have that tuple? <deltab> sewi: it doesn't provide an automatic way of deleting those <cantares> cause i have read a binary file and i upacked it using the struct module into that tuple. <sewi> deltab: ok, thanks <deltab> cantares: why? <deltab> cantares: why unpack it into a tuple? <cantares> cause i don't know how to unpack it into one big int ? O.o <deltab> long(s.encode('hex')) <deltab> er <deltab> long('0x' + s.encode('hex')) <deltab> hmm, no, doesn't work <deltab> long(s.encode('hex'), 16) <kbrooks> deltab: :-) <cantares> deltab: er, i have read the file via filedata = file.read() .. so i have a 4MB string.. where in your construct should i input my var. filedata? <deltab> yes <MFen> a 4MB string sounds like a good place to have a database instead <cantares> it isn't realy a string.. it's binary data O.o <MFen> to python it's a string <cantares> file.read() just reads it in as a string.. i don't want that stuff in a string.. <MFen> either way, it sounds like a good place to have a database <cantares> so i have converted the string into aprox. 4000000 1-byte ints.. <cantares> I don't want a database O.o <MFen> what is the data? <babbitt> a really big bitmap? <cantares> compressed files. <MFen> what kind of compression? python has a zip module, gzip, prolly bzip2 <MFen> tar <cantares> that wouldn't help in my case <MFen> well, you can either use a library that gives you an abstract layer to deal with this odd file format <MFen> or you read it in as a string and parse it yourself <MFen> up to you <cantares> i don't want to extract it <MFen> what do you want to do with it? <cantares> i want to experiment a little bit with encryption <cantares> and in actual state i have a tuple with 4.000.000 1-byte-ints and a realy big long int, which i want to combine with xor O.o <CHodapp> cantares, consider using Numeric or Numarray <CHodapp> There should be modules to read and write binary formats <Jerub> cantares: to read binary data you can use struct.unpack. <Jerub> oh, not sure that's the question <ChrisLong> cantares: and you used struct.unpack? i'd have used data=array.array('B',filecontent).tolist() to get a list of unsigned chars (ints) but that is irrelevant for the moment. <cantares> Jerub: I do that, unpack gave me the 4.000.000 1byte ints <Jerub> oh, good. <ChrisLong> cantares: instead of converting the int to a tuple, did you consider converting the tuple to an int? <Jerub> cantares: so you can do something like reduce(operator.xor, mylist) now, right? <cantares> i used it in,,, filedata = struct.unpack("@" + str(len(filedata)) + "B",filedata) that way <cantares> ChrisLong: the only way i know to do that would use exzessiv processor time.. <ChrisLong> the result should be the same... except for the difference between a tuple and a list <cantares> maybe a list is more usefull? <ChrisLong> cantares: i'm not sure if it makes a big diff in cpu time to go from tupkle to int or from int to tuple <Jerub> oh, a list and a tuple are interchangable in the reduce() thing <babbitt> does base64.b64encode() have a maximum size, or is there a string maximum size? I'm trying to read in a file and am only getting a small chunk of it <ChrisLong> jerub: i think cantares wants something like [a ^ b for a,b in zip(mytuple, myint_as_tuple)] <ChrisLong> cantares: have look at http://deadbeefbabe.org/paste/535 <fserb> Any AST expert around? <fserb> I want to know two things: Should I use the parser module instead of the compiler for everything? Second, on the ast.Function cl***, why "def x(a=1,b)" and "def x(a,b=1)" returns the same parameters (how do differentiate both?) <cantares> i think it would be easier to write the stuff to a file again <ChrisLong> cantares: maybe there are better ways, but those came to my mind <cantares> ... , when both ware in tuple form <ChrisLong> how does that help with the xor'ing? <ChrisLong> or do you mean instead of putting the xor result in a list, write it to file? <cantares> i have already written a experimental code part for tupel xoring that works <cantares> no, i want to read a file, xor it with generated date and save the xor-data back into a file <cantares> date -> data <ChrisLong> i'll go now. it's nearly 2 am. i have to get some sleep <Yhg1s> fserb: 'def x(a=1,b)' is invalid Python. <Kevin_p> Anyone know of something to turn python programs into stand-alone executables? <kosh> py2exe <Kevin_p> kosh: Thank you :P <_lester_> kosh: what about in *nix? <kosh> you don't do it in unixes <Jerub> _lester_: you build a .deb or a .rpm and have Depends: Python <kosh> you just use the system python <Jerub> oh osx, you use py2app <Kevin_p> most linux distributions already come with Python anyways <Jerub> (most linux distributions use python in the installer anyways) <Jerub> ;) <_lester_> yeah I am looking for running a python program on some embedded systems... <_lester_> without proper filesystem support. :) <Jerub> _lester_: huh? <Jerub> _lester_: how can you have an embedded system without filesystem support? <kosh> the point though is that for regular unixes you don't want it all bundled together since that makes life very difficult later for upgrades <_lester_> Jerub: when u build your own... <kosh> when I do a apt-get dist-upgrade I expect that everything gets updated so I don't have to manually track changes in stuff <_lester_> kosh: yeah true. <Jerub> _lester_: okay, how can you a) be competant enough to make a workable embedded system and b) be stupid enough not to implement a real filesystem. <Kevin_p> I'm stupid enough not to do either, so HA. <Jerub> (and (c) why the hell not use a bsd or linux base anyway) <squiggly> has AES encryption been ported to python yet? <_lester_> Jerub: because I have a day job and I'm not really competant. :) <kosh> python2.4-pyopenssl <Jerub> squiggly: google says yes. <kosh> that should do AES <bsmntbombdood> squiggly: I don't know of AES written in python, that would be really slow. But there are crypto librarys that include AES <Jerub> _lester_: :) <kosh> no idea how though but it should <bsmntbombdood> squiggle: py-crypto is a good one <ahmeni> the enigma cipher is in the python STL if you're up for some oldschool encryption <squiggly> hum <Yhg1s> no, rotor was removed in 2.4 <squiggly> can anyone recommend any good vcards that run on agp 4/8? <squiggly> ;p <cantares> how is the performance ratio between well c implementet encryption and well python implented? <mykhal> I wish to p*** an instance's attribute value as the default value of an argument of the cl*** method.. something like this wrong way ... http://deadbeefbabe.org/paste/536 is there a simple way to do it ? <bsmntbombdood> cantares: probably a lot <Jerub> cantares: nearly nothing. <Jerub> cantares: because a decent python implementation of a cypto algorithm is a python module written in C! <cantares> i mean completly in python written encryption
Return to
#python or Go to some related
logs:
konverter rpm FC5 #php unknown symbol pci_pretty_name
#mysql nvclock temperature wrong #perl #lgp #linux #perl sis 760gx ubuntu
|
|