- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 5
- Posts with Upvotes
- 3
- Upvoting Members
- 4
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Finishing my CS master thesis in system development. Working as a java consultant at Know IT Objectnet in Oslo, Norway.
I program java, python, php and do some web development.
- Interests
- Music, computers
- PC Specs
- Dell xps M1730, T9300 @ 2.5GHz, Windows Vista (urk), 2x Nvidia 8800M GTX in SLi.
Re: I'm not sure, but I think the reason why the txt-file is empty, is that you have redirected standard-output to the textfile, and the compiler prints all error-messages in error-output. if you redirect with 2> instead of > you get the error stream. example: [icode]javac *.java > output.txt 2> error.txt[/icode] … | |
Re: from: [url]http://www.crummy.com/software/BeautifulSoup/3.1-problems.html[/url] [quote] In Python 3.0, the latest version of Python, SGMLParser has been removed. The only parser that's part of the Python 3.0 standard library is HTMLParser, a simpler parser that's much worse at processing malformed HTML. In the meantime, an excellent new HTML parsing library called html5lib has … | |
Re: You have to use the x and y values for it to have any effect. [code=python] Box((20 + x, 20 + y), 100 + x, 100 + y) #the house [/code] if Box takes x1, y1, x2, y2 as arguments the code above should work | |
Re: It all depends on what you are doing. If you are starting B.jar from A.jar as a new process, it's quite simple. Just kill the process. If you launch the two programs seperately from the OS, I don't think you can do it in plain java. I think you can … | |
Re: If you use PyDev ([url]http://pydev.sourceforge.net/[/url]) you should get everything you need. | |
Re: 1. The SerialUID thingie You can make this go away permanently if you go into eclipse-preferences->java->compiler->errors/warnings and change "Serializable class without serialVersionUID" to Ignore. It's not a good idea to get used to creating a serialUID without knowing why it's there in the first place. May cause you a bunch … | |
Re: Can python: - Read text files? Check - Connect to a server? Check - Update a html-file? Check - Serve web-pages? Check - Anything that any other programming language can do? Check :) | |
Re: Check your httpd.conf file in the apache installation. Search for mod_rewrite and uncomment the line. Then you should be able to use it. Xammp has mod_rewrite disabled by default | |
Re: To do this you have to know how to convert a number from one base to another. If you take a look at [url]http://www.cut-the-knot.org/recurrence/conversion.shtml[/url], it has a decent explanation. You can iterate over a string like a list, so you can extract each character. Then you can convert that character … | |
Re: One more thing, it's common practice for ISP's to block port 25. So if you are trying to set up a mailserver from your home connection, you might be out of luck. ISP's block port 25 to make sure people don't spam, or have viruses/crapware that uses their computers to … | |
Re: You have to convert the string from the input to an integer. [code=python] x = int(input("Enter a value: ")) [/code] Remember you have to catch the exception that will be raised if the input is not a number. | |
Re: Is this what you are after? If you change your repeat function to [code=python] def repeat(f, n): totalFlips = 0 for i in range(n): results = "" while not results.endswith('hth'): results += f() totalFlips += 1 print("It took {0} flips to find HTH".format(len(results))) return totalFlips [/code] If you call this … | |
Re: There's an extra '}' at line 77. Don't know if that's the problem. You should also make use of the mysql_error() to see what's wrong. Add this after the insert: [code=php] if (mysql_affected_rows($conn) != 1) { die(mysql_error()); } [/code] | |
Re: First off, to include a file in a different folder, you don't have to change your current working directory. A folder in python is called a package, and the file in that folder is called a module. To correctly create a package, you have to create a file called __init__.py … | |
Re: If I understand your code correctly, you have two lists. One list called english_to_german where you store the words in "pairs", i.e. index 0 is the english word, and index 1 is the german translation. And the other way around in german_to_english The way you can do this with a … | |
Re: Maybe [url]http://www.py2exe.org/[/url] is what you are looking for? | |
Re: Well, you have to mount it properly in the OS. Then you should be able to access it like any other drive. | |
Re: You could also use a dictionary with the labels as keys and results as values. Then you can sort the keys and access the value through the dictionary. I think that's cleaner than using three lists. Just my $0.02, though | |
Hi, In my current project I'm trying to compose some objects at runtime based on a string containing the object-configuration. Based on the "Favour composition, not inheritance" pattern, but done runtime. My usecase: I have a downloader that downloads web-pages. The downloader is configured with a set of request-handlers and … | |
Re: Here a function that creates a 3xn matrix. [code=python] def create_3n_matrix(n): return [[[None for x in range(n)] for x in range(n)] for x in range(n)] [/code] calling [icode]create_3n_matrix(3)[/icode] creates the following: [code] [[[None, None, None], [None, None, None], [None, None, None]], [[None, None, None], [None, None, None], [None, None, None]], … | |
Re: Classes are excellent in this case. That's what they are there for - organizing data :) Consider using a base class for Animal, and subclass the other animal if you know the value at compiletime. Or use a subklass where you fill inn the attributes at load-time. I included some … | |
Re: From the module [icode]inspect[/icode]'s documentation: [icode]inspect.getsourcelines(object)[/icode] Return a list of source lines and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of the lines corresponding to the object and the … | |
Re: You have to implement the run() method so the thread can actually do something, or wrap your code in a Runnable and pass that to new Thread(myRunnablePassangerObject).start() Maybe this can help you on your way: [url]http://www.javaworld.com/javaworld/jw-04-1996/jw-04-threads.html[/url] | |
Re: [QUOTE=jameswoodhouse;848714]$sql = 'SELECT * FROM cartable';$finalurl = '<a href=''.$row['carwebsiteurl'].''>'.$row['carname'].'</a>';echo $finalurl; Now it just shows a blank page, no errors though!!!![/QUOTE] Just to check, you have actually executed the query, right? And fetched the result with mysql_fetch_assoc? | |
Re: Thought I could give some input in how to look at the problem in a different way. 1. Don't use <font> tags. Ever. Really. Never ever. They are evil. Use classes and css instead. 2. Why use mysql_result and save each in a variable? mysql_fetch_assoc does what you want, and … | |
Re: Your image is not actually sent to the brower when your script ends. The browser downloads the html, finds a <img>-tag, and uses the url in the src-attribute to request the image from the server. So it's two separate requests. What you could do, probably, is to intercept the request … | |
Re: I know this is a solved thread, but I thought I should clearify the second question about why 3^2 is 1 instead of 9. The exponential operator in python is **, as correctly given above. The ^ operator, however, is XOR (exclusive or). This operator works in the way that … | |
| Re: open a terminal and go to your code directory. type in the following: [code]python path_to_2to3.py yoursourcefile.py[/code] The tool will then output all the changes that it can perform. If you want to write the changes back to the file, use this command instead [code]python path_to_2to3.py -w yoursourcefile.py[/code] Take a look … |
Re: Another reason to stay away from 3.0 is that there's (AFAIK) no mysql access libraries yet. Libraries for pretty much everything is pretty scarce for python 3.0. But, check out what's new in python 3 vs 2.x and try to code as close to 3 syntax as possible. It makes … | |
Re: When you open your csv-file, you use the mode "w+b". Any reason you're opening the file as a binary instead of a regular text-file? Anyway, if you want to append text to a file you have to use "a+" (or "a+b"). If you take a look at [url]http://docs.python.org/library/functions.html#open[/url] it says: … |