Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

Lukas Benberg

Ranch Hand
+ Follow
since Jan 03, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lukas Benberg

Thanks Rob,
I solved it. My solution is:



Seems to work. I found the Javadoc not very helpful. But here is a good tutorial which I find more helpful for regex beginners: http://www.vogella.de/articles/JavaRegularExpressions/article.html

Regards,
L
8 years ago
Hi all,
I need some help with regex. I would like to replace any sequence of whitespaces larger than 5 by comma.

I would like to create a comma seperated file from the following file, where values are delimited by a sequence of whitespaces > 5 (it is a console output). However, single whitespaces may also occur inside the values.




Thanks for your help!

[edit]Add code tags which show the whitespace better.[/edit]
8 years ago
Thanks,
Well, I assumed the Tomcat log directory to be the default directory also for its applications. It works with an absolute path (the log directory must be writable for Tomcat user).
Hi all,
I use slf4j and log4j in Tomcat6. Locally (in my Eclipse IDE), I get the desired logs logged to the console, with my current log4j configuration. On server (Ubuntu 9.10), I assumed that ConsoleAppender logs would go to the the /var/log/tomcat6/catalina.2009-xx-xx.log files. But I don't get any application logs there. Neither do I get any warnings concerning log4j initialization at Tomcat startup.

I also configured a FileAppender, but also no logs from that in /var/log/tomcat6/ . Is something wrong with my configuration? Where should I find the file "myapp.log" created by FileAppender?

Thanks


### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### direct log messages to file myapp.log ###
log4j.appender.file= org.apache.log4j.FileAppender
log4j.appender.file.File=myapp.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### Set root logger ###
log4j.rootLogger=ERROR, stdout, file

### Set log levels for packages ###
log4j.logger.data=DEBUG, stdout, file
log4j.logger.data.feeds=DEBUG, stdout, file
log4j.logger.calculator=DEBUG, stdout, file


Hi Scott,
this is probably sort of the thing I had in mind. I didn't work a lot with JDBC yet, so the question for me is *how* to I centralize part of my writes to one DB thread. Is it done by putting them on a single application thread (i.e. a Class that extends Thread)?
Hi,
I run a Web application that constantly imports data to my DB. This import thread brings lots of reads and writes to my DB. The same Web application sends user requests (user search queries from a website) to the DB.

Problem: user requests get slower due to reads and writes to the DB by the import thread.

I wonder if I could assign a certain limit of e.g. JDBC maxThreads for each of the processes to control the performance for both processes separately. For example, does it make sense to configure two JDBC resources (connecting to the same DB) with limited maxThreads set for the import process to keep DB performance for the user requests?

Thanks for any input on this!
Hi all,
I would like to perform a Struts2 Action when the root of my Webapplication is called. I use Tomcat5 and Struts2. To make it clear, here is what I want:

- The user goes to www.myApp.org
- a Struts2 ActionClass is called: reads cookie from user and sets session attribute (i.e. login automatically)
- Struts2 ActionMapping redirects to index.jsp (which reads session attributes)

At present, what happens is:

- The user goes to www.myApp.org
- Tomcat redirects to the welcome file: index.jsp
- No action is performed.

So, is there an action name for "root" or something?

Thanks in advance!
9 years ago
Hi Fred,
the context is: I want to calculate something like the user's "preferences" for "items" from data I have. for further analysis, all preference values have to be between 0 and 1 (or alternatively between -1 and 1). I don't know in advance the final "preference" value, because preferences may increase later. also, the number of "items" may change later.

10 years ago
Thank you all,
I think this is what I had in my mind: x += (1 - x)/2.0 .

Henry, for the moment I don't care _how_ I approach 1. Later, this may become relevant. I will have to think about your hint.

Prabz, you are right, what I actually meant was: v = 1-1/n

10 years ago
I have a variable that represents a double value in the range between 0 and 1. This variable should increase (i.e. come closer to 1) everytime a certain event occurs (say, a user clicks).

How (mathematically) would I calculate the variable, so that it comes closer to 1 everytime the event happens? This is probably pretty easy, but I'm lost here...

The problem I have is that I don't have the overall number of events (n) that already occured, but only the current value (v) of the variable. Otherwise I could calculate v = 1-1*n.

Thanks for your hints!
10 years ago
Thanks Ulf,
Sorry, I did not post the catch block, because it didn't seem relevant to me concerning my question. Of course I catch Exceptions in the servlet. However, no exception is thrown in the Servlet, because the doPost function is not invoked by the *one* user who has the problem.

I am really helpless with this problem. The user uses the latest JRE, WinXP and tested IE6 and Firefox. On my computers all this works fine (and also on the ones of other users). I think I can also exlude firewall problems, since port 80 is definitely open. Strange.

If you have any ideas where the problem could be, I am grateful!

Thanks, L
11 years ago
Hi all,
I have trouble with my applet-servet communication. I send a file from an applet to a servlet. The servlet then sends a response "Thank you" (or an error message).

Generally this works, however it does not at one of the users. The user gets this error sending the file to the servlet:

java.io.IOException: Error writing to server
at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at AppletGUI.sendToServlet(AppletGUI.java:354)

I cannot reproduce the error, so I assume this is maybe due to a firewall. Which ports does my HTTP connection require except of 80?

This is the relevant code:




Thanks for help!
11 years ago
Hi all,
I did some minor changes on an applet and now my Swing GUI looks different:

JMenus in my JMenuBar now have a titlebar(close, minimize, maximize buttons) above the first menuItem. I can also detach the menus from the menuBar (but then only close them).

The problem only occurs in the applet that I changed, not in all applets. But this only occurs on Mac. I use Leopard since last week, so I am not sure if this is a bug related to the new OS, did someone else experience this problem, too?

OS: Mac OS X 1.5.1
JRE: JVM 1.5.0 (Mac OS X Default)
11 years ago
I got another hint: a user told me that it does work correctly with IE6. However I cannot test this, since I don't have IE6...
11 years ago
Hi Ulf,
ok, I think the problem is that the Locale is not set correctly in InternetExplorer. Here is the relevant code:



Output in Firefox 2:
DisplayLanguage: Italienisch
Locale in ResourceBundle: it //correct
DisplayLanguage in ResourceBundle: Italienisch



Output in InternetExplorer 7:
DisplayLanguage: it_it //different from the Firefox output
Locale in ResourceBundle: de //incorrect, this is the default Locale
DisplayLanguage in ResourceBundle: Deutsch



But I have no idea why it gets wrong here...
11 years ago