Tutorial by Examples: c

DESCRIBE and EXPLAIN are synonyms. DESCRIBE on a tablename returns the definition of the columns. DESCRIBE tablename; Exmple Result: COLUMN_NAME COLUMN_TYPE IS_NULLABLE COLUMN_KEY COLUMN_DEFAULT EXTRA id int(11) NO PRI 0 ...
android { ... defaultConfig {...} buildTypes {...} productFlavors { demo { applicationId "com.example.myapp.demo" versionName "1.0-demo" } full { applicationId "com.example.myapp.full"...
In this example, we have a Countries table. A table for countries has many uses, especially in Financial applications involving currencies and exchange rates. Live example: SQL fiddle Some Market data software applications like Bloomberg and Reuters require you to give their API either a 2 or 3 ch...
Options have some useful higher-order functions that can be easily understood by viewing options as collections with zero or one items - where None behaves like the empty collection, and Some(x) behaves like a collection with a single item, x. val option: Option[String] = ??? option.map(_.trim) ...
<?php /** * Panel: WPCustomize * * Basic Customizer panel with basic controls. * * @since 1.0.0 * @package WPC */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } // Customize function. if ( ! function_exists( 'wpc_panel_wpcustomize' ) ) { ...
Panels can have sections, sections can have settings, and settings can have controls. Settings are saved in the database, while the controls for particular settings are only used to display their corresponding setting to the user. This code creates a basic section in the panel from above. Inside a...
Add typings to your package.json { ... "typings": "path/file.d.ts" ... } Now when ever that library is imported typescript will load the typings file
Add the following code to functions.php to remove it from everyone except the Administrator user level: add_action('after_setup_theme', 'no_admin_bar'); function no_admin_bar() { if (!current_user_can('administrator') && !is_admin()) { show_admin_bar(false); ...
Data classes in kotlin are classes created to do nothing but hold data. Such classes are marked as data: data class User(var firstname: String, var lastname: String, var age: Int) The code above creates a User class with the following automatically generated: Getters and Setters for all prope...
Because a clack request is represented as a plist, we can use pattern matching as the entry point to the clack app as a way to route request to their appropriate controllers (defvar *app* (lambda (env) (match env ((plist :request-method :get :request-uri uri) (...
Using pattern matching one can intertwine function definition and pattern matching, similar to SML. (trivia:defun-match fib (index) "Return the corresponding term for INDEX." (0 1) (1 1) (index (+ (fib (1- index)) (fib (- index 2))))) (fib 5) ;; => 8
Rails is shipped by default with ActiveRecord, an ORM (Object Relational Mapping) derived from the pattern with the same name. As an ORM, it is built to handle relational-mapping, and more precisely by handling SQL requests for you, hence the limitation to SQL databases only. However, you can stil...
With the case statement you can match values against one variable. The argument passed to case is expanded and try to match against each patterns. If a match is found, the commands upto ;; are executed. case "$BASH_VERSION" in [34]*) echo {1..4} ;; *) seq -s" ...
This is a sample adapter code. public class SampleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private static final int FOOTER_VIEW = 1; // Define a view holder for Footer view public class FooterViewHolder extends ViewHolder { public FooterViewHolder(View ite...
Install a global package Globally installed packages drops modules in {prefix}/lib/node_modules, and puts executable files in {prefix}/bin, where {prefix} is usually something like /usr/local. Installing a global module means that its binaries end up in your PATH environment variable. Usually you'l...
The following are examples of how to install MIT/GNU Scheme: Debian/Ubuntu installation: sudo apt-get install mit-scheme Manual installation: Download the Unix binary directly from the GNU Project, then follow the instructions from the official webpage: # Unpack the tar file tar xzf mit-sche...
bc is an arbitrary precision calculator language. It could be used interactively or be executed from command line. For example, it can print out the result of an expression: echo '2 + 3' | bc 5 echo '12 / 5' | bc 2 For floating-post arithmetic, you can import standard library bc -l: echo ...
This example is a basic setup for unittesting the StringBuilder.toString() using junit. import static org.junit.Assert.assertEquals; import org.junit.Test; public class StringBuilderTest { @Test public void stringBuilderAppendShouldConcatinate() { StringBuilder stringBui...
Content has been moved back to good 'ol Servlets wiki page
Strategy: Strategy is a behavioural pattern, which allows to change the algorithm dynamically from a family of related algorithms. UML of Strategy pattern from Wikipedia : import java.util.*; /* Interface for Strategy */ interface OfferStrategy { public String getName(); public dou...

Page 231 of 826