Tutorial by Examples: n

We request that the Chef community not use this StackOverflow documentation feature. Docs managed via wiki (or community editing in general) tend to rot very quickly and are of poor quality. We've all experienced the sense of dread when searching for an answer on Google and getting back a half-unrea...
For immutable elements (e.g. None, string literals etc.): my_list = [None] * 10 my_list = ['test'] * 10 For mutable elements, the same construct will result in all elements of the list referring to the same object, for example, for a set: >>> my_list=[{1}] * 10 >>> print(my_...
General syntax: DATEADD (datepart , number , datetime_expr) To add a time measure, the number must be positive. To subtract a time measure, the number must be negative. Examples DECLARE @now DATETIME2 = GETDATE(); SELECT @now; --2016-07-21 14:39:46.4170000 SELECT DAT...
These are the datepart values available to date & time functions: datepartAbbreviationsyearyy, yyyyquarterqq, qmonthmm, mdayofyeardy, ydaydd, dweekwk, wwweekdaydw, whourhhminutemi, nsecondss, smillisecondmsmicrosecondmcsnanosecondns NOTE: Use of abbreviations is generally discouraged as they c...
General syntax: DATEDIFF (datepart, datetime_expr1, datetime_expr2) It will return a positive number if datetime_expr is in the past relative to datetime_expr2, and a negative number otherwise. Examples DECLARE @now DATETIME2 = GETDATE(); DECLARE @oneYearAgo DATETIME2 = DATEADD(YEAR, -1, @now...
DATEPART returns the specified datepart of the specified datetime expression as a numeric value. DATENAME returns a character string that represents the specified datepart of the specified date. In practice DATENAME is mostly useful for getting the name of the month or the day of the week. There a...
Using the DATEADD and DATEDIFF functions, it's possible to return the last date of a month. SELECT DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, '2016-09-23') + 1, 0)) -- 2016-09-30 00:00:00.000 SQL Server 2012 The EOMONTH function provides a more concise way to return the last date of a month, and...
Sometimes when destructuring maps, you would like to bind the destructured values to their respective key name. Depending on the granularity of the data structure, using the standard destructuring scheme may be a little bit verbose. Let's say, we have a map based record like so : (def john {:lastn...
One approach that is employed often is to use bootstrap's gridded framework in order to define the area that the chart will exist in. Using this in conjunction with clientWidth variable and the window.onresize event, it is very easy to create responsive d3 SVGs. Let's first create a row and a colum...
A CSS rule consists of a selector (e.g. h1) and declaration block ({}). h1 {}
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles_and_scripts' ); /** * Enqueue styles (or scripts) conditionally. * * Load stylesheets (or scripts) specifically for IE. IE10 and above does * not support conditional comments in standards mode. * * @link https://gist.github.com/wpsc...
@media print { p { page-break-inside: avoid; } h1 { page-break-before: always; } h2 { page-break-after: avoid; } } This code does 3 things: it prevents a page break inside any p tags, meaning a paragraph will never be broken in two pages, if possible. it for...
The most basic instance of an if construct evaluates a condition and executes some code according to the condition outcome. If the condition returns true, the code within the conditional is executed. counter = 10 if counter is 10 console.log 'This will be executed!' The if construct can be e...
To start using Spring data JPA, you must include the dependency in your project with the one of Spring core, all together. If you're using Maven as dependency management system (replace version-number for the version you want to use): <dependencies> <dependency> <groupI...
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles_and_scripts' ); /** * Enqueue scripts (or styles) conditionally. * * Load scripts (or stylesheets) specifically for IE. IE10 and above does * not support conditional comments in standards mode. * * @link https://gist.github.com/wpsc...
Mysql has its EVENT functionality for avoiding complicated cron interactions when much of what you are scheduling is SQL related, and less file related. See the Manual page here. Think of Events as Stored Procedures that are scheduled to run on recurring intervals. To save time in debugging Event-r...
An array column is supported by PostgreSQL. Rails will automatically convert a PostgreSQL array to a Ruby array, and vice-versa. Create a table with an array column: create_table :products do |t| t.string :name t.text :colors, array: true, default: [] end Add an array column to an existi...
Make sure your tomcat configurations file, server.xml has this line: <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" maxHttpHeaderSize="8192" SSLEnabled="true" maxThreads="150" minSpareThrea...
PHP 5.5 introduces Generators and the yield keyword, which allows us to write asynchronous code that looks more like synchronous code. The yield expression is responsible for giving control back to the calling code and providing a point of resumption at that place. One can send a value along the yi...

Page 474 of 1088