3,386 Posted Topics

Member Avatar for ceck30s
Member Avatar for valestrom

Raw binary bits is commonly used also selecting which Genetic Algorithm to perform. [url]http://en.wikipedia.org/wiki/Genetic_algorithm[/url] Probably not what you are looking for, though.

Member Avatar for ModernC++
0
2K
Member Avatar for pn1925

nh[17:18] is list slice, not character. nh[17] is 18th character. I do not also find the meaning of your variables intuitive or line spacing reasonable.

Member Avatar for pn1925
0
148
Member Avatar for TrustyTony

As in C++ was some question about speed of simple hard disk based lookup, here is a version of unscramble program completely HD based lookup, which gives all possible candidate words for multiword anagram. Program is not sensitive for case of words but does not ignore special characters like ' …

Member Avatar for svfox2000
0
1K
Member Avatar for chriswelborn

I would actually use a shell variable set and exported when starting each desktop. I would then use this saved username for current desktop (screen) to invoke browser, probably by having a statup script for browser using su with the shell variable name to open passed in url in a …

Member Avatar for chriswelborn
0
314
Member Avatar for kuchi
Member Avatar for kuchi
1
762
Member Avatar for ubi_ct83
Member Avatar for JamesCherrill
0
177
Member Avatar for JubalBarca
Member Avatar for sepp2k
0
236
Member Avatar for bobstein
Member Avatar for dilbert_here00

The doc is quite long and thorough, but should be helpfull: http://python.net/crew/theller/ctypes/tutorial.html#passing-pointers-or-passing-parameters-by-reference

Member Avatar for dilbert_here00
0
3K
Member Avatar for yordan.todorov.35

> # "parts[3] =" sets the 3rd index of the list 'parts' 4th index parts[3] ie parts at index 3. > # 8 = 1000 0x1 = 0001; the output would be 1001 == 9; parts[9] now equals '9' No int by itself turns number in decimal not binary

Member Avatar for chris.stout
0
1K
Member Avatar for whypython
Member Avatar for manticmadman

Announce not anagram and break out of loop or return False, otherwise announce 'is anagram' or return True **after** the loop. Middle letter does not matter as it can be anything. Do not use l for variable name as it looks like I or 1. Line 2 should be s=str(s) …

Member Avatar for TrustyTony
0
195
Member Avatar for chophouse
Member Avatar for peterparker
Member Avatar for tony75
Member Avatar for sam.tubb.10

You are reading filename and dirname you show the dialog, those lines must be inside if block. 'ab' is strange mode to open file you only read. Also there is not defined variable 'self.edit'.

Member Avatar for TrustyTony
0
227
Member Avatar for ChristianOncken

I have no experience, but I would start with http://code.activestate.com/recipes/82965-threads-tkinter-and-asynchronous-io/

Member Avatar for ChristianOncken
0
2K
Member Avatar for renyges

I think that fastest way would just iterate once through the database and compare key of sorted digits.

Member Avatar for renyges
0
115
Member Avatar for smile1

Can not make much of your code, except that after fixing numerous indention error and putting one `pass` to def without statements. I got it run and after giving it one random text data file as input, it complained of KeyError. Why is `three` defined again for each iteration of …

Member Avatar for TrustyTony
0
1K
Member Avatar for whypython

check start of line with startswith method. It can take tuple of line starts, not only single string.

Member Avatar for TrustyTony
0
129
Member Avatar for etquart

Here simple one, if you use Linux or similar, add appropriate Exception type to mkdir except import os import webbrowser def process(fn): with open(fn) as infile, open('./output/'+fn, 'w') as outfile: outfile.write(next(infile)[:26] + '\n') for line in infile: if '.txt' not in line: break else: outfile.write(line.rsplit('.txt',1)[0].rsplit(None,1)[0]+'\n') webbrowser.open('./output/' + fn) try: os.mkdir('./output') …

Member Avatar for TrustyTony
0
142
Member Avatar for WolfShield

> If there are any scandinavians around, you'll like this medieval tech support (also with english sub-titles): OK here is the [absolute classic from Finland by Spede](http://www.youtube.com/watch?v=gmhseAm173A) (now deceased, unfortunately) about more modern thing: Hardware store. Language is unfortunately only Finnish, but art is without language, isn't it? I think …

Member Avatar for itzarun
0
1K
Member Avatar for peterparker

file as variable name is bad odea, and truncate call does not make sense, but what is your question?

Member Avatar for peterparker
0
209
Member Avatar for vy_007

Your code does not make any kind of sense, what image at line 20? What enhancer at same line?

Member Avatar for vy_007
0
934
Member Avatar for babs.sammie

No, but you are welcome to tell us and we tell if it looks right or not.

Member Avatar for TrustyTony
0
51
Member Avatar for ashish karna

console part does nothing, it is just console interface and does repeated compilations of very questionable code in calc function.

Member Avatar for TrustyTony
0
176
Member Avatar for vy_007

I do not know, but maybe you could catch how I do here in my Mandelbrot code (another version in Code snippets: http://www.daniweb.com/software-development/python/code/371844/mandelbrot-with-tkinter-and-shedskin ) version, which zooms the old image before calculating more exact picture: """ class for Python Tkinter for Mandelbrot set compile modules with shedskin for best performance …

Member Avatar for TrustyTony
0
7K
Member Avatar for veledrom

I like http://www.diveintopython.net/ if you are already programmed it might fit you. With django you are out of luck if you learn Python3 https://docs.djangoproject.com/en/1.4/releases/1.4/

Member Avatar for Rashakil Fol
0
173
Member Avatar for peterparker

I run the code without problem, but it did crash when given empty string as response.

Member Avatar for peterparker
0
2K
Member Avatar for pritaeas

I reported this bug earlier, and the answer then was that it was Googles' fault, so good to know that you got influence there now. ;)

Member Avatar for Dani
0
301
Member Avatar for TrustyTony

Because of [C++ code snippets not dealing with multiple +-](http://www.daniweb.com/posts/jump/1829367) in sequence (or even negative number) in expressions, I post this, as it is so much easier for me than C/C++. EDIT: Fixed signs together with '(' issues and '+' at beginning removing without lstrip, removed separate now unused '(' …

0
413
Member Avatar for TrustyTony

This is bit funny code as you can first read from this excellent response: http://www.daniweb.com/software-development/python/threads/427341/custom-types-in-a-simple-way#post1828718 why should you not use it, even it maybe feels useful. Anyway I got curious to see how type signature could be implemented, even using it would generally just be stupid way of slowing down …

0
277
Member Avatar for HTMLperson5

search tic tac toe python in daniweb search or browse the Code Snippets for example(s).

Member Avatar for TrustyTony
0
283
Member Avatar for Frensi

incorrect line is actually previous line, replace it with print("You got", right * 100 / len(questions),"% right out of", len(questions))

Member Avatar for TrustyTony
0
184
Member Avatar for vy_007
Member Avatar for Lucaci Andrew

Good subject, unfortunately, when I tested, it only added some () for return, nothing else and did not fix bad indention (done by purpose to test the code).

Member Avatar for Lucaci Andrew
0
368
Member Avatar for HTMLperson5

print is statement in Python 2, and brackets around single value do nothing, so basically both are Ok in Python2. In Python3 print is function, which is usefull. The same style of printing can be activated in Python2 by from __future__ import print_function So the first version fails in Python3. …

Member Avatar for Gribouillis
0
215
Member Avatar for HTMLperson5

You have unnecessary variables, when you should use sequence and loop: from random import choice sentence = [ ("I", "The stupid cheeser", "He", "She", "The pirate personperson"), ("killed", "ate", "vomited" "ate", ":)'ed"), ("the stupid cheeser2", "the moldy cheese", "the cow") ] for values in sentence: print choice(values), print '.' You …

Member Avatar for HTMLperson5
-1
571
Member Avatar for zaphoenix

User input can not be the whole range use `in`. Your indention is off for the if statement in lines 12-17.

Member Avatar for ZZucker
0
189
Member Avatar for skiabox

Collect the info to dictionary and write each key to it's own file. f = ["""\ <ticker>,<date>,<open>,<high>,<low>,<close>,<vol> A,20120116,36.15,36.36,35.59,36.19,3327400 AA,20120116,10.73,10.78,10.53,10.64,20457600 """, """\ <ticker>,<date>,<open>,<high>,<low>,<close>,<vol> A,20120117,26.15,36.36,35.59,36.49,3327400 AA,20120117,10.73,20.78,10.53,10.64,20457600 """ ] collect = dict() for day in f: for line in day.splitlines()[1:]: key, d = line.split(',', 1) collect.setdefault(key, []).append(d) for key, info in sorted(collect.items()): print(key) …

Member Avatar for skiabox
0
197
Member Avatar for werydude

Your code is really bad, but about your question: you should use `not in` not !=. You should start over and use list, not zillion simple variables.

Member Avatar for werydude
0
256
Member Avatar for pritaeas

http://edn.embarcadero.com/article/32770 >The XMLDoc tool requires a number of supporting tools: >Delphi 2005 or later The XMLDoc tool. If this was not included in your copy of Delphi 2005, you can download it from Code Central. **Python (tested with Python 2.3)** *Joining of my first and last languages ;)*

Member Avatar for pritaeas
0
283
Member Avatar for srinivas88

see -not swich for find and take out r from rm to remove one by one. That would leave directories there, however.

Member Avatar for ramaakella
0
238
Member Avatar for sparsh610

Have you learned recursion? I think you could reverse an empty list quite easily wouldn't you? You just figure out how to reverse the list consisting on first node and rest of list reversed. Non-recursive reversing requires just that you remember the previous node and consider carefully corner cases like …

Member Avatar for sethlahaul
0
172
Member Avatar for Nirvin M

So you should do something like this: include <stdio.h> int main() { int i = 5; printf("%d", i++); printf("%d", i++); printf("%d", ++i); getchar(); } Output: 568 Then you have clear code points for expressions. Not that I would call postincrement and right after preincrement to be good style, better: #include …

Member Avatar for TrustyTony
0
185
Member Avatar for shean1488

Maybe teachers should be Teacher object from cleaned data, models.Model has save method? https://docs.djangoproject.com/en/dev/topics/forms/modelforms/

Member Avatar for TrustyTony
0
4K
Member Avatar for poloblue

> // e/f = (a/b) / (e/f) = (b * c) / (a * d) e/f = (a/b) / (c/d) = (a/b) * (d/c) = (a * d) / (b * c), you mean?

Member Avatar for poloblue
0
147
Member Avatar for smile1

You should post complete functional class not part snipped, which is not even correctly indented. you should also show how you are instantiating the class and the Tkinter, as you are unsure if you are doing it correctly.

Member Avatar for woooee
0
2K
Member Avatar for elyos
Member Avatar for elyos
0
297

The End.