Tutorial by Examples: sin

The foreach package brings the power of parallel processing to R. But before you want to use multi core CPUs you have to assign a multi core cluster. The doSNOW package is one possibility. A simple use of the foreach loop is to calculate the sum of the square root and the square of all numbers from...
Create a DataFrame of random numbers: import numpy as np import pandas as pd # Set the seed for a reproducible sample np.random.seed(0) df = pd.DataFrame(np.random.randn(5, 3), columns=list('ABC')) print(df) # Output: # A B C # 0 1.764052 0.400157 0.9787...
Single line comments are preceded by --, and go until the end of the line: SELECT * FROM Employees -- this is a comment WHERE FName = 'John'
Creating a DB and a Table DROP DATABASE IF EXISTS books_db; CREATE DATABASE books_db WITH ENCODING='UTF8' TEMPLATE template0; DROP TABLE IF EXISTS books; CREATE TABLE books ( id SERIAL PRIMARY KEY, client TEXT NOT NULL, data JSONb NOT NULL ); Populating the DB INSERT INTO books...
You can use subqueries to define a temporary table and use it in the FROM clause of an "outer" query. SELECT * FROM (SELECT city, temp_hi - temp_lo AS temp_var FROM weather) AS w WHERE temp_var > 20; The above finds cities from the weather table whose daily temperature variation i...
The following example finds cities (from the cities example) whose population is below the average temperature (obtained via a sub-qquery): SELECT name, pop2000 FROM cities WHERE pop2000 < (SELECT avg(pop2000) FROM cities); Here: the subquery (SELECT avg(pop2000) FROM cities) is used to s...
Subqueries can also be used in the SELECT part of the outer query. The following query shows all weather table columns with the corresponding states from the cities table. SELECT w.*, (SELECT c.state FROM cities AS c WHERE c.name = w.city ) AS state FROM weather AS w;
One (or two) of the coolest new features in recent Xcode releases are the IBInspectable properties and IBDesignable UIViews. These have nothing to do with the functionality of your application but instead impact the developer experience in Xcode. The goal is to be able to visually inspect custom v...
You can specify a column that contains dates so pandas would automatically parse them when reading from the csv pandas.read_csv('data_file.csv', parse_dates=['date_column'])
This example demonstrates that HTTP is a text-based Internet communications protocol, and shows a basic HTTP request and the corresponding HTTP response. You can use Telnet to manually send a minimal HTTP request from the command line, as follows. Start a Telnet session to the web server www.e...
/* This is a CSS comment */ div { color: red; /* This is a CSS comment */ }
{ "some_string": null, "ather_string": "something" } If we will use this way: JSONObject json = new JSONObject(jsonStr); String someString = json.optString("some_string"); We will have output: someString = "null"; So we need to...
A <clip-path> defines a shape which acts as a window, only allowing parts of a <path> to show if they are within the <clip-path> shape and cutting off the rest. <vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.an...
Given the following CSV file: Id,Name 1,"Joel" 2,"Adam" 3,"Ryan" 4,"Matt" You can read the data with the following script: #r "FSharp.Data.dll" open FSharp.Data type PeopleDB = CsvProvider<"people.csv"> let people = Pe...
BEGIN UPDATE Employees SET PhoneNumber = '5551234567' WHERE Id = 1; UPDATE Employees SET Salary = 650 WHERE Id = 3; END
def minus(left: Int, right: Int) = left - right val numberMinus5 = minus(_: Int, 5) val fiveMinusNumber = minus(5, _: Int) numberMinus5(7) // 2 fiveMinusNumber(7) // -2
This demonstrates how to print each element of a Map val map = Map(1 -> "a", 2 -> "b") for (number <- map) println(number) // prints (1,a), (2,b) for ((key, value) <- map) println(value) // prints a, b This demonstrates how to print each element of a list val l...
The Scala compiler will automatically convert methods into function values for the purpose of passing them into higher-order functions. object MyObject { def mapMethod(input: Int): String = { int.toString } } Seq(1, 2, 3).map(MyObject.mapMethod) // Seq("1", "2", &...
Use pinvoke.net. Before declaring an extern Windows API function in your code, consider looking for it on pinvoke.net. They most likely already have a suitable declaration with all supporting types and good examples.
DATA begda TYPE sy-datum.

Page 23 of 161