Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

Dan McCormick

@Dan McCormick
About
Posts
47
Topics
10
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Anyone explain me this thing .. I'l b thankful .. [modified]
    D Dan McCormick

    1. Sounds like the conditional expression syntax is confusing you.

    return tree ? TRUE : FALSE;

    is equivalent to

    if (tree != NULL)
    return TRUE;
    else
    return FALSE;

    2. A long time ago, in a time now forgotten, the data type bool and it's associated constants of true and false had not been created. Microsoft wanted a boolean type for use in their Windows code, so they created one and named it 'BOOL'. It was created using a typedef statement. BOOL has associated constants of TRUE and FALSE that are defined using the C-Preprocessor macro facility (in other words, #define). Much code was written using BOOL, TRUE and FALSE. Some time later, the ANSI committee got around to adding bool to the language as a native type (that is exactly one byte in size). Alas, the Windows code base, which used BOOL, was now quite large. It was a bigger pain to change to use bool than not to change, so BOOL was kept. So we have the legacy in Windows C++ code of seeing both BOOL and bool used. In order for BOOL to work, the proper headers must be included in the file. The definitions live in <WinDef.h> but if you just include <windows.h> ( or "stdafx.h" if you are using MFC ) before the template definition, the template code will have these values defined. Dan

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ----- Boris Beizer

    C / C++ / MFC question data-structures

  • Hollywood Programming Cliches
    D Dan McCormick

    Here's a fun little rant about the horrible cliches that Hollywood seems to retreat to invariably whenever programs and/or program cracking takes front and center on the big screen. What code DOESN'T do in real life (that it does in the movies)[^] I'm pretty much in agreement with this fellow. These sorts of things can ruin a movie for me. Question: can you provide counterexamples where Hollywood does a 'reasonable' job of it? And now it's back to work. Dan

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ----- Boris Beizer

    The Lounge question com career

  • Do you laugh or cry?
    D Dan McCormick

    Came across this little parable and can't decide if it merely hits too close to home or if it cuts to the bone. Either way I can certainly relate. The Parable of the Two Programmers[^] Dan

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ----- Boris Beizer

    The Lounge html question

  • Do cartoonists lurk at Code Project?
    D Dan McCormick

    Remember from a few days ago the fellow who needed "coders for software for IP cameras" at rock bottom prices and the resulting flame session that ignited? This cartoonist was apparently paying attention... PC & Pixel[^] Dan

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ----- Boris Beizer

    The Lounge html com question

  • Colorspace Conversion: RGB to YUY2
    D Dan McCormick

    I need to code up a converter to process RGB encoded images to YUY2 encoded images. I have good algorithms for the first step that maps between the RGB colorspace to the YUV colorspace (also known as YCbCr) thanks to FourCC.org[^]. What I've not been able to track down is how best to combine two YUV pixels into a YUY2 macropixel. Google pointed me to some code that uses a naive algorithm which is good enough to get the project done but probably not good enough for the final product. Anybody know of an online publication that might discuss this second step (YUV to YUY2) and sketch out an algorithm that is considered 'good.' Real-time performance is not required. Thanks, Dan

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ----- Boris Beizer

    C / C++ / MFC algorithms performance

  • Oooh, the pretty colors...
    D Dan McCormick

    Here's a nice Friday time waster... a musical realization of the motion graphics of john whitney as described in his book "digital harmony" clickety[^] Dan

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ----- Boris Beizer

    The Lounge php database com graphics question

  • Odd Jury Instructions
    D Dan McCormick

    What would you do if you were sitting on a jury and the judge gave you the following instructions? "retire to the jury room to consider what I have said, appoint one of yourselves to be your foreperson, and then to return to the court with a verdict of guilty." clickety[^] Dan

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ----- Boris Beizer

    The Lounge html question

  • Hate your 'ex'?
    D Dan McCormick

    Hate your 'ex'? How far would you go to express your loathing? Self-multilation? This guy did! Man separates from wife — and his ring finger[^]

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ----- Boris Beizer

    The Lounge com question

  • Snail Mail with Real Snails
    D Dan McCormick

    Okay... I enjoy an evening of experimental absurdist theater, watching bizarre foreign films and taking in the new art exhibit at the museum, but I just don't get 'performance art.' Snail Mail with Real Snails[^] Dan

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ----- Boris Beizer

    The Lounge html com performance

  • Initializing a const member in a class
    D Dan McCormick

    CMyClass cannot directly initialize a member of a contained class. ( remember structs are a special form of class ) You will need to provide a constructor for the contained class MyStruct that at the very minimum initializes the const member and then have CMyClass constructor use it. Try this...

    class CMyClass
    {
    public:
    CMyClass(); /* constructor */

    struct MyStruct
    {
    MyStruct( const int f2 ) :
    field2( f2 )
    {
    }

      int field1;
      const int field2;
    

    } stMyStruct;

    int iVar;
    };

    CMyClass::CMyClass():
    stMyStruct(10)
    {
    stMyStruct.field1 = 2;
    iVar = 10;
    }

    Dan

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ----- Boris Beizer

    IT & Infrastructure help c++ json

  • Caution! No sign ahead!
    D Dan McCormick

    For arithmetic expressions of the form:    <signed> <op> <unsigned> or    <unsigned> <op> <signed> C/C++ will promote the <signed> value to <unsigned>. The resulting expression 'signedness' will be <unsigned>. Details available here[^]. Later, Dan

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ----- Boris Beizer

    Clever Code c++ com help learning

  • Do you think this is a bad idea or not( C++)
    D Dan McCormick

    In our code, if we do a general catch(...), we call a common unhandled exception handler that:

    • logs the class name & method name that detected the problem
    • displays a message box to the user that an unrecoverable error has occurred
    • attempts a graceful shutdown of the application

    We never try to continue because we have no idea how the application has been compromised. And should another unhandled exception occur while we are trying to clean up, we just give up and die immediately. [ Hmm... 'Unhandled Exception Handler' -- that just might qualify as an oxymoron! ]

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ----- Boris Beizer

    Clever Code c++ debugging help question

  • C++ is 100% Object Oriented
    D Dan McCormick

    The notion of 'object oriented' is a moving target. Here[^] is an interesting little article that discusses the different views held by some languages that support 'object oriented' programming. The article is a response to an essay by Paul Graham[^]. His essays make good reading and while you're at it, browse his site. I think most people will find it interesting -- whether you agree with his views or not. His writing can be thought provoking, or at very least provocative. Later, Dan

    Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ------------ Boris Beizer

    C / C++ / MFC c++ oop question

  • Is real-time programming can be done with C# & .Net?
    D Dan McCormick

    Just what do you mean by real-time? How 'hard' are your constraints? In general you cannot get real-time performance from a Windows system ( and that's before you consider the issues caused by managed code with automatic garbage collection ). Please refer to this excellent article here on code project: http://www.codeproject.com/system/simpletime.asp[^] Regards, Dan

    Remember kids, we're trained professionals.
    Don't try this at home!

    Work Issues csharp dotnet visual-studio help question

  • Rich Editor
    D Dan McCormick

    after you write the "please wait" message, try calling RedrawWindow() on the rich edit object to force an immediate repaint. Then continue with the processing. If pRichEdit is a pointer to your rich edit object, then you would call pRichEdit->RedrawWindow(). Regards, Dan Remember kids, we're trained professionals.
    Don't try this at home!

    C / C++ / MFC question help

  • #pragma once
    D Dan McCormick

    from cplusplus.com[^] The pragma directive is used to specify diverse options to the compiler. These options are specific for the platform and the compiler you use. Consult the manual or the reference of your compiler for more information on the possible parameters that you can define with #pragma. If the compiler does not support a specific argument for #pragma, it is ignored - no error is generated. #pragma once is supported by many but not all compilers. If you want to write code that works with a number of compilers, you should use the old fasioned #define... method. Regards, Dan Remember kids, we're trained professionals.
    Don't try this at home!

    C / C++ / MFC html com question

  • Being a rock star programmer
    D Dan McCormick

    Reading good code of guru's has certainly been a boon to me. I would add the qualification though, that it has served me best when I have spent some time working in the problem domain for a period of time myself. Once I have some experience trying to tackle a problem, seeing truly elegant, efficient solutions really helps boost me to a new level. My two cents... Dan Remember kids, we're trained professionals.
    Don't try this at home!

    The Lounge html com question code-review

  • Guyz!! help me out hear
    D Dan McCormick

    Just throwing a ciphertext at us and asking us to break it is asking a lot - we're good here at CP, but even we need a little more to go on. Your professor thinks you have at least a chance of cracking this. If you would tell us what class this is for, we might be able to make some suggestions. Dan Remember kids, we're trained professionals.
    Don't try this at home!

    C / C++ / MFC help

  • Calculating the execution time of a Program
    D Dan McCormick

    Here is a simple console application (developed under VC++ 6 ). It measures the time it takes a 'printf()' statement to execute and displays that time in microseconds.

    #include <windows.h>
    #include <stdio.h>

    int main(int argc, char* argv[])
    {
    // retrieve frequency of high-resolution performance counter
    // exit program if counter is not available on this system

    LARGE\_INTEGER perfFreq;
    
    if( !::QueryPerformanceFrequency(&perfFreq) )
    {
        printf( "High Performance Counter not available!\\n" );
        return -1;
    }
    
    printf( "Performance Counter Frequency:  %I64d ticks / second\\n", perfFreq.QuadPart );
    printf( "                            or  %e microseconds / tick \\n\\n", 1.0e6 / perfFreq.QuadPart );
    
    
    
    // determine time needed to execute 'printf()'
    
    LARGE\_INTEGER perfStartTime;
    LARGE\_INTEGER perfEndTime;
    
    ::QueryPerformanceCounter( &perfStartTime );
    
    printf( "\\n(\* This is the statement that I am timing \*)\\n\\n\\n" );
    
    ::QueryPerformanceCounter( &perfEndTime );
    
    
    // report measured execution time
    
    printf( "Measured Time:  %I64d ticks\\n", perfEndTime.QuadPart - perfStartTime.QuadPart );
    printf( "            or  %f microseconds\\n\\n\\n", 1.0e6 \* ( perfEndTime.QuadPart - perfStartTime.QuadPart ) / perfFreq.QuadPart );
    return 0;
    

    }

    On my machine the output produced is:

    Performance Counter Frequency: 3579545 ticks / second
    or 2.793651e-001 microseconds / tick

    (* This is the statement that I am timing *)

    Measured Time: 80 ticks
    or 22.349209 microseconds

    Dan Remember kids, we're trained professionals.
    Don't try this at home!

    C / C++ / MFC c++ json help

  • INS update! Naturalization interview
    D Dan McCormick

    A Hearty Congratulations! Remember kids, we're trained professionals.
    Don't try this at home!

    The Lounge question announcement career
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups