Tutorial by Examples: c

The Scala compiler prefixes every argument in the parameter list by default with val. This means that, by default, case classes are immutable. Each parameter is given an accessor method, but there are no mutator methods. For example: case class Foo(i: Int) val fooInstance = Foo(1) val j = fooIn...
We start off with $db, an instance of the PDO class. After executing a query we often want to determine the number of rows that have been affected by it. The rowCount() method of the PDOStatement will work nicely: $query = $db->query("DELETE FROM table WHERE name = 'John'"); $count = ...
All you need is a variable of type IHostingEnvironment: get environment name: env.EnvironmentName for predefined Development, Staging, Production environments the best way is to use extension methods from HostingEnvironmentExtensions class env.IsDevelopment() env.IsStaging() ...
Apply will be used when when table valued function in the right expression. create a Department table to hold information about departments. Then create an Employee table which hold information about the employees. Please note, each employee belongs to a department, hence the Employee table has ref...
In normal mode, we can increment the nearest number on the line at or after the cursor with <C-a> and decrement it with <C-x>. In the following examples, the cursor position is indicated by ^. Incrementing and decrementing numbers for i in range(11): ^ <C-x> decrements ...
CREATE SYNONYM EmployeeData FOR MyDatabase.dbo.Employees
The core idea behind the Feature Branch Workflow is that all feature development should take place in a dedicated branch instead of the master branch. This encapsulation makes it easy for multiple developers to work on a particular feature without disturbing the main codebase. It also means the mast...
Future<Results> costlyQuery() { var completer = new Completer(); database.query("SELECT * FROM giant_table", (results) { // when complete completer.complete(results); }, (error) { completer.completeException(error); }); // this returns essentially im...
Flash Player 10 introduced the Vector.<*> generic list type that was faster than the Array. However, this is not entirely true. Only the following Vector types are faster than the Array counterparts, due to the way they are implemented in Flash Player. Vector.<int> - Vector of 32-bit ...
Creating and configuring Sprite and TextField objects at runtime can be costly if you are creating hundreds of thousands of these on a single frame. Therefore a common trick is "pooling" these objects for later reuse. Remember we are not just trying to optimize the creation time (new Sprit...
Working Source - https://github.com/benhysell/V.TouchIdExample Long form description - http://benjaminhysell.com/archive/2014/11/authentication-in-xamarin-ios-with-touch-id-or-passcode/ //Simple View with a switch to enable / disable Touch ID and //a button to invoke authentication /// <s...
Flash dispatches Events for most of its objects. One of the most basic event is ENTER_FRAME, which is dispatched (at the framerate of the SWF) on every display list object. import flash.display.Sprite; import flash.events.Event; var s:Sprite = new Sprite(); s.addEventListener(Event.ENTER_FRAME...
Codename One is a set of tools for mobile application development that derive a great deal of its architecture from Java. Codename One's mission statement is: Unify the complex and fragmented task of mobile device programming into a single set of tools, APIs & services. As a result create a...
UITextView has built in support to auto detect a variety of data. The data that is able to be auto-detected currently includes: enum { UIDataDetectorTypePhoneNumber = 1 << 0, UIDataDetectorTypeLink = 1 << 1, UIDataDetectorTypeAddress = 1 << 2, UID...
Single JAR Sometimes you have a local JAR file you need to add as a dependency to your Gradle build. Here's how you can do this: dependencies { compile files('path/local_dependency.jar') } Where path is a directory path on your filesystem and local_dependency.jar is the name of your local...
Dependencies in Gradle follow the same format as Maven. Dependencies are structured as follows: group:name:version Here's an example: 'org.springframework:spring-core:4.3.1.RELEASE' To add as a compile-time dependency, simply add this line in your dependency block in the Gradle build file: ...
In F#, all functions take exactly one parameter. This seems an odd statement, since it's trivially easy to declare more than one parameter in a function declaration: let add x y = x + y But if you type that function declaration into the F# interactive interpreter, you'll see that its type signat...
Most functions in F# are created with the let syntax: let timesTwo x = x * 2 This defines a function named timesTwo that takes a single parameter x. If you run an interactive F# session (fsharpi on OS X and Linux, fsi.exe on Windows) and paste that function in (and add the ;; that tells fsharpi ...
It is possible to find the first element of a Stream that matches a condition. For this example, we will find the first Integer whose square is over 50000. IntStream.iterate(1, i -> i + 1) // Generate an infinite stream 1,2,3,4... .filter(i -> (i*i) > 50000) // Filter to find element...
Template JS code Template.templateName.onCreated(function(){ this.subscribe('subsription1'); this.subscribe('subscription2'); }); Template HTML code <template name="templateName"> {{#if Template.subscriptionsReady }} //your actual view with data. it can ...

Page 195 of 826