May 15, 2015

Keys in SQL

  1. Primary Key
  2. Candidate Key
  3. Foreign Key
  4. Alternate Key
  5. Composite or Compound Key
  6. Unique Key


Candidate Key :


A Column with
  • Unique values
  • No null values


[A Table can have more than one column with above attributes. All these columns are candidate keys]


Primary Key:


A Column with
  • Unique values
  • No null values


[A Table can have more than one column with above attributes. But one of these column can be a primary key]


(Info: A table can have only one primary key but any number of candidate keys)


Alternate Key


When a table contains more than one candidate key (say 3 candidate keys), after selecting a column as a Primary key, other 2 columns are called as an Alternate Key


Unique Key:


A Column
  • with Unique values
  • can have null values


(Info: A table may not necessarily contain all the keys, but at least a primary key)

Composite Key:

Two or more columns collectively used to identify a row
Example: 
1. Identifying a student in a student table using his name and his father name
2. Identifying a student in a student table using his name, father name & Birth-date


Foreign Key:

  • Presence of a column in a table which is a primary key for another table.
  • This column is responsible for establishing relationship between two tables.

Multi-tenant and Single-tenant architecture

Multi-tenant architecture website:


  1. Single instance
  2. Data from multiple companies/users stored in a same database server
  3. Data are partitioned to prevent mismatching
  4. Standard and common configuration, templates, styles for all companies/users
  5. No individual considerations
  6. Any modifications are common to all
  7. Customization for single company/user is difficult
  8. Advantages:
    1. Safe - Any changes / modifications are common to all
    2. Meets the needs of most of the companies/users


Single-tenant architecture website:

  1. Separate instance and infrastructure for every company/user
  2. Used by companies/user when they need personal customization
  3. Every company/user has a distinct database server
  4. Advantages:
    1. More Secure - No data migration/ mismatching
    2. Preferred if the company needs a legal requirement

Tags: Multi-tenant and Single-tenant architecture, Multi-tenant, Single-tenant

June 25, 2014

Naming of C++ and C#

We know that C++ is the predecessor of C. Then why C++ and not D?

C++ (Pronounced as See Plus Plus) was renamed from C with Classes. More new features where added to it and the Version is Incremented by 1. Hence the increment operator itself was used. There is a programming language D too.

C# (Pronounced as See Sharp) was inspired by musical notation where a sharp indicates that the written note should be made a semitone higher in pitch. The sharp symbol also resembles a ligature of four "+" symbols (in a two-by-two grid), further implying that the language is an increment of C++.


March 25, 2014

Tetra pak

About the Pack:

Visit the local supermarket and there are so many different kinds of packages on the shelves. As an environmentally conscious consumer, how do you figure out which to choose? It helps to know exactly what you're buying. See what goes into a Tetra Pak package below.

Packaging material

1. Paperboard
The main ingredient in all our packages is paperboard. We use just enough to make the package stable, without adding unnecessary weight. Paperboard is a renewable raw material, made from wood.

2. Polyethylene
Thin layers of polyethylene - a commonly used plastic - are added to seal in the liquid and protect the product from external moisture.

3. Aluminium
Packages designed to store food without refrigeration also contain a thin layer of aluminium foil. This protects the product from oxygen, flavours and light.

Raw Materials:

Why use renewable raw material?

Tetra Pak packages are mostly made of wood, which is a renewable material.

Renewable simply means that the supply regrows naturally. Wood is renewed when trees grow at the same rate or faster than they are cut down. Tetra Pak only buys paperboard from suppliers who ensure that their wood comes from known and acceptable sources.

Forest Protection:

As wood is the main material in our packaging, it's natural we are interested in conserving all forests, not just those we use for our packages.

That's why we work with trusted global organisations such as the World Wide Fund for Nature (WWF), the Global Forest & Trade Network (GFTN) and Forest Stewardship Council™ (FSC™) to increase responsible forestry worldwide.

Life of a package:

Using renewable raw materials
We use renewable materials, as far as this is possible without reducing the performance of the package.

Recycling
To increase recycling, we work with customers, public authorities, NGOs, industry groups and community associations.


Your role as a consumer
At this stage in the package's life cycle - from the store to the recycling station - what you do also plays an important role.

Making production and distribution efficent
Customers use our equipment to package their products. We continously work to reduce the consumption of energy and water, and to minimize the amount of waste.


Turning raw materials into packaging material
Our goal is to minimise energy use and reduce waste during production at our factories.


Using certified paperboard
In 2008, 97% of the paperboard in Tetra Pak packages came from environmentally certified, responsibly managed forests. (Not bad going, but the goal, of course, is 100%).

Design for environment:

By using resources sparingly and designing cartons which can be recycled effectively, Tetra Pak's product developers help to minimise the packages' environmental impact. In practice, this means:

  1. Increasing the amount of renewable material in the package
  2. Reducing the amount of plastic in caps and packaging material
  3. Increasing efficiency of our equipment
  4. Minimising energy consumption
  5. Finding ways to eliminate waste
  6. Minimising emissions to air and water
  7. Securing efficient storage and transport solutions
Recycling:

What happens to used cartons?

If you live in an area where household rubbish is separated for recycling, your used cartons will be transported to a recycling plant. There, they will be soaked in water to separate the paperboard from the plastic and aluminium layers. The paper content can then be turned into new products like toilet paper, tissue and notebooks. The plastic and aluminium can also be recovered to make things like roof tiles or plastic pots.

Energy recovery

Recycling is not the only way to dispose of old cartons responsibly. They can also be incinerated and the energy recovered to generate heat and electricity. Some countries, such as Denmark, have decided to handle rubbish in this way. In Europe in 2007, 33% of all drink cartons were used to generate energy.

Source: http://campaign.tetrapak.com/

December 15, 2013

Google Glass: Early impressions

Gizmag begins its journey of exploration with Google Glass

Most companies conduct their experiments behind closed doors. If, say, a new iPhone hits store shelves, then chances are the dirty work has been done and it's already pretty polished. But Google is very different, sometimes letting the public join in on the beta testing fun. Gizmag recently joined Google's US$1,500 smartglasses beta test, and though we're still a ways off from a full Google Glass review, these are our early impressions.

Google describes its Google Glass early adopters as "Explorers," and I think that's a pretty fitting label. Based on my first days with Glass, I can say that using it is definitely unlike anything I've done before. This isn't a subtle nudge towards progress. Glass is Google's forceful bulldoze into the future, and when you join that crusade, you do feel a bit like Ponce de León, Neil Armstrong, or James T. Kirk. Only much funnier-looking.

Be prepared to draw some stares if you wear Google Glass

Yep, Glass very noticeably changes your appearance. Unlike a smartphone, which you can slip into your pocket, or even a smartwatch, which can be easily hidden behind a sleeve, Google Glass makes its presence known to anyone within sight of you. And there's really no way around this. If you have longer hair or wear hats, the effect is a little more subtle. But on a bald head like mine with nothing to distract from it? There will be stares. In these early stages of "Exploring," I think that self-consciousness is the biggest obstacle to embracing the Google Glass experience. I find myself thinking twice before wearing it out, wondering if this dinner or this trek to the supermarket is worth drawing the stares and questions, or whether I'd rather save that for another trip.

I don't think Glass looks bad. It's comfortable to wear, and is probably about as fashionable as a face-computer can be in 2013. I definitely feel like I just enlisted in the first stages of the Robocop program, or perhaps as a chief engineer on the starship Enterprise, but I think it looks alright. Most people's first reaction involves some kind of wrinkling of the brow (whether out of curiosity or abhorrence). But then again, maybe people reacted that way to the first prescription glasses, piercings, or shaved heads. Now those are all accepted styles in most cultures, and, who knows, maybe devices like Glass will be one day too.

Gizmagging and driving is still legal, as far as we know

For society to embrace smartglasses, though, the devices are going to have to do some pretty damn cool stuff to make it worth our while. Right now Glass is a mixed bag in that respect, as you'd expect a beta product to be. But it's also undeniably oozing with potential. As I'm writing this, I heard a chirp in my right ear (though technically I heard vibrations that traveled through the right side of my skull). I lifted my head to about a 30° angle to turn the screen on, and saw that I had a new text message. I read the text, tapped on a link, decided I'd handle it later, and went back to writing. Hardly world-changing stuff, especially when you're already sitting at a computer. But when you consider that I could have done that whether I was driving (while still paying attention to the road, of course), running a marathon, or skydiving out of a plane, you start to see the potential here.

When you put Google in your field of vision, you start to realize the potential

But I don't think notifications alone make smartglasses worth all the gawking you'll endure. Most of the early smartwatches handle notifications well too, only they don't wrap a long plastic bar around the side of your head. For me the biggest reason to get excited about Glass is, well, Google. You might already know that you activate the voice control portion of Glass by saying "OK Glass" from the device's main screen. The list of things it directly responds to is pretty limited right now (stuff like sending messages, taking pictures, or getting directions). But if you add a "Google" onto that ("OK Glass, Google how tall is Kevin Durant?"), you plug your query into the world's biggest search engine. And with Google search now answering more and more questions with direct answers (in addition to the tried-and-true web results), well, you can see where this could really shake things up.

While it's in beta, you'll have to a) get an invite, and b) plunk down US$1,500 to be a Go...

If a smartphone is like having the web in your pocket, then Google Glass is like having the entirety of Google in your field of vision. No matter where you are, no matter what you're doing, as long as you're wearing Glass, the world's vast reservoirs of knowledge are available to you. This really feels like a first baby-step in the direction of things like connected contact lenses or computer brain implants. I joke about the cyborg thing, but that's really what we're doing here. Any knowledge you seek is just waiting to be displayed in the upper-right part of your field of vision. Whether humanity as a whole actually goes in that direction is anyone's guess. The potential benefits are obvious, but so are the pitfalls. Can computers become intertwined with our eyesight without disconnecting us from, well, life? Will others always wonder whether you're really experiencing the moment with them or just checking the score of the Lakers game? Even worse, will people constantly worry that you're taking pictures of or recording them?

There's nothing subtle about Google Glass

These kinds of questions will probably follow Glass for a while, and we'll keep revisiting them too. But my first impressions of Glass are that it's the boldest product I've ever used ... and maybe also the most terrifying. Its potential reaches far beyond typical consumer lust, but gaining that mainstream acceptance might also be its biggest challenge.

Source: Gizmag