Tuesday, June 30, 2009
Scrapping Schools
Prem went to see the Guru to ask his opinion on the matter
Prem => "At last we have got a education minister who is sane !"
Guru => "Debatable ..."
Prem => "Why did u say so ?"
Guru => "People learn only when there is reward or prospect of getting punished "
Prem => "Is it ? "
Guru => "The Minister is repeating the Kerala model education scheme where more people passed in the exam will boost the govt's image. At least that is what these people think "
Guru => "By making things more easy , Minister is bringing medocrity in the country "
Prem => "What about Scrapping +2 exams ?"
Guru => " The attempt reminds me of a story by English Physicist Arthur Eddington. if we release some monkeys to a room full of Type writers , perhaps they might write a book. In the future , without necessity of writing the +2 exam , all of the guys in india will attempt IIT - JEE.
We are unleashing more than one million monkeys. Some 2000 of them will easily come to the top by sheer guess in the objective type exams"
| Reactions: |
Picking Girls
Perplexed , he visted the Guru.
Tilak => "Why it is that Girls show more inclination towards Prem ?"
Guru => "He regularly goes to the nearby Barber shop !"
Tilak => "what is so special about the place ?, i too visit the barber more frequently than Prem"
Guru => "u are going there for a haircut , facial or a shave ...right ?"
Tilak nodded his head
Guru => "Prem goes there to read Femina , StarDust and other vernacular film magazines!!"
Tilak hiding his surprise asked "All girls are not crazy for filmi gozzip"
Guru => "Such girls are not worthy of having a date !"
| Reactions: |
Friday, June 26, 2009
WPF - The Content Cloud Project
The Original application was written by an intern at Microsoft Research. I was entrusted to re-engineer the application as a XBAP program. One can retrieve the application from
http://files.skyscrapr.net/users/ContentMap/SocialNetWorkWPF.xbap
For applications which require incidental rendering need, GDI+ with it's coarse grained API is a better one. I had to write lot of Emulation routine to port the application. At least , i realized that
porting GDI+ application to WPF is not easy as one might think.
| Reactions: |
Thursday, June 25, 2009
Retained mode Graphics and Immediate mode Graphics
A graphics system operates in immediate mode if the application itself maintains the data that describe a model. For example, GDI/GDI+ is a two-dimensional graphics system that operates in immediate mode. You draw objects on the screen, using GDI, by calling routines that completely specify the objects to be drawn. GDI does not maintain any information about a picture internally; it simply takes the data provided by the application and immediately draws the appropriate objects.
When you program windows with GDI,GDI+,OpenGL or Direct3D directly , we need to handle the paint event because application was maintaining the state. When you are
using a SceneGraph library like OpenSceneGraph,Ogre3D,Java3D and WPF 3D , the
display library retains the state and they will do the necessary rendering.
CAD applications benefit from retained mode graphics. WPF is a retained mode graphics API.
| Reactions: |
WPF - 2D Graphics Transformation
The Primary Operations are Translation,Rotation and Scale ( other Misc
Transformations like Skew , Shear are available )
Translation , Rotation , Scale and Other similar operations combine to form Transformation. There are classes available for Matrix Transformations as well. In Computer Graphics , We use Homogeneous matrices to represent Transformation. The homogeneous coordinate system helps to combine translation ( a additive operation ) with rotation , scale (multiplicative operation ).
In 2D , we use a 3x3 matrix for representing Transformation matrices.
Given below are the WPF classes which can be used to perform Geometric Transform
Matrix Transformation allows you to create Custom Transformations. Good knowledge of Linear Algebra is necessary for working with this.
| Reactions: |
Drive Problem
"If you have got incredible drive , for that matter i was fortunate to be born
with immense drive , you will attempt many things , soon you realize that you can do almost all the things"
Prem was really enthused by the Quote. Tilak dropped into the libarary and
Prem with great enthusiasm , asked Tilak to read the above passage.
After reading the passage , Tilak gave the book back. Prem felt that Tilak did not get enthused with the Quote. Out of Curiosity Prem asked , "How was that sentence ?"
Tilak => "Oh , Who does not know that a bigger drive can store more data "!!!!!
| Reactions: |
API war
Tilak began to humiliate Prem by citing this project where ever they go together.
One Day, Prem asked Tilak "How did u design the feature ?"
Tilak => " I used Crypto API from Micrsoft "
Prem => "Ohh..... API stands for Average Programmer Interface , Since i consider myself as an Above average programmer , i can also do what u have done " !!
All the guys in the room could not stop laughing by seeing embarassed Tilak.
| Reactions: |
Islamization of Pakistani Cricket.
| Reactions: |
What is a Pixel ?
/////////////////////
//
// A C structure to store a Pixel Value in the RGBA format
//
typedef struct
{
BYTE r;
BYTE g;
BYTE b;
BYTE a;
}COLOR;
///////////////////////////////
//
//
// CDrawSurface is a a virtual FrameBuffer which can be used to render
// a graphics image in the screen. using Bitmaps we can transfer the content of the
// Buffer into the Screen ( We use DIB Sections )
//
class CDrawSurface
{
public:
int m_x; // Width
int m_y; // Height
int m_size; // Height*Width
bool m_init_val; // Initialize flag
UINT *pixels; // Pixel Buffer
int m_curr_x; // Current Cursor Position - X
int m_curr_y; // Current Cursor Position - Y
public:
CDrawSurface( int x , int y )
{
m_x = x;
m_y = y;
m_size = m_x*m_y;
pixels = new UINT[ m_size ];
m_init_val = true;
}
////////////////////////////////////////////
//
// Virtual destructor
//
//
//
virtual ~CDrawSurface( )
{
}
//////////////////////////
//
//
//
inline void PutPixel( int x , int y , COLOR *col )
{
if ( ( x < 0 || x > m_x ) ||
( y < 0 || y > m_y ) )
{
return;
}
////////////////////////////////////////////
// Find out the offset in the memory for the pixel
//
int offset = y*m_y*4 + x*4;
int *p_pixels = (int *) ((char *)pixels + offset);
r = col->r;
g = col->g;
b = col->b;
char *rs =(char *)((void *) p_pixels);
*rs++=b;
*rs++=g;
*rs++=r;
*rs++=0xFF;
}
////////////////////////////////////////////////
//
// Render - Copy the memory buffer to a Screen using DIBSECTION
//
//
//
int Render( HDC dc )
{
BITMAPINFO bmi;
LPVOID pvBits;
ZeroMemory(&bmi, sizeof(BITMAPINFO));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = m_x;
bmi.bmiHeader.biHeight = -m_y;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32; // four 8-bit components
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = m_x * m_y * 4;
HBITMAP hbitmap = CreateDIBSection(dc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0);
memcpy(pvBits,pixels,m_x*m_y*4);
StretchDIBits(dc,
// destination rectangle
0, 0, m_x, m_y,
// source rectangle
0, 0, m_x,m_y,
pvBits,
&bmi,
DIB_RGB_COLORS,
SRCCOPY);
return 1;
}
};
| Reactions: |
WPF 3D - Perspective Camera Parameters
void gluLookAt( GLdouble eyeX,
GLdouble eyeY,
GLdouble eyeZ,
GLdouble centerX,
GLdouble centerY,
GLdouble centerZ,
GLdouble upX,
GLdouble upY,
GLdouble upZ ) ;
We specify the eye position (camera position ) , center ( lookat position ) and up ( most often it is 0,1,0 ) position.
In WPF , they use Look Direction. It is easy to convert the look at position to Look Direction using the following code snippet
private void LookAt(Point3D camerapos, Point3D lookAtPoint)
{
LookDirection = lookAtPoint-camerapos;
}
| Reactions: |
WPF 3D - Camera
OrthoGraphicCamera
OrthographicCamera, is more useful for editing tools and some visualizations because objects appear the same size regardless of their distance from the Camera, allowing for precise measurement and analysis. Technical or manufacturing drawings frequently use OrthographicCameras.
<OrthographicCamera Position="5,5,5" LookDirection="-1,-1,-1" Width="5"/>
PerspectiveCamera
With a PerspectiveCamera, the width of the viewable area is not constant. As the distance from the Camera increases, more of the 3D world space is visible. This enables you to view a square frustum shaped region of the scene.
<PerspectiveCamera Position="5,5,5" LookDirection="-1,-1,-1" FieldOfView="45"/>
MatrixCamera
WPF supports a third type of Camera, the MatrixCamera, which enables you to specify the
view and projection transforms as Matrices.
private void SetMatrixCamera(object sender, EventArgs e)
{
//Define matrices for ViewMatrix and ProjectionMatrix properties.
Matrix3D vmatrix = new Matrix3D(1, 0, 0, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 0, 1);
Matrix3D pmatrix = new Matrix3D(1, 0, 0, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 0, 1);
MatrixCamera mCamera = new MatrixCamera(vmatrix, pmatrix);
myViewport.Camera = mCamera;
}
| Reactions: |
WPF 3D - Lights
WPF supports different kind of lights, like:
DirectionalLight
A DirectionalLight approximates a light source so far away that the rays have become parallel, such as light from the sun striking the Earth.
<DirectionalLight Direction="1,-1,-0.5" Color="White"/>
AmbientLight
AmbientLight is to substituite the effect of the Global illumination
PointLight
A PointLight approximates a light source that radiates light uniformly in all directions from a point in space, such as a naked light bulb. Unlike a DirectionalLight, the intensity of the light from a PointLight diminishes as distance from its position increases.
<PointLight Color="White" Position="2,2,2"
ConstantAttenuation="0"
LinearAttenuation="0"
QuadraticAttenuation="0.125"/<
SpotLight
SpotLight is just a PointLight whose rays have been constrained to an angular spread.
<SpotLight Color="White" Position="2,2,2"
Direction="-1,-1,-1"
InnerConeAngle="45"
OuterConeAngle="90"/>
To Properly Light a Scene , we need to assign Normals to the Vertices of a Object. WPF has got a feature for automatic calculation of normals. If we do not assign normals to the vertices , it will automatically compute the normals using Vector Cross Product. Too often , Models require tweaks to light it properly.
| Reactions: |
Wednesday, June 24, 2009
WPF 3D - Scene Graph
"HOOPS is database System (based on Scene Graph ) which helps user to think Graphics Programming as a data modeling problem. The user should be concerned about how to acquire the resources and organize it to be fed into the system. The task of Traversing the Graph , Culling the resources not rendered and Rendering should be left to the System"
A Scene Graph system will make Programming as easy as programming a Relational Database. Only difference is that you should be thinking Hierarchically. Thus the name Hierarchical Scene Graph. Here is a Scene Graph diagram taken from the Cosmo3D graphics API from Silicon Graphics

WPF 3D organizes the resources as a hierarchy. One can create the hierarchy programatically and there is an option to read the hierarchy from a serialization format like XAML.
Here is another schema of a Scene Graph

The Advantage of Scene Graph is View Frustum Culling. The following Diagram will clarify the stuff
| Reactions: |
WPF 3D - Co-ordinate System
I happen to get a cool image , which shows the WPF co-ordinate system from the Code Project Site. The image overlays a Quad in the 3D world. The Triangle Winding Order is also shown correctly.

In the Right handed co-ordinate System model , The Z axis comes towards the Viewer. In a Left Handed Co-ordinate System , Z axis goes into the screen. That is what Direct3D API do. WPF texture co-ordinate system is available here.
| Reactions: |
WPF 3D Texture Co-ordinate System
Some time back, when i started learning WPF, since it follows right handed co-ordinate system i also assumed that it will follow the same texture co-ordinate system. I was wrong in this assumption.
WPF follows the co-ordinate system of the OpenGL API and in the case of Texture Co-ordinate follows Direct3D.
| Reactions: |
Changing Gears
that Tilak met with a accident. In the campus , one thing was in the mind of people , "Did he need a vehichle which is that heavy ?"
| Reactions: |
Chess Championship
| Reactions: |
Bloated Self Image
Prem and Tilak went to their Guru to seek advise about this. A seasoned Veteran in the IT industry , he has seen this issue recurring time and again.
Guru => "How much Weight you can lift ?"
Prem => "I can lift 50 Kg"
Tilak => "I can do one better than Prem"
Guru => "GIM can lift 25 Kgs"
So, I am better ..right ? quipped Tilak.
Guru => "if i need to lift only 10 Kgs , GIM is better !!!"
| Reactions: |
Tuesday, June 23, 2009
A nice technical seminar
a) Server Virtualization
b) SQL Server 2008
c) Cloud Computing using Azure.
There were two speakers for each topics. The demos were good. What was fantastic about the whole event was the excellent set of people who took the presentations. Their quality was visible during the Q&A session.
The following were some of my take aways
A) One can run multiple Operating Systems concurrently using Hyper-V
B) One can migrate application from one Physical machine to another on line.
C) Modern CPUs has special instructions for supporting Virtualization.
D) To do the context switch between the OS, they prevent Data Segment attributes to
be changed to Executable. (Data Execution Prevention )
E) SQL Server 2008 uses Virtualization Technology for Mirroring.
F) One has got LZW (LZ77 ?) compression option while taking the backup
G) The CPU speed is a concern for compressed Backup.
H) The Cloud computing platform simplifies deployment
I) One can extend the capacity based on Usage
J) All data cannot be put in the cloud. ( From a control point of view )
| Reactions: |
Feedback about my blog
Hi,
I have gone thru your blogs. It is interesting.
Seems like your main task nowadays is blogging. I was wondering what may be the reason for your new obsession with blogging. And I have come up with the conclusion that either you have only few listeners at your company or your debating skills are not enough to flatter those guys. And to overcome that, you have found blogging as your new medium for intellectual mas****ation. Am I correct?
Well Wisher
| Reactions: |
Vector Graphics - Japanese Connection
Here is a Raster image of the flag
The same image can be generated with following WPF snippet ( can be easily translated to SVG or any other vector graphics software )
<page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
title="Window1" height="300" width="300">
<grid>
<rectangle name="rectangle1" stroke="Black">
<ellipse margin="97,98,100,83" name="ellipse1" stroke="Black" fill="Red"/>
</rectangle>
</grid>
The Vector Program is considerably lesser in size and scales well. The Above image and the WPF XAML code was created for a presentation which i am planning to take in TechEd on the road event to be held at Technopark,Trivandrum.
| Reactions: |
Monday, June 22, 2009
Source Code - More is good
One day to fix a bug in the program , Prem inspected the source folder of Tilak. To his surprise , he found 2 MB source code files. Where as 200 KB is the maximum in most projects, saw huge files and got perplexed.
On Closer inspection Prem came to know one startling fact. Tilak does not know Looping constructs. Instead he replicates the program source code a fixed number of times. Tilak was introduced to programming by the USTAD who started his career in a remote town in South India. When the art of Programming was at it's infancy in India , The USTAD's master who did not understand the looping himself taught programming to USTAD.
| Reactions: |
Debugging Skill
perfect programs. Prem takes a while to debug the program using the Debugger.
Even though they were roughly the same age , Prem was promoted to a Team lead Quickly. Tilak went and questioned his Boss about this.
Tilak => "Why Prem was promoted to a Team Lead ?"
Boss => "You do not know to use a Debugger , where as he Can " !!!!
| Reactions: |
Sunday, June 21, 2009
The Coming Revolution
Prem => " The Agrarian Revolution was started roughly around 1750 AD"
Tilak => " The Industrial Revolution was started in the year 1850 AD"
Prem => " Do not forget that Information revolution was the product of 1990s"
Tilak => " What kind of revolution lay ahead of US ? "
They discussed on this for days and could not reach any conclusion. They went to the Guru for getting his Opinion.
Guru => " The Next Revolution is ISLAMIC REVOLUTION " !!
| Reactions: |
One upmanship
While the conversation was going on , Professor's wife and their Adolescent daughter were at the home Computer. To get some help with Anatomy subject , the professor's wife asked for any good material on Human Body to Prem. Tilak pre-empted Prem and asked professor's wife to search for "Human Body" in Wikipeida !!!!!!!!!!!!!!!.
| Reactions: |
Hyderabad Blues
There lived a guy who is studious, polite and well behaved. Let us name him Tilak. After his engineering degree he was picked up by a company in Kerala. To get their work done, managers praise their subordinates more than what they deserve.
While Tilak was contemplating to go for higher studies, another guy who is equally frustrated with all his bosses landed in the same department. Let us name him Prem. Prem has got obsession for anything “Open”. Animosities of being colleagues were dumped to forge a bond with each other.
Tilakan was dumbfounded and heard whispering to himself, “For learning from a erstwhile colleague why did I quit the job and wasted my energy?”
| Reactions: |
Thursday, June 18, 2009
Sun Tzu's The Art of War
This week , i had occasion to chat with a guy who happens to be a close friend of my colleague. He has got a PhD in strategic management and from him i could learn more about the relevance of this book in the context of Business strategy. Since i am now a days interested in Game theory , i thought of buying the book. Today , i flipped through the preface written by James Clavell before starting for office. I got amused with the observation that "The aim of all war is to live in Peace". I mentioned this to a colleague of mine. As argumentative friends do , he posed a question back at me , "what about the action of a unscruplous dictator going for war ?". I had Ken binmore's book on Game theory ( a short introduction ) with me .
In it , i showed a paragraph about John Von nuemann. The paragraph ended with following note
"Just like you and me, he preferred cooperation to conflict, but he also understood that the
way to achieve cooperation isn’t to pretend that people can’t sometimes profit by
causing trouble"
| Reactions: |
New Web applications.
| Reactions: |
Wednesday, June 17, 2009
Aversion to Technology (in personal life )
a first step , i have decided to go to the Wikipedia site which enlists all Google applications.
| Reactions: |
Relativism in Corporate Ethics
Social (accepted belief ) ,Cultural or Role level.
| Reactions: |
Tuesday, June 16, 2009
Re-visiting Emergenetics
a) Analytical
b) Conceptual
c) Social
d) Structural
There are three behavioral attributes viz
A) Expressiveness ( 0 - 1)
B) Flexibility (0 - 1 )
C) Assertiveness (0-1)
The attributes are not mutually exclusive. A person can be 23% analytical , 30% conceptual,5% structural and 42% social. Likewise , one can be .6 (60%) expressive , .7 assertive , .3 flexible.
After a period of four years , i skimmed through the book written by Gail Browning. Seems to be
a framework worthy of look.
| Reactions: |
Monday, June 15, 2009
A thought provoking book
| Reactions: |
Thursday, June 11, 2009
Death March - a Software Engineering Phenomena
| Reactions: |
On Argument
| Reactions: |
Tuesday, June 09, 2009
Mathematics - It's representational value
The representational value of mathematics is under appreciated by general public. The advantage of mathematical notions are the ideas can be communicated succinctly.
As an example , take the case of assigning weights to a portfolio of risky assets (in finance )
They use some thing called mean variance optimization.
Suppose Rp is the portfolio return
u(p) = u( E[Rp],sigma(Rp))
The above line means , utility of the portfolio is a function of Average of Returns ( E[x] is the mathematical expectation of x) and standard deviation of returns (Risk )
subject to the constraints
du/dE[rp] >0 ( Actually it is partial derivative of u with respect to Average return )
du/dVar(rp) < 0 ( partial derivative of u with respect to Variance of Portfolio return )
Var(Rp) is the variance of portfolio returns ( or sigma(Rp)*sigma(Rp) )
for those of you who know calculus , things are pretty clear what we are trying to do while optimizing the portfolio.
This is much more compact than verbal description of the idea.
| Reactions: |
Actuarial science - not for insurance alone
What is an Actuary?
An actuary is a business professional who analyzes the financial consequences of risk. Actuaries use mathematics, statistics, and financial theory to study uncertain future events, especially those of concern to insurance and pension programs. Actuaries may work for insurance companies, consulting firms, government, employee benefits departments of large corporations, hospitals, banks and investment firms, or, more generally, in businesses that need to manage financial risk. A career as an Actuary is better described as a "business" career with a mathematical basis than as a "technical" mathematical career.
| Reactions: |
Choice Architects - A new profession
There is an implicit assumption while formulating Economic models. The assumptions can be summed up as Homo Economicus. The behaviorist ( and the book ) claims that Men are simply Homo Sapiens as opposed to Econs ( Homo Economicus ).
The book , based on Emperical evidence suggests that the way choice is presented influence one's decision making. The specialists who are good at presenting the choices in a intuitive and ethical manner are called Choice architects.
I am pasting the defenition given in the glossary of the book's site ( www.nudge.org )
Nudge Glossary of Terms
1. Choice architect: A homo sapien responsible for organizing how other homo sapiens make decisions. Choice architects recognize that "neutral" design is impossible, and that seemingly arbitrary decisions - such as where to put the bathrooms in a building - are of enormous importance. Examples of choice architects include a doctor describing treatments to a patient, a health care manager creating a form for health care enrollment, a rental car operator and a parent preparing dinner.
2. Choice architecture: A structure designed by a choice architect(s) to improve the quality of decisions made by homo sapiens. Often invisible, choice architecture is the specific user-friendly shape of an organization's policy or physical building when homo sapiens come into contact with it. Examples of choice architecture include a voter ballot, a procedure for handling well-meaning people who forget a deadline, or a skyscraper. Good choice architecture is not merely attractive; it also "works."
3. Homo economicus: The person from a standard economics textbook. Someone who, when facing a decision, thinks about every available option, and always makes a great choice. Home economicus has the brainpower of Albert Einstein, the storage memory of IBM's Big Blue, and the self-control of Mahatma Gandhi.
4. Homo sapiens: You and me.
5. Libertarian paternalism: Not an oxymoron. Libertarian paternalism is a relatively weak, soft, and non-intrusive type of paternalism where choices are not blocked, fenced off, or significantly burdened. A philosophic approach to governance, public or private, to help homo sapiens who want to make choices that improve their lives, without infringing on the liberty of others. Addendum to skeptics: It is not pledge for bigger government, just for better governance.
6. Nudges: Tools of choice for libertarian paternalists and choice architects. Examples include default rules, structured choice systems, incentives (market-based or socially created), feedback mechanisms, social cues, frames, and transparent designs.
| Reactions: |
Vector Graphics vs Raster Graphics
A Scene Graph API helps developers to focus on creating the content database , and the tedious task of rendering (by walking the Scene Graph ) is taken care by the engine.
In Raster Graphics , one stores the underlying pixel values of the message. Vector Graphics
stores the mathematical description of the object. Vector graphics is scalable and does not suffer from the aliasing effect of raster images.
| Reactions: |
Wednesday, June 03, 2009
Dan Brown - an Arthur Conan Doyle in the making ?
I personally like his style of writing. I call the authors in this genre as Collateral Knowledge Providers. When u read a novel by Dan Brown, Michael Crichton or Robin Cook,you enrich yourself in various disciplines like Cryptography, Christianity , Secret Societies , Palentology , Medicine to name a few.
IMHO, Like Sherlock Holmes ( overshadowed Arthur Conan Doyle) , some day Robert Langdon will become more famous than Dan Brown.
| Reactions: |