Wednesday, March 6, 2013

JavaScript Questions and Answers - Part 2

Continue random JavaScript Questions and Answers from previous post.

What are difference between global and local variables? 
A variable that is declare outside of a function is a global variable, and its value is accessible and modifiable throughout your program. A variable that is declared inside a function is local. It is created and destroyed every time the function is executed, and it cannot be accessed by any code outside the function. ( msdn.microsoft.com )

How we define a class in JavaScript?
JavaScript does not have a class definition separate from the constructor. Instead, you define a constructor function to create objects with a particular initial set of properties and values. Any JavaScript function can be used as a constructor. You used the new operator with a constructor function to create a new object. ( developer.mozilla.org )

What is a JavaScript function?
JavaScript function is a block of code that will be executed when it was called by external code. A function begin with the function keyword, followed by the name, list of parameters if any, and a block of codes inside a curly braces. Function can return a value. Arguments are passed to function by a value.

What is a function expression?
A function expression is a function defined inside an expression. A function name in function expression can be omitted, in which case the function is anonymous. Example: var foo = function () { return 5; }
Related posts:
JavaScript Questions and Answers – Part 2
JavaScript Questions and Answers

Sunday, February 24, 2013

MySQL error #1045 on GoDaddy phpMyAdmin

After I made a new MySQL databases, I logged in to phpMyAdmin to test and got this message:

#1045 – Access denied for user ‘myusername’@’10.10.10.10’ (using password: YES)

What???

After couple attempts for a few hours, I decided to use a new difference password. Now it worked. It seem to me, there is a character in my initial password did not carry to or accepted by MySQL database.

Friday, February 22, 2013

Verdana, Aria fonts on Ubuntu

Install Microsoft core fonts package by running this command in terminal: 

sudo apt-get install ttf-mscorefonts-installer

Thursday, February 7, 2013

SQL Questions and Answers - Part 2

Continue from previous part.

What is a constraint?
Constraints let you define the way the Database Engine automatically enforces the integrity of a database. Constraints define rules regarding the values allowed in columns and are the standard mechanism for enforcing integrity. SQL Server supports the following classes of constraints:
NOT NULL specifies that the column does not accept NULL values.
CHECK constraints enforce domain integrity by limiting the values that can be put in a column.
UNIQUE constraints enforce the uniqueness of the values in a set of columns.
PRIMARY KEY constraints identify the column or set of columns that have values that uniquely identify a row in a table.
FOREIGN KEY constraints identify and enforce the relationships between tables.
Read more at http://msdn.microsoft.com/

What is a unique constraint?
A Unique constraint uniquely identified each record in a table. This provides uniqueness for the column or set of columns. Use a Unique constraint when you want to enforce the uniqueness of a column, or combination of columns, that is not the primary key. Unique constraint creates a non-clustered index on the column. Unique Key allows only one NULL Value.

What is a Foreign Key (FK)?
A foreign key (FK) is a column or combination of columns that is used to establish and enforce a link between the data in two tables. You can create a foreign key by defining a FOREIGN KEY constraint when you create or modify a table.
Read more at http://msdn.microsoft.com/

What is the difference between Primary Key (PK) and Unique Key (UK)?
A Primary Key (PK) can not have a Null value. A Unique Key can have one Null value.
Primary Key creates a clustered index on the column. Unique Key creates a non-clustered index on the column.
Each table may have only one PK but many unique constraints.

What is a join?
An SQL join clause combines records from two or more tables in a database. A JOIN is a means for combining fields from two tables by using values common to each. ANSI standard SQL specifies four types of JOIN: INNER, OUTER, LEFT, and RIGHT. As a special case, a table (base table, view, or joined table) can JOIN to itself in a self-join.

What are the types of join?
Inner Join: Inner join returns only the rows that have a match in both joined tables.
Right Outer Join: Right join returns all the rows from the right hand side table even though there are no matches in the left hand side table.
Left Outer Join: Left join returns all the rows from left hand side table even though there are no matches in the right hand side table.
Full Outer Join: Full join returns all rows in all joined tables are included, whether they are matched or not. Cross Join: Cross join return all rows from the left table. Each row from the left table is combined with all rows from the right table. Cross joins are also called Cartesian products.
Read more at http://msdn.microsoft.com/


Related posts:
SQL Questions and Answers – Part 3
SQL Questions and Answers – Part 2
SQL Questions and Answers – Part 1

Wednesday, February 6, 2013

JavaScript Questions and Answers

What is JavaScript?
JavaScript is the object oriented scripting language developed by Brendan Eich, an engineer at Netscape, in 1995. It is also known as Mocha, LiveScript, JScript, ECMAScript, and it is one of the world's most popular programming languages.

Is JavaScript subset of Java?
No. Although Javascript's syntax came from Java and C, they are difference. JavaScript developed by Netscape. Java developed by Sun.
  • Java is an OOP programming language while Java Script is an OOP scripting language.
  • Java creates applications that run in a virtual machine or browser while JavaScript code is run on a browser only.
  • Java code needs to be compiled while JavaScript code are all in text.

What are JavaScript types?
  • Number.
  • String.
  • Boolean.
  • Object: Function, Array, Date, RegExp
  • Null.
  • Undefined.
What is the difference between undefined value and null value?
undefined means a variable has been declared but has not yet been assigned a value. undefined is a property of the global object, i.e. it is a variable in global scope.

null is an assignment value. It is a JavaScript keyword that indicates a variable has a no value. null is a literal (not a property of the global object like undefined can be).

What is jQuery?
jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensbility, jQuery has changed the way that millions of people write JavaScript.
Source: Jquery.com

Reference:
JavaScript | MDN
A re-introduction to JavaScript


Related posts:
JavaScript Questions and Answers – Part 2
JavaScript Questions and Answers

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:

How to Install Keka on macOS

Download latest version from https://www.keka.io/en/ Copy the MD5 hash value from Keka website to compare later (MD5: 8729f9d08d10293fa1ee65...