This is cool - List> lstlstString = new List
>();
<noscript>
is — don't. Design scripted functionality as a behavioral extension to static functionality
To give Network Service read permission on the EventLog/Security key (as suggested by Firenzi and royrules22) follow instructions from http://geekswithblogs.net/timh/archive/2005/10/05/56029.aspx Open the Registry Editor: Select Start then Run Enter regedt32 or regedit Navigate/expand to the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security Right click on this entry and select Permissions Add the "Network Service" user Give it Read permission *** The changes take only effect after you restart your aplication on IIS *** I gave IIS_IUSRS permission to read/write the eventlog key, and read the Security key. My product needed write access on the eventlog key because it creates its own event source.
Named Pipe Server and Client
Mongo
Authorization and Authentication
MVC Partial Views
MvcTest_2013
Does good error handling in Global.ASPX. ... Commented out so that I can see the errors.
Car - Includes a small Event Log method. Does Pagation. Filter code is there too.
Car 1 - Car/Details/1
Car1 - From Cars. For robust Pagation testing...Works slick with numbers of pages.
Car2 - From Cars. For Pagation with text entry of page.
Policy - This goes to Detail that has the sliding TD and ... no add
Policy1 - Uses noscript design - Conditions
Policy2 - Uses better noscript design - Actions ... Adding AJAX for spiffy autocomplete
Policy3 - Policy has Detail with sliding TD, but with Add ... Completely matches live version. Bunch of new data objects
Policy4 - Policy has Detail with sliding TD, but with Add ...
This is full functioning Policy screens
Policy5 - Policy has Detail with sliding TD, but with Add ... and Adding AJAX for spiffy autocomplete
Really this is about moving the AJAX into this controller and making the autocomplete less coupled to one text box. Slick... Add Group.
Gauges 1 - JustGage test page. Works
Gauges 2 - JustGage test page. Works neet with AJAX.
Gauges 3 - JustGage test page. Works neet with AJAX. ... Also Processes drivers.xml
HtmlGage 3 - Controls color of gage. New .js file
Html Spinner 1 - js and Raphael
IP Address - jQuery IP Address Plugin
Learn-JavaScript-Part-1-Create-a-Starfield
MvcTests_2013_SGTable_NuGet - Slick Grid Tests
This has the javascript libraries from NuGet and works great.
Index2 does column re-order, but has a bunch of other problems like no sorting, so need
to get some code from MvcTest_2013a and see if it will work with the libraries.
Index8 does Column Sort, Resize, Reorder, Show/Hide, and event
This is the AJAX demo with the Command Pattern
This also has some responsive design tests - Responsive CSS and javascript
MvcTest_2013a
Has a nice Gauge page
Initially about javascript tables DataTable.js from JQuery. This works amazingly.
Column Order change - Drag and Drop
This turned into a table js test project using DataTable.js, Slick Grid, HandsOnTable. Pretty Complete
Do not consider using this stuff for Slick Grid. Look at MvcTests_2013_SGTable_NuGet for up to date code that works.
MobileTest1_2014
There are a number of Templates for Visual Studio that read the User Agent string. Some are older than others.
HTML5 MVC4 Razor Responsive Web Template Free - Visual Studio Site. Uses User Agent like one below.
This is the one I used for the Responsive_* tests. It needs the jquery updated some
MVC4 Mobile Friendly Web Applications - Visual Studio Default for project. Educational about how VS does it. Look below for test implimentation.
Multiple Views and DisplayMode Providers in ASP.NET MVC 4 - Best explanation of display Modes.
NuGet Package of the Week #10 - New Mobile View Engines for ASP.NET MVC 3, spec-compatible with ASP.NET MVC 4 - Visual Studio Default for project. Educational about how VS does it. Look below for test implimentation.
Might want to search on Web Activator like the MobileViewEngines.Razor.Sample - NAh, unneeded
how-use-aspnet-mvc-4-display-modes-mobile-web-apps - Nice Discussion.
WebAPI_1
1. Has a nice AJAX function to populate a Movable JQuery Dialog
WebTest_2013
JSON
JSON
JSON1 - Works cool
htmlTableLayout1
SuperInput1
Javascript controlled input. Dynamic creation of elements. Initially is a label, but onClick it becomes input.
SuperInput2
Javascript controlled input. All elements initially exist.
SuperInput3
Javascript controlled input. All elements and events initially exist.
SlideDownAreas1.aspx Bundling and Optimization Test
SlideDown_tr.aspx - The objective of this is that Table rows show and hide ok, but do not slidedown and up very well. This is to test how to do that. Works Great!
Html Relative Position Test - Relative to it's normal position. Children move with it.
Objects1.aspx - Object creation and manipulation. Composit objects.
GetFromWebConfig1.aspx - Reading Settings from Web Config
Make_GUID_WithJavascript.aspx
TestSubmit1 - for testing submit actions
TestSubmit2 - for testing preventing submit actions
AutoComplete1 - Not used - AutoComplete2 is used
AutoComplete2 - Complex AutoComplete ... Very Trick
AutoComplete3 - Complex AutoComplete ... Very Trick... Lets see if I can AJAX it.
Make Gauges using JustGage which uses the Rapheal Library.
Browser version test
HTML data Attribute Test1
WebAPI
JQuiry UI Movable Dialog....
Has jsTree Code
WebTests1
Simple, but nice XML reader writer.
ASHX_Handler 1
WebTests_2012_110812a.zip - Nexus code, so good ASP.Net, datagrid...
Tests_2014/MvcApplication1
JQuery Dialog - Contact5
Real good JSON to dictionary and to object over AJAX
jsTree ... tough
Tests_2014/MvcTree*
Projects to get jsTree working lightweight
MvcTree2 - Got page 3 to work -jstree reads json message and makes tree with folder and events
MvcTree1 - is MvcTree2 with just the 1 page working to make a tree
MvcTree3 - is MvcTree2 elaborated. jsTree takes JSON and works in movable dialog.
Adding Product Models from A1 so as to allow AJAX -> JSON -> View with tree ... Works!!!
Page6 was to add autocomplete... mostly works.
Tests_2014/MvcBootstrap1
getbootstrap.com
Initial testing
1. When performance is an issue, if you can calculate or process it at the application layer, then take it out of the database layer. order by/group by are classic examples. It’s almost always easier to scale out your application layer than your database layer. As true for MySQL on your server as it is on the sqlite in your handheld. EDIT Some great comments on HN for this one so I felt like I better clarify: we only do this for certain queries not to improve necessarily the client response time, but to relieve load if the query is battering the DB and making it a significant bottleneck for ALL clients.
2. Concurrency, avoid it if you can. If not, then remember that with great power comes great responsibility Avoid working directly with threads if you can. Work at a higher level of abstraction if possible. In iOS, for example: GCD, dispatch and operation queues are your friends. The human mind was not designed to reason about infinite temporal state—I get nauseous thinking about how I learned all this first hand.
3. Minimize state as much as possible, and keep it as localized as possible. The functionalists were/are onto something.
4. Short composable methods are your friend.
5. Comments are dangerous since they can get out of date and mislead, but so is not having them. Don’t comment the trivial, but strategically write paragraphs if needed in specific sections. Your memory will fail you, as soon as tomorrow morning, even after coffee.
6. If you feel one use-case scenario will “probably be ok”, that’s the one that’s going to lead to catastrophic failure a month in production. Trust your paranoid gut, test and verify.
7. When in doubt, over communicate all concerns with your team.
8. Do the right thing—you usually know what that thing is.
9. Your users aren’t stupid, they just don’t have the patience for your cut corners.
10. If an engineer is not tasked with the long term maintenance of the systems they build, view them with suspicion. 80% of the blood, sweat, and tears of software occurs after its been released—that’s when you become a world weary, but wiser “professional.”
11. Checklists are your friends.
12. Take initiative to purposeful enjoy your work, sometimes this will take effort.
13. Silent failures, I still have nightmares. Monitor, log, alert. But be wary of false positives and the inevitable desensitization it leads to. Keep your system senses clear and alert.
14. At the end of the day, we’re paid to manage complexity. Work accordingly.
Model if you are going to have one. ***** CONTROLLERS aMvc2_1Hello ***** public ActionResult Index() { ViewData["CurrentTime"] = DateTime.Now.ToString(); return View(); } <%: ViewData["CurrentTime"] %> public ViewResult DisplayCustomer() { Customer objCustomer = new Customer(); objCustomer.Id = 12; objCustomer.CustomerCode = "1001"; objCustomer.Amount = 90.34; return View("DisplayCustomer",objCustomer); } } For this, create a View - Strongly Types, then the class From (input) Page Post [HttpPost] public ViewResult DisplayCustomer() { Customer objCustomer = new Customer(); objCustomer.Id = Convert.ToInt16(Request.Form["Id"].ToString()); objCustomer.CustomerCode = Request.Form["Id"].ToString(); objCustomer.Amount = Convert.ToDouble(Request.Form["Amount"].ToString()); ; return View("DisplayCustomer", objCustomer); } ***** VIEWS ***** The customer id is <%= Model.Id %>
The customer Code is <%= Model.CustomerCode %>
<% if (Model.Amount > 100) {%> This is a priveleged customer <% } else{ %> This is a normal customer <%} %> Enter customer id :- *** With HTML Helper *** <%using (Html.BeginForm("DisplayCustomer","Customer",FormMethod.Post)) }%> Enter customer id :- <%= Html.TextBox("Id")%> ***** OUTBOUND URLS bMvc2App ***** Link by name and action or you are violating MVC About us
<%= Html.ActionLink("Go To Home","GoTohome") %> ***** PARTIAL VIEWS cMvc2App ***** Re-usable parts Master page headers and footers User Controls? ... default name is ViewUserControl1 <% Html.RenderPartial("../Shared/PartialView1"); %> ***** DATA ANNOTATIONS - Meta Data ***** Need javascript need <% Html.EnableClientValidation(); %> using System.ComponentModel.DataAnnotations; [Required(ErrorMessage="Customer code is required")] public string CustomerCode { set; get; } // The values of the obj are set automatically... not positive how public ActionResult DisplayCustomer(Customer obj) { if (ModelState.IsValid) [StringLength(160)] [RegularExpression(@"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}")] ... email [Range(10,25)] public string Password { get; set; } [Compare("Password")] public string ConfirmPass { get; set; } In case you want to get a particular error message , you can use the Errors collection. var ErrMessage = ModelState["Email"].Errors[0].ErrorMessage; If you have created the model object yourself you can explicitly call TryUpdateModel in your controller to check if the object is valid or not. TryUpdateModel(NewCustomer); In case you want add errors in the controller you can use “AddModelError” function. ModelState.AddModelError("FirstName", "This is my server-side error."); If you are using App_Data folder then you can mention the folder as |DataDirectory| (enclosed in pipe symbols) in connection string. |DataDirectory| is a substitution string that indicates the path to the App_Data folder.
The "_ViewStart" page is a common page which will be used by views for common things like layout and common code. A Master page. @{ ViewBag.Title = "Index"; } ---Does Forms Authentication--- "[Authorize]" attribute.
var f = function() { // we create an anonymous function and store a reference to it return 25; }; ... var i = f(); // we call the anonymous function via a reference *** The number of parameters to a function do not need to match the number sent *** function MyFunction() { var result = ""; for(var i = 0; i < arguments.length; i++) { result += arguments[i]; } return result; } var concatenatedString = MyFunction("Hi ", "World"); **** **** function () { var i = 10; var square = function () { i = i * i; } i = 40; var result = square(); // result is 1600, not 100 as one might assume } A function can define a global variable (analogous to a static variable in C# sense). In order to create such a variable one should assign the variable a name without a var keyword in front of it. In that case, it is assigned to the global windows object representing the browser window and is accessible from any other function: function () { globalVariable = 10; // no 'var' in front the variable definition } // globalVariable is visible outside of the function scope **** **** var myObject = new Object(); // creates a new object myObject.someField = 5; // assigns number 5 to 'someField' field within the object. *** var myArray = new Array(); myArray[0] = 1; // array resizes as it is assigned myArray[10] = "hello world"; // array resizes as it is assigned // (now myArray.length is 11) and the // array cells with indices 1 to 9 are not defined. myArray.push(2); // adds number 2 to the end of the array, array length is now 12 var myVar = myArray.pop(); // removes and returns the last array value (number 2) // myArray.length now is 11 // myVar gets value 2