Friday, April 18, 2014

SQLServer Protocols

SQLServer and its SQL Native Client are communicating through the protocol layer called SNI (SQLServer Network Interface).  The data packet is in MS proprietary format called TDS (Tabular Data Stream),

SQLServer communication supports 4 protocols:
(1) Shared Memory - used within the same server
(2) Named Pipe - developed for LAN environment.  Used within the server or between 2 server across LAN.
(3) TCPIP
(4) VIA (Virtual Interface Adapter) - used with compliant hardware

Thursday, April 17, 2014

Piano

Piano is a percussion instrument.  Notes are produced by hammer striking the strings with force purposely asserted by the player.  The amount of force determine the loudness of the notes.  The piano was invented in 1709 in Italy.  The full name is call piano-forte which means soft-loud.  The instrument predate piano is called harpsichord which produce note by plucking strings instead of hammering like piano.  Harpsichord player cannot alter loudness as the plucking distance is constant.

Musical Notes and Noise

Musical notes are sound in repeat pattern.  The form may not be smooth sinusoid and rugged.  In fact, almost all musical instrument produce note in its unit repeating form (timbre).  Noise on the other hand has a form that is not repeating.

When a string is pull and released, it produce the base frequency and multiple of it.  For example, an A string on guitar produce a base frequency of 110 Hz, and multiples like 220 Hz, 330 Hz ... etc.  If the string is pulled in the middle, the frequencies comprises 110/330/550/770... etc.  There will be no even multiples.  The reason is the mid point is at the highest position at only the odd multiples will fit.  The even multiple will have the mid point in the lowest position.  If the pull is at 1/3 position of the string, the frequency bundle will comprise the even multiples.

These multiples are call harmonics.  No matter the composition for the A note, the combined wave form will repeat at the base frequency of 110 Hz.  That is why all the A sounds alike.

Sunday, April 13, 2014

Chaos

Chaos is a phenomenon.  A chaotic system has a property called nonlinear dynamics which describe the cause and effect are not related in a linear fashion.  In other words, a small cause can have a complex effect which is not expected.  This is why it is called nonlinear.

Order and determinism can eventually lead to randomness.  The randomness was due to unpredictability in the systems.

Determining the Future

The French mathematician Pierre-Simon Laplace suggested an intellectual being (demon) that knows the position and motion state of every particle in the Universe, and every forces that acts on them, that being is able to predict the future and make change to it.

While theoretically possible, it cannot be done to do so because it is impossible for anyone to know with absolutely precision of the properties of every interacting atoms.

In 1886, the Sweden King offered a prize of 2500 kroner to anyone that can prove or disprove the stability of the solar systems.  In other words, will the planets remain their orbits or one of them may crash into the Sun or drifted out of the system eventually.  The French mathematician Henri Pancare tried to analyze the problem with just 3 bodies - the sun, the earth and the moon.  Pancare found that even with only 3 objects, the equations are mathematically impossible to resolve because of the sensitivity to the initial conditions.  The calculations showed complete irregularity and unpredictable result.  Pancare nonetheless won the prize.

There are the billiard game software widely available these days.  While it is possible to simulate the interaction of balls on the table, it is impossible to predict in reality.  To predict, one must know the position and movement of the white ball.  One must also know the position and movement of all other balls, and the friction of every strain of fiber on the table cloths which affect the friction, and the size and shape of every dust on the table that could steer the ball off course for a minute immeasurable amount etc.

Edward Lorenz is a mathematician and meteorologist in America.  In early 1960, Lorenz used a LGP-30 desktop computer to run a weather simulations.   At one point, he wanted to continue a simulation half way by re-entering intermediate calculated numbers from a print out.  Unexpected, the result of the simulation is different from the lat runs.  The reason was the computer calculate using 6 decimal points but the printout only contains 3 decimal points.  Lorenz noticed that the minute difference can make a big impact to the simulation result.  He coined the term butterfly effect to describe the rippling effect which based on the 1952 novel by Ray Bradbury.

Tachyon

It is a type of subatomic particles that predicted by Einstein's mathematics which travel faster than light.  The word's root is tachys which means "fast" in Greek.

GPS time correction

The pull of gravity causes clock to run slower than outer space based on relativity theory.  Satellites orbiting at 400km altitude still have 90% of gravity pull as on surface and so clock aboard runs slightly faster.  At the same time, the satellites are moving fast sideway that prevent them from falling down.  This high speed movement slows down the clock.

The reduction of gravitational pull causes the satellite clock to run faster than Earth by 45 micorsecond a day.  The movement of the satellites on the other hands slow down their clock by about 7 msec a day.  This gives a net effect of 38msec a day slower for clock in satellites.

GPS positioning works by measuring the time it takes for a signal from the device on the ground to bounce off a satellite and returns.  As each msec delay is translate to about 300 meters.  The time difference, if not correct, will cause positioning problem of 10km each day.  

Lights in Relativity

In 1905, Einstein theory was based on 2 postulates.  First, there is no way to tell if one is moving or standing still.  Imagine two rocket moving towards each other.  If there is no background object to showed their position relatively, any observer on one of these rockets will not be able to tell if he is moving, or the other, or both.

Second, light behaves like wave but it does not require a medium to transmit, contrary to sound wave.  Light reaching an observer from a source, moving or not, will travel at the same speed.  This is same as other wave like sound.  The Doppler effect affect the frequency and not the speed.

When an observer shine a light from one of the rocket, he would see the light leaving the rocket at the usual speed as if he is stationary.  The light reaches to the other rocket and the observer on board there will see the light travelling at the usual speed as well.  In other words, both measure the speed of light and nd it to be the same.

The only way light can travel at the same speed for all observers regardless of how fast they are moving with respect to each other is if they measure distances and times differently.

Muon are particles travelling at above 99% of light speed.  They are created by colliding cosmic ray with air molecules.  The lifetime of muon is about 2 microsecond.  Therefore, muon created at high altitude should not have made it to the surface of the Earth.  This is not as such.  Therefore, the muon's time is dilated.  Another observation is to the muon, as the speed is fixed and known and the time reaching the surface of the earth is fixed, the distance must be shortened.  This is called length contraction.

Relativity theory indicated that the closer one speed is to light speed, the larger the length contraction is.  For a distance of 100 light-years, if one travelling at 99% of light speed, he could make the journey in 14 years.  For one travelling at 99.99% of light speed, it only takes 1 year to reach.  If the ship is travelling at 99.9999999% of light speed, the journey only takes less than 2 days.  However, to an observer on Earth, you will take 100 years to reach.

Laws of Thermodynamics

First Law - energy can be converted from one form to another but cannot be created or destroyed

Second Law - entropy is always going down and never going up

Entropy can be view as a measurement of ability to expend energy.  Lower entropy means higher ability.  For example, a charged battery have a higher entropy than a flat one.  The second law also defines how time flows, from lower entropy to higher entropy state.

Third Law - the entropy for a pure crystal is zero when it is at absolute zero temperature

Zeroth Law - when 2 bodies are with the same temperature with the third bodies, all three of them are in thermodynamic equilibrium

Maxwell's Demon

An insulated box containing only air.  The box is divided into halves and there is a trap door in the middle.  When it opens, it allow molecules to move from one part of the box to the other.  The 2 halves started off which each air pressure and there is no temperature difference between them.

The movement of individual molecule is random.  Some molecules moves faster than the other.  When the trap door is opened, there are on average same number of molecules moving to the other side.

Maxwell's demon controls the trap door and he only allows molecules to go from left compartment to the right.  In time,  there will be more molecules in the right compartment which means higher pressure and becomes hotter.  This seems to violate the Second Law of Thermodynamics and what is needed is just information.  However, to obtain the information and making the decision will also requires energy out of the system.  Thus, the law was not broken.