Wednesday, December 28, 2005

Mozilla Firefox's P2P extension



Allpeers ; mirror site

Tuesday, December 27, 2005

MS Document View Architecture


Sunday, December 25, 2005

OpenGL on Vista





Saturday, December 24, 2005

Medical Imaging markets

Comprehensive Report

Thursday, December 22, 2005

FCK Editor

Wednesday, December 21, 2005

Run Windows as Linux screensaver




Basic classes

CObject - macros accompanying this class allow classes derived from CObject to
  • get their class' name at run time
  • get their class' object size at run time
  • create an object of this class without knowing the class' name
  • store and retrieve an instance of this class to an archive device without knowings its name
CCmdTarget - classes derived from this can receive and process command messages from the application's menu or toolbar(s)

CWnd - derived from CCmdTarget, and can perform it's functions too
all other MFC fn.s that control a window (creating, maintaining) are derived from CWnd

Application Classes

CWinApp (Application Class) - initializing and running the application

CFrameWnd (Frame Class) - display and route user's commands, display application's main window

CDocument (Document Class) - load and maintain a document

CView (View Class) - provide one or more views into the document

Types of Applications

  • Dialog Application - dialog box for UI, no frame, document or view class; derivation of CWinApp and created using CDialog class
  • SDI (Single Document Interface) - load and edit one application at a time + use all the four base classes
  • MDI ( Multiple Document Interface ) - load and edit several documents at once + use all four base classes + CMDIFrameWnd and CMDIChildWnd ( 2 derivations of CFrameWnd )

Document Template - defines what frame, document and view class to create when the application opens a document
create an object of CSingleDocTemplate / CMultiDocTemplate class and initialize with three class pointers
RUNTIME_CLASS() macro - returns a pointer to a class' CRuntimeClass structure


CWinThread -> parent of CWinApp (primary thread of execution)

Control Bar Classes (OCW)
  • CToolBar, CToolBarCtrl
  • CStatusBar, CStatusBarCtrl
  • CDialogBar
  • CRebar, CRebarCtrl

Property Classes
  • CPropertySheet (OCW)
  • CPropertyPage (OCW/Dialog)

Drawing Classes
  • CClientDC
  • CWindowDC
  • CPaintDC
  • CMetaFileDC

File Classes
  • CMemFile
  • CSharedFile
  • CStdioFile

ODBC Classes
  • CDatabase(0)
  • CRecordset
  • CDBVariant

DAO Classes
  • CDaoDatabase(0)
  • CDaoRecordSet(0)
  • COleVariant
  • CDaoWorkSpace(0)
  • CDaoQueryDef(0)
  • CDaoTableDef(0)

Data Collection Classes
  • CArray
  • CList
  • CMap

Communication Classes

Tuesday, December 20, 2005

Free Software as a social movement

Interview with free software movement founder , Richard Stallman

Slashdot Discussion

Designing Windows GUI using Visual Studio .NET tools

RAD - Rapid Application Development

CASE tools - Computer Aided Software Engineering tools ; capture the requirements and turn them into user code quickly

Quality of RAD - 1) degree to which a delivered application meets the needs of the user, 2) degree of low maintenance costs

2 disadvantages - 1) reduced scalability , 2) reduced features

time boxing - features are pushed to later versions in order to finish a release in a short amount of time

An article on RAD

Monday, December 19, 2005

WNDCLASS Structure

Contains the window class attributes that are registered by the RegisterClass function

WNDCLASSEX - used with RegisterClassEx and GetClassInfoEx functions

typedef struct {
UINT cbSize;
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCTSTR lpszMenuName;
LPCTSTR lpszClassName;
HICON hIconSm;

Sunday, December 18, 2005


resources - objects used by the program, but defined outside
eg. menu (text based)

created seperately and added to the exe file while linking, contain special resource statements
resources are contained in resource files, extn .RC

2 types - text based and icons

.RC file -> compiled into .RES file using resource compiler

& in an item's name causes the key that it precedes to become the shortcut key associated with that option

; - to embed comments in the resource file

Friday, December 16, 2005

Algorithms determine Mona Lisa's true emotions

BBC News


Vista's Graphics to be moved out of the kernel



Windows NT Programming Fundamentals

LRESULT - typedef ; another name for long int

all messages are 32-bit integer values

registering a window class - telling Windows NT about the form and function of the window

message loop :
reads pending message from application's message queue -> dispatches it back to Windows NT -> call to program's window function with that message as a parameter

HANDLE - a 32-bit integer; a value that identifies some resource

HWND - 32-bit integer that is used as a window handle

BYTE - 8-bit unsigned character

WORD - 16-bit unsigned short integer

DWORD - unsigned long integer

UINT - unsigned 32-bit integer

LONG - long

BOOL - integer

LPSTR - pointer to a string

LPCSTR - const pointer to a string


MSG - holds a Windows NT message

WNDCLASSEX - defines a window class

Windows NT Skeleton
Contains 2 functions: WinMain() and Window Function

WinMain()'s functions:
  1. Define a window class
  2. Register the class with Windows NT
  3. Create a window of that class
  4. Display the window
  5. Begin running the message loop

LoadIcon() - returns a handle to an icon; loads the STYLE of each icon used
HICON LoadIcon(HINSTANCE hInst, LPCSTR lpszName)
hInst - specifies the handle of the module that contains the icon
lpszName - icon's name

CW_USEDDEFAULT - macro while creating a window; tells Windows NT to select an appropriate size and location for the window

CreateWindow() - returns the handle of the window it creates

ShowWindow() - to display the window
BOOL ShowWindow(HWND hwnd, int nHow);

UpdateWindow() - needed by almost all window applications; tells windows nt to send a message to your application that the main window needs to be updated

Message Loop - final part of the skeletal WinMain() ; receives and processes messages sent by the Windows NT; the messages are stored in the application's message queue until they can be read and processed
BOOL GetMessage(LPMSG msg, HWND hwnd, UINT min, UINT max);

GetMessage() - specifies for which window the messages will be obtained

TranslateMessage() - translates virtual key codes generated by Windows NT into character messages; facilitates full integration of keyboard into your application program

DispatchMessage() - the message which has been read and translated is dispatched back to the Windows NT, which holds this message until it can pass it to the program's window function

WM_DESTROY - sent when the user terminates the program; the program executes a call to the API function PostQuitMessage()

WM_CHAR - generated when a key is pressed
wParam - contains the ASCII value of the key pressed
LOWORD(lParam) - number of times the key has been repeated as a result of the key being held down
HIWORD(lParam) - the bits are encoded in a pre-determined format

Thursday, December 15, 2005

Bitmap Dithering functions

dithering - allows for a more pleasing image by selecting colors for adjacent pixels to produce an effect that makes it appear as if there are more colors onscreen than there really are.

LPBITMAPINFOHEADER - pointer to a device independent bitmap

Wednesday, December 14, 2005

India's New Export: Video Games

With multiple limbs and each hand wielding a different weapon, the fearsome Indian warrior-goddess Kali is a natural video-game character. And next year, Kali will be coming to game consoles, PCs, and mobile phones around the globe.

Microsoft quietly releases first glimpse at DirectX 10

Article on latest version of DirectX SDK

PACS Controller and Image Archive Server

Dicom PACS archive server hardware and software

Hardware Components



Archiver Server Software

Image Receiving

Data Insert and PACS Database

Image Routing

Image Send

Image Query/Receive


Backup Archive Server

Backup Archive using an Application Service Provider (ASP) Model


General Architecture

Dicom Gateway

Recovery Procedure

Dicom Compliant Network protocols
Data Migrator

General Setup Procedures of the ASP Model

Tuesday, December 13, 2005

PACS Controller and Image Archive Server

PACS controller - consists of hardware and software architecture, directs the data flow in the entire PACS by using interprocess communication among major processes

Archive server - hierarchical image storage management system for short-, medium-, and long-term image archiving.

Image Management Design Concept

Two major aspects to be considered:
  1. data integrity - no loss of images once they are received by the PACS from the imaging systems
  2. system efficiency - minimizes access time of the images at the display workstations
To achieve data integrity, PACS always has to retain at least two copies of an individual image on seperate storage devices until the original image has been archived successfully to the long-term storage device. This is achieved using PACS intercomponent communication.

Four components of the PACS controller and archive server:
  1. archive server
  2. database
  3. digital linear tape (DLT)
  4. communication network
Dicom-Compliant PACS Archive Server


Dicom Communications in PACS Environment

Dicom-Compliant Image Acquisition Gateways

Push Mode

Pull Mode

ImgrTrack process
DcmPull process

Monday, December 12, 2005

Save OpenGL petition

OpenGL in Windows Vista

Thursday, December 08, 2005

Haskell - a purely functional programming language

Games and DirectX tutorials

Wednesday, December 07, 2005

Bloggers the Tech World's New Elite?



Search Engine Optimization




32-bit value consisting of 3 fields:

  • Severity code - indicated whether the return value represents information, warning or error
  • Facility code - identifies the area of the system responsible for the error
  • Error code - unique number assigned to represent the exception
Each exception is mapped to a HRESULT. When managed code throws an exception, the runtime passes the HRESULT to the COM client. When unmanaged code throws an error, the HRESULT is converted to an exception, which is thrown by the runtime.

Tuesday, December 06, 2005

Google: Ten Golden Rules

Getting the most out of knowledge workers will be the key to business success for the next quarter century. Here's how we do it at google.

By Eric Schmidt and Hal Varian
Updated: 11:33 a.m. ET Dec. 2, 2005

Monday, December 05, 2005

Texture mapping in Direct3D

  1. Defining a custom vertex
  2. Initializing screen geometry
  3. Rendering the scene
We map one texture to a piece of geometry by specifying D3DFVF_TEX_no


(TEX1, TEX2, ..... , TEX8) - upto 8 textures, no - number of coordinate pairs per vertex

To provide values to the texture coordinate pairs, we use a vertex structure to correspond to these vertex flags.

VERTEX Vertices[]

// x, y , rhw , tu , tv

m_pd3dDevice->SetTexture( 0, texturename);
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0);

The texture coordinate pair is set for a particular texture with D3DTSS_TEXCOORDINDEX

Texture-Addressing Modes : When texture coordinate values lie outside the [0.0,1.0] range.
  • Map
  • Mirror
  • Border Color
  • Mirroronce
The graphics cards may not support all the addressing modes.

1. Wrap Mode [default] - repeat the texture on every integer junction and addressing mode

To switch it on , use

m_pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);

2. Mirror Mode - mirror the texture at every integer boundary so that the texels are flipped outside of the [0.0,1.0] boundary. The mirroring is done along each axis.

m_pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_MIRROR);
m_pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_MIRROR);

3. Clamp texture-addressing mode - applies the texture to the polygons once, and then smears the color of the texture edge pixels. The pixel colors at the bottom of the columns and end of the rows are are extended to the bottom and right of the primitive.

m_pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);

This mode is useful if we want to stitch together multiple textures over a mesh, since the bilinear interpolation used by wrap mode at the edges introduces artifacts from the opposite edge of the texture. For better fixing of the aliasing, we need to modify the texture coordinates.

4. Border Color Texture Addressing Mode - draw a (specified) colored border around the texture

m_pd3dDevice->SetSamplerState (0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
m_pd3dDevice->SetSamplerState (0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
m_pd3dDevice->SetSamplerState (0, D3DSAMP_BORDERCOLOR, 0x00aaaaaa);

We can use this to fake large textures by specifying a matching border around a smaller texture.

5. Mirroronce Texture Addressing Mode - Mirror + Clamp modes hybrid
Texture mirrored within the range [-1.0,1.0] and clamped outside of this range.

m_pd3dDevice->SetTextureStageState(0, D3DTSS_ADDRESSU, D3DTADDRESS_MIRRORONCE);
m_pd3dDevice->SetTextureStageState(0, D3DTSS_ADDRESSV, D3DTADDRESS_MIRRORONCE);

Texture Wrapping - decides how to interpolate between texture coordinates, and affects the way Direct3D rasterizes textured polygons and the way it utilizes the texture coordinates specified for each vertex

m_pd3dDevice->SetRenderState( D3DRS_WRAP0, D3DWRAP_U | D3DWRAP_V );

Texture coordinates outside the 0.0 and 1.0 become invalid and texture addressing is turned off.

Texture Filtering and Anti-Aliasing

As the textured object moves away from the screen of projection, two differently colored pixels might project to the same pixel on the screen. This will produce a pixel with a mix of the two pixels' colors and hence an inaccurate image.
This is called Aliasing.

Staircase effect - mapping a smaller texture to a larger polygon, will produce a staircase like image for an originally smooth line (magnification)
Swimming pixels - created on mapping a larger texture onto a smaller polygon (minification)

Filtering - way to get the texels from the texture map given the u,v coordinate

Basic texture-filtering methods:
  • Nearest Point Sampling
  • Linear Texture Filtering
  • Anisotropic Texture Filtering
Newer hardware supports:
  • Point Sampling
  • Bilinear filtering (linear filtering)
  • Trilinear filtering (linear filtering + mipmapping)

Mipmaps - A series of textures, each containing a progressively lower resolution of the image which represents the texture. Each level has a height and width, half the corresponding values in the previous level. The levels can be either square or rectangular.

Mipmaps are produced and used automatically if the right parameters are provided to the CreateTexture() method, which uses the D3DXCreateTextureFromFileEx() method.

They help in
  • reducing memory traffic
  • saving time
Direct3D automatically picks the MIP level which makes the texel-to-pixel ration closest to 1.0

Game Programming Wiki

Thursday, December 01, 2005


Texture file types which D3DUtil_CreateTexture() can load :

  1. *.bmp
  2. *.jpg
  3. *.png
  4. *.ppm
  5. *.dds
  6. *.tga