Tutorial by Examples

config.paths.html represents the path to your HTML file. gulp.task("watch", function() { gulp.watch(config.paths.html, ["html"]); }); The task should be added to default as well: gulp.task("default", ["html", "watch"]);
Build: xcodebuild -exportArchive -exportFormat ipa \ -archivePath "/Users/username/Desktop/MyiOSApp.xcarchive" \ -exportPath "/Users/username/Desktop/MyiOSApp.ipa" \ -exportProvisioningProfile "MyCompany Distribution Profile" Archive: xcodebuild -pro...
To consume a REST API with RestTemplate, create a Spring boot project with the Spring boot initialzr and make sure the Web dependency is added: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dep...
ActiveRecord includes default_scope, to automatically scope a model by default. class Post default_scope ->{ where(published: true).order(created_at: :desc) } end The above code will serve posts which are already published when you perform any query on the model. Post.all # will only lis...
The qsort() standard library function is a good example of how one can use void pointers to make a single function operate on a large variety of different types. void qsort ( void *base, /* Array to be sorted */ size_t num, /...
JSON_VALUE function enables you to take a data from JSON text on the path specified as the second argument, and use this value in any part of the select query: select ProductID, Name, Color, Size, Price, JSON_VALUE(Data, '$.Type') as Type from Product where JSON_VALUE(Data, '$.Type') = 'part' ...
Once JSON values are extracted from JSON text, you can use them ina any part of the query. You can create some kind of report on JSON data with grouping aggregations, etc: select JSON_VALUE(Data, '$.Type') as type, AVG( cast(JSON_VALUE(Data, '$.ManufacturingCost') as float) ) as cost from...
If some JSON text might not be properly formatted, you can remove those entries from query using ISJSON function. select ProductID, Name, Color, Size, Price, JSON_VALUE(Data, '$.Type') as Type from Product where JSON_VALUE(Data, '$.Type') = 'part' and ISJSON(Data) > 0
JSON_MODIFY function can be used to update value on some path. You can use this function to modify original value of JSON cell in UPDATE statement: update Product set Data = JSON_MODIFY(Data, '$.Price', 24.99) where ProductID = 17; JSON_MODIFY function will update or create Price key (if it do...
JSON_MODIFY function can be used to append new value to some array inside JSON: update Product set Data = JSON_MODIFY(Data, 'append $.tags', "sales") where ProductID = 17; New value will be appended at the end of the array, or a new array with value ["sales"] will be create...
If you have a "child table" formatted as JSON collection and stored in-row as JSON column, you can unpack this collection, transform it to table and join it with parent row. Instead of the standard JOIN operator, you should use CROSS APPLY. In this example, product parts are formatted as ...
In this example, Tags array may contain various keywords like ["promo", "sales"], so we can open this array and filter values: select ProductID, Name, Color, Size, Price, Quantity from Product CROSS APPLY OPENJSON(Data, '$.Tags') where value = 'sales' OPENJSON will op...
JSON is textual format, so it is stored in standard NVARCHAR columns. NoSQL collection is equivalent to two column key value table: CREATE TABLE ProductCollection ( Id int identity primary key, Data nvarchar(max) ) Use nvarchar(max) as you are not sure what would be the size of your JSON ...
Since JSON is stored textual column, you might want to ensure that it is properly formatted. You can add CHECK constraint on JSON column that checks is text properly formatted JSON: CREATE TABLE ProductCollection ( Id int identity primary key, Data nvarchar(max) CONSTRAINT [Data shoul...
You can expose values from JSON column as computed columns: CREATE TABLE ProductCollection ( Id int identity primary key, Data nvarchar(max), Price AS JSON_VALUE(Data, '$.Price'), Color JSON_VALUE(Data, '$.Color') PERSISTED ) If you add PERSISTED computed column, value from JSON tex...
Queries that filter or sort data by some value in JSON column usually use full table scan. SELECT * FROM ProductCollection WHERE JSON_VALUE(Data, '$.Color') = 'Black' To optimize these kind of queries, you can add non-persisted computed column that exposes JSON expression used in filter or sort...
If you can use memory-optimized tables, you can store JSON as text: CREATE TABLE ProductCollection ( Id int identity primary key nonclustered, Data nvarchar(max) ) WITH (MEMORY_OPTIMIZED=ON) Advantages of JSON in in-memory: JSON data is always in memory so there is no disk access Ther...
PL/SQL uses IN, OUT, IN OUT keywords to define what can happen to a passed parameter. IN specifies that the parameter is read only and the value cannot be changed by the procedure. OUT specifies the parameter is write only and a procedure can assign a value to it, but not reference the value. IN ...
OPENJSON function parse JSON text and returns all key:value pairs at the first level of JSON: declare @json NVARCHAR(4000) = N'{"Name":"Joe","age":27,"skills":["C#","SQL"]}'; SELECT * FROM OPENJSON(@json); keyvaluetypeNameJoe1age272ski...
OPENJSON function parses collection of JSON objects and returns values from JSON text as set of rows. declare @json nvarchar(4000) = N'[ {"Number":"SO43659","Date":"2011-05-31T00:00:00","Customer": "MSFT","Price":59.99,"Q...

Page 690 of 1336