Tutorial by Examples

Starting from a fresh installation of Codeigniter 3, here is a simple way to start with an Hello World application, to break the ice with this solid PHP framework. To do this you can start creating the view that we want to be shown for our Hello World app. We are going to put it in your applicatio...
Now we'll try going for a little more complex example, using the capabilities of the controller to fill in the view. Here is our view: /application/views/hello_world.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <titl...
Let's say that we want to have an alternative greeting that is accessible through a different URL. We might create a new function or even a new controller for that, but a best practice is to optimize what we already have, to make it work at it's best! To do this, we'll keep the same view as in the ...
public class Tag { public IList<string> Synonyms { get; set; } } Synonyms is a collection-type property. When the Tag object is created using object initializer syntax, Synonyms can also be initialized with collection initializer syntax: Tag t = new Tag { Synonyms = new List&...
Recursion is when a method calls itself. Preferably it will do so until a specific condition is met and then it will exit the method normally, returning to the point from which the method was called. If not, a stack overflow exception might occur due to too many recursive calls. /// <summary>...
To write the contents of a string to a file: Dim toWrite As String = "This will be written to the file." System.IO.File.WriteAllText("filename.txt", toWrite) WriteAllText will open the specified file, write the data, and then close the file. If the target file exists, it is ...
To read the contents to a file into a string variable: Dim fileContents As String = System.IO.File.ReadAllText("filename.txt") ReadAllText will open the specified file, read data to the end, then close the file. To read a file, separating it into an array element for each line: Dim f...
;; package.el is available since emacs 24 (require 'package) ;; Add melpa package source when using package list (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) ;; Load emacs packages and activate them ;; This must come before configurations o...
Routes in Flask can be defined using the route decorator of the Flask application instance: app = Flask(__name__) @app.route('/') def index(): return 'Hello Flask' The route decorator takes a string which is the URL to match. When a request for a URL that matches this string is receive...
UIGraphicsBeginPDFContextToFile(fileName, CGRectZero, nil); UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, 612, 792), nil); [self drawText]; UIGraphicsEndPDFContext(); fileName is the document file where You are going to append or attach NSString* temporaryFile = @"firstI...
NSString* fileName = @"firstIOS.PDF"; NSArray *arrayPaths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES); NSString *path = [arrayPat...
UIGraphicsBeginPDFContextToFile(fileName, CGRectZero, nil); UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, 600, 792), nil); UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, 600, 792), nil); UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, 600, 792), nil); ...
Minimal requirements for WCF service is one ServiceContract with one OperationContract. Service contract: [ServiceContract] public interface IDemoService { [OperationContract] CompositeType SampleMethod(); } Service contract implementation: public class DemoService : IDemoService...
Lists are a special kind of compound term. Lists are defined inductively: the atom [] is a list, denoting the empty list. if Ls is a list, then the term '.'(L, Ls) is also a list. There is a special syntax for denoting lists conveniently in Prolog: The list '.'(a, '.'(b, '.'(c, []))) can a...
By convention, the functor (-)/2 is often used to denote pairs of elements in Prolog. For example, the term -(A, B) denotes the pair of elements A and B. In Prolog, (-)/2 is defined as an infix operator. Therefore, the term can be written equivalently as A-B. Many commonly available predicates also...
In all serious Prolog systems, association lists are available to allow faster than linear access to a collection of elements. These association lists are typically based on balanced trees like AVL trees. There is a public domain library called library(assoc) that ships with many Prolog systems and ...
On a very high level, Prolog only has a single data type, called term. In Prolog, all data is represented by Prolog terms. Terms are defined inductively: an atom is a term. Examples of atoms are: x, test and 'quotes and space'. a variable is a term. Variables start with an uppercase letter or un...
Consider the following block of code. try { using (var disposable = new MyDisposable()) { throw new Exception("Couldn't perform operation."); } } catch (Exception ex) { Console.WriteLine(ex.Message); } class MyDisposable : IDisposable { public vo...
6.0 Introduced in C# 6.0, the Null Conditional Operator ?. will immediately return null if the expression on its left-hand side evaluates to null, instead of throwing a NullReferenceException. If its left-hand side evaluates to a non-null value, it is treated just like a normal . operator. Note tha...
To connect to a local Wildfly server via the command line, the tool bin/jboss-cli.sh can be used: $ ./bin/jboss-cli.sh --connect [standalone@localhost:9990 /] To connect to a remote Wildfly server, use the --controller option: $ ./bin/jboss-cli.sh --connect --controller=localhost:9990 [stan...

Page 301 of 1336