Web Design: Introduction

I created this section so I can take down some notes and be able to go back to them as I learn more about HTML, CSS, Javascript, and AJAX, especially now that there is a new version of HTML 5 and CSS 3.  I have used them occasionally at my previous jobs but I feel I need to brush up on them and widen my knowledge.  Plus, I also want to learn other technologies out there like jQuery, etc.  To help me achieve this, I will mostly be referring to W3Schools tutorials.  I have added a link to their site under the Favorites Links.  So, let’s see how this goes and wish me luck.


C#: Quick facts on numeric suffixes, verbatim string, null coalescing, short-circuiting, main entry point, fall through switch-case

Use a numeric suffix to explicitly declare a numeric literal to be of a specific numeric type (U for unsigned int, L for long, UL for unsigned long, M for decimal, F for float, and D for double).

uint a = 123U;
long b = 1234L;
ulong c = 1234UL;
decimal d = 123.4M;
float e = 123.4F;
double f = 123.4D;


Use verbatim string (prefixed with the @ character) if you don’t want the characters in your string translated (e.g. if you have escape sequences, etc.), except for the double quote escape sequence, as in below:

string s = @"Hello \t ""Universe""!"; // Hello \t "Universe"! 


Use null coalescing (??) if the variable you are working on can be null and you don’t want null.

int? i = null;
int j = i ?? 0;


Use | or & if you are not short-circuiting, otherwise use || or &&.  

There are actually 4 types of main entry point in a C# program.  They are:

static void Main()
    // ...
static int Main()
    // ... 
    return 0; 
static void Main(string[] args) 
    // ... 
static int Main(string[] args) 
    // ... 
    return 0; 


There is no cascading of case  in switch which is why each case including the default need to have the break.  But you can cascade cases that have no statements, as in below.  Useful when you need to handle multiple cases in the same way.

switch (i)
    case 1:
    case 2:
        Console.WriteLine("1 or 2");


General: C#, HTML, CSS, Javascript, AJAX

My previous job requires me to work on C#, and occasionally on HTML, CSS, Javascript, and AJAX.  To be honest, I like C# more than VB.NET, being a C programmer for a while way back starting from University days and was very good at it.  So I created a C# category on my blog because I plan on keeping my C# skills and improving on it.  I also created a Web UI category where I can put all my notes about HTML, CSS, Javascript, AJAX, and more.  I don’t use these skills much but since I wanted to work more on the front end of web development for some time now, I plan to keep these skills up to date and what better way to do this is to make use of the W3Schools site.  So I added a link to the website under Favorite Links.  I am so excited about these technologies that I can’t wait to be blogging more often.  Happy blogging!

SQL Server: Multi-Tenant Data Architecture

As promised in my previous post, I will look briefly into ways on how to architect multi-tenant data.  Multi-tenant means servicing multiple clients or tenants.  In the case of a data architecture, it’s how to store data from multiple clients.  I learned there are three options to do this, not just two.  I know the two of them are the most common which I will talk first.

First option, is using Separate Databases.  This is the simplest approach of all the three.  Basically each client has its own copy of the database, and sometimes depending on the client’s strict security requirements, can be located on a server separate from the others.  It may be inexpensive in terms of development cost to do this way initially, but in the long run, it will be more expensive in terms of operational cost.

Second option, is using Shared Database and Shared Schema.  Only one database and one set of tables are used to store all the clients’ data.  The only thing that differentiates them from each other is an ID unique to each client.  In contrast to using separate databases, using shared database and shared schema has a higher development cost but a lower operational cost.

These two options are popular, at least in my experience.  They are actually mostly used by application service provider companies.  In my last company, they use the separate databases option.  The company before that, I know they used the shared database and shared schema option.  Little did I know that there is a third option, which I still have yet to see implemented in an ASP company.

So the third option, is using Shared Database and Separate Schemas.  What this means is that there is only database but each client has its own copy of the set of tables that are grouped into a schema unique to each client.  So basically, when onboarding a new client, a schema unique to the client is created first and assigned and defaulted to the client account.  From within that client’s schema, you then create the tables with the schema name as the qualifier for naming the tables to be created.  When accessing the client’s data, since the client’s default schema is set, you don’t have to qualify the table names with the client’s schema name.  Therefore, you use the same SQL statements for all clients.  There is no duplication of SQL statements here.

These three options have their own pros and cons which I won’t be talking here.  This is just to give an idea what these options are.  If you need more information, check this link.

ASP.NET: GET, POST, IsPostBack, QueryString, and Form

I have been asked a couple of times in my job interviews about GET, POST, IsPostBack, QueryString, and Forms.  These are the basics that one who has worked on ASP.NET should know.  Sometimes you get focused on higher level stuff especially if you are working with wrappers or some sort of framework on top of ASP.NET that you lose focus on the basics.  It happens.  At least to me it happens.

So what is GETGET is one of the most common HTTP commands, just like POST, that is sent by the browser to the web server.  It tells the web server to get or fetch a page for the browser.  So when you type a URL


on your browser’s address window and press ENTER, the browser sends a GET command to the web server and the web server fetches the page and sends it back to the browser and the browser displays the page.  Simple.

POST, on the other hand, is sent by the browser to the web server if it needs to post or send back data or information to the web server.  So when you fill up information on a web page, say maybe you are creating a new user account, and pressed a submit button, the browser sends a POST command, attaches the information you entered and sends it to the web server.

IsPostBack is a property of the Page class representing a Web Forms page in ASP.NET.  You use this property to check if the page is being loaded or rendered or being requested for the first time (a GET command) as opposed to being loaded as a response to a postback (a POST command).

Querystring is the string you see in a URL after the ? character


It allows you to pass data from one page to another.  It can contain more than one name/value pair



separated by the & character.  On the target page (e.g. results.aspx) one can access the name/value pair using the QueryString collection of the Request object



Form collection is another property of the Request object that allows you to access the information sent by the browser through a POST command.  It retrieves the values of the form elements.  So if we have the following form tag:

<form method="POST" action = "getCustomer.aspx" >
    Enter Customer ID:
    <input type="text" name="Id">
    <input type="submit" value="Get Customer">


we can retrieve the customer ID using the following code: