Tutorial by Examples: st

implode() combines all the array values but looses all the key info: $arr = ['a' => "AA", 'b' => "BB", 'c' => "CC"]; echo implode(" ", $arr); // AA BB CC Imploding keys can be done using array_keys() call: $arr = ['a' => "AA", 'b'...
Html <img id="cats"></img> Dart import 'dart:html'; /// Stores the image in [blob] in the [ImageElement] of the given [selector]. void setImage(selector, blob) { FileReader reader = new FileReader(); reader.onLoad.listen((fe) { ImageElement image = document...
To store and retrieve encrypted credentials easily, use PowerShell's built-in XML serialization (Clixml): $credential = Get-Credential $credential | Export-CliXml -Path 'C:\My\Path\cred.xml' To re-import: $credential = Import-CliXml -Path 'C:\My\Path\cred.xml' The important thing to remem...
The dir() function can be used to get a list of the members of a class: dir(Class) For example: >>> dir(list) ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__...
Notice that packages can be installedThis command installs the newest available version of the named packages: both locally or globally. Local installation means that npm installs your package in the current working directory. Node modules go in ./node_modules, executables go in ./node_modules/.bi...
The trim() method returns a new String with the leading and trailing whitespace removed. String s = new String(" Hello World!! "); String t = s.trim(); // t = "Hello World!!" If you trim a String that doesn't have any whitespace to remove, you will be returned the same S...
To use Cython two things are needed.The Cython package itself, which contains the cython source-to-source compiler and Cython interfaces to several C and Python libraries (for example numpy). To compile the C code generated by the cython compiler, a C compiler is needed. Step 1: Installing Cython ...
See also the Mercurial Tutorial Creating a Mercurial Repository A Mercurial repository is simply a directory (referred to as the "working directory") containing an .hg directory with metadata about the contents of the repository. This makes Mercurial very lightweight and easy to start us...
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...
<?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 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); ...
val list = listOf(1,2,3,4,5,6) //filter out even numbers val even = list.filter { it % 2 == 0 } println(even) //returns [2,4]
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) (...
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" ...
Introduction JetBrains PhpStorm is a commercial, cross-platform IDE for PHP. It is built on JetBrains' IntelliJ IDEA platform, which is written in Java. It will thus run on all major operating systems that support Java. Users can extend the IDE by installing plugins created for the IntelliJ Platfo...
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...
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...

Page 102 of 369