Tutorial by Examples: basic

To get started with the jQuery UI library, you'll need to add the jQuery script, the jQuery UI script, and the jQuery UI stylesheet to your HTML. First, download jQuery UI; choose the features you need on the download page. Unzip your download, and put jquery-ui.css and jquery-ui.js (and jquery.js)...
Properties can be added to a class or struct (technically enums too, see "Computed Properties" example). These add values that associate with instances of classes/structs: class Dog { var name = "" } In the above case, instances of Dog have a property named name of type...
Output buffering allows you to store any textual content (Text, HTML) in a variable and send to the browser as one piece at the end of your script. By default, php sends your content as it interprets it. <?php // Turn on output buffering ob_start(); // Print some output to the buffer (via...
Using the threading module, a new thread of execution may be started by creating a new threading.Thread and assigning it a function to execute: import threading def foo(): print "Hello threading!" my_thread = threading.Thread(target=foo) The target parameter references the fun...
Every format type is related to an HTML tag. The First Heading refers to the <h1> tag and is visualized like: Hello World and it's written underlining the text with =: Hello World =========== or by prepending # to the text: # Hello World The Second Heading refers to the <h2&gt...
Using the following code with the format string yyyy/MM/dd hh:mm.ss, we will receive the following output 2016/04/19 11:45.36 // define the format to use String formatString = "yyyy/MM/dd hh:mm.ss"; // get a current date object Date date = Calendar.getInstance().getTime(); //...
At its simplest, a unit test consists of three stages: Prepare the environment for the test Execute the code to be tested Validate the expected behaviour matches the observed behaviour These three stages are often called 'Arrange-Act-Assert', or 'Given-When-Then'. Below is example in C# tha...
The datetime module contains three primary types of objects - date, time, and datetime. import datetime # Date object today = datetime.date.today() new_year = datetime.date(2017, 01, 01) #datetime.date(2017, 1, 1) # Time object noon = datetime.time(12, 0, 0) #datetime.time(12, 0) # Curr...
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...
A typical email has three main components: A recipient (represented as an email address) A subject A message body Sending mail in PHP can be as simple as calling the built-in function mail(). mail() takes up to five parameters but the first three are all that is required to send an email (al...
A positive lookahead (?=123) asserts the text is followed by the given pattern, without including the pattern in the match. Similarly, a positive lookbehind (?<=123) asserts the text is preceded by the given pattern. Replacing the = with ! negates the assertion. Input: 123456 123(?=456) mat...
The pipe operator, %>%, is used to insert an argument into a function. It is not a base feature of the language and can only be used after attaching a package that provides it, such as magrittr. The pipe operator takes the left-hand side (LHS) of the pipe and uses it as the first argument of the ...
A group is a section of a regular expression enclosed in parentheses (). This is commonly called "sub-expression" and serves two purposes: It makes the sub-expression atomic, i.e. it will either match, fail or repeat as a whole. The portion of text it matched is accessible in the remai...
Before publishing a package you have to version it. npm supports semantic versioning, this means there are patch, minor and major releases. For example, if your package is at version 1.2.3 to change version you have to: patch release: npm version patch => 1.2.4 minor release: npm version min...
for (x <- 1 to 10) println("Iteration number " + x) This demonstrates iterating a variable, x, from 1 to 10 and doing something with that value. The return type of this for comprehension is Unit.
This demonstrates a filter on a for-loop, and the use of yield to create a 'sequence comprehension': for ( x <- 1 to 10 if x % 2 == 0) yield x The output for this is: scala.collection.immutable.IndexedSeq[Int] = Vector(2, 4, 6, 8, 10) A for comprehension is useful when you need to crea...
A CLOS class is described by: a name a list of superclasses a list of slots further options like documentation Each slot has: a name an initialization form (optional) an initialization argument (optional) a type (optional) a documentation string (optional) accessor, reader and/or wr...
Go is a statically typed language, meaning you generally have to declare the type of the variables you are using. // Basic variable declaration. Declares a variable of type specified on the right. // The variable is initialized to the zero value of the respective type. var x int var s string va...
The first two arguments to format are an output stream and a control string. Basic use does not require additional arguments. Passing t as the stream writes to *standard-output*. > (format t "Basic Message") Basic Message nil That expression will write Basic Message to standard ou...
A ViewPager allows to show multiple fragments in an activity that can be navigated by either fliping left or right. A ViewPager needs to be feed of either Views or Fragments by using a PagerAdapter. There are however two more specific implementations that you will find most useful in case of using ...

Page 4 of 43