Posts
 
Reputation
Joined
Last Seen
Ranked #138
Strength to Increase Rep
+12
Strength to Decrease Rep
-3
97% Quality Score
Upvotes Received
230
Posts with Upvotes
198
Upvoting Members
109
Downvotes Received
6
Posts with Downvotes
6
Downvoting Members
6
48 Commented Posts
4 Endorsements
Ranked #397
Ranked #83
~563.43K People Reached
About Me

Programmer since 1991 - extensive C++ experience (at Rogue Wave Software) - Java experience (Various web service companies) - recent expertise: Python (Mozilla: Socorro project) - MySql and Postgresql at the 'informed non-expert' level I also do shell…

Interests
Reading, contradance, music: Jazz, classical, instrumental folk, ethnic
PC Specs
I've always used some flavor of Unix/Linux. Currently OS/X.
Favorite Tags
Member Avatar for amrutraj

Just a small warning that you have to be careful not to create an ever increasing herd of spiders when you start spawning them in multiple threads or processes. As with robots.txt, you have responsibilities to the community (and a contract with your ISP)

Member Avatar for musawir_2
0
279
Member Avatar for Shift_

[QUOTE=britanicus;1545317]Here is your problem: [CODE] choice = input("ENTER CHOICE: ") [/CODE] Changing 'input' to 'raw_input' will solve your problem. You must probably try this to know the difference: [CODE] >>> input( "Enter something: " ) 5 5 >>> input( "Enter something else: " ) britanicus Traceback (most recent call last): …

Member Avatar for TAJUL ISLAM_1
0
10K
Member Avatar for griswolf

I'm writing a utility that will likely be called by a script that uses `argparse`, but should be useable by any script. The engine object constructor needs a dozen or so parameters to tune its behavior. The question is: What is the best way to allow the caller to send …

Member Avatar for JamesCherrill
0
305
Member Avatar for ppel123

My very first thought is that what you want to do is extremely annoying: You're grabbing the keystream away from the user right while the user is still typing. That's why word processors typically don't do that; they simply mark the (probable) error and let the user do the correction …

Member Avatar for griswolf
0
383
Member Avatar for tjsilver

Another way: Break from the loop immediately when [iCODE]choice == '5'[/iCODE] Another way: [icode]eval("sys.exit(0)")[/icode] for choice 5 I would prefer, though: add[CODE]def func_5(): print 'quitting' [/CODE] and do the obvious thing on line 16

Member Avatar for August.Garcia
0
3K
Member Avatar for samaru

Most of the code I've written doesn't count as a 'program' because I've mostly worked down among the gears and grease, making libraries or writing other utility code. (or testing...). Some high(low)lights:[list] [*]Commercial grade: hash table, B-tree, and a rewrite of a B-tree-on-disk (simple database). Fun, useful and hard because …

Member Avatar for Fest3er
0
3K
Member Avatar for rahulrajcse

The first step in solving that problem is to know what the problem is. I know of at least three different problems that mention a monkey and a banana. One involves a hanging banana, a monkey and a tool of some kind. One involves a banana behind a barrier and …

Member Avatar for Adarsh_4
0
6K
Member Avatar for Fo.katia

The function named "raw_input" in Python 2.x is named "input" in Python 3.x . Since you did not specify what version of Python you use (until your last post), people were naturally confused. More so since many many more Python 2.x users than 3.x.

Member Avatar for woooee
0
13K
Member Avatar for Tickon

From personal preference (not raw utility), I find PHP to be ugly, arcane and difficult. It is, as noted, nearly ubiquitous, free, powerful and has lots of available packages. [B]mysql_real_escape_string()[/B] is probably not the best way to deal with incoming data, though it works. Better, in my opinion, to use …

Member Avatar for Janet_4
0
346
Member Avatar for pasta
Member Avatar for Sudo Bash

Consider using [URL="http://linux.die.net/man/3/gettimeofday"]gettimeofday()[/URL] which keeps track of seconds and microseconds since the epoch. To compare them, subtract the two fields individually, then multiply one (or divide the other) and add the differences; then convert as needed.

Member Avatar for Yangang
0
4K
Member Avatar for Tenck

Hmm. First check: Is script1.py a pure text file? If not, there's the problem. Otherwise: Windows or unix-like system? [LIST] [*]If unix-like try chanting [icode]python [I]full/path/to/script[/I][/icode] where that full path might be [icode]./script1.py[/icode] [*]If Windows, try the same sort of thing with the slashes tilted the other way [/LIST] If …

Member Avatar for rproffitt
0
2K
Member Avatar for pwolf

If you need to write your own instead of using strftime/strptime, the right answer is probably [URL="http://docs.python.org/library/re.html"]regular expressions[/URL] Regular expression syntax is tricky if you don't already know it (and sometimes, if you do). [CODE] import re timeS = r'(?P<hour>[01]?\d):(?P<minute>[0-5]\d) *((?P<am>[Aa]\.?[Mm].?)|(?P<pm>[Pp]\.?[Mm]\.?)) timeRE = re.compile(timeS) # ... get somestring "some how" …

Member Avatar for Abhinav_4
0
3K
Member Avatar for vegaseat

I prefer to send the quit condition as a second argument to the list entry function. That way, if you need 'q' as a valid list member, you can use something else to stop the loop (also works better for folks whose language does not use a 'q' word to …

Member Avatar for vegaseat
23
34K
Member Avatar for vjcagay

The one that will best solve your [B]current[/B] (or maybe your [B]next[/B]) problem. As everybody above points out (more or less directly): They all suck sometimes, and they are all Turing Complete, so whatever can be computed, you can describe the program in any of them.

Member Avatar for vegaseat
-1
4K
Member Avatar for frankinaround

Start emacs. Type M-x doctor (escape, x, space, "doctor"). You want something like that. Now go look at the lisp code and do it in python. [QUOTE]I am the psychotherapist. Please, describe your problems. Each time you are finished talking, type RET twice. >> I am trying to write an …

Member Avatar for magnus.wootton
0
395
Member Avatar for mappersas

Actually, I think mappersas should do the work. Suggest: Look at the [URL="http://docs.python.org/library/numeric.html"]numeric and math package for python[/URL]. With that plus the javascript code that I found with a quick google search: [url]http://www.movable-type.co.uk/scripts/latlong.html#rhumb[/url] , you should be able to get the result very easily.

Member Avatar for Peter_21
0
6K
Member Avatar for lovebird_huby

For a (ba)sh script I'd look at (g)awk, which allows you to write little functions based on a regex match. You can set (global) variables within the functions, and you can check their values which gives you something resembling a state machine.

Member Avatar for griswolf
0
183
Member Avatar for tubs1

Pick a programming language. One language. Python is a good choice, but there are many other good choices. Then do some tutorials in that language. When you get stuck, ask (here) for help with what you ran up against. Be sure to show what work you have done.

Member Avatar for ~s.o.s~
0
264
Member Avatar for iamsmooth

http://en.wikipedia.org/wiki/Benchmark_%28computing%29#Open_source_benchmarks (less than 30 seconds to use Google, decide on Wikipedia, find the Open Source section. Another minute or so to write this reply)

Member Avatar for griswolf
0
289
Member Avatar for nano72

Please use the (CODE) button Please tell us specifically what "won't parse the options" means. Do you get options that are incorrect? Does the script run, but no options are seen? What?

Member Avatar for cfajohnson
0
738
Member Avatar for taekgo
Member Avatar for Dunkler

They all use the Sieve of Eratosthenes one way or another. Here's one for future consideration that uses the [icode]yield[/icode] keyword in a generator that always yields the next prime. On my mac, it found 10,000 primes in about 5 seconds, but took about 85 seconds to find 20,000. It …

Member Avatar for Ashley_4
0
208
Member Avatar for zeeters

Think about the flow of logic: Why are you asking the user for a new pair of words on every line? Shouldn't you do that at the top, then just use them in the loop? Here's a function that (almost) returns the line that is manipulated, but if there are …

Member Avatar for zeeters
0
3K
Member Avatar for hughesadam_87

I see no need to make the deep copy. Pick an attr, save its value, try to change it, then if it changed, put back the original. But I'm with lrh9: A function that does two different things is an odd duck: The code that calls it cannot depend on …

Member Avatar for hughesadam_87
0
4K
Member Avatar for bigstorm

There is one further consideration: Both fields of study are difficult and time consuming: Unless you are brilliant or/and have much better study habits than most, you will need longer to finish such a double major than most students. Where I attended school, both degrees were in the Engineering department; …

Member Avatar for editorawais
0
242
Member Avatar for blaine.rogers.14

This is not the most efficient or tight code, but it works. In particular, the function `populate(...)` could be shorter. In a real world situation `populate()` should raise a useful error if the files aren't found or aren't as expected (many more lines of code) I have also deliberately made …

Member Avatar for blaine.rogers.14
0
258
Member Avatar for Baka_Kuma

Agile is a way of thinking about requirements, then creating what is needed. Agile practice doesn't even need to be about coding a program, it can be used for any requirements about any product, though programming is the place it is most used. There is no part of Agile development …

Member Avatar for griswolf
0
281
Member Avatar for GrimJack

You can't remember why you came into this room, you can't remember what you were doing before you came in, and you are pretty sure this has happened at least once already today. Or maybe yesterday...

Member Avatar for vinnitro
1
3K
Member Avatar for aint

You can use an [NDFA (NFA)](http://en.wikipedia.org/wiki/Nondeterministic_finite_automaton) where each transition character in your short string triggers a transition in the NFA, if possible. The google knows about how you might want to start doing that.

Member Avatar for TrustyTony
0
317