Tutorial by Examples

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...
ANTLR is distributed as a Java Jar file It can be downloaded here. As ANTLR is compiled as a jar file it subsequently requires the Java runtime environment to operate, if you do not have It can be downloaded here. Once the ANTLR JAR file has been downloaded you can run ANTLR from the command line i...
If your application is available in different languages, you usually show the current locale in the URL. scope '/(:locale)', locale: /#{I18n.available_locales.join('|')}/ do root 'example#root' # other routes end Your root will be accessible via the locales defined in I18n.available_l...
A self reference can be useful to build a hierarchical tree. This can be achieved with add_reference in a migration. class AddParentPages < ActiveRecord::Migration[5.0] def change add_reference :pages, :pages end end The foreign key column will be pages_id. If you want to decide a...
Open Xcode and select Create a new Xcode Project. Now select iOS > Application on the left and Game on the main selection area. Press Next. Write into Product Name the name of your first great game. Into Organization Name the name of your company (or simply your own name). Organisation I...
As discussed in the introduction, the gradle wrapper functionality works because a jar is downloaded into the project to be used when the gradlew command is run. However this may not get committed and after the next time the project is checked out, gradlew will fail to run with the error: Error: C...
Gradle has the ability to add a wrapper to projects. This wrapper alleviates the need for all users or continuous integration systems to have Gradle installed. It also prevents version issues where there is some incompatibility between the version the project uses and that which users have installed...
Create SharedPreferences BuyyaPref SharedPreferences pref = getApplicationContext().getSharedPreferences("BuyyaPref", MODE_PRIVATE); Editor editor = pref.edit(); Storing data as KEY/VALUE pair editor.putBoolean("key_name1", true); // Saving boolean - true/false ...
Let's say you have class with generic methods. And you need to call its functions with reflection. public class Sample { public void GenericMethod<T>() { // ... } public static void StaticMethod<T>() { //... } } Let's say we want to...
From Apple documentation: Use the CTCallCenter class to obtain a list of current cellular calls, and to respond to state changes for calls such as from a dialing state to a connected state. Such state changes are known as cellular call events. The purpose of CTCallCenter is to give the develop...
You can subclass SKSpriteNode and define your own type of sprite. class Hero: SKSpriteNode { //Use a convenience init when you want to hard code values convenience init() { let texture = SKTexture(imageNamed: "Hero") self.init(texture: texture, color: .clearCol...
In contrast to segue that lets you pass data "forward" from current view controller to destination view controller: (VC1) -> (VC2) Using "unwind" you can do the opposite, pass data from the destination or current view controller to its presenting view controller: (VC1) <...
There are cases, where custom objects need to be created and defined in the resources of the application. Such objects can be composed of Java simple types, for example Integer, Float, String. Here is the example of how to import an object defined in application resources. The object Category cons...
Let's say you have a User model class User < ActiveRecord::Base end Now to update the first_name and last_name of a user with id = 1, you can write the following code. user = User.find(1) user.update(first_name: 'Kashif', last_name: 'Liaqat') Calling update will attempt to update the gi...
\documentclass{report} \begin{document} \title{I want to be a Wombat} \author{Carl Capybara} \maketitle \end{document} This will create a title page with no other content:
RoboGuice is a framework that brings the simplicity and ease of Dependency Injection to Android, using Google's own Guice library. RoboGuice 3 slims down your application code. Less code means fewer opportunities for bugs. It also makes your code easier to follow -- no longer is your code littered ...

Page 389 of 1336