Tutorial by Examples

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...
These are form values that go in the HTTP request using the POST method. (including jQuery POST requests). Say you did an ajax post like $.ajax({ type: 'POST', url: window.updatePost, data: { id: 21, title: 'snappy title' }, //kept short for clarity }); Here the two values...
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...
Introduction In this minimalist example, using pytest we're going to test that indeed our Hello World app does return "Hello, World!" with an HTTP OK status code of 200, when hit with a GET request on the URL / First let's install pytest into our virtualenv pip install pytest And jus...
SELECT * FROM Employees This statement will return all the rows from the table Employees. Id FName LName PhoneNumber ManagerId DepartmentId Salary Hire_date CreatedDate ModifiedDate 1 James Smith 1234567890 NULL 1 1000 01-01-2002 0...
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...
Multiple transforms can be applied to an element in one property like this: transform: rotate(15deg) translateX(200px); This will rotate the element 15 degrees clockwise and then translate it 200px to the right. In chained transforms, the coordinate system moves with the element. This means tha...
The break statement ends a loop (like for, while) or the evaluation of a switch statement. Loop: while(true) { if(someCondition == 5) { break; } } The loop in the example would run forever. But when someCondition equals 5 at some point of execution, then the loop ends. If mult...
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; }...
When reading multiple values from a channel, using range is a common pattern: func foo() chan int { ch := make(chan int) go func() { ch <- 1 ch <- 2 ch <- 3 close(ch) }() return ch } func main() { for n := r...
With Git, you can (almost) always turn the clock back Don't be afraid to experiment with commands that rewrite history*. Git doesn't delete your commits for 90 days by default, and during that time you can easily recover them from the reflog: $ git reset @~3 # go back 3 commits $ git reflog c4...
Elements can be selected by jQuery using jQuery Selectors. The function returns either an element or a list of elements. Basic selectors $("*") // All elements $("div") // All <div> elements $(".blue") ...
The charset attribute specifies the character encoding for the HTML document and needs to be a valid character encoding (examples include windows-1252, ISO-8859-2, Shift_JIS, and UTF-8). UTF-8 (Unicode) is the most widely used and should be used for any new project. 5 <meta charset="UTF-8...
To refresh the page every five seconds, add this meta element in the head element: <meta http-equiv="refresh" content="5"> CAUTION! While this is a valid command, it is recommended that you do not use it because of its negative effects on user experience. Refreshing the...
git diff 1234abc..6789def # old new E.g.: Show the changes made in the last 3 commits: git diff @~3..@ # HEAD -3 HEAD Note: the two dots (..) is optional, but adds clarity. This will show the textual difference between the commits, regardless of where they are in the tree.
This error appears while trying to update or delete records without including the WHERE clause that uses the KEY column. To execute the delete or update anyway - type: SET SQL_SAFE_UPDATES = 0; To enable the safe mode again - type: SET SQL_SAFE_UPDATES = 1;
Firstly, make sure that the agent being used has the following attributes in the Manifest.mf: Can-Redefine-Classes: true Can-Retransform-Classes: true Starting a java agent will let the agent access the class Instrumentation. With Instrumentation you can call addTransformer(ClassFileTransformer...
Agents can be added to a JVM at runtime. To load an agent you will need to use the Attach API's VirtualMachine.attatch(String id). You can then load a compiled agent jar with the following method: public static void loadAgent(String agentPath) { String vmName = ManagementFactory.getRuntimeMXBe...

Page 156 of 1336