Tutorial by Examples: ga

When using the interactive interpreter, you might want to reload a module. This can be useful if you're editing a module and want to import the newest version, or if you've monkey-patched an element of an existing module and want to revert your changes. Note that you can't just import the module ag...
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...
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", ...
using System; using System.Threading; using System.Threading.Tasks; class Program { static void Main( string[] args ) { object sync = new object(); int sum = 0; Parallel.For( 1, 1000, ( i ) => { lock( sync ) sum = sum + i; // lock is necessa...
Using the Library Database, we try to find the last book added to the database for each author. For this simple example we assume an always incrementing Id for each record added. SELECT MostRecentBook.Name, MostRecentBook.Title FROM ( SELECT Authors.Name, Books.Title, ...
As of Qt 5.1 and later you can use QQmlApplicationEngine instead of QQuickView to load and render a QML script. With QQmlApplicationEngine you do need to use a QML Window type as your root element. You can obtain the root context from the engine where you can then add global properties to the cont...
class ClassWithAReallyLongName { public: class Iterator { /* ... */ }; Iterator end(); }; Defining the member end with a trailing return type: auto ClassWithAReallyLongName::end() -> Iterator { return Iterator(); } Defining the member end without a trailing return type: Clas...
Navigation Drawers are used to navigate to top-level destinations in an app. Make sure that you have added design support library in your build.gradle file under dependencies: dependencies { // ... compile 'com.android.support:design:25.3.1' } Next, add the DrawerLayout and Navigati...
Given the following XML document: <documentation> <tags> <tag name="Java"> <topic name="Regular expressions"> <example>Matching groups</example> <example>Escaping metacharacter...
Sometimes specific instances of data should be used. Recreation is not desired and referencing static data would have a code smell. It is possible to specify a XmlAdapter instance the Unmarshaller should use, which allows the user to use XmlAdapters with no zero-arg constructor and/or pass data to ...
In Java, it's too "easy" to create many String instances which are not needed. That and other reasons might cause your program to have lots of Strings that the GC is busy cleaning up. Some ways you might be creating String instances: myString += "foo"; Or worse, in a loop or...
If you just want to get data, but not modify anything, you can turn off change tracking and proxy creation. This will improve your performance and also prevent lazy loading. Bad Example: using(var context = new Context()) { return await context.Set<MyEntity>().ToListAsync().ConfigureAw...
--- person_table: - &person001 fname: homer lname: simpson role: dad age: 33 - &person002 fname: marge lname: simpson role: mom age: 34 - &person003 fname: pe...
bookmarks, bookmark: create a new bookmark or list existing bookmarks branch: set or show the current branch name tag: add one or more tags for the current or given revision update, up, checkout, co: update working directory (or switch revisions)
var MY_AJAX_ACTION_URL = "path/to/controller.php"; var table = $('#user_list_table').DataTable({ "autoWidth": true, "paging": true, "searching": true, "ordering": true, "language": { ...
The Collection object implements the ArrayAccess and IteratorAggregate interface, allowing it to be used like an array. Access collection element: $collection = collect([1, 2, 3]); $result = $collection[1]; Result: 2 Assign new element: $collection = collect([1, 2, 3]); $collection[] = ...
Just run: svn delete https://svn.example.com/svn/MyRepo/MyProject/branches/MyNewBranch -m "Deleting no longer needed MyNewBranch" Or, using the short URL: svn delete ^/branches/MyNewBranch -m "Deleting no longer needed MyNewBranch" In Windows, you need to use ^^ You ...
A sprite sheet by definition is a bitmap that contains a certain animation. Old games use grid type sprite sheet, that is, every frame occupies an equal region, and frames are aligned by the edges to form a rectangle, probably with some spaces unoccupied. Later, in order to minimize the bitmap size,...
reduce(_:combine:) can be used in order to combine the elements of a sequence into a single value. It takes an initial value for the result, as well as a closure to apply to each element – which will return the new accumulated value. For example, we can use it to sum an array of numbers: let numbe...

Page 66 of 137