Thursday, August 8, 2013

How to dynamically load file properties based on environments: Spring Profiles tutorial

If you are working with different environments which need different property file configurations, maybe the best way is to load a specific profile for each different environment wich load the specific properties for that environment. There are different ways to create profiles in Java, but in this post I will just talk about the way I used.
My applications normally uses Spring framework and Maven for the build/deploy process. In Maven 3 is possible to create profiles but I find it not very usefull because if you want to create application properties dynamically then you need to use ant plugins, so I found another way: using Spring Profiles (avaliable from Spring 3.1).

How to enable USB debugging mode on Nexus 4/Nexus 7

Starting in Android 4.2 Jelly Bean, Google has hidden the ability to enable USB debugging mode.
To see the option for USB debugging mode in Android 4.2 or higher, do the following:
  • Open up your device’s “Settings”. This can be done by pressing the Menu button while on your home screen and tapping “System settings” 
  • Press “About phone/About tablet”. At the “About” screen, scroll to the bottom and press on “Build number” seven times. Make sure you tap seven times. You will see a message thats says “You are now a developer!”.
  • Now you have unlocked USB debugging mode. You can now enable/disable it whenever you desire by going to “Settings” -> “Developer Options” -> “Debugging” ->” USB debugging”. 
The best part is you only have to do the tap-build-number-seven-times once. After you do it once, USB debugging has been unlocked and you can enable or disable at your leisure.