The file {module:secure}/app/controllers/Check.java could not be compiled. Error raised is : The type Check is already defined
Posted by blogmeister on
August 2, 2013
So you recently started with the Play Framework and ran a project but you encountered this error message:
|
1 2 |
Compilation error The file {module:secure}/app/controllers/Check.java could not be compiled. Error raised is : The type Check is already defined |
|
1 2 3 4 5 6 7 8 |
import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface Check { String[] value(); } This exception has been logged with id 6f24fo6ff |
I am not sure how this is important since I am still new to the Play Framework but since my purpose was just to run a web application project, I was able to bypass this problem by removing or commenting this line
module.secure=${play.path}/modules/secure
in the applicaiton.conf in the conf folder of the project.
Found this useful? Donations appreciated to help keep this blog alive.tags: app, check, check.java, controllers, defined, module:secure, type
No Comments
Check If There Is Internet Connection In Android
Posted by blogmeister on
June 17, 2011
You may have easily found this same code (below) in forums scattered across the Internet but when you used it, you wondered why even though you disabled your WIFI Internet connection, the method still returns true. You find out that the NetworkInfo of type mobile returns true even if your connectivity is offline.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
public static boolean hasInternet(Activity a) { boolean hasConnectedWifi = false; boolean hasConnectedMobile = false; ConnectivityManager cm = (ConnectivityManager) a.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo[] netInfo = cm.getAllNetworkInfo(); for (NetworkInfo ni : netInfo) { if (ni.getTypeName().equalsIgnoreCase("wifi")) if (ni.isConnected()) hasConnectedWifi = true; if (ni.getTypeName().equalsIgnoreCase("mobile")) if (ni.isConnected()) hasConnectedMobile = true; } return hasConnectedWifi || hasConnectedMobile; } |
This is a common misconception among developers when using this method in their app and running it in the Android emulator. If it is a normal smartphone, then this will work correctly. But when it comes to the emulator, even I was baffled why it kept returning true.
It seems that by default, the emulator has connectivity on by default. Just press the F8 key to switch between on and off and the method should work the way you want it to.
Found this useful? Donations appreciated to help keep this blog alive.tags: android, check, internet, networkinfo
No Comments
Check If Date Is Valid Using Java
Posted by blogmeister on
May 17, 2009
Here is a simple method to check if a Date is valid or not. It requires the month, day and year as int parameters and the method uses a Calendar object to determine it. Remember that months in the Calendar class start with 0 (January) and so on.
|
1 2 3 4 5 6 7 8 9 10 11 12 |
public static boolean isDate(int m, int d, int y) { m -= 1; Calendar c = Calendar.getInstance(); c.setLenient(false); try { c.set(y, m, d); Date dt = c.getTime(); } catch(IllegalArgumentException e) { return false; } return true; } |









