Stefano Mtangoo 455 Senior Poster

Learn Python, and then slowly start licking some C++. Python will give you necessary programming skills and discipline

Stefano Mtangoo 455 Senior Poster

try gui2exe. It is front end for py2exe so that you don't need to reinvert the wheel :)

http://code.google.com/p/gui2exe/

Stefano Mtangoo 455 Senior Poster

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!

Stefano Mtangoo 455 Senior Poster

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

Stefano Mtangoo 455 Senior Poster

replace fname throughout with self.fname
That is because self.fname is accessible throughout the class

try and see what happens

Stefano Mtangoo 455 Senior Poster

replace fname throughout with self.fname
That is because self.fname is accessible throughout the class

try and see what happens

Stefano Mtangoo 455 Senior Poster

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

Stefano Mtangoo 455 Senior Poster

where do you get self.database?
I cannot see it in this code either!

Stefano Mtangoo 455 Senior Poster

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.

Stefano Mtangoo 455 Senior Poster

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 :))

Stefano Mtangoo 455 Senior Poster

Export the whole database using PHPMyAdmin
There is export option

Stefano Mtangoo 455 Senior Poster

What version of Python do you have?

Stefano Mtangoo 455 Senior Poster

do us a favor and mark it solved :)

Stefano Mtangoo 455 Senior Poster

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

www.code.google.com/p/gui2exe/

Stefano Mtangoo 455 Senior Poster

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

Stefano Mtangoo 455 Senior Poster

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()
Stefano Mtangoo 455 Senior Poster

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()
Stefano Mtangoo 455 Senior Poster

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!

Stefano Mtangoo 455 Senior Poster

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 :)

Stefano Mtangoo 455 Senior Poster

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, )
Stefano Mtangoo 455 Senior Poster
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

Stefano Mtangoo 455 Senior Poster

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")
Stefano Mtangoo 455 Senior Poster

above the box you typed are blue words "MARK SOLVED"
Just click that link and all is done

Stefano Mtangoo 455 Senior Poster

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

Stefano Mtangoo 455 Senior Poster

Do us a favor,
Mark thread solved. It is yet another good behaviour :D

Stefano Mtangoo 455 Senior Poster

IDLE have been reported to be troublesome, especially in GUI apps
Just check for modified version that can be downloaded at www.vpython.org

Stefano Mtangoo 455 Senior Poster

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 :)

Stefano Mtangoo 455 Senior Poster

I use Firefox, Freedownload manager (Have integrated torrent ability)

On security:
Avast Home,
COMODO Firewall

stvrich commented: Kindly contributed His Own experience +1
Stefano Mtangoo 455 Senior Poster

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 ;)

Stefano Mtangoo 455 Senior Poster

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

Stefano Mtangoo 455 Senior Poster

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 :)

Stefano Mtangoo 455 Senior Poster

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!

Stefano Mtangoo 455 Senior Poster

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

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

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!

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

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

Stefano Mtangoo 455 Senior Poster

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

Stefano Mtangoo 455 Senior Poster

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

Stefano Mtangoo 455 Senior Poster

Tried check disk?
Try something like this (Assuming F is your drive)
chkdsk F: /f
try and see

Stefano Mtangoo 455 Senior Poster

While trying to fix it, try pidgin
Just google it. It handles almost all protocols (Including MSN and Yahoo)

Stefano Mtangoo 455 Senior Poster

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 :)

Stefano Mtangoo 455 Senior Poster

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 :)

Stefano Mtangoo 455 Senior Poster

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/

Stefano Mtangoo 455 Senior Poster

output
Poped: d
Poped: c
Poped: b
Poped: a

Stefano Mtangoo 455 Senior Poster

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())
Stefano Mtangoo 455 Senior Poster

No errors to me too (Vega's version)
Check your python installation

Stefano Mtangoo 455 Senior Poster

I wonder how it runs on you!
What version of wxPython do you have?

Stefano Mtangoo 455 Senior Poster

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)
Stefano Mtangoo 455 Senior Poster

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 :)