I am doing a assignment about this.
For Eaxmple:
I have a message (String), and the length is 302 in dec, 12e in hex.
String message = "THE MESSAGE BODY";
int lengthOfMessage = number.length(); // 302
String lengthOfMessageInHex = Integer.toHexString(lengthOfMessage); // 12e
Now, I need to change the lengthOfMessageInHex from "12e" t...
I just stumbles upon a screencast that shows someone designing a GUI with Matisse consisting of SWT-Component:
http://showmedo.com/videotutorials/video?name=javaDevijverJ2Spart3&fromSeriesID=35
Does someone know how he integrated the SWT-Support into Matisse? Searching the web did not yield any useful infrmation so far. The screenc...
I have a for loop, where i check if there is a certain key in a HashMap, if the key is not there, it should put a new association in the HashMap. The problem is that that it puts the association, but by the next iteration of the loop the association is gone! I don't get it!
public void DrawBoard(ArrayList<Integer[]> BoardList, int Frame...
I am looking at the solution in this post http://stackoverflow.com/questions/354875/reversing-a-linked-list-in-java-recursively
I copied the one of the solutions below. I've implemented it and it works fine.
public ListNode Reverse(ListNode list)
{
if (list == null) return null; // first question
if (list.next == null) return ...
Hey,
I want to store a list names and individual nicknames for each name as an Enum in Java. The number of nicknames will not vary. The purpose is to be able to get a full name from a nickname. Currently I have implemented this like so:
public enum Names {
ELIZABETH(new String[] {"Liz","Bet"}),
...
;
private Strin...
We have several classic asp web application that instantiates a visual basic 6 component, passes a (possibly huge) xml string, and gets back a (also possibly huge) xml string.
This component is the only way we have to interact with the database.
We are planning to rewrite this component using java. The idea is to left the rest of the ...
Okay, so I want to make a Java JFrame that is transparent, but than has a the glassPane not transparent so I can make my own style of windows. can this be done?
...
I have a Swing application which consists of a single JFrame set to Always On Top.
When running under Windows, I use the following code to open the the native default email client and browser respectively:
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + Utils.formatMailtoUrl(to, subject, body));
Runtime.getRuntime()...
I can't manage to get my textSwitcher to be able to support superscript text. No matter what I try it shows up as regular size text.
Here is what I've tried:
Spanned span = Html.fromHtml("<sup>TM</sup>");
String subscript = span.toString();
mSwitcher.setText(getText(R.string.desc_about1) + subscript);
Then I ...
Hello I have an User with some Roles
User.class
public class User {
private Long id;
private String firstName;
private String lastName;
private Set<Role> roles = new HashSet<Role>(0);
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getFirstName() { return this.firstName; }
pu...
I parse various data sources with network information in them.
I have been using java.net.InetAddress to represent and parse hosts. It works fine being initialized with IP.
I have to parse a new source now. It contains hostnames instead of IP's. InetAddress.getByName() throws UnknownHostException if a hostname argument can't be resolve...
Hi,
What I'm trying to do is dynamicly edit a panel and readd it to the (Border)layout. The panel contains textfields and I want the user to be able to add or remove textfields to the panel. What I tried is the following: remove the panel from the layout, add another textfield to the panel, readd the panel to the layout. However this do...
How can i compare the Logo of a website to the logo available in my database just by entering the url to the particular explorer?do i need any plugins or it is simple enough?
...
This is a puzzler! :D
Is there a way to force Hibernate to load a collection for an entity without loading the entire entity first?
Let m explain better. I have a Role entity annotated this way:
@Entity(name="Role")
@Table(name = "ROLES")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@javax.persistence.TableGenerator(
name...
Is there a standard way to tell when a page was last modified? Currently I am doing this:
URLConnection uCon = url.openConnection();
uCon.setConnectTimeout(5000); // 5 seconds
String lastMod = uCon.getHeaderField("Last-Modified");
System.out.println("last mod: "+lastMod);
However it looks like some sites do not have a Last-Modifie...
Our project badly needs to move to Flexmojos4 to get a fix, but this requires Maven 3. Our project makes extensive use of Maven and we really love it, but have configured it very heavily. Between a dozen modules we probably have 50+ pages of XML configuration.
We also use Eclipse and make heavy use of the M2Eclipse plug-in. We also...
I can not find the results of my logging calls.
To log messages I tried both:
System.out.println("some message");
and
Logger logger = Logger.getLogger("MyLogger"); // Logger is java.util.logging.Logger
// ...
logger.info("some message");
I have deployed my app and after few tests I decided check out some
log messages. But ...
I realize this is a hotly debated, controversial topic for Java programmers, but I believe my problem is somewhat unique. My algorithm REQUIRES pass by reference. I am doing a clockwise/counterclockwise pre-order traversal of a general tree (i.e. n-children) to assign virtual (x,y) coordinates. This simply means I count (and tag) the nod...
Out of curiosity, how many dimensions of an array can you have in java.
...
I have inherited a codebase :)
Under src/test/java/ there's a file that I need to run (I need to run its public static void main(String[] args), not a @Test method within it).
The closest I have got is:
mvn -e exec:java -Dexec.mainClass="com.me.packagex.RunFile" -Dexec.classpathScope="test"
but that then fails, and it appears to be ...