Posts
 
Reputation
Joined
Last Seen
Ranked #1K
Strength to Increase Rep
+7
Strength to Decrease Rep
-1
91% Quality Score
Upvotes Received
35
Posts with Upvotes
32
Upvoting Members
21
Downvotes Received
3
Posts with Downvotes
3
Downvoting Members
2
7 Commented Posts
~358.98K People Reached
About Me

I love Python!
I often play with D and C#.

Interests
School Biology Chemistry
PC Specs
Windows 7 OpenSUSE Ubuntu Netbook Edition
Favorite Tags
Member Avatar for vegaseat

Here's a really evil Hello World program. You see, in Python, type(type)==type, so with that in mind, Classes are a type of type, which means that they inherit from type. So really, you can actually define a class by initiating a type of it, and then defining a classDict for …

Member Avatar for vegaseat
23
34K
Member Avatar for vegaseat

Here is [B]code[/B] for a [B]GUI[/B] program in [B]IronPython[/B], which is a [B]cross-platform[/B] (and of course cross-browser) implementation of CPython that has the exact same syntax. With IronPython you can use .NET with Python. This is [B]not[/B] a question. It's a code snippet for a GUI program. Pretty neat alternative …

Member Avatar for vegaseat
9
45K
Member Avatar for Taqwasarwar

Wouldn't be something like this? : [CODE] def main(): fname = raw_input ("Enter filename:") infile = open(fname,"r") data = infile.readlines() infile.close() items = len(data) print items, "number of items." main() [/CODE] You should add a try:/except: because the filename the user might be trying might not exist.

Member Avatar for vegaseat
0
305
Member Avatar for loken

C++ is a big thing to learn. It's really big. If you like Python (I'm a huge fan), you can use panda3d, which in my opinion is the simplest option, especially if you have a background in Python.

Member Avatar for cherqeza
0
1K
Member Avatar for mappersas
Member Avatar for Peter_21
0
6K
Member Avatar for lionaneesh

[QUOTE=tonyjv;1252311]In math.sqrt the math is module and sqrt is function. Nothing to do with objects.[/QUOTE] Well, not exactly [I]nothing[/I] to do with objects, if you realize that functions are in fact objects. But you are right, math is the module. Overall, very good tutorial on the basics of classes and …

Member Avatar for mail2sanjay
1
861
Member Avatar for vegaseat
Member Avatar for Tcll

I have some comments on your code. [CODE]import struct as S import Blender def HexToDec(n): #return float(S.unpack("<h", S.pack("<H", int((n.encode('hex')), 16)))[0]) #jcao219: please keep lines short, so it is readable nhex = int(n.encode('hex'), 16) packed = S.pack("<H", nhex) unpacked = S.unpack("<h", packed)[0] return float(unpacked) def readvert(v): #jcao219:where do you use this …

Member Avatar for Tcll
0
2K
Member Avatar for jeezcak3++

I was able to compile it with IronPython's compiler, so I can give you that, if you don't mind it running on .NET of course.

Member Avatar for vegaseat
0
620
Member Avatar for Tcll

[QUOTE=tonyjv;1296859]Could be that that module you want would work with IronPython or what you say IronPython gurus? Or the program could be complied to library (dll in Windows) and used as Python library with [URL="http://docs.python.org/library/ctypes.html"]ctypes[/URL]. Or you could see if [URL="http://code.google.com/p/shedskin/"]shedskin[/URL] could manage to turn all your code to C++ …

Member Avatar for JoshuaBurleson
0
2K
Member Avatar for tzho11

You can use WolframAlpha for graphing. I'm not sure what you want your program to do.

Member Avatar for JoshuaBurleson
0
151
Member Avatar for vegaseat

This method is great for basic cryptography in Python, however advanced and secure encryptions such as AES offer the best degree of security. For those of you interested in that, PyCrypto is for you.

Member Avatar for TrustyTony
3
7K
Member Avatar for TrustyTony

Well, if you want to be able to do this: [icode]for i in numberstack[/icode], you have to write the stack like this: [code] class Stack: """doc omitted""" def __init__(self,size): self.data = [None]*size self.size = 0 def push(self,item): self.data[self.size] = item self.size = self.size + 1 def pop(self): self.size = self.size …

Member Avatar for TrustyTony
0
851
Member Avatar for reanopp

There really is no fool-proof way, for any application written in any language. For C#, someone could maybe use Reflector and then see what creative registration processes you have written, unless if you obfuscate the code, which only makes it harder, never fool-proof. Good luck.

Member Avatar for Momerath
0
253
Member Avatar for singlem1905
Re: help

First of all don't use "globals" or "locals" as your identifiers, they are built-in functions. One possibility to fix this is to do this: [CODE]#execfile('comp1.py') def exefi(name, globalsmap=None, localsmap=None): if localsmap or globalsmap: exec compile(open(name).read(), name, 'exec') in globalsmap, localsmap else: exec compile(open(name).read(), name, 'exec') in globals() exefi('comp1.py')[/CODE] Another is …

Member Avatar for singlem1905
0
117
Member Avatar for Muro29

You could do that in Python, but since you are beginning Python, why not just use a service such as OpenDNS (which would be much easier to set up), instead of trying to deal with sockets, etc?

Member Avatar for jcao219
0
103
Member Avatar for techie929
Member Avatar for roboguy

[code]for file in [f for f in files if f.endswith(".html" or ".htm" or ".txt")]:[/code] is equal to [code]for file in [f for f in files if f.endswith(False)]:[/code] Don't use "file" as a variable name (identifier) since it's builtin. Escape [icode]"C:\New Folder"[/icode] as [icode]"C:\\New Folder"[/icode] or add an "r" before the …

Member Avatar for TrustyTony
0
253
Member Avatar for KrazyKitsune
Member Avatar for Sirovica

Lua has a really small standard library. Also, I think it's used a lot as a game scripting language.

Member Avatar for jcao219
0
70
Member Avatar for Ultralisk

[CODE]with open("scores.dat") as fileIn: for line in fileIn: if line: parse(line)[/CODE] (Something like that, I'm not sure if I wrote that correctly. I haven't been doing much Python lately.)

Member Avatar for TrustyTony
0
128
Member Avatar for KrazyKitsune

For windows you can use the msvcrt module: [CODE]import msvcrt import sys time_is_up = False #use threads to modify this userinput = "" while True: if msvcrt.kbhit(): ch = msvcrt.getch() if ch != "\r" and not time_is_up: userinput += ch sys.stdout.write(ch) else: break[/CODE]

Member Avatar for wikirifi
0
4K
Member Avatar for lionaneesh

One thing you have to be careful of is this tricky stumbling point (which arises because Python's lists are mutable): [CODE]>>> a = [[None]*3]*3 >>> a [[None, None, None], [None, None, None], [None, None, None]] >>> a[0].append("Hello") >>> a [[None, None, None, 'Hello'], [None, None, None, 'Hello'], [None, None, None, …

Member Avatar for redyugi
1
3K
Member Avatar for err1100

It may be easier to understand when you take comprehensions out. [CODE]def myfunc(x): ret = [] for i in range(2**len(x)): res = [] for j, y in enumerate(x): if (i >> j) & 1: res.append(y) ret.append(res) return ret[/CODE]

Member Avatar for jcao219
0
127
Member Avatar for anurag.kyal

I thought os.kill didn't work on Windows... [URL="http://docs.python.org/faq/windows.html#how-do-i-emulate-os-kill-in-windows"]http://docs.python.org/faq/windows.html#how-do-i-emulate-os-kill-in-windows[/URL] I see it now works on 2.7 and 3.2. I guess you are on linux.

Member Avatar for jcao219
0
156
Member Avatar for j3nny

[QUOTE=Gribouillis;1296241]0xfe is not the hex of -2, it is the hex of 256 - 2. You can use [code=python] >>> hex(-2 % 256) '0xfe' >>> hex(256 - 2) '0xfe' [/code][/QUOTE] Actually, it is for byte. If I can remember correctly, Windows, -2 is: [INDENT]Qword (long) = 0xFFFFFFFFFFFFFFFE Dword (int) = …

Member Avatar for jcao219
0
91
Member Avatar for abcdr

[QUOTE=tonyjv;1291565]Maybe the poster liked to have list containing integer length instead of the element for every element of the list. Then for line 5 use statement to return list of counts. What happens or is supposed to happen if the elements are numbers? Maybe len(str(element)) is better to add to …

Member Avatar for jcao219
0
97
Member Avatar for personx1212

No, you have to save it to a temp file. You can't expect software to be able to read your program's memory.

Member Avatar for personx1212
0
75
Member Avatar for Tommymac501
Member Avatar for jrthom444

Well, at first I thought what you want to do would require the traceback module. Now that I think about it, I think you use id. [CODE]def get_var_name(arg): for x in globals(): if id(globals()[x]) == id(arg): return x return[/CODE]

Member Avatar for jcao219
0
219