Search Results

Showing results 1 to 40 of 141
Search took 0.01 seconds.
Search: Posts Made By: mn_kthompson
Forum: Python 1 Day Ago
Replies: 5
Views: 135
Posted By mn_kthompson
I don't understand why someone modded the OP down. He clearly showed effort in his homework, and has a legitimate newby question.
Forum: Python 4 Days Ago
Replies: 10
Views: 273
Posted By mn_kthompson
OK, you want the code to look in the directory you specified for the files, but you never actually specify that the program should be running in that directory. You list files from the directory,...
Forum: Python 4 Days Ago
Replies: 12
Solved: auto-update?
Views: 283
Posted By mn_kthompson
Exactly. You could use the urllib2 library to connect to a website and pull down a file with the latest version number of your software. Then compare that to the version number that you have as the...
Forum: Python 4 Days Ago
Replies: 10
Views: 273
Posted By mn_kthompson
I might be on to something for you. First I took out the print line that you have at line 24. Then I put in this statement at line 23, right before the rename happens.

temp = raw_input('about...
Forum: Python 5 Days Ago
Replies: 12
Solved: auto-update?
Views: 283
Posted By mn_kthompson
One thing you could try doing is to give the user two different programs. Prog1 is the auto updater and Prog2 is the twitter client. The user will always run prog1. Prog1 will check for a version...
Forum: Python 5 Days Ago
Replies: 6
Solved: Temperture
Views: 221
Posted By mn_kthompson
So you're going to ask the user to put in a starting temperature

start_temp = int( raw_input('Enter a temperature: ') )


Then you need to give the user some kind of menu or options

choice =...
Forum: Python 5 Days Ago
Replies: 2
Solved: __str__
Views: 142
Posted By mn_kthompson
Add this in line 12 and I think you'll see it getting called.

print "__str__ has been called."


The __str__ is called when you try to turn something that is not a string (in this case a...
Forum: Python 5 Days Ago
Replies: 2
Views: 139
Posted By mn_kthompson
I have some processes that I need to keep running on a linux host. For some reason the processes are dying (possibly being killed by another admin). I can hunt that down later, right now I need to...
Forum: Python 5 Days Ago
Replies: 5
Views: 193
Posted By mn_kthompson
CWD is the directory that your script is running in. If you want to change the CWD that your script is using, you can use os.chdir()

Line 7 of your original script would change to...
Forum: Python 5 Days Ago
Replies: 10
Views: 440
Posted By mn_kthompson
if assignment.hard or self.lazy:
submit_to_daniweb(assignment)
else:
self.DoHomework(assignment)
Forum: Python 5 Days Ago
Replies: 5
Views: 193
Posted By mn_kthompson
I think that line 14 might be your problem. Even though you ask the user for a path on line 5, you perform your renaming on the operating systems current working directory (CWD) on line 14. I think...
Forum: Python 5 Days Ago
Replies: 4
Views: 45
Posted By mn_kthompson
Another thing you can do to add to the security of the application is to add a "seed" value to the stored passwords. You store the seed value along with the password. Then when the user provides a...
Forum: Python 5 Days Ago
Replies: 4
Views: 45
Posted By mn_kthompson
One thing you might want to consider is writing the code so that the users password isn't stored in clear text. The way to do this is to hash the user's password with a cryptographic algorithm and...
Forum: Python 6 Days Ago
Replies: 5
Views: 233
Posted By mn_kthompson
I didn't even have the IDLE problems...which absolutely plagued me on Vista. Everything was great.
Forum: Python 8 Days Ago
Replies: 5
Views: 233
Posted By mn_kthompson
I have installed and run python on my Windows 7 Enterprise machine at work. I had no problems with the installer or a simple wxPython application.
Forum: Python 11 Days Ago
Replies: 9
Views: 284
Posted By mn_kthompson
LOL @Vegaseat
Forum: Python 13 Days Ago
Replies: 9
Views: 284
Posted By mn_kthompson
Oh yeah, I understand the version changes and I actually appreciate them. I'm just still trying to decide if I should start writing my classes with that object parameter or not. I'm not seeing what...
Forum: Python 13 Days Ago
Replies: 9
Views: 284
Posted By mn_kthompson
OK, I read the paper that was linked to above and the comments in this thread so far.

So back in the old days, before Python 2.3 we only had Classic Classes and we created them using this syntax
...
Forum: Python 13 Days Ago
Replies: 3
Views: 400
Posted By mn_kthompson
I guess it depends on what you mean by simplify. If you mean fewer lines of code, then yeah there are ways to simplify it.

If you mean make the code more readable so that the next person who has...
Forum: Python 13 Days Ago
Replies: 9
Views: 284
Posted By mn_kthompson
Difficult to say without more context. Is the author talking about inheritance at that point?
Forum: Python 15 Days Ago
Replies: 11
Views: 303
Posted By mn_kthompson
Have you considered looking at the source code for some other implementation of SHA1?

I took a look at the hashlib.py file (which is where python implements sha1) and it looks to me like it is...
Forum: Python 15 Days Ago
Replies: 11
Views: 303
Posted By mn_kthompson
Unfortunately I don't understand the encryption algorithm well enough to figure out where you code is going wrong.
Forum: Python 16 Days Ago
Replies: 4
Views: 222
Posted By mn_kthompson
You're probably going to want to use some recursion when you're searching through the directories. If you copy subfolders you're going to want to know if the files in the subfolders have also copied...
Forum: Python 16 Days Ago
Replies: 11
Views: 303
Posted By mn_kthompson
On my system (which is running Ubuntu linux) your code is working as expected for small files.

From the command line I created a small file using the touch command and put a small amount of data...
Forum: Python 18 Days Ago
Replies: 11
Views: 303
Posted By mn_kthompson
When you reply you should find an option to put in a link. You can also attach a file to your post so that you don't have to make a gigantic post with all of the code in it.
Forum: Python 18 Days Ago
Replies: 12
Views: 404
Posted By mn_kthompson
I've only done this one time, and I found that I had to use sys.stdout.flush() before I wrote the \b characters. Just in case you run into any problems.
Forum: Python 18 Days Ago
Replies: 11
Views: 303
Posted By mn_kthompson
You said that when you hash a string (not a file) that your algorithm and the sha1 library come back with the same results? That's awesome! You're definitely close.

What length of string are we...
Forum: Python 20 Days Ago
Replies: 3
Views: 188
Posted By mn_kthompson
What is the load_airports function? Are you sure that it is returning something into your dictionaries?
Forum: Python 20 Days Ago
Replies: 14
Views: 522
Posted By mn_kthompson
It doesn't look like you're using a dictionary. It appears that you have a list of tuples, and each tuple consists of a string and a list.

I can't think of a built in way to do this. You might...
Forum: Python 20 Days Ago
Replies: 2
Solved: Python Question
Views: 160
Posted By mn_kthompson
No,that doesn't quite work. What you would be doing is assigning the key 'Boo' to have the same value as they key 'Hoo'. The question wants you to change the value of dict1['Boo'] to 'Hoo'

>>>...
Forum: Python 20 Days Ago
Replies: 16
Solved: Pythagoras?
Views: 351
Posted By mn_kthompson
What error are you getting? It seems to run fine for me.

>>> import math
>>> def distance(p1, p2):
... return float(math.sqrt((p2-p1)**2+(p2-p1)**2))
...
>>> print distance(1,6)...
Forum: Python 24 Days Ago
Replies: 14
Solved: palindrome
Views: 399
Posted By mn_kthompson
Or you could use isalpha() like vegaseat did and stop being a chode like me.
Forum: Python 24 Days Ago
Replies: 14
Solved: palindrome
Views: 399
Posted By mn_kthompson
First of all, bravo to snippsat for a very elegant solution. I have never seen string splicing like that.

Now, how to remove the spaces and symbols? Well there is the easy inefficient way and the...
Forum: Python 25 Days Ago
Replies: 16
Views: 908
Posted By mn_kthompson
First open a file for writing

outFile = open('/home/figved/file.txt','w')


Then replace your print statement with this. I have never used BeautifulSoup so I don't know about the encoding...
Forum: Python 25 Days Ago
Replies: 14
Solved: palindrome
Views: 399
Posted By mn_kthompson
There is no built in function that I know of to check that.

On thing you might try doing is reversing the string and then comparing each element.

inString = 'racecar'
reversestring = ''
for...
Forum: Python 26 Days Ago
Replies: 8
Solved: neeed help!!!
Views: 228
Posted By mn_kthompson
Use the first code snippet that I put in my last post so that you can strip off the first and last lines of the file.

Now if you want a list that only contains the stuff in the 6th column, you...
Forum: Python 26 Days Ago
Replies: 10
Views: 459
Posted By mn_kthompson
I think both would work really well, but you'll have an easier time getting support if you're using PHP because that is a very common setup. PHP makes it really easy to grab the form fields and it...
Forum: Python 26 Days Ago
Replies: 8
Solved: simple question
Views: 306
Posted By mn_kthompson
I think Pythopian gets the award for most elegant code. That is just beautiful.
Forum: Python 26 Days Ago
Replies: 8
Solved: neeed help!!!
Views: 228
Posted By mn_kthompson
Remember, the first thing you want to do is read in the input, so start by working out that problem. Read in the file and strip off the first and last lines:

infile = open('grades1.txt','r')...
Forum: Python 27 Days Ago
Replies: 3
Views: 147
Posted By mn_kthompson
Keep in mind that vegaseat's solution will only show you when the photo was created in the filesystem. If you took the photo on a digital camera and then put it on your computer three days later,...
Showing results 1 to 40 of 141

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC