For Java Enums, the values are normally auto-assigned starting from 0.
To assign specific value, see the example here: http://stackoverflow.com/questions/8811815/is-it-possible-to-assign-numeric-value-to-an-enum-in-java
My online tech scrapbook where I keep my notes in case I need to look them up later
Monday, February 16, 2015
Git: Reverting Back Multiple Commits
Let's say you want to roll back the Git repository back to a specific commit e.g. by getting rid of the last 8 commits. This is how it's done:
git revert HEAD~8..HEAD
|
Friday, February 13, 2015
Android Capturing "Done" Button Event
The recommended way to do this is by setting a "onEditorActionListener"
References:
References:
Android Intercepting Back Button When Keyboard Open
In Android, when the keyboard is open, the back button closes the keyboard and then the key event is swallowed. To capture this key event, override the "onKeyPreIme" method in the EditText class.
Reference:
Reference:
Wednesday, February 11, 2015
Wordpress Pagination Multiple Loops
Wordpress pagination can be tricky when you have multiple loops. The trick is obtaining the "paged" variable "get_query_var('paged')" before the first loop starts.
Thursday, February 5, 2015
Cocos2D-X: Disable Keyboard Autocomplete for Android
As at Cocos2D-X 3.2, it is not possible to disable autocomplete in the keyboard and this can prove to be a critical issue e.g. when user is keying in password.
A simple solution (which will disable autocomplete throughout the app) is to edit the "org.cocos2dx.lib.Cocos2dxActivity" file in the Cocos2D-X Android Java library. In the "init()" method, add the following line:
According to this article, some devices may require different flags: http://stackoverflow.com/questions/6281514/android-programmatically-disable-autocomplete-autosuggest-for-edittext-in-emulat
A simple solution (which will disable autocomplete throughout the app) is to edit the "org.cocos2dx.lib.Cocos2dxActivity" file in the Cocos2D-X Android Java library. In the "init()" method, add the following line:
edittext.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | TYPE_TEXT_VARIATION_PASSWORD);
|
According to this article, some devices may require different flags: http://stackoverflow.com/questions/6281514/android-programmatically-disable-autocomplete-autosuggest-for-edittext-in-emulat
Tuesday, February 3, 2015
Common Causes of Wordpress "White Screen of Death"
Links:
- http://codex.wordpress.org/Common_WordPress_Errors
- http://www.wpbeginner.com/wp-tutorials/how-to-fix-the-wordpress-white-screen-of-death/
To find out the error, enable debug, and the error will be shown in the white screen.
http://codex.wordpress.org/Editing_wp-config.php#Debug
A possible cause is memory, and to give WP more memory: http://www.wpbeginner.com/wp-tutorials/fix-wordpress-memory-exhausted-error-increase-php-memory/
A possible cause is memory, and to give WP more memory: http://www.wpbeginner.com/wp-tutorials/fix-wordpress-memory-exhausted-error-increase-php-memory/
APC Performance
APC: Alternate PHP Cache
Here is a study about potential performance gains: http://www.webperformance.com/library/reports/SugarAPC/
Conclusion in this test was that it gave 180% performance improvement meaning 2.8 times original performance.
Here is a study about potential performance gains: http://www.webperformance.com/library/reports/SugarAPC/
Conclusion in this test was that it gave 180% performance improvement meaning 2.8 times original performance.
TypeError: $ is not a function when calling jQuery function
I got this error with one of the plugins in Wordpress. The solution was to edit the JS source file of the WP plugin, and replacing references of "$" with "jQuery".
More info:
More info:
Subscribe to:
Posts (Atom)