Tutorial by Examples

With this declaration: fun Temporal.toIsoString(): String = DateTimeFormatter.ISO_INSTANT.format(this) You can now simply: val dateAsString = someInstant.toIsoString()
If you want to extend a class as-if you are a static function, for example for class Something add static looking function fromString, this can only work if the class has a companion object and that the extension function has been declared upon the companion object: class Something { compani...
Kotlin allows us to provide implementations for a predefined set of operators with fixed symbolic representation (like + or *) and fixed precedence. To implement an operator, we provide a member function or an extension function with a fixed name, for the corresponding type. Functions that overload ...
Taken from jQuery.ajax API web site: $.ajax({ method: "POST", url: "some.php", data: { name: "John", location: "Boston" }, success: function(msg) { alert("Data Saved: " + msg); }, error: ...
NumPy is available in the default repositories of most popular Linux distributions and can be installed in the same way that packages in a Linux distribution are usually installed. Some Linux distributions have different NumPy packages for Python 2.x and Python 3.x. In Ubuntu and Debian, install nu...
Custom routing provides specialized need of routing to handle specific incoming requests. In order to defining custom routes, keep in mind that the order of routes that you add to the route table is important. public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute(&qu...
For instance, two tables are given, T1 id x y 8 42 1.9 9 30 1.9 T2 id signal 8 55 8 56 8 59 9 57 9 58 9 60 The goal is to get the new table T3: id x y s1 s2 s3 8 42 1.9 55 ...
To get Unix Epoch Time, use the constant timeIntervalSince1970: Swift let date = NSDate() // current date let unixtime = date.timeIntervalSince1970 Objective-C NSDate *date = [NSDate date]; // current date int unixtime = [date timeIntervalSince1970];
Uppercase and lowercase letters of the alphabet are equivalent in the Fortran character set. In other words, Fortran is case insensitive. This behavior is in contrast with case-sensitive languages, such as C++ and many others. As a consequence, the variables a and A are the same variable. In princ...
import pandas as pd import numpy as np np.random.seed(0) # create an array of 5 dates starting at '2015-02-24', one per minute rng = pd.date_range('2015-02-24', periods=5, freq='T') df = pd.DataFrame({ 'Date': rng, 'Val': np.random.randn(len(rng)) }) print (df) # Output: # ...
import pandas as pd import numpy as np Using from_tuples: np.random.seed(0) tuples = list(zip(*[['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'], ['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']])) idx = pd...
Let's say we want to replace only numbers with 2 digits: regular expression will find them with (\d\d) SELECT REGEXP_REPLACE ('2, 5, and 10 are numbers in this example', '(\d\d)', '#') FROM dual; Results in: '2, 5, and # are numbers in this example' If I want to swap parts of the text, I us...
Let's say you have an object like this: var myObject = { name: 'Peter' } Later in your code, you try to access myObject.name and you get George instead of Peter. You start wondering who changed it and where exactly it was changed. There is a way to place a debugger (or something else) on e...
Use Nested Loops. Usage : use_nl(A B) This hint will ask the engine to use nested loop method to join the tables A and B. That is row by row comparison. The hint does not force the order of the join, just asks for NL. SELECT /*+use_nl(e d)*/ * FROM Employees E JOIN Departments D on E.Department...
"Use DIRECT PATH method for inserting new rows". The APPEND hint instructs the engine to use direct path load. This means that the engine will not use a conventional insert using memory structures and standard locks, but will write directly to the tablespace the data. Always creates new b...
Consider this simple example: import QtQuick 2.7 import QtQuick.Controls 2.0 ApplicationWindow { visible: true width: 400 height: 640 Rectangle{ id: rect anchors.centerIn: parent height: 100 width: parent.width color: "blue...
In the simple example, we simply set the width of the rectangle to that of it's parent. Let's consider a more complicated example: ApplicationWindow { visible: true width: 400 height: 640 Rectangle{ id: rect anchors.centerIn: parent height: 100 ...
Sample Data: CREATE TABLE table_name ( id, list ) AS SELECT 1, 'a,b,c,d' FROM DUAL UNION ALL -- Multiple items in the list SELECT 2, 'e' FROM DUAL UNION ALL -- Single item in the list SELECT 3, NULL FROM DUAL UNION ALL -- NULL list SELECT 4, 'f,,g' FROM DUAL; -- NULL item...
PL/SQL Function: CREATE OR REPLACE FUNCTION split_String( i_str IN VARCHAR2, i_delim IN VARCHAR2 DEFAULT ',' ) RETURN SYS.ODCIVARCHAR2LIST DETERMINISTIC AS p_result SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST(); p_start NUMBER(5) := 1; p_end NUMBER(5); ...
Sample Data: CREATE TABLE table_name ( id, list ) AS SELECT 1, 'a,b,c,d' FROM DUAL UNION ALL -- Multiple items in the list SELECT 2, 'e' FROM DUAL UNION ALL -- Single item in the list SELECT 3, NULL FROM DUAL UNION ALL -- NULL list SELECT 4, 'f,,g' FROM DUAL; -- NULL item...

Page 242 of 1336