java

How do you get a data value associated with a specific col,row from a 2-d array in java?

here is the code I have written in java I think it is right. I am just not sure what to set result to? I want to return the element associated with the specific row column public int getElement(int row,int col){ int result = 0; if(((row>=1) && (row <=rowArray.length))&&((col>=1) && (col <=colArray.length))){ result = ??...

whether reading swing is worth it?

i planning to read swing concept, if it is worth reading ,please suggest some study material ...

Calling a DLL from an Applet via JNI

I have a "proof of concept" piece of work that crosses over into some unfamiliar territory. I'm tasked with connecting an EFTPOS machine to an application running as an applet in a browser on our intranet. I've ignored the EFTPOS dll for the moment and created a simple JNI decorated DLL in my language of choice (Delphi) that just logs a...

How do I add a menubar to a tabbed pane?

Is it possible to add a menubar to one of the windows in a tabbed pane? And is a frame the only container which can have a menubar? ...

How to create a folder in a directory where user need admin permission

Hi All, Hi I need to put some files in some directory which myself as a user have no rights but for administrator has rights. In this case I want my program should ask for admin username and password. If i put correct admin username and password then i must be able to put the folder in that directory. Otherwise i should ge...

how to set SqlMapClient outside of spring xmls

I have the following in my xml configurations. I would like to convert these to my code because I am doing some unit/integration testing outside of the container. xmls: <bean id="MyMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation" value="classpath:sql-map-config-oracle.xml"/> ...

How can I rename a file in Java?

My purpose is to rename one file. What I'm doing is: I'm searching a particular string in a text file. Among So many files and if that particular text is found then I want rename that text file with a given string. Here is what I have tried: String opcode="OPCODES"; // String that I want to search. File file = new File("D:\\C...

S#arp architecture equivalent in Java

What’s the equivalent of S#arp architecture(.net) in the java world. A one stop package that encompasses all the best practices and well identified packages to start a web application project. ...

Easiest way of getting third party database information into java objects

I am making some small "business intelligence" applications/tools that need to talk to other systems. Primarily accounting systems that believe that databases are an integration layer (or are too lazy to provide an api). What's the easiest way of getting specific data out of a third party database and into my Java objects? Notes: (I...

Is there a way to just copy resources when using a Maven archetype (no Velocity)?

We are using a Maven archetype to create an initial setup for projects using our framework, which relies heavily on Freemarker. As a consequence we need to copy a few Freemarker templates when the archetype is used to generate a new project. The problem we ran into is that Maven seems to run Velocity on all of the files listed as resour...

afterTransactionCompletion not working

I created an hibernate interceptor : public class MyInterceptor extends EmptyInterceptor { private boolean isCanal=false; public boolean onSave(Object entity, Serializable arg1, Object[] arg2, String[] arg3, Type[] arg4) throws CallbackException { for(int i=0;i<100;i++){ System.out.println("Inside MyInterceptor(onSave) : "+entity....

Using Java PDFBox library to write Russian PDF

Hello , I am using a Java library called PDFBox trying to write text to a PDF. It works perfect for English text, but when i tried to write Russian text inside the PDF the letters appeared so strange. It seems the problem is in the font used, but i am not so sure about that, so i hope if anyone could guide me through this. Here is the i...

How to process compressed data in Java

I have some data which takes up more than 50MB in an uncompressed file, but compresses down to less than half a MB using gzip. Most of this is numerical data. I'm trying to figure out how to process this data without having to uncompress it completely. For example, if this data contains a couple of strings and 5 or so numerical values...

How to build a web based chat application similar to gmail using java at backend logic

Hii, I want to built a web based chat using j2ee at backend logic.i want to implement the similar way the gmail do,so that performance of application doesnr degrade.please suggest what type of architecture shoul i follow.load of application would be high. ...

is javax.tools depends on JDK?

hi, i want to use JavaCompiler to dynamic create some classes. i find the source code of javax.tools package, but there is no implementation, some posts on internet says it depends on tools.jar, i am not sure tools.jar associates with JRE. so can i run the program in a JRE environment without JDK installed? another question, what is t...

How can I determine Objects in application context?

I am trying to write a portlet for Liferay (using Tomcat and Spring) and need to use a database via Persistence API/Hibernate. I am using some configuration XMLs (applicationContext.xml, etc.) and annotations to realize that. e.g. @Component @Scope("application") public class SomeForm { @PersistenceContext EntityManager entityManager...

Java: unable to access static singleton method

hi. i am facing one problem.i have a class named "ReportingService" and it should be singleton and is is extending "CommonService". package MyApp.Services.ReportingService; public class ReportingService extends CommonService { private static ReportingService instance = null; public static ReportingService getInstance() { ...

Howto automate documentation of a REST API (Jersey Implementation)

Hey guys, I have written a pretty extensive REST API using Java Jersey (and JAXB). I have also written the documentation using a Wiki, but its been a totally manual process, which is very error-prone, especially when we need to make modifications, people tend to forget to update the wiki. From looking around, most other REST API's are ...

SNMP in Java, specifically to be JMX adapter.

Hi, I have a few JAVA application that I monitor using JMX. I would like to write an SNMP client for these applications that wraps the JMX interface and by discovery exposes the same attributes that are exposed in JMX, through SNMP. I have no problem writing the client if I just figure out how to write SNMP clients in JAVA. Is there a...

Portlet URL appending Session ID ?

Hi guys, I'm facing a problem and don't know if it is even possible, what I'm trying to do: I just want to append my session ID to all my URLs which are generated in my portal? I'm using JSR-268 Portlets and tried to define a public-render-parameter - if I'm not wrong, this should be - once set - available to all other portlets which s...