http://www.draconianoverlord.com/2010/11/23/gwt-handlers.html
Tuesday, October 6, 2015
Saturday, October 3, 2015
ANDROID - how to enable your mobile phone for Android Studio on Windows
Case:
You want to run/debug Android app on your phone (e.g. Samsung Galaxy S2) instead of emulator (which sucks), but Android Studio (Windows version of it) can not see it among available devices.
Solution:
FIRST OF ALL The last thing you will think it is important, but it is indeed: install on Windows USB drivers for you phone model!!!
For instance:
Samsung Galaxy S2: http://www.samsung.com/us/support/owners/product/SGH-I777ZKAATT
LG L9: http://www.lg.com/us/support-mobile/lg-LGP769BK
Then enable some phone settings:
Developer options / USB debugging
Security / Unknown sources (Allow installation of apps from sources other than Play Store)
You want to run/debug Android app on your phone (e.g. Samsung Galaxy S2) instead of emulator (which sucks), but Android Studio (Windows version of it) can not see it among available devices.
Solution:
FIRST OF ALL The last thing you will think it is important, but it is indeed: install on Windows USB drivers for you phone model!!!
For instance:
Samsung Galaxy S2: http://www.samsung.com/us/support/owners/product/SGH-I777ZKAATT
LG L9: http://www.lg.com/us/support-mobile/lg-LGP769BK
Then enable some phone settings:
Developer options / USB debugging
Security / Unknown sources (Allow installation of apps from sources other than Play Store)
Friday, October 2, 2015
Thursday, October 1, 2015
JAVA - when WeakReference and SoftReference are equaly garbage collected
WeakReference - is ALWAYS eagerly garbage collected.
SoftReference - is LESS eagerly garbage collected on Server JVM.
The Sun JRE does treat SoftReferences differently from WeakReferences. We attempt to hold on to object referenced by a SoftReference if there isn't pressure on the available memory. One detail: the policy for the "-client" and "-server" JRE's are different: the -client JRE tries to keep your footprint small by preferring to clear SoftReferences rather than expand the heap, whereas the -server JRE tries to keep your performance high by preferring to expand the heap (if possible) rather than clear SoftReferences. One size does not fit all.
More here...
SoftReference - is LESS eagerly garbage collected on Server JVM.
The Sun JRE does treat SoftReferences differently from WeakReferences. We attempt to hold on to object referenced by a SoftReference if there isn't pressure on the available memory. One detail: the policy for the "-client" and "-server" JRE's are different: the -client JRE tries to keep your footprint small by preferring to clear SoftReferences rather than expand the heap, whereas the -server JRE tries to keep your performance high by preferring to expand the heap (if possible) rather than clear SoftReferences. One size does not fit all.
More here...
JAVA - collections, the main difference between Map and SortedMap contracts
The main difference between Map and SortedMap contracts is its approach to comparing of keys.
Map contract is to compare keys with equals method.
SortedMap contract is to compare keys with provided or class natural compator.
From javadoc of Comparable<T> interface: This ordering is referred to as the class's natural ordering, and the class's compareTo method is referred to as its natural comparison method.
Objects that implement this interface can be used as keys in a sorted map or as elements in a sorted set, without the need to specify a comparator.
Why NULL can not be set as value in Set?
The natural ordering for a class C is said to be consistent with equals if and only if e1.compareTo(e2) == 0 has the same boolean value as e1.equals(e2) for every e1 and e2 of class C. Note that null is not an instance of any class, and e.compareTo(null) should throw a NullPointerException even though e.equals(null) returns false.
Map contract is to compare keys with equals method.
SortedMap contract is to compare keys with provided or class natural compator.
From javadoc of Comparable<T> interface: This ordering is referred to as the class's natural ordering, and the class's compareTo method is referred to as its natural comparison method.
Objects that implement this interface can be used as keys in a sorted map or as elements in a sorted set, without the need to specify a comparator.
Why NULL can not be set as value in Set?
The natural ordering for a class C is said to be consistent with equals if and only if e1.compareTo(e2) == 0 has the same boolean value as e1.equals(e2) for every e1 and e2 of class C. Note that null is not an instance of any class, and e.compareTo(null) should throw a NullPointerException even though e.equals(null) returns false.
Wednesday, September 30, 2015
GIT - 'git reset' my explanation
When and how to use git reset.
Case 1:
You have commited changes, but not yet pushed it. (never reset shared (pushed) commits, read this)
AND
You want to undo this commit and continue to work on these changes in it.
git reset --soft HEAD~1
Case 2:
You have commited changes, but not yet pushed it. (never reset shared (pushed) commits, read this)
AND
You want to undo this commit and DO NOT WANT to continue to work on these changes in it.
git reset --hard HEAD~1
In this case all changes of this commit will be lost and you will not see it in your Local Changes list (e.g. in InteleJIdea IDE)
HEAD~1 means 'one commit from HEAD'
Case 1:
You have commited changes, but not yet pushed it. (never reset shared (pushed) commits, read this)
AND
You want to undo this commit and continue to work on these changes in it.
git reset --soft HEAD~1
Case 2:
You have commited changes, but not yet pushed it. (never reset shared (pushed) commits, read this)
AND
You want to undo this commit and DO NOT WANT to continue to work on these changes in it.
git reset --hard HEAD~1
In this case all changes of this commit will be lost and you will not see it in your Local Changes list (e.g. in InteleJIdea IDE)
HEAD~1 means 'one commit from HEAD'
Tuesday, September 29, 2015
Subscribe to:
Posts (Atom)