This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//output : | |
Normal Array Elapsed Time: 10831 | |
Parallel For Elapsed Time: 39028 | |
Clone Elapsed Time: 2149 | |
//code | |
[Test] | |
public void zz() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public dynamic ViewBag { | |
get{ | |
if (_dynamicViewDataDictionary == null) { | |
_dynamicViewDataDictionary = new DynamicViewDataDictionary(() => ViewData); | |
} | |
return _dynamicViewDataDictionary; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected internal virtual ViewResult View(string viewName, string masterName, object model) { | |
if (model != null) { | |
ViewData.Model = model; | |
} | |
return new ViewResult { | |
ViewName = viewName, | |
MasterName = masterName, | |
ViewData = ViewData, | |
TempData = TempData |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(Rook) | |
# to install Rook, which makes it possible to run R as a server, | |
# R -q -e "install.packages('Rook', repos='http://cran.r-project.org')" | |
app <- function(env){ | |
req <- Rook::Request$new(env) | |
res <- Rook::Response$new() | |
res$write(42) | |
res$finish() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Student | |
{ | |
public int PhysicsScore { get; set; } | |
public float MathScore { get; set; } | |
public char PhysicsGrade { get; set; } | |
public char MathGrade { get;set; } | |
public string Name { get;set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Html.TextBoxFor(student => student.Name) | |
@Html.TextBoxFor(student => student.PhysicsScore) | |
@Html.TextBoxFor(student => student.MathScore) | |
@Html.TextBoxFor(student => student.PhysicsGrade) | |
@Html.TextBoxFor(student => student.MathGrade) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input data-val="true" id="Name" name="Name" type="text" value=""> | |
<input data-val="true" data-val-number="The field PhysicsScore must be a number." data-val-required="The PhysicsScore field is required." id="PhysicsScore" name="PhysicsScore" type="text" value=""> | |
<input data-val="true" data-val-number="The field MathScore must be a number." data-val-required="The MathScore field is required." id="MathScore" name="MathScore" type="text" value=""> | |
.... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Student | |
{ | |
// Notice the nullable types | |
public int? PhysicsScore { get; set; } | |
public float? MathScore { get; set; } | |
public char? PhysicsGrade { get; set; } | |
public char? MathGrade { get;set; } | |
public string Name { get;set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ViewResult Save(Model modelToSave) | |
{ | |
if(ModelState.isValid) | |
{ | |
modelToSave.Save(); | |
// redirects to the list action if the save is successful | |
return RedirectToAction("Index"); | |
} | |
//if there are any errors, the same edit View is returned. | |
return View("Edit", modelToSave); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return RedirectToAction("Index", new {message="Saved successfully"}); |