java

convert .net format string to java format string

I am looking at the format specifiers of C# and the patterns for formatting numeric strings in Java. I am wondering if anyone has any pointers as to translating from one form to another? ...

up to first N characters

How do I get up to the first n characters of a string in java without doing a size check first(inline is acceptable) or risking an IndexOutOfBoundsException? ...

Spring @Transactional merge and persist question

Hi, new to Spring and here @stackoverflow I'm building an stand-alone Inventory & Sales tracking app (Apache Pivot/Spring/JPA/Hibernate/MySQL) for a distributor business. So far I think everything is CRUD, so I plan to have a base class with everything @Transactional. Then I got a problem with my save generic method. Does persist and ...

Is it possible/valid to have a TCP connection with secure login only, but non-secure messages?

Say I am writing a chat server and client that allows users to login with their user-name and password. Now I could just send and receive the information as plain-text but there is the risk that the information may be intercepted. So the socket should be secured to protect the user. I am not interested in certificates or verifying identi...

Src jar for Pentaho Kettle

Where can I find a src-jar for Kettle? I'm looking for a jar that contains the Java files, and I can point my IDE to (like for example junit-4.6-src.jar). ...

How to embed Java libraries in Ruby On Rails ?

I have a working RoR application, I want to insert some Java code into it. What is the best option for me ? ...

jdbc to access complete database

i want what should be given in DriverManager.getConnection() when i want to access all tables from ms-access ...

Java applet - saving an image in a png format

Hi, I am creating a simple applet for avatar-making. You can choose face, hair, eyes, etc and then save it to a disc as a png file. The simple version (without the interface for the simplicity purpose) looks like this: import java.awt.*; import java.applet.*; import java.net.*; public class Example extends Applet { Image my_gif; I...

Using double negatives to test for conditions

To validate user inputs, I am unsure of which of two alternatives is better 1 isNull( Object input ) 2 notNull( Object input ) apache's commons lang library chose #2 but I am uncomfortable with double negatives. What do you say ? ...

Finding most proper standard for image [Image recognition]

We have some examples of pictures. And we have on input set of pictures. Every input picture is one of example after combination of next things 1) Rotating 2) Scaling 3) Cutting part of it 4) Adding noise 5) Using filter of some color It is guarantee that human can recognize picture ease. I need simple but effective algorithm to ...

Where is the source code for the java compiler?

I'm looking for the source code of Sun's standard java compiler, javac. jdk1.6.0_07 has a few classes that are related, but they are interfaces (java.lang.Compiler and javax.tools.JavaCompiler). There's also some packages under com.sun.mirror.* and com.sun.source.*, which seem to be interfaces for representing the java abstract syntax ...

Java deque / prepared statement memory leak.

One of the following pieces of code generates a memory leak, any idea which part? 1) private Deque<Snapshot> snapshots = new LinkedList<Snapshot>(); Iterator<Snapshot> i = world.getSnapshots().descendingIterator(); while (i.hasNext()) { Snapshot s = i.next(); if (curTime - s.getTimestamp() > 60000) { i.remove(); ...

Why JOptionPane prevents ActionListener on JButton???

PreventingButtonListener.java import java.awt.*; import java.awt.event.*; import javax.swing.*; public class PreventingButtonListener extends JFrame implements ActionListener{ JTextField fld = new JTextField(5) ; PreventingButtonListener(){ super("PreventingButtonListener") ; setSize(300, 250) ; setDefaultClos...

Powerbook compiler queries

I am thinking about buying an Apple Powerbook 1.5 GHz machine. While my primary focus for that machine would be internet, I may also do some programming on that machine since it would be the machine I would be taking to college... What I wanted to know if there would be any major difference in context with the compilers used etc? Would I...

openfire monitor stanza xml message

inside openfire admin control panel page, is there any plugin i can use to monitor xml stanza . i know able to monitor it from smack client side, but i want to see it directly from server size, then my client do not need to run in debug mode ...

best way to analyze xml stanza from xmpp

i get stream of xml stanza from log. i want to understand the flow , currently what i can think of is get the spec from xmpp.org protocol and try to understanding each line. Is there any best prastice do you folks do to understand the xml stream? any easier way? ...

Java: Expected overhead of the rmi protocol

Hi there! Within my program I'm using two RMI servers, which provide different methods, to simulate a simple network protocol between two notebooks. From my trace log I can see that the transmission time of a "packet" currently varies between 850 and 1100 ms. Are the transmission times in the expected range? Is the overhead of the RMI...

O Notation Help

I am getting stuck with the class work we got this week and its a subject i really want to learn so for once i thought i would do the additional reading!!!! The method is provided for us and i am just writign some test cases. This is where my knowledge gets a little hazy. If the time increases then i am underestimatign the complexity i ...

Call hierarchy and/or data flow tool for Scala.

Hi. Is there an IDE/Tool/script/something that can show call hierarchy and/or data flow in Scala+Java programs (preferably from source code). Or (as a backup plan) is there a tool that can show it using Java bytecode? (And preferably give the option to go to source code, if provided by user). All that, preferably integrated into an IDE a...

java.lang.NoClassDefFoundError

i am geting following error Am i missing some jar file? Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.slf4j.impl.JCLLoggerFactory.getLogger(JCLLoggerFactory.java:69) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:243) at org.smslib.helper.Logger.<...