Tutorial by Examples

public ActionResult Index() { // Renders a view as a Web page. return View(); } Action methods typically return a result that is known as an action result. The ActionResult class is the base class for all action results. The ActionInvoker decide which type of action result to return ...
public ActionResult PopulateFoods() { IEnumerable<Food> foodList = GetAll(); // Renders a partial view, which defines a section of a view that can be rendered inside another view. return PartialView("_foodTable", foodVms);; } Action methods typically retur...
public ActionResult Index() { //Redirects to another action method by using its URL. return new RedirectResult("http://www.google.com"); } Action methods typically return a result that is known as an action result. The ActionResult class is the base class for all action resu...
public ActionResult PopulateFoods() { // Redirects to another action method. In this case the index method return RedirectToAction("Index"); } Action methods typically return a result that is known as an action result. The ActionResult class is the base class for all action ...
public ActionResult Hello() { // Returns a user-defined content type, in this case a string. return Content("hello world!"); } Action methods typically return a result that is known as an action result. The ActionResult class is the base class for all action results. The Ac...
public ActionResult LoadPage() { Student result = getFirst(); //Returns a serialized JSON object. return Json(result, JsonRequestBehavior.AllowGet); } Action methods typically return a result that is known as an action result. The ActionResult class is the base class for al...
Xamarins built in gesture recognizers provide only very basic touch handling. E.g. there is no way to get the position of a touching finger. MR.Gestures is a component which adds 14 different touch handling events. The position of the touching fingers is part of the EventArgs passed to all MR.Gestu...
Imagine the following XML: <root> <element foobar="hello_world" /> <element example="this is one!" /> </root> /root/element[@foobar] and will return the <element foobar="hello_world" /> element.
Imagine the following XML: <root> <element foobar="hello_world" /> <element example="this is one!" /> </root> The following XPath expression: /root/element[@foobar = 'hello_world'] will return the <element foobar="hello_world&quo...
Let's say you don't want the fields houseNum and street in the address field of the final populated doc, use the populate() as follows, Person.findOne({_id: req.params.id}) .populate('address', '-houseNum -street') // note the `-` symbol .exec(function(err, person) { // do somet...
If you only want the fields houseNum and street in the address field in the final populated doc, use the populate() function as follows in the above two methods, Person.findOne({_id: req.params.id}) .populate('address', 'houseNum street') .exec(function(err, person) { // do somet...
Assuming that you are running redis server on localhost you can type command redis-cli After this command appear redis command line prompt 127.0.0.1:6379>
There are four types of sockets available in POSIX API: TCP, UDP, UNIX, and (optionally) RAW. Unix domain sockets may act like stream sockets or like datagram sockets. Some of endpoint types: struct sockaddr - universal endpoint type. Typically, other concrete endpoint types are converted to thi...
If the built in attributes are not sufficient to validate your model data, then you can place your validation logic in a class derived from ValidationAttribute. In this example only odd numbers are valid values for a model member. Custom Validation Attribute public class OddNumberAttribute : Valid...
Through this example, it will be explained to divide the node.js code into different modules/folders for better undertandibility. Following this technique makes it easier for other developers to understand the code as he can directly refer to concerned file instead of going through whole code. The m...
For using Attribute Routing in areas, registering areas and [RouteArea(...)] definitions are required. In RouteConfig.cs : public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); ...
How do you handle errors, rather then log them to the console? Bad way: Router.route('/') .get((req, res) => { Request.find((err, r) => { if(err){ console.log(err) } else { res.json(r) } }) }) .post((req, res) => { const reque...
1-HTTP Server. For example: Apache. Having mod_rewrite is preferred, but by no means required. 2-PHP 5.5.9 or greater (including PHP 7) 3-mbstring PHP extens ion 4-intl PHP extension I usually make an apache and mysql installation on a linuxbox. I can use windows too, however I do not recommen...
The simplest way to write a parser is to use the recursive descent technique. This creates a top-down parser (which may formally be described a LL(1)). To start the example we first have to establish the grammar rules for our language. In this example we will use simple arithmetic expression assignm...
The following example is a very useful basis when you are trying to convert transaction data to un-pivoted data for BI/reporting reasons, where the dimensions which are to be un-pivoted can have a dynamic set of columns. For our example, we suppose that the raw data table contains employee assessme...

Page 889 of 1336