Tutorial by Examples: and

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...
Fragments also have a onSaveInstanceState() method which is called when their state needs to be saved: public class MySimpleFragment extends Fragment { private int someStateValue; private final String SOME_VALUE_KEY = "someValueToSave"; // Fires when a configuration ch...
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...
There are some functions to help tear down Free computations by interpreting them into another monad m: iterM :: (Functor f, Monad m) => (f (m a) -> m a) -> (Free f a -> m a) and foldFree :: Monad m => (forall x. f x -> m x) -> (Free f a -> m a). What are they doing? First l...
There are two possible ways of including LaTeX preamble commands (e.g. \usepackage) in a RMarkdown document. 1. Using the YAML option header-includes: --- title: "Including LaTeX Preample Commands in RMarkdown" header-includes: - \renewcommand{\familydefault}{cmss} - \usepacka...
page.html - source code <html> <head> <script src="loadData.js"></script> </head> <body onLoad="loadData()"> <div class="container"> <table id="data" border="1"> <...
Now we want to install nginx to serve our application. sudo apt-get install nginx # on debian/ubuntu Then we create a configuration for our website cd /etc/nginx/site-available # go to the configuration for available sites # create a file flaskconfig with your favourite editor flaskconfig...
#!/bin/bash FILENAME="/etc/passwd" while IFS=: read -r username password userid groupid comment homedir cmdshell do echo "$username, $userid, $comment $homedir" done < $FILENAME In unix password file, user information is stored line by line, each line consisting of i...
In Object Oriented Programming a common task is to compose objects (values). In Functional Programming it is as common task to compose values as well as functions. We are used to compose values from our experience of other programming languages using operators like +, -, *, / and so on. Value co...
Pooling provides a higher level abstraction of the Worker functionality, including the management of references in the way required by pthreads. From: http://php.net/manual/en/class.pool.php Pools and workers provide an higher level of control and ease of creating multi-threaded <?php // T...
Audio stream types There are different profiles of ringtone streams. Each one of them has it's different volume. Every example here is written for AudioManager.STREAM_RING stream type. However this is not the only one. The available stream types are: STREAM_ALARM STREAM_DTMF STREAM_MUSIC STR...
Iterator methods can be broken into two distinct groups: Adapters Adapters take an iterator and return another iterator // Iterator Adapter // | | let my_map = (1..6).map(|x| x * x); println!("{:?}", my_map); Output Map { iter: 1..6 } Note that the v...
If you want to remove calls to certain methods, assuming they return void and have no side affects (as in, calling them doesn't change any system values, reference arguments, statics, etc.) then you can have ProGuard remove them from the output after the build is complete. For example, I find this ...
For functions that need to take a collection of objects, slices are usually a good choice: fn work_on_bytes(slice: &[u8]) {} Because Vec<T> and arrays [T; N] implement Deref<Target=[T]>, they can be easily coerced to a slice: let vec = Vec::new(); work_on_bytes(&vec); le...
The following output equivalent results: class IfElseExample { public string DebugToString(object a) { if (a is StringBuilder) { return DebugToStringInternal(a as StringBuilder); } else if (a is List<string>) { ...
This example portrays the most simple ALV creation using the cl_salv_table class and no additional formatting options. Additional formatting options would be included after the TRY ENDTRY block and before the alv->display( ) method call. All subsequent examples using the ABAP Objects approach to...
Suppose you have a parentView into which you want to insert a new subView programmatically (eg. when you want to insert an UIImageView into a UIViewController's view), than you can do it as below. Objective-C [parentView addSubview:subView]; Swift parentView.addSubview(subView) You can also...
The following are some of the more common/useful shortcuts. These are based on the default IntelliJ shortcut map. You can switch to other common IDE shortcut maps via File -> Settings -> Keymap -> <Choose Eclipse/Visual Studio/etc from Keymaps dropdown> ActionShortcutFormat codeCTRL...
Enable Offline Work: Click File -> Settings. Search for "gradle" and click in Offline work box. Go to Compiler (in same settings dialog just below Gradle) and add --offline to Command-line Options text box. Improve Gradle Performance Add following two line of code in your gradle...
System Requirements Microsoft® Windows® 8/7/Vista/2003 (32 or 64-bit). Mac® OS X® 10.8.5 or higher, up to 10.9 (Mavericks) GNOME or KDE desktop Installation Window Download and install JDK (Java Development Kit) version 8 Download Android Studio Launch Android Studio.exe then mention J...

Page 71 of 153