java

Grab random frames from video & make a gif image - Java

Hi! I want to know if it's possible to grab random frames from a video and then "stick" these frames together to make a gif image? I intend to achieve the above said idea by programming in Java. What should I use? (I have no previous experience in programming involving videos, although am proficient in Java) ...

What is a driver class? (Java)

Hi, I was reading through a Java textbook, and it mentions something called a "driver class". What is it, and how is it different from a normal class? ...

HQL: How to sort list of objects on property of mapped composite element

Hi everyone, I have an object with a map of components: <class name="Article" table="articles"> ... <map name="i18nData" table="articles_i18n"> <key column="id" not-null="true"/> <map-key column="language" type="string"/> <composite-element class="Article$ArticleI18nData"> <property name="displayName" type...

How to get SelectableChannel from an InputStream?

I want to read from an java.io.InputStream with a timeout. Apparently the correct way to do this is to use java.nio.channels.SelectableChannel and java.nio.channels.Selector. Unfortunately, it's not clear how to go from an InputStream to a SelectableChannel. The InputStream is coming from a non-conventional source -- http://java.sun.com...

How to go about "Calling home" in minimalistic way?

I am looking for the simplest way to get notified when successful installation of a program takes place somewhere. My application is Java based and has Java installer, I could easily put up a client to do any http call with any parameters, this is not an issue. My problem is on the other side - I've got hosted web site and I want direct ...

How can I hide a CTabItem in a CTabFolder

I can't find any method for making a tab invisible or otherwise hidden in an SWT/JFace application --- I want a second tab to be available (or not) based on some other preferences set by the user. It shouldn't be so hard to figure this out! ...

Test if object implements interface

This has probably been asked before, but a quick search only brought up the same question asked for C#. See here. What I basically want to do is to check wether a given object implements a given interface. I kind of figured out a solution but this is just not comfortable enough to use it frequently in if or case statements and I was wo...

Jersey in Tomcat+Spring environment can't find ComponentProvider. Why?

I've deployed Jersey on Tomcat and everything works perfectly (when I use the com.sun.jersey.spi.container.servlet.ServletContainer), but as soon as I change it to the com.sun.jersey.spi.spring.container.servlet.SpringServlet (according to all the tutorials I can find), I get a nasty exception: Apr 19, 2009 5:07:35 PM org.apache.catalin...

Is it possible to separate totally the HTML/CSS layout from the GWT logic?

I'd like to allow our web developers to continue to work in pure HTML and to let developers to write GWT Java-only code to write the rest of the business logic. Is it even possible? Have anyone tried to work with the web developers in the GWT environment? How do you incorporate the web developers into the GWT development process? ...

Java: Run HTTP server on demand from my app?

Hello! I want to write a simple P2P test app which uses HTTP as underlying protocol. The app has to decide on demand, if it should act as a HTTP server, or as a HTTP client. The classic way which I am aware of, would be to deploy the app on some existing HTTP server. But this is the wrong way for my intention. It has to be the other wa...

Is "else if" one whole or two separate keywords in Java?

I happen to read the practicing material for SCJP certification, and I just tripped over a chapter of flow control et al, where they give the impression that "else if" is a keyword on its own. I have always thought that it was just a normal else, containing nothing but an if block, braces omitted. So, which is it? Edit: I'd like to em...

What's the best way to get up to speed on changes in Java syntax since 2001?

Duplicate: How do I best catch up with the latest developments in java? I've been working on a Java codebase that was frozen in time around 2001. As a result I haven't bothered to learn any new Java syntax since then. Today I saw this code and recognized it as a syntax that must have been introduced in the current decade. private Arra...

How to save Chinese Characters to file with java ?

I use the following code to save Chinese characters into a .txt file, but when I opened it with wordpad, I can't read it. StringBuffer Shanghai_StrBuf=new StringBuffer("\u4E0A\u6D77"); boolean Append=true; FileOutputStream fos; fos=new FileOutputStream(FileName,Append); for (int i=0;i<Shanghai_StrBuf.length();i++) fos.write(Shanghai_St...

Implementation of Prim's Algorithm

For my CS class I need to implement Prim's algorithm in Java and I am having problems with the priority queue step. I have experience with priority queues and understand they work in general but I am having trouble with a particular step. Prim(G,w,r) For each u in V[G] do key[u] ← ∞ π[u] ← NIL key[r] ← 0 Q ← V[G] ...

Are Java generics mainly a way of forcing static type on elements of a collection?

private ArrayList<String> colors = new ArrayList<String>(); Looking at the example above, it seems the main point of generics is to enforce type on a collection. So, instead of having an array of "Objects", which need to be cast to a String at the programmer's discretion, I enforce the type "String" on the collection in the ArrayList. ...

How do I easily edit the style of the selected text in a JTextPane?

How do I easily edit the style of the selected text in a JTextPane? There doesn't seem to be many resources on this. Even if you can direct me to a good resource on this, I'd greatly appreciate it. Also, how do I get the current style of the selected text? I tried styledDoc.getLogicalStyle(textPane.getSelectionStart()); but it doesn't s...

Autoboxing: So I can write: Integer i = 0; instead of: Integer i = new Integer(0);

Autoboxing seems to come down to the fact that I can write: Integer i = 0; instead of: Integer i = new Integer(0); So, the compiler can automatically convert a primitive to an Object. Is that the idea? Why is this important? ...

Some sort of master page for java servlet using css

Hi I am creating a web application using Netbeans and servlets. I have used some css into my pages. Is there a way how I can put the banner and menu which every servlet will have in one place so I do not need to rewrite this in every servlet? Thank you ...

Java Code Use Checker

I am working on a library where we want to determine how much of our library is being used. I.E. we want to know how many methods in our library are public, but never being called. Goal: Static Analysis Determine how many lines of code call each public method in package A in the current project. If the number of calls is zero, the metho...

When do you use varargs in Java?

I'm afraid of varargs. I don't know what to use them for. Plus, it feels dangerous to let people pass as many arguments as they want. What's an example of a context that would be a good place to use them? ...