- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 8
- Posts with Upvotes
- 6
- Upvoting Members
- 8
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
23 Posted Topics
Re: [QUOTE=Rete;130037]I have another problem with pythons Input, and I was wondering if someone could help me. Whenever I get any input from the user, python keeps printing out on a new line. So for example: [B]test = raw_input ("Input word")[/B] [B]print "Why "+ test +" there a line break all … | |
I've tried this a number of different ways and I've even downloaded the Regular Expression reference sheet from addedbytes.com, but I just can't figure out how to move this eregi_replace() statement into a preg_replace() statement. I've read and understood the delimiter requirements for preg_replace(), but I think the problem is … | |
Re: You need to modify your php.ini file to increase the max_execution_time setting to a value higher than 60 seconds. Or...streamline your code if possible to perform the work in under 60 seconds, if possible that is. | |
Re: You shouldn't be asking people to write your code for you, it appears you're doing this for school or some other project. However, to direct you in the right direction, have a look at the PHP 'explode()' function. [URL="http://www.php.net/manual/en/function.explode.php"]http://www.php.net/manual/en/function.explode.php[/URL] There are some examples on that page that should show you … | |
Re: Your 'update' link needs to be it's own form. You have 'form1', so make this 'refreshForm' or the like. Once you've create the form, the form action needs to be something like: [code]action="update.php?update=true"[/code] That is, if the file is named 'update.php'...use whatever file name you've given. Then, you'll need to … | |
Re: Are you trying to just validate that the first four characters of a username consists of alphabetic characters? You can use the "substr" function: [code]$username = "MyUser"; if(preg_match('/[A-Za-z]/', substr('abcdef', 0, 4)) { $valid = true; } else { $valid = false; }[/code] | |
Re: Check out Usable Forms. [url]http://www.quirksmode.org/dom/usableforms.html[/url] | |
Re: Since "header()" doesn't provide any output (at least not to my knowledge), the only way I can see this working for you is to use cookies. Redirect with a variable in the URL, for example: [code=php]$cname = "nopage"; $cvalue = ""; $cexpire = time()+3600; // 1 hour $cpath = ""; … | |
Re: You need to run the file from the Windows command line, not the Python command line. You should also be able to select "Run" from within the Python IDE in Windows. For example: [code] C:\Users\user1\Python Files> python script1 [/code] It may also be easier for you to just run it … | |
Re: Open the file and place it in a list (this puts the file in memory). From that list, keep track of your location in the list. If the item is found, confirm the delete request, then delete the list item (line). For example: [code=python] #if editing if action2 == '2': … | |
Re: [QUOTE=nsutton;1200219]How can i use this code (below) to take the random numbers from the dice roll and change 6 to "A" and 5 to "K" and ect.[/QUOTE] Use a Python dictionary...or two. [code=python] #!/usr/bin/env python import sys, random dice_to_cards = { 1:'9', 2:'10', 3:'J', 4:'Q', 5:'K', 6:'A' } hand = … | |
Re: This is my opinion of having a yes/no question with a default, but you should capitalize the default letter and leave the other lowercase. You also need to take into account that the raw_input() function will provide you with a line break as well (\n) and therefore should be striped. … | |
Re: First, in your mainPage() function, you can't do this: [code=python] s +='<a href = http://www.speedfinance.appspot.com/microsoft>Microsoft</a>\n' return s for name in company: generateMainPage(company [/code] You're returning before you reach the 'for' loop. The loop will never be executed and you *should* be getting a Python indentation error, as well a syntax … | |
Re: Though I've never used it, try [url=http://pymediaserver.sourceforge.net/]PyMediaServer[/url]. | |
Re: Why don't you take all of the content for the "mainPage()" function, put it in a text file, then open and read the lines? There's not a single line of actual Python code and it's basically a waste of space. You're not even performing string replacement, so it brings nothing … | |
Re: Your 'playgame()' def doesn't actually return anything. Why not return a 1 for win or a 0 for loose. Then, in your main() function, use: [code=python] ### Main Script wins = 0 games = 0 while 1: result = playgame() if result == 1: win += 1 pass games += … | |
I'm using Python and the Python CGI module to do some web development for a system's administrative access page. The problem I have is that the current features allow you to reboot the system, power off the system and stop/start/restart system services. The system is very limited in what's running … | |
I have a toaster system that does one thing. I'm looking to provide some network troubleshooting ability to the extremely stripped Linux OS by providing the 'dig' command. However, it appears that 'dig' is only available via the 'bind' package. My questions is: has anyone ever successfully buildt a dig … | |
I've been going through some PHP code for an open source applications and I've been seeing a lot of use of the "@" symbol in front of functions. For example: [code=php] if (!@copy($_FILE['attachment'], $dest)) { return $error['failed']; } [/code] My question is: what is the "@" symbol in front of … | |
I've been writing PHP for about two years now, nothing complex, mostly just HTML form processing scripts. My latest project for a customer has over 40 items in the form. It's a dynamic form using some JavaScript and PHP that displays certain parts of the form based on other options … | |
Re: [quote] What I want to be able to do is display a different image depending on the url such as mywebsite.com/index.php?name=aname=red or mywebsite.com/index.php?name=aname=blue and it displays a red or blue image depending.[/quote] You would have to supply two variables in the URL, then use $_GET. I do this same thing, … | |
Re: If you're looking for a single key-press event, my suggestion is to use 'termios', but you'll need to make sure that you import termios before you try to run it. Here's something that I use when waiting for a user to input a single key strong from a menu option: … |
The End.