Tutorial by Examples: c

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...
A CSS rule consists of a selector (e.g. h1) and declaration block ({}). h1 {}
This example shows how to create a table, insert data, and select from the database using the SQLAlchemy ORM. For information re: SQLAlchemy Core, see here. First things first, we need to connect to our database, which is identical to how we would connect using SQLAlchemy Core (Core). from sqlalch...
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...
Icicle uses Awaitables and Generators to create Coroutines. require __DIR__ . '/vendor/autoload.php'; use Icicle\Awaitable; use Icicle\Coroutine\Coroutine; use Icicle\Loop; $generator = function (float $time) { try { // Sets $start to the value returned by microtime() after ap...
A common refrain in R goes along these lines: You should not have a bunch of related tables with names like DT1, DT2, ..., DT11. Iteratively reading and assigning to objects by name is messy. The solution is a list of tables of data! Such a list looks like set.seed(1) DT_list = lapply(setNam...
Unzipping a zip archive is done with unzip function from the utils package (which is included in base R). unzip(zipfile = "bar.zip", exdir = "./foo") This will extract all files in "bar.zip" to the "foo" directory, which will be created if necessary. Tilde...
Listing files in a zip archive is done with unzip function from the utils package (which is included in base R). unzip(zipfile = "bar.zip", list = TRUE) This will list all files in "bar.zip" and extract none. Tilde expansion is done automatically from your working directory. ...
Listing files in a tar archive is done with untar function from the utils package (which is included in base R). untar(zipfile = "bar.tar", list = TRUE) This will list all files in "bar.tar" and extract none. Tilde expansion is done automatically from your working directory. ...
Extracting files from a tar archive is done with untar function from the utils package (which is included in base R). untar(tarfile = "bar.tar", exdir = "./foo") This will extract all files in "bar.tar" to the "foo" directory, which will be created if nece...
Iterators produce enumerators. In C#, enumerators are produced by defining methods, properties or indexers that contain yield statements. Most methods will return control to their caller through normal return statements, which disposes all state local to that method. In contrast, methods that use y...
Codeigniter may be configured to run more than one project without duplicating CI core files. It's possible by splitting CI Application side. For example let's take project of website, which contains front-end and back-end Content Management System (CMS) applications. In this case CI folder struct...
When defining themes, one usually uses the theme provided by the system, and then changes modifies the look to fit his own application. For example, this is how the Theme.AppCompat theme is inherited: <style name="AppTheme" parent="Theme.AppCompat"> <item name=&quo...
https://github.com/jaymedavis/stripe.net is a great starting point. Assuming you are using MVC w/Razor you need to have a few things in your View page <script type="text/javascript" src="https://js.stripe.com/v2/"></script> This script calls upon the stripe.js t...
It's good practice to complete your AssemblyInfo's default fields. The information may be picked up by installers and will then appear when using Programs and Features (Windows 10) to uninstall or change a program. The minimum should be: AssemblyTitle - usually the namespace, i.e. MyCompany.MySo...
A higher-order function is one that takes another function as an argument or returns a function (or both). This is commonly done with lambdas, for example when passing a predicate to a LINQ Where clause: var results = data.Where(p => p.Items == 0); The Where() clause could receive many diffe...
This example shows how a MongoDB collection can be displayed in a React component. The collection is continuously synchronized between server and client, and the page instantly updates as database contents change. To connect React components and Meteor collections, you'll need the react-meteor-data...

Page 362 of 826