Search Results

Search found 1636 results on 66 pages for 'netbeans 7'.

Page 50/66 | < Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >

  • Thread sleep and thread join.

    - by Dhruv Gairola
    hi guys, if i put a thread to sleep in a loop, netbeans gives me a caution saying Invoking Thread.sleep in loop can cause performance problems. However, if i were to replace the sleep with join, no such caution is given. Both versions compile and work fine tho. My code is below (check the last few lines for "Thread.sleep() vs t.join()"). public class Test{ //Display a message, preceded by the name of the current thread static void threadMessage(String message) { String threadName = Thread.currentThread().getName(); System.out.format("%s: %s%n", threadName, message); } private static class MessageLoop implements Runnable { public void run() { String importantInfo[] = { "Mares eat oats", "Does eat oats", "Little lambs eat ivy", "A kid will eat ivy too" }; try { for (int i = 0; i < importantInfo.length; i++) { //Pause for 4 seconds Thread.sleep(4000); //Print a message threadMessage(importantInfo[i]); } } catch (InterruptedException e) { threadMessage("I wasn't done!"); } } } public static void main(String args[]) throws InterruptedException { //Delay, in milliseconds before we interrupt MessageLoop //thread (default one hour). long patience = 1000 * 60 * 60; //If command line argument present, gives patience in seconds. if (args.length > 0) { try { patience = Long.parseLong(args[0]) * 1000; } catch (NumberFormatException e) { System.err.println("Argument must be an integer."); System.exit(1); } } threadMessage("Starting MessageLoop thread"); long startTime = System.currentTimeMillis(); Thread t = new Thread(new MessageLoop()); t.start(); threadMessage("Waiting for MessageLoop thread to finish"); //loop until MessageLoop thread exits while (t.isAlive()) { threadMessage("Still waiting..."); //Wait maximum of 1 second for MessageLoop thread to //finish. /*******LOOK HERE**********************/ Thread.sleep(1000);//issues caution unlike t.join(1000) /**************************************/ if (((System.currentTimeMillis() - startTime) > patience) && t.isAlive()) { threadMessage("Tired of waiting!"); t.interrupt(); //Shouldn't be long now -- wait indefinitely t.join(); } } threadMessage("Finally!"); } } As i understand it, join waits for the other thread to complete, but in this case, arent both sleep and join doing the same thing? Then why does netbeans throw the caution?

    Read the article

  • How to copy or clone model?

    - by Zeck
    I have a model Book with attributes id, name, price. I have an instance of Book: b1 = Book.new b1.name = "Blah" b1.price = 12.5 b1.save I would like to copy b1, create another instance of the Product model. I'm tryid p1=b1.clone then p1.save but it didn't work. Any idea? And my environment is: Netbeans 6.9 RC2 JRuby 1.5.0 Thanks

    Read the article

  • Compute jvm heap size to host web application

    - by Enrique
    Hello, I want to host a web application on a private JVM they offer 32, 64, 128, 256 MB plans. My web application uses Spring. And I store some objects for every logged in user session. My question is: How can I profile my web app to see how much heap size it needs so I can choose a plan?, How can I simulate hundreds of users logged in at the same time? I'm developing the application using Netbeans 6.7 Java 1.6 Tomcat 6.0.18 Thank you.

    Read the article

  • rails db:seed no method error

    - by louddwarf
    when I try and run the "rake db:seed" command the rails console outputs "NoMethodError: undefined method `db' for #" not quite sure what going on. I'm using netbeans to build my rails project which is using the built-in JRuby 1.2 would that have anything to do with it?

    Read the article

  • Php plugin to replace '->' with '.' as the member access operator ? Or even better: alternative synt

    - by Gigi
    Present day usable solution: Note that if you use an ide or an advanced editor, you could make a code template, or record a macro that inserts '->' when you press Ctrl and '.' or something. Netbeans has macros, and I have recorded a macro for this, and I like it a lot :) (just click the red circle toolbar button (start record macro),then type -> into the editor (thats all the macro will do, insert the arrow into the editor), then click the gray square (stop record macro) and assign the 'Ctrl dot' shortcut to it, or whatever shortcut you like) The php plugin: The php plugin, would also have to have a different string concatenation operator than the dot. Maybe a double dot ? Yea... why not. All it has to do is set an activation tag so that it doesnt replace / interpreter '.' as '->' for old scripts and scripts that dont intent do use this. Something like this: <php+ $obj.i = 5 ?> (notice the modified '<?php' tag to '<?php+' ) This way it wouldnt break old code. (and you can just add the '<?php+' code template to your editor and then type 'php tab' (for netbeans) and it would insert '<?php+' ) With the alternative syntax method you could even have old and new syntax cohabitating on the same page like this (I am illustrating this to show the great compatibility of this method, not because you would want to do this): <?php+ $obj.i = 5; ?> <?php $obj->str = 'a' . 'b'; ?> You could change the tag to something more explanatory, in case somebody who doesnt know about the plugin reads the script and thinks its a syntax error <?php-dot.com $obj.i = 5; ?> This is easy because most editors have code templates, so its easy to assign a shortcut to it. And whoever doesnt want the dot replacement, doesnt have to use it. These are NOT ultimate solutions, they are ONLY examples to show that solutions exist, and that arguments against replacing '->' with '.' are only excuses. (Just admit you like the arrow, its ok : ) With this potential method, nobody who doesnt want to use it would have to use it, and it wouldnt break old code. And if other problems (ahem... excuses) arise, they could be fixed too. So who can, and who will do such a thing ?

    Read the article

  • How to replace a region in emacs with yank buffer contents?

    - by Mad Wombat
    When I use VIM or most modeless editors (Eclipse, NetBeans etc.) I frequently do the following. If I have similar text blocks and I need to change them all, I will change one, copy it (or use non-deleting yank), select next block I need and paste the changed version over it. If I do the same thing in emacs (select region and paste with C-y), it doesn't replace the region, it just pastes at the cursor position. What is the way to do this in emacs?

    Read the article

  • question about linux

    - by davit-datuashvili
    i have following question i am writting programs in linux like this from command line i do following steps touch project.java nano project.java and // code here i have questions how can i create new classes interfaces and so on?because in IDE like netbeans i can do click on projects name with right size of mouse choose create new class or interfaces and it is created but how do it in linux if i dont use IDE?

    Read the article

  • #include headers in C/C++

    - by Carlos
    After reading several questions regarding problems with compilation (particularly C++) and noticing that in many cases the problem is a missing header #include. I couldn't help to wonder in my ignorance and ask myself (and now to you): Why are missing headers not automatically checked and added or requested to the programmer? Such feature is available for Java in Netbeans for example.

    Read the article

  • Using JDeveloper to develop a portlet for JavaFX project

    - by isaacniu
    Suppose I developed a JavaFX project using netbeans 6.8 (JavaFX SDK plugin installed), and right now I need to convert this JavaFX UI to portlet and display it in a web page. And I'm only allowed to do this using JDeveloper. So how could I achieve this? I'm using Oracle WebLogic Service as my web application server. -Regards from Isaac.

    Read the article

  • Place Eclipse Project File in Separate Directory

    - by Eddie Ringle
    I'm using a default Eclipse project file generated for my Android application, and I want to keep it in a targets/ directory (along with other eclipse-specific files) in order to better organize my project structure (I also plan on adding a target for NetBeans). Simple question, I suppose: Is this possible?

    Read the article

  • Is there any advantage for using a library other than Hibernate for JPA?

    - by Jeduan Cornejo
    Hi, I've been using JPA for some time now and been in projects where we've used both Hibernate Annotations and Toplink Essentials. AFAIK the project leader chose Toplink because Netbeans had it integrated and seemed to be the easy thing to do. However when looking for help, most of the literature seemed to assume that you are using Hibernate as the JPA provider, so, the question is, is have you found any advantage, performance or otherwise for not using the de-facto standard for JPA, Hibernate?

    Read the article

  • How to deduce wsdl for web service under tomcat

    - by xain
    Hi, I developed a ws using netbeans using annotations: @WebService MyWS() public class MyWS { @WebMethod(operationName="MyWebMethod") public MyWebMethod(@WebParam(name="str") StringHolder str){ ... } } The applicaction's context root is /WSTests Based on this information how can I deduce what's the .wsdl associated with my project to test it with - for instance - soapui ? Thanks

    Read the article

  • calling a java webservice from html page and javascript

    - by Jukki
    Hey guys, I'm trying to call a java implemented web service (using the NetBeans IDE) from javascript. I have read a lot about jQuery and AJAX but i cant seem to get a hand on it. suppose my web service WSDL is found at: http://localhost:8080/MICE_Server/MapEditorService?WSDL web method name : sayHello(String name) which returns a string. how would i be able to to this in javascript? thanks in advance for ur help!!

    Read the article

  • Are classes in Python in different files?

    - by Asaf
    Much like Java (or php), I'm use to seperating the classes to files. Is it the same deal in Python? plus, how should I name the file? Lowercase like classname.py or the same like ClassName.py? Do I need to do something special if I want to create an object from this class or does the fact that it's in the same "project" (netbeans) makes it ok to create an object from it?

    Read the article

  • Best IDE for Grails/Groovy?

    - by fernandogarcez
    I am starting a project with Grails since I already use Eclipse, it was my first choice. But I don´t think its good enough, had some problems and the plugging is poor in functionalities. Anyone uses/tested others IDEs(NetBeans, InteliJ(not free)...)? Which one is the best? thanks.

    Read the article

  • best way to create UI java apps ?

    - by fwfwfw
    I've come across Netbeans but is there any tools out there that lets you build things event driven ? I'm looking for a feature like being able to drag and drop UI components, and add methods to buttons directly by double clicking it (kinda like visualbasic) and viewing the source.

    Read the article

< Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >