Tutorial by Examples: c

You can insert data in a table as the result of a select statement: INSERT INTO person SELECT * FROM tmp_person WHERE age < 30; Note that the projection of the select must match the columns required for the insert. In this case, the tmp_person table has the same columns as person.
Beware that numbers can accidentally be converted to strings or NaN (Not a Number). JavaScript is loosely typed. A variable can contain different data types, and a variable can change its data type: var x = "Hello"; // typeof x is a string x = 5; // changes typeof x to...
GridViews allow commands to be sent from a GridView row. This is useful for passing row-specific information into an event handler as command arguments. To subscribe to a command event: <asp:GridView ID="GridView1" ... OnRowCommand="GridView1_RowCommand"> Buttons are t...
When custom options are merged, they use the default strategy, which simply overwrites the existing value. If you want a custom option to be merged using custom logic, you need to attach a function to Vue.config.optionMergeStrategies: Vue.config.optionMergeStrategies.myOption = function (toVal, fro...
Mixins are a flexible way to distribute reusable functionalities for Vue components. A mixin object can contain any component options. When a component uses a mixin, all options in the mixin will be “mixed” into the component’s own options. // define a mixin object var myMixin = { created: fun...
Let's say you have a service the same as the one defined in the "First service and host" example. To create a client, define the client configuration section in the system.serviceModel section of your client configuration file. <system.serviceModel> <services> <cli...
Add the following pom to the dependencies section of your gradle build file : project.dependencies { compile 'org.roboguice:roboguice:3.+' provided 'org.roboguice:roboblender:3.+' }
The @ContentView annotation can be used to further alleviate development of activities and replace the setContentView statement : @ContentView(R.layout.myactivity_layout) public class MyActivity extends RoboActivity { @InjectView(R.id.text1) TextView textView; @Override protected ...
You can inject any type of resource, Strings, Animations, Drawables, etc. To inject your first resource into an activity, you'll need to: Inherit from RoboActivity Annotate your resources with @InjectResource Example @InjectResource(R.string.app_name) String name; @InjectResource(R.drawa...
You can inject any view using the @InjectView annotation: You'll need to: Inherit from RoboActivity Set your content view Annotate your views with @InjectView Example @InjectView(R.id.textView1) TextView textView1; @InjectView(R.id.textView2) TextView textView2; @InjectView(R.id.imag...
The UIAlertController available since iOS8 allows you to use the same alert object for either Action sheets or more classic alerts. The only difference is the UIAlertControllerStyle passed as a parameter when creating. This line changes from an AlertView to an ActionSheet, compared to some other ex...
User input Imagine you want a user to enter a number via input. You want to ensure that the input is a number. You can use try/except for this: Python 3.x3.0 while True: try: nb = int(input('Enter a number: ')) break except ValueError: print('This is not a num...
Func provides a holder for parameterised anonymous functions. The leading types are the inputs and the last type is always the return value. // square a number. Func<double, double> square = (x) => { return x * x; }; // get the square root. // note how the signature matches the built ...
Functions have two built-in methods that allow the programmer to supply arguments and the this variable differently: call and apply. This is useful, because functions that operate on one object (the object that they are a property of) can be repurposed to operate on another, compatible object. Addi...
To create a variable: variableType variableName; For example: int a; To create a variable and initialize it: variableType variableName = initialValue; For example: int a = 2;
DECLARE @Employees TABLE ( EmployeeID INT NOT NULL PRIMARY KEY, FirstName NVARCHAR(50) NOT NULL, LastName NVARCHAR(50) NOT NULL, ManagerID INT NULL ) When you create a normal table, you use CREATE TABLE Name (Columns) syntax. When creating a table variable, you use DECLARE @...
Using SELECT, you can update multiple variables at once. DECLARE @Variable1 INT, @Variable2 VARCHAR(10) SELECT @Variable1 = 1, @Variable2 = 'Hello' PRINT @Variable1 PRINT @Variable2 1 Hello When using SELECT to update a variable from a table column, if there are multiple values, it wi...
DECLARE @Var1 INT = 5, @Var2 NVARCHAR(50) = N'Hello World', @Var3 DATETIME = GETDATE()
This is an example of what a simple Arduino sketch looks like after being imported into Atmel Studio. Atmel Studio added the auto generated sections at the top. The rest is identical to the original Arduino code. If you expand the ArduinoCore project that was created and look in the src -> cor...
You can group related assertions in deftest unit tests within a context using the testing macro: (deftest add-nums (testing "Positive cases" (is (= 2 (+ 1 1))) (is (= 4 (+ 2 2)))) (testing "Negative cases" (is (= -1 (+ 2 -3))) (is (= -4 (+ 8 -12))))) ...

Page 198 of 826