Stefano Mtangoo 455 Senior Poster

in wxApp you should disable it

myApp = wx.App(False)
Stefano Mtangoo 455 Senior Poster

And don't forget, you can use Foreign library interface; The so called ctypes
It comes with Python (>=2.5) and It is in Docs

Stefano Mtangoo 455 Senior Poster

if windows you can use code below(Just alternative). Not tested though

import os
os.system("myprog //mydir_where_there_is_xm//myxml.xml")
Stefano Mtangoo 455 Senior Poster

You should make random function that will take range and at any time return two random numbers. Then present those numbers to her and calculate her answer. Compare to the real answer and then grade her (array?)

Stefano Mtangoo 455 Senior Poster

not specifically answer to your question, but there is duplication of subprocess imports
Just use one

from subprocess import call
Stefano Mtangoo 455 Senior Poster

I do not want to use any script or wordpress
I want to create my blog from scratch.
I am working but there are many problems

Didi you see this?
What problems are you facing?

Stefano Mtangoo 455 Senior Poster

First of all im new here so Hi all..

im also new to c/c++ have been a java php and actionscript developer for some time now and finally have time to learn something new so im gonna go for c++ im just tryna get familiar with everything but i ran into some (to me) weird results.

i was trying to make a recursive function but i kept getting errors so i stripped everything out of the function and still got an error can anyone explain me why the following fails everytime after calling the function for the 262058 time with a segmentation fault.

void recursive() {
	recursive();
}
int main( int argc, char **argv ) {
	recursive();
}

its probably very obvious and easy (just not to me)

thanks in advance,
Yrm

Now you have learned something about malicious code, don't you?
It is like looping infinitely while creating new arrays without deleting them. Guess what? ;)

Ok just rumbling, solution is well pointed above :)

Stefano Mtangoo 455 Senior Poster


Here is a typical code example mostly produced by the wxFormBuilder program

No so dirty ;)

Stefano Mtangoo 455 Senior Poster

int is simple function that changes "numeric" strings into integers. There is also double(), str() etc

Stefano Mtangoo 455 Senior Poster

Nice program indeed!

Sure Vega, It saved a lot of programming time in C++ (May be days or even months)

On Windows it was a little cumbersome to get the wxPython support.
I had to go through the following sequence ...

I was about to ask snippsat how he got around the DLL. Thanks for info and the link

Stefano Mtangoo 455 Senior Poster

I do not want script of blog. There is best script WORDPRESS.
I am trying to create my own blog.

I do not want to add mutiple functionalities. I just want to add post, view post, reply post and add post in archive(sorting monthwise)

Please help for coding.

Anybody????????????

Log in to admin panel and set things up

Stefano Mtangoo 455 Senior Poster

Thanks for the help anyway :-)

I like your quote... too true.

It comes out of experience. I tried to know everything I can and when I evaluate myself, I knew as expert nearly as nothing. So don't try that because you'll learn it the hard way ;)

Stefano Mtangoo 455 Senior Poster

I tried it with fewer lines and get the same effect - the first delete works but nothing thereafter.

I should add that each line contains 101 elements! So the total file has about 10,000 lines with each line containing 101 values (not that the values within each line need to be stored separately - I need to delete and keep entire lines)

I suggest you create a cpy of orignal and delete what you want and store that list, then take a copy of orignal modify the lines you need etc. I suggest that because deleting stuffs changes the indexing of list.

EDIT:
you got it! Bravo to G.

Stefano Mtangoo 455 Senior Poster

would you try to work with few lines let say 15 lines and after it works go to that large file

Stefano Mtangoo 455 Senior Poster

Yup!
I missed that!
How do you generate your own classes? Same inheritance principle?

Stefano Mtangoo 455 Senior Poster

I heard that it supports wxPython but I haven't seen that!
I use wxFB version 3.0 and have only C++ features. I love wxFB and Their inheritance philosohpy is really vanilla on cake ;)

Stefano Mtangoo 455 Senior Poster

So in summary (for lazy to read like me), what is the issue? Doesn't work as intended or throws exception? What is the error?

Stefano Mtangoo 455 Senior Poster

not sure what you want but here are tricks I use
Use GetParent function to get parent and store that parent in variable. Then use that variable to call any parent method. For dialog, its parent will be a Frame and by that trick you can call any frame methods from Dialog.

Using Multi class is better for learning and big projects. For small projects keep with one class

Stefano Mtangoo 455 Senior Poster

PIL is not part of Standard Library. Did you install it explicitly?

Stefano Mtangoo 455 Senior Poster

The 'or die " exits from the code when the condition is met.
I don't see an If statement there at all.

Sure, no if!

Stefano Mtangoo 455 Senior Poster

hi thr,

Could u pls tell me how to write the codes..
I tried it out but cant get it updated... in the admin table..
Pls help...
Thanks

Did you try the above trick

Stefano Mtangoo 455 Senior Poster
<?php
if($_POST['btn']=='Update'){
$old_pass=$_POST['opass'];
$new_pass=$_POST['npass'];
if($old_pass==$$new_pass){
$query="UPDATE users set password='$new_pass' where password='$old_pass'";
mysql_query($query);

}
else{
echo "Password Doesn't match!!";
}


?>
Stefano Mtangoo 455 Senior Poster

Then re install the module.
I haven't used PIL but does it go with capita letters PIL or small one?
Try from pil import ....

Stefano Mtangoo 455 Senior Poster

thanks evstevemd

Karibu (Welcome)

Stefano Mtangoo 455 Senior Poster

So, what do you want Python to do for you?

Stefano Mtangoo 455 Senior Poster

Just a technique. Replace variables with form's variable and Update Query according to your table structure

<?php
$pass = $_POST['password'];
$rpass = $_POST['repeatpassword'];
if($pass==$rpass){
	$query = "UPDATE QUERY HERE";
	mysql_query($query);
}

?>
Stefano Mtangoo 455 Senior Poster

how do you import it?
What OS do you have?

Stefano Mtangoo 455 Senior Poster

If that doesn't work use the wxStaticText's SetLabel() mathod

Stefano Mtangoo 455 Senior Poster

Oh sorry. My browser stopped loading and the code you typed didn't show up.
Anyway, I tried that and it printed out, just not in the GUI. It ended up printing it in the idle shell

It should print in both console and Label

Stefano Mtangoo 455 Senior Poster

Absolutely bloody ridiculous. I'm in your class (CSC108) and I know the prof has offered office hours to help people with the assignment. There's no excuse for you to just paste the whole assignment into an online forum expecting someone to do it for you while other students are sitting here busting their balls trying to get it done on their own.

Nice work ethic, although I suppose it's my fault for expecting more from UofT students.

Laziness is virtue ONLY if you are lazy enough to be lazy person

Stefano Mtangoo 455 Senior Poster

I did not intend to join an ongoing service - I only wanted to find the answer to ONE question, which I did not get. I am not savvy enough to make us of your Forum. Please unsubscribe me immediately.

And who did subscribe you? and secondly which question are you talking about?

Stefano Mtangoo 455 Senior Poster

Why keep yelling? and who is Daniweb here? I'm curious why you are so mad at email notifications that you agreed to receive? did anyone forced you to? If no then you should be asking politely than threating putting curses! You should learn acronym R.E.S.P.E.C.T.

Now I see, you want to avoid flood of email from DaniWeb.
You can:
2 Try your Python skills and write small program to UNsubscribe you. :)

Yup! That's very funny H.

Stefano Mtangoo 455 Senior Poster

in this line where do you get username.screen_name?

wx.StaticText(panel, -1, username.screen_name, (10,100))

change to something like this

#
for username in userlist:
#
wx.StaticText(panel, -1, username, size = (10,100))
Stefano Mtangoo 455 Senior Poster

You run this little program ...

# the base64 image string has been created with this short
# program, the resulting string is then copied and pasted
import base64
jpg_file = "Btn_next.jpg"
jpg2base64string = base64.encodestring(open(jpg_file,"rb").read())
print "Btn_next_jpg_b64='''\\\n" + jpg2base64string + "'''"

Make sure you have the image file in the working folder.

If you use it much of the time you can make a GUI app to embed all images in folder in same file and give them same name as their names.

Stefano Mtangoo 455 Senior Poster

Hello Python community,

I've just finished building an app with Python and I'd like to share my experiences and get some feedback. This was from scratch (no code templates) all the way to compile and distribution on a Windows environment. Now all my colleagues at work are using the app with no problems.

Bravo!

I'll start off with some queries and questions that I had building the app, that I couldn't solve and then we'll move on to my experiences.

1. What is the standard way to put images on your toolbar buttons on other languages? Do you put your images in the install folder (i.e. the folder within the C:\Program Files\ folder) ??? or do you embed them in the code either directly or putting them into a DLL file or something. And is what I am doing right in terms of creating the toolbar buttons and images?

All those are possible
- Put images in folder and load them using wx.Bitmap while adding to let say toolbar
Untested but to give flavor

mytoolbar.AddLabelTool(.....wx.Bitmap("./icons/exit.png", wx.BITMAP_TYPE_PNG))

- You can embed them using base_64 encode. See somewhere in your wxPython folder. I hope you will go on writing GUI front end for that tool ;)
- You can Put them in DLL or use DLL your friend wrote for you in C++ and use ctypes to access it

2. This is a related question. How do we normally package and distribute apps and their respective …

Stefano Mtangoo 455 Senior Poster

right, I was raising an error with that certain condition, sorry about the wording earlier.

Just another question though, what if I wanted the '6' from the raiser to be changed to an int so that the print "Passed 2" statement you used earlier would not be printed? would the condition I used earlier

x != int(x)

be correct? or no?

Don't understand what you mean here!

Ideally, I wanted raiser('6') to pass normally without raising any exceptions, just like raiser(6) passes normally for the program.

what are you trying to accomplish in very summary?

Stefano Mtangoo 455 Senior Poster

the error still comes out the same

That is not error, it is exactly what you're telling it to do! You tell it to raise value error and it does right? Remember computers aren't intelligent at all, garbage in garbage out!

use this code to see what is going on

class  E2Exception (Exception):
    pass

class  E2OddException (E2Exception):
    pass

def raiser(x):
    if x == 'So sue me!':
        raise E2Exception, "New Yorker"
    elif ((int(x)) % 2) != 0:
        print "Passed 1"
    elif ((x != 'So sue me!') and (x != int(x))):
        print "Passed 2"
    return

if __name__ == '__main__':
    raiser('6')
Stefano Mtangoo 455 Senior Poster

try this

elif ((x != 'So sue me!') and (x != int(x))):
        raise ValueError

Mind you that it raises value error because you might be converting non-numeric string (that is, x is not a numeric string like "f"). Posting your whole code will help to pinpoint the problem

Stefano Mtangoo 455 Senior Poster

Ok, we have your assignment here, where are your efforts?

Stefano Mtangoo 455 Senior Poster

Personally, I'd stay clear of js if possible - header() if used correctly shouldn't cause an error ("headers already sent")..

JS is the best way to go but only if you are sure your users will not turn off JS in their browsers. No one in the world can guarantee that so here is what I do:
1. Create Pure XHTM/PHP site
2. Add JS to do PHP stuffs at Client.
If user's JS is on some basic things like empty field will be dealt at user level and relieve server of unnecessary queries

Cheers ;)

Stefano Mtangoo 455 Senior Poster

to be comfortable with arrays check foreach loop

Stefano Mtangoo 455 Senior Poster

header is what you need

Stefano Mtangoo 455 Senior Poster

if you know how to do it from CLI then try subprocess

Stefano Mtangoo 455 Senior Poster

what exactly do you mean by 'a variable' speeds?

I think he means speed is varying while it was supposed to be constant


Also as Java learner I'm lost with this code
Does it imply JFrame is contained in JPanel? Is that Possible with Java?

package snake;
import javax.swing.*;
import java.awt.*;

public class board extends JPanel {

       public board()
       {

            JFrame frame = new JFrame();
            frame.setSize(300,400);
            frame.setTitle("Snake");
            frame.setBackground(Color.black);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            snake component = new snake();
            frame.add(component);
            frame.setVisible(true);
            

       }
}
Stefano Mtangoo 455 Senior Poster

>Don't use system("PAUSE"). It is causing unncessary
>overhead to your program by making system calls.
system("PAUSE") is typically used to keep a command prompt window open after the program is finished. Overhead is irrelevant when the very nature of the system call is I/O bound. More important is the fact that a malicious party can easily replace the pause program with malware, and the program will innocently run it with it's own privileges. It also hurts portability because the pause program isn't standard across platforms.

Bum! I was having wrong concept ;)

Stefano Mtangoo 455 Senior Poster

Thank you. I am trying that out now.
I can use system ("PAUSE") in a gnu compiler, right? Also, would it be better to use system ("PAUSE") on cin.get()?
Does system("PAUSE") also wait for an key to be pressed?

Don't use system("PAUSE"). It is causing unncessary overhead to your program by making system calls. Just stick with the latter

Stefano Mtangoo 455 Senior Poster

What have you done so far?
Your code? Do you know how to convert binary to decimal?

Stefano Mtangoo 455 Senior Poster
$search = $_GET['search']; ['start'];

I have tried to locate the variable search on submission but I cannot see it. It should be submitted via get. I'm I overlooking it somewhere in posted code?

Stefano Mtangoo 455 Senior Poster

There is excellent guide here. Haven't tried though

Stefano Mtangoo 455 Senior Poster

The problem solved!! I don't know why!!
After uninstaling this thing, I try to install it again by:

tar xfz MySQL-python-1.2.3c1.tar.gz
cd MySQL-python-1.2.3c1
python setup.py build
python setup.py install

then the program works!
I think the problem may be caused by unproper installation( I need to install mysql-devel before trying to install mysqldb )
To conclude:
1) install Mysql
2) install mysql-devel ( alias : mysql-devel, libmysqlclient-devel )
3) install setuptool, the Mysqldb package included this
4) untar the mysqldb file
5) cd to the folder
6) python ez_setup.py (this will install the "setuptool" )
7) python setup.py build
8) python setup.py install

From that you missed mySQL headers and it should have spit that out but strage enough it didn't

Thanks anyway!! Thank you evstevemd!!
I created a table in mysql via python!(the first step)

Eureka to you? I'm glad I helped. It is good thing to mark thread solved and....you are welcome :)