Database Normalisation

This is an important concept one must know when dealing with databases. This is something which is quite often asked in Interviews.

Database  Normalization is a technique of decomposing data in a table. The main Intention to perform Normalization is to remove Data Redundancy and to ensure that there is uniqueness and consistency across the table.

By performing Normalization we resolve Issues of Insertion, Updation and Deletion. In case we have a table which is not Normalized, then there is a possibility that we might have two rows which are similar. And if we want to delete a particular row, Instead of performing one delete operation, we have to do it twice. This decreases the efficiency and multiplies the overhead cost. Since we are literally doubling the operations we perform.

In Order to overcome this, there are Normalization Rules available. And in case a table follows these rules, then the database can be called Normalized.

There are 4 major Normalization Rules-

  1. First Normal Form (1NF)
  2.  Second Normal Form (2NF)
  3. Third Normal Form (3NF)
  4.  Boyce and Codd Normal Form (BCNF)

 

These rules will be explained later!

Persistence

Persistence is quite a common term used in the English Language. It is used to refer to a quality or trait .That is someone who consistently strives to do something in order to achieve a particular goal or task. And in most cases this attribute is said to stand in good stead. The field of Computer Science and Operating Systems also has something called as Persistence. Whether the meaning of persistence in Computer Science is similar to that of the English Language remains to be seen.

In Computer Science, persistence means a resource which exceeds it’s normal/original life term and continues to exist in the system. An example for such kind of resources would be,  the resources which exist in the Hard Disk of the Operating System. As you would all know, the contents residing in the hard disk or the secondary storage memory are non volatile and continue to “exist” even after the computer or the system is turned off. This shows that the resource is “persistent” to stay alive and not go away after it is turned off.

JQuery CDN Issue

 

Every programming language or a script requires a library in order  for the developer to experience all the the functions and features of the language. A library is a resource which has got lot of useful and important information which allows programs to execute properly.  All major programming languages require you to include the libraries before writing the program.

For Example in the C language-

# include <stdio.h>

 

In C++

 

# include <iostream>

 

JQuery (which itself is a library of the Javascript programming language) also requires a library in order for the JQuery code to function in the web browser. It can be either downloaded from the Internet or we can specify a url which would access that resource (CDN). Google is one of the hosting providers which hosts  JQuery libraries.

While working with JQuery you might have observed that sometimes the CDN fails to load. You might have used the latest JQuery CDN but still it does not work.

The main reason it does not work is because the JQuery file is linked before we place the JQuery CDN in the header section of the html file.

Something like this-

We are taking an Instance where we are using the JQuery libraries hosted by google and assuming that the JQuery file we have written is named as “script.js”

In the HTML File,

Capture

 

 

 

Which is wrong.

 

This would be the solution in order to avoid this problem.

Steps:

1.First place the JQuery CDN on the header section of the HTML file

2. Then use the script tag to link to your JQuery File.

 

Capture

And it works!!

Virtual Memory

Have you ever wondered how are you able to continuously launch applications one  after the other without the RAM saying “Stop!! I can’t take it anymore!”. This is one of the features which is very understated in an operating system. It is something which happens in the background and the end user never realizes it.

Today we are going to get a brief insight of Virtual Memory. It is the memory which is transferred from the RAM to the ROM  or the hard disk. Now why would the Operating System do that? The operating system has a limited amount of RAM or Primary storage memory. And once this memory get’s almost full, the memory  it is temporarily transferred to the secondary storage ROM.

Now, who is responsible for the transfer of memory? It is a resource known as MMU, which is an abbreviation for Memory Management Unit.

We will learn more about MMU and what it does later. Until then see you next time!

SSD

Have you had situations where your laptop runs terribly slow and wished that it had run faster?? Well, you don’t need to leave your wish remaining unfulfilled for too long since SSD’s have come into the market. They bring a radical transformation to the overall performance of a machine. Many users have experienced a tremendous improvement in the efficiency  and performance once they have switched over to SSD’s.

Now you might be thinking that all that is good but what exactly are SSD’s??black-297648_960_720

Well, SSD is an abbreviation for Solid State Drive. It is a solid state storage device. A solid state storage means that the Information can be stored and retrieved using electronic circuits and there are no mechanical moving components involved. It is non-volatile and hence the Information can be retrieved even after a power cycle.  It can be compared to other devices having non-volatile memory like the External Hard Drive.

Solid State Storage Devices have the following Advantages  over an External Hard Drive-

  • They are faster
  • Consume lesser power
  • No Vibrations
  • Resistant to physical shock
  • No heating Issues
  • Lighter

This technology is used in a wide variety of devices right from SD Cards and USB Flash Drives to large servers.

A Solid State Drive uses an IC Circuit as memory and the data is stored persistently. It has Electronic Interfaces which are compatible with the traditional Input Output Hard Disk Drive. They have Introduced new I/O Interfaces known as SATA Express which supports data transfer speeds upto 1969 MB/s.

You should not be surprised if a day comes when the default secondary storage for a Computer is a SSD and not an External Hard Drive!

JQuery-Hide Action

JQuery is a library of the JavaScript Programming Language.  It was introduced in order to make a website more dynamic. HTML and CSS which are the core languages for web development generate static content.

JQuery makes the website more fun and interactive for the end user. You can have buttons on the website which get highlighted or glow once the mouse is over them. It can also do animations, sliding panels  and many other things. In order to perform them, JQuery provides certain actions. The official motto of JQuery is to “Write Less Do More”. And this is exactly how JQuery works. With lesser number of statements, it can display a perceivable output.

There is a hide action in JQuery, which hides an element during an event. The event can be a time when you click on an element or hover over it. Today let’s see what happens when use a hide action with a click event.

Let’s suppose we have a  Blue Box

Capture

And we click the element. Then what is going to happen is, the box will disappear form the screen since we used the hide action on the click event. Let’s see how the code for this looks like.

$(document).ready(function(){

$(‘div’).click(function(){

$(‘div’).hide();

});

});

The above code basically means  that once the HTML document has loaded. And we click on the element, the concerned element disappears.

Virtual Machines

Have you ever got bored of the Operating System which you were using and wanted to switch over to something else, But didn’t have enough money to buy a new one?? Then Virtual Machine is a solution for you!!

Now don’t get intimidated by the term! It might sound so initially. Even I too was flustered by what it meant when I first encountered this term. But once you get to know about it, you would feel that it could be something which you could use in your daily life!

What comes to your mind when you hear the word “Virtual”?? Think…..

download

Sci-fi, Simulation Games, Video Conferencing, Tele Presence, Skype, Virtual Images(Remember!!You might have studied this in your Physics Class-Optics, focal length, Real Image….), Virtual Memory (Related to Memory Allocation in an Operating System. I would talk about that in my forthcoming blogs), 3D Movies….Well, the list would go on..

So, what you have thought of are terms which belong to contrasting contexts. Movies, Games, Physics,  Operating Systems.. You know what I mean? But, all of them are related in one aspect. They try to create a simulated or make-believe environment. To show something which might not be physically existing.

This can be related to the field of Operating Systems also. With a physically existing Operating Machine, we could have another “Virtual” Operating System to run over it. And the reason we are calling it Virtual is, because even though it is not the primary Operating System of your computer, you are made to believe that it is one! It would perform all the functions which one would normally perform in an operating system, like browsing the net, creating files and folders etc.

 

One of the main advantages of using a Virtual Machine would be that you could use two operating systems at once! Once the Virtual Machine is running, it would just be another window of an application and you can easily switch between them.

 

Now there are many Virtual Machine providers in the Market. Some are free and some are paid. The popular Virtual Machines providers are- VMWare, QEMU, ParallelsDesktop, VirtualBox.

Some of them are used for specific purposes. For Example- The ParallelsDesktop is normally run in the Mac OS X operating System. It is used to run Windows over the Operating System. VMWare comes up with different packages based on the needs of the end user. Just to name a few-VMWare Workstation Player and VMWare Workstation Pro.  The former is for people who just want to get a feel of the Virtual Environment and the latter are for the ones who would like to experiment and use some advanced features. One way of using it would be to run VMWare on a Windows Operating System and have a virtual Linux Environment. QEMU is another Virtual Machine which is mainly used in the Linux based Operating Systems and it can run Windows over it.

 

If you are Interested there are many articles and reports which would give you a further Insight on this topic.

http://www.howtogeek.com/howto/11287/how-to-run-ubuntu-in-windows-7-with-vmware-player/

http://www.jncs.com/php/info/VMware-Explained.php

http://www.parallels.com/products/desktop/

http://www.vmware.com/products/player/

http://wiki.qemu.org/Main_Page

 

Happy Reading!

 

 

Cross Browser Issues

As you look back into the nineties and compare that with the present day world, what do you think has been the major change/difference? Some of you might say that smartphones or laptops has been the change. But I hope that most of you would agree that Internet has changed our lives dramatically.

We can send emails, surf the net and buy whatever we want. In fact if you really see a smartphone without Internet/Data would just be a phone and not a “Smartphone”. Since most of the apps which make it “smart” need Internet in order to make the Applications work. You might still be able to use the app  and view the content because of Asynchronous Programming which I discussed in the previous post.  But unfortunately, if you need to receive new  content you really need Internet and it won’t come from thin air!

Nineties was the time when Internet first started coming into existence. And it took off from there on. Initially we had only the Internet Explorer for Windows and NetScape for other operating systems. But as time passed, the number of browsers in the market started increasing manifold. And now we have a multitude of options to choose from. To name a few-Mozilla FireFox, Opera, Google Chrome, Internet Explorer,Microsoft Edge, Safari. We are now not limited to the default browsers provided by the Operating System.  We have the freedom to choose what we want. That’s good right?? But, it is not a good thing for developers. They have to now test their website or web app across browsers and see whether they are rendering similar web pages. Earlier they would  have tested for two or three but now they have to test three times this number!

Now developers face situations where some feature may show up correctly on one browser, but may behave the opposite when tested on another browser. This has elevated a new problem called “Cross Browser Compatibility”. The task for a developer is to make his/her web page render similarly across all browsers.

Some of the reasons this incompatibility occurs is due to-

  1. Forgetting to mention <!DOCTYPE html> declaration on the beginning of the HTML document. Some browsers might automatically add that line of code, and some might not. Hence the difference. It’s always a good practice to add that line at the beginning of the document. This declaration denotes that we are confirming to HTML5 Specifications.
  2.  Not having CSS Reset Code. It resets the value of border, margin and padding to zero. Different browsers have default values for border, margin and padding unless specified otherwise. Mentioning the CSS Reset Code forces the browser to reset these values to zero.

      {

border:0;

padding:0;

margin:0;

}

3. For Certain CSS Properties, some browsers have a “prefixed” version of it. And in case it is not mentioned, that property will not render properly in the browser. For Example,

-moz : Mozilla Firefox

-ms: Microsoft

-o:Opera

-webkit: Safari and Chrome

These have to be prefixed against some properties in order to run correctly.

4. Not closing tags in HTML. HTML is a scripting language where everything is written between a start tag and an end tag

For Example

<body>

<h1>Hello</h1>

</body>

Inside the body tag we have an h1 tag which would display the Heading Hello. Sometimes developers forget to close the tag. Some Browsers may be forgiving and would automatically close tags for them. But, unfortunately most of them do not. And it is always a good practice to close the tags once you have started it.

So, That were some of the Incompatibility Issues which could be addressed if a good programming practice is followed. For Viewers Interested in this topic and would like to dive deeper, these links might help you:

https://en.wikipedia.org/wiki/List_of_web_browsers

http://www.thetoptens.com/best-web-browsers/

http://www.wisegeek.com/what-is-browser-compatibility.htm#didyouknowout

https://www.browseemall.com/Blog/index.php/2014/04/24/5-most-common-browser-compatibility-issues/

http://1stwebdesigner.com/cross-browser-compatibility/

 

Happy Reading!

 

Asynchronous Programming

Asynchronous Programming is another concept which is slowly being used in the desktop and web applications. Have you ever experienced a situation where a web application or a desktop application is slow to respond once you request for something? I bet many of us, might have faced this situation currently or in the past.

This might be because these applications might have not adopted the Asynchronous programming approach.  Let’s take an example  of an Application which does not follow the Asynchronous Programming approach.

Suppose, we have a desktop application which obtains it’s content from the web. And for some reason during some particular day, the internet server is down or it is too slow. Due to this, the whole application will stop functioning and we will not be able to use the other aspects of the application. So, just because one resource fails to execute properly, the whole application stops working. This is not a pleasant situation in case we want the users to continue using our applications.

With Asynchronous Programming, this situation can be handled quite effectively. We can simultaneously run other other parts of the application, in case some aspects stop functioning temporarily.

Let’s take another example. Microsoft Excel is a common application which runs in the Windows Platform and there are similar applications which run on other Operating Systems as well. Many of us have used it.

Now let’s say we have created a spreadsheet regarding Contact Names and Telephone Numbers. And then suppose we want to search the Name of a person. Sometimes even though you are sure the Name is present, it would return a prompt saying that the Name is not found. In this case the search feature of Excel is currently not working. But, we would still be able to add new rows or columns and continue working with our application.

 

C# has recently added a new technique for Asynchronous Programming, to make it easier to adopt this feature.They have added two new keywords Async and Await which in a sense saves time in making the application Asynchronous.

 

 

Type Safety

This is another very important topic in the context of coding. Programming Languages can be classified based on their type safety. Basically you can have two kinds of type safety-

  1. Strongly Typed
  2. Weakly Typed

Some Languages fall into the Strongly Typed Category and some of them fall into the Weakly Typed Category.  Let’s see what to they mean-

A Programming Language is said to be strongly typed if it forces us to define a datatype for each variable. By now, you might be knowing what datatypes are. Some of the common datatypes are int, char, boolean, float etc. It basically defines the type of the data. Whether the data is a number, character or a string.

For Example-

56

This is  a whole number. And so we need to define it as an integer. In order, to use this value we have to store it in a container known as a variable.

Let’s name the variable as “apple”.

We store the value in this variable. And since the contents of the variable is a whole number, we define the variable to be an Integer.

So, we have to write something like this-

int apple=56;

Capture.PNG

We have a pink box (known as a variable) named Apple. And in that box, we store a value called 56.

 

A Strongly typed Language forces us to define the type of a variable. In this case, had we been coding in a strongly typed language, we would have written int apple=56 .

 

Whereas in a weakly typed language, we are not forced to define the type of the variable. We could have simply written apple=56; and it would have worked!

And In a weakly typed language we can mix two unrelated types. By “Unrelated” what I mean is that an Integer and a Character or an Integer and a Boolean Value. Related Types could be Integers and Decimals.

So, in a weakly typed language, we could add a number and a character and it would allow us to do it.

Example

$apple=45;

$ch=”and”;

$next=$apple.$ch;

print $next;

 

This is what we would have written in Perl, which is a weakly typed language. In Perl, the variables are prefixed with a dollar sign. So, we have a variable named apple which stores a whole number 45. And we have another variable named ch which stores a string named “and”. In the third line, we try to combine the two unrelated types. And finally, we try to print that result.

And the result is??

It would be  45and

 

So, this essentially demonstrates that weakly typed languages have no problem mixing unrelated types.

Some of the strongly typed languages are- Java, C# and a  weakly type Language would be Perl.