Friday, November 25, 2016

Indexes

  • speed up the querying process by providing swift access to rows in the data tables. (same as book index)
  • Created on columns of tables or view.
  • No need add primary key to index, because SQL Server automatically creates a unique index when you declare the primary key.
  • good to use Index at column WHERE and JOIN.
  • SQL Server first finds that value in index, then use the index to quickly locate the row of data
  • Index not recommend create on large object data type (image,text,varchar(max))
  • E.g. search value 123, the search engine will search root level and determine which intermediate level to go, 101-200, then will go to the node level until find 123.
  • The leaf node will contain entire row of data or pointer to the row, depending on the index is clustered or nonclustered

Clustered Index
  • Store actual data rows at the leaf level of index.
  • clustered index is sorted in ascending or descending.
  • only one clustered index on a table.
  • Query will faster than NON-Clustered.
Nonclustered Index
  • Leaf nodes of a non-clustered index only contain the values from the indexed columns and row locators to point the actual row.
  • Non-clustered indexes cannot be sorted like clustered index.
  • Create more than one non-clustered index per table or view.
Why many indexes will cause slower performance
  • Each index is a system-managed table, so every add or update data will update the index, then will cause slower performance of data updates.
  • Frequently update key column

Thursday, November 17, 2016

How to Running mongoDB

1) Download and Install mongo DB
2) make a .bat file
3) Key in this into .bat file"C:\Program Files\MongoDB\Server\3.2\bin\mongod.exe" -dbpath "C:\data\db"
4)Download robomongo to connect it


import to MongoDB

import a .bson file:
mongorestore -d db_name -c collection_name path/file.bson

import a .bson file (Incase only for a single collection)
mongorestore --drop -d db_name -c collection_name path/file.bson

For restoring the complete folder exported by mongodump:
mongorestore -d db_name path/

Monday, September 12, 2016

ISAPI

Internet Server Application Programming Interface (ISAPI), 
2 Component (extensions and filters) must compiled into DLL 
  • ISAPI extensions
    • Called from qualified request to IIS. (URL, POST [Submit Method]) 
    • run on IIS, it has access to all functionality in IIS.
    • Client can access ISAPI extensions in static HTML or certain file extensions can mapped to be handled by ISAPI extension.
  • ISAPI filters
    • Called from all request to IIS.
    • Used to enhance the functionality by IIS.
    • Run on IIS Server and filter every request until they find one they need to process.
    • Filter can programmed to examine and modify both incoming and outgoing streams of data. (logging)
    • Change request data (URL or headers) send by client.
    • Control physical file get mapped to the URL,
    • Control Username and password (authentication)
    • Change response 
    • Encryption and decryption.



Friday, September 9, 2016

Membership

Run below to create a asp.net membership DB

cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
aspnet_regsql.exe -S LT-OBY-MY -U sa -P p@ssw0rd -A all -d SecurityTutorials

Friday, September 2, 2016

IIS App

Site
  • Container for application and virtual directory.
  • Binding protocol : protocol communication between server and client. (HTTP / HTTPS)
  • Binding Information : combination IP address, port and optional host header.
Application
  • Run inside that 'folder'.
  • Standalone application. Own Session state and Application State.
  • Can run in different App Pool with different .NET version.
Virtual Directory
  • Link to a physical folder on the server
  • Point to different phyical path into that application. (e.g. image folder)
  • only run in DefaultAppPool

Thursday, August 25, 2016

Server Control and Custom Control

  • Building block of the GUI
  • E.g. Textbox, Button , drop down list ...
  • E.g. Validation, Security , Master Page and data manipulation.
5 Type of Control :
  • HTML controls
    • <a>,<button>,<input type>
  • HTML server controls
    • HTML control with runat=server
    • Able run in ASP.NET
  • ASP.NET server controls
    • Validation control
    • Data source control - data binding
    • Data view control - list and table from data source
    • Personalization control - personalization of page based on user information
    • Login and security control
    • Master Page
    • Navigation control
    • Rich control - file upload and calendar control
  • ASP.NET AJAX server controls
  • User controls

Custom Control
  • Compile into DLL and used as any other ASP.NET server control.

Different Custom Control and User Control
  • Custom control are compiled into assembly (.dll), user control are not.
  • Custom control can add into toolbox, user control cannot.
  • Custom control are difficult to create, it has no designer, and everything done by code; user control are easier to create as similar to creating web pages.
  • Single copy of custom control can be used in multiple application (just browse to the location); A separate user control is required in each application