Welcome to Hardcode Sign in | Join | Help

November 2005 - Posts

Another way of catching the errors early is enabling the page heap for a specific executable. You must download the debugging tools then run gflags.exe, choose an executable and then "enable page heap". This will somehow force each allocation block to be a memory page and the forbidden memory zones will be protected by the operation system. However obviously, this will have very negative performance impact on the allocation system.
In case that you didn't know this - you can force some exceptions to be caught by the Visual C++ debugger before your program does that i.e. with the try / catch blocks. For doing this enter debugging then go to "Debug / Exceptions" and put 0xc0000005 and 0xe06d7363 to "Stop always".
I was thinking at structuring the activities on a project into a flow and presenting it visually - however also with a large level of details. For example, one task may result in a deliverable and some bugs that go to the developer and then again to the testing team and so on. Also all the tasks go into a project deliverable that goes to the client and so on - you get the idea. With a bit of hacking you can have this project view generated automatically (assuming you already have project management tools for bug-tracking, task management).
With Powerstrip I've managed to increase the refresh rate of my monitor beyond of the specified limit of 85 Hz (at 1152x864) to 95 - and it's clearly a difference, my eyes don't hurt anymore. The only downside is that the image can't stretch to the whole screen area, rather it will be slightly smaller (having it sized to the whole area is not accepted by the display).
Test your managing skills in this game by Intel - the simulation of IT department.
You should use the __emit keyword:
    __asm {
        __emit 0x90;
        __emit 0x90;
        __emit 0x90;
        __emit 0xBA;
        __emit 0x42;
        __emit 0x41;
    };

Nice guidelines - be very careful following them ! :D. via Slashdot.
Well, the formulas that I've found were unusable: if you create a quaternion with yaw, pitch and roll of 45 and then call ToEulerAngles you'd get different results - and this is unacceptable. Now - the solution I've found involves transforming the rotated system of the quaternion back to the inital system.
Initially you extract the x axis, y axis and z axis from the quaternion - let's call them x', y' and z'. Then you get the yaw (by atan2 of y'.y and y'.x or something like that) and then rotate the system (all of the axis) by -yaw around z axis (the axis around yaw is). So you'll end up with y' aligned with y. Then you get the pitch and rotate with -pitch, and then you do the same with the roll - and now you can verify (assert) that x' = x (i.e. 1, 0, 0), y'=y and z'=z - just to be sure.
That's it - now you have the yaw, roll and pitch. Of course, in the beginning you have to decide what which angle represents (i.e. z points up, yaw is around it, etc).
In the spirit of modding your devices - what about modding your mobile phone? Well, not that crap stuff like replacing leds with pink ones as some people do. So - I'm thinking of tweaking the processor speed, changing the camera lens with some high-quality ones and maybe adding a label as the Nokia fashion phones have. As for the mods I know - I remember about a phone modded as a night vision cam (with an infra-red flashlight), pretty cool but not so useful.
As I couldn't find any simple algorithm, I decided to get a brand new one. The problem is to smooth the mesh i.e. starting from a cube to round its corners until in the end you get a sphere. So - moving nodes along the normal direction appeared to do it - however it's not that good when concave surfaces are used (because the new faces may intersect and so on). Currently I'm thinking to define one segment per point - to specify where it is allowed to move so it doesn't intersect with another point that's also moved. It's not finished though.
Pretty incredible for me, the good old algorithm of computing the normals for each vertex of the mesh is flawed. Basically the algorithm browsed all the triangles then adds the triangle's normal to the normal of each one of its three vertices. And after this - the vertex normals are normalized. Now, the problem is that you may have more coplanar triangles sharing the same vertex, and in that case (because of the averaging) the normal will be biased much more in that position.
Here's an image describing the problem, because of the two triangles on the right side the normal pointing to the right has more "influence" on the resulting normal:

Now, for fixing it you should alter slightly the normal computing routine: instead of summing the normals directly keep a list with the normals per vertex and sum them in the end. And, of course, don't add equivalent normals.
I've just come back (pretty early for me, let's say :D ) from an evening dinner (party?) with Troniu, Tina, Dragos, Adi, Andreiard and of course my beloved Pisi. As I saw for the first time these blog writers - they are really very nice people and let's hope for more meetings like this one.
I've managed to avoid the annoying prompt to build when F5 is pressed (now don't ask me why I did this now and not 6 years ago :D ). Making a macro that executes both Build and DebugGo is not right, because they are executed asynchronously. So use this macro then (found here) :
Dim bNeedToRun

Sub CompileAndRun()
    If Debugger.ProcessState = 0 then
        bNeedToRun = True
        Documents.SaveAll True
        ExecuteCommand "Build"
    Else
        ExecuteCommand "DebugGo"
    End if
End Sub

Sub Application_BuildFinish(numErr, numWarn)
    If (bNeedToRun=True) Then
        bNeedToRun = False
        If (numErr=0) Then
            ExecuteCommand "DebugGo"
        End If
    End If
End Sub

Update: I tweaked the macro to behave correctly when into debugging also. Beware, Debugger.State as it is in MSDN does not work, instead it's ProcessState.
As I'm in the process of completely customizing the MFC grid, I propose a "Pimp my Grid" contest with the spiffiest grids out there. Actually I guess the tree control is the most radical modification, however it's pretty standard and doesn't count as a mod.
I was shocked today to see a BSOD of my installation of Vista Beta 2 with the following, *critical*, error code: END_OF_NT_EVALUATION_PERIOD :)). Well, actually it started with a dialog to prompt the evaluation expiration however after some minutes it simply crashed with this BSOD.
Jensen's blog is definitely very interesting - with subjects as the new Office user interface design, what are the top 5 most used commands in Word and also how to assign commands to menus and toolbars.
It appears that my good old friend Adrian 'Micutzu' Drumea has started blogging again (after about 8 months). Poor him - with some nasty bugs :D. So while I'm happy to see him posting I certainly wish him to don't have issues of this kind ever again.
Because there was no standard way to do them (the functionality is: hide the panels when the application is deactivated and restore them when, of course, it's activated again), I did a workaround involving the following: ShowWindow with SW_SHOWNOACTIVATE for popping them without de-focusing the main window and, of course, a one-shot timer. This was because the main window's Deactivate event was fired before the panel's Activate, and, you guess it, the timer was started together with Deactivate (the panels were hidden in Tick).
_variant_t doesn't help at all, and also there are no SDK functions helpful. One easy way to do it though is using CArchive and COleVariant.
Here's a nice demo of this new capability in Firefox 1.5 - I say about this new html tag that "can be used for rendering graphs, UI elements, and other custom graphics on the client".
Today I was getting a strange error in Visual Basic: "Unable to show modal form within this context" - that happened in a VB activex control method that was called by a c++ event handler of a VB fired event (so it's clear that the context was pretty messy :) ). Didn't know what to do to fix it - thus resorted to one of my usual workarounds on these issues by using a one-shot timer after 10 ms that will continue the process.
I'm pretty sure this will be my next phone, in black flavour of course. First I was decided to get N91 because of HDD but this one is really better, by the way they both have WiFi. Also, don't forget Nokia's new browser here.
I found a weird issue with CComboBoxes that don't have the default item height (-1) (that is the height of the control when not opened minus the border) - it appears that SetDroppedWidth resets the value to the default (15 or I guess it depends on the font).