java

Regex for matching alternating sequences

I'm working in Java and having trouble matching a repeated sequence. I'd like to match something like: a.b.c.d.e.f.g. and be able to extract the text between the delimiters (e.g. return abcdefg) where the delimiter can be multiple non-word characters and the text can be multiple word characters. Here is my regex so far: ([\\w]+([\\...

Trying to be a little bit better...

I am part of a development team that switched to a different project from a pure Java 5 project to a Java 6, J2EE, cloud environment, open source project. The problem is that we are doing barely OK, since we use a lot of search engines and we are pretty proficient in Java (3 years experience), but it feels like we need to start educatin...

Calendar.getActualMaximum(Calendar.WEEK_OF_YEAR) weirdness

Either I don't understand the method getActualMaximum(int) or the field WEEK_OF_YEAR, or there's a Sun bug involved (or all three)...could someone explain to me why (at least in a German locale...) the following code: Locale.setDefault( Locale.GERMAN ); Calendar c = Calendar.getInstance(); c.set( Calendar.YEAR, 2010 ); c...

A peculiar bug which I can't seem to find...

What I'm trying to do is I have this program which reads in a number, and that number designates how many words there are, for example: 3 red blue green And then prints out that same text but in reverse order so it would be green blue red followed by a blank line indicating to the server that you are done with that specific pro...

Solaris JMS Client connect to Weblogic 11g t3s security problem

When I try to connect Weblogic t3s protocol in Solaris Server, it shows this error: java.lang.IllegalStateException: Not enough cryptography available to enable a cipher suite! at com.certicom.tls.interfaceimpl.TLSSystem.resetCipherSuiteSupport(Unknown Source) at com.certicom.tls.interfaceimpl.TLSSystem.setCertificateSup...

Spring MVC REST : static files unaccessible because of url-pattern

Hi, My Spring Dispatcher servlet url-pattern is /* (as spring MVC REST suggests) Now all the request are resolved by this Servlet. even CSS/JS/Images also get resolved and handled by servlet.. So, Spring MVC tries to find controller.. :( How to bypass this? Is there any standard way out of this problem?? & Don't want to change url-...

How can I update my JList without running that frame again?

I have a main frame that has a list and "add" button. When I click on the 'add' button, one frame will be shown that I can enter name, family and id. And by clicking on the "addAPerson", the name will be stored in the SQL. But when I close the frame, the new person will not be added to my list which is in my main frame but if I close th...

Function override-overload in Java

What is the difference between override and overload? ...

File not found when browsing

I have one problem that is to upload file. It is working perfectly on my computer but fails when deploying to a server. The system is to browse the file, then the system will zip it before uploading it to the server. When a client browse a file, the server will generate an error that the file is not found. Here is my code: try { ...

Change JScrollBar arrow height

Hi, How do you change the height of the arrows in JScroll Bar? I was able to change the width of the Scrollbar but the height of arrows were still small. Thanks for your help. ...

Numerical Java Libraries

Most of my code is in Java. For standardized algorithms: matrix operations, FFT, ... I would prefer to not use my own pure Java implementations, and are perfectly happy using unsafe FFI/JNI calls. What are the libraries I should look into? Thanks! ...

How to reload ResourceBundles that are used by JSF?

I want to reload the ResourceBundles used by JSF programmatically on a button click. The ResourceBundles in the classpath (i.e. WEB-INF/classes) are modified by an external application and the modification event is known to me. ...

How to resovle javax.mail.AuthenticationFailedException issue?

Hi, I am doing a sendMail Servlet with JavaMail. I have javax.mail.AuthenticationFailedException on my output. Can anyone please help me out? Thanks. sendMailServlet code: try { String host = "smtp.gmail.com"; String from = "[email protected]"; String pass = "pass"; Properties props = System.getProperties(); ...

Custom MediaSizeName for Java Printing

Hi, I need to use a card printer (Evolis Tattoo) with java .. the problem is, that java seems not to have a correct mediasize (54mm by 85mm or 2.13" by 3.38"). Thats my code: DocPrintJob job = tattoo.createPrintJob(); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(new MediaPrintableArea(0, 0, 54, 85...

Boolean return method

Hi, i am doing computer science and in a project at the moment. I have had no code input for this as its specifically designed to mimic work i guess. I am the tester. i have stumbled across a rather complex method written by my colleague who isn't here at the moment, and the method returns a boolean. The issue is however that the method...

Get an Enumeration (for the Keys) of a Map (HashMap) in Java?

Hello, maybe I am missing something completely. But as far as I understand this, there seems to be no direct way of getting an Enumeration directly for the Keys of a HashMap. I can only get a keySet(). From that Set I can get an Iterator but an Iterator seems to be something different than an Enumeration. What is the best and most per...

Java & memory management

Dear StackOverflow, I'm new to java world from C++ background. I'd like to port some C++ code to Java. The code uses Sparse vectors: struct Feature{ int index; double value; }; typedef std::vector<Feature> featvec_t; As I understood, if one makes an object, there will be some overhead on memory usage. So naive implementation of Fea...

Logging Facade or Logger in an Application for a newcomer

Hello Everyone I am at the point for my little test-webapplication that I need some logging. I have no real experience in log4j nor java.util.logging and I was thinking if I should start right away with a logging facade (slf4j). I was reading that a logging facade should be used for libraries that are shared (frameworks) which makes se...

How to ping the snmp devices for a range of IP addresses using java (thread)?

Hi All, I need to create a thread pool to ping a range of ip addresses simultaneously using java language. Please help me out. Edited 1 If there are lots of thread created, then whether we have to call stop() method explicitly to stop the thread? or will it be taken care? ...

Giving up control: machine code generation vs memory layout?

This may be a bit off topic of "right answer, not discussion." However, I am trying to debug my thought process, so maybe someone can help me: I use compilers all the time, and the fact that I'm giving up control over machine code generation (the layout of my caches, and the flow of electrons) does not bother me. However, giving up co...