G_S 38 Junior Poster in Training

One of the most popular ones is Eclipse with PyDev. It has the button you want and also debugging features. PyDev is the plugin for Python.

Another nice one would be Ninja IDE.

Both are free and opensource.

A simpler IDe would be WingIDE. It's very good for learning Python as you don't have to setup a project to work in just one file.

G_S 38 Junior Poster in Training

Turns out it doesn't even place links to itself anywhere. I just had it install in /opt/ActivePython/ and it didn't place anything outside that location. So no problem I have Python2.6, ActivePython 2.7, Python3.1, and ActivePython3.2.

Gribouillis commented: thanks to let the rest of us know +13
Lardmeister commented: great info +10
G_S 38 Junior Poster in Training

Think about MIT's Scratch. It's a nice graphical environment for children. It's like LOGO: http://scratch.mit.edu/

G_S 38 Junior Poster in Training

I think IE is THE worst browser, not just graphics-wise. Don't know about the latest version though.

G_S 38 Junior Poster in Training

I have a couple of lovebirds. I let them loose in my house. Right now, one of them is chewing on my books, arrrgg gota go catch it!

G_S 38 Junior Poster in Training

I'm not very experienced but I have been doing exactly what jakedrake333 suggests for 2 years and it DOES work. Imust add that trying to make a program that is useful for your own job is also a way of keeping yourself motivated and engaged with the project.

G_S 38 Junior Poster in Training

I know this is old, but just in case somebody sees this and finds it useful: the problem is definitely Virtual Box. It works properly in a real Windows installation.

G_S 38 Junior Poster in Training

Do you think that this would still happen if I choose a different install directory?

G_S 38 Junior Poster in Training

Sorry for the incredibly late reply. Thanks for the answer.

G_S 38 Junior Poster in Training

Thank you very much everybody (forgot to thank and mark as solved, sory)

TrustyTony commented: Better late than never ;) +12
G_S 38 Junior Poster in Training

Uuuhh? What game are you talking about? In Wild Arms 3 they move a lot on their own, but it has no efect on the battle per se. You don't move the characters, they just relocate on their own. In Shadow Hearts 2 and 3, they also relocate, or rather stay in one point after the attack instead of comming back to a particular area, but it's also command based, you don't move anyone around.

Again, what game are you referring to?

G_S 38 Junior Poster in Training

Though Question. The only FF games available for PS2 are X, X-2 and 12. Your second condition rules out Final Fantasy 12, so the only one left is X-2, whose storyline continues X's, but sucks. There are no summons, only three characters, and the gameplay is basically a bunch of minigames an an occasional good fight.

I suggest you try other PS2 RPGs. For example, the Shadow Hearts series has an excellent storyline and the fighting system uses commands, yet is very innovative.

The Wild Arms series also has commands and summons. There are 4 entries for PS2 (WA 3, 4, and 5). Their storilines have nothing to envy FF and the graphics (specially in 4 and 5) are pretty good.

Another good series is Mana Khemia/Atelier Iris. These have retro graphics (use youtube) but a very interesting gameplay for an RPG. The battle system is command oriented but it's awesome.

G_S 38 Junior Poster in Training

Hello everybody. I want to make sure about something:

If I install ActivePython 3.2 as root on Linux, will it delete the distro's default Python (2.6)? I also installed Python 3.1 a long time ago, so I have Distro's Python 2.6, the official Python 3.1 and want to add this other ActivePython. Will it pose any trouble?

G_S 38 Junior Poster in Training

Nevermind I found the answer on my own:

The server has to have some email-sending software. In Linux I had to install sendmail to get it to work.

G_S 38 Junior Poster in Training

Thank you very much, rch1231. It worked like a charm.

G_S 38 Junior Poster in Training

Thank you for your prompt reply. However, I do not understand something: my blog is hosted on a local LINUX server and the WINDOWS clients can access it via IP AND NAME. So it's working wonderfully in a Linux (server) - Windows (client) environment. The problem is that Linux CLIENTS can only access the LINUX server using the IP.

Should I then change the Windows hosts (that's what I understood in your reply, correct me if I'm wrong).

G_S 38 Junior Poster in Training

Hello Everybody. I'm not sure if I should post this here or in the Linux forum. Here goes:


1 - I have a local Linux server (Mandriva 2010) with a WordPress blog in it. It's for testing.

2 - I have other 2 computers at home (both have Linux and Windows), all of them connected to the local network via a Speedtouch router.

3 - For PHP, MySQL, and Apache, I'm using XAMPP

4 - I want to access the blog from the other two computers.

5 - I can access the server from Windows either via IP or server name.

6 - Under Linux, I can only access the Blog via IP, if I use the server name, the browser goes stright to google and does a search using that name.

7 - I read on the Internet that I should do something to the router, but I don't know.

8 - I tried disabling the firewall on one computer running SuSE 11.4, the problem continued. Can't try the same on the other one because it is Linux Mint, and I don't know how to disable it's firewall :P

9 - I don't know if the problem is the router or the Linux configuration.

The problem is I need both Linux computers to be able to access the Blog via NAME, not IP.

The machines are perfectly connected: I can share files via SAMBA and across …

G_S 38 Junior Poster in Training

I get this:

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\Tests\tessst.php on line 2
ERROR

So, the mail() function is not working...

G_S 38 Junior Poster in Training

Hello. I need your help with PHP.


I recently began studying it, and I am stuck at the "make a contact form" exercice.

I am trying to understand the concepts behind it. I think I get everything, but still my Form won't work.


I event went as far as to reproduce an example from the Internet, and it doesn't work either... I'm starting to think there is something wrong with my PHP installation.


Here is the HTML code for the form:

<html>
<body>
<form action="send_contact.php" method="post"> 
<table width="400" border="0" cellspacing="2" cellpadding="0"> 
<tr> 
<td width="29%" class="bodytext">Your name:</td> 
<td width="71%"><input name="name" type="text" id="name" size="32"></td> 
</tr> 
<tr> 
<td class="bodytext">Email address:</td> 
<td><input name="email" type="text" id="email" size="32"></td> 
</tr> 
<tr> 
<td class="bodytext">Comment:</td> 
<td><textarea name="comment" cols="45" rows="6" id="comment" class="bodytext"></textarea></td> 
</tr> 
<tr> 
<td class="bodytext">&nbsp;</td> 
<td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td> 
</tr> 
</table> 
</form>
</body>
</html>

And here is the code for the php file (send_contact.php):

<?php 
$ToEmail = 'my@email.com'; 
$EmailSubject = 'Site contact form '; 
$mailheader = "From: ".$_POST["email"]."\r\n"; 
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; 
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
$MESSAGE_BODY = "Name: ".$_POST["name"]."<br>"; 
$MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>"; 
$MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])."<br>"; 
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); 
?>

I'm getting this error:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\send_contact.php on line 10

and then it says

Failure

whic means the code IS running to the end, …

G_S 38 Junior Poster in Training

> 0. I added that "/" and everything is fine now.

As I have been mentioning repeatedly, you should never have a need to deal with "/" or "\" when dealing with files in Java. The different File constructors make it possible for you to manipulate paths in java in a platform agnostic way.

OK, got it. So I have to get rid of the / and \.


I'll try your last snippet. The problem was that I'm not using File, but FileWriter, and FileWriter seems to be unable to write to places that don't end with '/'.

I see, so I'll have to use a config file to get it to write to My Documents? I guess I'll have to have the user specify a filesave path...

G_S 38 Junior Poster in Training

> Now, I tried to follow S.O.S's advice regarding filepaths, and I came up with this:

You are still relying on string concatenation for building up file/dir paths. Also, what exactly happens when you say "doesn't work"? Exception? Here is a simple snippet which should work and uses File constructors instead of "+" on Strings.

// try..catch..finally left out for brevity
public static void main(String[] args) throws Exception {
	final File homeDir = new File(System.getProperty("user.home"));
	final FileWriter writer = new FileWriter(new File(homeDir, "a.txt"), true);
	final PrintWriter pWriter = new PrintWriter(writer);
	pWriter.printf("%s -> %s%n", "home", "a place you can always go to");
	pWriter.close();
}

I solved the problem, but DanyWeb wouldn't let me edit after 30 minutes. The problem was that HomeDir is C:\Documents and setting\USERNAME, without the trailing '\' so it was saving the files to nowhere.

I added that "/" and everything is fine now.

So tell me:

1 - How do I get it to write to My Documents folder instead of the home folder (because the name My documents changes with language).

2 - How could I avoid using trailing? Remember that getProperty(user.home) returns the home without the trailing \.

3 - Also, you use a different object for the file, is there any problem with mine? Why are so many ways of creating files with Java?

G_S 38 Junior Poster in Training

Great , great. This is excellent. You're being really helpful :)

I'll post the code as soon as I am done with it. Now, I tried to follow S.O.S's advice regarding filepaths, and I came up with this:

private void writeToFile(String originalWord, String translatedWord){	
		try{		
			String homeDir = System.getProperty("user.home");
			FileWriter theFile = new FileWriter(homeDir + "/My Documents/" + fileName + ".txt", true);
	 		BufferedWriter output = new BufferedWriter(theFile);
			output.write(originalWord + "\t" + translatedWord + "\n");
			output.close();
		}
                catch (Exception e){
			System.err.println("Error: " + e.getMessage());
		}
	
	}

Filename is the filename provided in the constructor. Now the funny thing is it doesn't work if I have it write to user.home, but it does if I add '/My Documents/'. It's a Windows XP machine, so the user.home should be C:\Documents and settings\USERNAME\.

G_S 38 Junior Poster in Training

Oh geat!! That really helps. Question about your code: that this.filename is referring to the classe's filename not to the method filename, right?

G_S 38 Junior Poster in Training

So, there is nothing wrong with having a class without instance attributes? Or should I make the filename a class attribute too?

G_S 38 Junior Poster in Training

yeah ,that works ,there is 16,097 files in mine lol.time to empty it i guess,as soon as i find out how

If you want to empty the cache just press control+shift+delete (in a PC), it will bring up a menu from where you can choose what to delete, including cache files.

G_S 38 Junior Poster in Training

I think he means the cached files, not the downloaded ones.


And yes, you can't see Firefox's cached files as easily as you can see Internet Explorer's. But I found this, it could be useful: http://www.nirsoft.net/utils/mozilla_cache_viewer.html

G_S 38 Junior Poster in Training

Hello.


I recently started studying Java and OOP. I am currently creating a class that writes text to a file in a particular format. I have 'finished' it, and it works, but I am unsure as to the quality of the implementation.

This is how it works:

* First of all: the class has no attributes, just a method... Is this correct?

* Second: the method receives three parameters one word, another word and a sentence. The first word is supposed to be a word in one language, the second would be its ranslation into another one, and the third is a comment regarding the word. All of them are strings

* Third: the method in question is the one that creates three variables (String) to write them to a file.

Is this OK? Should I make a constructor and have the user provide the three strings?

This class is intended to be instantiated by another program (the GUI), this program will collect the three string from graphical user input. My idea is that it takes the input as variables and then passes these variables to the objects mehotd so it can write in the file.

I guess it's poorly designed, any ideas?

G_S 38 Junior Poster in Training

As far as I know, user configuration files are in c:\Documents and Settings\<UserName>\Application Data (<= or however that is called in your language)\Mozilla.

Inside that folder you'll find one folder for extensions and another one for firefox, the latter contains the profile folder, which in turn contais a folder with a random name, the cache files are in there.

The thing ios that Firefox seems to store the cache in a single big file, so it's not like internet explorer.

G_S 38 Junior Poster in Training

Although I'm not a very advanced programmer, I agree with everyone else here VB 2008 or 2010 is the way to go.

As for books, I like these two:

http://www.murach.com/books/vb10/index.htm
http://www.murach.com/books/vb08/index.htm

This series of books is very intuitive and easy to learn in my opinion, the book layout is very helpful to me, as it presents the information and explanations in the left page and the example code/pictures in the right one. So it's pretty easy to follow.

G_S 38 Junior Poster in Training

In cell C2, paste:

=IF(B2="YES",A2, "")

Then highlight from C2 down to the end of your data and hit Ctrl-D. That will copy the formula and automatically change the references.

Execellent, it worked perfectly, thank you very much.

G_S 38 Junior Poster in Training

Hello I need your help with a simple Excel issue:


This is what I have


COLUMN 1 COLUMN 2 COLUMN 3
125 YES
304 NO
1549 YES


Here is what I need:

If the string in COLUMN 2 is 'YES', copy the value in COLUMN 1 to COLUMN 3.

What would the formula for this be? I got this but it just gives me a FALSE value...

=IF(A2="YES";A3=A1;A3=0)

Thank you

PS. I'm using Excel 2007, if that helps.

G_S 38 Junior Poster in Training

Hello.


I am trying to create a module containing many little functions useful for linguistics. So far everything works right, but I have a question: is it a problem if a function within a module calls another function within the same module?

I mean, I have a function that performs a particular process and a second function that produces some kind of out put and then calls the first function to produce something different.


It's something like this:


function A takes a verb in english (to speak, for example) and removes the 'to'.

function B requires parameters for tense and verb, and according to user input it defines the ending to be attached to the verb. So function B receives ('to start', 'past') as parameters. Then it calls function A to remove the 'to' and then attaches the -ed to form 'started'.

It works great, but, is it OK to do have function be call function A (which is in the same module).

I hope it's clear enough

Thanks for your help

G_S 38 Junior Poster in Training

It depends on which version of Python you are using as x could be a string or an integer so print the type().

x = input('write something: ')
    print type(x)
assert("1"==1), "Not equal"

And don't use tabs to indent as the tab can be set to anything on any computer, so is not the same as yours.

I'm using python 3.1.


The problem was that input returns a STRING in python 3.1.

I solved the first problem like this:

def foo():
	x = int(input('write something: '))
	if x == 1 or x == 2:
		print('OK')
	else:
		print('NO')

And voilà. It works perfectly now.

The second problem needed the () to clarify which part could be variable. I didn't know that python accepted parentheses in if statements.


Thank you Woooee, it all works perfectly now.

G_S 38 Junior Poster in Training

Hello,


This is a really simple question but I just don't see the error here:

def foo():
	x = input('write something: ')
	if x == 1 or x == 2:
		print('OK')
	else:
		print('NO')
	print(x)

Why does it keep printing NO?


Also, I have a more complicated one:


def foo(x, y):
if x == 'a' or x == 'b' and y == 'z':
print('OK')
elif x == 'a' or x == 'b' and y == 'w':
print('OK2')

It keeps printing OK instead of OK2.

I have read the documentation and the use I'm giving to the and and or expressions seems correct and logical to me, but obviously it's not (or my logic is flawed).

Any ideas?

G_S 38 Junior Poster in Training

YEs. It seems that Ruby itself can't generate bytecode, but these other alternatives can.

Thank you all guys.

G_S 38 Junior Poster in Training

Maybe this is what you think:
From: http://wiki.python.org/jython/InstallationInstructions#standalone-mode

I tried it already. If I'm not mistaken this thing is another interpreter for python. But it runs java bytecode instead. So if you compile, it generates a .class file instead of a .pyc. I presume I can generate .jar files too.

G_S 38 Junior Poster in Training

Thanks for all your input. I just found something: Jython.


Do you think I can make python programs and then generate jar files that are runnable if users have java. Frankly, the problem with python is that there is no compressed filed containing the compiled code and ready to be executed. My users keep complaining that they don't wanna have a lot of .py files lying inside the program folder bu rather a single file they can put in their USB stick and take (and run) anywhere (Anywhere here means Windows and Linux platforms with the proper interpreter, of course).

So, what's this Jython thing? After reading I understood that this is a different interpreter that can compile python source into java bytecode, am I right?

G_S 38 Junior Poster in Training

It is not possible to generate bytecode with normal Ruby i.e C-Ruby. But I think its possible in Jruby

This very interesting. So, if I understood correctly, this is the same ruby programming language but they removed the standard interpreter and changed it to an interpreter that works using Java bytecode instead of ruby bytecode? So the compiled output is JVM-executable??? Which in turn means I can create Java programs using Ruby?!


If so this is nice :)


Thank you

G_S 38 Junior Poster in Training

I believe you are thinking on the Java Runtime Environment, and that's why you ask about a Python Runtime Environment.

If my observations are correct (I'm also a noob) the JRE is an interpreter that runs the Java code.

Now, since Python is also an interpreted language it also requires an interpreter (a software that has been installed on the machine and has the ability to run python code). So you definitively need the interpreter before you can run any code.

So the user's machine has to have the interpreter somewhere (installed, portable, etc.) before it can run anything.

G_S 38 Junior Poster in Training

Um... I'm not very experienced, but I think tkinter looks ugly only under Linux. It looks too old and definitely not GTK-ish or QT-ish.

Under windows, on the other hand, it looks native to me .


PS. I'm talking about python 3.x and the tkinter version that comes with it and allows you to use ttk widgets.

G_S 38 Junior Poster in Training

Hello again.


Here are the details:


* My litle scripts work perfectly in my virtual Windows XP (I'm using virtualbox if that matters) as long as they are non-compiled .py or .pyw files

* After compiling them, I double click on them and a DOS window comes out, then dissapears almost instantly.

* The window displays an error, but it dissapears too fast. The error reads (I'm not sure since it goes away too quickly) 'python: can't reopen .pyc file'. (By the way, is there any way of preventing DOS windows from dissapearing like this?)

* The program itself has no errors as 1).It runs perfectly prior to compilation AND 2).The .pyc file does run if you type python script.pyc.

This last detail leads me to believe that there must be something wrong with the way python is being called when I double click on it.

G_S 38 Junior Poster in Training

Hello everybody


I have a question: is it possible to compile ruby files into bytecode. Does ruby have something like .pyc files?

I found some discussions online about generating .exe's from ruby files, but what I want to know if it is possible to compile .rb files just like you compile .py files.


Thanks

G_S 38 Junior Poster in Training

Take a look at McMillan's installer; looks like archives is what you are looking for.
Disclaimer: I never used it myself.

Thanks. I have also read something about .egg files, but I don't know them. What can you tell me about them? It seems that they are also another sort of compressed file (like .jar's). But, can you run the program without unpacking/installing?

G_S 38 Junior Poster in Training

Yes .py files.
So think of this jar files will not work if not JRE (Java Runtime Environment) is installed.
To make jar files you need JDK (Java Development Kit)

Py files will not work if python is not installed.
Jus the same as with jar files.

jar are not executable without java installed,just the same as .py files is not executable without python installed.

Yes, I am aware of the need for an interpreter. But .py files are not comparable with .jar files for 2 reasons:

1. .py files are just plain text files containing the source code, whereas .jar files are compressed files containing everything the program needs to run (this is what I want in python).
2. The files inside a .jar are .class files, which don't contain source code, but rather compiled bytecode.

so the comparison would be:

.py files = .java files (I don't know if you can run these with the JVM without compiling, I think not, but am not sure.)

.pyc files = .class files

.jar files = ? This is what I am asking. Is there some kind of python equivalent?


Sorry if my questions are not clear enough, the part of my brain that manages English is on vacation today.

G_S 38 Junior Poster in Training

Hello.

I don't know if somebody has asked this before, but is there any python equivalent to the Java .jar files? I have read about py2exe, freeze, and module distribution, but it's not what I'm looking for. I need a file that can contain everything in my program (and modules must be compiled, by the way), and that the user can double clic to run. On Windows, I found the pyw extension, and this partially covers my need: I compile everything, then change extensions from pyc to pyw. The problem is that my users want only 1 file pre program instead of having a folder with a lot of modules.

Is there any way to produce an executable file containing everything within it like Java's .jar's?

G_S 38 Junior Poster in Training

Thank you all for your quick answers!

The endswith method is going to be really helpful for my project.

I'm going to test all your suggestions and will post back if more questions arise (I'm intrigued by the way you used the lists).

G_S 38 Junior Poster in Training

Hello

I'm trying to make a verb conjugator for Spanish. The problem is that I need to get the last two characters in the verb to be able to determine the verb group to which it belongs.

In Spanish, conjugation depends on the verb ending, among other factors. Verbs end in either -ar, -er or -ir. So the program must be able to isolate these two letters and then use conditional structures to determine how to proceed.


But here is the problem:

verb = input("Write the verb here: ")
if verb[-2:-1] == 'ar':
    do this
elif verb[-2:-1] == 'er':
    do this
elif verb[-2:-1] == 'ir':
    do this
else:
    print('you did not provide a verb')

if verb is 'amar', verb [-2:-1] will return 'a', not 'ar'. Can you tell me a way of telling python to isolate from the second to last character up to the VERY last one?


After much thinking I came up with this:

verb= 'amar'
verb=[-2:len(verb)]
'ar'

But I don't know if this is the right wayor if this is elegant at all.

Please help me.

G_S 38 Junior Poster in Training

You would do something along the lines of the following. Note that if you open the file using a program that does not encompass encoding, then you will see what appears to be some garbage letters. This in not the file's fault, but the lies with the program being used to view it. Also, Python3.X has unicode built in, so what happens depends on which version of Python you are using. If there are any further questions, include the version of Python that you are using with the question.

fp = codecs.open('test', encoding='utf-8', mode='w+')
fp.write(u'\u4500 blah blah blah\n')

See this page http://docs.python.org/howto/unicode.html

Oh, I forgot that, I'm using python 3.1.

could you please explain what the first line does? Is it encoding the whole file?

G_S 38 Junior Poster in Training

Hello,


Now I'm making a program for creating language glossaries, but the problem is that windows uses ANSI for encoding text files, and the program that will read these files (which is not mine) only displays words in utf-8 encoding.


Since my program is multiplatform, it can also work under Linux. In Linux there is no problem at all, because it uses UTF-8 as default, so it works smoothly. The problem is Windows.

Right now I have this:

the program manages to take the words and convert them to utf-8, (or at least that's what I think, see code) then it writes them to the file, but when I open it under windows the character encoding is still ANSI.

I understand I need to turn the file into a UTF-8 file FROM Python (right now I have to open the file and change it myself, everything works fine after that.)

t = word.get()    #I'm using tkinter, word is an entry field
e = meaning.get() #I'm using tkinter, meaning is an entry field
meaning.delete(0, END)
word.focus()
es = e.encode("utf-8") 
ts = t.encode("utf-8") 
es.decode("utf-8")     
ts.decode("utf-8")     

#then the usual write procedure whre I write es and ts to the file.

Thank you

G_S 38 Junior Poster in Training

Hi,


I need your help with a php issue here:


I have a flash form where the user enters some strings. Action Script is supposed to get these strings and place them into variables, then send the to php.

Now php gets these variables and places them inside other variables using $_POST, and then send them to my email.

The problem is that flash returns undefined every time the user clicks on submit.


My guess is that there is some sort of trouble in the communication between php and AS.


here is the php code (which I gues is the wrong one):

<?
$nombre=$_POST["nom"];
$ocupacion=$_POST["ocu"];
$nos_conoce=$_POST["conoc"];
$email=$_POST["ema"];

$para="aquipongomicorreo@gmail.com";
$asunto="envio de correo desde flash";

if (mail($para,$asunto,$ocupacion,$nombre)==true){
echo chr(38) . "resultado=ok";
}

and here is the AS code just in case:

boton.onRelease = function() {
   var correo = new LoadVars();
   correo.nom = nombre.text;
   correo.ocu = ocupacion.text;
   correo.conoc = nos_conoce.text;
   correo.ema = email.text;
   correo.sendAndLoad("correo.php",correo,"POST");
   correo.onLoad = function() {
      resultado.text = correo.res;
      nombre.text = "";
      ocupacion.text = "";
      nos_conoce.text = "";
      email.text = "";
   };
};