Search Results

Search found 1156 results on 47 pages for 'roman'.

Page 17/47 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Why it cannot find getInputStream?

    - by Roman
    I have this code: ServerSocket serverSideSocket = new ServerSocket(1234); serverSideSocket.accept(); BufferedReader in = new BufferedReader(new InputStreamReader(serverSideSocket.getInputStream())); And compiler writes me that it cannot find "getInputStream". I do not understand why. In the beginning of my code I do import java.net.*.

    Read the article

  • How to set up single array or dictionary for use in multiple datasources?

    - by Roman
    I have multiple TableViewDatasources that need to display list of objects form same pool depending of certain property. E.g. object.flag1 is set- it will show up in TableView1 object.flag2 is set- it will show up in TableView2 The obvious way would be to have separate arrays for each TableView, But same object may appear in different arrays. Also I need to update objects very often or access all objects through same array. How do I setup a single dictionary or array to have all objects in one structure? To put it in another way: When table view or selection changes, application need to redraw TableViews with the new data. Application have to access the pool of objects and search through them using iterator and accessing each object and its properties. I think that this is an expensive operation and want to avoid that. Perhaps maybe by making a global pool of objects a dictionary and exposing objects properties as dictionary fields. So instead of iterating global pool of objects I could access global pool Dicitonary in a manner of database by selecting objects that has fields that match particular criteria. Anyone know any example of doing that?

    Read the article

  • How to implement custom JSF component for drawing chart?

    - by Roman
    I want to create a component which can be used like: <mc:chart data="#{bean.data}" width="200" height="300" /> where #{bean.data} returns a collection of some objects or chart model object or something else what can be represented as a chart (to put it simple, let's assume it returns a collection of integers). I want this component to generate html like this: <img src="someimg123.png" width="200" height="300"/> The problem is that I have some method which can receive data and return image, like: public RenderedImage getChartImage (Collection<Integer> data) { ... } and I also have a component for drawing dynamic image: <o:dynamicImage width="200" height="300" data="#{bean.readyChartImage}/> This component generates html just as I need but it's parameter is array of bytes or RenderedImage i.e. it needs method in bean like this: public RenderedImage getReadyChartImage () { ... } So, one approach is to use propertyChangedListener on submit to set data (Collection<Integer>) for drawing chart and then use <o:dynamicImage /> component. But I'd like to create my own component which receives data and draws chart. I'm using facelets but it's not so important indeed. Any ideas how to create the desired component? P.S. One solution I was thinking about is not to use <o:dynamicImage/> and use some servlet to stream image. But I don't know how to implement that correctly and how to tie jsf component with servlet and how to save already built chart images (generating new same image for each request can cause performance problems imho) and so on..

    Read the article

  • Class Methods Inheritence

    - by Roman A. Taycher
    I was told that static methods in java didn't have Inheritance but when I try the following test package test1; public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { TB.ttt(); TB.ttt2(); } } package test1; public class TA { static public Boolean ttt() { System.out.println("TestInheritenceA"); return true; } static public String test ="ClassA"; } package test1; public class TB extends TA{ static public void ttt2(){ System.out.println(test); } } it printed : TestInheritenceA ClassA so do java static methods (and fields have) inheritance (if you try to call a class method does it go down the inheritance chai looking for class methods). Was this ever not the case,are there any inheritance OO languages that are messed up like that for class methods?

    Read the article

  • Running a program in another one?

    - by Roman
    Hi, I've written a program in C++. It's just using the console to have it as portable as possible. Unfortunately, many Windows-Users seem not to understand how to use the program (Linux Users are just fine with it :) ). So I'd like to write a GUI for that program. As this needs to run on Windows only, I'd like to write it in C#. But I want to maintain the GUI apart from the original program. So basically, I need a way to include a compiled *.exe into another program. Is there a way to catch the console output from another program and send inputs to it? Also, can the console of the original program be hidden? Similar Questions How To: Execute command line in C#, get STD OUT results

    Read the article

  • How to get JSON back from HTTP POST Request (to another domain)

    - by roman m
    I'm trying to use the API on a website, here's the part of the manual: Authenticated Sessions (taken from here) To create an authenticated session, you need to request an authToken from the '/auth' API resource. URL: http://stage.amee.com/auth (this is not my domain) Method: POST Request format: application/x-www-form-urlencoded Response format: application/xml, application/json Response code: 200 OK Response body: Details of the authenticated user, including API version. Extra data: "authToken" cookie and header, containing the authentication token that should be used for subsequent calls. Parameters: username / password Example Request POST /auth HTTP/1.1 Accept: application/xml Content-Type: application/x-www-form-urlencoded username=my_username&password=my_password Response HTTP/1.1 200 OK Set-Cookie: authToken=1KVARbypAjxLGViZ0Cg+UskZEHmqVkhx/Pm...; authToken: 1KVARbypAjxLGViZ0Cg+UskZEHmqVkhx/PmEvzkPGp...== Content-Type: application/xml; charset=UTF-8 QUESTION: How do I get that to work? I tried jQuery, but it seems to have problem with XSS. Actual code snippet would be greatly appreciated. p.s. All I was looking for was WebClient class in C#

    Read the article

  • Can it be done in a more elegant way with the Swing Timer?

    - by Roman
    Bellow is the code for the simplest GUI countdown. Can the same be done in a shorter and more elegant way with the usage of the Swing timer? import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingUtilities; public class CountdownNew { static JLabel label; // Method which defines the appearance of the window. public static void showGUI() { JFrame frame = new JFrame("Simple Countdown"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); label = new JLabel("Some Text"); frame.add(label); frame.pack(); frame.setVisible(true); } // Define a new thread in which the countdown is counting down. public static Thread counter = new Thread() { public void run() { for (int i=10; i>0; i=i-1) { updateGUI(i,label); try {Thread.sleep(1000);} catch(InterruptedException e) {}; } } }; // A method which updates GUI (sets a new value of JLabel). private static void updateGUI(final int i, final JLabel label) { SwingUtilities.invokeLater( new Runnable() { public void run() { label.setText("You have " + i + " seconds."); } } ); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { showGUI(); counter.start(); } }); } }

    Read the article

  • Can I close and reopen a socket?

    - by Roman
    I learned an example of usage of sockets. In this example a client sends a request to a server to open a socket and then the server (listening to a specific port) opens a socket and everything is fine, socket is "opened" from both sides (client and server). But it is still not clear to me how flexible is this stuff. For example, is it possible for the client to close an opened (from both ends) socket and to reopen it again (under condition that the server keeps the socket opened). Is it possible for the server to "know" that a socket was closed on the client side? Is it possible for the client to know that a socket was closed on the server side?

    Read the article

  • How can I find a package?

    - by Roman
    In my code I have the following statement import com.apple.dnssd.*; and compiler (javac) complains about this line. It writes that the package does not exist. But I think that it could be that "javac" search the package in a wrong place (directory). In this respect I have two questions: How can I know where javac search for the packages? I think that it is very likely that I have the above mentioned package but I do not know where it is located. What are the typical place to look for the packages?

    Read the article

  • Hibernate error: cannot resolve table

    - by Roman
    I'm trying to make work the example from hibernate reference. I've got simple table Pupil with id, name and age fields. I've created correct (as I think) java-class for it according to all java-beans rules. I've created configuration file - hibernate.cfg.xml, just like in the example from reference. I've created hibernate mapping for one class Pupil, and here is the error occured. <hibernate-mapping> <class name="Pupil" table="pupils"> ... </class> </hibernate-mapping> table="pupils" is red in my IDE and I see message "cannot resolve table pupils". I've also founded very strange note in reference which says that most users fail with the same problem trying to run the example. Ah.. I'm very angry with this example.. IMHO if authors know that there is such problem they should add some information about it. But, how should I fix it? I don't want to deal with Ant here and with other instruments used in example. I'm using MySql 5.0, but I think it doesn't matter. UPD: source code Pupil.java - my persistent class package domain; public class Pupil { private Integer id; private String name; private Integer age; protected Pupil () { } public Pupil (String name, int age) { this.age = age; this.name = name; } public Integer getId () { return id; } public void setId (Integer id) { this.id = id; } public String getName () { return name; } public void setName (String name) { this.name = name; } public Integer getAge () { return age; } public void setAge (Integer age) { this.age = age; } public String toString () { return "Pupil [ name = " + name + ", age = " + age + " ]"; } } Pupil.hbm.xml is mapping for this class <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="domain" > <class name="Pupil" table="pupils"> <id name="id"> <generator class="native" /> </id> <property name="name" not-null="true"/> <property name="age"/> </class> </hibernate-mapping> hibernate.cfg.xml - configuration for hibernate <hibernate-configuration> <session-factory> <!-- Database connection settings --> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost/hbm_test</property> <property name="connection.username">root</property> <property name="connection.password">root</property> <property name="connection.pool_size">1</property> <property name="dialect">org.hibernate.dialect.MySQL5Dialect</property> <property name="current_session_context_class">thread</property> <property name="show_sql">true</property> <mapping resource="domain/Pupil.hbm.xml"/> </session-factory> </hibernate-configuration> HibernateUtils.java package utils; import org.hibernate.SessionFactory; import org.hibernate.HibernateException; import org.hibernate.cfg.Configuration; public class HibernateUtils { private static final SessionFactory sessionFactory; static { try { sessionFactory = new Configuration ().configure ().buildSessionFactory (); } catch (HibernateException he) { System.err.println (he); throw new ExceptionInInitializerError (he); } } public static SessionFactory getSessionFactory () { return sessionFactory; } } Runner.java - class for testing hibernate import org.hibernate.Session; import java.util.*; import utils.HibernateUtils; import domain.Pupil; public class Runner { public static void main (String[] args) { Session s = HibernateUtils.getSessionFactory ().getCurrentSession (); s.beginTransaction (); List pups = s.createQuery ("from Pupil").list (); for (Object obj : pups) { System.out.println (obj); } s.getTransaction ().commit (); HibernateUtils.getSessionFactory ().close (); } } My libs: antlr-2.7.6.jar, asm.jar, asm-attrs.jar, cglib-2.1.3.jar, commons-collections-2.1.1.jar, commons-logging-1.0.4.jar, dom4j-1.6.1.jar, hibernate3.jar, jta.jar, log4j-1.2.11.jar, mysql-connector-java-5.1.7-bin.jar Compile error: cannot resolve table pupils

    Read the article

  • How the simples GUI countdown is supposed to work?

    - by Roman
    I am trying to write the simples GUI countdown. I found in Internet some code but it is already too fancy for me. I am trying to keep it as simple as possible. So, I just want to have a window saying "You have 10 second left". The number of second should decrease every second from 10 to 0. I wrote a code. And I think I am close to the working solution. But I still missing something. Could you pleas help me to find out what is wrong? Here is my code: import javax.swing.*; public class Countdown { static JLabel label; // Method which defines the appearance of the window. private static void showGUI() { JFrame frame = new JFrame("Simple Countdown"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("Some Text"); frame.add(label); frame.pack(); frame.setVisible(true); } // Define a new thread in which the countdown is counting down. static Thread counter = new Thread() { public void run() { for (int i=10; i>0; i=i-1) { updateGUI(i,label); try {Thread.sleep(1000);} catch(InterruptedException e) {}; } } }; // A method which updates GUI (sets a new value of JLabel). private static void updateGUI(final int i, final JLabel label) { SwingUtilities.invokeLater(new Runnable(i,label) { public Runnable(int i, JLabel label) { this.i = i; this.label = label; } public void run() { label.setText("You have " + i + " seconds."); } }); } // The main method (entry point). public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { showGUI(); //counter.start(); } }); //counter.start(); } } And I have several concrete question about this code: Where should I place the counter.start();? (In my code I put it on 2 places. Which one is correct?) Why compiler complains about the constructor for Runnable? It says that I have an invalid method declaration and I need to specify the returned type. ADDED: I made the suggested corrections. And then I execute the code and get: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Worker.run(Worker.java:12) In the Worker.java in the line 12 I have: label.setText("You have " + i + " seconds.");.

    Read the article

  • How do the size standard libraries compare for different languages

    - by Roman A. Taycher
    Someone was recently raving about how great jQuery was and how it made javascript into a pleasure and also how the whole source code was so small(and one file). I looked it up on www.ohloh.net/ and it said it was about 30,000 lines of javascript, when I tired curl piped to wc it said about 5000 lines(strange discrepancy that, maybe test suites, ect?). I thought well it isn't that strange since javascript from what I've heard has a lot of fun dynamic tricks, so you can probably get away with a small library. But then I thought what about other high level languages, the ones with large standard libraries and wondered how big the standard are for python/ruby/haskell/pharo(smalltalk)/*ml/ect. (libraries not vm stuff to the degree its possible to separate it) Anybody know? Any details (comment/blank/code lines , test code lines, lines in language vs lines in ffi/byte-code) are appreciated! edit: ps. since it started this me asking about jQuery as a bonus if you could please list the size of mega frameworks, a megaframewok provides so much that people using an x megaframework in language y might sometimes refer to programming in xy or even x rather then in y (ie. : qt, jQuery, etc.).

    Read the article

  • Placement new in gcc

    - by Roman Prikhodchenko
    I need to find a workaround for a bug with placement new in g++. I now it was fixed in gcc-4.3 but I have to support versions 4.2 and 4.1. For example, following code compiles with an error "error: no matching function for call to 'operator new(long unsigned int, void*&)" template<class T, template<typename> class Alloc> inline void* type_ctor() { Alloc<T> a; void* p = a.allocate(1); new(p) T; return p; } ..... type_ctor<A, NewAllocator >();

    Read the article

  • How to identify what locked PL/SQL package (Oracle 10.0.4.2)?

    - by Roman Kagan
    I was trying to recompile PL/SQL package and no avail. because something obtained the lock and that wasn't released for long time. As soon as I kill all sessions I was able to recompile but encounter the same behavior (i.e. locked package) and I wonder what tools are avail to identify what could of obtain it and never release it? This happen on (Oracle 10.0.4.2). Greatly appreciate for your help.

    Read the article

  • Invoke Maven-Module build from intellij

    - by Roman
    Hi All I was wondering if someone knows a way to invoke a specific maven module build from IntelliJ that will also build ( or use already compiled classes ) from depended modules. So for instance if I would like to build the module "Model" in the picture and only it , it seems reasonable for me to click the package step on it. But what is actually does it invokes the mvn package step inside this specific module rather than "mvn -am -pl module-name" from the root module , which also builds all the dependencies. So is there something that I just don't know ?

    Read the article

  • Why a EDT violation happens?

    - by Roman
    I started to use CheckThreadViolationRepaintManager to detect EDT violations. It complains about: partner = getParameter("partner",generatePartnerSelectionPanel(),Design.partnerSelectionDuration); Because it does not like generatePartnerSelectionPanel() because it does not like JPanel panel = new JPanel(); in this method. But I cannot find out why there should be a problem around that. In more details, generatePartnerSelectionPanel() generates a JPanel (I do it not in the EDT) but then, in the getParameter I add the JPanel to the main JFrame and I do it in the EDT (using invokeLater). So, why there should be a problem?

    Read the article

  • Rank Source Control Options-VSS vs CVS vs none vs your own hell

    - by Roman A. Taycher
    It seems like a lot of people here and on many programmer wikis/blogs/ect. elsewhere really dislike VSS. A lot of people also have a serious dislike for cvs. In many places I have heard a lot of differing opinions on whether or not using VSS or cvs is better or worse then using no source control, please rate the worst and explain why!!!!! you rated them this way. Feel free to throw in your own horrible system in the rankings. If you feel it depends on the circumstances try to explain the some of the different scenarios which lead to different rankings. (note:I see a lot of discussion of what is better but little of what is worse.) second note: while both answers are nice I'm looking less for good replacements and more for a comparison of which is worse and more importantly why!

    Read the article

  • RedirectStandardInput crashes program

    - by Roman
    Hi, the following code is to open a console application (which uses pdcurses for output, nothing special): myProcess.StartInfo.FileName = "some.exe"; myProcess.StartInfo.UseShellExecute = false; myProcess.StartInfo.CreateNoWindow = false; myProcess.StartInfo.RedirectStandardInput = true; myProcess.Start(); The Problem is that it opens the designated window but directly closes it (it's barely visible). Starting the program without RedirectStandardInput works. The problem is that it does not throw an exception nor any error-message. What is wrong with my code? How can I write input to the program? Thanks.

    Read the article

  • How can I shift html-text in the JButton to the left?

    - by Roman
    I use HTML to put text into a JButton. In this way I can play with colors and text size. What I do not like is the distance from the left border of the button and the text (this separation is too large). Is there a way to decrease this distance? I think it should be some parameter in the style of the HTML code. Sample of the code: JButton btn = new JButton("<html><span style='color:#000000; font-size: 11pt;'>" + label + "</span></html>");

    Read the article

  • How can I easily run different configurations in Eclipse?

    - by Roman
    I have an Java applications which I would like to run with different values of input parameters (specified in the command line). In "Run - Run Configurations" I have created different configurations corresponding to different values of the input arguments. I can run these configurations in the same way (throw "Run - Run Configurations"). But in these case I have to perform to many actions (clicks) to run a particular configuration. Is there a easier (faster) way to do that? For example I expect that I can do it throw "Run - Run as" but in the drop-dawn menu of the "Run as" I see "(Not Applicable)".

    Read the article

  • Build specific module in multi-module project

    - by Roman
    Hi I have a multi-module project. I thought I can compile only a single module from that multi module project by that line : mvn -amd -pl "module-name" Seems not to work , this command builds only the specific module. Its dependencies are not compiled yet so it fails. Any ideas how to solve that ? Thanks

    Read the article

  • How to handle large dataset with JPA (or at least with Hibernate)?

    - by Roman
    I need to make my web-app work with really huge datasets. At the moment I get either OutOfMemoryException or output which is being generated 1-2 minutes. Let's put it simple and suppose that we have 2 tables in DB: Worker and WorkLog with about 1000 rows in the first one and 10 000 000 rows in the second one. Latter table has several fields including 'workerId' and 'hoursWorked' fields among others. What we need is: count total hours worked by each user; list of work periods for each user. The most straightforward approach (IMO) for each task in plain SQL is: 1) select Worker.name, sum(hoursWorked) from Worker, WorkLog where Worker.id = WorkLog.workerId group by Worker.name; //results of this query should be transformed to Multimap<Worker, Long> 2) select Worker.name, WorkLog.start, WorkLog.hoursWorked from Worker, WorkLog where Worker.id = WorkLog.workerId; //results of this query should be transformed to Multimap<Worker, Period> //if it was JDBC then it would be vitally //to set resultSet.setFetchSize (someSmallNumber), ~100 So, I have two questions: how to implement each of my approaches with JPA (or at least with Hibernate); how would you handle this problem (with JPA or Hibernate of course)?

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >