Triangulation/Trilateration in GPS

Global Positioning System (GPS) has made a tremendous impact in our life and has become immensely popular in recent times. GPS receivers are omnipresent and the applications of GPS extend beyond technology purposes. At the core of this wonderful technology is a simple mathematical/geometrical concept called trilateration or triangualation. Imagine you are lost one day and you don't even know if you are on the northern or southern hemisphere. All that you have is a GPS device with you to locate yourself.

To start off, you are situated somewhere on the surface of the earth (Now don't tell that the earth is not a perfect sphere). Your GPS device receives position and time (sent) information from GPS satellites and the distance is calculated based on the standard distance-time formula given the fact that radio signals from GPS satellites travel roughly with the speed of light. The key problem here is that you don't know the direction but you only know the distance from a satellite.

Consider the blue sphere as the earth E. We are trying to locate a point P on the surface of the earth.

When your GPS device calculates the distance x from satellite say S1, you know that you might be located anywhere on the surface of a sphere of radius x with S1 as the centre. But you don't know in which precise angle you are located in the 360 degrees. Now when your GPS device gets hold of another satellite S2 and calculates the distance y from it, you can apply the geometric principle that spheres intersect in a perfect circle to narrow down your position to somewhere on the perimeter of a circle. Now, the point at which this circle intersects with the earth should give your location on earth. Now when your GPS device calculates the distance z from a third satellite S3, the sphere of radius z with S3 as centre will intersect the circle of intersection of the other two spheres at two points. Only one of those two intersection points will actually lie on the surface of the earth and the other point will lie in space. The point on the surface of the earth will give your location on earth.

GPS satellites transmit time information derived from high accuracy atomic clocks but the GPS receivers cannot afford such high precision clocks. There are several factors that might introduce errors in GPS like clock inaccuracies, rounding errors, multipath and atmospheric effects, etc. Since the earth is also not a perfect sphere, GPS receivers generally look to four or more satellites to compute the precise location.

AppFabric Caching (aka Velocity Caching) - Microsoft .NET

Caching is an essential component to speed up any web application by minimizing the number of trips to the actual database. AppFabric Caching or Velocity caching is a distributed caching system that leverages the caching infrastructure available across a cluster of cache servers efficiently to enhance application performance as well as scalability. The secret behind the effectiveness of appfabric caching lies in the fact that duplicate data is not cached by the cache cluster because whenever data is requested by any client, it is first looked up in the unified logical cache and if available the data that reaches the client can be from the physical cache memory of any of the servers in the cluster.

Appfabric Velocity Caching Architecture Design Overview Diagram

Velocity caching is implemented in a synchronized tier and the service can be accessed across the network with the cache servers in the cluster running the process (DistributedCache.exe). Even though several cache servers contribute to the shared cache memory, there is a common gateway for data to enter and exit in the form of a centralized and shared cache. The distributed cache is handled in code with the help of simple get and put methods that will retrieve, insert, update or delete data items in the unified logical cache as a whole. The programmer is not worried about the internal implementation or the physical location of cached data in the cluster.

Notable Aspects:
  • Each server in the cluster stores the session object data in its RAM and does not write it to disk for obvious reasons
  • No code change or new code has to be incorporated by the programmer and all that is needed is to change a configuration setting in order to activate velocity caching
  • Distributed caching means multiple web servers can each run an instance of the same application which helps in load balancing
  • Both web server (IIS) and cache server (Appfabric) can be deployed on a single application server running on Windows Server OS
  • Turning on the high-availability feature helps mitigate situations when a server in the cluster goes down by storing a synchronous secondary copy of the data item on a different server
One of the key challenges for the implementation of velocity caching involves managing parallel access to data that changes rapidly and velocity caching offers different concurrency models suitable for the concerned application. Controlling access to sensitive data among the clients is another challenge which is controlled by limiting access to such data with encryption or restricted accounts. Appfabric caching attempts to maximize the benefits from the underlying computer infrastructure with the help of a distributed yet shared architecture to provide value for both application developers and end users. Things can only get better from here.

Lava A9 Mobile Phone - Personal Review

Lava A9 India 3.2MP Camera Review

Lava A9 Dual Sim Phone is a handsome instrument with an assortment of useful features and applications at an affordable price. The phone looks solid with a hard metal body and a smooth keypad which gives an elegant appearance to the phone. Lava A9 comes with a 3.2MP camera that lets you take pictures and shoot videos but the image quality is very poor and doesn't live up to the expectations of a 3.2MP camera. The zooming option is also limited and the camera is a big let down in A9. There is 64MB internal phone memory and the phone will support up to 8GB Micro SD Cards. Listening to music on this phone is not a pleasant experience on the loud speaker but the audio quality is slightly better while hearing it on the ear phone. FM reception is also not satisfactory.

Having said the above glitches in the phone, Lava A9 is otherwise an excellent phone with an impressive profile. The phone comes with both EDGE and GPRS support enabling you to connect with the internet through the pre-installed Opera Mini web browser. Nimbuzz is a refreshingly new application that comes pre-installed with Lava A9 with which you can make calls or chat with your friends over the internet sans the conventional call charges. The phone with a user friendly interface has all the features we expect including bluetooth, java games, Ebook reader, Email support, MP3/MP4 Player, etc. Apart from the usual audio and video recorder the phone also lets you record streaming FM audio in any of the three formats WAV/AWB/AMR. You can also search your contacts with phone number as the search criterion which is handy at some situations. You can also integrate the phone with your PC with the help of Lava A9 PC Suite that can be downloaded from website. Apart from the camera and loud speaker anomalies, LAVA A9 is a good looking phone with powerful features and provides value for money.

Samsung Corby S3653 - Mobile Phone Review

Samsung Corby S3653 Review FeaturesI had a chance to handle this phone after my friend bought it last week. As far as the design is concerned, holding the phone in my palms was a bit awkward considering the width (56.5 mm) of the phone but it is an advantage when it comes to a bigger screen experience. The phone with a plastic body is light weight but still sturdy and looks plain and simple. From the design perspective there is a dedicated keypad lock/unlock button on the right side. Virtual keypad means minimum buttons on the front panel and maximum screen size. The capacitive touchscreen performs well and the interface is intelligently designed for easy navigation of menu items. The menu icons can be docked on the left side for quick access or pulled out from the menu which spans 3 pages that can be easily flicked through. The 2MP camera shoots well in good lighting conditions and the single finger image zoom option is handy while viewing pictures. The phone has a gamut of applications and widgets to integrate with the internet and the social networking world. The sound quality is good and watching videos in a wide screen is comforting as well.

How to transfer data from one table to another table?

In software engineering profession everyday new challenges and problems turn up in the blink of an eye and as engineers we are obliged to resolve them ASAP. One of the biggest challenges in the IT industry today is handling data that is vast and increasing everyday. Data is normally stored in databases in the form of tables and a common situation while handling databases is to transfer data from one table to another.

Case I: If both tables reside in the same database server

Consider the case where you want copy the data from Table_1 under Schema_1 into Table_2 under Schema_2. A simple sql command to do this operation would be

INSERT INTO DB_Name.Schema_2.Table_2
SELECT * FROM DB_Name.Schema_1.Table_1 WHERE [condition]

If you want to insert only certain columns you can slightly tweak the command accordingly

INSERT INTO DB_Name.Schema_2.Table_2(COL1, COL2, ....COLn)
SELECT COL1, COL2, ....COLn FROM DB_Name.Schema_1.Table_1 WHERE [condition]

Case II: Load a table from a file

Consider the situation where you want to load a table from a delimited file. This can be done using the BULK INSERT command in Transact-SQL. In order to perform this operation you need access to the file present in the database server. CSV (Comma-seperated values) is a common format used to store the data from a table or spreadsheet. To load a database table from a .csv file use the following command

FROM 'C:\Program Files\File.csv'

Bulk insert command provides a slew of options to load a table from a simple delimited text file or even from an xml file.

Case III: If both tables reside in different database servers

The bcp Utility is an excellent command line tool to transfer table data between two different database servers swiftly across a network. You can use bcp to extract table data by querying the table and store it in a delimited file. You can then load the other table from this delimited file easily using a simple bcp command. You don't even have to login to the servers to access the files.

bcp DB1.SCHEMA1.TABLE1 out FILEPATH -n -S[server_name\instance_name] -T -e[error_filepath]
bcp DB2.SCHEMA2.TABLE2 in FILEPATH -n -S[server_name\instance_name] -T -e[error_filepath]

-n uses the native (database) data types
-S should be added before server name
-T using a trusted connection
-e should be added before filepath for error file that logs the failed rows

The first command extracts the rows from TABLE1 and stores in the appropriate FILEPATH (eg. C:\Program Files\File.csv) in the database server. The second command loads TABLE2 with the data present in the File.csv. You have to run the first command to create the file first and then run the second command to load the data into the table. Instead of selecting the entire table you can also include your own select query within the bcp command. BCP offers a legion of options to transfer data between tables in different modes and formats.

Alternately you can also make use of Data Transformation Services (DTS)/ SQL Server Integration Services (SSIS) package in order to consolidate data from heterogeneous data sources.

Useful Resources:

bcp Utility -
bulk insert -