User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
DaniWeb is a massive community of 373,878 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,015 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Showing results 1 to 40 of 500
Search took 0.04 seconds.
Posts Made By: jrcagle
Forum: Python 7 Days Ago
Replies: 1
Views: 83
Posted By jrcagle
Re: subtype custom 'float'. How to?

I would probably take a completely different approach:


class MyFloat(float):

def __new__(self, name, value):
return float.__new__(self, value)

def __init__(self, name, value):
...
Forum: Python 9 Days Ago
Replies: 1
Views: 94
Posted By jrcagle
Re: receive bytes streams

The function "unpack" is not a built-in function. Does your code import some module at the top?

Jeff
Forum: Python 11 Days Ago
Replies: 16
Views: 401
Posted By jrcagle
Re: If <not number>?

Or this:


try:
val = int(item)
if val > 0:
do stuff for positive numbers
elif val < 0:
do stuff for negative numbers
else: # don't omit zero!
Forum: Python 12 Days Ago
Replies: 4
Views: 201
Posted By jrcagle
Forum: Python 15 Days Ago
Replies: 8
Views: 188
Posted By jrcagle
Re: subscript and superscript help!

Good news: the convention for scientific notation

2.72e-2 (which is the correct rendering)

is so well-recognized that superscripting is not required.

Jeff
Forum: Python 15 Days Ago
Replies: 2
Views: 201
Posted By jrcagle
Re: Class getters and setters

Just to jlm's good points above, the getter and setter functions allow the object to control access to its own data members.

For instance, suppose you have a sprite that can rotate. Clearly, if the...
Forum: Python 15 Days Ago
Replies: 4
Views: 201
Posted By jrcagle
Re: Spoken (raw_) input?

Search this forum for posts by Seagull One. She has gotten a lot of this code working.

Jeff
Forum: Python 15 Days Ago
Replies: 2
Views: 397
Posted By jrcagle
Re: How to send broadcast message over network and collect all the IPaddress?

There are a couple of bugs that jump out at me.

First, notice that you remove the "serverlist.txt" file each time a server message is received. So naturally, only the last server that broadcasts...
Forum: Python 15 Days Ago
Replies: 5
Views: 253
Posted By jrcagle
Re: Memory Error

WRT to the main problem, the memory error, I agree that there's something wrong, and it doesn't appear to be your code.

You might try e-mailing the PIL support at

image-sig@python.org

Jeff
Forum: Python 15 Days Ago
Replies: 5
Views: 253
Posted By jrcagle
Re: Memory Error

Well, a quick tangential note: your method for extracting the extension

name[-4:]

is buggy. What if the file extension is ".jpeg"?

Better:


filename, ext = os.path.splitext(name)
Forum: Python 16 Days Ago
Replies: 1
Views: 99
Posted By jrcagle
Re: Pygame

Well, that depends. Do you want to end up coding games? If so, then start!

http://www.pygame.org/news.html

The "tutorials" link on the left should be helpful

Jeff
Forum: Python 28 Days Ago
Replies: 3
Views: 278
Posted By jrcagle
Re: Getting groups a user is part of from AD

I would try to contact Tim Golden. At first glance, it looks like his AD module doesn't handle Unicode properly (though I might be mistaken about this)

Jeff
Forum: Python Jun 5th, 2008
Replies: 2
Views: 183
Posted By jrcagle
Re: keys problem

Well, that question may not have an answer if the values are not unique; for example, if

book['key1'] = {'keya':valuea, 'keyb':valueb}

and

book['key2'] = {'keya':valuec, 'keyd':valued}

then...
Forum: Python Jun 4th, 2008
Replies: 5
Views: 198
Posted By jrcagle
Re: Surely there's a better way?

If you are determined to iterate through the original list ... and there are times when that's appropriate ... then you must iterate through a copy of the list:


>>> nums = [1.0,2.0,3.0,4.0,5.0]
>>>...
Forum: Python Jun 4th, 2008
Replies: 4
Views: 219
Posted By jrcagle
Re: Total newbie, please help with python classes

Well, the usual procedure here is to start with your code. Post it here and then we can give pointers and such.

Jeff
Forum: Python Jun 3rd, 2008
Replies: 4
Views: 255
Posted By jrcagle
Re: Replace a column by its IDs from another file

Absolutely. You need ... dictionaries.


store_dict = {}
f1 = open("ITEMS.txt")
for line in f1:
store, item = line.strip("/n").split(" ")
store_dict[store] = item
f1.close()
Forum: Python Jun 3rd, 2008
Replies: 2
Views: 240
Posted By jrcagle
Re: Can't hear PMIDI

Is there a chance that the sound is playing on the wrong sound device? I have two sound cards (built in and recording equipment), and sometimes my software gets confused.

Jeff
Forum: Python Jun 3rd, 2008
Replies: 1
Views: 235
Posted By jrcagle
Re: pymssql reconnect to db if connection dies

Seems to me that this line ought to be an error...


c=Cursor()


because you then try to execute commands on it ... but it's not assigned to any database, right?

Maybe I'm misunderstanding.
Jeff
Forum: Python Jun 3rd, 2008
Replies: 2
Views: 152
Posted By jrcagle
Re: how can i increase the visibility of dialogs and windows...

What do you mean by "increasing the look"? If you just want to make it more visible, you could set border colors to hot pink or something...

Jeff
Forum: Python Jun 3rd, 2008
Replies: 5
Views: 306
Posted By jrcagle
Re: Need help converting temperature, using classes

You're experiencing the imprecisions of computer arithmetic -- it happens in any language and is the combined result of base 2 arithmetic AND the impossibility of writing repeating decimals with a...
Forum: Python May 29th, 2008
Replies: 1
Views: 201
Posted By jrcagle
Re: Network help

Yes, the standard way of writing a shell (which is what you are doing) is like this:


while True:
inputline = raw_input(myprompt)
parse inputline into command, operands
if command ==...
Forum: Python May 29th, 2008
Replies: 1
Views: 115
Posted By jrcagle
Re: Question about Crap Game

What you've done is to make the game itself into your main code. If you think about it, that's not what you want. The main loop here is


playerscore = housescore = 0
while user wants to play:
...
Forum: Python May 29th, 2008
Replies: 1
Views: 150
Posted By jrcagle
Re: battleships

First, please use the tags to enclose your code. That will preserve your indentation.

More importantly, your code:

The first thing that strikes me is that your Tank1() and Tank2() classes contain...
Forum: Python May 27th, 2008
Replies: 2
Views: 222
Posted By jrcagle
Re: problems with pygame

The appropriate code tags are


## code here


What's happening? I'm guessing that the sound plays, but then the code hangs after that?

Jeff
Forum: Python May 27th, 2008
Replies: 4
Views: 253
Posted By jrcagle
Re: python network simulator

No, I think it's clear enough. class Network should inherit from object, though. Only old-style classes get to be parent-less.

class Network(object):
...

Jeff
Forum: Python May 26th, 2008
Replies: 5
Views: 306
Posted By jrcagle
Re: Need help converting temperature, using classes

I would recommend re-ordering your class a bit, if you have the freedom to do so:


class Temperature(object):
def __init__(self, temp):

def toCelcius(self):

def toRankine(self):
Forum: Python May 25th, 2008
Replies: 8
Views: 404
Posted By jrcagle
Re: Running a program by double-click (windows)

OK, wait. In your source code directory, you have

myprog.pyw
myprog.pyc

Yes?

What happens if you double-click "myprog.pyw"?
Forum: Python May 25th, 2008
Replies: 1
Views: 169
Posted By jrcagle
Re: If and Else

That code won't work. Here's why:

"or" doesn't mean "one of these" in Python, or any other computing language. Instead, "or" means "True if one or both operands is True; False if both are...
Forum: Python May 25th, 2008
Replies: 8
Views: 404
Posted By jrcagle
Re: Running a program by double-click (windows)

Two things:

(1) I can double-click on your program and get a nice little Hello, World window, along with the command-prompt window. Do you get something else?

(2) If you manually rename the file...
Forum: Python May 25th, 2008
Replies: 7
Views: 374
Posted By jrcagle
Re: Removing everything inbetween '<>'

OK, so give an idea of what the tag looks like, and we might be able to help.

Jeff
Forum: Python May 25th, 2008
Replies: 8
Views: 404
Posted By jrcagle
Re: Running a program by double-click (windows)

Actually, it probably does something and then closes the window immediately -- which means you can't see it!

Try this:


print "Hello, World"
raw_input("Press <Enter> to exit.")


If you...
Forum: Python May 25th, 2008
Replies: 7
Views: 374
Posted By jrcagle
Re: Removing everything inbetween '<>'

well, you might consider the BeautifulSoup module.

link:

http://www.crummy.com/software/BeautifulSoup/

It has the capability to extract tags and values relatively easily.

Jeff
Forum: Python May 24th, 2008
Replies: 6
Views: 339
Posted By jrcagle
Re: turtle.setup(width=800,height=600,startx=400,starty=300)

It looks like your turtle module is not correctly installed. The error message means that there is no 'turtle.setup', which clearly should not be the case.

I recommend either (a) reinstalling...
Forum: Python May 24th, 2008
Replies: 6
Views: 339
Posted By jrcagle
Re: turtle.setup(width=800,height=600,startx=400,starty=300)

It worked for me. What result are you getting?

Jeff

P.S. eliminate the spaces between "code = Python" to get your tag to work.
Forum: Python May 24th, 2008
Replies: 2
Views: 233
Posted By jrcagle
Re: keep os.chdir() after exit?

Your code would have to have its own configuration file that it stores the default directory in and then loads on entry.

Jeff
Forum: Python May 24th, 2008
Replies: 1
Views: 185
Posted By jrcagle
Re: Batch files and termination of program

It can be due to any exception whatsoever. To find out, you'll need to isolate the offending lines.

I often run my code through IDLE, which prints exceptions. There might be another solution that...
Forum: Python May 24th, 2008
Replies: 4
Views: 209
Posted By jrcagle
Re: cube texture problem

Sorry, not an OpenGL user.
Forum: Python May 24th, 2008
Replies: 2
Views: 193
Posted By jrcagle
Re: Varible change Detection

There's a second way to think about this as well, and it's well adapted to real-time operating systems (read: robotics).

Suppose you have a speaker object, a listener object, and a thinker object...
Forum: Python May 24th, 2008
Replies: 2
Views: 193
Posted By jrcagle
Re: Varible change Detection

what about


class MySpeechParser(...):
self.topic = "Dinosaurs"
sentence = self.GetSentence()
topic = self.DiscernTopic(sentence)
if topic != self.topic:
speaker.Speak("You...
Forum: Python May 24th, 2008
Replies: 1
Views: 202
Posted By jrcagle
Re: Working on a little program

I'm sorry ... I'm really unclear about the rules of this game.

I notice a couple of things that you can streamline.

* The lines


del shots[8:]
return shots
Showing results 1 to 40 of 500

 
All times are GMT -4. The time now is 3:48 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC