Why must implement Object.Hashcode along with Object.Equals October 26, 2009
Posted by metalickl in Software Insights.Tags: java, software engineering
add a comment
I’ve heard of this advice over and over from various sources, and never been able to fully understand why. Until recently (few weeks ago), I was working with various java.util.Collection classes, there were a few connection made relating to this.
Whenever you get an Objects from hash based collections, such as HashMap, with a String or Integer key, you could simply say map.get(“key”) or map.get(new String(“key”)). This is because Strings or Integers are logical equivalent, which is a greater set than traditional identity equivalence (==). This allows greater flexibility to retrieve stored content from our little hash locker by playing the Keymaker, and constructing a key that is identical to the original one (in our case, a new String with the same characters).
But you cannot do this with entity objects. By default implementation, their Object.equals(Object o) simply returns this==o. This means you can never retrieve the stored content with any other object beside the one you’ve used in Map.put(Object key, Object value).
Hash based collections simply uses the hash code to identify a smaller, refined group of stored objects from the larger collection. If you’ve modified Object.equals to allow both identity and logical equivalence, but not Object.hashcode. Then try to search the collection with the logically equivalent key (same colour, same groove, but just not the key you’ve used the first time!), then obviously the hash based collection, who relies only on Object.hashcode to refine the search will have no idea that this Type is also logically equivalent. In this case, its attempt to refine the collection fails with false precondition.
—–
May be off topic, but then you would think an easy way to implement equals (for both identity and logical equivalence) along with hashcode would be simply compare the string representation of the 2 Objects (including instance members in some way or the other) and just output the hashcode of the string representation of the Object. This saves you the time (mostly brain power) to implement the non-trivial hash functions. This is acceptable, but not performance efficient or easy to read.
This is why it’s always nice to override Object.toString()
—–
Btw, Object serialization does preserve identity equivalence, IF:
- Both a and b are written as and subsequently read from as parts of the same stream. Here’s a quote from ObjectInputStream documentation: “Graphs of objects are restored correctly using a reference sharing mechanism.”
- Class of a and b does not override readResolve() that has the potential of changing how references are restored back; neither do classes that hold a and b.
For all other cases, object identity will NOT be preserved.
Microsoft offers downgrade from Vista to XP September 22, 2007
Posted by metalickl in Software Insights, Software Insights@Windows Vista.add a comment
It’s no shock that Windows Vista isn’t, shall we say, universally loved, and it’s also unsurprising that a plethora of businesses have voiced their preference to keep on runnin’ their operations on Windows XP. Presumably in response, Microsoft is “quietly allowing PC makers to offer a downgrade option to buyers that get machines with the new operating system but want to switch to Windows XP,” but the program only applies to Vista Business and Ultimate editions. The likes of Fujitsu, HP, Lenovo and Dell all have processes in place to ensure that customers have the ability to downgrade if they so choose, and while some firms are still selling their PCs with XP pre-installed, debates are already swirling around how long that tactic can remain in place.
Norwegian hacker crack iPhone just one week after its release July 6, 2007
Posted by metalickl in Gadegets Insights, IT Industries, PDA and Mobile Insights, Software Insights.add a comment
According to a post on his blog, a well-known Norwegian hacker has figured out a way to bypass restrictions on the iPhone that forces people to activate on the AT&T network. Now the iPhone might be worth buying.Digital Journal — Jon Lech Johansen, a 23-year-old famous for his hacking of consumer electronics, says he has cracked the iPhone. In a post on his blog on July 3 (titled “iPhone Independence Day”), Johansen said: “I’ve found a way to activate a brand new unactivated iPhone without giving any of your money or personal information to
AT&TNSA. The iPhone does not have phone capability, but the iPod and WiFi work. Stay tuned!”Johansen’s blog, titled “So Sue Me” provides source code and software for hackers to activate an iPhone for iPod+WiFi use.
Hackers and coders have been working around the clock to crack the iPhone’s security restrictions since its launch a week ago.Apple is in a long-term contract with AT&T, meaning anyone who wants an iPhone must activate it through the wireless carrier.
Mark Siegel, a spokesman for AT&T said it was “necessary” to activate the iPhone on his company’s network to “ensure optimum performance.”Despite what AT&T’s spin doctors have said, anyone in the tech world knows the wireless provider has what can only be described as a horribly slow Edge network, and many Apple fans want to use the phone without activating on AT&T.
The hack is important for an iPhone owner who wants to travel abroad and use the Internet or the phone’s music without having to pay AT&T to activate the phone.
As hackers continue to dig through code, cracks will also (likely) eventually lead to a way for the iPhone to work on another network. The phone comes locked, and a crack is (of course) against AT&T and Apple’s contract.
No doubt, few crackers actually care about that.
Johansen is practically a god in the underground tech world, most well-known as “DVD Jon” for reversing the code on DVDs that protect them from being pirated.
On his blog, Johansen warns the “application will not do anything unless you understand the magic numbers as well as add the hosts entry,” and you will need software installed on your computer.
by Christopher Hogg
——————————
E-Insight, 2007
Install a Mac OS X Tiger on your PC June 28, 2007
Posted by metalickl in Software Insights.1 comment so far
How to install a Mac OS X Tiger on your own PC, originally by vinceqz
Here my man installed Mac OS X 10.4.8 on one of his notebooks. It’s actually quite simple when you doing it, you only need a dvd and computer. haha
Well if you want duo system (install OS X in addition to your xp), just make an additional drive, 15G should be enough. If you want single system, you can install straight away.
check for hardware compatiability: http://wiki.osx86project.org/wiki/index.php/Main_Page
First step: the most important step… Download Mac OS X JaS 10.4.8 AMD Intel. You can find the file through eMule or BT, here is a link to the seed for BT: http://www.sendspace.com/file/lpt3jg
Good, now burn a dvd from the image file you’ve just downloaded.
Now, for duo system users. You should do a disc partition, an application called Partition Magic, or Acronis disk Director Suite 10 should do the trick. But remember, the disc format for the OS X must be “FAT 32 Logical” not “NTF“, remember!!! After you install the system, you then need to change “FAT 32 Logical” to “FAT 32 Primary“, remember!!! SO that OS X can start properly.
put the dvd into computer, restart and you will see…
here you select the language, you can choose chinese.
After choosing which driver you will install OS X, e.g. D:\ or E:\, you will be asked to format the disc into Mac OS Extended (Journled)
Very simple.
If you have Intel CPU, choose the file for Intel CPU!!!!!
Skip…
The total instalation time is about 30 minutes or so, you can rest aside and listen to some music or watch some tv.
Haha, you are done. Here is a comparison with MacBook pro.
——————————
E-Insight, 2007
How to setup OpenGL in Win32 environment June 3, 2007
Posted by metalickl in Software Insights.2 comments
How to setup OpenGL in Win32 environment
Because of different computer games have different qualifications in terms of graphics, compatibility, hardware and operation, so their programming are done differently, especially there is quite a few distinctive platforms and different companies also have their own preferences. Some popular platforms are Microsoft’s XBOX, Sony’s PlayStation, Nitendo’s Wii etcetera. When you want to play a specific game, you need to know which platform it runs on. For example, you need to own a Playstation to play its games.
There is one more platform, perhaps the most well known of all, is PC. Although the performance of PC is not as superb as those specialized gaming platforms, it still holds a great market share in gaming entertainment. Most of PC is based on Win32, and runs Windows. Many popular PC games are developed with DirectX because it is introduced by Microsoft and contains all the graphic displays, operations and controls. If you want to develop these kinds of games, you need to download a very large SDK (free) library. Today, I will describe another graphic engine, OpenGL.
OpenGL (Open Graphics Library) is a standard for a cross-platform graphics development. Some of the games developed by OpenGL are Doom3, Quake, and etcetera. Strictly speaking, OpenGL can be developed for any platform, and you don’t need to download a SDK, (if you have Visual Studio) because Microsoft cooperated with SGI, so it provides the running library.
Ok, you can now see the code attached; ‘I’ copied it from the Microsoft website. When you run it, you will see a little red light flashing and spinning.
You should have Visual Studio C++, start a new Win32 Project, and use any name you wish. Under Application Settings, choose Windows Application and Empty Project. When the project is initialized, you will see a folder called Source Files. Right Click it and choose Add New Items, choose Code in the popped up window. Then choose C++ File(.cpp), give a name, and hit ‘ok’.
Copy & paste the code included as followed. Then run it.
Source Code:
// MyOpenGL.cpp : Defines the entry point for the application.
//#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0×0501 // Change this to the appropriate value to target other versions of Windows.
#endif#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include < windows.h >
#include < GL/gl.h >
#include < GL/glu.h >
#include < gl/glaux.h >
#include < math.h >#pragma comment( lib, “opengl32.lib” )
#pragma comment( lib, “glu32.lib” )
#pragma comment( lib, “glaux.lib” )/* Windows globals, defines, and prototypes */
TCHAR szAppName[]=L”Win OpenGL”;
HWND ghWnd;
HDC ghDC;
HGLRC ghRC;#define SWAPBUFFERS SwapBuffers(ghDC)
#define BLACK_INDEX 0
#define RED_INDEX 13
#define GREEN_INDEX 14
#define BLUE_INDEX 16
#define WIDTH 600
#define HEIGHT 450LONG WINAPI MainWndProc (HWND, UINT, WPARAM, LPARAM);
BOOL bSetupPixelFormat(HDC);/* OpenGL globals, defines, and prototypes */GLfloat LightAmbient[]= { 1.0f, 0.0f, 0.0f, 1.0f };
GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat LightPosition[]= { 0.50f, .50f, -6.0f, 1.0f };
GLfloat Lightspecular[] = { 0.5f, 0.5f, 0.5f, 1.0f };GLfloat LightAmbient1[]= { 1.0f, 1.0f, 0.0f, 1.0f };
GLvoid resize(GLsizei, GLsizei);
GLvoid initializeGL(GLsizei, GLsizei);
GLvoid drawScene(GLvoid);
GLfloat yrot=0.0f;
GLfloat xrot=0.0f;
GLfloat zrot=0.0f;/*Win32 code*/
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
WNDCLASS wndclass;/* Register the frame class */
wndclass.style = 0;
wndclass.lpfnWndProc = (WNDPROC)MainWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (hInstance, szAppName);
wndclass.hCursor = LoadCursor (NULL,IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wndclass.lpszMenuName = szAppName;
wndclass.lpszClassName = szAppName;if (!RegisterClass (&wndclass) )
return FALSE;/* Create the frame */
ghWnd = CreateWindow (szAppName,
L”OpenGL Sample”,
WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
CW_USEDEFAULT,
CW_USEDEFAULT,
WIDTH,
HEIGHT,
NULL,
NULL,
hInstance,
NULL);/* make sure window was created */
if (!ghWnd)
return FALSE;/* show and update main window */
ShowWindow (ghWnd, nCmdShow);UpdateWindow (ghWnd);
/* animation loop */
while (1) {
/*
* Process all pending messages
*/while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) == TRUE)
{
if (GetMessage(&msg, NULL, 0, 0) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} else {
return TRUE;
}
}
drawScene();
}
}/* main window procedure */
LONG WINAPI MainWndProc (
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
LONG lRet = 1;
PAINTSTRUCT ps;
RECT rect;switch (uMsg) {
case WM_CREATE:
ghDC = GetDC(hWnd);
if (!bSetupPixelFormat(ghDC))
PostQuitMessage (0);ghRC = wglCreateContext(ghDC);
wglMakeCurrent(ghDC, ghRC);
GetClientRect(hWnd, &rect);
initializeGL(rect.right, rect.bottom);
break;case WM_PAINT:
BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
break;case WM_SIZE:
GetClientRect(hWnd, &rect);
resize(rect.right, rect.bottom);
break;case WM_CLOSE:
if (ghRC)
wglDeleteContext(ghRC);
if (ghDC)
ReleaseDC(hWnd, ghDC);
ghRC = 0;
ghDC = 0;DestroyWindow (hWnd);
break;case WM_DESTROY:
if (ghRC)
wglDeleteContext(ghRC);
if (ghDC)
ReleaseDC(hWnd, ghDC);PostQuitMessage (0);
break;case WM_KEYDOWN:
switch (wParam) {
case VK_LEFT:
zrot+=1.0f; break;
case VK_RIGHT:
zrot-=1.0f;break;
case VK_UP:
xrot+=1.0f;break;
case VK_DOWN:
xrot-=1.0f;break;
}
default:
lRet = DefWindowProc (hWnd, uMsg, wParam, lParam);
break;
}return lRet;
}BOOL bSetupPixelFormat(HDC hdc)
{
PIXELFORMATDE***OR pfd, *ppfd;
int pixelformat;ppfd = &pfd;ppfd->nSize = sizeof(PIXELFORMATDE***OR);
ppfd->nVersion = 1;
ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER;
ppfd->dwLayerMask = PFD_MAIN_PLANE;
ppfd->iPixelType = PFD_TYPE_COLORINDEX;
ppfd->cColorBits = 8;
ppfd->cDepthBits = 16;
ppfd->cAccumBits = 0;
ppfd->cStencilBits = 0;pixelformat = ChoosePixelFormat(hdc, ppfd);
SetPixelFormat(hdc, pixelformat, ppfd);
return TRUE;
}/* OpenGL code */GLvoid resize( GLsizei width, GLsizei height )
{
GLfloat aspect;glViewport( 0, 0, width, height );aspect = (GLfloat) width / height;
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 45.0, aspect, 3.0, 7.0 );
glMatrixMode( GL_MODELVIEW );
}
//construct the basic objects, and put them in a list
GLvoid createObjects()
{
GLUquadricObj *quadObjBody;
GLUquadricObj *quadObjNet;
GLUquadricObj *quadObjTop;
GLUquadricObj *quadObjUp;
GLUquadricObj *quadObjDown1;
GLUquadricObj *quadObjDown2;
GLUquadricObj *quadObjHandle;
GLUquadricObj *quadObjHead;glNewList(1, GL_COMPILE);
glPushMatrix();
glScalef(0.7,0.7,0.7);
//draw the handle
glPushMatrix();
glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient1);
glTranslatef(0.0f,.0f,-1.4f);
quadObjHandle = gluNewQuadric ();
gluQuadricDrawStyle (quadObjHandle, GLU_SILHOUETTE);
gluCylinder(quadObjHandle,0.02,0.02,0.5f,32,32);
quadObjHead = gluNewQuadric ();
gluSphere (quadObjHead, 0.05f, 64, 64);
glPopMatrix();
//draw the top
glPushMatrix();
glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient1);
glTranslatef(0.0f,.0f,-1.05f);
quadObjUp = gluNewQuadric ();
gluQuadricDrawStyle (quadObjUp, GLU_SILHOUETTE);
gluCylinder(quadObjUp,0.25,0.3,0.1,32,32);quadObjTop = gluNewQuadric();
gluQuadricDrawStyle (quadObjTop, GLU_LINE);
gluDisk(quadObjTop,0.02f,0.25,10,10);
glPopMatrix();
//draw the body
glPushMatrix();
glScalef(1.0,1.0,.80);
quadObjNet = gluNewQuadric ();
gluQuadricDrawStyle (quadObjNet, GLU_LINE);
gluSphere (quadObjNet, 1.205f, 8, 64);glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
quadObjBody = gluNewQuadric ();
gluSphere (quadObjBody, 1.20f, 64, 64);
glPopMatrix();
//draw the bottom
glPushMatrix();
glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient1);
glTranslatef(0.0f,.0f,0.95f); quadObjDown1 = gluNewQuadric ();
gluQuadricDrawStyle (quadObjDown1, GLU_SILHOUETTE);
gluCylinder(quadObjDown1,0.25,0.3,0.2,32,32); quadObjDown2 = gluNewQuadric ();
gluQuadricDrawStyle (quadObjDown2, GLU_SILHOUETTE);
gluCylinder(quadObjDown2,0.15,0.2,0.3,32,32);glPopMatrix();
glPopMatrix();
glEndList();
}
//initial, lighting, enable something
GLvoid initializeGL(GLsizei width, GLsizei height)
{
GLfloat aspect;glClearIndex( (GLfloat)BLACK_INDEX);
glShadeModel(GL_SMOOTH); //make the color smoothly
glClearColor( 0.50, 0.50, 0.50, 1.0 ); //set the screen clear color
glClearDepth(.0f); //set the depth of buffer
glEnable(GL_DEPTH_TEST); //allow depth test
glDepthFunc(GL_GREATER); //the type of depth test
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);glEnable(GL_LIGHTING);
glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, Lightspecular);
glLightfv(GL_LIGHT0, GL_POSITION,LightPosition);
glEnable(GL_LIGHT0);glEnable(GL_NORMALIZE);
glFrontFace(GL_FRONT_AND_BACK);
glMatrixMode( GL_PROJECTION );
aspect = (GLfloat) width / height;gluPerspective( 45.0, aspect, 5.0f, 10.0f );
glMatrixMode( GL_MODELVIEW );createObjects();
}//move
GLvoid drawScene(GLvoid)
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );glLoadIdentity(); glPushMatrix();
glTranslatef(0.0f,0.0f,-4.0f);
glRotatef(xrot,1.0f,0.0f,0.0f);
glRotatef(zrot,0.0f,0.0f,1.0f);
glPushMatrix();
glRotatef(yrot,0.0f,1.0f,0.0f);
glPushMatrix();
glRotatef(90,1.0f,.0f,.0f);
glCallList(1);
glPopMatrix();
glPopMatrix();
glPopMatrix();if(abs(yrot – 360.0f) < 0.01)
yrot=0.0f;
yrot+=0.5f;glFlush();
SWAPBUFFERS;
}
please excuse me for any spelling/grammar errors, I don’t proof read.
——————————
E-Insight, 2007
Adobe and Photobucket introduces online video editor May 19, 2007
Posted by metalickl in IT Industries, Internet Insights, Software Insights.add a comment
Adobe’s Remix is a new Web-based video editing tool that will be provided free to all Photobucket members in the coming weeks. Remix allows you to string together and edit short video clips. We covered the announcement of the online video editor last week, but got our hands on it this morning.Remix is essentially a stripped-down version of Adobe Premiere Elements. You get a timeline with clips and transitions, along with a source bin containing all the media from your Photobucket account. Adding clips to your movie is as simple as dragging and dropping. There’s also a handy clipping tool if you feel like cutting out the boring bits. There are only three transitions to choose from, and they’re all fades. This might seem like a letdown, but honestly if you’ve ever edited video before, you know some of the flashier transitions aren’t necessarily better than the fundamentals.
(Credit: CNET Networks)
To put the finishing touches on your movie you can add titles and all sorts of cheesy digital overlays, like a police hat or gingerbread people (both genders are provided). You also can add thought or chat bubbles with customizable text. What really feels off about adding all these effects is that you can only add one to each clip. There is a way to get around this–by cutting your clips into pieces to make them separate–but it would be nice to have a separate timeline for overlays, as the majority of video editing apps provide.
You also can add music to your film, though not your own. The library of music clips is fairly large, although you’ve probably never heard the tracks. There’s no way to add voice narration.When you’re done with your masterpiece, there are the standard URL and embed links, but no way to locally save or export your video to other formats. No doubt Adobe wants you to buy one of its video editing programs for this. This also means there’s no way to archive your videos–you’ve got to rely on Photobucket to keep running.
I like Adobe Remix for the casual stringing together of clips. It’s really easy to use and quite fast. The Photobucket integration is spot-on, but don’t be surprised if you see Remix popping up in other sites, since the partnership isn’t exclusive. It will be interesting to see where it shows up next.
————————–
2007, E-insight
Mac Simulates Windows through Parallels Coherence May 19, 2007
Posted by metalickl in Software Insights, Software Insights@Windows Vista.add a comment
Parallels Coherence:
Run Windows applications like they were native Mac applications
What is it?
A groundbreaking feature that lets users run Windows applications without seeing Windows. When a user switches to Coherence mode, their Windows desktop disappears, leaving their Windows applications running directly on their Mac desktop. This is the first opportunity ever for Mac users to run Windows applications in an effectively native environment!
How does it work?
Coherence is new, unique view mode that enables users to work with Windows applications on their Mac without seeing the Windows operating system. In Coherence mode, the entire Windows OS is running, just like it would in windowed or full-screen mode, but the user doesn’t see it, eliminating the confusing and sometimes jarring switch between the Windows and Mac desktop.
To enable easy access to Windows applications in Coherence mode, users can add any Windows shortcut icon to their Mac application dock, and load the program just by clicking the icon, like they would do with any normal Mac application. Users can also choose to show or hide the Windows task bar if they’d like. If the Windows taskbar is hidden, a user can access the Windows start menu by clicking the Parallels Desktop icon in the Mac application dock.
Why is it important?
The introduction of Coherence is a fundamental shift in the way computer users work with virtualization and multiple operating systems. It changes the question from “which operating system do I need to work in?” to “Which application is best for the task at hand?” By enabling Windows applications to run on a Mac desktop without any traces of the Windows operating system in view, users can get more done in less time, and truly experience the best of the Windows and Mac worlds.
Coherence in Action
————————–
2007, E-insight
Google Earth 4 January 24, 2007
Posted by metalickl in Software Insights.add a comment
The new amazing Google Earth 4 has just been released. The new GE renders much smoother 3d graphics and terrain details. You can simply zoom in and out at easy with the newly changed navigation bar. The UI is much more simpler and effective, you can even see the signs for hiking trails on there!!!! hehe Looking into those 3d buildings, some of them might be grey boxes, but you can actually design the models on your own and then submit to Google Earth. If they like it, they will actually implement that to you!!! According to the official Google Earth Blog, it also supports timeline animations, which you can make exciting.

Good thing always comes with a bad, and it’s always most eye catching because it’s only one sentence. According to CNET,new GE4 would take up a lot of ram, if you have an older computer, don’t upgrade…
——————————
E-Insight, 2007
Windows Vista’s Win FS file system January 9, 2007
Posted by metalickl in Software Insights, Software Insights@Windows Vista.add a comment
Windows Vista’s new file system
By Robert Vamosi (November 22, 2006)
Windows Vista stands to challenge how we think about files and file storage, allowing users to tag, organize, and search content in new ways.With typical storage capacity approaching 200GB on most new PCs sold today and with the choice of large media files (digital images, audio or video videos) streamed quickly via the Internet increasing daily, Microsoft could not continue the same old file storage structure within Windows XP in its successor operating system. Indeed, Windows Vista is more of a hard drive file browser than an operating system, even going so far as to adopt within its Windows Explorer the look and feel of Internet Explorer. But falling well short of Microsoft’s more ambitious plans for a whole new File System (the new Win FS file system is expected to be a feature of the new Longhorn server release due by early 2008), Windows Vista performs best as a transitional operating system, weaning its users away from file hierarchies and toward metatag-driven search. Nonetheless, Windows Vista will require a large paradigm shift on the part of users.
With Windows Vista, large volumes of documents, images, and media files become unmoored from the hierarchical file structures of earlier Windows versions by indexing filenames, metatags, and even file content. When viewed this way, Windows Vista allows users to create virtual groups on the fly based on a variety of criteria without dragging and dropping the individual files into various folders. Indeed, like the Internet itself, physical location ceases to be an issue within Windows Vista. This sea change affects many aspects overall of the new operating system.Gone from Windows Vista is the traditional file path of folders and files separated by slashes. And instead of remembering within which folder a particular document, image, or media files was saved, something called Windows Vista Instant Search will point to the correct document or program. And, unlike many desktop search applets from Google and others, Windows Vista indexes your hard drive without much of a performance hit.
I strongly doubt the efficiency of these new features. I wonder how the indexing of the users’ files are done “without much of a performance hit”. Much are left in mystery before Vista will be fully avaliable later January.
The new hardware, the new Windows, his DirectX 10 and her competitor January 5, 2007
Posted by metalickl in Hardware Insights, Software Insights, Software Insights@Windows Vista.add a comment
The new configuration, the new Windows Vista, his DirectX 10 and her competitor
The Highly Anticipated DirectX 10
Windows Vista includes a major update to the Direct3D API. Originally called WGF 2.0 (Windows Graphics Foundation 2.0), DirectX 10 and DirectX Next, it features an updated shader model — the shaders still consist of fixed stages like on previous APIs, but all stages sport a nearly unified interface, as well as a unified access to resources. The language itself has been extended to be more expressive (integer operations, nearly unlimited instructions count). In addition to the previously available vertex and pixel shader stages, the API includes a geometry shader stage that breaks the old model of one vertex in/one vertex out, to allow for more complex effects in real time. Direct3D 10 no longer uses “capability bits” to indicate which features are active on the current hardware. Instead, it defines a minimum standard of hardware capabilities which must be supported for a display system to be “Direct3D 10 compatible”. Therefore, contrary to the previous revisions of Direct3D, it requires new graphics hardware to run at all, whereas prior versions allow the old hardware capabilities to be addressed within the new interface. This is one of the major departure of this new API, and it is justified by Microsoft as the only way to achieve the CPU efficiency gains needed for the newest pieces of hardware without the clutter of legacy code.
Many of the advanced features and performance improvements of Direct3D 10 mandate the use of WDDM-compliant drivers. WDDM drivers are also required by Direct3D9Ex, an extended version of DirectX 9.0c, used in Windows Vista. D3D9Ex was previously known as WGF 1.0 and D3D9.0L. However, D3D9Ex needs WGF 1.0 drivers (previously, basic profile), and D3D10 needs WDDM 2.x drivers (previously, Advanced profile) which supports the extended graphics pipeline. D3D9Ex features similar improvements like better gamma control, support for virtualization of resources and safe device removal, other improvements make D3D10 incompatible with previous versions.
Because Direct3D 10 hardware will be comparatively rare for a period of time after the release of Windows Vista, and because the Vista Premium logo program does not require Direct3D 10 to be supported, the first D3D10-compatible games will most likely still provide a D3D9/D3D9Ex render path.
Windows Vista and DirectX 10 from CNET News.
It’s been called DirectX 10, Windows Graphics Foundation 2.0, and most recently, Direct3D10. The naming situation will clear up as we get closer to the official Windows Vista release, but all you have to know is that DirectX 10 and Direct3D10 in particular will introduce a new era in PC gaming.
Microsoft’s DirectX APIs are a collection of interfaces that standardize how game developers talk to PC system hardware. It’s a lot easier for programmers to write for a single DirectSound or Direct3D API, instead of writing for every single video card and sound card in existence. Microsoft rebuilt its Direct3D API from scratch for Windows Vista, and Direct3D10 will serve as the base for all future Direct3D innovations throughout the life span of the Windows Vista operating system.
Because the Direct3D10 foundation has to serve game developers through the next decade, Windows Vista will streamline and open up Direct3D with several forward-looking features that will help programmers create better games and get more performance out of PC hardware.
All hail the graphics processing unit
Direct3D10 finally completes the break from the legacy fixed-function pipeline. Developers will use the programmable pipeline to emulate the older, fixed-function steps. Additionally, Microsoft had to rethink its display driver model now that the entire desktop is going 3D. The video card isn’t just for games anymore. When you have a 3D desktop and give each application its own 3D window, the display driver has to be flexible and stable enough to handle the video card’s increased role in the system. Microsoft split up the display driver to increase stability, to ensure that the 3D desktop stays up in the event that a game or another application crashes due to a graphics error. This change also means that Microsoft will not release DirectX 10 for Windows XP, because many of the Direct3D10 improvements will need the new Windows Vista Display Driver Model.Opening up the video card to more applications will require Vista to give the GPU more system resources and allow applications to share the hardware. The biggest change for game developers will be virtualized memory for the GPU. The video card will now have its own space in system RAM to store information that can’t fit on local video card memory. High-end video cards ship with 256MB or 512MB of memory, but games can still use the extra space in system memory to store large chunks of information, like textures.
Epic Games founder Tim Sweeney explains, “Virtual texturing eliminates the video memory bottleneck on texture size; whereas in DirectX 9 the size of textures we can use with full performance is limited by the amount of video memory, in DirectX 10 it is only limited by total system memory.” Furthermore, Tim predicts that virtual memory will enable a “2X-4X increase in texture usage in games, which will be great for Unreal Engine 3 games, where textures are often authored at very high resolutions like 2048×2048, and then scaled down on lower-end systems to improve performance.”
Setting standards and improving performance
Video cards will now have strict feature-set requirements for Direct3D10. A video card must have the full feature set to be DirectX 10 approved. This isn’t a whole lot different from the existing model, in which a card has to have certain features to be DirectX 9.0c or Shader Model 2.0 compliant, but Microsoft has made the specification much more detailed to remove any chance of hardware variation. Differences in how Nvidia and ATI cards handled floating-point precision created extra work for developers in the past, but tighter Direct3D10 specifications will help remove ambiguous areas in hardware design. Having consistent hardware means programmers can avoid spending development time on customizing games for cards that don’t have all the necessary features or have odd implementations.Microsoft plans to accelerate its Direct3D release schedule to keep up as the graphics manufacturers release new GPUs with advanced features. If everything goes as planned, the game developer will have to learn only Direct3D11, instead of figuring out the quirks for two different GPUs when Nvidia and ATI release a new technology round. However, this change might not mean the end of writing code for specific GPUs. While developers can count on DX10 to define card features sets, the Microsoft DirectX team admits that “we may see [hardware vendors] putting in additional differentiating features, which developers may want to natively support.”
Now on News.com:
- Wal-Mart takes shine to solar power
- Detecting PC-made child pornography
- New year brings familiar security threats
- Extra: Rich Skrenta: Google won already
DirectX 10 will increase game performance by as much as six to eight times. Much of that will be accomplished with smarter resource management, improving API and driver efficiencies, and moving more work from the CPU to the GPU. “The entire API and pipeline have been redesigned from the ground up to maximize performance and minimize CPU and bandwidth overhead,” according to Microsoft. Furthermore, “the idea behind D3D10 is to maximize what the GPU can do without CPU interaction, and when the CPU is needed it’s a fast, streamlined, pipeline-able operation.” Giving the GPU more efficient ways to write and access data will reduce CPU overhead costs by keeping more of the work on the video card.
Here’s a list of several new Direct3D 10 performance improvements GameSpot was able to wrestle out of the DirectX 10 team:
• New constant buffers maximize efficiency of sending shader constant data (light positions, material information, etc.) to the GPU by eliminating redundancy and massively reducing the number of calls to the runtime and driver.
• New state objects significantly reduce the amount of API calls and bandwidth, tracking, mapping, and validation overhead needed in the runtime and driver to change GPU device state.
• Texture arrays enable the GPU to swap materials on-the-fly without having to swap those textures from the CPU.
• Resource views enable super-fast binding of resources to the pipeline by informing the system early-on about its intended use. This also vastly reduces the cost of hazard-tracking and validation.
• Predicated rendering allows draw calls to be automatically deactivated based on the results of previous rendering–without any CPU interaction. This enables rapid occlusion culling to avoid rendering objects that aren’t visible. Shader Model 4.0 provides a more robust instruction set with capabilities like integer and bitwise instructions, enabling more work to be transferred to the GPU.
• The D3D runtime itself has been completely refactored to maximize performance and configurability by the application.
It remains to be seen just how well actual DX10 graphics hardware will be able to handle the additional work, but we’ve seen in the past that ATI and Nvidia have been able to deliver whenever games have shifted work from the CPU to the GPU.
Now a comparison between Direct3D tt’s Competitior OpenGL
In general, Direct3D is designed to be a 3D hardware interface. The feature set of D3D is derived from the feature set of what hardware provides. OpenGL, on the other hand, is designed to be a 3D rendering system that may be hardware accelerated. These two API’s are fundamentally designed under two separate modes of thought. The fact that the two APIs have become so similar in functionality shows how well hardware is converging into user functionality.
Even so, there are functional differences in how the two APIs work. Direct3D expects the application to manage hardware resources; OpenGL makes the implementation do it. This makes it much easier for the user in terms of writing a valid application, but it leaves the user more susceptible to implementation bugs that the user may be unable to fix. At the same time, because OpenGL hides hardware details (including whether hardware is even being used), the user is unable to query the status of various hardware resources. So the user must trust that the implementation is using hardware resources “Optimally”.
Professional graphics
OpenGL has always seen more use in the professional graphics market than DirectX (Microsoft even acknowledges OpenGL’s advantage in this field[citation needed]), while DirectX is used mostly for computer games. (The term professional is used here to refer to the professional production of graphics, such as in computer animated films, as opposed to games where the graphics produced by the game are for the user’s personal, rather than professional, use.)
At one point many professional graphics cards only supported OpenGL, however, nowadays all the major professional card manufacturers (Nvidia, ATI Technologies and Matrox) support both OpenGL and Direct3D.
Gaming
The principal reason for Direct3D’s dominance in the gaming industry is historical. In the earliest days of hardware-accelerated 3D graphics, 3dfx was the dominant force, and their Glide API was used by far more games than D3D or OpenGL. Glide was much lower-level than D3D or OpenGL, and thus its performance was greater than either. Performance is the most important facet for game developers, so the less easy to use Glide API was preferred over the other two. This helped catapult 3DFx into the forefront of 3D hardware in those days.
As hardware got faster, however, the performance advantages of Glide began to be outweighted by the ease of use. Also, because Glide was restricted to 3dfx hardware, and 3dfx was not being as smart about hardware design as its main competitor nVidia, a hardware neutral API was needed. The very earliest versions of Direct3D (part of DirectX version 3) was not the simplest API to use. The next Direct3D version (in DirectX 5) was much more lucid. As interest in making Glide only games or games with multiple renderers dropped, there was a choice to make: OpenGL or Direct3D 5.
Making games that use OpenGL while using the non-Direct3D portion of the DirectX API is no more difficult than making a game using all of the DirectX API. The decision to use Direct3D over OpenGL was made from simple pragmatism: in those days, OpenGL implementations were difficult to work with. Writing an OpenGL implementation requires implementing every feature of OpenGL, even if the hardware doesn’t support it. If the hardware can’t do it, you have to write a software rasterizer that can handle that feature.
Different GL implementations would, when activating some feature, spontaneously go into a slow software renderer. Because OpenGL has no mechanism for telling the user whether or not a feature, or combination of features, will kick the renderer into software mode, users of OpenGL had to carefully test everything that they did on every piece of hardware that they were going to support.
Adding to that is the fact that an OpenGL implementation is a complex piece of code. It is much more than a simple graphics driver that is just a low-level interface to hardware registers. It needs to keep track of a great deal of state information, and that requires a lot of code. However, in a game situation, where a loss of performance can destroy the feeling of the game, it is more desirable to know that the functionality doesn’t exist and to simply avoid using it.
Direct3D didn’t have these problems. A Direct3D driver is (or, was in those days) just a low-level interface to hardware registers. And D3D has a query mechanism that tells the application whether or not a particular feature is available in hardware. So game developers chose to use it because it did what they needed.
At this point, the Windows Vista issue aside, the reason for using one over the other is typically inertia. It is what they have used in the past, so it is what they use now.
————————–


