Posts
 
Reputation
Joined
Last Seen
Ranked #714
Strength to Increase Rep
+6
Strength to Decrease Rep
-1
100% Quality Score
Upvotes Received
5
Posts with Upvotes
3
Upvoting Members
4
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
5 Commented Posts
~36.2K People Reached
About Me

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.
Favorite Tags

44 Posted Topics

Member Avatar for shinoske

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] …

Member Avatar for Swap_1
0
138
Member Avatar for Stefano Mtangoo

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 …

Member Avatar for vegaseat
0
985
Member Avatar for txwooley

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

Member Avatar for shasta90
0
591
Member Avatar for ramjeev

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 …

Member Avatar for valatharv
0
4K
Member Avatar for kartal

If you use PyDev ([url]http://pydev.sourceforge.net/[/url]) you should get everything you need.

Member Avatar for patrickwang
0
263
Member Avatar for einhachi

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 …

Member Avatar for painless
0
184
Member Avatar for action_owl

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 :)

Member Avatar for vidaj
0
143
Member Avatar for coolmind259

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

Member Avatar for vidaj
0
455
Member Avatar for EvanPM

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 …

Member Avatar for vidaj
0
154
Member Avatar for ero100@live.com

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 …

Member Avatar for cwarn23
0
149
Member Avatar for Undermine

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.

Member Avatar for Undermine
0
79
Member Avatar for Vihaio2012

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 …

Member Avatar for vegaseat
0
112
Member Avatar for mbabaali

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]

Member Avatar for somedude3488
0
199
Member Avatar for besktrap

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 …

Member Avatar for besktrap
0
10K
Member Avatar for Dart82

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 …

Member Avatar for Dart82
0
96
Member Avatar for gbrokaw
Member Avatar for gbrokaw
0
137
Member Avatar for ihatehippies

Well, you have to mount it properly in the OS. Then you should be able to access it like any other drive.

Member Avatar for vidaj
0
94
Member Avatar for yemu

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

Member Avatar for vidaj
0
2K
Member Avatar for vidaj

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 …

Member Avatar for vidaj
0
105
Member Avatar for jmil2

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]], …

Member Avatar for adam1122
0
8K
Member Avatar for katamole

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 …

Member Avatar for katamole
0
406
Member Avatar for tivrfoa

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 …

Member Avatar for vidaj
0
184
Member Avatar for stevnlon

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]

Member Avatar for stevnlon
0
2K
Member Avatar for jameswoodhouse

[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?

Member Avatar for vidaj
0
205
Member Avatar for kssi89

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 …

Member Avatar for komang80
0
154
Member Avatar for smb3d

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 …

Member Avatar for smb3d
0
153
Member Avatar for max.yevs

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 …

Member Avatar for adam1122
0
108
Member Avatar for leegeorg07
Re: 2to3

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 …

Member Avatar for leegeorg07
0
197
Member Avatar for docesam

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 …

Member Avatar for Mearah
0
168
Member Avatar for shaun.b

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: …

Member Avatar for adam1122
0
199
Member Avatar for matthewsamdanny

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 …

Member Avatar for adam1122
0
1K
Member Avatar for harrykokil

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 …

Member Avatar for lllllIllIlllI
0
150
Member Avatar for toadzky

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 …

Member Avatar for vidaj
0
189
Member Avatar for srk619

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, …

Member Avatar for srk619
0
146
Member Avatar for akhileus87

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 …

Member Avatar for akhileus87
0
124
Member Avatar for vidaj

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 …

Member Avatar for vidaj
0
1K
Member Avatar for lordx78

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. …

Member Avatar for vidaj
0
139
Member Avatar for codered152

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 …

Member Avatar for vidaj
0
83
Member Avatar for vidaj

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 …

Member Avatar for jephthah
0
270
Member Avatar for vidaj

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 …

Member Avatar for vidaj
0
133
Member Avatar for ramjeev

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. …

Member Avatar for vidaj
0
102
Member Avatar for vidaj

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 …

0
95
Member Avatar for vidaj

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 …

Member Avatar for iamthwee
0
105
Member Avatar for gaurav252

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 …

Member Avatar for vidaj
0
106

The End.