Tutorial by Examples: c

Prior to C++17, template deduction cannot deduce the class type for you in a constructor. It must be explicitly specified. Sometimes, however, these types can be very cumbersome or (in the case of lambdas) impossible to name, so we got a proliferation of type factories (like make_pair(), make_tuple(...
Types used in Sets and Dictionaries(key) must conform to Hashable protocol which inherits from Equatable protocol. Custom type conforming to Hashable protocol must implement A calculated property hashValue Define one of the equality operators i.e. == or !=. Following example implements Hasha...
Create a basic application with single view application template with swift as language Add SWRevealViewController.h and SWRevealViewController.m then click on Create Bridging Header button and add #import "SWRevealViewController.h" on the Bridging header Then select viewControll...
LINQ provides a method that makes it easy to create a collection filled with sequential numbers. For example, you can declare an array which contains the integers between 1 and 100. The Enumerable.Range method allows us to create sequence of integer numbers from a specified start position and a num...
When we want to change root password in windows, We need to follow following steps : Step 1 : Start your Command Prompt by using any of below method : Perss Crtl+R or Goto Start Menu > Run and then type cmd and hit enter Step 2 : Change your directory to where MYSQL is installed, In my case i...
It's a good practice to cache loaded result to avoid multiple loading of same data. To invalidate cache onContentChanged() should be called. If loader has been already started, forceLoad() will be called, otherwise (if loader in stopped state) loader will be able to understand content change with ta...
Suppose you have a collection elements, and you want to create another collection containing the same elements but with all duplicates eliminated: Collection<Type> noDuplicates = new HashSet<Type>(elements); Example: List<String> names = new ArrayList<>( Arrays....
// First load a product object $product->getSku(); $product->getName(); // Alternative method $product->getData('sku'); $product->getData('name');
// First load a collection object foreach($collection as $product) { $product->getSku(); $product->getName(); // Alternative method $product->getData('sku'); $product->getData('name'); }
Initialize the UITextField with a CGRect as a frame: Swift let textfield = UITextField(frame: CGRect(x: 0, y: 0, width: 200, height: 21)) Objective-C UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 200, 21)]; You can also create a UITextField in Interface Builde...
Line Length // Lines should never exceed 100 characters. // Instead, just wrap on to the next line. let bad_example = "So this sort of code should never really happen, because it's really hard to fit on the screen!"; Indentation // You should always use 4 spaces for indentation. ...
Preludes and Re-Exports // To reduce the amount of imports that users need, you should // re-export important structs and traits. pub use foo::Client; pub use bar::Server; Sometimes, crates use a prelude module to contain important structs, just like std::io::prelude. Usually, these are impor...
As your activity begins to stop, the system calls onSaveInstanceState() so your activity can save state information with a collection of key-value pairs. The default implementation of this method automatically saves information about the state of the activity's view hierarchy, such as the text in an...
If you want to lock the screen orientation change of any screen (activity) of your android application you just need to set the android:screenOrientation property of an <activity> within the AndroidManifest.xml: <activity android:name="com.techblogon.screenorientationexample.Main...
If your application doesn't need to update resources during a specific configuration change and you have a performance limitation that requires you to avoid the activity restart, then you can declare that your activity handles the configuration change itself, which prevents the system from restartin...
The CAEmitterLayer class provides a particle emitter system for Core Animation. The particles are defined by instances of CAEmitterCell. The particles are drawn above the layer’s background color and border. var emitter = CAEmitterLayer() emitter.emitterPosition = CGPoin...
For example we will create view that contains emitter layer and animates particles. import QuartzCore class ConfettiView: UIView { // main emitter layer var emitter: CAEmitterLayer! // array of color to emit var colors: [UIColor]! // intensity of appearance var ...
Demonstrate how to embed a lua interpreter in C code, expose a C-defined function to Lua script, evaluate a Lua script, call a C-defined function from Lua, and call a Lua-defined function from C (the host). In this example, we want the mood to be set by a Lua script. Here is mood.lua: -- Get versi...
To setup a WebRTC-based communication system, you need three main components: A WebRTC signaling server To establish a WebRTC connections, peers need to contact a signaling server, which then provides the address information the peers require to set up a peer-to-peer connection. Signaling serv...
Suppose you have multiple threads running. Each thread is doing one task. You want to get notified either on the mainThread OR another thread, when all the task-threads are completed. The simplest solution to such a problem is a DispatchGroup. When using a DispatchGroup, for each request, you ente...

Page 390 of 826