Learn Python, and then slowly start licking some C++. Python will give you necessary programming skills and discipline
Stefano Mtangoo 455 Senior Poster
stvrich commented: Kindly contributed His Own experience +1
Learn Python, and then slowly start licking some C++. Python will give you necessary programming skills and discipline
try gui2exe. It is front end for py2exe so that you don't need to reinvert the wheel :)
I don't know but If you can mess with tasklist and subprocess module (for XP/VISTA). This is purely untested as I'm not sure if tasklist returns anything!
Also what Data type of those variables?
If they are numeric, then Just save them as strings. Then retrieve them and use int() or float() to convert them back o numerical values
replace fname throughout with self.fname
That is because self.fname is accessible throughout the class
try and see what happens
replace fname throughout with self.fname
That is because self.fname is accessible throughout the class
try and see what happens
If you didn't close the database
connection.commit()
db.close()
you sould be able to access it via Database.db from the second program so try substituting that for self.database and see if it works, or just use
self.database = Database.db
There you are! He is trying to call self.database which is'nt defined anywhere. This should at least work
where do you get self.database?
I cannot see it in this code either!
I cannot read your mind but I think the line missing is :
self.database = connection.cursor()
Also I see in line 76
"self.connection.commit()" but I cannot see where self.connection is defined.
Although this is off-topic: I have Python 2.6.3, I installed py2exe 0.6.9, and when I try to compile the program it gives some error, I can't post the error since I can't copy text from the command prompt. I did mention something about wx.core and some dll file (MSVCP90.dll). It works fine for other non-wxpython programs, but it doesn't work with this! How do I solve this?
Do you you code setup.py by yourself?
If yes, Andrea Gavana have saved you alot of pain by making front end (GUI) for py2exe. It is called GUI2exe
Get It here:
http://code.google.com/p/gui2exe/
I use it with inno setup to make setups
It is fantastic work!
If you still get errors, then open new thread. Oh by the way, Using wing IDE (101 version is free) will help you copy and paste errors. Any other decent IDE should be able to do that (even IDLE :))
Export the whole database using PHPMyAdmin
There is export option
What version of Python do you have?
do us a favor and mark it solved :)
Have you tried andrea gavana's gui2exe? It have many options that comes from py2exe. It have also other 'packers' options.
Check if it can solve your problem
That's where sockets comes in MHO.
You will use to send data to the server and then there will be a thread opened to server to save each query. So theoretically this is what I would do :
1. Connect to the server via sockets and server's mysql-python module
2. Use that connection to send queries
3. Close database connection and end socket session
Just my 2cents
try learning by dividing the issues at hand using functions:
1.Function that Gets numbers entered by the userand first ask the user how many numbers there are.
2. Find average should always be a float, even if the user inputs are all
#function to get numbers and store them --> store is only for practice
def getvalues():
how_many = raw_input("How Many Numbers are we operating on? \n")
#Chek if the provided answer is correct
try:
n = int(how_many)
return n
except:
print "You can't trick me, that is not integer!"
getvalues()
def storevalues(n):
s = []
for i in range(0, n):
ret = raw_input("Enter %dth number: \n" %(i+1, ))
s.append(ret)
return s
def calc():
n_times = getvalues()
t_list = storevalues(n_times)
#our calculation container
cont = 0
for i in t_list:
cont+=float(i)
result = float(cont)/n_times
print "The result to two decimal places is %.2f" %(result, )
calc()
try learning by dividing the issues at hand using functions:
1.Function that Gets numbers entered by the userand first ask the user how many numbers there are.
2. Find average should always be a float, even if the user inputs are all
#function to get numbers and store them --> store is only for practice
def getvalues():
how_many = raw_input("How Many Numbers are we operating on? \n")
#Chek if the provided answer is correct
try:
n = int(how_many)
return n
except:
print "You can't trick me, that is not integer!"
getvalues()
def storevalues(n):
s = []
for i in range(0, n):
ret = raw_input("Enter %dth number: \n" %(i+1, ))
s.append(ret)
return s
def calc():
n_times = getvalues()
t_list = storevalues(n_times)
#our calculation container
cont = 0
for i in t_list:
cont+=float(i)
result = float(cont)/n_times
print "The result to two decimal places is %.2f" %(result, )
calc()
As jlm699 said, Postgresql is good but isn't the only one.
You can go with mysql plus mysql-python.
I have read yahoo! and many other big companies uses mysql(not sure if it is with Python or PHP) so I know it must be multiuser!
I was once a fond of global variables as "child" programmer.
As I went on coding, things turned harsh on me. Thanks God I then learned OOP. In OOP, you do alot of stuffs without global variable.
I have forgotten even last time i used global keyword. all I remember is alot of self.xyz and __init__
learn OOP and enjoy classes :)
Alternatively you can use placeholder (same Snee's example)
#Convert C to F
def Tc_to_Tf ():
Tc = input ("What is the Celsius Temperature ? " )
Tf = 9.0/5.0 * Tc + 32
return Tf
Tf = Tc_to_Tf ()
#.2f instructs Python that placeholder holds float number with 2decimal places. try 3f, 4f etc and see how it does
print 'The temperature is %.2f Degrees Fahrenheit' %(Tf, )
import math y = math.sin(1) + math.cos(1)
If you use ...
from math import sin, cos y = sin(1) + cos(1)
... in the hope that only sin and cos are imported, you are wrong. The whole math module is imported
I was about to say that this method might be efficient. Ooh! It have bad pitfalls I will stick with import and import as
if it was windows, I could use the system's taskkill with switches /f
here is completely untested example.
This will close any running instance of firefox :)
Not sure about linux. I buried it long ago, though I plan to go back
import os
os.system("taskkill /F /IM firefox.exe")
above the box you typed are blue words "MARK SOLVED"
Just click that link and all is done
HAL is Hardware Abstraction Layer. It just hides the implementation of hardware and remove alot of pains for you to interact with individual hardware
http://en.wikipedia.org/wiki/Hardware_abstraction_layer
EDIT:
Here is a project that died way back to 2007
http://pypi.python.org/pypi/minihallib/0.1.10
Do us a favor,
Mark thread solved. It is yet another good behaviour :D
IDLE have been reported to be troublesome, especially in GUI apps
Just check for modified version that can be downloaded at www.vpython.org
for more info just perruzzi here at wikipedia
http://en.wikipedia.org/wiki/Application_programming_interface
Loong explanations that will take you up and running :)
I use Firefox, Freedownload manager (Have integrated torrent ability)
On security:
Avast Home,
COMODO Firewall
hi i want to creat activity by Pygtk for OLPC-xo. so how i work pygtk in eclipse? sorry for my english skill. e.x import pygtk. it's not import
re-read my above post ;)
Get your eclipse IDE (Though it is very heavy and Javaic IMHO) and then get python extensions for eclipse here
http://pydev.sourceforge.net/
Happy Pythoning
why not start with http://wiki.python.org/moin/BeginnersGuide
then move to:
http://docs.python.org/tutorial/
from there you can start flying for more :)
The popular Geany IDE is written with GTK (not PyGTK).
Wing IDE is written in PyGTK
I would suggest wxPython, for easy learning curve (to my experience). Why? Because I grasped the basics even before I could be fluent in Python. I almost learned them simultaneously (though Python came first) :)
PyQT? No, unless you will never develop any commercial app or you are willing to $. PyGTK? Yes why not? But if you want to!
I was messing around a little with pygame, and I noticed it dose not like the python IDLE...
Have you tried VIDLE
http://vpython.org/vidle/index.html
wingware 101
www.wingware.com
netbeans python early access
www.netbeans.org
DrPython
www.drpython.sourceforge.net
a process is a program that runs with its own memory block and it own global variables. Processes don't share memory block, and cannot communicate directly except via inter process communication
Threads on other hand is "lightweight" process and share memory block and many other resources that processes don't share. To create a process you need new memory block, while thread share the parent thread's memory.
Single process can spawn many threads and as a matter of fact, a process is a single threaded or multithreaded.
Hope haven't confused you too!
I'm not yet int threds, but hope this will help you:
http://www.daniweb.com/forums/thread36752.html
http://bytes.com/groups/python/514796-how-force-thread-stop
http://docs.python.org/library/threading.html#module-threading
Hello,
Why use WinDef while have McAfee?
As far as I know, McAfee hav its own antispyware and there is no need to use multiple AS. So just disable one of them and I advice you disable WinDef
see same discussion on windows recorder here:
http://discussions.virtualdr.com/archive/index.php/t-185935.html
try this as they suggested:
http://www.fridgesoft.de/harddiskogg.php
Here is a Jump start:
Download and install (Check the one bundled with Mingw)
www.codeblocks.org
Books:
Thinking in C++
http://www.google.co.tz/search?hl=sw&q=thinking+in+C%2B%2B+pdf&meta=&aq=f&oq=
tutorials:
www.cplusplus.com
www.cprogramming.com
Happy coding!
Wait to see your OS :D
Tried check disk?
Try something like this (Assuming F is your drive)
chkdsk F: /f
try and see
While trying to fix it, try pidgin
Just google it. It handles almost all protocols (Including MSN and Yahoo)
Another Advice, you can use system cleaners like ccleaner. It wipes out garbages in your disk. Check out here at www.ccleaner.com
Bonus point is, it is freeware :)
Don't mess with hidden folders/files unless you know what you are doing! I don't know what they are, but take that advice seriously. May be use google :)
In case you don't like to bother writing the codes for setup.py, use GUI for Py2exe which can export setup.py
www.code.google.com/p/gui2exe/
output
Poped: d
Poped: c
Poped: b
Poped: a
What do you want to accomplish?
Here is simple Looping. It prints what is poped
L1 = ["a", "b", "c", "d"]
for i in range(len(L1)):
print "Poped: %s" %(L1.pop())
No errors to me too (Vega's version)
Check your python installation
I wonder how it runs on you!
What version of wxPython do you have?
Why not? It worked for me when I tested his code... and there's nothing wrong with his binding as I added another menu item with a separate function and ID and that still worked without conflict.
here is what I got:
File "c:\Users\Elijah Ministries\Desktop\daniweb.py", line 17, in <module>
frame = MainFrame('Ya Mum')
File "c:\Users\Elijah Ministries\Desktop\daniweb.py", line 11, in __init__
self.Bind(wx.EVT_MENU, self.Close(), id=ID_FILE_QUIT)
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 3911, in Bind
event.Bind(self, id, id2, handler)
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 3985, in Bind
target.Connect(id1, id2, et, function)
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 3868, in Connect
return _core_.EvtHandler_Connect(*args, **kwargs)
Is sending a file Illegal?
If not, then I can send It to you
I have downloaded full via a link I provided above.
I cannot test whether installation works or not as I use USB stick version and don't have Python (at work now). So If it is legal send me Email and I will send it to you :)