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

Thanks. leaving it open in case someone have something to say

Stefano Mtangoo 455 Senior Poster

Thanks alot. Im going to check them right now. However, How easily do they integrate with custom site (Hand coded and not CMS)?

Stefano Mtangoo 455 Senior Poster

Hi All,
I need to make a PHP word editor for writting notes that will have buttons like one for wordpress. How do I start it? Is there readymade class that I can employ? Or any tutorial?

I have never done such project before but I need such editor to help people to post to my Web without messing with those HTML tags. The editor should convert them to tags.

Thanks for helping me!

Stefano Mtangoo 455 Senior Poster

you need to brush yourself with wx's Layout management. It is very simple once you grasp the basics.
Check here:
http://zetcode.com/wxpython/layout/

Stefano Mtangoo 455 Senior Poster

I don't know where to post it in Daniweb, but since I'm used to Python forum, I hope someone will help me here. Advices of as to where I should post this are valid!

I have made a project, compiled it with py2exe and packed fine with Inno setup. The setup installs fine and adds both desktop and start menu Icon.

The problem is when I click the shortcuts, I get error as attached image shows "see log for more details" But when I go to program Directory and run the exe manually, It runs fine. I don't know what is wrong with the installer

Thanks for your help :)

Stefano Mtangoo 455 Senior Poster

@cwarn23,
Thanks for information. I'm not very experienced PHPer, and I have alot to learn. But I downloaded for learning purposes. Thanks for the link

@ardav,
Thanks for the link. I will download and integrate with my phpBB3
Thanks alot for pointing that.

Stefano Mtangoo 455 Senior Poster

Its long now I try to understand wxPython's print frame work. Every effort have fallen apart. I just cannot understand how it works. I have tried to google with no avail. wxDemo is too painful to swallow :(

I request anyone familiar with framework to give me a jump start on the Framework. I want to have options like Printer Setup, Print Preview and Print.

I really appreciate any thought on that
Thanks!

Stefano Mtangoo 455 Senior Poster

Hi All,
I want to incorporate chat room in my Website (Currently still on WAMP). What chat software is good? Is it easy to write mine from the scratch? Any tutorials if that is possible?

Thanks Guys!

Stefano Mtangoo 455 Senior Poster

Hi all,
I want to implement print option on my program. For now I need to print ListCtrl. I'm doing google process and I posted here in case someone happens to know and is willing to help me, whether with code or advice.

Appreciate

Stefano Mtangoo 455 Senior Poster

Implementing Save algorithm

Postby Apostle on Fri Sep 04, 2009 4:48 pm
Hello All,
I have a project of allowing user to save guests in Guest Book. I use Python/wxPython/SQLite for that. I Have implement basic database operation as well as GUI. I can save to DB as well as reload to wxListCtrl. The problem I'm facing is how to implement save algorithm.

When I save, currently, I save the whole list of object and that results in duplication each time I click save button. I want to be able to monitor changes and save ONLY the changes as well as Newly added data. I don't know how to implement that.

I don't want to write hundreds of lines of code, but here is the save function and its dependant.
Thanks

#Save Items
        def OnSave(self, evt):
            #Get Items from dictionary
            items = self.guestlist.items()
            #get tuple of data and discard the key/index
            for i, j in items:
                #Remove first element -- SQLite is set to auto increment
                self.filltb(j[1:])
               
            self.commit()
               
            #Reload after that -- Reloads data from database and fills the ListCtrl
            self.OnReload()
#populate Guest table
        def filltb(self, values, tbname = "guests"):
            query = "INSERT INTO %s(fname, lname, mphone, ministry, tdate, reason) VALUES(?, ?, ?, ?, ?, ?)" %tbname
            self.cur.execute(query, values)
#Commit all transactions
        def commit(self):
            self.conn.commit()
def OnReload(self):
            #Reload the Ctrl
            print "Reloaded called!"
            data = self.loadtb().fetchall()
            self.guestlist.clear()
            for i,j in enumerate(data):
                self.guestlist[i] = j
           
            #Load dict toListCtrl
            self.LoadData(self.guestlist)
Stefano Mtangoo 455 Senior Poster

I have written the program but menu doesn,t show up!
What is wrong?
code

import wx

class MyFrame(wx.Frame):
def __init__(self, parent,id,title):
wx.Frame.__init__(self, parent,id,title,size=(250,150))

menuBar=wx.MenuBar()
file=wx.Menu()
file.Append(-1,'Quit','Quit application')
menuBar.Append(file,'&File')
self.SetMenuBar=(menuBar)

panel = wx.Panel(self, -1)
statusBar = self.CreateStatusBar()
self.Centre()
self.Show(True)

app=wx.App()
MyFrame(None,-1,'Simple Menu')
app.MainLoop()

Stefano Mtangoo 455 Senior Poster

on windows use os.system("YOUR EJECT COMMAND HERE")

Stefano Mtangoo 455 Senior Poster

Create flash animations plus links in it, very simple flash animation

Stefano Mtangoo 455 Senior Poster

Some apps work in Safe Mode. Restart in Safe Mode with Networking and see if it works. TO start in SMWN, power the system up and at the BIOS sign on screen, tap F8 until you get to the Windows Advanced Options Menu, choose Safe Mode with Networking and go from there. If they update fine in Safe Mode, It's probably a firewall issue.

I will try that. So far I'm far from my LTop.
I use Vista SP1. It is Ad-aware and not Adware. Just a typo :)

Stefano Mtangoo 455 Senior Poster

Also explorer take loong eons to open.
I wonder if there is secret invasion here!

Stefano Mtangoo 455 Senior Poster

Hi all,
It is strange that I cannot Update Adware (Free anniversary edition), Malwarebytes, or even spyware doctor trial. I have existed my comodo firewall and event turn off windows firewall. I don't know what is happening as I have tried Spyboat SD and it updates fine!

Any help appreciated

Stefano Mtangoo 455 Senior Poster

I was editing an image and bang, there was option in GIMP to save as xpm. I'm going to give it a try! Thank s to God I met that option. Thank you Salem too for your reply :)

Stefano Mtangoo 455 Senior Poster

I have a python script whihc logs in some file.
This script calls some outside bat file which also logs in same file.

What does that .bat script do that can't be done in python?
IMHO, Python is very capable of replacing your .bat and hence removing unnecessary snags. Also Python OOP capabilities are added advantages

Stefano Mtangoo 455 Senior Poster

Thanks!
Relative paths you provided works.
I will retain DOCUMENT_ROOT for includes. I hope it is good idea
Isnt that so? Just reply though I have marked it solved

Stefano Mtangoo 455 Senior Poster

I see there is $_SERVER and $_SERVER;
Which is the best?
Also In google there are alot of $_SERVER but I cannot find it anywhere in PHP manual and doesnt work on my WAMP

Stefano Mtangoo 455 Senior Poster

Hi,
I have a WAMP based Site and would like to user path as a variable instead of fixed path. I tried variable like

$sgospel = "$server./sgospel/";
$include_path = "$sgospel./includes";
echo($server);
echo($sgospel);

Results are:

C:/wamp/www/
C:/wamp/www/./sgospel/

When I put

$f_path = "$include_path/inc.terms.php";
echo($f_path);

I get
C:/wamp/www/./sgospel/./includes/inc.terms.php

Instead of
http://localhost/sgospel/includes/inc.terms.php

I want it to be relative path instead of absolute path equivalent to :
"/gospel/"
"/"

Thanks alot.

Stefano Mtangoo 455 Senior Poster

I have a question for you. Does wamp have a control panel to restart services? Just a thing that comes with xampp that I'm not sure about wamp.

Yes it have. I have used both XAMPP and WAMP and they are good. But I have loved WAMP than XAMPP. It is nicier and have simple access to features like PHPMyAdmin

Stefano Mtangoo 455 Senior Poster

And what is your internet speed?

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

WAMP have never let me down
http://www.wampserver.com/en/

Stefano Mtangoo 455 Senior Poster

Hello there,
Is there a free windows flash maker that have got no advertisments?
I have got flash maker free version, but it advertises in my swf file. I want free flash maker, may be full functional trial

Thanks

Stefano Mtangoo 455 Senior Poster

I love Ubuntu too though for some reason I have to remove it to remain with my vista. Another interesting Linux distro is Fedora core by Redhat guys. I heard a buddy using Mandriva too.

So If can't get Windows, why don't you go for linux?
No AV and Very capable for Web stuffs :)

Stefano Mtangoo 455 Senior Poster

Hi all,
I have been using PNG files for icons and they are good. But I want now to use xpm as they can be included just as I include header file. How do I do that? Any free tool?

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

Thanks alot Scru
I will dig in. I will keep the thread open in case of any Idea or if I will need help on the mentioned stuffs :)
Thank you!

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

I'm confused. Are you implementing your own proprietary playlist format, a widely format, or a playlist format specific to wxMediaCtrl?

sorry for late reply, I was out of the net for some time.
I want to implement ANY type of XML playlist. My aim is learning xml through that, and any playlist fromat that is XML is welcomed.
Only thing is I should be able to LOAD, ADD, DELETE and SAVE file information on that XML file

If I'm still confusing just tell me and I will try to my best to explain :)

Stefano Mtangoo 455 Senior Poster

Hi,
I'm planning to work something with XML and Python. As part of familializing with it, I want to make simple playlist for a wxMedia player. the player is simply wx.MediaCtrl with some buttons and wxListCtrl as list container. My Question is, what process does it take to get playlis and write an mp3 (let say), to a playlist?

Another questio, is it must that the playlist have .xml extension? or it can be something like .playlist?

Thanks for devoting your time helping :)

Stefano Mtangoo 455 Senior Poster

I wil check another solution
This seems like impossible to do :(

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

Don't know about eclipse, but Netbeans comes bundled with Jython and to configure it is very very easy! :)

Stefano Mtangoo 455 Senior Poster

Thanks alot KKeith29,
I failed to add to you some reputation points. I wonder why. That option isn't there in your username
Bravo!

Stefano Mtangoo 455 Senior Poster

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

Stefano Mtangoo 455 Senior Poster

Hi All,
I was asking if it is possible to hide the wx.MediaCtrl window so that Only controls (play, stop, pause etc) can be shown? I plan to play audio only and never video for this project. Thanks alot :D

Stefano Mtangoo 455 Senior Poster

Use PE Builder to make BartPE. There is a zip version that doesnt need installation but It will require Admin right to run it.

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

Ok I'm leaving for now but, some servers support SSL some dont. So setting SSL on for server that doesn't support, will lead to failure to login and hence will not do the necessary. See you tomorrow :)

Stefano Mtangoo 455 Senior Poster

I know my explanation was a bit general, do you want a more specific answer?

Thanks for even that geanaral question. I want to be full loaded with bullets before tackle that pert of project. You can be as specific as you want. In short NO limitation!

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

How about a blank icon as a spacer? ?

That is! Just blank Icon with shape |
Thanks alot

Stefano Mtangoo 455 Senior Poster

Hi,
I want to track changes done to wxListCtrl as user Updates it (via my custom dialog of course). I will be querying and saving updates from and to database. the problem I have in thinking how to track changes and enable/disable save button as well as update the database (when save button clicked)

Any suggestion on how to do it? :(

Stefano Mtangoo 455 Senior Poster

Thanks a lot. I have searched a lot and it seems with AddSimpleTool no permanent text like AddLabelTool is possible. meanwhile No separator can be seen with AddLabelTool as it is in AddSimpleTool.

That is a big dilemma!

Stefano Mtangoo 455 Senior Poster

I got wingware's Wing personal and I enjoy!