Java: best type to store grid references
I am creating an object in Java. One of its attributes is a grid reference - ints x, y & z. Rather than creating a variable for each, is there a better way to store these? ...
I am creating an object in Java. One of its attributes is a grid reference - ints x, y & z. Rather than creating a variable for each, is there a better way to store these? ...
I am new to programming, I was wondering if there is a way to find the java classes I need for a particular thing other than asking people for them on forums? I have seen the APIs on sun website but there is no good search option to find the class that will work for me. ...
Hello, Is there a way of removing an activity from the home launcher by itself at runtime? I mean removing Intent.CATEGORY_LAUNCHER from it's properties or something similar. ...
Let's say I have a class Customer, which has a property customerType. I have another class called something like SpecialContract, which has a Customer and some other properties. If customer.customerType == SPECIAL, then there is a SpecialContract which has a reference to this particular Customer. Now I realize that this is a bit hoaky...
Let's say I have a class which, internally, stores a List of data: import java.util.List; public class Wrapper { private List<Integer> list; public Wrapper(List<Integer> list) { this.list = list; } public Integer get(int index) { return list.get(index); } } For the sake of this example, pretend it's a usefu...
Are there any preexisting Maven plugins or commands to update the dependencies in the POM? Example: (if this was in my POM) <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.3</version> </dependency> Is there a command or plugin I can run to get it to update the dependency to: ...
I am working on an android app that needs to act on a few data files totaling around 30MB. I put together a test and the emulator failed with OutOfDiskSpace. Debugging on a device failed with even a smaller data size. After reading through the google groups, it appears that the application size limit isn't stated anywhere and nobody ...
I am writing a Java class that parses log files. The compiled .class file needs to be loaded into a 3rd party monitoring platform (eG) for deployment and invocation. Unfortunately, the 3rd party platform only allows me to upload a single .class file. My current implementation has a function to find the 'latest' file in a folder that...
Hi, Why java functions are virtual by default.But c# its the oposite. Which is better?Or what is the advantage and disadvantage in both? Thanks SC ...
I want to make strings like "a b c" to "prefix_a prefix_b prefix_c" how to do that in java? ...
I have existing code that's like: final Term t = /* ... */; final Iterator i = searcher.search( new TermQuery( t ) ).iterator(); while ( i.hasNext() ) { Hit hit = (Hit)i.next(); // "FILE" is the field that recorded the original file indexed File f = new File( hit.get( "FILE" ) ); // ... } It's not clear to me how to re...
Hello everybody I have a little problem I am trying to use MartkItUp JQuery rich text editor on JSF textarea component. MY form looks pretty much like this: <h:form id="comment"> <h:inputTextarea id="commentBody" cols="10" rows="10" value="#{postComment.commentBody}" required="true" requiredMessage="Comment Body i...
If I have a reference to a class and invoke a method on it, and the class or the method is final, my understanding is that the compiler or the JVM would replace the dynamic dispatch with a cheaper static dispatch since it can determine exactly which version would be invoked. However, what if I have a reference to an interface, and the i...
I've been debating this to myself for the last few minutes, and I'm seeing reasons for both yes and no. This stemmed from looking at the answers to Java HashMap vs. Hashtable and seeing several people say Hashtable is in fact slower. It seems to me that a synchronized method should act absolutely no different than its unsynchronized co...
I'm trying to write some simple code to resize an image, and I am getting a JVM crash. As far as I can tell I'm using the APIs correctly. Here is the code: import java.awt.image.*; import java.io.*; import javax.imageio.*; public class Resizer { public static void main(String[] args) { BufferedImage img = null; try { ...
Hi, I've been working on a java web project. Currently this project doesnt use any framework. Its a standard MVC application, using servlets and DAO with jdbc access to database (all queries are handwritten). The project has a good code (all project developed using TDD), but its way too slow to add any feature, since all have to be d...
Hello everybody, I am working on application with jsp, jstl and jsf for my college project, thats being said, I am as well very new to jsf. Everything is going great so far. However, I seems to have a problem figuring out how to do redirect from managed bean to page with dinamyc parameters. For example article.jsp?article_id=2 Can som...
I am trying to develop a REST style application with Spring but the url mapping is not working as I expected. in web.xml I have <servlet-mapping> <servlet-name>UrlParsing</servlet-name> <url-pattern>/device/</url-pattern> </servlet-mapping> in NetTRaceHQ-servlet.xml I have <bean name="urlMapping" class="org.spr...
Spring and Hibernate uses reflection for bean creation (in case of spring) and POJO mapping (in case of Hibernate). Does it negatively impacts on performance ? Because reflection is slower compare to direct object creation. ...
Hi All: I want to send mail along with embedded image. For that i have used the below code. Its not full code. Its a part of code Multipart multipart = new MimeMultipart("related"); // Create the message part BodyPart messageBodyPart; messageBodyPart = new MimeBodyPart(); messageBodyPart.setText(msgBody); // msgbody ...