Tutorial by Examples

YAML provides a way to store structured data. The data can be a simple set of name-value pairs or a complex hierarchical data with values even being arrays. Consider the following YAML file: database: driver: mysql host: database.mydomain.com port: 3306 db_name: sample_db ...
General log - all queries - see VARIABLE general_log Slow log - queries slower than long_query_time - slow_query_log_file Binlog - for replication and backup - log_bin_basename Relay log - also for replication general errors - mysqld.err start/stop - mysql.log (not very interesting) - log_err...
How to use conditional execution of command lists Any builtin command, expression, or function, as well as any external command or script can be executed conditionally using the &&(and) and ||(or) operators. For example, this will only print the current directory if the cd command was succ...
First, you need to install django-debug-toolbar: pip install django-debug-toolbar settings.py: Next, include it to project's installed apps, but be careful - it's always a good practice to use a different settings.py file for such development-only apps and middlewares as debug toolbar: # If en...
Lists def lst = ['foo', 'bar', 'baz'] // using implicit argument lst.each { println it } // using explicit argument lst.each { val -> println val } // both print: // foo // bar // baz Iterate with index def lst = ['foo', 'bar', 'baz'] // explicit arguments are required lst.each...
def lst = ['foo', 'bar', 'baz'] lst.collect { it } // ['foo', 'bar', 'baz'] lst.collect { it.toUpperCase() } // ['FOO', 'BAR', 'BAZ'] To collect keys or values from a maps def map = [foo: 'FOO', bar: 'BAR', baz: 'BAZ'] def keys = map.collect { it.key } // ['foo', 'bar', 'baz'] def vals = m...
def lst = [10, 20, 30, 40] lst.findAll { it > 25 } // [30, 40]
def lst = [10, 20, 30, 40] lst.find { it > 25 } // 30. Note: it returns a single value
From lists def lst = ['foo', 'bar', 'baz'] // for each entry return a list containing [key, value] lst.collectEntries { [it, it.toUpperCase()] } // [foo: FOO, bar: BAR, baz: BAZ] // another option, return a map containing the single entry lst.collectEntries { [(it): it.toUpperCase()] } // [...
Apply the transformation to non-collection entries, delving into nested collections too and preserving the whole structure. def lst = ['foo', 'bar', ['inner_foo', 'inner_bar']] lst.collectNested { it.toUpperCase() } // [FOO, BAR, [INNER_FOO, INNER_BAR]]
def lst = ['foo', 'bar', ['inner_foo', 'inner_bar']] lst.flatten() ​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​...
def lst = ['foo', 'foo', 'bar', 'baz'] // *modifies* the list removing duplicate items lst.unique() // [foo, bar, baz] // setting to false the "mutate" argument returns a new list, leaving the original intact lst.unique(false) // [foo, bar, baz] // convert the list to a Set, thu...
The Slow Query Log consists of log events for queries taking up to long_query_time seconds to finish. For instance, up to 10 seconds to complete. To see the time threshold currently set, issue the following: SELECT @@long_query_time; +-------------------+ | @@long_query_time | +-----------------...
WebRTC is an open framework for the web that enables Real Time Communications in the browser. It includes the fundamental building blocks for high-quality communications on the web, such as network, audio and video components used in voice and video chat applications. These components, when impleme...
# operator or stringizing operator is used to convert a Macro parameter to a string literal. It can only be used with the Macros having arguments. // preprocessor will convert the parameter x to the string literal x #define PRINT(x) printf(#x "\n") PRINT(This line will be converted to...
This is an example on how to use React Native's BackAndroid along with the Navigator. componentWillMount registers an event listener to handle the taps on the back button. It checks if there is another view in the history stack, and if there is one, it goes back -otherwise it keeps the default beha...
Here's a simple example that uses XSLT to convert data in an XML file into a table in an HTML file. You can use it to experiment with simple XSLT transforms. Prerequisite: Install a Java Runtime Environment and add the location of the JRE to your PATH variable. (On Windows, most installers will add...
class ImageExample extends Component { render() { return ( <View> <Image style={{width: 30, height: 30}} source={{uri: 'http://facebook.github.io/react/img/logo_og.png'}} /> </View> ); } }
You can start the remote debugging from Developer menu. After selecting the enable remote debugging it will open Google Chrome, So that you can log the output into your console. You can also write debugger syntax into your js code.
Prefix bitwise operators Bitwise operators are like logical operators but executed per bit rather than per boolean value. // bitwise NOT ~: sets all unset bits and unsets all set bits printf("%'06b", ~0b110110); // 001001 Bitmask-bitmask operators Bitwise AND &: a bit is set onl...

Page 701 of 1336