Thursday, October 29, 2015
Sunday, October 25, 2015
Friday, October 23, 2015
SPRING - stereotypes example
import org.springframework.beans.factory.annotation.Autowired;import org.springframework.beans.factory.annotation.Value;import org.springframework.stereotype.Service; import java.util.*; @Service("myConfigServiceFacade")public class MyConfigServiceFacadeImpl implements MyConfigServiceFacade { @Value("${com.foo.isWebSSOEnabled}") private String webSSOEnabled; @Value("${com.foo.webSSOlogoutURL}") private String webSSOInternetLogoutURL; @Value("${com.foo.webSSOlogoutURL}") private String webSSOIntranetLogoutURL; @Value("${com.foo.brandbarURL}" ) private String brandbarURL; @Value("${com.foo.4eye.active}") private boolean is4eyeActive; @Autowired private MyPrincipalService principalService;
====================================================
import com.google.gwt.user.client.rpc.RemoteService;import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;import java.util.Map;import java.util.Set;
@RemoteServiceRelativePath("services/myConfigServiceFacade.rpc")
public interface MyConfigServiceFacade extends RemoteService {
ApplicationInfo getApplicationInfo();
SessionInfo config() throws Exception;
Map<Long, Set<String>> configAllowedAccounts(Long var1, Long var2) throws Exception;}
Thursday, October 22, 2015
Wednesday, October 21, 2015
ANDROID - align linearlayout each one behind other programmatically
http://stackoverflow.com/questions/12108370/how-to-setcontentview-in-a-fragment
The method setContent(relativeLayout) on Activity in case of Fragments need to be replaced with return this relatiVeLayout from onCreateView or do from onViewCreated this:
The method setContent(relativeLayout) on Activity in case of Fragments need to be replaced with return this relatiVeLayout from onCreateView or do from onViewCreated this:
RelativeLayout rootContainer = (RelativeLayout)mainActivity.findViewById(R.id.rootContainer);
rootContainer.addView(rl);
Sunday, October 18, 2015
Saturday, October 17, 2015
TOOLS - Colorzilla, nice color picker tool for browser
Colorzilla - http://www.colorzilla.com/
Very nice plugin for browsers Chrome and Firefox. It allows to pick colors and see its numeric value in very handily way.
Very nice plugin for browsers Chrome and Firefox. It allows to pick colors and see its numeric value in very handily way.
Friday, October 16, 2015
ANGULAR - left menu, multiple controllers
https://www.codecademy.com/courses/javascript-advanced-en-2hJ3J/1/1#
index.html
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js"></script>
<script src="app.js"></script>
<script src="user.js"></script>
<script src="menu.js"></script>
<script src="content.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body ng-app="exampleApp">
<header ng-controller="userCtrl">Welcome {{user}}!</header>
<nav ng-controller="menuCtrl">
<h2>Menu</h2>
<ul>
<li ng-repeat="link in links">{{link}}</li>
</ul>
</nav>
<article ng-controller="contentCtrl">
<h1>{{title}}</h1>
<hr />
<p>{{paragraph}}</p>
<small >by {{author}}</small>
</article>
</body>
</html>
app.js
// Defining a module
angular.module('exampleApp', []);
user.js
angular.module('exampleApp')
.controller('userCtrl', function ($scope) {
$scope.user = "Jan Kowalski";
});
menu.js
angular.module('exampleApp')
.controller('menuCtrl', function ($scope) {
$scope.links = ['Link 1', 'Link 2'];
});
content.js
angular.module('exampleApp')
.controller('contentCtrl', function ($scope) {
$scope.title = "Lorem Ipsum";
$scope.paragraph = "Completely myocardinate process-centric "
+ "total linkage whereas installed base e-tailers. "
+ "Proactively extend collaborative intellectual capital "
+ "vis-a-vis unique expertise. Dynamically.";
$scope.author = "Anna Nowak";
});
style.css
body {
width: 500px;
}
nav {
float: left;
width: 30%;
}
article {
margin-left: 30%;
width: 70%;
}
index.html
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js"></script>
<script src="app.js"></script>
<script src="user.js"></script>
<script src="menu.js"></script>
<script src="content.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body ng-app="exampleApp">
<header ng-controller="userCtrl">Welcome {{user}}!</header>
<nav ng-controller="menuCtrl">
<h2>Menu</h2>
<ul>
<li ng-repeat="link in links">{{link}}</li>
</ul>
</nav>
<article ng-controller="contentCtrl">
<h1>{{title}}</h1>
<hr />
<p>{{paragraph}}</p>
<small >by {{author}}</small>
</article>
</body>
</html>
app.js
// Defining a module
angular.module('exampleApp', []);
user.js
angular.module('exampleApp')
.controller('userCtrl', function ($scope) {
$scope.user = "Jan Kowalski";
});
menu.js
angular.module('exampleApp')
.controller('menuCtrl', function ($scope) {
$scope.links = ['Link 1', 'Link 2'];
});
content.js
angular.module('exampleApp')
.controller('contentCtrl', function ($scope) {
$scope.title = "Lorem Ipsum";
$scope.paragraph = "Completely myocardinate process-centric "
+ "total linkage whereas installed base e-tailers. "
+ "Proactively extend collaborative intellectual capital "
+ "vis-a-vis unique expertise. Dynamically.";
$scope.author = "Anna Nowak";
});
style.css
body {
width: 500px;
}
nav {
float: left;
width: 30%;
}
article {
margin-left: 30%;
width: 70%;
}
Thursday, October 15, 2015
ANGULAR - links on different components implementaiotion
Angular Dropdown menu:
https://www.codementor.io/angularjs/tutorial/create-dropdown-control
https://angular-ui.github.io/bootstrap/
https://github.com/jseppi/angular-dropdowns (https://jsfiddle.net/jseppi/cTzun/142/embedded/result/)
Angular Left menu:
http://stackoverflow.com/questions/18599753/vertical-navbar-using-bootstrap-and-angular (http://plnkr.co/edit/UBBq7V8mdyqllBHdwegY?p=preview)
Angular Subheader
http://codepen.io/svswaminathan/pen/MYBrgM
https://www.codementor.io/angularjs/tutorial/create-dropdown-control
https://angular-ui.github.io/bootstrap/
https://github.com/jseppi/angular-dropdowns (https://jsfiddle.net/jseppi/cTzun/142/embedded/result/)
Angular Left menu:
http://stackoverflow.com/questions/18599753/vertical-navbar-using-bootstrap-and-angular (http://plnkr.co/edit/UBBq7V8mdyqllBHdwegY?p=preview)
Angular Subheader
http://codepen.io/svswaminathan/pen/MYBrgM
Tuesday, October 13, 2015
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.
Subscribe to:
Posts (Atom)