User Profile

Collapse

Profile Sidebar

Collapse
spacecoyote
spacecoyote
Last Activity: Jul 12 '07, 02:14 AM
Joined: Nov 20 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • spacecoyote
    replied to Multiple Pipes (shell scripting)
    Ok...I figured it out. You have to make everything that accesses that pipe run at the same time with &.

    Kind of obvious now that I think about it :)

    [resolved]
    See more | Go to post

    Leave a comment:


  • spacecoyote
    replied to Multiple Pipes (shell scripting)
    For now I'm using the "write to a file in /tmp/" method...it works pretty good.
    See more | Go to post

    Leave a comment:


  • spacecoyote
    started a topic Multiple Pipes (shell scripting)

    Multiple Pipes (shell scripting)

    I have a script which starts out with:

    ls -lhagG | grep ^d
    ls -lhagG | grep ^-

    but I would like to be able to do something like this:

    ls -lhagG ls's output to grep ^d and then ls's output to grep ^-

    so I don't have to run ls twice. I can't find a howto I can understand. I think what I need to use is named pipes but I'm not sure.
    See more | Go to post

  • spacecoyote
    replied to Python from Scratch
    I started with the free ebook "How to Think Like a Computer Scientist - Learning With Python" and once I outgrew that, I refer only to Python's included reference manual (its very good for intermediate use but not a good start). I think you'll find Python very easy to grasp. Good luck and happy coding.
    See more | Go to post

    Leave a comment:


  • spacecoyote
    started a topic optparse: usage

    optparse: usage

    I tried this:

    Code:
    usage = "Something, by Spacecoyote\nusage: %prog file [options]"
    parser = OptionParser(usage)
    Code:
    test.py --help
    and I expected:
    Code:
    Something, by Spacecoyote
    usage: test.py file [options]
    but I got:
    Code:
    usage: Something, by Spacecoyote
    usage: test.py file [options]
    Is there an easy way to make optparse not force the usage prompt to start...
    See more | Go to post

  • spacecoyote
    replied to Know a good pickle howto?
    I figured out how to do what I wanted to do (before you guys posted :p). But I'll have a look at these.
    See more | Go to post

    Leave a comment:


  • spacecoyote
    started a topic Know a good pickle howto?

    Know a good pickle howto?

    I need to know how to use pickle (and its brethren) correctly. Does anyone know of a good tutorial? The python manual is a bit too dense on this subject.
    See more | Go to post

  • spacecoyote
    replied to What is your OS and Python Version
    Ubuntu Dapper:
    Python 2.4
    gedit

    Windows XP:
    Python 2.5 (don't really use it right now)
    Python 2.4 (I need it for pygame)
    IDLE

    Linux on Gamepark Holdings' GP2X handheld:
    A weird build of python 2.4, not by me. I wish to later make a better one.
    See more | Go to post

    Leave a comment:


  • spacecoyote
    replied to Beyond "Self"
    Well, I've found another more useful way to do it.

    But there are cases where it is necessary to have a class inside a class.

    In pygame, for example, to make a sprite you make a class which inherits pygame.sprite.S prite and then overload whatever you need to (ie __init__).

    Then you have your functions which are inside a class (becuase programs are separated into subprograms which are separted into functions,...
    See more | Go to post

    Leave a comment:


  • spacecoyote
    started a topic Beyond "Self"

    Beyond "Self"

    Hello,

    I have a class inside a class. I want to set a variable "rect" in that class "textrender " to the value of a variable "rect" in the parent class "textbox". I don't know how to do this.

    Code:
    class textbox(pygame.sprite.Sprite): 		# Textbox class
    			
    	def __init__(self):
    			
    		rect=*something*
    				
    	class textrender(pygame.sprite.Sprite):
    ...
    See more | Go to post

  • spacecoyote
    replied to bitshifting help
    Hooray! It works. Thank you :)...
    See more | Go to post

    Leave a comment:


  • spacecoyote
    replied to bitshifting help
    r = c >> 11 works and
    b = c & 0x001f works,
    g is the tough one......
    See more | Go to post

    Leave a comment:


  • spacecoyote
    replied to bitshifting help
    Hmm...

    43039 =
    1010100000011111

    so:

    r=10101=21
    g=000000=0
    b=11111=31...
    See more | Go to post

    Leave a comment:


  • spacecoyote
    replied to bitshifting help
    Unfortunately, that doesn't seem to work :(

    If I substitute (for example) the value 43039, r, g, and b still equal 31, so it apparently only works for 65535......
    See more | Go to post

    Leave a comment:


  • spacecoyote
    started a topic bitshifting help

    bitshifting help

    Okay, so I have a 16 bit positive value (0-65535) representing a color in 565 RGB notation, that is 5 bits for red, 6 bits for green, and 5 bits for blue.

    I need to separate the red, green, and blue values out so I may give them to a function that takes red, green, and blue values separately.

    So, thinking back to C, I figured I could use bitshifts. But when I do, it appears the bits wrap around. So is this even possible...
    See more | Go to post
No activity results to display
Show More
Working...