Tutorial by Examples: co

The json_encode function will convert a PHP array (or, since PHP 5.4, an object which implements the JsonSerializable interface) to a JSON-encoded string. It returns a JSON-encoded string on success or FALSE on failure. $array = [ 'name' => 'Jeff', 'age' => 20, 'active' => ...
In this example, we can use GROUP BY not only determined the sort of the rows returned, but also what rows are returned, since we're using TOP to limit the result set. Let's say we want to return the top 5 highest reputation users from an unnamed popular Q&A site. Without ORDER BY This query ...
#include <stdio.h> #include <string.h> int main(void) { /* Always ensure that your string is large enough to contain the characters * and a terminating NUL character ('\0')! */ char mystring[10]; /* Copy "foo" into `mystring`, until a NUL character is en...
The strcase*-functions are not Standard C, but a POSIX extension. The strcmp function lexicographically compare two null-terminated character arrays. The functions return a negative value if the first argument appears before the second in lexicographical order, zero if they compare equal, or positi...
Let's say you want to generate counts or subtotals for a given value in a column. Given this table, "Westerosians": NameGreatHouseAllegienceAryaStarkCerceiLannisterMyrcellaLannisterYaraGreyjoyCatelynStarkSansaStark Without GROUP BY, COUNT will simply return a total number of rows: SELE...
Syntax for accessing rows and columns: [, [[, and $ This topic covers the most common syntax to access specific rows and columns of a data frame. These are Like a matrix with single brackets data[rows, columns] Using row and column numbers Using column (and row) names Like a list: Wi...
To use an accordion, one must have headers and content inside the headers in their HTML. Then one must instantiate the accordion() method of jQuery UI. <script> $(function() { $( "#accordion" ).accordion(); }); </script> In the HTML: <div id="accordion&quot...
$( "#accordion" ).accordion( "destroy" ); This will remove the accordion functionality completely and show default HTML removing all the jQuery-UI elements. This method does not take any arguments.
$( "#accordion" ).accordion( "disable" ); This method will disable the accordion, i.e. the headers are not selectable making the content read only and static. This method does not take any arguments.
$( "#accordion" ).accordion( "enable" ); This method will enable an accordion. This will enable a disabled accordion or simply do nothing on an already enabled accordion. This method does not take any arguments.
var options = $( "#accordion" ).accordion( "option" ); This will return a PlainObject giving all the options representing the selected accordion. This will contain all the values of the keys that are explained in the Parameters section. This method takes parameters which are ...
$( "#accordion" ).accordion( "refresh" ); This method recomputes the height of the accordion panels if headers or content was added or removed in the DOM.
var widget = $( "#accordion" ).accordion( "widget" ); This method returns a jQuery object containing the accordion.
The Basics The simplist way to convert one date format into another is to use strtotime() with date(). strtotime() will convert the date into a Unix Timestamp. That Unix Timestamp can then be passed to date() to convert it to the new format. $timestamp = strtotime('2008-07-01T22:35:17.02'); $new_...
Given some JSON file "foo.json" like: {"foo": {"bar": {"baz": 1}}} we can call the module directly from the command line (passing the filename as an argument) to pretty-print it: $ python -m json.tool foo.json { "foo": { "bar...
Number('0') === 0 Number('0') will convert the string ('0') into a number (0) A shorter, but less clear, form: +'0' === 0 The unary + operator does nothing to numbers, but converts anything else to a number. Interestingly, +(-12) === -12. parseInt('0', 10) === 0 parseInt('0', 10) will c...
String(0) === '0' String(0) will convert the number (0) into a string ('0'). A shorter, but less clear, form: '' + 0 === '0'
In most environments, console.table() can be used to display objects and arrays in a tabular format. For example: console.table(['Hello', 'world']); displays like: (index)value0"Hello"1"world" console.table({foo: 'bar', bar: 'baz'}); displays like: (index)value"fo...
If you want to use a pipe character (|) in the content of a cell you'll need to escape it with a backslash. Column | Column ------ | ------ \| Cell \|| \| Cell \| This results in the following table: ColumnColumn| Cell || Cell |
When ASP.NET handles a request, a thread is assigned from the thread pool and a request context is created. The request context contains information about the current request which can be accessed through the static HttpContext.Current property. The request context for the request is then assigned t...

Page 13 of 248