Search Results

Search found 33640 results on 1346 pages for 'java generics'.

Page 163/1346 | < Previous Page | 159 160 161 162 163 164 165 166 167 168 169 170  | Next Page >

  • suggestions for someone studying for java certification

    - by newguy
    I have been working with java (J2EE) for about 4 years. I have been putting off the certification for a while now. I bought the exam last year and still have not taken the exam. it expires in june so I am going to give it a shot. I know certifications don't get jobs but interviews but where I work...certification will put a 'stamp' on my resume and I think it'll popout in the eyes of the management. Anyways, I am going for JAVA 6. Can someone suggest some good mock exams that are kind of new and relevant. I came across this link but most of these exams are fairly old. I am using kathy Sierra's book for studying. Any other resources/pointers?

    Read the article

  • Ajax and sophisticated graphics in Java web-app

    - by EugeneP
    In my opinion WWW will sooner or later come to full-blown AJAX web-sites, so that we wouldn't have page reloads every time you click somewhere. Now I want you to ask this. What tools and frameworks can one use to make a Java Web-application running on Tomcat have AJAX functionality like "in-place, with no page reloading" table sorting by clicking on its column header, multi-tabs that enable opening at once the new screen to the user without reloading a page, saving data in the database without reloading a page, and other similar things that we do not usually see on web pages. That's all should probably be based on AJAX. But how to integrate this AJAX functionality with existing java web-frameworks, let's say Spring MVC? Or maybe there are other frameworks that better suit such needs but that can be integrated with core Spring?

    Read the article

  • Java Swing app hangs when run in normal mode but runs fine in debug mode

    - by snocorp
    I am writing a basic Java application with a Swing front-end. Basically it loads some data from a Derby database via Apache Cayenne and then displays it in a JTable. I'm doing my development in Eclipse and I don't think it's important but I'm using Maven for dependencies. Now this works fine when I run using Debug but it seems to hang the display thread when I use the Run button. I've done a thread dump and I'm not 100% certain but everything looks good. I used Java VisualVM and the threads look fine there as well. Strangely it seems to work intermittently. It's pretty consistent though and easy to reproduce. If anyone has any ideas, I'm all out of them.

    Read the article

  • WYSIWYG text editor in Java

    - by Aaron Digulla
    I'd like to collect all WYSIWYG text editors for Java here. Some rules for entries: There must be a link to the project/product You must state whether it's open source or commercial Is it possible to extend the editor (add new features like a "violet centered sudoku")? Is that simple or complex? Does it come with lots of features (fancy character and paragraph styles with online spell checking for several languages in the same document) or just the basics (bold, italics, no underline)? List important dependencies (does it run on bare Java with Swing? SWT? MacOS?) Your personal opinion This list should help developers determine which editor to choose. I'm not looking for "the best" but more "what's there".

    Read the article

  • Connecting to hosted MySQL server with Java

    - by Infiniti Fizz
    Hi, I've been recently trying to connect to a hosted MySQL using Java but can't get it to work. I can connect to a local MySQL with localhost using: connect = DriverManager.getConnection("jdbc:mysql://localhost/lego?" + "user=******&password=*******"); (Replacing the astrisks withmy username and password) I can connect to the hosted MySQL database fine with PHP using: mysql_connect('mysql.hosts.co.uk','******','**********'); mysql_select_db('test'); My problem is, I cannot connect via Java. I have an Exception which is caught if the connection doesn't work and this is always printed out. Any ideas why it isn't working? Am I doing something wrong? Thanks for your time, InfinitiFizz

    Read the article

  • Translate from Java to C#: simple code to re-encode a string

    - by Dr. Zim
    We were sent this formula to encrypt a string written in Java: String myInput = "test1234"; MessageDigest md = MessageDigest.getInstance("SHA"); byte[] myD = md.digest(myInput.getBytes()); BASE64Encoder en64 = new BASE64Encoder(); String myOutput = new String ( Java.net.URLEncoder.encode( en64.encode(myD))); // myOutput becomes "F009U%2Bx99bVTGwS3cQdHf%2BJcpCo%3D" Our attempt at writing this in C# is: System.Security.Cryptography.SHA1 sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider(); string myOutput = HttpUtility.UrlEncode( Convert.ToBase64String( sha1.ComputeHash( ASCIIEncoding.Default.GetBytes(myInput)))); However the output is no where near the same. It doesn't even have percent signs in it. Any chance anyone would know where we are going wrong?

    Read the article

  • Storing a file in the user's directory in cross-platform Java

    - by dalyons
    I have a Java application that runs on Mac and Windows, directly off a CD/DVD with no installation. Now, I need to store a file containing per-user data (think favourites etc.) somewhere on the local file system, so that it can be written to. So, where do you think is a good location for this file? I am thinking something like: <USER_DOCUMENTS_AND_SETTINGS>/application data/myapp/favourites.db for windows <USER_HOME_DIR>/.myapp/favourites.db for mac/nix Thoughts? And does anyone know the best way to determine these paths within Java?

    Read the article

  • java double buffering problem

    - by russell
    Whats wrong with my applet code which does not render double buffering correctly.I am trying and trying.But failed to get a solution.Plz Plz someone tell me whats wrong with my code. import java.applet.* ; import java.awt.* ; import java.awt.event.* ; public class Ball extends Applet implements Runnable { // Initialisierung der Variablen int x_pos = 10; // x - Position des Balles int y_pos = 100; // y - Position des Balles int radius = 20; // Radius des Balles Image buffer=null; //Graphics graphic=null; int w,h; public void init() { Dimension d=getSize(); w=d.width; h=d.height; buffer=createImage(w,h); //graphic=buffer.getGraphics(); setBackground (Color.black); } public void start () { // Schaffen eines neuen Threads, in dem das Spiel l?uft Thread th = new Thread (this); // Starten des Threads th.start (); } public void stop() { } public void destroy() { } public void run () { // Erniedrigen der ThreadPriority um zeichnen zu erleichtern Thread.currentThread().setPriority(Thread.MIN_PRIORITY); // Solange true ist l?uft der Thread weiter while (true) { // Ver?ndern der x- Koordinate repaint(); x_pos++; y_pos++; //x2--; //y2--; // Neuzeichnen des Applets if(x_pos>410) x_pos=20; if(y_pos>410) y_pos=20; try { Thread.sleep (30); } catch (InterruptedException ex) { // do nothing } Thread.currentThread().setPriority(Thread.MAX_PRIORITY); } } public void paint (Graphics g) { Graphics screen=null; screen=g; g=buffer.getGraphics(); g.setColor(Color.red); g.fillOval(x_pos - radius, y_pos - radius, 2 * radius, 2 * radius); g.setColor(Color.green); screen.drawImage(buffer,0,0,this); } public void update(Graphics g) { paint(g); } } what change should i make.When offscreen image is drawn the previous image also remain in screen.How to erase the previous image from the screen??

    Read the article

  • Java Socket Connection is flooding network OR resulting in high ping

    - by user1461100
    i have a little problem with my java socket code. I'm writing an android client application which is sending data to a java multithreaded socket server on my pc through direct(!) wireless connection. It works fine but i want to improve it for mobile applications as it is very power consuming by now. When i remove two special lines in my code, the cpu usage of my mobile device (htc one x) is totally okay but then my connection seems to have high ping rates or something like that... Here is a server code snippet where i receive the clients data: while(true) { try { .... Object obj = in.readObject(); if(obj != null) { Class clazz = obj.getClass(); String className = clazz.getName(); if(className.equals("java.lang.String")) { String cmd = (String)obj; if(cmd.equals("dc")) { System.out.println("Client "+id+" disconnected!"); Server.connectedClients[id-1] = false; break; } if(cmd.substring(0,1).equals("!")) { robot.keyRelease(PlayerEnum.getKey(cmd,id)); } else { robot.keyPress(PlayerEnum.getKey(cmd,id)); } } } } catch .... Heres the client part, where i send my data in a while loop: private void networking() { try { if(client != null) { .... out.writeObject(sendQueue.poll()); .... } } catch .... when i write it this why, i send data everytime the while loop gets executed.. when sendQueue is empty, a null "Object" will be send. this results in "high" network traffic and in "high" cpu usage. BUT: all send comments are received nearly immediately. when i change the code to following: while(true) ... if(sendQueue.peek() != null) { out.writeObject(sendQueue.poll()); } ... the cpu usage is totally okay but i'm getting some laggs.. the commands do not arrive fast enough.. as i said, it works fine (besides cpu usage) if i'm sending data(with that null objects) every while execution. but i'm sure that this is very rough coding style because i'm kind of flooding the network. any hints? what am i doing wrong?? Thanks for your Help! Sincerly yours, maaft

    Read the article

  • AES acceleration for Java

    - by chris_l
    I want to encrypt/decrypt lots of small (2-10kB) pieces of data. The performance is ok for now: On a Core2Duo, I get about 90 MBytes/s AES256 (when using 2 threads). But I may need to improve that in the future - or at least reduce the impact on the CPU. Is it possible to use dedicated AES encryption hardware with Java (using JCE, or maybe a different API)? Would Java take advantage of special CPU features (SSE5?!), if I get a better CPU? Or are there faster JCE providers? (I tried SunJCE and BouncyCastle - no big difference.) Other possiblilities?

    Read the article

  • Pet project ideas in Java

    - by Amir Rachum
    I'm looking for a pet project idea in Java. I'm a Software Engineering undergraduate finishing my 3rd year. I have also been working for the past 1.5-2 years programming in C++, and I get enough of that at work. I recently learned Java and I like it very much. Already done some project assignments and some really small console applications, but I'm looking for something to invest my time in. I would like a project that is complex enough to "brag about" (have it open sourced and get people interested, added to resume) and learn while doing it, but also simple enough to be able to at least have a working version in a few months. I know the most common advice is something that I need, but I admit I simply couldn't think of anything like that. Any ideas?

    Read the article

  • How do I rewrite binary data in Java

    - by hayato
    I'm trying to figure out how to replace binary data using Java. below is a PHP example of replacing "foo" to "bar" from a swf file. <?php $fp = fopen("binary.swf","rb"); $size = filesize("binary.swf"); $search = bin2hex("foo"); $replace = bin2hex("bar"); $data = fread($fp, $size); $data16 = bin2hex($data); $data16 = str_replace($search, $replace, $data16); $data = pack('H*',$data16); header("Content-Type:application/x-shockwave-flash"); echo $data; ?> How do I do this in Java.

    Read the article

  • How to know start and kill processes within Java code (or C or Python) on *nix

    - by recipriversexclusion
    I need to write a process controller module on Linux that handles tasks, which are each made up of multiple executables. The input to the controller is an XML file that contains the path to each executable and list of command line parameters to be passed to each. I need to implement the following functionality: Start each executable as an independent Be able to kill any of the created processes independent of the others In order to do (2), I think I need to capture the pid when I create a process, to issue a system kill command. I tried to get access to pid in Java but saw no easy way to do it. All my other logic (putting info about the tasks in DB, etc) is done in Java so I'd like to stick with that, but if there are solutions you can suggest in C, C++, or Python I'd appreciate those, too.

    Read the article

  • A better way to do XML in Java

    - by jboyd
    There are a lot of questions that ask the best XML parser, I am more interested in what is the XML parser that is the most like Groovy for Java? I want: SomeApiDefinedObject o = parseXml( xml ); for( SomeApiDefinedObject it : o.getChildren() ) { System.out.println( it.getAttributes() ); } The most important things are that I don't want to create an object for every type of filed, I'd rather just deal with them all as strings, and that building the XML doesn't require any converters or anything, just a simple object that is already defined If you have used the Groovy XML parser, you will know what I'm talking about Alternatively, would it be better for me to just use Groovy from Java?

    Read the article

  • Managing Data Dependecies of Java Classes that Load Data from the Classpath at Runtime

    - by Martin Potthast
    What is the simplest way to manage dependencies of Java classes to data files present in the classpath? More specifically: How should data dependencies be annotated? Perhaps using Java annotations (e.g., @Data)? Or rather some build entries in a build script or a properties file? Is there build tool that integrates and evaluates such information (Ant, Scons, ...)? Do you have examples? Consider the following scenario: A few lines of Ant create a Jar from my sources that includes everything found on the classpath. Then jarjar is used to remove all .class files that are not necessary to execute, say, class Foo. The problem is that all the data files that class Bar depends upon are still there in the Jar. The ideal deployment script, however, would recognize that the data files on which only class Bar depends can be removed while data files on which class Foo depends must be retained. Any hints?

    Read the article

  • Measuring time spent in application / thread

    - by Adamski
    I am writing a simulation in Java whereby objects act under Newtonian physics. An object may have a force applied to it and the resulting velocity causes it to move across the screen. The nature of the simulation means that objects move in discrete steps depending on the time ellapsed between the current and previous iteration of the animation loop; e.g public void animationLoop() { long prev = System.currentTimeMillis(); long now; while(true) { long now = System.currentTimeMillis(); long deltaMillis = now - prev; prev = now; if (deltaMillis > 0) { // Some time has passed for (Mass m : masses) { m.updatePosition(deltaMillis); } // Do all repaints. } } } A problem arises if the animation thread is delayed in some way causing a large amount of time to ellapse (the classic case being under Windows whereby clicking and holding on minimise / maximise prevents a repaint), which causes objects to move at an alarming rate. My question: Is there a way to determine the time spent in the animation thread rather than the wallclock time, or can anyone suggest a workaround to avoid this problem? My only thought so far is to contstrain deltaMillis by some upper bound.

    Read the article

  • OSX - Update "Java for OS X 2012-002" is not mentioned on support.apple.com, is this ok?

    - by snies
    Straight after installing "Java for OS X 2012-001" Software Update asks me to install "Java for OS X 2012-002", which has the exact same size (66.6 MB) and description (including the same two links: HT5055 and HT1222) as the former, which strikes me as odd. The "Java for OS X 2012-001" is described on the apple support pages, but the "Java for OS X 2012-002" is not mentioned anywhere. Also searching on google does not yield any usable results. What is your opinon? Am i paranoid? Did you also see this update?

    Read the article

  • Tool for checking source for dependencies on specific Java versions

    - by Gregor
    Is there a quick way (e.g. tool) to detect, from the source (or maybe even from compiled classes), which parts of an application call Java API methods that are only implemented in a specific Java version? (e.g. which parts of my app are Java6-specific) I don't necessarily want to hop through all ClassMismatchErrors and avoid the trial-and-error-method. Let's say I only want to document which parts of an application won't work if they were writte for, e.g., Java6 and I want to run it in a version 5 JDK. Is there something like this? Google did not help this time, nor did I find any solution here (a rare case indeed:)

    Read the article

< Previous Page | 159 160 161 162 163 164 165 166 167 168 169 170  | Next Page >