Tutorial by Examples

ARC can be disabled for individual files by adding the -fno-objc-arc compiler flag for each file. Conversely it can be added in Targets ▸ Build Phases ▸ Compile Sources
Repeated Timer event Swift class ViewController: UIViewController { var timer = NSTimer() override func viewDidLoad() { NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: Selector(self.timerMethod()), userInfo: nil, repeats: true) } func tim...
All parameters specified after the first asterisk in the function signature are keyword-only. def f(*a, b): pass f(1, 2, 3) # TypeError: f() missing 1 required keyword-only argument: 'b' In Python 3 it's possible to put a single asterisk in the function signature to ensure that the rema...
Detailed instructions on getting windows-phone-8 set up or installed.
Prolog categorizes everything into: Atoms - Any sequence of characters that do not start with an uppercase alphabet. Eg - a, b, okay Numbers - There is no special syntax for numbers, no declaration is required. Eg 1, 22, 35.8 Variables - A string which starts with an uppercase character or unde...
Usually grep prints only matching lines. In the example below seq 9 generates a list of numbers from 1 to 9, one per line, and grep prints a single matching line: seq 9 | grep 5 # 5 The -C n option (or --context=n in long form) prints n lines before and after each matching line, in addition to ...
In this example, a private static instance of the class is declared at its beginning. The value of a static field is shared between instances, so if a new instance of this class gets created the if will find a reference to the first Singleton object, destroying the new instance (or its game object)...
Why an Editor Window? As you may have seen, you can do a lot of things in a custom inspector (if you don't know what a custom inspector is, check the example here : http://www.riptutorial.com/unity3d/topic/2506/extending-the-editor. But at one point you may want to implement a configuration panel, ...
import std.stdio; bool isPrime(int number) { foreach(i; 2..number) { if (number % i == 0) { return false; } } return true; } void main() { writeln(2.isPrime); writeln(3.isPrime); writeln(4.isPrime); 5.isPrime.writeln; } ...
On calling, an application chooser dialog will appear and by selecting an application you can share your content with it. For calling use this line of code in your program class: share(context, "This is a test message", "Test Subject") Function's definition: public static v...
Notice, that in order to change file prmissions, your device need to be rooted, su binary doesn't come with factory shipped devices! Convention: adb shell su -c "chmod <numeric-permisson> <file>" Numeric permission constructed from user, group and world sections. For exa...
Dim openListType = GetType(List(Of )) Dim typeParameters = {GetType(String)} Dim stringListType = openListType.MakeGenericType(typeParameters) Dim instance = DirectCast(Activator.CreateInstance(stringListType), List(Of String)) instance.Add("Hello")
It is possible to easily catch the exception without any try catch block. public class ListTest { private final List<Object> list = new ArrayList<>(); @Test(expected = IndexOutOfBoundsException.class) public void testIndexOutOfBoundsException() { list.get(0); } } ...
var a = new List<int>(); var b = a; a.Add(5); Console.WriteLine(a.Count); // prints 1 Console.WriteLine(b.Count); // prints 1 as well Assigning to a variable of a List<int> does not create a copy of the List<int>. Instead, it copies the reference to the List<int>. We ...
Timing There are two trigger action time modifiers : BEFORE trigger activates before executing the request, AFTER trigger fire after change. Triggering event There are three events that triggers can be attached to: INSERT UPDATE DELETE Before Insert trigger example DELIMITER $$ ...
Here is a tested code for image and video.It will work for all APIs less than 19 and greater than 19 as well. Image: if (Build.VERSION.SDK_INT <= 19) { Intent i = new Intent(); i.setType("image/*"); i.setAction...
add permission in your manifest file <uses-permission android:name="android.permission.BLUETOOTH" /> In your Fragment(or Activity) Add the receiver method private BroadcastReceiver mBluetoothStatusChangedReceiver = new BroadcastReceiver() { @Override public void o...
Headings can be used to describe the topic they precede and they are defined with the <h1> to <h6> tags. Headings support all the global attributes. <h1> defines the most important heading. <h6> defines the least important heading. Defining a heading: <h1>Headin...
Once you have setup the Retrofit environment in your project, you can use the following example that demonstrates how to upload multiple files using Retrofit: private void mulipleFileUploadFile(Uri[] fileUri) { OkHttpClient okHttpClient = new OkHttpClient(); OkHttpClient clientWith30sTime...
The Java Native Interface (JNI) allows you to call native functions from Java code, and vice versa. This example shows how to load and call a native function via JNI, it does not go into accessing Java methods and fields from native code using JNI functions. Suppose you have a native library named ...

Page 560 of 1336