Tutorial by Examples: c

+currentCalendar returns the logical calendar for the current user. NSCalendar *calender = [NSCalendar currentCalendar]; NSLog(@"%@",calender); +autoupdatingCurrentCalendar returns the current logical calendar for the current user. NSCalendar *calender = [NSCalendar autoupdat...
- initWithCalendarIdentifier: Initializes a newly-allocated NSCalendar object for the calendar specified by a given identifier. NSCalendar *calender = [[NSCalendar alloc]initWithCalendarIdentifier:@"gregorian"]; NSLog(@"%@",calender); - setFirstWeekday: Sets the index of the...
- components:fromDate: Returns a NSDateComponents object containing a given date decomposed into specified components NSCalendar *calender = [NSCalendar autoupdatingCurrentCalendar]; [calender setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]]; NSLog(@"%@",[calender components:NSCale...
Like slices, maps hold references to an underlying data structure. So by assigning its value to another variable, only the reference will be passed. To copy the map, it is necessary to create another map and copy each value: // Create the original map originalMap := make(map[string]int) originalM...
ob_start is especially handy when you have redirections on your page. For example, the following code won't work: Hello! <?php header("Location: somepage.php"); ?> The error that will be given is something like: headers already sent by <xxx> on line <xxx>. In or...
This book is known as CLtL2. This is the second edition of the book Common Lisp the Language. It was published in 1990, before the ANSI CL standard was final. It took the original language definition from the first edition (published in 1984) and described all changes in the standardization process...
In HTTP 1.1, a minimal HTTP request consists of a request line and a Host header: GET /search HTTP/1.1 \r\n Host: google.com \r\n \r\n The first line has this format: Method Request-URI HTTP-Version CRLF Method should be a valid HTTP method; one of [1][2]: OPTIONS GET HEAD POST PUT ...
On CLiki, a Wiki for Common Lisp and free Common Lisp software, a list of Proposed ANSI Revisions and Clarifications is being maintained. Since the Common Lisp standard has not changed since 1994, users have found several problems with the specification document. These are documented on the CLiki p...
The split-sequence library provides a function split-sequence, which allows to split on elements of a sequence (split-sequence:split-sequence #\Space "John Doe II") ;; => ("John" "Doe" "II")
From the official documentation: If you want to get advanced, you can also open up the project file for a specific platform by opening the required XCode or Android Eclipse project in platforms/PLATFORM inside the root of your project. Then, you can build and test from inside the platform-specifi...
There are several good examples of using lambdas as a FunctionalInterface in simple scenarios. A fairly common use case that can be improved by lambdas is what is called the Execute-Around pattern. In this pattern, you have a set of standard setup/teardown code that is needed for multiple scenarios ...
When to use Virtually all WPF controls make heavy use of dependency properties. A dependency property allows for the use of many WPF features that are not possible with standard CLR properties alone, including but not limited to support for styles, animations, data binding, value inheritance, and c...
When to use An attached property is a dependency property that can be applied to any DependencyObject to enhance the behavior of various controls or services that are aware of the property's existence. Some use cases for attached properties include: Having a parent element iterate through its c...
When to use A read-only dependency property is similar to a normal dependency property, but it is structured to not allow having its value set from outside the control. This works well if you have a property that is purely informational for consumers, e.g. IsMouseOver or IsKeyboardFocusWithin. How...
Generic parameters can also be bound to more than one type using the T extends Type1 & Type2 & ... syntax. Let's say you want to create a class whose Generic type should implement both Flushable and Closeable, you can write class ExampleClass<T extends Flushable & Closeable> { }...
These macros merge control flow and binding. They are an improvement over anaphoric anaphoric macros because they let the developer communicate meaning through naming. As such their use is recommended over their anaphoric counterparts. (if-let (user (get-user user-id)) (show-dashboard user) (...
A JSON Object is surrounded by curly braces and contains key-value pairs. { "key1": "value1", "key2": "value2", ... } Keys must be valid strings, thus surrounded by double quotation marks. Values can be JSON objects, numbers, strings, arrays, or one of the...
To prompt for credentials, you should almost always use the Get-Credential cmdlet: $credential = Get-Credential Pre-filled user name: $credential = Get-Credential -UserName 'myUser' Add a custom prompt message: $credential = Get-Credential -Message 'Please enter your company email address a...
The password in a credential object is an encrypted [SecureString]. The most straightforward way is to get a [NetworkCredential] which does not store the password encrypted: $credential = Get-Credential $plainPass = $credential.GetNetworkCredential().Password The helper method (.GetNetworkCrede...
To store and retrieve encrypted credentials easily, use PowerShell's built-in XML serialization (Clixml): $credential = Get-Credential $credential | Export-CliXml -Path 'C:\My\Path\cred.xml' To re-import: $credential = Import-CliXml -Path 'C:\My\Path\cred.xml' The important thing to remem...

Page 229 of 826