I am very new to StackOverflow and I’ve done my best to fix this problem before posting this question here. I’m faced with the problem of getResource() returning null. I have a hunch that this is because I’m on a mac and the pathing is different here than on a PC (where this code seems to wo…
How to solve warning when using liferay-ui:search-container in JSP?
I’m developing a portlet in Liferay 6.1 using Liferay MVC famework. When I use Eclipse allways shows me the following warning message SearchContainer is a raw type. References to generic type SearhcContainer<R> should be parameterized JSP code fragment: I have searched many examples. I’ve im…
how to log only one level with log4j2?
I’m using log4j2 in my application. What I want is everything up to ‘debug’ to go to console, everything up to ‘info’ to go to myapp.log, and ONLY ‘info’ to go to ‘myapp-audit.log’. The reason is, INFO mostly consists of successful modifications to data (e…
Creating threads without extends and implements
I was going through an old project (Java) in my company where I found the author (already left), creates and runs thread without extending the Thread class or implementing the Runnable interface. One noticable thing was that the class was a singleton class. There are no usage of thread pooling, or the new con…
onNewIntent in Fragments in android
I am trying to develop a NFC application. I need to recognize the NFC TAG from the OnNewIntent that in the Activity class. Now I need to move and use fragments and not activity. Is their a way to replace the onNewIntent in the fragment class? Answer According to here (https://stackoverflow.com/a/5320694/37369…
Android RecyclerView addition & removal of items
I have a RecyclerView with an TextView text box and a cross button ImageView. I have a button outside of the recyclerview that makes the cross button ImageView visible / gone. I’m looking to remove an item from the recylerview, when that items cross button ImageView is pressed. My adapter: My layout is:…
SSL Java java.io.IOException: Invalid keystore format
I am testing SSL in java with SSLServerSocket and other classes in the java.ssl package. When I run the following code, I get the exception java.io.IOException: Invalid keystore format. My code: File key.txt: 1268312345812304612348712634283427346 I am guessing I should put something else in the key.txt file, …
Swing application menu name not displaying correctly in Java 1.8
Okay, so I’ve done Swing applications before, and I know if you want to display a different name for the application menu (the one on Macs that usually have a “Preferences” and “Quit” option), you have to use: System.setProperty(“com.apple.mrj.application.apple.menu.about.n…
Spring Boot with container security
I’ve been using spring boot for some projects lately and I really like it. For a new project, we’d like to use tomcat-users.xml for really basic authentication, but I can’t figure out how to use the mechanism without a web.xml file. Most people using spring boot seem to be using spring secur…
Calculate the date of Easter Sunday
Write a program to compute the date of Easter Sunday. Easter Sunday is the first Sunday after the first full moon of spring. Use the algorithm invented by the mathematician Carl Friedrich Gauss in 1800: Let y be the year (such as 1800 or 2001) Divide y by 19 and call the remainder a. Ignore the quotient. Divi…