Kari Nordmann

Ranch Hand
+ Follow
since Feb 12, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Kari Nordmann

Paul Clapham wrote:You wrote your initial code as if the website used basic HTTP authentication. It's pretty uncommon for websites to use that form of authentication these days -- are you sure that was the right thing to do?


Nope, I have no knowledge of different types of HTTP authentification :p
I've seen various code that is supposed to do the same thing, without telling me there are any crucial differences between them.
It wouldn't surprise me if there's some kind of vital bit of knowledge that I lack in order to do these things.
4 years ago

Yuriy Fuksenko wrote:I actually used HttpClient in a lot of projects with no problem.

did you try this:
http://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientAuthentication.java


I just tried that code. Here's what I get, after replacing the URL, username and pw:

I have no idea of whether I am supposed to replace anything in this line: " new AuthScope("localhost", 443)"
I also have no idea what the output here means. I see that it didn't return any error, but nothing tells me it managed to really log in either.
4 years ago
I have built a scraper, and I now want it to gather information that is only visible to logged in users.
I have a user name and password, full access to the information while logged in, but I'm having trouble logging in via my application.
So far I have the following code:

I got this from a tutorial about logging into websites with Java, and replaced the URL and login info with my own.
When I run this code, all I get is an outprint of the front page - it doesn't log in.

Could anyone tell me what is wrong here?

PS: I have also tried apache commons and HTMLunit, without getting even a single tutorial to work properly.
4 years ago
I have built a scraper for two buddies of mine, and now I'm working on making the program upload the datas to the database.
While testing I am using my own database. I will be making the program so that one of my buddies will himself insert the required information for logging on to their server. That means I don't have access info to their database as of now.
When testing with my own server I keep getting the "Access denied" error. I am positive the user name, password and host is correct.
Googling this problem, all I can find is something about granting access to remote users on the server (it's not a firewall problem).

These two buddies of mine are not very experienced with programming, servers or databases. One of them has only basic computer knowledge, and the other has very limited knowledge of these things.
Thus, I would prefer to have my program be able to connect to their database with as little server fiddling as possible.

Is there any way I can make the program send the grant commands to the server by itself?
If not, could I make this java program execute a PHP script on the server, which in turn could do the uploading? I have never before built a program that executes anything outside itself.
I got this Exception:

I understand perfectly well what it means that an array is out of range, but I have no idea where this occurs or what array is affected!
The weirdest thing is that the exception occurs seemingly randomly. Some times it occurs right away, while some times the program can run a while before the problem occurs.
Also, some times the exception is "java.lang.ArrayIndexOutOfBoundsException: 0 >= 0", while some times it something else, like "java.lang.ArrayIndexOutOfBoundsException: 6 >= 5"

However, the exception mentions a vector, and thus I am pretty sure the problem is somewhere in this method:

It's been a long time since I last dealt with vectors and tables, so I'm kindof rusty at it. It wouldn't surprise me if I've simply forgot something.

Can anyone tell what the problem is?
Thanks.
6 years ago
Well nevermind, I managed to get around it by having java search for <div class=\"wowitem wowitemlive\"> instead.
It's kinda weird though, using .indexof("<div class=\"wowitem wowitemlive\">") works just fine, but .replacefirst\all("<div class=\"wowitem wowitemlive\">") refuses to work... So when I need to replace strings, I have to do it this way:
8 years ago
Well I could just remove all " myself in word, but that's not what Im after.
The program Im working on will 1. import the texts from web, 2. clean them, 3. create objects from them based on user settings, and 4. print the results out to a new file, which I will use in another program.
The reason why I want java to do all this, is because these tasks take a long time(several hours), and I will use this program to make it all automatic instead of checking the progress myself every now and then to start the next step. The whole process would be alot easier for me if I could just click 1 button and have it all completed later.
8 years ago
I'm working on a program that imports source code from several web pages, wipes off all html code and then saves the interesting content in a new file.
To start it off I need to be able to recognize strings like <div class="wowitem wowitemlive"> so that I can recognize and separate interesting parts from each page saved.
How do I tell java to look for a string with double quotation marks in it?
8 years ago
I'm working on a project that will work with lots(hundreds, maybe thousands) of objects of the same type (but different content).
The objects contain information that can easily be put in manually via GUI, but considering the number of items, it would be very helpful to have the program put them in by itself.
All the items that I want in the program can be found on this website www.wowhead.com
So what I want, is have the program search that website for all objects of a certain type, and then put them in a file.
The trouble is that I've barely ever touched html within java, I dont know much about website structures in general, and I really dont know how to do this.
Can anyone give me an idea what to do, once I've sent the program off to the website? Are there any tutorials or something that I can learn from? I didn't find anything helpful when I googled on it
8 years ago
Nevermind, the problem turned out to be in the method calling the read method
8 years ago
I'm trying to read a file and I get a bug that I've never experienced before.

The read method:

The file content:

The result:


I've tried several ways of reading the file, different readers, different reading loops, and I always get the same, weird bug. I also tried reading from a different file, the result was just the same.

Can anyone explain why it doesnt work?
8 years ago
Im working on a task where I need to save and load object information to file.
The format in the file does not matter, so it doesnt matter exactly how I save\load it. However, I am required to use the method 'read ( Readable arg0, Readable arg1 )' to write the file, and 'write ( PrintStream arg0, PrintStream arg1 )' to save it.

I wish to use serializing to save the objects to file, as it is a very quick and easy way to save objects with all their information and relations.
The problem is that the only I way I know to save with serializing, is by using ObjectInputStream. As mentioned, I need to implement it in a method that requires Readable.
I've googled for some hours on how to deal with this, and I haven't found the answer to my two questions:
- Is it possible to save\load serialized objects with a reader instead of a stream?
- Is it possible to turn a reader into a stream? I know that I can do the opposite, but that doesn't solve my problem.

Thanks for any help
8 years ago
I'm trying to get Maven to work with my Eclipse. I have installed it, but every time I run Eclipse I get this message:

03.02.09 11:22:27 CET: Eclipse is running in a JRE, but a JDK is required
Some Maven plugins may not work when importing projects or updating source folders.


I have installed JDK, but I can't figure out how to make Eclipse run in JDK instead of JRE. I tried the Maven installation guide, I tried searching in Eclipse Help, but I havent found out.

Can anyone help me?
I'm working on a small game where I need to update the graphics often.
I've got the double buffering right afaik, but there's a problem with RepaintManager spamming paintDirtyRegions so much that the graphics are flickering.
I tried googling for paintDirtyRegions and RepaintManager, but I didn't see any useful information on this issue. I don't understand why the method is spammed so much and I have no idea how to deal with it. I'm not even sure if this issue is related to paint() or something else. The problem did go away when I disabled paint(), but the problem doesn't go away when I stop calling for paint() or repaint anywhere.

Can anyone help me get reduce the spam and remove the flickering? Have I done something wrong, or do I lack something in the application?
I can post my code when I know which part is useful for you to see My paint() is pretty long with lots of drawstring, fillrect and drawimage.
9 years ago