Search Results

Search found 1161 results on 47 pages for 'roman kagan'.

Page 23/47 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • What is the event dispatching thread?

    - by Roman
    I know what "thread" means and if I understand the event dispatching thread (EDT) as "just a thread", it explains a lot but, apparently, it does not explain everything. I do not understand what is special about this thread. For example I do not understand why we should start a GUI in a the EDT? Why the "main" thread is bed for GUI? Well, if we just do not want to occupy the main thread why we cannot start GUI just in "another thread" why it should be some "special" thread called EDT? Then I do not understand why we cannot start the EDT like any other thread? Why we should use some special tool (called invokeLater). And why GUI, unlike any other thread, does not start immediately. We should wait until it is ready to accept our job. Is it because EDT can, potentially execute several task simultaneously? If you decide to answer this question, could you pleas use a really simple terminology because otherwise, I am afraid, I will not be able to understand the answer.

    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

  • CSS styles gone after Ajax call in IE 7

    - by roman m
    I've had a problem with my styles not being applied after AJAX calls. My styles were not in the < HEAD section of the page, and they were only recognized by IE on initial Page_Load. If you know of any other ways to fix this problem, post them here. This is more of a reference, hope this helps some people.

    Read the article

  • Guice child injector override binding

    - by Roman
    Hi All I am trying to to override a binding in a child injector that was already configured in a base injector. like that : public class PersistenceModule extends Abstract{ @Override protected void configure() { bind(IProductPersistenceHelper.class).to(ProductPersistenceHelper.class); } } then : Injector injector = Guice.createInjector(new PersistenceModule()); injector.createChildInjector(new AbstractModule(){ @Override protected void configure() { bind(IProductPersistenceHelper.class).to(MockProductPersistenceHelper.class); } }) Guice is complaining that it has already a binding for that. Are there any patterns or best practices for that problem ?

    Read the article

  • How can I add similar functionality to a number of methods in java?

    - by Roman
    I have a lot of methods for logging, like logSomeAction, logAnotherAction etc. Now I want all these methods make a small pause after printing messages (Thread.sleep). If I do it manually, I would do something like this: //before: public static void logSomeAction () { System.out.println (msg(SOME_ACTION)); } //after: public static void logSomeAction () { System.out.println (msg(SOME_ACTION)); try { Thread.sleep (2000); } catch (InterruptedException ignored) { } } I remember that Java has proxy classes and some other magic-making tools. Is there any way avoid copy-n-pasting N sleep-blocks to N logging methods?

    Read the article

  • Mysterious different conversion to string[] of seemingly same input data

    - by Roman Kuzmin
    During investigation of some problem I found that the reason was unexpected different conversion to string[] of seemingly same input data. Namely, in the code below two commands both return the same two items File1.txt and File2.txt. But conversion to string[] gives different results, see the comments. Any ideas why is it? This might be a bug. If anybody also thinks so, I’ll submit it. But it would nice to understand what’s going on and avoid traps like that. # *** WARNING # *** Make sure you do not have anything in C:\TEMP\Test # *** The code creates C:\TEMP\Test with File1.txt, File2.txt # Make C:\TEMP\Test and two test files $null = mkdir C:\TEMP\Test -Force 1 | Set-Content C:\TEMP\Test\File1.txt 1 | Set-Content C:\TEMP\Test\File2.txt # This gets just file names [string[]](Get-ChildItem C:\TEMP\Test) # This gets full file paths [string[]](Get-ChildItem C:\TEMP\Test -Include *) # Output: # File1.txt # File2.txt # C:\TEMP\Test\File1.txt # C:\TEMP\Test\File2.txt

    Read the article

  • How to create a project from existing source in Eclipse and then find it?

    - by Roman
    I have created several .class files. All of them are located in one directory. I used a text editor to write these class files. Now I want to switch to Eclipse. In Eclipse I click File-New-Java Project. Then I select "Create project from existing source". After that I select the directory where all my .class files and click OK. As a result, nothing visible happens. But when I try to do the same, Eclipse tells me that that this project already exist. Where does it exist and how can I access it? By the way, in my "workspace" file nothing new appeared. Is it OK? I though my new Java Project will be there.

    Read the article

  • Get info about svn root repository structure

    - by Roman
    Hello All, I would like to know how to get information about svn root repository structure using svn api. I have for instance following structure: http:/// /project1 /project2 I tried : svn list http:///svn also svn list -v http:///svn As response I got only : ./ How can I get information recursively ? Thank you in advance.

    Read the article

  • How to create two columns on a web page?

    - by Roman
    I want to have two columns on my web page. For me the simples way to do that is to use a table: <table> <tr> <td> Content of the first column. </td> <td> Content of the second column. </td> </tr> </table> I like this solution because, first of all, it works (it gives exactly what I want), it is also really simple and stable (I will always have two columns, no matter how big is my window). It is easy to control the size and position of the table. However, I know that people do not like the table-layout and, as far as I know, they use div and css instead. So, I would like also to try this approach. Can anybody help me with that? I would like to have a simple solution (without tricks) that is easy to remember. It also needs to be stable (so that it will not accidentally happen that one column is under another one or they overlap or something like that).

    Read the article

  • How to check if my string is equal to null?

    - by Roman
    I want to perform some action ONLY IF my string has a meaningful value. So, I tried this. if (!myString.eqauls("")) { doSomething } and this if (!myString.eqauls(null)) { doSomething } and this if ( (!myString.eqauls("")) && (!myString.eqauls(null))) { doSomething } and this if ( (!myString.eqauls("")) && (myString!=null)) { doSomething } and this if ( myString.length()>0) { doSomething } And in all cases my program doSomething in spite on the fact that my string IS EMPTY. It equals to null. So, what is wrong with that?

    Read the article

  • best way to write a-> ..->[a] recursive functions in haskell

    - by Roman A. Taycher
    So I keep having this small problem where I have something like func :: a -> b -> [a] -- or basically any a-> ...-> [a] where ... is any types -> func x y = func' [x] y -- as long as they are used to generate a list of [a] from x func' :: [a] -> b -> [a] func = undefined --situation dependant generates a list from each element and returns it as one long list should I keep it like this? should I use func' hidden by a where? should I only use the [a] - b - [a] version and leave the responsibility of passing [variable] to the callee? I might well need to compose these functions and might want to mess around with the order so I'm leaning towards option 3. What do you think?

    Read the article

  • How to update JLabel in Swing?

    - by Roman
    I am trying to use Swing Timer and I wanted to start from a very simple program. I have a window with text: "You have n seconds", where n changes from 10 to 0 every second. I know how to generate a window with text. And I understand how Timer works (it starts an action periodically). But I cannot figure out how to combing this two things. Should I use that: JLabel label = new JLabel(myMessage); and then with timer I need to update the "myMessage" variable? But I think I need to "force" my window to "update" itself (to display a new value stored in "myMessage").

    Read the article

  • How to draw a filled circle in Java?

    - by Roman
    I have a JPanel with a Grid Layout. In the "cells" of the grid I can put different elements (for example JButtons). There is no problems with that. But now I want to put a filled circle in some of the cells. I also would like to relate an ActionListener with these circles. In more details, if I click the circle it disappears from the current cell and appears in another one. How can I do it in Java? I am using Swing.

    Read the article

  • How to make your more experienced and authoritative teammates not to create 'fast temporary solution

    - by Roman
    I'm currently working on a small short-lived project. But despite the size it's complicated enough with very unclear logic. That's why it was started by more experienced developers. They work on it from time to time because it's not their main project. They made some code drafts with numerous places which 'would be rewritten in the nearest future'. After that they added several another 'temporary pieces'. And then again.. So, now the project is a mess of 'half-working' pieces of code with some hardcoded values, like file names or some constants which 'will be replaced latter with working parts'. The API is awful (nobody thinks about it actually). And it's really, really hard to do development now (for me it's the main and only project). I caught myself thinking that I spent about an hour every day just to understand again all that tricky 'temporary' things and API weaknesses. And after that hour my brain melts. I can't just say that "guys, your code smells like a trash dump". What's the correct way?

    Read the article

  • How do I remove an old JPanel and add a new one?

    - by Roman
    I would like to remove an old JPanel from the Window (JFrame) and add a new one. How should I do it? I tried the following: public static void showGUI() { JFrame frame = new JFrame("Colored Trails"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(partnerSelectionPanel); frame.setSize(600,400); frame.setVisible(true); } private static void updateGUI(final int i, final JLabel label, final JPanel partnerSelectionPanel) { SwingUtilities.invokeLater( new Runnable() { public void run() { label.setText(i + " seconds left."); } partnerSelectionPanel.setVisible(false); \\ <------------ } ); } So, my code update the "old" JPanel and them it makes the whole JPanel invisible. It was the idea. But it does not work. The compiler complains about the line indicated with "<------------". It writes: <identifier> expected, illegal start of type.

    Read the article

  • How can I create a .jar file?

    - by Roman
    In the tutorial I found out that jar files can be created in the following way: jar cf jar-file input-file(s) However, it was not clear what are the input-file(s). Is that .java files or .class files? From the examples on the same page I can assume that should be .class files. But now it is not clear which .class files should I put there. After the compilation of .java files I have a lot of .class files. One of the reason of that is that I have a lot files like that: GameWindow$2$10class, GameWindow$2$7.class and so on. Should I include all of them into the command line for the creation of the .jar file? To run my application I use java Game. So, my be I need to use only Game.class file when I create a .jar file? On the other hand other class files corresponds to classes used by the application. My software use external libraries (during compilation I specify .jar files of these libraries). Will .jar file of my application be able to run on the computer which does not contain the .jar file of used library?

    Read the article

  • Samples of Scala and Java code where Scala code looks simpler/has less lines?

    - by Roman
    I need some code samples (and I also really curious about them) of Scala and Java code which show that Scala code is more simple and concise then code written in Java (of course both samples should solve the same problem). If there is only Scala sample with comment like "this is abstract factory in Scala, in Java it will look much more cumbersome" then this is also acceptable. Thanks!

    Read the article

  • Getting all inner classes by reflection

    - by Roman
    I have the following problem. I have this pretty class and now I want to get all the classes that extend that class (inner classes ) and fill 'classList' with it. ( in an automatic way of course ) public abstract class CompoundReference { private static List<Class<? extends CompoundReference>> classList = new ArrayList<Class<? extends CompoundReference>>(); @CompoundKey(gsType = User.class, dbType = UserDetailsMappings.class) public static class CUser extends CompoundReference { } @CompoundKey(gsType = Catalog.class, dbType = CatalogDetailsMappings.class) public static class CCatalog extends CompoundReference { } @CompoundKey(gsType = Product.class, dbType = ProductDetailsMappings.class) public static class CProduct extends CompoundReference { } @CompoundKey(gsType = Category.class) public static class CCategory extends CompoundReference { } @CompoundKey(gsType = Poll.class, dbType = PollDetailsMappings.class) public static class CPoll extends CompoundReference { } // much mroe inner classes Some manual solution would be just to main such a static block , that is something that I dont want to do. static { classList.addAll(Arrays.asList(CUser.class, CCatalog.class, CProduct.class, CCategory.class, CPoll.class, CComment.class, CWebPage.class, CReview.class, CPost.class, CMessage.class, CStory.class,CPicture.class)); }

    Read the article

  • What is the common way to program action listeners?

    - by Roman
    I just started to learn how to use action listeners. To my understanding it works in the following way: There are some classes which contains "addActionListener" method by default (for example classes for buttons). Using this method we add an action listener to an object. For example: listenedObject.addActionListener(listeningObject). When an action with the "listenedObject" is performed, the "actionPerformed" method of the "listeningObject" will be called. So, it means that when we program a class for the listeningObject, we need to put there "actionPerformed" method. What is not clear to me, should we create a new class for every object that we want to listen. It does not seem to me as an elegant solution. On the other hand, if we have one action listener class for all (or at least many) object, than we have a problem since a instance of this class will not know which object is calling the "actionPerformed" method (and we need to know that since actions performed by the actionPerformed differs depending on who is called for this method). In my opinion, for every listened object we need to create are "personal" action listener and we can do it by setting a specific value to the corresponding field of the action listener. But I am not sure that it is a standard way to go? How do usually people do it?

    Read the article

  • Why use of session name and session id in the get variables does not work?

    - by Roman
    I have the following code: $location .= 'red=no&'.session_name() . "=". session_id(); $content = file_get_contents($location); echo $content; If I run it, noting is displayed in my browser. However, if I modify it in the following way: $location .= 'red=no'; $content = file_get_contents($location); echo $content; everything works fine (I see the content in my browser). What is also strange, if I display the value of the $location variable from the first example (url) and manually paste it in the address line of my browser, I do see the content. So, my browser is able to use this URL and file_get_contents not. Does anybody know how it can be explained?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >