761 Posted Topics

Member Avatar for jacob501

Either it isn't in your python path (examine sys.path) or it isn't being recognized as a module. Most modules are a file, such as in your case a file named [ICODE]mechanize.py[/ICODE] if you have a directory, then to find files within it, you need a file named [ICODE]__init__.py[/ICODE] (which might …

Member Avatar for jacob501
0
1K
Member Avatar for asong

A recursive function calls itself (or calls a function that calls a function that ... calls the original). If you think about a magic square, where would there be a chance to recurse? Since we need to test the main diagonals as well as the rows and columns, we can't …

Member Avatar for asong
0
2K
Member Avatar for pelin

What have you tried? What worked? What didn't? Do you have a specific question?

Member Avatar for pelin
0
6K
Member Avatar for THEPalletizer

Please use the CODE button to show indents, line numbers, syntax coloring... Hints: * You can get the list of words by simply saying `words = sentence.split()` * You need to think about punctuation, in case user inputs some. For instance, if you got the words from the first sentence …

Member Avatar for THEPalletizer
0
399
Member Avatar for Sarcasm

Because Python has 2.x and 3.x versions, it is wise to mention the python version in the module comment or string It would be nice of you to print a summary of the state of the game in the game loop. Such as [ICODE]print("Correct guesses: %s; Wrong guesses: %s"%(correct_guesses, wrong_guesses))[/ICODE] …

Member Avatar for Sarcasm
0
214
Member Avatar for london-G

I get a factor of 1.67 . If you need to explain that 1.2 is the correct factor, then you have to say that something else is important. Maybe I/O on the new machine is faster or the new machine has faster/larger CPU-side cache or ...

Member Avatar for griswolf
0
71
Member Avatar for edw211

Not clear to me why you have table CATALOG instead of having that information directly in table VIDEO (unless you are planning to add non-video items? Even so, I think that the VIDEO table is the CATALOG table (and add a "type" column to it so you know if it …

Member Avatar for griswolf
0
647
Member Avatar for Ravic85

I have to dispute your "pretty much done". I spotted a half dozen problems before I looked at your errors. That said: If you actually read the error messages, they give you pretty good clues about what the problem is. Main clue: What line is the parser on when it …

Member Avatar for griswolf
0
767
Member Avatar for Pamilerin

I speak no VB, so in general terms: [LIST=1] [*]You open a connection to (some web service) [*]You provide your bona fides to that server [*]You make your request [*]You receive and parse the data [*]You close the connection [*]You massage the new data [*]You display the massaged data [/LIST] …

Member Avatar for Pamilerin
0
177
Member Avatar for twitah

What you want is to put two or more sql statements into a single transaction. How you do that in PHP is not something I know.

Member Avatar for smantscheff
0
169
Member Avatar for cpeeyush1

You really should consider what [B]else[/B] the world needs. Web browsers have been done, and done very well (though they keep getting better, it is incremental). The people who say "start small" are partly correct. Instead, I suggest you start with something that has been making you crazy, that a …

Member Avatar for chrishea
0
322
Member Avatar for hovestar

It means that the replace function expects a string (or string-like object) as the first parameter, but you passed it an integer. Line 17 should be [icode]board = board.replace(str(comp), "O")[/icode]. Note that the semicolons at lines 7, 12, 17 are not needed, though they are not illegal.

Member Avatar for TrustyTony
0
8K
Member Avatar for AdampskiB

The print function by itself adds a newline at the end. I suspect you are doing something like this (though you showed no code, so I am guessing)[CODE]asterisks = '*'*5 print(asterisks+'\n') print(asterisks+'\n')[/CODE]This will work just fine without the explicit newline. Of course if you want an embedded newline, you have …

Member Avatar for AdampskiB
0
120
Member Avatar for Flames91

I would be tempted to represent the polynomial as a list of coefficients. The nth item in the list is the coefficient of [icode]x^n[/icode] This requires specific 0 coefficients for all terms. It doesn't work (without jiggering) for negative exponents. A dict also works: Key is exponent, value is coefficient. …

Member Avatar for TrustyTony
0
517
Member Avatar for SCass2010

I kind of like find for this because if "all" isn't exactly right, it is easy to tune.[CODE]find $basedir -print[/CODE] or if you want a lot of detail: [CODE]find $basedir -ls[/CODE]

Member Avatar for griswolf
0
120
Member Avatar for Mark198995

The problem description is a good start. Now you have to think about how to organize your code. Nothing (much) to do with the language, mostly to do with logic. You will have an [icode]int main()[/icode] just like in C++; and per the instructions, you will need at least four …

Member Avatar for cse.avinash
0
620
Member Avatar for acechauhan

macros do not honor any kind of scoping. Somewhere in the include files the token 'sec' is being converted to the manifest constant 3600. This is one reason that we have all agreed that macros will always be CAPITALIZED since that much reduces the chance of such conflicts. Better yet, …

Member Avatar for asitmahato
0
169
Member Avatar for poker158149

That has to do with the flow of control (logic) of the program as a whole: Something you did not show us.

Member Avatar for poker158149
0
15K
Member Avatar for Rivka Schwartz

When upgrading the underlying code / compiler / whatever for your work, the thing of greatest importance is that you know the upgrade worked. For this, you must have an already existing test suite that you trust to tell you when something breaks. The upgrade process then works like this: …

Member Avatar for Rivka Schwartz
-1
173
Member Avatar for kaskoraja

You can convert the list to a string with one item per line like this: [CODE]my_list = [ ... ] my_list_as_string = '\n'.join(str(x) for x in my_list)[/CODE] Then you simply write that string to the file. Be careful about adding a newline after the last element. You can use a …

Member Avatar for kaskoraja
0
164
Member Avatar for Rahul V S

The general opinion is that MySQL is accessible, easy to use. Postgresql is robust, more technical, harder to get started using. I've used both without any real trouble (but the Postgres one was set up and administered by someone else). MS SqlServer Express may be good for you if you …

Member Avatar for griswolf
0
810
Member Avatar for jiapei100

It is always very good to have a backup in case something goes wrong, so[list=1] [*]make a new directory beside current one: [icode]mkdir ../something-or-other[/icode] [*]do the work with target ../something-or-other/$filename [*]clean up:[icode]thisdir=$(pwd);cd ..; mv $thisdir $thisdir.back; mv something-or-other $thisdir; cd $thisdir[/icode] [/list] Beware that I did [B]not[/B] test this code, …

Member Avatar for griswolf
0
282
Member Avatar for earlybirdsean

More or less by definition, shell scripting is done in the language of the shell you use. The most common these days are the Windows "batch" shell, which is very little used, but runs on all Windows machines; and [URL="http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html"]bash[/URL] (Born Again SHell) which is very common on Unix flavored …

Member Avatar for cfajohnson
0
196
Member Avatar for aragonnette

Your question did not make it into the English language well enough to understand. Also: Please post your code (which should be short, if possible). Be sure to use the CODE button.

Member Avatar for TrustyTony
0
346
Member Avatar for casper1

The main thing is to be clear in your own mind about what you are doing. You are not "converting a decimal number". What you want to do is [B][I]display[/I][/B] a number in octal. This is done by formatting the number. The big hammer is built-in function [icode]format[/icode] which uses …

Member Avatar for casper1
0
234
Member Avatar for anjoz

You might want to use a language you already know. If you need to learn a language, then I suggest the [URL="http://python.org/"]Python[/URL] programming language instead of Java. It has about the same expressive power as Java, a similarly powerful set of tools in the standard library, and in my opinion …

Member Avatar for griswolf
0
187
Member Avatar for Simplicity.

I have no idea what you mean by your question. How is line 145 now an "output"? It looks like a calculation. There's no print statement, no return statement so nothing is being put "out". What do you man "make it an input"? Input is data that comes into the …

Member Avatar for Simplicity.
0
161
Member Avatar for JoshuaBurleson

Why a text file? If you simply want to preserve information from session to session, there are three ways [LIST=1] [*]What you suggested: Write the data to a text file [*][URL="http://docs.python.org/library/pickle.html"]Pickle[/URL], Python's object serializer module (actually: Use cPickle) [*]Use a database [/LIST] I recommend you use pickle. However if you …

Member Avatar for JoshuaBurleson
0
252
Member Avatar for mools3

[QUOTE=mools3;1598068]please i need response !!![/QUOTE] That isn't [B]our[/B] problem, but yours. If you want a response, you need to make it easier to respond. What is the exact nature of the trouble your code is in? Does it [LIST] [*]have a syntax error? What, exactly? [*]not run? [*]not run as …

Member Avatar for Enalicho
0
161
Member Avatar for geekme

[URL="http://lmgtfy.com/?q=XAMPP+mysql+can+not+be+stopped.+Busy"]Let me google that for you[/URL]

Member Avatar for linuxaomi
0
140
Member Avatar for neely615

lose the pause, and print the progress indicator at the bottom of the for loop. If that's too fast, keep a counter and print only on every Nth pass through the loop. You don't get a nice steady progression (assuming that the conversions are not equally lengthy), but you do …

Member Avatar for griswolf
0
333
Member Avatar for tubby123

In your main() function, call [iCODE]lcs = LCS(m,n); // where did m and n come from?[/iCODE] then print that value.

Member Avatar for Momerath
0
177
Member Avatar for vaironl

The radius is simple math (Pythagorean theorem): the distance between two points (x0,y0) and (x1,y1) is [ICODE]math.sqrt((x0-x1)**2+(y0-y1)**2)[/ICODE] (If you want to think about distance along a path, such as a road, then you are working on a much larger problem) I presume that the Arcgis data contains the restaurant information, …

Member Avatar for vaironl
0
328
Member Avatar for rhuffman8

Actually, the first option (keep track of pennies using a (long) integer) is a better choice almost always. If you use floats representing dollars, you are subject to rounding error even if being very careful. This is because a penny ($0.01 decimal) is in fact an infinite repeating binary fraction, …

Member Avatar for Gribouillis
0
240
Member Avatar for juan77

sh and bash have for loops, conditionals etc, so the process of converting something short like this is to understand it, then rewrite it in (ba)sh. From your linux command line, chant [icode]info bash[/icode] or [icode]man bash[/icode]. From a system that has a "real" sh (as opposed to using a …

Member Avatar for griswolf
0
119
Member Avatar for NewbieinC

There are probably 100 or more examples of such code right here at Daniweb. See the search box in the upper right corner of this page? Use it!

Member Avatar for Adak
0
132
Member Avatar for wilfanada

Start hanging out here and at StackOverflow. Discipline yourself to log in at least three times a day to each. Answer questions (or ask them) every time you visit. Go to Google Code, Source Forge, and other places where you can see professional grade code. Download and figure out how …

Member Avatar for Killer_Typo
0
146
Member Avatar for theharshest

Django appears to be winning the battle for the minds of programmers with "serious" (== big) development needs. TurboGears looked very interesting when I was researching how to develop a site, but I ended up going with Django. There are a lot of others, including some very small ones. You …

Member Avatar for griswolf
0
310
Member Avatar for de1337ed

any machine that can connect to the web site you intend to scrape is suitable. (donning my lawyer hat): Be sure you are following fair use rules as described at healthgrades.com and any other place you would like to scrape information. Because people are so much slower than machines, many …

Member Avatar for griswolf
0
3K
Member Avatar for sha11e

Please re-read the section in your textbook about references. Yes, the bool& is a reference and yes, it has a pointer in it at the machine code level, but it is always automatically deferenced.

Member Avatar for pseudorandom21
0
272
Member Avatar for MoNaLiZaOman

Why is this a question in the C++ forum? Do, please [thread=78223]Read This First[/thread]

Member Avatar for Tellalca
0
99
Member Avatar for mtatadotcom

OK, I see the red code (by the way, how did you manage to get code without line numbers? The appropriate thing to do is press the (code) button, then paste your code between the tags... or paste first, highlight it all, then press the button) Based on the red …

Member Avatar for mtatadotcom
0
167
Member Avatar for libathos
Member Avatar for libathos
0
197
Member Avatar for SakuraPink

sed would be perfect for this. You could also use cut -c if all the tuple-numbers are one digit, or cut -f twice: Once with -d ',' and once with -d ')'

Member Avatar for Aia
0
319
Member Avatar for [V]

Confused. Want wider, but not taller... but you are calling it the Y axis? Assuming you misspoke, will [URL="http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.set_xlim"]this[/URL] do what you need? (There's a parallel method for the Y axis)

Member Avatar for griswolf
0
471
Member Avatar for Renzeeks

Do you need to pay attention to case? Your variable declarations don't all match variables in the pseudo-code (allowance versus Allowance, why "Start" but "STOP", "If" but "ENDIF", "Declare" and not "DECLARE"?)

Member Avatar for Momerath
0
224
Member Avatar for neuro

For what its worth, my own way to learn something is a little different than what you propose for yourself: I find a project (small, accessible) that fulfills some need of my own, and just start in doing it. The result is a useful tool if all goes well, but …

Member Avatar for griswolf
0
302
Member Avatar for magnetic rifle

First, you need to use the **CODE** button to maintain indents when you paste your code (you also get code coloring and line numbers, also good things). With Python particularly indent matters. Here is what I think you meant: #!/usr/bin/env python import csv import random alpha = 'abcdefghijklmnopqrstuvwxyz' e = …

Member Avatar for griswolf
0
144
Member Avatar for Archenemie

OK. I'm assuming that you have MySQL installed and running and you want to access it from Python. Otherwise, you'd be posting in the MySQL forum, right? I just chanted [icode] pip install mysql-python[/icode] from the command line. Maybe I did it all [icode]sudo[/icode]? It has been some time since …

Member Avatar for griswolf
0
120
Member Avatar for Lolalola

Another way: If your function has a loop like this[CODE]def myfunc(*args): something = initial_value while True: # your work here return something[/CODE] Then you can check if the loop has run too long with a call to [URL="http://docs.python.org/library/time.html#time.time"]time.time()[/URL] like this:[CODE]import time def myfunc(*args): start = time.time() something = initial_value while …

Member Avatar for TrustyTony
0
196

The End.