Search Results

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

Page 130/1346 | < Previous Page | 126 127 128 129 130 131 132 133 134 135 136 137  | Next Page >

  • After C++ - Python or Java?

    - by carleeto
    I'm fast approaching the point in my coding where I would like to quickly write object oriented code in languages other than C++ for a variety of reasons. After a lot of research, my choices have pretty much narrowed down to Python and Java. I'm leaning towards Python because of its relationship to C, but with Java, from what I can see, I get a good introduction to using and creating test suites with Eclipse - there is also Processing which is pulling me towards Java. I'm not the kind of guy to tackle two languages at once, so which one would you recommend and why? What I want at the end is to have an additional language I can use for rapid development. Ease of learning isn't important to me as I'm willing to put in the time regardless. Ability to use the new language widely is.

    Read the article

  • Why do date manipulation in Java with milliseconds?

    - by staticsan
    I was recently faced with the problem of calculating the number of days from two dates in Java (without using joda, I'm afraid). Searching on the 'net shows most answers to this question say to get the milliseconds of the two days and convert that to days, which I found appalling. However, a scant few show a different approach: use a temporary variable to count how many times it takes adding 1 day to the first date to get to the second. This leaves the conversions to the code that does it best: the library. Why do so many people advocate the first? In another project, I had previously encountered numerous subtle date calculation problems involving time-zones, daylight-saving and once even leap years using seconds to do date comparisions and calculations. All these went away when all the comparison and calculation code was rewitten to use the language libraries. (This was in PHP, though, where the libraries are structured quite differently to Java.) So I'm understandably reluctant to use this "common wisdom" in the world of Java about comparing dates.

    Read the article

  • Why is memory management so visible in Java?

    - by Emil
    I'm playing around with writing some simple Spring-based web apps and deploying them to Tomcat. Almost immediately, I run into the need to customize the Tomcat's JVM settings with -XX:MaxPermSize (and -Xmx and -Xms); without this, the server easily runs out of PermGen space. Why is this such an issue for Java compared to other garbage collected languages? Comparing counts of "tune X memory usage" for X in Java, Ruby, Perl and Python, shows that Java has easily an order of magnitude more hits in Google than the other languages combined.

    Read the article

  • Inheriting from multiple classes in Java (and possibly not using interface)

    - by sheidaei
    So, let's say we have classes A, B and C and I want to inherit from all those classes and have another class called D, it can be done using implements and interfaces in Java. But let's say we don't want to use this simple solution, would you be able to inherit class D from classes A, B and C in any other way in Java? (This question might be related to design patterns, it has been brought up after challenging my colleague at lunch discussing design patterns) I don't think there is any other way to have multiple inheritance in Java other than using multiple interfaces.

    Read the article

  • Java serial comm notifyOnDataAvailable configure receive buffer size?

    - by fred basset
    Hi All, I have a Java serial driver that's using the notifyOnDataAvailable mode to enable async. receive notification. I see an occasional problem where the SerialPortEvent.DATA_AVAILABLE serial event is not called until a relatively large no. of characters have been received (e.g. 34). The problem is that the sender sent a 20 byte packet, so the Java receiver did not send an ACK until the sender did a retry of the 20 byte send. Is there any way in Java COMM to configure the size of the receive buffer?

    Read the article

  • Java 7 New Features

    - by John W.
    I have done some good reading on the new java.util.concurrent features being introduced with the java 7 release. For instance, Phaser, TransferQueue and the more exciting Fork Join Framework. I recently saw a power point made by Josh Bloch about even more features that are going to be introduced however that link has been lost. For example I remember one change is being able to build a Map the same way you can build an array for: Map myMap = {"1,Dog","2,Cat"}; and so forth (this may not be 100% correct but the idea is there) Does anyone know of a list or just can name some new things to look forward to? Note: I did see a question asked http://stackoverflow.com/questions/213958/new-features-in-java-7 however it was asked ~2 years ago and I am sure the list of updates are more concrete. Thanks!

    Read the article

  • Java Swing- Create a function to add elements to JScrollPanel

    - by battousai622
    I want to create a function so that i can call add JLabel's, etc inside the JScrollPanel. I am not sure what the command is in NetBeans. I tried doing JScrollPanel - events - container - componentAdded to create the code below. But nothing shows up when i add code to that function. private void initComponents() { scrollPanel = new javax.swing.JScrollPane(); scrollPanel.addContainerListener(new java.awt.event.ContainerAdapter() { public void componentAdded(java.awt.event.ContainerEvent evt) { scrollPanelComponentAdded(evt); } } private void scrollPanelComponentAdded(java.awt.event.ContainerEvent evt) { System.out.println("main"); } Any help would be great, thanks.

    Read the article

  • Java training for .NET developers?

    - by C Keene
    We are working with a large retail bank on training 40-50 .Net developers to use Java. They are familiar with C# and .Net framework and have built dozens of "run the business" style apps in .Net. We need advice on how to provide basic Java familiarity, with a focus on back end logic, security and transaction management. Back end is Spring/Hibernate, front end is Ajax (Dojo). Are there any online, self-paced, Java courses that would be good for C#/.Net developers to get up to speed quickly?

    Read the article

  • execute external command / application from java

    - by IttayD
    I'm looking for a package to support reliably executing external processes from Java. My criteria: Abstract over OS. So if I want to run 'foo', it will look for 'foo.bat', 'foo.exe' under windows and 'foo' under other OSs (or, have a way of passing a map of os-command) Being able to execute Java classes by simply giving the class name and arguments (so the package locates the java command, copies jvm flags and then executes) Process stdout and stderr properly Watchdog / Monitoring capabilities I've looked at commons-exec but it looks like it answers only 3 & 4. Ant has support for execution but looks like an overkill to use it for this purpose only.

    Read the article

  • Take input through Buttons in java

    - by stash211
    I understand that the title might not be descriptive enough, but I'm making a magic square game in Java and basically, I'm trying to replicate user input as found in the sudoku game here: http://www.websudoku.com/. What I have is a n x n grid of Buttons (not JButton) as the board and what I want the user to be able to do is when the user clicks on one of the buttons, similar to the game above, it allows the user to type in his guess in the button itself instead of popping up a dialog box with an input field of some sort. I don't know where to start, I am a beginner in Java (not very beginner, but my knowledge with the various Java APIs is very limited), so I'm trying to find out if this would be possible and if it is, how would I go about doing it? Thanks for any help.

    Read the article

  • Can you call compiled JRuby classes from java?

    - by John Baker
    So I came up with the general idea to write some code in JRuby, then access all the classes via Java. I have no idea if this is at all possible but I wanted to ask anyway. Lets say I have some JRuby code: class adder def addme return 22 end end If I compiled this with jrubyc is there any way I could then possibly do something like this in java: import adder; class anything { void testMethod() { adder a = new adder(); int x = a.addme(); } } After looking at it now it sort of makes me think that Java will have zero idea what sort of item test addme is going to return so that might not work. I don't know but I wanted to throw it out there anyway. Thanks

    Read the article

  • Clearcase and java process : changing view does not apply

    - by user1432310
    i have a simple application, which receives input from a user for a CC stream name, and is suppose to return the content of a specific file from this stream repository. I have tried doing this using a simple shell script: user enters stream name, java receives stream name, runs a process which runs a script "myccscript.sh" which contains "myinput=$1; cleartool setview $myinput" (or something like that). then i try reading the file and printing it's content in the java side. BUT, after the process is finished - the view is not the view from the user input - that environment was probably only valid for the process Ive created. how do i change the clearcase view to the main java process? Thanks!

    Read the article

  • Why Java cannot find my constructor?

    - by Roman
    Well, maybe it is a stupid question, but I cannot resolve this problem. In my ServiceBrowser class I have this line: ServiceResolver serviceResolver = new ServiceResolver(ifIndex, serviceName, regType, domain); And compiler complains about it. It says: cannot find symbol symbol : constructor ServiceResolver(int,java.lang.String,java.lang.String,java.lang.String) This is strange, because I do have a constructor in the ServiceResolver: public void ServiceResolver(int ifIndex, String serviceName, String regType, String domain) { this.ifIndex = ifIndex; this.serviceName = serviceName; this.regType = regType; this.domain = domain; } ADDED: I removed void from the constructor and it works! Why?

    Read the article

  • Get all variables of javascript in JAVA

    - by Parhs
    Hello... I am using rhino and Scripting for the Java Platform in order to allow the user extend my application. However the user can write some cases eg (ASTO.value>440) || (ASTO.bellowNormal) etc... The problem is that before running the script from my JAVA application using ScriptEngine i want to get the names of all the variables! Because i should know which variables are required for the script to run... I know that a regular expression would do the job but i amnt sure... Please i somebody could help me figure out the java regexp to get the variables i would really appriciate it..

    Read the article

  • IP Address not obtained in java

    - by nilesh
    This code used to return my local ip address as 192.xxx.x.xxx but now it is returning 127.0.0.1 . Please help me why the same code is returning different value. Is there something that I need to watch at linux OS. import java.util.*; import java.lang.*; import java.net.*; public class GetOwnIP { public static void main(String args[]) { try{ InetAddress ownIP=InetAddress.getLocalHost(); System.out.println("IP of my system is := "+ownIP.getHostAddress()); }catch (Exception e){ System.out.println("Exception caught ="+e.getMessage()); } } }

    Read the article

  • Closed Source Java Applications

    - by Paul
    I am taking programming courses and we have been discussing Open Source and having a bit of an argument over the confusion. Just because Java is Open Source, the licensing on developed applications starts at the developer, correct? Someone is arguing about the use of code from a complete program just because "Java is Open Source". If I write a Java application, what are the limitations on how I can distribute it or how someone else can use it? Assume here that I DO NOT want someone having access to my source. Thanks

    Read the article

  • Build common interface for two applications(one is in .asp, other in java)

    - by govardhan
    We have two applications. One application in .asp and second application in java. we want to build interface for universal authentication, so that one can access the other application once signed into one application. Both applications are using SQL database, but one is written in .ASP hosted on Windows server while the other is in JAVA hosted on a Linux server. The applications are currently resided on two different servers. requirements: 1)The end user are most likely to access the applications through .ASP first, then reach the 2nd application more like "back office" management system. 2)he JAVA application currently works well with IE web browser, but not very smooth with other browsers such as Firefox. Would like to make the application to be more compatible with other browsers. Please help me, its very important to me. Thanks in advance!

    Read the article

  • how to create a dynamic class at runtime in Java

    - by Mrityunjay
    hi, is it possible to create a new java file from existing java file after changing some of its attributes at runtime?? Suppose i have a java file pubic class Student{ private int rollNo; private String name; // getters and setters // constructor } is it possible to create something like this, provided that rollNo is key element for the table.. public class Student { private StudentKey key; private String name; //getters and setters //constructor } public class StudentKey { private int rollNo; // getters and setters // construcotors } please help..

    Read the article

  • Java and C# : how to decide

    - by Andrea
    I'm working in a company where i work on environment. Net; I found another company that offered me a job where, however, programming in Java. I do not know Java and want to understand what are the differences. With the. NET framework I can build Windows Forms applications, web (asp.net and asp.net MVC), Silverlight (also for the 7 Series phones), WPF, WCF services and more and I have also Intellisense and ReSharper. In java? It 'a language that has a future? You what would you do? Thanks

    Read the article

  • A non-blocking server with java.io

    - by Jon
    Everybody knows that java IO is blocking, and java NIO is non-blocking. In IO you will have to use the thread per client pattern, in NIO you can use one thread for all clients. Now my question follows: is it possible to make a non-blocking design using only the Java IO api. (not NIO) I was thinking about a pattern like this (obviously very simplified); List<Socket> li; for (Socket s : li) { InputStream in = s.getInputStream(); byte[] data = in.available(); in.read(data); // processData(data); (decoding packets, encoding outgoing packets } Also note that the client will always be ready for reading data. What are your opinions on this? Will this be suitable for a server that should at least hold a few hundred of clients without major performance issues?

    Read the article

  • Java swing doesn't show changes to source

    - by out_sider
    I'm using Java Swing graphical editor with netbeans to make my project...but using it brings some limitations like I can't add to a jpanel an image,using java swing options. So i'll need to code it, implementing a new jPanel. My problem is that the code generated by the java swing graphical editor can't be edited so instead of adding the new JPanel code in the initComponents() section I'm doing it after this function is called in the constructor of my main JPanel. But any code I add is not recognized by the "Designer" which means that after making my coded objects I can't use them in the "Designer" and everything must be coded, which is a pain considering how much easier is previewing and moving elements in the "Designer" tool. How can I code what I want but steel appear in the "DEsigner"? Thx in advance

    Read the article

  • How to extend the list of available Java Locales

    - by alfonx
    I am looking for a way to add more Locales to the Locales available in Java 1.6. But the Locales I want to create do not have ISO-3166 country codes, nor ISO-639 language codes. Is there any way to do this anyways? The Locales I want to add only differ in the language names, but the smaller an ethnic group is, the more picky they get about their identity ;-) So I thought about extending an existing Locale, something like UserDefinedLocale extends Locale { UserDefinedLocale (Locale parentLocale) {...} } but java.util.Locale is final, which makes it especially hard to hack something around... So, is the idea that the list of Java Locales is exhaustive? Am I the first to miss some more Locales?

    Read the article

  • Simple Hash that is always equal between C# and Java

    - by GaiusSensei
    I have a C# WebService and a (Java) Android Application. Is there a SIMPLE hash function that produces the same result between these two languages? The simplest C# hash is a String.GetHashCode(), but I can't replicate it in Java. The simplest Java hash is not simple at all. And I don't know if I can replicate it exactly in C#. In case it's relevant, I'm hashing passwords before sending it across the internet. I'm currently using Encode64, but that's obviously not secure since we can reverse it.

    Read the article

  • Java Collections.Rotate with an array doesn't work

    - by steve_72
    I have the following java code: import java.util.Arrays; import java.util.Collections; public class Test { public static void main(String[] args) { int[] test = {1,2,3,4,5}; Collections.rotate(Arrays.asList(test), -1); for(int i = 0; i < test.length; i++) { System.out.println(test[i]); } } } I want the array to be rotated, but the output I get is 1 2 3 4 5 Why is this? And is there an alternative solution?

    Read the article

  • Java Double Array

    - by user1062058
    I'm having trouble setting up and placing values into an array using a text file containing the floating point numbers 2.1 and 4.3 each number is separated by a space - below is the error I'm getting: Exception in thread "main" java.util.NoSuchElementException import java.util.*; import java.io.*; public class DoubleArray { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(new FileReader("mytestnumbers.txt")); double [] nums = new double[2]; for (int counter=0; counter < 2; counter++) { int index = 0; index++; nums[index] = in.nextDouble(); } } } Thanks, I'm sure this isn't a hard question to answer... I appreciate your time.

    Read the article

< Previous Page | 126 127 128 129 130 131 132 133 134 135 136 137  | Next Page >