1,075,763 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Posts by pyTony which have been Voted Up

Symbian does not support Tkinter, it has interface to phone UI through appuifw module:
http://www.mobilenin.com/pys60/info_gui_design.htm

Tutorial:
http://croozeus.com/blogs/?p=215

pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

no, you are making cmd a set of strings,

cmd(command='listTemplates', templatefilter='executable')

like in my example.

pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

line 6 is indented inproperly from second code part, as the error clearly indicates.

pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

You are missing the curly braces for dictionary:

cmd = {'command':'listTemplates', 'templatefilter':'executable'}

Calling (procedural) function in Python example

def func(required, optional=None):
    print 'required = %s, optional = %s' % (required, optional)


func('something')
func('something', 'other')
func(optional='other', required='something')

"""Output:
required = something, optional = None
required = something, optional = other
required = something, optional = other
"""
pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26
pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

Now the policy is just ignore inappropriate down votes, as they have 0 point effect if the giver is not gained respect in form of minus voting power. Also notice that minus power is lot weaker than the plus power of member, in my own case -3/12. Also the DaniWeb is very democratic in giving voting power, consider that happygeek has voting power -2/11, and Dani herself has only -3/15 power.

For example you, even with 117 posts and 93 % post quality, have 0 down voting power.

pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

The way you do array or list of 50001 values initial value zero, for zeroth element set value to 1. Should be easy, even in C#

pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

What is your problem, why you do not write it simply directly in C#.

mixes[i+n] = mixes[i]+mixes[i+n]

could be expressed more concisely:

mixes[i+n] += mixes[i]
pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

Just draw rectangle whose width is proportional to points.

pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

JasonHippy> was generated at least once.

No it is > 1, so those which was hit more than once.

I do not see the purpose of printing out the numbers that was hit multiple times. Seeing the distribution of counts would make more sense.

pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26
pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

Use list comprehension with enumerate:

>>> column = [['A', 'A', 'B'], ['B', 'A', ''], ['', '', 'B']]
>>> print [item[ind] for ind, item in enumerate(column)]
['A', 'A', 'B']
>>> 
pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

"Write to outfile joined lines of set of items (lines) in file infile"
Set of values has only one instance of same item.

pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

If the order of lines does not matter, you can use

  with open('filelein.txt') as infile,  open('fileout.txt', 'w') as outfile:
           outfile.write(''.join(set(infile))) 
pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

class average should update by accumulating the initialized sum by += not overwrite variable by =. You should take probably also average, not sum.

Here little more advanced version for averaging total items.

values = [item for value in my_dict.items() for item in value]
average = float(sum(values)) / len(values)
pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

Provided your code is correct, this is how I could clean it up (unchecked):

def ID_check(ID_code):
    if (all(x==ID_code[0] for x in ID_code)) or len(ID_code) < 8 or len(ID_code) > 10 :
        return False
    ID_code = ('00'+ID_code)[-10:]
    intlist = [int(i) for i in ID_code]
    control = sum(intlist[ind] * (10 - ind) for ind in range(9)) % 11
    return  (control if control < 2 else (11 - control)) == intlist[-1]

print ID_check(raw_input("Enter Your ID Code Number: "))
pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

You need to run it properly from command line double click etc. IDLE does not work.

pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

Maybe a quiz program of English spelling? ;-)

pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

Your main code is not protected for importing, which multiprocessing module uses, this works:

import multiprocessing
def cracker():
    print "Hello"
    return

if __name__ == '__main__':
    procs = []
    for i in range(8):
        p = multiprocessing.Process(target = cracker)
        procs.append(p)
        p.start()

    for p in procs:
        p.join()
pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

range value should be integer:

for tile_x in range(0, int(image_width/width)):
pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26
 
© 2013 DaniWeb® LLC
Page rendered in 0.2503 seconds using 2.72MB