Tutorial by Examples: c

It is a good practice to add comments that describe the code. It is helpful for others and even for the coder when returned later. A single line can be commented using the % symbol or using the shortkey Ctrl+R. To uncomment a previously commented line remove the % symbol or use shortkey Crtl+T. W...
Keychain allows to save items with special SecAccessControl attribute which will allow to get item from Keychain only after user will be authenticated with Touch ID (or passcode if such fallback is allowed). App is only notified whether the authentication was successful or not, whole UI is managed b...
Interpolating values is helpful if you need to pass a server-side variable to client-side JavaScript (or other languages that require it). In the case of variables, numbers, strings, and the like, you can pass these types of variables directly into your JavaScript with bracket syntax plus an explan...
Let's see how we can organize the code, when the codebase is getting larger. 01. Functions fn main() { greet(); } fn greet() { println!("Hello, world!"); } 02. Modules - In the same file fn main() { greet::hello(); } mod greet { // By default, everything inside a...
In Strict Mode, functions declared in a local block are inaccessible outside the block. "use strict"; { f(); // 'hi' function f() {console.log('hi');} } f(); // ReferenceError: f is not defined Scope-wise, function declarations in Strict Mode have the same kind of binding as l...
ClassDeclaration's Name is bound in different ways in different scopes - The scope in which the class is defined - let binding The scope of the class itself - within { and } in class {} - const binding class Foo { // Foo inside this block is a const binding } // Foo here is a let binding...
To develop an application for watchOS, you should start with Xcode. Xcode only runs on macOS. At the time of writing, the latest version is Xcode 8.3. If you want to start a new project from scratch: Boot up your Mac and install Xcode from the App Store if it's not already installed. Choo...
Use case: just one action which should return a plain (text) content as-is: public function actionAsXML() { $this->layout = false; Yii::$app->response->format = Response::FORMAT_XML; return ['aaa' => [1, 2, 3, 4]];; } Pre-defined response formats are: FORMAT_HTM...
TL;DR It basically allows us to simulate real devices and test our apps without a real device. According to Android Developer Documentation, an Android Virtual Device (AVD) definition lets you define the characteristics of an Android Phone, Tablet, Android Wear, or Android TV device that you w...
(require '[clj-time.core :as t]) (def example-time (t/date-time 2016 12 5 4 3 27 456)) (t/year example-time) ;; 2016 (t/month example-time) ;; 12 (t/day example-time) ;; 5 (t/hour example-time) ;; 4 (t/minute example-time) ;; 3 (t/second example-time) ;; 27
(require '[clj-time.core :as t]) (def date1 (t/date-time 2016 12 5)) (def date2 (t/date-time 2016 12 6)) (t/equal? date1 date2) ;; false (t/equal? date1 date1) ;; true (t/before? date1 date2) ;; true (t/before? date2 date1) ;; false (t/after? date1 date2) ;; false (t/after? date2 dat...
strComputer = "." Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSettings = objWMIService.ExecQuery _("Select * from Win32_ComputerSystem") For Each objCompu...
strComputer = "." instances = 0 processName = "chrome.exe" Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colProcess = objWMIService.ExecQuery("Select * from Win32_Process") For Each objProcess in colP...
strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_DesktopMonitor",,48) For Each objItem in colItems WScript.Echo "ScreenHeight: " &am...
To calculate the sum of terms (of type float, int or big integer) of a number list, it is preferable to use List.sum In other cases, List.fold is the function that is best suited to calculate such a sum. Sum of complex numbers In this example, we declare a list of complex numbers and we calcu...
One of the most critical parts of dealing with NMS code is being able to support mulitple Minecraft versions. There are numerous ways to do this, but a simple solution is to use this code to store the version as a public static field: public static final String NMS_VERSION = Bukkit.getServer().getC...
This example shows how to obtain the ancestry of a component using the ClassType and ClassParent properties. It uses a button Button1: TButton and a list box ListBox1: TListBox on a form TForm1. When the user clicks the button, the name of the button’s class and the names of its parent classes are ...
New-S3Bucket -BucketName trevor The Simple Storage Service (S3) bucket name must be globally unique. This means that if someone else has already used the bucket name that you want to use, then you must decide on a new name.
Set-Content -Path myfile.txt -Value 'PowerShell Rocks' Write-S3Object -BucketName powershell -File myfile.txt Uploading files from your local filesystem into AWS S3 is easy, using the Write-S3Object command. In its most basic form, you only need to specify the -BucketName parameter, to indicate ...
Get-S3Object -BucketName powershell | Remove-S3Object -Force Remove-S3Bucket -BucketName powershell -Force In order to remove a S3 bucket, you must first remove all of the S3 objects that are stored inside of the bucket, provided you have permission to do so. In the above example, we are retriev...

Page 745 of 826