Posts

Showing posts with the label java

Eclipse Photon - SVN / Maven not handled as Java-Project

Eclipse Photon - SVN / Maven not handled as Java-Project I moved forward to Eclipse 4.8. My Projects Maven projects under subversion is not displayed as Java Project and the pom.xml is displayed in XML-Editor instead of the well-meant pom-editor. pom.xml Steps I done: The Project's icon is showing the M-Icon-Overlay let me think it is a maven project. The Project's icon does not contain the J-Icon-Overlay what let me think he does not treat it as a Java project. Any ideas? Try to delete the file without deleting its content, delete the .project file and reopen it via File > Open Projects from File System... . – howlger Jun 30 at 10:54 .project 1 Answer 1 Doesnt work at the moment. I created a workspace in an older version and opend the works...

Compare the List of different Objects and build the new list of Object in java8 using Stream

Compare the List of different Objects and build the new list of Object in java8 using Stream Could someone help me converting the below code to java 8 standards using streams. Iterate CustomerRelationship list and customer list,compare customerRelationShip firstName with customer firstName. if it matches then construct the BusinessCustomer object using customerRelationShip and customer object and add it to businessCustomerList. if no matches then construct BusinessCustomer using customerRelationShip and add it to businessCustomerList. List<BusinessCustomer> businessCustomers = new ArrayList<BusinessCustomer>(); List<CustomerRelationship> customerRelationshipList = new ArrayList<CustomerRelationship>(); List<Customer> customerList = new ArrayList<Customer>(); for (CustomerRelationship customerRelationship: customerRelationshipList) { int temp = 0; for (Customer customer:customerList){ if(customer...

What is the reason behind “non-static method cannot be referenced from a static context”? [duplicate]

What is the reason behind “non-static method cannot be referenced from a static context”? [duplicate] This question already has an answer here: The very common beginner mistake is when you try to use a class property "statically" without making an instance of that class. It leaves you with the mentioned error message: You can either make the non static method static or make an instance of that class to use its properties. Why? I am not asking for solutions. I would be grateful to know what is the reason behind it. The very core reason! private java.util.List<String> someMethod(){ /* Some Code */ return someList; } public static void main(String strArgs){ // The following statement causes the error. You know why.. java.util.List<String> someList = someMethod(); } This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. ...

Nested setOnClickListener in Java / Android

Nested setOnClickListener in Java / Android I am trying to setup a onclicklistner on a dialog button. If the listener is set using bnxt.setOnClickListener(new x()); the app works as expected but if the below given 2nd implementation is used, the app crashes. Any hint or help is highly appreciated. bnxt.setOnClickListener(new OnClickListener() { ... Supplied code: class x implements OnClickListener { x() { } public void onClick(View v) { if (listener != null) { final Dialog dialog = new Dialog(getActivity()); FancyButton m_no = (FancyButton) dialog.findViewById(R.id.b_no); m_no.setOnClickListener(new OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } } } public View onCView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_x, container, fa...

How do I hide the navigation bar in the editor for android studio?

How do I hide the navigation bar in the editor for android studio? How do I make the bottom navigation bar disappear in the visual XML editor in Android Studio? I added a screenshot of the navigation bar which I want to remove. I have looked at both of these and they were no help to me. How to hide navigation bar permanently in android activity? How to emulate immersive mode in layout editor Here is the screenshot of the Navigation bar: https://imgur.com/gallery/GlmDsIs Here is my XML Code for activity_main: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#474747" tools:context=".Main...

How does java stores type indication? [on hold]

How does java stores type indication? [on hold] While reading the book Java Generics and Collections (O'Reilly), my attention got cached by below paragraph Another consequence of implementing generics by erasure is that array types differ in key ways from parameterized types. Executing new String[size] allocates an array, and stores in that array an indication that its components are of type String. In contrast, executing: new ArrayList() allocates a list, but does not store in the list any indication of the type of its elements. In the jargon, we say that Java reifies array component types but does not reify list element types (or other generic types). Can anyone brief how java maintains the scenario in italic text? Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rul...

Jenkins run up an Amazon EC2 Linux Ubuntu instance failing

Jenkins run up an Amazon EC2 Linux Ubuntu instance failing I have configured and tried to run Jenkins System Configuration from AWS windows system: It is failed and thrown the fallowing error. I insalled manually Java 1.7 Jun 29, 2018 6:22:29 PM null FINEST: Node RocketChat-Server (i-034fb93609641e1b1)(i-034fb93609641e1b1) is still pending/launching, waiting 5s Jun 29, 2018 6:22:35 PM null FINEST: Node RocketChat-Server (i-034fb93609641e1b1)(i-034fb93609641e1b1) is still pending/launching, waiting 5s Jun 29, 2018 6:22:40 PM null FINEST: Node RocketChat-Server (i-034fb93609641e1b1)(i-034fb93609641e1b1) is still pending/launching, waiting 5s Jun 29, 2018 6:22:45 PM null FINEST: Node RocketChat-Server (i-034fb93609641e1b1)(i-034fb93609641e1b1) is still pending/launching, waiting 5s Jun 29, 2018 6:22:50 PM null FINER: Node RocketChat-Server (i-034fb93609641e1b1)(i-034fb93609641e1b1) is ready Jun 29, 2018 6:22:50 PM null INFO: Launching instance: i-034fb93609641e1b1 Jun 29, 2018 6:22:50 PM ...

Rounded corner mapbox mapView

Image
Rounded corner mapbox mapView So I'm trying to add a small mini map to my android app with a mapbox mapView. I'm trying to add rounded corners to it and I can't seem to find a way to do that. Is there a good way to do this? I know one option is to use a CardView but it doesn't seem to round the corners of the map. use any library for that. – Harshit Agrawal Jun 21 at 16:30 yes, you can do this. Follow this answer. It will help you to do that. – Sayem Jun 21 at 16:45 I don't entirely understand that method. I tried to do what the answer said but the mapbox mapview doesn't resize. Is this maybe an issue with mapbox? ...

JBWEB000236: Servlet.service(), maven, jboss, rest

JBWEB000236: Servlet.service(), maven, jboss, rest I try to recover data from a table but when I try to access the method where it gets the data from the database it gives me an error. Executing http://localhost:8080/cart/service/sepsRest/obtenerCatalogo; in the line http://localhost:8080/cart/service/sepsRest/obtenerCatalogo; listaCatalogo = catalogoServicio.obtenerPorGrupoNemonico("TIPOID"); It gives me the following error. 15:48:15,370 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/cart].[javax.ws.rs.core.Application]] (http-/0.0.0.0:8080-6) JBWEB000236: Servlet.service() for servlet javax.ws.rs.core.Application threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:364) [resteasy-jaxrs-2.3.10.Final-redhat-1.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.ja...

How to decrease count getting from user input in java and my sql

How to decrease count getting from user input in java and my sql public void bookRooms(){ try{ System.out.println("Enter rooms to book "); int roomCount = scan.nextInt(); String queryTwo = "select mansion_names,rent,single_rooms-1,double_rooms from mansions where mansion_names =? "; // above query i am not able to pass user input roomCount from console instead number is working PreparedStatement ps2 = con.prepareStatement(queryTwo); ps2.setString(1, mName); ResultSet rs2 = ps2.executeQuery(); while(rs2.next()){ System.out.println(" "+rs2.getString(1)+" "+rs2.getInt(2)+" "+rs2.getInt(3)+" "+rs2.getInt(4));//+" "+rs.getInt(4)+" "+rs.getString(5)+" "+rs.getInt(6)+" "+rs.getInt(7)); } con.close(); }catch(Exception e){ System.out.println("error"); }; } in the above queryTwo i am not ...

Programmatically changing Hystrix properties

Programmatically changing Hystrix properties I have a circuit breaker set up that I would like to change parameters for runtime. Things like threads and timeout needs to be tuned at customer site. I create a HystrixCommandProperties.Setter like this: HystrixCommandProperties.Setter hystrixProps = HystrixCommandProperties.defaultSetter() .withCircuitBreakerSleepWindowInMilliseconds(myconf.sleepWindow); HystrixThreadPoolProperties.Setter threadPoolSettings = HystrixThreadPoolProperties.Setter() .withCoreSize(myconf.threadPoolSize); new MyCommand(HystrixCommand.Setter.withGroupKey("mygroup") .andCommandPropertiesDefaults(hystrixProps) .andThreadPoolPropertiesDefaults(threadPoolSettings)); MyCommand implements standard HystrixCommand and calls super(hystrixProps). This works the first time, but when I try to change the properties at runtime (same group name) nothing happens. Is there another way to programmatically change this? I don't want to ...

clean code but app won't work

clean code but app won't work http://localhost:63342/-dnmx7eyt5qt81ikj125hc4xxyfyaia04pcuum/thejustjava/app/src/main/res/layout/activity_main.xml I used the following java and xml code to create justjava app (LINKS: https://gist.github.com/udacityandroid/273e1273286e5169c87d) and (https://gist.github.com/udacityandroid/609dbb5370ba0665955a) but when i try to start the app, this message appears: XML document structures must start and end within the same entity. Any assistance with this issue? show YOUR code from YOUR project. you are missing a end tag somewhere in your layout. (or other xml doc) – DroiDev Jun 29 at 19:02 Check all your xml files. try commenting out files one by one. You can narrow it down this way. Then examine carefully starting and closing of tags – Suhaib Roomy ...

IllegalStateException in MediaPlayer#Pause

IllegalStateException in MediaPlayer#Pause I uploaded my app at google console and in prelaunch report , in 2 devices only, there was this issue java.lang.IllegalStateException FATAL EXCEPTION: ControllerMessenger Process: com.wolframite.manos.crack_the_code, PID: 11744 java.lang.IllegalStateException at android.media.MediaPlayer.isPlaying(Native Method) at com.wolframite.manos.crack_the_code.Music$1.onReceive(Music.java:36) at android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:311) at android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:47) at android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:120) at android.os.Handler.dispatchMessage(Handler.java:102) at android.support.test.espresso.base.Interrogator.a(Interrogator.java:19) at android.support.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:142) at android.support.test.espresso.base.UiControllerIm...