Tutorial by Examples: c

If you are working with vectors or lines you will at some stage want to get the direction of a vector, or line. Or the direction from a point to another point. Math.atan(yComponent, xComponent) return the angle in radius within the range of -Math.PI to Math.PI (-180 to 180 deg) Direction of a vect...
If you have a vector in polar form (direction & distance) you will want to convert it to a cartesian vector with a x and y component. For referance the screen coordinate system has directions as 0 deg points from left to right, 90 (PI/2) point down the screen, and so on in a clock wise direction...
Math.sin and Math.cos are cyclic with a period of 2*PI radians (360 deg) they output a wave with an amplitude of 2 in the range -1 to 1. Graph of sine and cosine function: (courtesy Wikipedia) They are both very handy for many types of periodic calculations, from creating sound waves, to animati...
In XAML: <RadioButton IsChecked="{Binding EntityValue, Mode=TwoWay, Converter={StaticResource StringToIsCheckedConverter}, ConverterParameter=Male}" Content="Male"/> <RadioButton IsChecked="{Bindi...
public Result sayHello() { JsonNode json = request().body().asJson(); if(json == null) { return badRequest("Expecting Json data"); } else { String name = json.findPath("name").textValue(); if(name == null) { return badRequest...
@BodyParser.Of(BodyParser.Json.class) public Result sayHello() { JsonNode json = request().body().asJson(); String name = json.findPath("name").textValue(); if(name == null) { return badRequest("Missing parameter [name]"); } else { return ok...
Python's string module provides constants for string related operations. To use them, import the string module: >>> import string string.ascii_letters: Concatenation of ascii_lowercase and ascii_uppercase: >>> string.ascii_letters 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ...
<!-- <moduleDir>/etc/<area>/di.xml --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <!-- ... --> <type name="Vendor\Namespace\Model\So...
<!-- <moduleDir>/etc/<area>/di.xml --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <!-- ... --> <preference for="Vendor\Name...
CommandDescriptionCtrl+EScroll one line down.Ctrl+DScroll half a screen down (configurable using the scroll option).Ctrl+FScroll a full screen down.z+Draw the first line below the window at the top of the window.
CommandDescriptionCtrl+YScroll one line up.Ctrl+UScroll half a screen up (configurable using the scroll option).Ctrl+BScroll a full screen up.z^Draw the first line above the window at the bottom of the window.
CommandDescriptionzRedraw current line at the top of the window and put the cursor on the first non-blank character on the line.ztLike z but leave the cursor in the same column.z.Redraw current line at the center of the window and put the cursor on the first non-blank character on the line.zzLike z....
Sometimes we want to design our own UI for "Sign In With Facebook" button instead of the original button that comes with FacebookSDK. In your storyboard, drag your UIButton and set it however you want it to be. Ctrl + drag your button to your view controller as IBAction. Inside the IB...
After the user signed in to Facebook at your app, now it's time to fetch the data you requested at the FBButton.readPermissions. Swift: enum FacebookParametesField : String { case FIELDS_KEY = "fields" case FIELDS_VALUE = "id, email, picture, first_name, last_name" ...
In SpriteKit a Sprite is represented by the SKSpriteNode class (which inherits from SKNode). First of all create a new Xcode Project based on the SpriteKit template as described in Your First SpriteKit Game. Creating a Sprite Now you can create a SKSpriteNode using an image loaded into the Assets...
Escape sequences are not restricted to string and char literals. Suppose you need to override a third-party method: protected abstract IEnumerable<Texte> ObtenirŒuvres(); and suppose the character Œ is not available in the character encoding you use for your C# source files. You are lucky...
Whenever AFNetworking is used the call is dispatched on a custom thread provided by AFNetworking. When the call returns to the completion block, it gets executed on the main thread. This example sets a custom thread that dispatch to the completion block: AFNetworking 2.xx: // Create dispatch_queu...
There are many cases when one has created an NSDate from only an hour and minute format, i.e: 08:12 that returns from a server as a String and you initiate an NSDate instance by these values only. The downside for this situation is that your NSDate is almost completely "naked" and what yo...
// class declaration with a list of parameters for a primary constructor type Car (model: string, plates: string, miles: int) = // secondary constructor (it must call primary constructor) new (model, plates) = let miles = 0 new Car(model, plates, miles) ...
One can clear the user data of a specific app using adb: adb shell pm clear <package> This is the same as to browse the settings on the phone, select the app and press on the clear data button. pm invokes the package manager on the device clear deletes all data associated with a packag...

Page 238 of 826