Tutorial by Examples: c

Views, in an MVC pattern, contain the logic on how to present data to the user. In a web application, typically they are used to generate the HTML output that is sent back to users with each response. By default, views in Laravel are stored in the resources/views directory. A view can be called u...
The protected keyword marks field, methods properties and nested classes for use inside the same class and derived classes only: public class Foo() { protected void SomeFooMethod() { //do something } protected class Thing { private string blah; ...
function output = mymult(a, b) % MYMULT Multiply two numbers. % output = MYMULT(a, b) multiplies a and b. % % See also fft, foo, sin. % % For more information, see <a href="matlab:web('https://google.com')">Google</a>. output = a * b; end help mymult then p...
git clean -fX Will remove all ignored files from the current directory and all subdirectories. git clean -Xn Will preview all files that will be cleaned.
git clean -fd Will remove all untracked directories and the files within them. It will start at the current working directory and will iterate through all subdirectories. git clean -dn Will preview all directories that will be cleaned.
Implementations in classes, including abstract declarations, take precedence over all interface defaults. Abstract class method takes precedence over Interface Default Method. public interface Swim { default void backStroke() { System.out.println("Swim.backStroke"); ...
TODO: Maybe move the explanations to remarks and add examples separately FOOF In Common Lisp, there is a concept of Generalized References. They allow a programmer to setf values to various "places" as if they were variables. Macros that make use of this ability often have a F-postfix in...
An Anaphoric Macro is a macro that introduces a variable (often IT) that captures the result of a user-supplied form. A common example is the Anaphoric If, which is like a regular IF, but also defines the variable IT to refer to the result of the test-form. (defmacro aif (test-form then-form &o...
Macro expansion is the process of turning macros into actual code. This usually happens as part of the compilation process. The compiler will expand all macro forms before actually compiling code. Macro expansion also happens during interpretation of Lisp code. One can call MACROEXPAND manually to ...
Macros return code. Since code in Lisp consists of lists, one can use the regular list manipulation functions to generate it. ;; A pointless macro (defmacro echo (form) (list 'progn (list 'format t "Form: ~a~%" (list 'quote form)) form)) This is often very hard to...
The expansion of a macro often needs to use symbols that weren't passed as arguments by the user (as names for local variables, for example). One must make sure that such symbols cannot conflict with a symbol that the user is using in the surrounding code. This is usually achieved by using GENSYM, ...
json.Marshal from the package "encoding/json" encodes a value to JSON. The parameter is the value to encode. The returned values are an array of bytes representing the JSON-encoded input (on success), and an error (on failure). decodedValue := []string{"foo", "bar"} ...
json.Unmarshal from the package "encoding/json" decodes a JSON value into the value pointed by the given variable. The parameters are the value to decode in []bytes and a variable to use as a storage for the de-serialized value. The returned value is an error (on failure). encodedValue :...
After following the instructions above and installing Leiningen, start a new project by running: lein new <project-name> This will setup a Clojure project with the default Leiningen template within the <project-name> folder. There are several templates for Leiningen, which affect the...
Often you'd be working with viewmodel classes in asp.net-mvc and would want to bind to properties on these. This works similar to mapping to individual parameters. Say you had a simple view model call PostViewModel like this public class PostViewModel{ public int Id {get;set;} public int Sn...
Functions in Common Lisp are first class values. An anonymous function can be created by using lambda. For example, here is a function of 3 arguments which we then call using funcall CL-USER> (lambda (a b c) (+ a (* b c))) #<FUNCTION (LAMBDA (A B C)) {10034F484B}> CL-USER> (defvar *fo...
Any symbol in Common Lisp has a slot for a variable to be bound and a separate slot for a function to be bound. Note that the naming in this example is only for illustration. Global variables should not be named foo, but *foo*. The latter notation is a convention to make it clear that the variable ...
Common Lisp contains many higher order functions which are passed functions for arguments and call them. Perhaps the most fundamental are funcall and apply: CL-USER> (list 1 2 3) (1 2 3) CL-USER> (funcall #'list 1 2 3) (1 2 3) CL-USER> (funcall #'list 1 2 3 4 5) (1 2 3 4 5) CL-USER&g...
os.access is much better solution to check whether directory exists and it's accesable for reading and writing. import os path = "/home/myFiles/directory1" ## Check if path exists os.access(path, os.F_OK) ## Check if path is Readable os.access(path, os.R_OK) ## Check if path i...
h2 { /* adds a 1px space horizontally between each letter; also known as tracking */ letter-spacing: 1px; } The letter-spacing property is used to specify the space between the characters in a text. ! letter-spacing also supports negative values: p { letter-spacing: -1px; }...

Page 95 of 826