Stefano Mtangoo 455 Senior Poster

It is a programming class =)"you programs must match mine exact."

Mhh, I guess this teacher isn't teaching you programming, but conforming!! Programming is all about creativity and not copy and paste. Why does he want you to do that?

Stefano Mtangoo 455 Senior Poster

You may find this helpful

http://www.voidspace.org.uk/python/movpy/movableidle.html

Chris

Hello Chris, good to see you here!
thanks alot for the link

Stefano Mtangoo 455 Senior Poster

Thanks Vega!
The only precious thing I didn't realize is the run menu (F5)
I tried and it worked. I'll pack some modules and feedback

Stefano Mtangoo 455 Senior Poster

I know of ww.portablepython.com/
Can anyone know how to do a combination of IDE and this python in stick. Also if anyone have ever tried to add other python modules to it like Vpython, wxpython, etc

Thanks alot

Stefano Mtangoo 455 Senior Poster

Very vague and general question!
you haven't said of your background on python and whether or not you know GUI programming.

That info is very important

Stefano Mtangoo 455 Senior Poster

decided to use %s temporarily, until I get permanent solution.
Thanks all!

Stefano Mtangoo 455 Senior Poster
#create table - tuple of column and table name
    def onNewTable(self, cursor, t_name):        
        cursor.execute("CREATE TABLE  %s(date DATE, transaction_expl CHAR, deposit_equi INTEGER, withdral_equi INTEGER, balance INTEGER)" %(t_name,))
        cursor.execute('INSERT INTO  %s(date, transaction_expl, deposit_equi, withdral_equi, balance) VALUES("12/11/2008", "fee", 500, 300, 200)' %(t_name))
Stefano Mtangoo 455 Senior Poster

If you want to start with python 3 then the only free book is the one Snee have given. The drawback of Python 3 is that external modules are not yet out; and few free books are there. Contrary to that is Python 2.x which have many books and modules. So It depends! If you need to start with2.x then think python is book to start with and byte of python and lastly Dive into python. All those are available via google.

The only advantage of python 3 is that, you will not to have to catch up with broken backward compability :lol:

Stefano Mtangoo 455 Senior Poster

You could start with dive into python http://diveintopython.org/regular_expressions/index.html.

There is also:
http://www.amk.ca/python/howto/regex/

Thanks all, I'll dive in

Stefano Mtangoo 455 Senior Poster

Are you using Remote Desktop?
How do you try to login? Your explanations are vague. Please elaborate more

Stefano Mtangoo 455 Senior Poster

I Uninstalled and re-installed Avast and everything went fine

Stefano Mtangoo 455 Senior Poster

I played around a little and came with this. Note assumption here is, two lists are equal :)

list1 = [0, 0, 1, 1, 0, 1, 0]
list2 = [0, 0, 0, 1, 1, 1, 0]
score = 0

i = 0
while True:
            #assumming length of both list is equal
            if i == len(list1):
                        break
                     
            elif list1[i] == list2[i]:
                        print "first number is %s and second %s" %(str(list1[i]), str (list2[i]) )
                        score = score+1
                        print "Score is %d: " %(score,)
                        i = i+1
            else:
                        #do anything else like -3 scores
                        print "Not Equal!"
                        i = i+1
                                    
            
print "Total Score is %d" %(score, )
Stefano Mtangoo 455 Senior Poster

I haven't checked much, but I run error too. One thing, I see "message" in many places and don't know if it is class or variable
Anyway, my IDE complained of mixed indentation and here is corrected version

global msgstr

def create_message(message, msgstr):
    if msgstr[0:3].upper() == 'CMD':
        return apply(message, (msgstr))
    elif msgstr[0:3].upper() == 'RSP':
        return apply(message, (msgstr))
    elif msgstr[0:3].upper() == 'IND':
        return apply(message, (msgstr))
    elif msgstr[0:3].upper() not in 'CMDRSPIND':
        print "Miscellaneous message has been found with details", msgstr
    else:
        pass


class message(object):

    def __init__(self, msgstr):
        self.msgstr = msgstr

    def getdetails(self):
        print "Type: ", msgstr[0:3]
        print "Date Stamp: ", msgstr[9:11],"/",msgstr[7:9],"/",msgstr[3:7]

teststr="CMD20090114:1"
m=create_message(message, teststr)
m.getdetails()
Stefano Mtangoo 455 Senior Poster

I would like to learn regular expressions. I have no Idea what it is (I always see people here using). Can someone explain a litle and suggest good tutorial?

Didn't mean to deviate the thread, so keep your first focus on the thread, then you can answer my question

Stefano Mtangoo 455 Senior Poster

Be careful with recent vista update!
I had to use system restore three times, after this update. Instantly after installing the update and reboot, could not connect to internet though ethernet nor dial up. So I rolled back using system restore and shut off the updates until later

Stefano Mtangoo 455 Senior Poster

Here is another idea...

Just polishing what Kthom has written

infile = open("test.txt", "r")
uppercasecount, lowercasecount, digitcount = (0, 0, 0)
for character in infile.readlines():
    if character.isupper() == True:
        uppercasecount += 1
    if character.islower() == True:
        lowercasecount += 1
    if character.isdigit() == True:
        digitcount += 1
    print uppercasecount, lowercasecount, digitcount
print "Total count is %d Upper case, %d Lower case and %d Digit(s)" %(uppercasecount, lowercasecount, digitcount)
Stefano Mtangoo 455 Senior Poster

Whoop! I didn't saw that elegant example that Vega already wrote

Stefano Mtangoo 455 Senior Poster

Take this example:
you have class of pets and each have method/attribute. See how self applies. Not very neat (one can make it more tidy and neat) but gives idea.

class Dogs():
    def __init__(self)
    
    def OnBarking(self, voice):
        #make voice be attribute/belong of self which is now Dogs class
        self.voice = voice
        self.voice = "baah, baah"
        print "Dog cries wuh! wuh! Wuh!"

class Cats():
    def __init__(self)
    
    def OnMeowing(self, voice):
        #make voice be attribute/belong of self which is now cat class
        self.voice = voice
        self.voice = "Meeh Meeh Meeh"
        print "Cat cries Nyaau! Nyaau! Nyaau!"
Stefano Mtangoo 455 Senior Poster

I have many programs in start menu.
I want to group all related programs. Can you propose what free software is the best :)

Stefano Mtangoo 455 Senior Poster

I'll try and feedback

Stefano Mtangoo 455 Senior Poster

I will try those, thanks guys

Stefano Mtangoo 455 Senior Poster

but I read somehwere that, the character % is dangerous and is to be avoided as it can make SQL injection easier and they suggested ? as placeholder. I don't know what is wrong!
Here is example:
http://www.devshed.com/c/a/Python/Using-SQLite-in-Python/2/

Stefano Mtangoo 455 Senior Poster

I was having problem with my Computer. It refused to connect via LAN/Ethernet and found due to MS update. I used system restore and connected. Then I updated it and refused dialup connection. I restored again (That why I think of shutting off the Updates). From first Restore, my avast Icon at taskbar became grayed. Do anyone know how to make it normal?? :-O

Stefano Mtangoo 455 Senior Poster

mhh, I'm new to SQLite and want to Create table without passing strings literal, because names can be subject to change. I want something like:

name = "Jimmy"
print "My name is %s " %(name, )

How do I do that in SQLite?

Stefano Mtangoo 455 Senior Poster

tried do little modification and came up with this but still error! :(
What I'm I missing?

def onNewTable(self, cursor, t_name):
    
        t_date = "Date of Transaction"
        t_explanations = "Transaction Explanations"
        t_deposit = "Deposit Equivalent"
        t_withdraw = "Withdraw Equivalent"
        t_balance = "Balance After Transaction"
        
        cursor.execute("CREATE TABLE  table = ? (col1 = ? TEXT, col2 = ? TEXT, col3 = ? TEXT, col4 = ? TEXT, col5 = ? TEXT)", (t_name, t_date, t_explanations, t_deposit, t_withdraw, t_balance)  )

full error decription

sqlite3.OperationalError: near "table": syntax error
File "i:\Documents\Projects\Coding\Financial Management\MainApp_tabbed.py", line 257, in <module>
Application().MainLoop()
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7942, in MainLoop
wx.PyApp.MainLoop(self)
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7267, in MainLoop
return _core_.PyApp_MainLoop(*args, **kwargs)
File "i:\Documents\Projects\Coding\Financial Management\MainApp_tabbed.py", line 201, in onNewFile
self.onNewTable(cur, "steve_test")
File "i:\Documents\Projects\Coding\Financial Management\MainApp_tabbed.py", line 215, in onNewTable
cursor.execute("CREATE TABLE table = ? VALUES(col1 = ? TEXT, col2 = ? TEXT, col3 = ? TEXT, col4 = ? TEXT, col5 = ? TEXT)", (t_name, t_date, t_explanations, t_deposit, t_withdraw, t_balance) )

Stefano Mtangoo 455 Senior Poster

ok I understod now, I forgot a comma. Also SQLite uses TEXT instead of CHAR (which I found in mysql) (open to correction)
Now inserting that comma and changing to TEXT i still have error:

def onNewTable(self, cursor, t_name):
    
        t_date = "Date of Transaction"
        t_explanations = "Transaction Explanations"
        t_deposit = "Deposit Equivalent"
        t_withdraw = "Withdraw Equivalent"
        t_balance = "Balance After Transaction"
        
        cursor.execute("CREATE TABLE  ? (? TEXT, ? TEXT, ? TEXT, ? TEXT, ? TEXT)", (t_name, t_date, t_explanations, t_deposit, t_withdraw, t_balance)  )

sqlite3.OperationalError: near "?": syntax error

Stefano Mtangoo 455 Senior Poster

Ok everything seems fine on DMGT.
Check for hidden files by showing hidden folders and even system folders (Be careful to do nothing with any folder just check properties to get what they occupy) If nothing found I woud suspect malevolent software invasion

Stefano Mtangoo 455 Senior Poster

what if you mark it solved? :icon_razz:

Stefano Mtangoo 455 Senior Poster

Thanks Snee

Stefano Mtangoo 455 Senior Poster

I Haven't catched you, can you elaborate?

Stefano Mtangoo 455 Senior Poster

May be only 69 GB is partitioned, and the remain is not!
Go to :
Control Panel/Administrative Tools/Computer Management/Storage/Disk Management

and post here what you see!

Stefano Mtangoo 455 Senior Poster

i HAVE iTUNES something like ver 7, but no such bizarre situation.
Have you tried to run using Windows Media Player? Are all codecs fine? (if codec is missing then WMP will say that). If it is missing try KLite Codecs
http://www.free-codecs.com/download/K_lite_codec_pack.htm

Stefano Mtangoo 455 Senior Poster

I'm not entirely sure. It should be working anyways.
I'm assuming you have a genuine version of Windows, because if you don't that may be the cause.

Vista sometimes becomes very stubborn sometimes, It failed to do so for me. It seems to be some sort of bugs-and-fix. I didn't do anything, and yet it fixes itself. I just at that time ignored, and it have fixed itself. May be because they fixed in one or other updates

Stefano Mtangoo 455 Senior Poster

Avast 4.8 Home
Zone alarm firewall
Spyboat S&D

Stefano Mtangoo 455 Senior Poster

what message or error do you get?

Stefano Mtangoo 455 Senior Poster

Hello colleagues,
I wan't to upgrade to python 2.5.4 from 2.5.2 but I don't want to lose my modules. Is it possible to upgrade without removing those modules?

Thanks

Stefano Mtangoo 455 Senior Poster

first, it is better to use code tags.
Having that said, it seems the PDF is encrypted. So try something not encrypted or check for decryption option if available in pyPDF module (I have never used it)

Stefano Mtangoo 455 Senior Poster

Thanks,
I will visit and see.
Can I ask what you fellow developers use to make your icons?

Stefano Mtangoo 455 Senior Poster

Hi all,
I have been trying to write and retrieve data from SQLite Database. So far I can make connection, cursor; but cannot get table populated(fails to execute SQL statement). Since I read somewhere that it is recommended to use ? instead of % then I tries it but I run errors. Below is the code and traceback error

Thanks alot,

def onNewTable(self, cursor, t_name):    
        t_date = "Date of Transaction"
        t_explanations = "Transaction Explanations"
        t_deposit = "Deposit Equivalent"
        t_withdraw = "Withdraw Equivalent"
        t_balance = "Balance After Transaction"        
        cursor.execute("CREATE TABLE  ? (? CHAR, ? CHAR, ? CHAR, ? CHAR, ? CHAR)" (t_name, t_date, t_explanations, t_deposit, t_withdraw, t_balance)  ) 
        cursor.commit()

File "I:\Documents\Projects\Coding\Financial Management\MainApp_tabbed.py", line 201, in onNewFile
self.onNewTable(cur, "steve_test")
File "I:\Documents\Projects\Coding\Financial Management\MainApp_tabbed.py", line 215, in onNewTable
cursor.execute("CREATE TABLE ? (? CHAR, ? CHAR, ? CHAR, ? CHAR, ? CHAR)" (t_name, t_date, t_explanations, t_deposit, t_withdraw, t_balance) )
TypeError: 'str' object is not callable

Stefano Mtangoo 455 Senior Poster

Hello all,
I have been long using Tango Icons and are good, but some stuffs are lacking. Is there good freeware Icon designer or free Icon package?
Thanks alot

Stefano Mtangoo 455 Senior Poster

check mysqldb module, the simplest way to deal with my sql in python

Stefano Mtangoo 455 Senior Poster

agree with Jlm699!
Just download wxpython demo and enjoy examples demonstrating how to do things in wxpython, very helpful

Stefano Mtangoo 455 Senior Poster

check www.vpython.org and check pythons time module
after reading, you come up with your code and we help you improve it

Happy coding!

Stefano Mtangoo 455 Senior Poster

+1 for Jlm699
Nothing new but using modules' returned value is same as functions

def addition(a, b):
    c = a+b
    return c
summ = addition(2, 3)
print summ

The only difference is, the module is imported and uses as you always access module methods
assume that is in module named math_module

import math_module as math
summ = math.addition(2, 3)
print summ
Stefano Mtangoo 455 Senior Poster

Thanks Gribouillis,
I have the basics, its time to go for exercises

Stefano Mtangoo 455 Senior Poster

I found on net this:
"Mixins are classes that further enhance the functionality of a wx.ListCtrl. Mixin classes are so called helper classes. They are located in wx.lib.mixins.listctrl module. In order to use them, the programmer has to inherit from these classes. "

Please someone explain me the way this stuffs do work, perhaps good tutorial on helper classes, especially this mixins and how to use them.
Thanks alot :D

Stefano Mtangoo 455 Senior Poster

you are welcome! Have any question? Don't hesitate to ask

Stefano Mtangoo 455 Senior Poster

Thank you everyone.

You are welcome!

Daniweb didn't allowed me to edit my mistake so I will repost the code
just to get a clue of things:

string = raw_input("Enter Number: \n")
print type(string)

integer = int(string)
print type(integer)

floating = float(string)
print type(floating)
Stefano Mtangoo 455 Senior Poster

just to get a clue of things:

string = raw_input("Enter Number: \n")
print type(string)

integer = int(string)
print type(integer)

floating = float(string)
print type(floating)
Stefano Mtangoo 455 Senior Poster

I haven't got you well can you describe the the steps your program do?
example:
1. Load file
2. write to a list
3....etc