Tuesday, January 29, 2013

C# Questions and Answers

What are namespaces?

Namespaces are heavily used in C# programming in two ways. First, the .NET Framework uses namespaces to organize its many classes. Second, declaring your own namespaces can help you control the scope of class and method names in larger programming projects. Use the namespace keyword to declare a namespace

Namespaces have the following properties:
  • They organize large code projects.
  • They are delimited by using the . operator.
  • The using directive obviates the requirement to specify the name of the namespace for every class.
  • The global namespace is the "root" namespace: global::System will always refer to the .NET Framework namespace System.
Read more at MSDN: Namespaces (C# Programming Guide)

Namespaces are a way of grouping type names and reducing the chance of name collisions. A namespace provides a fundamental unit of logical code grouping.
( Understanding and Using Assemblies and Namespaces in .NET )

What is the GAC?

GAC stands for global assembly cache. It is a machine-wide common language runtime code cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.

Read more at MSDN: Global Assembly Cache

What is a class?

A class is a construct that enables you to create your own custom types by grouping together variables of other types, methods and events. A class is like a blueprint. It defines the data and behavior of a type.

For more information, see MSDN: Classes (C# Programming Guide).
Previous posts:
C# Questions and Answers
C# Questions and Answers – Part 2
C# Questions and Answers – Part 3

Monday, January 28, 2013

ASP.NET Questions and Answers - Part 2

How can we prevent browser from caching an ASPX page? 
Use the SetNoStore method of the HttpCachePolicy class to direct the client not to store the responses in its history. See http://msdn.microsoft.com/en-us/library/system.web.httpcachepolicy.setnostore.aspx

In which event are the controls fully loaded?
On Load event. (http://msdn.microsoft.com/en-us/library/system.web.ui.page(v=vs.100).aspx
The Page object calls the OnLoad method on the Page object, and then recursively does the same for each child control until the page and all controls are loaded. The Load event of individual controls occurs after the Load event of the page.
Use the OnLoad event method to set properties in controls and to establish database connections.
(http://msdn.microsoft.com/en-us/library/ms178472(v=vs.100).aspx)

How we can force all the validation controls to run?
Using Page.Validate() method to instructs any validation controls included on the page to validate their assigned information.
Read more at http://msdn.microsoft.com/en-us/library/0ke7bxeh.aspx

What is .ASCX file?
.ascx file is a user control file.
Read more at http://msdn.microsoft.com/en-us/library/26db8ysc(v=vs.71).aspx

Related posts:

Saturday, January 26, 2013

SQL Questions and Answers

What is SQL?
SQL stands for Structured Query Language. It is a special-purpose programming language designed for managing data in relational database management systems (RDBMS). Most popular SQL commands are "Select", "Insert", "Update", and "Delete".

What is RDBMS?
RDBMS stands for Relational Database Management System. It is a database management system (DBMS) that is based on the relational model as introduced by E. F. Codd, of IBM's San Jose Research Laboratory. Many popular databases such as IBM DB2, MySQL, Microsoft SQL, Oracle currently in use are based on the relational database model.

What is database normalization?
Database normalization is the process of organizing the fields and tables of a relational database to minimize redundancy and dependency. Normalization usually involves dividing large tables into smaller (and less redundant) tables and defining relationships between them. (http://en.wikipedia.org/wiki/Database_normalization)

What is a primary key?  
A primary key is a single field or combination of fields that uniquely defines a record. Primary key can not contain a null value. A table can have only one primary key.

What is a stored procedure?
A stored procedure is a group of Transact-SQL statements compiled into a single execution plan.

What is a trigger? 
A database trigger is a special stored procedure that is automatically executed in response to certain events on a particular table or view in a database. The trigger is mostly used for maintaining the integrity of the information on the database.
Related posts:
SQL Questions and Answers – Part 3
SQL Questions and Answers – Part 2
SQL Questions and Answers – Part 1

Wednesday, January 9, 2013

ASP.NET Questions and Answers

What is ASP.NET?
ASP.NET is a Web platform that provides all the services that you require to build enterprise-class server-based Web applications. ASP.NET is built on the .NET Framework, so all .NET Framework features are available to ASP.NET applications. Your applications can be written in any language that is compatible with the common language runtime (CLR), including Visual Basic and C#.
Source:  http://msdn.microsoft.com/en-us/library/dd566231%28v=vs.100%29.aspx

ASP.NET is a unified Web development model that includes the services necessary for you to build enterprise-class Web applications with a minimum of coding. ASP.NET is part of the .NET Framework, and when coding ASP.NET applications you have access to classes in the .NET Framework. You can code your applications in any language compatible with the common language runtime (CLR), including Microsoft Visual Basic and C#. These languages enable you to develop ASP.NET applications that benefit from the common language runtime, type safety, inheritance, and so on.
Source: http://msdn.microsoft.com/en-us/library/4w3ex9c2%28v=vs.100%29.aspx

What is a Cookie?
A cookie, also known as an HTTP cookie, web cookie, or browser cookie, is usually a small piece of data sent from a website and stored in a user's web browser while a user is browsing a website. When the user browses the same website in the future, the data stored in the cookie can be retrieved by the website to notify the website of the user's previous activity. Cookies were designed to be a reliable mechanism for websites to remember the state of the website or activity the user had taken in the past.
Source: http://en.wikipedia.org/wiki/HTTP_cookie

Describe the complete ASP.NET page lifecycle.
  1. Page request: The page request occurs before the page life cycle begins. When the page is requested by a user, ASP.NET determines whether the page needs to be parsed and compiled (therefore beginning the life of a page), or whether a cached version of the page can be sent in response without running the page.
  2. Start: In the start stage, page properties such as Request and Response are set. At this stage, the page also determines whether the request is a postback or a new request and sets the IsPostBack property. The page also sets the UICulture property.
  3. Initialization: During page initialization, controls on the page are available and each control's UniqueID property is set. A master page and themes are also applied to the page if applicable. If the current request is a postback, the postback data has not yet been loaded and control property values have not been restored to the values from view state.
  4. Load: During load, if the current request is a postback, control properties are loaded with information recovered from view state and control state.
  5. Postback event handling: If the request is a postback, control event handlers are called. After that, the Validate method of all validator controls is called, which sets the IsValid property of individual validator controls and of the page. (There is an exception to this sequence: the handler for the event that caused validation is called after validation.)
  6. Rendering: Before rendering, view state is saved for the page and all controls. During the rendering stage, the page calls the Render method for each control, providing a text writer that writes its output to the OutputStream object of the page's Response property.
  7. Unload: The Unload event is raised after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and cleanup is performed.

Related posts:

Tuesday, January 1, 2013

New Year New Password

Your password should change frequently. If you cannot change every month, every quarter, then at least once a year.

When you change the password, it should NOT in "The 25 worst passwords of 2012". You should NOT using the same password for all accounts. Use the KeePass or a password protected LibreOffice document to keep track your password. Read "The guide to password security (and why you should care)" for more info.

Happy New Year!

How to recognize a fake Geek Squad renewal scam | Consumer Advice

Except from  https://consumer.ftc.gov/consumer-alerts/2022/10/how-recognize-fake-geek-squad-renewal-scam Scammers are at it ag...