Tutorial by Examples: c

Defining the list of Ints trait IntList { ... } class Cons(val head: Int, val tail: IntList) extends IntList { ... } class Nil extends IntList { ... } but what if we need to define the list of Boolean, Double etc? Defining generic list trait List[T] { def isEmpty: Boolean def head:...
Loading custom fonts can be lead to a bad performance. I highly recommend to use this little helper which saves/loads your already used fonts into a Hashtable. public class TypefaceUtils { private static final Hashtable<String, Typeface> sTypeFaces = new Hashtable<>(); /** * Get...
AngularJS code for dynamic classes: <p ng-class="{ highlighted: scopeVariableX, 'has-error': scopeVariableY }">Text.</p> KnockoutJS equivalent: <p data-bind="css: { highlighted: scopeObservableX, 'has-error': scopeObservableY }">Text.</p>
build.gradle repositories { maven { url 'http://4thline.org/m2' } } dependencies { // Cling compile 'org.fourthline.cling:cling-support:2.1.0' //Other dependencies required by Cling compile 'org.eclipse.jetty:jetty-server:8.1.18.v20150929' compile 'org.eclipse.jetty:jetty-servlet:8....
Say, you have a dataset consisting of names and email addresses. Now in another dataset, you just have the email address and wish to find the appropriate first name that belongs to that email address. The MATCH function returns the appropriate row the email is at, and the INDEX function selects i...
As an alternative to using Html.ActionLink to generate links in a view, you can use Html.RouteLink To make use of this feature, you need to configure a route, for example: public static void RegisterRoutes(RouteCollection routes) { routes.MapRoute( "SearchResults", "{...
Usually the case when one wants to change a field type to another, for instance the original collection may have "numerical" or "date" fields saved as strings: { "name": "Alice", "salary": "57871", "dob": "198...
After you got the Location object from FusedAPI, you can easily acquire Address information from that object. private Address getCountryInfo(Location location) { Address address = null; Geocoder geocoder = new Geocoder(getActivity(), Locale.getDefault()); String errorMessage; Li...
Puppet provide official documention for both open-source and enterprise versions. you can find it here
Android Studio -> Preferences -> Gradle -> Tick Offline work and then restart your Android studio. Reference screenshot:
You can get easily get this information by barfing out the input in your handler function. For example, in Java: public String handleRequest(String input, Context context) { context.getLogger().log("Input: " + input); String output = "Input:" + System.getProperty(&qu...
// Mixin to generate hidden classes @mixin generate-hidden-classes { @each $bp in map-keys($grid-breakpoints) { .hidden-#{$bp} { @include media-breakpoint-only($bp) { display: none !important; } } } } // Call to the mixin @include generate-hidden-classes(...
Just add this function to your functions.php. It will remove the version from all enqueued js and css files. function remove_cssjs_ver( $src ) { if( strpos( $src, '?ver=' ) ) $src = remove_query_arg( 'ver', $src ); return $src; } add_filter( 'style_loader_src', 'remove_cssjs_ver', 9...
If you are attempting to get an Angular2 site running on your Windows work computer at XYZ MegaCorp the chances are that you are having problems getting through the company proxy. There are (at least) two package managers that need to get through the proxy: NPM Typings For NPM you need to ad...
You have a few options when it comes to logging in with Meteor. The most common method is using accounts for Meteor. Accounts-password If you want users to be able to create and register on your site, you can use accounts-password. Install the package using meteor add accounts-password. To creat...
Initial Creation and Download (CakePHP 3.x) The easiest way to create a new CakePHP project is via Composer (if you don't know about composer look here for more info) Install Composer If you need to install it and are on a windows machine follow this guide If you are on Linux/Unix/OSX follow thi...
@Configuration // @Lazy - For all Beans to load lazily public class AppConf { @Bean @Lazy public Demo demo() { return new Demo(); } }
@Component @Lazy public class Demo { .... .... } @Component public class B { @Autowired @Lazy // If this is not here, Demo will still get eagerly instantiated to satisfy this request. private Demo demo; ....... }
Mongoose contains some built in functions that build on the standard find(). doc.find({'some.value':5},function(err,docs){ //returns array docs }); doc.findOne({'some.value':5},function(err,doc){ //returns document doc }); doc.findById(obj._id,function(err,doc){ //returns doc...
i=0 while read -r line; do i=$((i+1)) done < file echo $i With a file containing: Alpha Beta Gamma Delta Epsilon The above script prints: 5

Page 529 of 826