761 Posted Topics

Member Avatar for jarograv

I have not looked at this at all, beyond a quick 20 second scan of what they claim to offer, but it might be worth exploring: [url]http://www.python-excel.org/[/url]

Member Avatar for griswolf
0
2K
Member Avatar for penguino138

Arbitrary precision arithmetic is not easy, and even when well written, not fast. Are you constrained to use C++? Then I suggest you search [URL="http://lmgtfy.com/?q=Arbitrary+precision+in+C%2B%2B"]like this[/URL] otherwise, use a more appropriate language/tool

Member Avatar for Derek Elensar
0
916
Member Avatar for karlamadeus

Probably not the best thing to do, though it will apparently work. Your second question indicates that you have a clue. Class attributes belong to the class itself, whereas instance attributes belong to an instance (of the class). So your lists are in the class: There is only one class …

Member Avatar for snippsat
0
115
Member Avatar for karlamadeus

You need to think about [URL="http://www.saltycrane.com/blog/2008/01/python-variable-scope-notes/"]the scope of variables[/URL]. As a general rule, you don't want global [B][I]variables[/I][/B] (though global [B][I]constants[/I][/B] are much more acceptable) since the presence of global variables makes your program harder to understand ("where in the heck did [B][I]that[/I][/B] variable change value?")? As a result, most …

Member Avatar for griswolf
0
229
Member Avatar for Xcelled194

Hmm. [list] [*][B]unjumble[/B] takes a string of characters and finds all the words (or sets of words) that use up all the letters. You need to read in the system dictionary to do it [*][B]signature[/B] takes a text and finds statistics about the text, treating it as just an array …

Member Avatar for BitBlt
0
201
Member Avatar for shroomiin

If you are willing to walk the structure three times, it is easy to use [icode]find[/icode] to do it. For instance [icode]find $topdir -depth 1 -type l -print[/icode] gets all the links in [icode]$topdir[/icode]

Member Avatar for thekashyap
0
166
Member Avatar for bkoper16

bkoper16: Please mark this thread as solved. Only you, the original poster (OP) have that link. Marking threads solved, when they are solved of course, helps keep DaniWeb working smoothly.

Member Avatar for griswolf
0
10K
Member Avatar for Venku Tur'Mukan

It is best to ask a simple question (sometimes they escape from simplicity though) and when the question is either answered or does not matter any more, then mark the thread "solved". That is best because it makes it easier for other Daniweb users. Then, when you have a new …

Member Avatar for vegaseat
0
44K
Member Avatar for eman 22

Perhaps the problem is integer division when the result is less than 1? Try casting the difference to double and see if it helps.

Member Avatar for eman 22
0
190
Member Avatar for Darion

I think the task at the end of the chapter is for you to discover how to use `input()` to accept input from the keyboard, and **then** print "Game Over" and exit. Think of Python as a little robot that does exactly and only what you tell it to do. …

Member Avatar for Darion
0
371
Member Avatar for eman 22

Your question is not in clear English, but I think you mean "Is there a way to convert an array to a pointer, or a pointer to an array". An array [B]is[/B] a pointer (to the zero-th element), so there's no way to convert. Just use it as is. Your …

Member Avatar for mike_2000_17
0
88
Member Avatar for Dasini

I use them as follows: [LIST=1] [*]Discover that I have a need for some programming service [*]Look online for a library(*) that seems to offer the service [*]Look for user commentary comparing some top contenders, or commenting on one or another [*]Read the documentation enough to possibly confirm or actually …

Member Avatar for griswolf
0
2K
Member Avatar for lu2lu

$@ is a built in variable that holds [B]all[/B] the command line arguments passed to your script. $1 is just the first command line argument. Here's a useless script that illustrates use of $@[CODE]# Usage: bash thisfile anyfile [anyfile...] for fname in $@; do echo "Will cat $fname" cat $fname …

Member Avatar for lu2lu
0
166
Member Avatar for e-papa

You could use [URL="http://docs.python.org/library/itertools.html?highlight=groupby#itertools.groupby"]itertools.groupby[/URL] which has a nice example right in the docs. Once you have the groups, just calculate the ranking: All the folks in the first group tie for 1st place. All the folks in the second group tie for (count of 1st-place people + 1); All in …

Member Avatar for e-papa
0
221
Member Avatar for Theformand

Or to be a little more specific: You the OP (original poster) have a link at the bottom of the page that allows you to mark the thread solved. I suggest you first post an entry : "This thread marked solved because our requirements changed, not because I got an …

Member Avatar for griswolf
0
159
Member Avatar for e-papa
Member Avatar for e-papa
0
648
Member Avatar for shyla

[QUOTE]Write an abstract file filter class ... Create one subclass of your file filter class that performs encryption, another that transforms a file to all uppercase, and another that creates an unchanged copy of the original file.[/QUOTE] I don't see this (interface/abstract) class anywhere in your code It seems to …

Member Avatar for shyla
0
1K
Member Avatar for MUFC4life

Somewhere around line 34, just add a block that listens for K_UNPAUSE. K_UNPAUSE might be K_PAUSE, I suppose, if you want it to toggle in which case just change line 35: [icode]paused = not paused[/icode]

Member Avatar for griswolf
0
188
Member Avatar for South

Your syntax is just wrong in so many ways. Please visit the [URL="http://docs.python.org/tutorial/index.html"]Python Tutorials[/URL] or read the introduction to your Python book again.

Member Avatar for South
0
116
Member Avatar for k2k

[CODE]awk 'NR%3==0' file.txt[/CODE] (or 1 or 2 depending on which actual lines you want)

Member Avatar for griswolf
0
78
Member Avatar for Joeflims

If you are working from the command prompt, change directory to the location of your script and try again. OR stay where you are and invoke python on the full path of the script: [iCODE]python C:\joeflims\pywork\one\script1.py[/iCODE]

Member Avatar for TrustyTony
0
773
Member Avatar for rssk

You are trying to use C syntax in Python. Python loops over a range of integers look like this:[CODE]for i in range(680): print(i)[/CODE] Look [URL="http://docs.python.org/tutorial/controlflow.html"]here[/URL] ... or perhaps you should start at the [URL="http://docs.python.org/tutorial/index.html"]top of the tutorial [/URL]

Member Avatar for griswolf
0
99
Member Avatar for TrustyTony

IMHO, you found Python easier because: [list] [*]It is interpreted, which makes the compile/test/edit cycle faster [*]It was a tiny problem, so the execution speed did not matter [*]The OP doesn't know how to make best use of C++: Using the standard containers makes C++ almost as expressive as Python …

Member Avatar for TrustyTony
0
635
Member Avatar for diniboi

So show the code. Here's a hint: [CODE]primes = set((2,3,5,7)) factors = [] for p in primes: if 0 == num%p: num /= p factors.append(p) [/CODE] Now re-do this code so as to check even more possible factors, and handle multiples of the same prime. You can do it two …

Member Avatar for TrustyTony
0
224
Member Avatar for salty11

[QUOTE=Ancient Dragon;1531222]line 37: use == operator, not = operator. That is setting those variables to 0.[/QUOTE] This problem is what gave rise to the way I now code equality checks. Rather than[ICODE]if (i == 0)[/ICODE] I put the manifest constant on the left [ICODE]if (0 == i)[/ICODE]. Now, if I …

Member Avatar for salty11
0
180
Member Avatar for diniboi

Please take note of the [URL="http://docs.python.org/library/datetime.html"]datetime[/URL] module, particularly [URL="http://docs.python.org/library/datetime.html#datetime.date"]datetime.date[/URL] which can be used to print all kinds of date-related things (method [URL="http://docs.python.org/library/datetime.html#datetime.date.strftime"]strftime[/URL]) By the time you finish reading all that good documentation and get to this line of my post, you should be slapping yourself on the forehead and thinking …

Member Avatar for diniboi
0
199
Member Avatar for G_S

Python egg is the closest jar equivalent. Details [URL="http://mrtopf.de/blog/en/a-small-introduction-to-python-eggs/"]here[/URL] (a little out of date, but easy) and (well not exactly details) [URL="http://stackoverflow.com/questions/2026395/how-to-create-python-egg-file"]here[/URL] P.S. I have always considered jar to be the approximate equivalent to 'library' not to 'executable'. Python eggs are also more like a library than an executable (though …

Member Avatar for G_S
0
8K
Member Avatar for rockerjhr

Well, you are asking us to make many assumptions; and you aren't clear about where, exactly, you want the 8 to go in your (one dimensional?) array... so we can't help you. And you should show us some code so we have something to help you [B]with[/B]. I'll offer this …

Member Avatar for griswolf
0
107
Member Avatar for MasterGberry

You want line 42: [icode]if(*c1 != *c2)[/icode]. The [icode]read[/icode] method does not append trailing nulls, so your current version cannot work; and of course c1 and c2 are pointers, so comparing them directly is useless for your task. You might want to consider using method [icode]get()[/icode] (with no arguments) which …

Member Avatar for WaltP
0
113
Member Avatar for wolfrain63

If your professor doesn't have good examples and references, you need to report (him) to the department head as being incompetent to teach the course. And, since (he) must have chosen "good ones" (by (his) standards), you are much better off using those than some you find anywhere else, since …

Member Avatar for rubberman
0
97
Member Avatar for debasishgang7

So, for each file, examine this: [ICODE]os.path.splitext(the_file_name)[-1].lower()[/ICODE]

Member Avatar for TrustyTony
0
109
Member Avatar for banks2140

Look [URL="http://download.oracle.com/javase/6/docs/api/java/lang/String.html#split%28java.lang.String,%20int%29"]here[/URL]

Member Avatar for kramerd
0
109
Member Avatar for Bevosnz

Post some code using the (CODE) button, and ask for help making it work better. Using better or more careful English.

Member Avatar for e-papa
0
145
Member Avatar for parijat24

What is this second '~'? [iCODE]"cd ~/~/work/...[/iCODE] If that isn't the problem, then perhaps you can tell us [B][I]how[/I][/B] the last step doesn't work.

Member Avatar for richieking
0
182
Member Avatar for South

Use the built-in method int: lhs = int(raw_input("Number: ") rhs = int(raw_input("Another number ") print "%d plus %d is %d"%(lhs, rhs, lhs+rhs If you wish to have people enter a date, then read about datetime module, paying particular attention to the strftime() and strptime() methods.

Member Avatar for South
0
133
Member Avatar for e-papa

Classes describe objects Objects hold data and do work If you can imagine your program as "He does something, and in order to do it, he asks her to do something, and she needs help from several of her friends..." then each of the 'he', 'she' and 'friend' might be …

Member Avatar for e-papa
0
359
Member Avatar for Emred_Skye

You never want to del part of a thing in the midst of a loop over the items in the thing: Think about what must be going on when you call del. Instead, one of two options: [list=1] [*]write each line if it passes the test, as you see it …

Member Avatar for Emred_Skye
0
190
Member Avatar for jfunchio

Is your search engine broken? [URL="http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html"]http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html[/URL]:[QUOTE]If you re-create a table that was dropped, it must have a definition that conforms to the foreign key constraints referencing it. It must have the right column names and types, and it must have indexes on the referenced keys, as stated earlier. If these …

Member Avatar for griswolf
0
224
Member Avatar for gstavreski
Member Avatar for adam80

Bear in mind that if the user can see the code in the 'master' script, they can alter it. Obfuscation only works if the user is naive. And think about when the cutoff time is set: If it is done as part of the installation, then the user merely reinstalls …

Member Avatar for adam80
0
2K
Member Avatar for JonSmith

Using bash: This worked fine for my baby test. I can't see any need for the case statement. Of course you will need to poke it into shape to do your particular task.[CODE]change() { mv $1 ${1%$2}$3 } for f in $(find $toplocation -iname '*.txt' -print) ; do change $f …

Member Avatar for JonSmith
0
180
Member Avatar for woooee
Member Avatar for group256

There is nothing stopping you from using either multiple dictionaries or a larger dictionary with a variety of keys. For instance, I am now working on a project where I have a dictionary like this[CODE]{ offset: date, #offset is an integer date: filename, #date is datetime.date filename: lines-from-the-file, #filename is …

Member Avatar for group256
0
174
Member Avatar for Pascode

In lines 3 through 11, I see no 'break' statement. You want something like[CODE]if(_isGameOverForXxx(...)) { break; }[/CODE] don't you?

Member Avatar for Pascode
0
180
Member Avatar for arul jeba

I looked at Google using [icode]email hacking[/icode] and found good references (and news) in the top 10. I suggest you do something similar.

Member Avatar for arul jeba
0
176
Member Avatar for llocar

Something resembling this:[CODE]for srcfile in $(echo *.data) ; do bn=$(basename $srcfile .data) sinkfile={$bn}.txt grep "something about $bn" srcfile >> sinkfile done[/CODE] Assuming bash, but ksh should work also. The [ICODE]$(...)[/ICODE] becomes [ICODE]`...`[/ICODE] in sh (Bourne shell) line 1: echo *.data works only if you are in the correct directory. You …

Member Avatar for llocar
0
125
Member Avatar for Veneficvs

Well, in the first place this is a "rotate" function, not a "shift", but I'll assume you really want "rotate" You are stepping on your data: What happens to the number that was at index in lines 12 and 16? When it is time to shift it, where is the …

Member Avatar for vijayan121
0
2K
Member Avatar for joeywheels

hint: Think about a two dimensional array of asterisks. There is nothing sacred about traversing such an array in row-major order.

Member Avatar for TrustyTony
0
1K
Member Avatar for e-papa

Another speedup: You only need to check for factors up to the square root of the target.

Member Avatar for e-papa
0
221
Member Avatar for anip1610

Start with something very much simpler: A tutorial about how to program in VB. Once you have done that, do some tutorials on how to use a database, which is very very different from Visual Basic. Then, if you are still interested, you will be able to do it (maybe …

Member Avatar for debasisdas
0
105

The End.