lllllIllIlllI 178 Veteran Poster

Oh, Woops :P then congrats admins.. Whoever did it did it really quickly

lllllIllIlllI 178 Veteran Poster

That was amazing, in 20 minutes you managed to ban Josh4. Im quite impressed at the speed you work at. And the forums are all clean again. So you really will only have noticed him if you were on here for a period of about 20 minutes :)

So congrats guys :)

lllllIllIlllI 178 Veteran Poster

Yeah there is still no py2exe support for python 3.x

lllllIllIlllI 178 Veteran Poster

And also change the like

app.Mainloop()

to

app.MainLoop()
lllllIllIlllI 178 Veteran Poster

I think he is a user called JoshSCH who is banned, but he has just made a new profile.

lllllIllIlllI 178 Veteran Poster

>Thank you for your friendly answer.
Yeah that wasn't friendly at all, ignore him, it seems a previously banned member has gone around screwing up the forums by posting huge amounts of threads and being rude in answers

lllllIllIlllI 178 Veteran Poster

Okay so you need to just copy the names file into

C:\Program Files\Wing IDE 101 3.2\src\debug\tserver\

lllllIllIlllI 178 Veteran Poster

Could you post the exact error? That can help a lot.

As well there are a few things you need to address.

def name_list():
    infile = open('names.txt', 'r')
    names = infile.readlines()
    infile.close()
    index = 0
    while index < len(names):
        names[index] = names[index].rstrip('\n')
        index += 1
    return names

When you have return names it doesn't actually do anything as in the main function you do not store the returned value in a variable. So in that case you should do something more like

def main():
    names = name_list()
    print_list()
    write_output()
    search_list()

Now the returned value will be stored in names..

well hopefully that helps a little :)

lllllIllIlllI 178 Veteran Poster

Ah, excellent. threading is a great thing to show people.... Im still stuck for another idea for a tutorial though.. Unless i do wxPython ones. I already have some of those at my site tho :P

lllllIllIlllI 178 Veteran Poster

Ah yeah, forgot about doing the compiling of them. Im glad you liked it though :)

lllllIllIlllI 178 Veteran Poster

Regex is one of the more complicated modules that you can use in python. Once you have learnt it though you can use it many different programming languages, so its a useful tool for using with strings.

So first to use regex you must import it

import re

This loads the module for us to use.

Regex is a module designed to make strings easy to manipulate and is often used to check for correct input.

For example

r = raw_input("Please enter an email address")

But how do you know without complicated checking that they have entered the right format of something@something.com? Well to check this normally we would need to index the '@' symbol, as well as make sure they had the right words (.com) and that it was all in the right order.

But with regex we can work this out in one line... that is after working out the regex string.

So lets start on the email..
First we have to understand what an email needs in it:

  1. A Beginning (xxxx@mail.com)
  2. The '@' sign
  3. a domain (mail@xxx.com)
  4. and a .com (we are not going to make it for .orgs/anything else)

So lets start (please see below for explanation of symbols)

import re
#Lets make a fake email...
email = 'bogusemail123@sillymail.com'

#to make a re pattern we use a string
pattern = "^[A-Za-z0-9.]+@[A-Za-z0-9.]+.com$"

#now we check if it matches
re.findall(pattern, email)
#Yes! it …
lllllIllIlllI 178 Veteran Poster

Wow a tutorials, i havent seen one of these posted for aages...

lllllIllIlllI 178 Veteran Poster

You can find out how something is make up by using the dir() function.

This lists all of the variables, methods and classes of whatever you put inside the brackets :)

lllllIllIlllI 178 Veteran Poster

Thanks! Thats it. :)

lllllIllIlllI 178 Veteran Poster

Yup, it works with mIRC :S Thats weird

lllllIllIlllI 178 Veteran Poster

Hmm.... I'll download a client and try again

lllllIllIlllI 178 Veteran Poster

Hi,
Im using wxPython for my latest project and i was wondering, how do i make the window go to the best size, so it includes all of the objects on screen?

I used to be able to remember... but i forgot :P

lllllIllIlllI 178 Veteran Poster

Ah, Thanks guys.. I have been using the Mibbit client that you can find in my sig.. Not sure if that could be the problem or not though :S

lllllIllIlllI 178 Veteran Poster

Hi,
I thought it would be nice to go on IRC today and see if anything is happening. But i went in and entered my username "Paul Thompson" as my name and halfway through logging on it went like this:

+++ Paul Thompson set to mode +iwx
(Something about this nic not being registered)
You are banned from the channel #Daniweb

I tried using other names but it all seems to come out like this

+++ Paul_Thompson set to mode +iwx
You are banned from the channel #Daniweb

And seeing i have only been on daniweb irc 4 times, i am a bit confused as to how i got banned, as i hardly talked at all and it was certainly nothing bannable. :S

Cheers
Paul

lllllIllIlllI 178 Veteran Poster

Well you can use the type() function to show what type the number is:

>>> type(12)
<type 'int'>
>>> type(12.4)
<type 'float'>
>>> type(input())
12
<type 'int'>
>>> type(input())
12.5
<type 'float'>
>>>

So you can adapt that to check for any type. So when you input something you can do something like

#Keep pass as False until they have entered an integer :)
cont = False

while not cont:
    i = input("Enter input (integers only):")

   #This checks if the type of the input is equal
   # to the int type. Just as we saw above
    if type(i) == int:
        #If it is then the loop can stop and the program can continue
        cont = True

Hope that helps :)

lllllIllIlllI 178 Veteran Poster

Well my recommendation is avast :)

lllllIllIlllI 178 Veteran Poster

Alright. Cheers grib. I was hoping you could help with this :)

lllllIllIlllI 178 Veteran Poster

So.. By importing the program into its own __init__ module it then imports everything in the folder... Or am i still missing the point?

lllllIllIlllI 178 Veteran Poster

Hmm... I have always wondered.. What is the significance of the __init__.py filename? I know what __init__ but what does it do in relation to files?

lllllIllIlllI 178 Veteran Poster

Hi guys,
Im a making a program where i need to be able to specify a folder and have my program import every module from that folder into my program... I was wondering how i would go about it. I can't use something like eval.

But yeah, help would be greatly appreciated :)

Cheers
Paul

lllllIllIlllI 178 Veteran Poster

Ancient Dragon, new favourite golden oldie :P

Really though, this whole thread just sounds a lot like "he said", "she said". I havent heart an argument like this since primary school :S

lllllIllIlllI 178 Veteran Poster

If you are using python 3 then you just have to change your input and print statements to fit

order=int(input("Please enter the price of the order: "))
x=1.50
if order <10:
    print("the total price including the delivery charge is", order + x)
else:
    print("The toal price including delivery charges is", order)

HTH :)

lllllIllIlllI 178 Veteran Poster

Woah, people seem easily offended today. :S But back to the topic at hand, i'm quite annoyed that is talked about how it was a mix of python C++ etc. Because i really couldn't see much of the python in it, it doesn't look like python, it compiles, unlike python and im just trying to find when i see the thing that makes me think. Oh that sure is python!

And i want it on windows :P

lllllIllIlllI 178 Veteran Poster

Sooo. What work have you done? Its nice to see a base from which we can help you.

lllllIllIlllI 178 Veteran Poster

Okay, first of all you need to learn a bit about scope:
http://www.network-theory.co.uk/docs/pytut/PythonScopesandNameSpaces.html
That is basically where a variable lives, so you have the problem that when you call menu() the variable option doesn't stay in memory after that function is completed. But don't fret :) that can be fixed very easily.

def menu():
    print ("High Score Keeper")
    print (mitems[0])
    print (mitems[1])
    print (mitems[2])
    return raw_input("Please choose an option (0-2): ")

option = menu()

See how i added a return? That means that the value is returned to the variable...

Sorry, i would help further, buut its dinner time :P

lllllIllIlllI 178 Veteran Poster

A lot of developers aren't bothering changing their modules to 3.x I dont upgrade personally because i know if i do i will not be able to use wxPython anymore :(

So yeah, also seeing the last newspost was almost a year ago i have a feeling its not that active anymore... But heh, i could be wrong

lllllIllIlllI 178 Veteran Poster

Yeah i had optus for a while there but after starting an internet and home phone bundle they only realised about 4 months in that they didn't actually service our area after all and that might be the reason our old phone company kept sending us bills. Thanks optus...

But yeah after all of the horror stories about Telstra i am pleasantly surprised about the service we do receive. It gets a proper 1.5MB
[IMG]http://www.speedtest.net/result/618787943.png[/IMG]

Well... close to..

lllllIllIlllI 178 Veteran Poster

Yeah.. im just saying a bot could be a lot more a nuisance if it was able to report 3 posts a second or something. That would clog up the system. So it gives the admins time to reel in the bot before it gets to annoying.

lllllIllIlllI 178 Veteran Poster

It could help stop it flooding with bot posts or something though.. Otherwise they could make loads.. It could overwhelm the admins :P

lllllIllIlllI 178 Veteran Poster

:S G - Rated....

lllllIllIlllI 178 Veteran Poster

http://xkcd.com/297/
Sorry, i dont usually link things. But this feels appropriate :)

lllllIllIlllI 178 Veteran Poster

Yeah, i was really surprised. But it seemed that before the login menu popped up it would take an age with AVG installed while avast seemed to solve it. Not sure why though, i just say someone on the net with the same problem and they fixed it that way.

lllllIllIlllI 178 Veteran Poster

Yeah, im still using avast and it seems to keep the boot time fine. I used AVG and it seemed to slow down a LOT

lllllIllIlllI 178 Veteran Poster

Cost a lot of money? What for? The server that ran the movie bandwith or something?

lllllIllIlllI 178 Veteran Poster

Newcastle - Australia
with Telstra i get 1.5MB/s down and 256kB/s up

lllllIllIlllI 178 Veteran Poster

Yup, 20 seconds from pressing the on button to get to the log-on screen.
another 20 seconds and my desktop was fully loaded :)

lllllIllIlllI 178 Veteran Poster

Hahaha, you should have been here a few weeks ago, you really would have enjoyed this topic:
http://www.daniweb.com/forums/thread228059.html
But as this is not a topic about bagging windows, its about saying who's got it and first experiences and so on, there really is no need. Start a new thread for that.

lllllIllIlllI 178 Veteran Poster

If you want to write something at the start of a file though you would need to do something like this

#opening the file in read ("r") mode
f = open("file.txt",'r')
#get all that is in the text file so far
oldString = f.readlines()
#and close it
f.close()


#delete it so we can reopen the file in write mode ('w')
del f
f=open("File.txt",'w')

#the string we are adding
newString = """
Hello
This will go
At the start"""

#writing the new string

for line in newString.split("\n"):
    f.write(line+'\n')

#writing the old string
for line in oldString:
    f.write(line+'\n')

#closing the file

f.close()

That is untested code.. so im not quite sure how it will work, but hopefully it shows the concept i am trying to show :)

hope it helps :)

lllllIllIlllI 178 Veteran Poster

yes. It is faster, i used to run XP and now i have installed windows 7 there is a very noticeable speed increase, especially on the startup time.

Dont immediately discount things before trying them, and also i bet your girlfrends laptop cost a lot more money then you are running the XP system on. If you payed the same amount of money as you did for the mac i think you would find it would be closer to 35 - 40 seconds, that was what it was for me on a $500 netbook.

bonsev39 commented: I tried Windows 7 Ultimate RC version and its fantastic. It install automatically all the needed drivers not supported by XP. +0
lllllIllIlllI 178 Veteran Poster

Hahaha well i might as well use my eyes while i am still young. :P
Actually i would love a big computer in some ways. The portability of a netbook though is exemplary. And whenever i need a large screen i just plug it into my widescreen monitor :)

If i had more money though i would invest in something a little more.. powerful

lllllIllIlllI 178 Veteran Poster

Yep, I think it's a pretty essential thing to have. For example, alot of the time when I browse the C/C++ forums, I find a thread I feel I can answer, but then I see someone such as Ancient Dragon is already at it, it saves me having to make a useless second post.

It's also just generally nice to see who's online :)

I must say i agree. I will do the same in the python forum.. If vegaseat is already there, i needn't bother.

lllllIllIlllI 178 Veteran Poster

I find them fairly useless.

:O thats my only computer.. it does what i need it to do. And it only cost me $500 which was all i had when i was shopping for computers.

lllllIllIlllI 178 Veteran Poster

:( No its not just you.. Thats a bummer. I liked that

lllllIllIlllI 178 Veteran Poster

Just go to uni :P then its only $50 AUS

lllllIllIlllI 178 Veteran Poster

Ha Ha!! Hello from windows 7 running on my netbook :)