java

  1. I

    Cannot return array to main method

    Im trying to return intArray from the wordCheck method and the error cannot find symbol - variable intArray is appearing in lines 10,11, and 12 when I try to print the values from the array. I was wondering if I am declaring the method wrong or not using a proper return, or am possibly making my...
  2. B

    Finish application after 15 minutes in background

    How to finish application after 15 minutes, when user minimized? When user exit from the application without finish it, then user turn back after some time network of application is not working. For work need to restart the application. I want to trigger when the app becomes at the background...
  3. R

    Java TimerTask example

    I need to execute a thread at a regular interval of time. I am using timerTask method in my java program public class StudentDTO extends TimerTask{ @Override public void run(){ System.out.println("hi"); } public static void main(String[] args){ StudentDTO t1=new StudentDTO()...
  4. S

    Regex to find String with square bracket and replace

    My current Code is ` String text= "[School_Teacher_Name] is our new member, So please congratulate [School_Teacher_Name] ."; String tag = "[School_Teacher_Name]"; String value= "Yash Mathur"; String str1 = tag.substring(1, tag.length()-1); String reg = "/\\["+str1+"\\]/"...
  5. D

    Are JDBC select queries through a single connection less efficient that a proc containing those queries?

    If I open a single JDBC connection (for Oracle), and execute multiple select queries, will it be less efficient than calling a procedure that executes those queries, and returns the result in cursors? Edit: Sample queries are: select id, name from animals; select * from animal_reservoir where...
  6. R

    Random generated array does not print small value correctly

    My code is not working because it is always printing small value as 0. Thanks in advance for your help. public class Tests { public static void main(String [] args){ int [] num=new int[10]; Random random= new Random(); //1st time both big and small value will be at...
  7. T

    Java regex behaving wierd

    I have the below test case, @Test public void test_check_pattern_match_caseInSensitive_for_pre_sampling_filename() { // given String pattern = "Sample*.*Selection*.*Preliminary"; // when // then...
  8. M

    How to deselect the select all checkbox when i am deselecting even 1 checkbox in android

    I want functionality in my project where on a click of select all checkbox all the checkbox in the list must get selected and on deselect of checkbox all the other checkbox must get deselected. I have achieved this functionality by doing this: /*in my main activity i have done this*/...
  9. J

    How to modify/split invidual string in an array

    How to create a method send in an array of names in “firstName lastName” form(ex:Anna Hale). The method returns the name(through a return statement) in the form “first---last”. Below is my full name array public static void readData(String file) throws FileNotFoundException { x = new...
  10. G

    Update a user entity field in JPQL with IN clause

    I have a class user where I need to update the loginCount and lastLogin. Some users have already logged in and updated data, so I want to update there loginCount to 1. I tried to use JPQL. I created a query, where I am sending loginCount variable = 1, lastLogin as currentDate and idsas a...
  11. K

    How to get computer's WAN IP address in Java?

    How do i get the Wide Area Network of my computer with Java? I try with this: ServerSocket ss = new ServerSocket(port); System.out.println(ss.getInetAddress().getHostAddress()); //wich return 0.0.0.0 then i try with this: System.out.println(InetAddress.getLocalHost().toString()); //which...
  12. E

    How to know if WAN IP has changed and receive massive IP address broadcasts

    The system I am developing potentially has a very large number of clients (lets say one million) that need to periodically update a central server with some information. Clients are written in Java. The specific use-case is that the server backend needs to have an up to date mapping of IP...
  13. V

    Constant data feed from a log file to wan

    I am looking for an efficient way to feed a log file via the network (a demon of sorts). Each packet being a number of lines from the log file so that they can be processed from the other end. It is important for the server to be independent from the client meaning that it should be able to...
  14. H

    Values Cannot be Converted to JSON Array

    This is the function that's giving me the problem: public String URLToJson() { String result = ""; String jsonString = ReadingURL(" here goes my URL that reads a JSON "); JSONObject jsonResult = null; try { jsonResult = new JSONObject(jsonString); JSONArray...
  15. D

    Why my recycler view adapter clearing during search for items?

    I want to create searching for items from recycler view. I have MainActivity where I have the main recycler view and I have SearchActivity where I have the seconds recycler view for appearing of searching items. When user inputs a letter in the input I ask my SQLite for the same query as my...
  16. B

    Updating a List Size for all users

    I am trying to make it so that when a user creates an open game, in my Firebase Database the name of the game is the size of the list. So the very first game created the name of it will = 0, and if another user creates a game then the game will be labeled 1 and so on. I have it set up right now...
  17. K

    Can you guide me to check if any other android application installed then push Notification “Example” app installed

    Any insight to solve this problem will be very helpful... Thank You in advance
  18. L

    How can I convert this to Java, perhaps using Maps

    I picked up a JS code for my assignment and I'm having problems achieving this in Java. My aim is to create predefined values of cities. * Removed JS code * How can I convert this to Java, perhaps using Maps, I have an idea. i just don't know how to put this together perfectly. Map<String...
  19. R

    How to format Array value from Javascript to Java Servlet using Ajax

    I am in need of your help. I have this array being passed from Javascript to Java Servlet using AJAX. Javascript and AJAX snippet code: var BuildingNo = []; $(xml).find('BUILDING').each(function(){ BuildingNo.push($.trim(this).children('BuildingNo').text()); } The value of BuildingNo...
  20. R

    Increase integer values within a integer array

    I have question regarding increase the values within a one dimensional integer array. For example an array like [0,0,0,0] and I want to increase the farthest right position in the array by one so [0,0,0,1]. I want to keep increase this value to a set limit for example [0,0,0,3] and once it...
Top