Tuesday, June 30, 2009

Scrapping Schools

Prem was very jubilant when the education minister of India Mr. Kapi announced the introduction of a bill to scrap School leaving Exam altogether. The Minister is also planning to Scrap the twelfth standard Exams too. Prem being a convent educated student was critical of the way nuns handle the students to keep the reputation of the instituition.

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"

Picking Girls

Tilak and Prem are at loggerheads with each other when it comes to picking the girls in the campus. Tilak's inherent urge to differentiate makes him spin plans to outsmart Prem at every facet of life. Somehow , Prem seems to have the last laugh. Tilak tried various techniques to lure girls towards him. But, Prem and others like him seems to win most of them over.

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 !"

Friday, June 26, 2009

WPF - The Content Cloud Project

Back in late 2006 , when WPF was at it's infancy , i worked with a XBAP application to display the the contents of Skyscrapr site in a visual form. You can read more about the interface at the blog site of Simon Guest.

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.

Thursday, June 25, 2009

Retained mode Graphics and Immediate mode Graphics

A graphics system operates in retained mode if it retains a copy of all the data describing a model. In other words, a retained mode graphics system requires you to completely specify a model by passing model data to the system using predefined data structures. The graphics system organizes the data internally, usually in a hierarchical SceneGraph database. Once an object is added to that database, you can change the object only by calling specific editing routines provided by the graphics system.

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.

WPF - 2D Graphics Transformation

WPF has got classes available for Geometric 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.

Drive Problem

One Day Prem was sitting in library with a book by the title "Hard Disk Secrets". While skimming through the pages , he found an amusing Quote

"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 "!!!!!

API war

Tilak was hired as an intern by a Hyderabad based company for integrating couple of Programs with their flagship product. Prem did not get any call of that sort and was bit upset about it. After the stint Tilak began to boast about his accomplishment in the company.

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.

Islamization of Pakistani Cricket.

I happen to get a mail (from a colleague of mine ) regarding a blog post which clearly sums up the story of Pakistan cricket team's flirting with Tableeghi Jammat.

What is a Pixel ?

Pixel stands for Picture Element. The color information is encoded using values for Red , Green ,Blue and Alpha. Using an integer value (32 bit) , one can encode pixel which is meant to be stored as a true color image.








/////////////////////
//
// 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;

}
};

WPF 3D - Perspective Camera Parameters

OpenGL Utility library has got an API call for specifying the View. Based on the view , Open GL Utility Library will calculate the Matrix necessary for converting the Object from World Co-ordinate System to Physical Co-ordinate System


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;
}

WPF 3D - Camera

There are three types of Camera Systems available in WPF 3D.

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;
}

WPF 3D - Lights

Without any lights you see nothing in a 3D Scene. So we need to place at least one light in our scene to illuminate our models.

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


<AmbientLight Color="White"/<


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.









Wednesday, June 24, 2009

WPF 3D - Scene Graph

Scene Graph is a data structure used for Organizing a Rendering System. The Users of API , will update the Scene Graph. How to Render the Scene on to the Display Surface will be taken care by the Rendering System. The HOOPS rendering system manual contained a Paragraph roughly reproduced from my memory as follows

"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




WPF 3D - Co-ordinate System

WPF is a Scene Graph based API for the creation of rich media applications. It integrates 2D graphics , 3D graphics , Animation and imaging into a single Display Sub 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.

WPF 3D Texture Co-ordinate System

WPF is an API which runs on top of the Direct3D API. The Direct3D API follows a left handed co-ordinate system. Open GL is an API which follows right handed co-ordinate system. This subtle changes creates lot of head aches for people who want to import the models they create. The Triangle Winding order is counter clockwise in the case of Right handed Co-ordinate System. The Direct3D API requires clock wise Winding.

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.

Changing Gears

Tilak used to drive a gear-less vehicle in his younger days. To navigate in the Campus , he purchased a vehicle which costed money closer to the price of a a Nano Car. The urge to differentiate is too much in him. Prem is happy hitchhiking in the campus. One day , Tilak gave a lift to Prem to go to the City. Prem felt that Tilak is bit rusty in his driving skill. After a while , Prem got irritated to the extent that he told Tilak "Lower gears are for Power and Higher gears are for Speed". Since it is told by Prem , Tilak instinctively rejected it. One day , the word spread
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 ?"

Chess Championship

Prem is outspoken , rash and easy going in nature. Tilak always want to show that he is one up , when it comes to Prem. One day , Tilak was explaining to his friends , how he became the Champion of Chess in one of his previous company. Some of them , who were skeptical about this asked Prem , "is it true that Tilak was champion player in Chess ?" . Prem after a slight hesitation said "Yes....." . After a while Prem told "Tilak will participate in all the events and The chess tournament mentioned above was about to be cancelled as only a sole participant was there. Tilak , asked one of his friend to participate and Won the match. He chose the weakest opponent.!!!"

Bloated Self Image

Prem and Tilak are wary of their Boss rating an "intellectual moron" higher than what they rate the fellow. Let us name him, Great Intellectual Moron (GIM). In a small company , natural reaction will be to lobby against GIM. GIM is a no moron as these people think. He wants to project himself first and has got opinion on every thing around him. People around them , do not despise GIM as Prem and Tilak do. So, they play a double game. A Shameless self promoter he is , GIM is also an effective worker.

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 !!!"

Tuesday, June 23, 2009

A nice technical seminar

I and my friend Shalvin went for a Technical event hosted by Microsoft GTSC,Bangalore. The topics were

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 )

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

Vector Graphics - Japanese Connection

I had been to Hitachi Engineering Company in the year 2002. Most of the programming book available in Japan is in their language. Even though i knew some Japanese ( Hiragana , Katakana and 150 Kanji characters ), reading their text was hard for me. I happen to see a program to print the national flag of Japan in java programming language book. It was a two line java program. I have been using variants of that program as an example to contrast the vector graphics programming model and raster graphics.


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.

Monday, June 22, 2009

Source Code - More is good

Tilak learned Programming from an acknowledged master of Art in Programming. At least he is a local USTAD. Let us call him USTAD. The USTAD started his career with Cobol and made a fortune during the Cobol Conversion Era. The USTAD always used to emphasize the Line count while writing the programs. Prem noted that some of the programs written by Tilak have bigger memory footprint and stop working after entering 10 screens of data. Prem has to re-start the program.

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.

Debugging Skill

Prem and Tilak differed in their approach towards programming computers. Prem was a happy go lucky programmer , who will iteratively design the programs by Trial and Error. Tilak is a programmer who is systematic and meticulous in his programming endeavour. Tilak always write
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 " !!!!

Sunday, June 21, 2009

The Coming Revolution

Prem and Tilak were engaged in a heated discussion on future paradigms amongst their class mates. Even though , respectful of each other in private , they try to play one upmanship on each other when they are in a open forum.

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 " !!

One upmanship

Prem and Tilak went together to meet their favorite professor at his Residence. The friendship they forged while colleagues in a Software company , has started to crack slowly but steadily. Tilak being a student wanted to impress his professor more than Prem. After the snacks , they sat together with the professor for a chit-chat.

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 !!!!!!!!!!!!!!!.

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. Tilakan’s managers were not an exception to this phenomena.After a couple of successful assignments, he picked up chauvinistic respect for a guy who was generally despised by his Immediate colleagues. Soon, getting along with people around him became really tough for him. Too much liking for anything is not good. So the saying goes. To Escape the Quagmire, he thought of a scheme which has been a rage with most frustrated youngsters, especially in the Software industry all across India. Higher studies are what these people think as their escape route to the next level of ‘nirvana’.

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. There were some oldies in the company who were equally frustrated as these Youngsters. The idea of higher studies also percolated Into Mr. Prem as well.

Quitting the job is not easy for most middle class youngsters in India. The Duo was brain storming on this for a while. Soon, a dashing guy who is not wise in the ways of Kerala joined their company. For the first time, Prem and Tilak were intellectually challenged in their professional life. Tilak could not tolerate this much. In a way, it was boon in disguise. He got a call from within to quit the job and prepare for the GATE exam.

GATE is a dreaded exam written by most engineering graduates to get into centers of technology excellence in India. Prem also started to plot his exit plan. Realizing that GATE is not his cup of tea, he tried to get a position as Research Assistant with a leading institute which has got an additional ‘I’ compared to India’s best run institutions. Luckily , he could get there as a research assistant to a professor who specializes in data structures and algorithms. Mean while,Tilak got good grades in his GATE exam. Some of his erstwhile colleagues suspected that GATE was just a façade and his real reason for quitting was to join a new startup company. Tilak after weighing options was forced to join the institution where Prem was working.

Data structures and algorithms were taught by one professor who is a name to reckon within the institution. Tilakan missed the intro class. The Second session is to be taken by his TA. To the surprise of Tilak, Prem was the TA chosen to take the next five classes.

Tilakan was dumbfounded and heard whispering to himself, “For learning from a erstwhile colleague why did I quit the job and wasted my energy?”

Thursday, June 18, 2009

Sun Tzu's The Art of War

This venerable book was suggested to me by a friend of mine. He came to know about the book when he saw the west Indian Cricketer Carl Hooper reading it in the pavilion's gallery of a cricket match. I did purchase the book to give it as a gift to a American who visited the company which i was working in the year 2003. Once in a while , this book has been referenced by some of my friends when we discuss military business strategy.

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"

New Web applications.

I had a orkut profile some time back. Last year , i deleted it. Recently , i got interested in social networking as a phenomena , potential of web 2.0 for novel applications and internet economics etc. To understand the state of the art and the operational model , i saw lot of videos on Blog,Twitter,Mashups,Social network philosophy. Now i know that Ajax is more than hype.

Wednesday, June 17, 2009

Aversion to Technology (in personal life )

I am bit technophobic in nature. Too often i adopt technology only after it has reached critical mass. Some times it is good economics. But as one who consider himself as a techie,there is wisdom in adopting new technologies as an enabler . if we are comfortable in using something , we will try to probe how do the designers of that app got their idea? . Is there any similar product in the same genre ? This will give good insight into their architecture , list of innovations , their business models etc. I have decided to change myself towards the direction of technophilism. It seems , i might require adjustments. That is true for most of the first generation (early 90s ) IT professionals. As
a first step , i have decided to go to the Wikipedia site which enlists all Google applications.

Relativism in Corporate Ethics

Relativists in management proposes that ethics are relative to the personal , social and cultural circumstances in which one finds oneself. In other words , the context is the king. People who advocate relativism are pragmatic about their outlook towards life. They do not set any hard fast rule about their daily lives. The assertion of one's right is dealt at the individual (naive relativism),
Social (accepted belief ) ,Cultural or Role level.

Tuesday, June 16, 2009

Re-visiting Emergenetics

Emergenetics is a psychometric framework which combines positions in the nature vs nurture debate. As per this system, Humans are having four thinking attributes

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.

Monday, June 15, 2009

A thought provoking book

Last week , i purchased a book by the title "Undercover Philosopher" Written by Michael Philips. This is not just another Philosophy book which talks about Mind body problem, Determinism in the universe,MetaPhysics etc.. The Book talks about our errors in perception , fallibility of memory , flaws in data to name a few. One interesting part was revising probabilities ( Bayes theorem ) in the case of medical diagnosis. if majority of the doctors get the results of the test wrong,it is a serious matter. Assigning probabilities correctly is essential for professions like medicine ( life threatening ) and law ( people will be unnecessarily put behind the bars ). The book also talks about biases ( not only prejudice ) inherent in human mind while taking decisions.

Thursday, June 11, 2009

Death March - a Software Engineering Phenomena

I encountered the term Death March in a Well know Company's Software Engineering department. The company is a leader in Engineering Software Industry with a popular flagship product. Their product is more famous than the name of the company. In the case of a particular product , two teams from East and West of US will start development concurrently for a release. They have got summer and autumn release. The Last two weeks before the code freeze was sarcastically known as "Death March".

On Argument

I chanced upon a book written by a lawyer who has not lost a single law suit in his fifty years of Practice. Gerry Spence is a successul lawyer who has lived in small towns of Wyoming state in the united states. The title of his book is "How to Argue and Win Every Time" . On the surface the title seems to be a book in the self help genre. But,on a prima facie scan of the book , i feel there is more to the book than it's catchy title. He dissects the phenomena of Argument and gives startegies for navigating the territories controlled by various forces acting upon the arguer. I paid only a sum of Rs. 50 for getting the book (It was part of the book stall's clearing sales ). So, ROI will be good in this.

Tuesday, June 09, 2009

Mathematics - It's representational value

Mathematics is a hard subject , even for professional mathematicians. Among the people at large,Math is a subject which has got immense computational value. Creating abstract models of real life situation is another practical application of mathematics.

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.

Actuarial science - not for insurance alone

I have been always fascinated by mathematical modeling , statistical reasoning and other quantitative techniques as a practical tool for investigation to solutions of problems we encounter in real life. Actuarial science is something i associate with insurance industries. Actuarial science goes beyond the insurance business.

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.

Choice Architects - A new profession

I purcahased a book co-authored by Richard Thaler and Cass R. Sunstien by the title Nudge. The book is a good and it is thought provoking as well. The book borrows from wisdom gained through the study of Behavioral economics.

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.



Vector Graphics vs Raster Graphics

I am taking a session on WPF (Windows Presentation Foundation ) at the mini tech ed event to be held in Techno park, Trivandrum. Before WPF, Windows was primarily a raster graphics system. The primary emphasis was on Blitting the Bitmap. This is a faster approach to produce graphics. The Onus was on the application program to paint the content on the Graphics Context provided by the Windows run time. From the mid 2003 onwards , Hardware accelerated graphics reached critical mass. Because of backward compatitbility reason, GDI ( Graphics Device Interface ) is still a software rendering system. The Programmability of GPU can be exploited only if u are comfortable with HLSL ( High Level Shading Language ) and Direct3D 9 or above. Microsoft was looking for ways to support hardware acceleration at the Managed code level. Even though they had a C# wrapper on top of D3D9 called managed DX ,they chose to create a Scene Graph based API from the ground up. A Scene Graph is a data structure familiar to CAD/CAM programmers. Some people call it Display list. A Scene Graph API is a good way to produce sizeable graphics programs without much awareness about the underlying mechanisms.
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.

Wednesday, June 03, 2009

Dan Brown - an Arthur Conan Doyle in the making ?

The celebrated author Dan Brown is known for his controversial title 'Da Vinci Code'. This was made into a movie in the year 2006 with Tom Hanks as Robert Langdon. Prof. Langdon made his debut with the book Angels and Demons. Ytd , i saw a movie based on this book. Dan's forthcoming novel (The Lost Symbol ) also features his protege, Prof. Langdon.

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.