- 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.
44 Posted Topics
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: … | |
Re: I can give you some pointers for your first task. The formula you described can be defined as a function. [code=python] def windspeed(t, v): # compute the formula you got in the assignment [/code] Then you create two lists with the values in windspeeds and temperatures. To do this you … | |
Re: Lets say you have a list of apples: apples = [Apple(x, b, c, d) for x in range(0, 50)] Why would you want to have a variable for each of the apples? There's no difference between: [code=python] apple1 = apples[1] #done somewhere in the program apple1.someFunction() [/code] and [code=python] apples[1].someFunction … | |
Re: Just a wild stab - could you use [icode]select[/icode] to solve your problem? Since it's a server, you have a socket that you listen to for incoming connections. you can use [icode]select[/icode] to poll each socket to see if there's data incoming. [icode]sys.stdin[/icode] works in the same way as a … | |
Re: As you probably already know, and have been told earlier in this thread, iterative means you have to solve the problem in one function without calling the same function from within the same function (recursion) What I would use for this is lists. Define a list with the initial solutions, … | |
Re: I'm not quite sure what you want. I gather you want to start a python script from a webpage. 1: Your python app is on the same server as the webpage Solution: you can just execute the python script from the webpage. In the web-controller for the start-action do something … | |
Hello I'm building my own html parser in python, and have ran into some problems. First off, I'm using python 3, so I can't use the old bundled sgmlparser, or beautiful soup and could not find windows binaries for lxml, so I'm rolling my own. It is for my master … | |
Re: I'm using eclipse for all my development in Java. But AFAIK vanilla eclipse doesn't have any good support for GUI making. Were I work we use a really good plugin for eclipse called WindowBuilder (made by Instantiations), wich makes eclipse a viable choice. It's a commercial plugin, costs about $200. … | |
Re: I'm also assuming you're talking about adding columns to a JTable. Adding a new column to a table is quite simple. it goes something like this: [code=java] JTable tabell = new JTable(); TableColumn column = new TableColumn(); column.setHeaderValue("New column"); tabell.getColumnModel().addColumn(column); [/code] Unfortunately, the hard part is getting meaningful data to … | |
Hello. I have been reading this forum for quite some time, and this is my first post. I often have the need to dynamically allocate memory for arrays with multiple dimensions. In my opinion I find it quite ugly to litter the code with multiple for-loops and mallocs every time … | |
Hello I'm building a factory for my DAO's and want it to return the correct DAO based on the class of the ValueObject passed to the factory. Now, if this was java I would use something like this: [code=java] if (valueObject instanceof User) { return new UserDAO(); } else if … | |
Re: If you have written both programs yourself you can use java Sockets to communicate. Take a look at [url]http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html[/url] When the program starts you create a thread that runs the servercode, which listens to a socket. All it does is when it receives incoming connections; accept it, reply, close it. … | |
Hello I'm creating a program where I want a "BeanBox" window for editing an object's properties. I'm thinking something like: [url=http://img301.imageshack.us/img301/5308/javagridtg0.jpg][http://img301.imageshack.us/img301/5308/javagridtg0.jpg][/url] It must retain alot of the functionality that JTable gives: Resizable columns, custom cellrenders & celleditors, min/max column width. So far, so good. I could just use a JTable … | |
Hello. I'm having a hard time figuring this out. I want to open a file, but I don't know the filename. I know the directory the file resides in, and I know the extension ('.lay'), and I know there is only one file with that extension in the directory. How … ![]() | |
Re: I'm guessing from the code that test [inlinecode]if (f == 1.0f)[/inlinecode] always fails. This happens because floating point representation in a computer isn't very acurate. Or perhaps too acurate. It depends on your point of view. It is possible that when you increment f ten times with 0.1 intervals, the … |
The End.