Prevent iframe white flash issue while loading

I had a link on my website. I had written a click event for link to load iframe. But every time I was clicking the link, iframe was taking time to load and thus displaying white flash.

I tried to get help from internet, found many solutions with css and javascript, but they were either complex to implement or unable to solve this problem.

I wonder why I didn't try anything with JQuery and when I tried, the issue was solved!
Below is the logic that I followed:

To explain the solution let's take below as my link and iframe ids.
my link id: dwnloadDoc
my iframe id: myiframe

Step1: Write iframe load event in jquery as given below.

$('#myiframe').load(function(){
$(this).show();
});

Step2: Hide iframe on link click

$('#dwnloadDoc').click(function(){
$('#myiframe').hide();
//link click logic
});

How It worked:
When I will click the link, my iframe will get hidden. I  will bring data from server and will load it in iframe.
My iframe load event will get called after iframe is loaded which will show the iframe.
That means iframe will be hidden in its loading period, avoiding white flash.


Understanding Boxing and Unboxing in C#

Boxing is the process of converting a value type to the type object. Unboxing extracts the value type from the object. Let’s see how boxing and unboxing works.



Boxing: This is an implicit process. That means developer doesn’t need do any type casting.
See below line of code:
int boxingInteger = 123;

This will create a block on stack memory area for variable of type int.

Stack

boxingInteger


Now see below line of code:
object myObject = boxingInteger; // boxing

This is the step where boxing is occurring. When above line is executed, two things will occur at backend.
1.       An object will be created on heap area that will hold value of boxingInteger.
2.       Reference type myObject will get created that will point to memory area allocate in above step.
Note: It will not affect boxingInteger variable on stack. The entry on stack will be there after boxing.



Unboxing: It is reversing of boxing. But it is explicit. Developer need to do type casting explicitly. It will type case object on heap to the value type.
From above example,
int unboxingInteger = (int)myObject;  // unboxing

It will convert value at my object from object type to type int and it will assign this value to variable unboxingInteger which will get created on stack area.

Stack

unboxingInteger
boxingInteger



Myth about Boxing:
Myth: Below code does boxing.
string sMyString = “Box”;
object myObject =   sMyString

Truth: string is not a value type variable. It is a reference type variable. So when you are assigning sMyString to myObject, you are just copying reference. There is no value type to object type conversion is happening here.


To get depth knowledge check this:
http://www.codeguru.com/Csharp/Csharp/cs_syntax/article.php/c5883



Difference between const char *p and char *const p


const char *p and char *const p  both look similar, but are different!
const char *p -- It is a non constant pointer to constant data. That means the data to which it is pointing can never be changed.
For example,
char mychar = 'a';
const char *p = & mychar;
*p = 'b'; //not possible as value at pointer is constant i.e. 'a'

char *const p  -- It is a constant pointer to non constant data. That means, this pointer points to address that is constant and thus pointer cannot point to other address.
For example,
char mychar = 'a';
char mychar2 = 'z';
const char *p = &mychar;
*p = 'b';
p = &mychar2; //not possible as you cannot change address value of pointer


What is location.search in javascript?

location is an object that provides information about current url.
"search" is a property of location object that gives query portion of the url.
For example,
if url is : http://www.sample.com?id=1&qs=5
then window.location.search will return "?id=1&qs=5".
You can apply regular expression on this result to get query string parameters in javascript/jquery in case if you don't want to go with any plugin that reads these values.


Update value against the same key in hashtable using C# code

There are two ways you can add data to your Hashtable as shown below:
ohashtable[Key1] = Value1;
ohashtable[Key2] =  Value2;
ohashtable[Key3] = Value3;

Or like this:
ohashtable.Add(Key1, Value1);
ohashtable.Add(Key2, Value2);
ohashtable.Add(Key3, Value3);

There is a difference between these two ways. 
Using Add method, you can't have update the value against existing Key. But you can, if you use the square brackets. 

For example,
ohashtable.Add(Key1, Value1);
ohashtable.Add(Key1, Value2); //this will throw exception at run time

Whereas,
ohashtable[Key1] = Value1;
ohashtable[Key1] =  Value2; // this will allow the entry in hashtable
It won't add a new key but will update the value against the existing key.

Difference between malloc and calloc in C

Malloc and Calloc are functions provided to allocate memory at run time.Both of these functions return pointer to first block of  allocated memory in success and return null in case of failure.
Though their purpose is same, there are few differences between them.


1. No. of Arguments: 
Both these functions vary in number of arguments they accept.


void *malloc(size_t size);

void *calloc(size_t n, size_t size);

Malloc takes only one argument that describes size of block to be allocated in memory.

e.g. oPointer = (int *)malloc(sizeof(int) * 2); will allocate size of 4 bytes(size of int is 2 bytes).
Whereas, Calloc takes two arguments number of blocks and size of each block.
e.g. oPointer = (int *)calloc(2 ,sizeof(int)); will allocate size of 4 bytes(size of int is 2 bytes).


2. Default Initialization: 
Malloc does not initialize the memory allocated whereas calloc initializes the allocated memory to default (e.g. Zero).


3. Calculation of memory reuired:
Malloc function does not calculate total memory to be allocated, the argument itself describes the total memory whereas, calloc accepts two argument and internally calculates their product to find total memory to be allocated.