Search Results

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

Page 160/1346 | < Previous Page | 156 157 158 159 160 161 162 163 164 165 166 167  | Next Page >

  • java.util.BitSet -- set() doesn't work as expected

    - by dwhsix
    Am I missing something painfully obvious? Or does just nobody in the world actually use java.util.BitSet? The following test fails: @Test public void testBitSet() throws Exception { BitSet b = new BitSet(); b.set(0, true); b.set(1, false); assertEquals(2, b.length()); } It's really unclear to me why I don't end up with a BitSet of length 2 and the value 10. I peeked at the source for java.util.BitSet, and on casual inspection it seems to fail to make sufficient distinction between a bit that's been set false and a bit that has never been set to any value... (Note that explicitly setting the size of the BitSet in the constructor has no effect, e.g.: BitSet b = new BitSet(2);

    Read the article

  • Digital signature integration with software written in java

    - by Serkan Kasapbasi
    hi everyone, i'm extremely rookie on this security field, so please forgive if my questions are dumb. i am asked to convert and migrate couple "Lotus Forms" forms to our software that is written in java. One thing in forms that bother me is digital signatures. These forms can be signed by digital signatures, probably generated by "Silanis Approve-it". as i have said before, i dont have much knowledge about this technology. and strangely couldnt find any tutorial or example of integrating digital signature and java. So what are the possibilities here ? how my code read a digital signature, sign a document with this signature? There should be an API or something that is provided by vendors right :)

    Read the article

  • How to stop jucheck from running? Java won't remember "Check for Updates Automatically" setting.

    - by Ken
    I've installed Java on Windows Vista, and every day I get a Vista security warning asking me if I want to run "jucheck". Apparently this is the Java automatic updater. Well, I don't want it to run on its own, ever. I cancel it, and quit it. I right-click on the taskbar and unclick "Check for Updates Automatically", and then click "Never Check", and "Apply". And yet, it never remembers this setting. If I come back to the "Java Control Panel" right after clicking "OK", the very same box is checked again, all on its own. Is there some way to kill jucheck once and for all? If I simply delete jucheck.exe, will Java (other than the automatic check) still work, and will manual updates still work, and will it stop even trying to update every morning?

    Read the article

  • UTF-8 to ISO-8859-1 mapping / lossless conversion libraries in Java

    - by Pawel Krupinski
    I need to perform a conversion of characters from UTF-8 to ISO-8859-1 in Java without losing for example all of the UTF-8 specific punctuation. Ideally would like these to be converted to equivalents in ISO (e.g. there are probably 5 different single quotes in UTF-8 and would like them all converted to ISO single quote character). String.getBytes("ISO-8859-1") just won't do the trick in this case as it will lose the UTF-8-specific chars. Do you know of any ready mappings or libraries in Java that would map UTF-8 specific characters to ISO?

    Read the article

  • Error during maven build: "[java] Timestamp response not valid"

    - by fei
    My maven build started failing randomly, and it got the following error which I cannot make sense of, and googling it doesn't give me anything useful: [echo] Creating a full package... [java] Timestamp response not valid [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to execute: Executing Ant script: /airtest.build.xml [package-admin-air]: Failed to execute. Java returned: 10 This is a random error that pops up in various point during the build process, and sometimes the build will succeed and then the next one will fail again. This is really weird, does anyone seen this before? I'm using maven 2.2.1 BTW, the error return code 10 in windows mean "Environment is invalid.:

    Read the article

  • Porting Java app to Go - any advice?

    - by Devrim
    We want to rewrite kodingen.com backend with Go which currently is Java, running as daemon using jsvc. I have never touched any C in my life, am only experienced in Java so I don't know if this is something that I should even start. However, task is pretty simple read shell commands from mysql database queue and execute them in parallel save each shell output to the database that's it. So these simple requirements gives me hope that I can start using this wonderful language. What would you advise?

    Read the article

  • Reading Windows ACLs from Java

    - by Matt Sheppard
    From within a Java program, I want to be able to list out the Windows users and groups who have permission to read a given file. Obviously Java has no built-in ability to read the Windows ACL information out, so I'm looking for other solutions. Are there any third party libraries available which can provide direct access to the ACL information for a Windows file? Failing that, maybe running cacls and capturing and then processing the output would be a reasonable temporary solution - Is the output format of cacls thoroughly documented anywhere, and is it likely to change between versions of Windows?

    Read the article

  • Best Practice For Referencing an External Module In a Java Project

    - by Greg Harman
    I have a Java project that expects external modules to be registered with it. These modules: Implement a particular interface in the main project Are packaged into a uni-jar (along with any dependencies) Contain some human-readable meta-information (like the module name). My main project needs to be able to load at runtime (e.g. using its own classloader) any of these external modules. My question is: what's the best way of registering these modules with the main project (I'd prefer to keep this vanilla Java, and not use any third-party frameworks/libraries for this isolated issue)? My current solution is to keep a single .properties file in the main project with key=name, value=classhuman-readable-name (or coordinate two .properties files in order to avoid the delimiter parsing). At runtime, the main project loads in the .properties file and uses any entries it finds to drive the classloader. This feels hokey to me. Is there a better way to this?

    Read the article

  • java spring and ftl

    - by bobby
    I defined a modelview object named "buttonpressed" in spring controller file and I need to access that modelview object in ftl(freemarker) file which is being returned as a view from a controller like abcd.java The abcd.java controller code is as below if (questionAnswer.getAnswerId() == 1045) { modelAndView.addObject("buttonPressed","You have been added in mailing list"); modelAndView.setViewName("enterCode_nextSteps"); } else { modelAndView.addObject("buttonPressed","Not added in the mailing list"); modelAndView.setViewName("enterCode_nextSteps"); } the below ajax function is working fine currently but I am not sure how to access this object called "buttonpressed" in this ajax function. I have written like the way mentioned below but when i am clicking the submit link its not calling "partner.do" and also throwing error saying #buttonPressed is undefind (but in the script below its working fine and calling "partner.do" and even posting data) So is that problem coming from javsscript code i mean due to incorrect use of "buttonPressed" or might be problem from spring controller abcd.java file. <div class="partnerOptInBox"> <div id="optInContent"> <form name="partnerOptIn"> <h4>Want the Latest</h4> <p class="pad10Top">${partnerOpt.translation}</p> <div class="pad10Top"> <input type="radio" name="questionAnswer['${partnerOpt.questionId}']" value="${partnerOpt.getAnswers()[0].answerId}" class="radioButton" /> <label for="questionAnswer['${partnerOpt.questionId}']" class="formLabel pad20Right">Yes</label> <input type="radio" name="questionAnswer['${partnerOpt.questionId}']" class="radioButton" value="${partnerOpt.getAnswers()[1].answerId}" /> <label for="questionAnswer['${partnerOpt.questionId}']" class="formLabel">No</label> </div> <div id="optInError" class="formError" style="display:none;">Oops... your request did not go through, please try again.</div> <div class="pad15Top"> <a href="javascript:submitOptIn();"><img src="images/theme/btn_opt_in_submit.gif"/></a> </div> </form> <script type="text/javascript"> function submitOptIn() { $('optInError').hide(); dataString = $('#partnerOptIn').serialize(); $.ajax({ data: dataString, url: "partnerOpt.do", timeout: 30000, type: "POST", success: function(html){ var newHtml = "<h4>Thank you</h4><p>We appreciate your time to respond to our request.</p>"; $('#optInContent').html(newHtml); }, */trying this code for sucess is throwing me an error /* <!-- buttonpressed function--> success: function(html){ $('#optInContent').html(${buttonPressed}); }, <!-- buttonpressed function--> error: function(){ $('#optInError').show(); } }); } </script>

    Read the article

  • NETBEANS JAVADB - How do I integrate a JavaDB DataBase into my main Java Package

    - by Stefanos Kargas
    JAVA I am working on a desktop application which uses JavaDB. I am using NetBeans 6.8 and JDK 6 Update 20 I created the database I need and connected to it through my application using ClientDriver: String driver = "org.apache.derby.jdbc.ClientDriver"; String connectionURL = "jdbc:derby://localhost:1527/myDB;create=true;user=user;password=pass"; try { Class.forName(driver); } catch (java.lang.ClassNotFoundException e) { e.printStackTrace(); } try { schedoDBConnection = DriverManager.getConnection(connectionURL); } catch (Exception e) { e.printStackTrace(); } This works fine. But in that case the service of the database comes from NetBeans. If I move my application to another PC I won't be able to access my database. How can I integrate my JavaDB into my application?

    Read the article

  • Java.util.scanner error handeling

    - by Hussain
    I'm helping a friend with a java problem. However, we've hit a snag. We're using Java.Util.Scanner.nextInt() to get a number from the user, asking continiously if the user gives anything else. Only problem is, we can't figure out how to do the error handeling. What we've tried: do { int reloop = 0; try { number = nextInt(); } catch (Exception e) { System.out.println ("Please enter a number!"); reloop ++; } } while(reloop != 0); Only problem is, this loops indefinatly if you enter in something not a number. Any help?

    Read the article

  • Where to place java applet policy file?

    - by makdere
    Hi all, I am working on an artificial intelligence project which is a logic game and aims two user connecting to the server on the network who acts as an Admin and then start to play one by one. In order to create connections, i have a server code which is just listening on localhost:8000 and assigning team values to the clients as they arrive. After connecting, clients make their move under Admin's control. The question is that when i try to put my code to work in the browser it fails with the following error: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:8000 connect,resolve) Even though i have created my own policy, first granting only Socket access permission to the codebase of my project folder (file:///home/xxx/projects/-), after it didnt work i granted all permissions from all codebase. I tried placing my policy file both in the home directory and in the same directory where my applet code resides. Appreciate any tips, thanks.

    Read the article

  • a question on webpage data scraping using Java

    - by Gemma
    Hi there. I am now trying to implement a simple HTML webpage scraper using Java.Now I have a small problem. Suppose I have the following HTML fragment. <div id="sr-h-left" class="sr-comp"> <a class="link-gray-underline" id="compare_header" rel="nofollow" href="javascript:i18nCompareProd('/serv/main/buyer/ProductCompare.jsp?nxtg=41980a1c051f-0942A6ADCF43B802'); " Compare Showing 1 - 30 of 1,439 matches, The data I am interested is the integer 1.439 shown at the bottom.I am just wondering how can I get that integer out of the HTML. I am now considering using a regular expression,and then use the java.util.Pattern to help get the data out,but still not very clear about the process. I would be grateful if you guys could give me some hint or idea on this data scraping. Thanks a lot.

    Read the article

  • java question: Is it a method?

    - by Stefan
    Hello, I'm no Java guy, so I ask myself what this means: public Button(Light light) { this.light = light; } Is Button a method? I ask myself, because it takes an input parameter light. But if it was a method, why would it begin with a capital letter and has no return data type? Here comes the full example: public class Button { private Light light; public Button(Light light) { this.light = light; } public void press() { light.turnOn(); } } I know, this question is really trivial. However, I have nothing to do with Java and haven't found a description for the Button thing above. I'm just interested.

    Read the article

  • Signal amplitude against time in Java

    - by wsr74ws84
    I'm racking my brain in order to solve a knotty problem (at least for me). While playing an audio file (using Java) I want the signal amplitude to be displayed against time. I mean I'd like to implement a small panel showing a sort of oscilloscope (spectrum analyzer). The audio signal should be viewed in the time domain (vertical axis is amplitude and the horizontal axis is time). Does anyone know how to do it? Is there a good tutorial I can rely on? Since I know very little about Java, I hope someone can help me.

    Read the article

  • Unselecting RadioButtons in Java Swing

    - by Thomas
    When displaying a group of JRadioButtons, initially none of them is selected (unless you programmatically enforce that). I would like to be able to put buttons back into that state even after the user already selected one, i.e., none of the buttons should be selected. However, using the usual suspects doesn't deliver the required effect: calling 'setSelected(false)' on each button doesn't work. Interestingly, it does work when the buttons are not put into a ButtonGroup - unfortunately, the latter is required for JRadioButtons to be mutually exclusive. Also, using the setSelected(ButtonModel, boolean) - method of javax.swing.ButtonGroup doesn't do what I want. I've put together a small program to demonstrate the effect: two radio buttons and a JButton. Clicking the JButton should unselect the radio buttons so that the window looks exactly as it does when it first pops up. import java.awt.Container; import java.awt.GridLayout; import java.awt.event.*; import javax.swing.*; /** * This class creates two radio buttons and a JButton. Initially, none * of the radio buttons is selected. Clicking on the JButton should * always return the radio buttons into that initial state, i.e., * should disable both radio buttons. */ public class RadioTest implements ActionListener { /* create two radio buttons and a group */ private JRadioButton button1 = new JRadioButton("button1"); private JRadioButton button2 = new JRadioButton("button2"); private ButtonGroup group = new ButtonGroup(); /* clicking this button should unselect both button1 and button2 */ private JButton unselectRadio = new JButton("Unselect radio buttons."); /* In the constructor, set up the group and event listening */ public RadioTest() { /* put the radio buttons in a group so they become mutually * exclusive -- without this, unselecting actually works! */ group.add(button1); group.add(button2); /* listen to clicks on 'unselectRadio' button */ unselectRadio.addActionListener(this); } /* called when 'unselectRadio' is clicked */ public void actionPerformed(ActionEvent e) { /* variant1: disable both buttons directly. * ...doesn't work */ button1.setSelected(false); button2.setSelected(false); /* variant2: disable the selection via the button group. * ...doesn't work either */ group.setSelected(group.getSelection(), false); } /* Test: create a JFrame which displays the two radio buttons and * the unselect-button */ public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); RadioTest test = new RadioTest(); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(3,1)); contentPane.add(test.button1); contentPane.add(test.button2); contentPane.add(test.unselectRadio); frame.setSize(400, 400); frame.setVisible(true); } } Any ideas anyone? Thanks!

    Read the article

  • Load data from CSV to mySQL database Java+hibernate+spring

    - by mona
    I am trying to load a CSV file in to mySQL database using Java+Hibernate+Spring. I am using the following query in the DAO to help me load in to the database: entityManager.createQuery("LOAD DATA INFILE :fileName INTO TABLE test").setParameter("fileName", "C:\\samples\\test\\abcd.csv").executeUpdate(); I got some idea to use this from http://dev.mysql.com/doc/refman/5.1/en/load-data.html and how to import a csv file into a mysql from an hibernate+spring application? But I am getting the error: java.lang.IllegalArgumentException: node to traverse cannot be null! Please help! Thanks

    Read the article

  • java timer on current instance

    - by hspim
    import java.util.Scanner; import java.util.Timer; import java.util.TimerTask; public class Boggle { Board board; Player player; Timer timer; boolean active; static Scanner in = new Scanner(System.in); public Boggle() { board = new Board(4); timer = new Timer(); } public void newGame() { System.out.println("Please enter your name: "); String line = in.nextLine(); player = new Player(line); active = true; board.shuffle(); System.out.println(board); timer.schedule(new timesUP(), 20000); while(active) { String temp = in.nextLine(); player.addGuess(temp); } } public void endGame() { active = false; int score = Scoring.calculate(player, board); System.out.println(score); } class timesUP extends TimerTask { public void run() { endGame(); } } public static void main(String[] args) { Boggle boggle = new Boggle(); boggle.newGame(); } } I have the above class which should perform a loop for a given length of time and afterwards invoke an instance method. Essentially I need the loop in newGame() to run for a minute or so before endGame() is invoked on the current instance. However, using the Timer class I'm not sure how I would invoke the method I need on the current instance since I can't pass any parameters to the timertasks run method? Is there an easy way to do this or am I going about this the wrong way? (note: this is a console project only, no GUI) ========== code edited I've changed the code to the above following the recommendations, and it works almost as I expect however the thread still doesnt seem to end properly. I was the while loop would die and control would eventually come back to the main method. Any ideas?

    Read the article

  • 3 matchers expected, 4 recorded.

    - by user564159
    I get this exception during the mock recording time. Searched for a solution in this forum. Made sure that i did not mess up any another parameter. The below mock expection is giving the error. EasyMock.expect(slotManager.addSlotPageletBinding(EasyMock.isA(String.class), EasyMock.isA(String.class), EasyMock.isA(helloWorld.class))).andReturn(true); before this statement i have another mock expection on the same method with TWO parameter(overloaded method).Below is that mock. EasyMock.expect(slotManager.addSlotPageletBinding(EasyMock.isA(String.class),EasyMock.isA(String.class))).andReturn(true).anyTimes(); Could any one guide me on this. Thanks. java.lang.IllegalStateException: 3 matchers expected, 4 recorded. at org.easymock.internal.ExpectedInvocation.createMissingMatchers(ExpectedInvocation.java:56) at org.easymock.internal.ExpectedInvocation.(ExpectedInvocation.java:48) at org.easymock.internal.ExpectedInvocation.(ExpectedInvocation.java:40) at org.easymock.internal.RecordState.invoke(RecordState.java:76) at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:38) at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:72) at org.easymock.classextension.internal.ClassProxyFactory$1.intercept(ClassProxyFactory.java:79) at com.amazon.inca.application.SlotManager$$EnhancerByCGLIB$$3bf5ac02.addSlotPageletBinding() at com.amazon.iris3.apps.Iris3YourAccountApplicationTest.testBuildIncaViewConfiguration(Iris3YourAccountApplicationTest.java:107) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

    Read the article

< Previous Page | 156 157 158 159 160 161 162 163 164 165 166 167  | Next Page >