Tutorial by Examples: dc

Consider the case of creating a nested list structure by multiplying: li = [[]] * 3 print(li) # Out: [[], [], []] At first glance we would think we have a list of containing 3 different nested lists. Let's try to append 1 to the first one: li[0].append(1) print(li) # Out: [[1], [1], [1]] ...
Any time SQL executed through an ADO connection needs to contain user input, it is considered best practice to parameterize it in order to minimize the chance of SQL injection. This method is also more readable than long concatenations and facilitates more robust and maintainable code (i.e. by using...
The following example utilizes the tm text mining package to scrape and mine text data from the web to build word clouds with symbolic shading and ordering. require(RWeka) require(tau) require(tm) require(tm.plugin.webmining) require(wordcloud) # Scrape Google Finance -----------------------...
Dim lineOfHyphens As String 'Assign a string with 80 repeated hyphens lineOfHyphens = String$(80, "-")
You can reload the current state using the $state.reload method from your controller $state.reload() This is a shorthand for (code taken from the official docs) $state.transitionTo($state.current, $stateParams, { reload: true, inherit: false, notify: false }); Running a reload on your ...
Constants in Go may be typed or untyped. For instance, given the following string literal: "bar" one might say that the type of the literal is string, however, this is not semantically correct. Instead, literals are Untyped string constants. It is a string (more correctly, its default ...
The year, month or day components of a DATE data type can be found using the EXTRACT( [ YEAR | MONTH | DAY ] FROM datevalue ) SELECT EXTRACT (YEAR FROM DATE '2016-07-25') AS YEAR, EXTRACT (MONTH FROM DATE '2016-07-25') AS MONTH, EXTRACT (DAY FROM DATE '2016-07-25') AS DAY FROM D...
There are a few changes where instant won't do its trick and a full build and reinstall fo your app will happen just like it used to happen before Instant Run was born. Change the app manifest Change resources referenced by the app manifest Change an Android widget UI element (requires a Clean ...
Java provides a conditional-and and a conditional-or operator, that both take one or two operands of type boolean and produce a boolean result. These are: && - the conditional-AND operator, || - the conditional-OR operators. The evaluation of <left-expr> && <righ...
A typeglob *foo holds references to the contents of global variables with that name: $foo, @foo, $foo, &foo, etc. You can access it like an hash and assign to manipulate the symbol tables directly (evil!). use v5.10; # necessary for say our $foo = "foo"; our $bar; say ref *foo{SCAL...
wildcard characters are used with the SQL LIKE operator. SQL wildcards are used to search for data within a table. Wildcards in SQL are:%, _, [charlist], [^charlist] % - A substitute for zero or more characters Eg: //selects all customers with a City starting with "Lo" SEL...
It is good practice to test the calling program's __name__ variable before executing your code. import sys def main(): # Your code starts here # Don't forget to provide a return code return 0 if __name__ == "__main__": sys.exit(main()) Using this pattern ens...
With the power of regex comes great responsibility.... db.posts.find({'text': /.*foo.*|.*bar.*/i})
In order to use libraries in CodeIgniter, you need to create a library. class Pro { function show_hello_world() { return 'Hello World'; } } In this library, which is called is pro.php, this file must be added to the following path. Path: \xampp\htdocs\project\application\librarie...
Example demonstrates component composition and one-way message passing from parent to children. 0.18.0 Component composition relies on Message tagging with Html.App.map 0.18.0 In 0.18.0 HTML.App was collapsed into HTML Component composition relies on Message tagging with Html.map Example ...
{-# LANGUAGE RecordWildCards #-} data Client = Client { firstName :: String , lastName :: String , clientID :: String } deriving (Show) printClientName :: Client -> IO () printClientName Client{..} = do p...
.SD .SD refers to the subset of the data.table for each group, excluding all columns used in by. .SD along with lapply can be used to apply any function to multiple columns by group in a data.table We will continue using the same built-in dataset, mtcars: mtcars = data.table(mtcars) # Let's not ...
You first need to run a Stanford CoreNLP server: java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 50000 Here is a code snippet showing how to pass data to the Stanford CoreNLP server, using the pycorenlp Python package. from pycorenlp import Stanf...
The word count program is like the "Hello World" program in MapReduce. Hadoop MapReduce is a software framework for easily writing applications which process vast amounts of data (multi-terabyte data-sets) in-parallel on large clusters (thousands of nodes) of commodity hardware in a relia...
Remember to npm install all the files into devDependencies first. E.g. npm install --save-dev gulp gulp-concat gulp-rename gulp-uglify gulp-uglifycss Gulpfile.js var gulp = require('gulp'); var gulp_concat = require('gulp-concat'); var gulp_rename = require('gulp-rename'); var gulp_uglify = ...

Page 11 of 28