Search Results

Search found 1178 results on 48 pages for 'roman ivanov'.

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

  • Is it OK to write a constructor which does nothing?

    - by Roman
    To use methods of a class I need to instantiate a class. At the moment the class has not constructor (so I want to write it). But than I have realized that the constructor should do nothing (I do need to specify values of fields). In this context I have a question if it is OK to write constructor which does nothing. For example: public Point() { }

    Read the article

  • How to make cycle over cycles in Java?

    - by Roman
    I would like to make a cycle over the following elements: [1,2,11,12,21,22,111,112,121,122,....,222222] or for example [1,2,3,11,12,13,21,22,23,31,32,33,111,112,113,... 333333333] How can I make it in Java? In my particular case I use 4 digits (1,2,3,4) and the length of the last number can be from 1 to 10. I managed to do it in Python and PHP. In the first case I used list over lists. I started from [[1],[2],] then for every element of the list I added 1 and 2, so I got [[1,1],[1,2],[2,1],[2,2]] and so on: nchips = sum(chips) traj = [[]] last = [[]] while len(last[0]) < nchips: newlast = [] for tr in last: for d in [1,2,3,4]: newlast.append(tr + [d]) last = newlast traj += last When I did it in PHP I used number with base 3. But it was a tricky and non elegant solution. for ($i=-1; $i<=$n; $i+=1) { if ($i>-1) { $n5 = base_convert($i,10,5); $n5_str = strval($n5); $tr = array(); $found = 0; for ($j=0; $j<strlen($n5_str); $j+=1) { $k = $n5_str[$j]; if ($k==0) { $found = 1; break; } array_push($tr,$k); } if ($found==1) continue; } else { $tr = array(); } } Can it be done easily in Java?

    Read the article

  • I have a feeling that adding fields marked with @Transient annotation to entity is very bug-prone. A

    - by Roman
    I have some philosophical feeling that adding to an entity fields which doesn't mapped to the DB is a wrong way of solving problems. But are there any concrete situations where using @Transient fields leads to implicit and hard fixing problems? For example, is it possible that adding/removing 2nd level cache will break our app when there are @Transient fields in our entities?

    Read the article

  • PreparedStatement and setTimestamp in oracle jdbc

    - by Roman
    Hi everyone, I am using PreparedStatement with Timestamp in where clause: PreparedStatement s=c.prepareStatement("select utctimestamp from t where utctimestamp>=? and utctimestamp<?"); s.setTimestamp(1, new Timestamp(1273017600000L)); //2010-05-05 00:00 GMT s.setTimestamp(2, new Timestamp(1273104000000L)); //2010-05-06 00:00 GMT The result I get is different, when I have different time zones on the client computer. Is this a bug in Oracle jdbc? or correct behavior? The parameter is Timestamp, and I expected that no time conversions will be done on the way. The database column type is DATE, but I also checked it with TIMESTAMP column type with the same results. Is there a way to achieve correct result? I cannot change default timezone in the the whole application to UTC. Thanks for your help

    Read the article

  • How to import a package from Eclipse?

    - by Roman
    In one of my directories I have all .java files which belong to one package ("game"). Now I want to create one .java file which does not belong to this package and which imports the "game" package. If I create a new file and write import game; then Eclipse complains that it does not know what the "game" package means. Can somebody please help me to solve this problem?

    Read the article

  • Can fields of the class and arguments of the method interfere?

    - by Roman
    I have a class with a fields called "a". In the class I have a method and in the list of arguments of this method I also have "a". So, which "a" I will see inside of the method? Will it be the field or it will be the argument of the method? public class myClass { private String a; // Method which sets the value of the field "a". public void setA(String a) { a = a; } } By the way, there is a similar situation. A method has some local (for method) variables whose names coincide with the names of the fields. What will the "see" the method if I refer to such a method-local variable inside the method (the field or the local variable)?

    Read the article

  • Does importing of packages change visibility of classes?

    - by Roman
    I jsut learned that A class may be declared with the modifier public, in which case that class is visible to all classes everywhere. If a class has no modifier (the default, also known as package-private), it is visible only within its own package. This is a clear statement. But this information interfere with my understanding of importing of packages (which easily can be wrong). I thought that importing a package I make classes from the imported package visible to the importing class. So, how does it work? Are public classes visible to all classes everywhere under condition that the package containing the public class is imported? Or there is not such a condition? What about the package-private classes? They are invisible no mater if the containing package was imported or not? ADDED: It seems to me that I got 2 answers which are marked as good (up-voted) and which contradict eachother.

    Read the article

  • How to achieve "merge" of two data sets with Insert SQL statemen (Oracle DBMS)t?

    - by Roman Kagan
    Hi: What would be the insert SQL statement to merge data from two tables. For example I have events_source_1 table (columns: event_type_id, event_date) and events_source_2 table (same columns) and events_target table (columns: event_type_id, past_event_date nullalbe, future_event_date nullable). Events_source_1 has past events, Events_source_2 has future events and resultant events_target would contain past and future events in the same row for same event_type_id. If there is no past_events but future_events then past_event_date won't be set and only future_event_date will be and the opposite is true too. Thanks a lot in advance for helping me resolving this problem.

    Read the article

  • Good simple C/C++ FTP and SFTP client library recommendation for embedded Linux

    - by Roman Nikitchenko
    Could anyone recommend FTP / SFTP client C/C++ library for Linux-based embedded system? I know about Curl library but I need something as simple as possible just to download files from FTP / SFTP servers. Is there any recommendation to look for? Yes, SFTP support is critical. Actually I can even sacrifice multi-threading because I need only one stream at a time. And I'd like it to be able to work through memory buffers but this should be not a problem. Thank you in advance.

    Read the article

  • How to force my method to accept objects from external software?

    - by Roman
    I have a method which needs to take a callback object as an argument and then (at the moment when it's needed) my method will call a specific method of the callback object. I wrote a class called Manager which has a method called addListener. As the argument for this method I need to use a callback object which is defined by the external software. So, I define the addListener in the following way: public void addListener(Listener listener). Of course Eclipse complains because it does not know what Listener is (because the Listener is defined by the external software). The only think that I know (should know) about the Listener is that it has a method called doSomething. So, to pleasure Eclipse I add an interface before my Manager class: interface Listener { void doSomething(); } public class CTManager { ... The problem seems to be solved but then I try to test my software. So, I create a class called test. In this class I create an instance of the Manager class and try to use addListener method of this instance. I also create a class Listener, instantiate it and give the instance to the addListener. And it's the place where the problem appears. Eclipse writes that addListener is not applicable to the given argument. I think it's because it expect something from my Listenr interface but gets something from the Listener class. How can I solve this problem?

    Read the article

  • Are there any way to apply regexp in java ignoring letter case?

    - by Roman
    Simple example: we have string "Some sample string Of Text". And I want to filter out all stop words (i.e. "some" and "of") but I don't want to change letter case of other words which should be retained. If letter case was unimportant I would do this: str.toLowerCase().replaceAll ("a|the|of|some|any", ""); Is there an "ignore case" solution with regular expressions in java?

    Read the article

  • Where should I put interface?

    - by Roman
    I program a class in which I have a method which takes an callback object from an external software. At the moment Eclipse says that it does not know the type of the object I gave as argument (it is expectable since I do not specify this type, it's done by the external software). So, I think I need to write an interface for the object which I give as an argument to my method. In this respect I have two questions. Is it really so? Can I solve the mentioned problem in the mentioned way. If it is the case, where should I put this interface? In the same file where my class is? In the class? Outside of the class?

    Read the article

  • Can I run two web servers on the same computer?

    - by Roman
    I just found out that I can write a really simple web server using Python. I have already an Apache web server I would like to try the Python based web server on this machine. But I am afraid that I can get some kind of conflict if I try it. I mean how two web server will "decide" who needs to server a request from a client?

    Read the article

  • How can I specify dependencies in the manifest file and then to include it into my .jar file?

    - by Roman
    I generated .class files by the following command: javac -cp \directoryName\external.jar myPackageDirectory\First.java myPackageDirectory\Second.java I needed to use -cp during compilation and name of .jar file of an "external" library (external.jar) to be able to use this library from my code. Using my .class files I have generated my .jar file in the following way: jar cfm app.jar manifest.txt myPackageDirectory\*.class manifest.txt contains just one line: Main-Class: myPackageName.First My problem is that I am not sure that I will be able to run my .jar file on other computers. I think so because during the compilation I specified the location of the .jar file of the external library. So, my .class files (included into the .jar file will try to find the .jar file of the external library in a specific directory and there is no guaranty that that the .jar file of the external library will be in the same directory as on the my computer. I heard that the above problem can be solved by a usage of a MANIFEST file that I include in my own jar, and which will list dependency locations but I do not understand how it works. I do need to specify location of the "external.jar" at the compilation stage (otherwise the compiler complains).

    Read the article

  • Does Socket open another thread? Does it return something?

    - by Roman
    In the client application I call new Socket(serverIP,serverPort). As a result the client application sends a request to the server application to open a socket. Does it start a new thread? I mean which of the following is true? Client application sends a request and immediately starts to execute following commands (not weighting for the answer). Client sends the request and weights for the answer. As soon as the answer is obtained, the client application continues to execute following commands. The second case seems to be more realistic and logical for me. However, I do not understand what happens if the server does not open a socket and it does not say that it does not "want" to open the second (it can happen if the server does not exist or network is broken). What will happen in this case? Will server weight forever? In general it would be nice for the client to know what is the result of its request for the socket. For example I can imagine the following situations: The socket is opened by the server. The server refuses to open a socket. So, server exists, it got the request from the client but it says "no". There is no response from the server. I know that new Socket(serverIP,serverPort) does not "return" this kind of information. But it throws exceptions. One of them is "UnkownHostException". When it is thrown? When the server is not responding for a while (for how long)? ADDED: I just found out that UnknownHostException is thrown to indicate that the IP address of a host could not be determined. So, it is unrelated with the above described situations (server is not responding, server refuses to open a socket).

    Read the article

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