Tutorial by Examples: c

This is a nice trick to add a link to code, so it will be easy to jump to the code that issued the log. With the following code, this call: MyLogger.logWithLink("MyTag","param="+param); Will result in: 07-26...012/com.myapp D/MyTag: MyFrag:onStart(param=3) (MyFrag.java:236...
Current updates the branch on the remote repository that shares a name with the current working branch. git config push.default current Simple pushes to the upstream branch, but will not work if the upstream branch is called something else. git config push.default simple Upstream pushes to t...
This is the basic way to insert data from another table with the SELECT statement. INSERT INTO `tableA` (`field_one`, `field_two`) SELECT `tableB`.`field_one`, `tableB`.`field_two` FROM `tableB` WHERE `tableB`.clmn <> 'someValue' ORDER BY `tableB`.`sorting_clmn`; You can...
Vim macros can also be recursive. This is useful for when you need to act on every line (or other text object) till the end of the file. To record a recursive macro, start with an empty register. (A register can be emptied using q<register>q.) Choose a consistent starting point on each line ...
To hide the blinking caret, you need to override caretRectForPosition of a UITextField and return CGRectZero. Swift 2.3 < public override func caretRectForPosition(position: UITextPosition) -> CGRect { return CGRectZero } Swift 3 override func caretRect(for position: UITextPositio...
We can change the style of the placeholder by setting attributedPlaceholder (a NSAttributedString). var placeholderAttributes = [String: AnyObject]() placeholderAttributes[NSForegroundColorAttributeName] = color placeholderAttributes[NSFontAttributeName] = font if let placeholder = textField.p...
If you need to clean the build: ndk-build clean
Reflection is useful but fragile. Consider this: let mi = typeof<System.String>.GetMethod "StartsWith" The problems with this kind of code are: The code doesn't work because there are several overloads of String.StartsWith Even if there wouldn't be any overloads right now la...
Starting a File Chooser Activity public void showFileChooser() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); // Update with mime types intent.setType("*/*"); // Update with additional mime types here using a String[]. intent.putExtra(Intent.EXTRA_M...
Here is a basic example form with one required text field and one submit button, which submits to a custom function: class Page_Controller extends ContentController { private static $allowed_actions = array( 'ExampleForm' ); public function ExampleForm() { $fiel...
os.mkdir('newdir') If you need to specify permissions, you can use the optional mode argument: os.mkdir('newdir', mode=0700)
Use the os.getcwd() function: print(os.getcwd())
Remove the directory at path: os.rmdir(path) You should not use os.remove() to remove a directory. That function is for files and using it on directories will result in an OSError
os.chmod(path, mode) where mode is the desired permission, in octal.
Create a DATABASE. Note that the shortened word SCHEMA can be used as a synonym. CREATE DATABASE Baseball; -- creates a database named Baseball If the database already exists, Error 1007 is returned. To get around this error, try: CREATE DATABASE IF NOT EXISTS Baseball; Similarly, DROP DATA...
A lambda closure is created when a lambda expression references the variables of an enclosing scope (global or local). The rules for doing this are the same as those for inline methods and anonymous classes. Local variables from an enclosing scope that are used within a lambda have to be final. Wit...
All constructors in Java must make a call to the Object constructor. This is done with the call super(). This has to be the first line in a constructor. The reason for this is so that the object can actually be created on the heap before any additional initialization is performed. If you do not spe...
Arrays can be compared for equality with the aptly named isEqualToArray: method, which returns YES when both arrays have the same number of elements and every pair pass an isEqual: comparison. NSArray *germanMakes = @[@"Mercedes-Benz", @"BMW", @"Porsche", ...
The AUROC is one of the most commonly used metric to evaluate a classifier's performances. This section explains how to compute it. AUC (Area Under the Curve) is used most of the time to mean AUROC, which is a bad practice as AUC is ambiguous (could be any curve) while AUROC is not. Overview – Abb...
SELECT is used to retrieve rows of data from a table. You can specify which columns will be retrieved: SELECT Name, Position FROM Employees; Or just use * to get all columns: SELECT * FROM Employees;

Page 346 of 826