@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14



Comments:

<0> yonkeltron: use socket.inet_aton(someAddress), it does the right thing
<1> myselfhimself: ah, blender. Perhaps blender does something odd.
<2> Yhg1s i have tried in another text file
<2> and i don't have that problem anymore
<2> I should look at my code again
<2> thanks for your help
<1> myselfhimself: you have to do something _very_ odd to make 'abs' disappear. It's more likely blender is the problem.
<3> joedj: and then i can just tack the ip address onto the string i am about to send right?
<1> yonkeltron: no, you need to tack the result of socket.inet_aton() to the string.
<0> yonkeltron: the 4-byte representation of the IP address that inet_ntoa gives you, yes
<3> aha!
<3> i see it now!
<3> thank you both for your help
<3> it's all clear
<2> ok
<2> i'll solve that problem later



<2> now I have another question
<2> I define a lot of functions which I want to make belong to an object called "GameLogic"
<2> is there a quicker way to do it than : def myfunc():.... and then GameLogic.myfunc = myfunc ?
<1> myselfhimself: 'cl*** GameLogic: def myfunc(self): ...'
<2> wah
<2> ok cool : )
<1> that is, if you define the cl*** yourself.
<2> okok
<1> if you don't define the cl*** yourself, adding to it like that is probably a bad idea.
<1> but you can subcl*** and do it this way.
<1> ('cl*** MyGameLogic(GameLogic): def myfunc(self): ...')
<2> ah ok
<2> but... as long as there's no such function as that I'm creating it's ok i'm overwriting nothing right ?
<1> yes.
<1> you may want to read up on subcl***ing in your favorite tutorial.
<2> : )
<2> thank you
<3> can python generate UUIDs?
<2> good bye !!
<1> yonkeltron: Python can do anything.
<3> Yhg1s: is there a module that will make me a UUID? i know python can do anything. that's why i love it
<1> google is your friend. But here: http://zesty.ca/python/uuid.py
<3> i found that before i was just wondering if there was a module included with standard python. i checked the modindex and all....
<1> nope.
<1> but Ping's uuid module is small, and easy to use, and a drop-in.
<4> Evening all.
<4> Does anyone know of a file based ringlist ?
<5> q. i look for a way to record and play sound sumultaneously in python. where should i look ?
<6> jme___: check pygame.org
<7> jme___: shtoom can do that
<7> jme___: maybe you could look at how shtoom talks to sound devices.
<8> how can i get input from the stdin
<7> xerophyte: sys.stdin is a file-like object.
<5> TenOfTen: im cheking and it is unclear that it can record
<9> jme___: pygame is Python bindings for SDL, it can do it if your hardware supports it. There's also direct OpenAL bindings for Python.
<5> Jerub: ok thanks, will do
<5> Coke: so you confirm that pygame is able to record sound ?
<9> jme___: there's also the option of using platform specific audio like ALSA.
<9> jme___: I have never used or encountered such a use from PyGame.
<7> pygame can't record
<7> but it can play.
<7> iirc
<4> this is a ring list, http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/435902
<5> Coke: from the web site, to play sound the 'mixer' has to be used, and mixer doesnt record
<4> is there a way to save an object to a file and read it back ?
<7> maatttt: sure.
<7> pickle.
<9> jme___: i'd probably write it for ALSA or OpenAL
<9> maatttt: there are object databases if you need more advanced object persistency functionality
<7> that reminds me.
<5> coke, ok i will look in those directions
<9> jme___: remember that ALSA is Linux-only
<5> coke, is openal supported on win/mac/linux ?
<9> jme___: when I think about it, using Jack would be nice too
<5> coke, the python binding of it i means
<5> yep jack seems better to handle sound
<9> jme___: jack is very good, but it might be too big a framework for simple game audio
<9> but once your software is using jack everybody else can incorporate your software without caring about the actual source code
<5> yep i really like its flexibility
<5> not that i need it now tho :)



<5> ok shtoom does it by doing direct read/write on oss device :)
<5> not very portable too
<10> hmm
<5> at least from my rapid scan of the source :) and my shallow knowledge of python
<10> are the socket objects of the socket package thread-safe?
<9> jme___: C programmer?
<10> in the absence of a select method in the socket package, I'll be starting several threads monitoring a couple of sockets
<9> danderson: file:///usr/share/doc/python2.4-doc/html/lib/module-select.html
<1> danderson: they are thread-safe, yes, but you can still get data out-of-order in different threads.
<10> I can guarantee that only one thread will read/write on a given socket, but one thread may read while another is writing
<9> sorry, my local copy
<11> danderson: import select?
<10> oh.
<1> danderson: but select.select is what you want.
<5> coke, mostly yes. even if i did several year of asm before c, and now coding c++
<10> damn, didn't think of that :)
<9> danderson: you want the select package though
<10> Yhg1s: yah, just didn't think of import select when I didn't find socket.select() :)
<10> thanks!
<1> danderson: docs.python.org/lib is your friend ;)
<9> danderson: select works on more than just sockets
<10> Yhg1s: yeah, I have five tabs open on there :)
<9> jme___: ok, so extending Python using C (CPython) to make it work with jack should be an easy task for you.
<10> just litterally didn't think of import select. But it makes perfect sense now you've told me :)
<5> coke, despite the fact i dunno jack, nothing too hard indead, but would take time :) im looking for a rapid hack. nothing real serious
<5> it is surprising how hard it is to record a sound in a portable fashion
<5> only playing sound is easy
<5> ok thanks for your helps guy, i go back to learn python language :)
<8> what is the best way to make small menu for my script like install/uninstall ???
<9> xerophyte: GNU make
<9> xerophyte: no need for a menu, just make sure the Makefile contains some documentation on the various targets.
<12> xerophyte: Distutils also is something to look at
<8> Coke i am looking for ;) 1) install 2)uninstall 3) upgrade 4) exit .. then while loop them
<8> is there any nice way to do that
<9> xerophyte: many
<8> good one would be
<9> xerophyte: but there's no need for a menu, you can call the targets directly from the prompt
<12> xerophyte: Platform independent?
<9> i.e: make install, make whatever, etc.
<8> odl nope linux
<8> hwo can i get the case or switch kind of operation
<9> xerophyte: if: ... elif: ...
<1> or a dispatch table.
<12> xerophyte: http://docs.python.org/lib/module-distutils.html (distutils), gnumake is also a good suggestion
<1> d = {"install": do_install, "test": do_test}; d[action](args)
<1> the dispatch table is also easily created using a cl*** and getattr().
<8> Yhg1s, will that execude the function code just wondering
<8> never tried that
<9> xerophyte: why wouldn't it?
<9> Yhg1s: the downside of that is having to define functions for, possibly, unique code blocks.
<13> >>> 12/20.
<13> 0.59999999999999998
<6> geckosen1tor: welcome to the world of computers
<14> >>> 12/20
<14> 0
<6> :O
<14> ah the dot
<6> can you do more tricks?
<15> geckosen1tor: if you want to perform decimal operations, use the stdlib decimal module.
<15> >>> decimal.Decimal(12) / 20
<15> #=> Decimal("0.6")
<16> JoaoJoao: well you don't have to stick a fork in the cl*** to see if it is done ;)
<14> I don't always trust the one that is cooking :)
<17> exception ForkError:
<17> premature pentration by fork (line 28)
<16> hehe
<18> I have a function trailingSlash() that appends a "/" to strings, if they don't end with one. My current solution is http://rafb.net/paste/results/E5rW1m45.html, but I have a feeling this could be done with less code. Any ideas?
<7> don't do ==False
<7> just
<7> if pathstr.endswith('/'): return foo + '/'
<7> return foo
<7> or rather, the other way around


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #python
or
Go to some related logs:

freebsd without chsh
postgres8 sarge
#mysql
alin means
portage keep work gentoo
#ai
#web
#php
hpt374 install ubuntu
#css



Home  |  disclaimer  |  contact  |  submit quotes