Tutorial by Examples: e

1..10 | foreach-object { $fileName = "file_name_$_.txt" Write-Progress -Activity "Copying files" -Status "$($_*10) %" -Id 1 -PercentComplete ($_*10) -CurrentOperation "Copying file $fileName" 1..100 | foreach-object { ...
The simplest way to understand creating and modifying SVG elements is to operate on the elements using the DOM Level 2 Core interfaces, as you would with HTML or XML. It is imperative that the elements created from JavaScript are created in the same namespace declared in the SVG element - in this e...
You can use either DOM Level 2 Core methods getAttribute(), getAttributeNS(), setAttribute(), and setAttributeNS() to read and write values from SVG elements, or you can use custom properties and methods specified in the SVG 1.1 IDL (Interface Definition Language). Simple Numeric Attributes For ex...
Using the mouse to drag an SVG element (or group of elements) can be accomplished by: Adding mousedown handler to starts the drag: adding a translation on the element to use during dragging (if needed), tracking mousemove events, and adding a mouseup handler to end the drag. During mousemove, tr...
QThread is a handle to a platform thread. It lets you manage the thread by monitoring its lifetime, and requesting that it finishes its work. In most cases inhering from the class is not recommended. The default run method starts an event loop that can dispatch events to objects living in the class...
# Set The Formatting $xmlsettings = New-Object System.Xml.XmlWriterSettings $xmlsettings.Indent = $true $xmlsettings.IndentChars = " " # Set the File Name Create The Document $XmlWriter = [System.XML.XmlWriter]::Create("C:\YourXML.xml", $xmlsettings) # Write the XML ...
The instance_eval method is available on all objects. It evaluates code in the context of the receiver: object = Object.new object.instance_eval do @variable = :value end object.instance_variable_get :@variable # => :value instance_eval sets self to object for the duration of the c...
Many languages feature a with statement that allows programmers to omit the receiver of method calls. with can be easily emulated in Ruby using instance_eval: def with(object, &block) object.instance_eval &block end The with method can be used to seamlessly execute methods on object...
All objects are instances of a class. However, that is not the whole truth. In Ruby, every object also has a somewhat hidden singleton class. This is what allows methods to be defined on individual objects. The singleton class sits between the object itself and its actual class, so all methods defi...
@supports (display: flex) { /* Flexbox is available, so use it */ .my-container { display: flex; } } In terms of syntax, @supports is very similar to @media, but instead of detecting screen size and orientation, @supports will detect whether the browser can handle a given CSS rule....
To detect multiple features at once, use the and operator. @supports (transform: translateZ(1px)) and (transform-style: preserve-3d) and (perspective: 1px) { /* Probably do some fancy 3d stuff here */ } There is also an or operator and a not operator: @supports (display: flex) or (display...
To better understand the semantics of conses and lists, a graphical representation of this kind of structures is often used. A cons cell is usually represented with two boxes in contact, that contain either two arrows that point to the car and cdr values, or directly the values. For instance, the re...
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

Page 609 of 1191