Skip to content
Advertisement

how to properly check if a string is in txt file

I’m writing a program that manages a library. This part of the program is where you borrow a book, but only if it’s in the library, so I check if the book is in the library but it always comes back negative even if the string is in the library txt file. What should I do? Answer You are just

How to configure proguard to keep all classes in packages that contain a specific word in package name?

I am trying to keep all classes in packages that contain the word model in the package name. Eg – com.xyz.model, com.xyz.abc.model, com.xyz.model.abc All the classes in these packages should not be obfuscated. I tried using wildcard for package names but it isn’t working How to achieve the desired result? Answer Please try below. Remove dot(.) before the model.

Return maximum element

I wrote this program which can count the number of pizzas ordered. I can’t find how to return the maximum element of my list (the pizza with maximum orders). I tried this but it doesn’t work return …

map yaml config to a java hashmap

I have below in my yaml I am map it in my spring bean as follow, I get below error, Cannot convert value of type [java.lang.String] to required type [java.util.Map]: no matching editors or conversion strategy found How can I map a configuration map representation to a java hashmap? Answer In yaml try to format it in this way: Or

cannot insert list of maps to Apache Cassandra

This is my schema insert query generated by java is in this form issue is with ‘=’ sign in the map objects in the list of maps. How can I insert it correctly? in java. Answer map value should be specified as {key1:val1, key2:val2} (see docs), in your case it should be a but really, you shouldn’t generate literal query

SAP DBTech JDBC: Cannot connect to jdbc:sap://… on SCP

I’m running a Java application in the SAP Cloud Platform that connects to a shared HANA database using JDBC. Out of a sudden (no code changes, no deployments, no config changes…) the application can no longer connect to the database. The logs/stacktrace says: Failed to get connection from datasource com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: Cannot connect to jdbc:sap://xxxx.od.sap.biz:30015/ [Cannot connect to

@ResponseBody returns empty object

When I use below to get the user object it works just fine. Above gives me a response back as: Now, I am trying to search based on UUID(4) using this: This doesn’t return anything. No error, no warning whatsoever. While this gives me all the details I need: This is what I have in my Repository and Entity Question:

Advertisement