Browsed by
Category: Software Development

Should Johnny Learn to Program?

Should Johnny Learn to Program?

Points and counter points on whether programming should be something all  kids should learn: Should Johnny Learn to Program?

I’m on the  side of no, programming is not a basic skill everyone should learn.  I like this counterpoint:

The giant hole in our workforce isn’t entry level developers who can hash out c code and write a compiler from scratch. It is for people with combined skills who can APPLY encapsulated technology (lots thanks to companies has been encapsulated) to specific domains.

Let’s stop trying to train the mass of high school students to become preservation carpenters, and instead make them very good contractors.

My reply:

I would recommend a deeper understanding of computing for the USER.  People don’t have a clue of the very basics of computing.

How many people click on an attachment to save and can never find it again?  People don’t understand the concept of CC vs BCC.  Folks don’t not the difference between  an Operating System, a browser, and a website.  Learning how to program is NOT something everyone should learn.  Phillips is right on the mark in suggesting we adjust the education system to teach application of encapsulated technology.  A good book on the subject is Daniel Pink’s A While New Mind.

UAC

UAC

User Access Control has been causing me fits.
With UAC on, if you attempt to open a registry key in the LOCAL_MACHINE hive and you specify WRITE permissions, it will fail (that was a bug on my part).
Something else to consider is that processes of different  integrity levels cannot send/post messages to each other.  This post has a good explanation of that and a work around.

Mercurial For Source Control

Mercurial For Source Control

It appears that Subversion is no longer where it’s at.  We now have Mercurial.

Joel has a nice tutorial f or Mercurial.

There is TortoiseHG for Explorer Integration which is what I installed which included Mercurial.

Two plugins for Visual Studio exists as well: VisualHG, hgscc

Update:  I was unable to get hgscc to work on Windows 7 VS 2008.  Any attempts to add a file from  within VS resulted in a generic error  message.  I uninstalled hgscc by right clicking the .msi install file and selecting uninstall

C Run-Time Error R6025 pure virtual function call

C Run-Time Error R6025 pure virtual function call

I did a bad bad thing.

Not so bad.  Calling a virtual pure function using a pointer to the abstract base class, or calling  it before the derived class has been initialized (in the constructor of the abstract class for example), is a no no.  I did the latter.

Here is Microsoft’s explanation:

No object has been instantiated to handle the pure virtual function call. This error is caused by calling a virtual function in an abstract base class through a pointer which is created by a cast to the type of the derived class, but is actually a pointer to the base class. This can occur when casting from a void* to a pointer to a class when the void* was created during the construction of the base class.

And an explanation and example of the exact thing I did:

   /* Compile options needed: none
   */ 

   class A;

   void fcn( A* );

   class A
   {
   public:
       virtual void f() = 0;
       A() { fcn( this ); }
   };

   class B : A
   {
       void f() { }
   };

   void fcn( A* p )
   {
       p->f();
   }

   // The declaration below invokes class B's constructor, which
   // first calls class A's constructor, which calls fcn. Then
   // fcn calls A::f, which is a pure virtual function, and
   // this causes the run-time error. B has not been constructed
   // at this point, so the B::f cannot be called. You would not
   // want it to be called because it could depend on something
   // in B that has not been initialized yet.

   B b;

   void main()
   {
   }

I was actually able to make the following adjustment:

Before:

A:A()
{
VirtualPureFunction();
}

B:B() : A()
{
}

After:

A:A()
{
// VirtualPureFunction(); //  Don’t call  here.  Derived object not guaranteed to be intialized
}

B:B() : A()
{
VirtualPureFunction(); // Safe to call here since A() constructor already called
}

WINVER not defined, defaulting to…

WINVER not defined, defaulting to…

WINVER is a symbol that your Windows application is suppose to define to declare the oldest version of the OS that your application  is designed to run on.  If you do not define it, you will get a warning and it will default to the OS on which you are building.

ox501 is the value to use for  Windows  XP.   You can define it in stdafx.h or in the preprocessor settings of your project.

Read more about it at here.

Can’t login to mac from Vista

Can’t login to mac from Vista

For sometime I’ve had problems connecting from my Vista laptop to my MacBook Pro.  I’ve only been  able  to connect  the other way.  Finally a solution.

This thread recommends the following:

On the start menu in the search field type “gpedit.msc”, hit enter. This will open the group policy editor.

Go to “Computer Configruation” –> “Windows Settings” –> “Security Settings” –> “Local Policies” –> “Security Options”

In the pane on the right side of the screen, select “Network Security: LAN Manager Authentication level.” By default this read “Send NTLMv2 response only.”
Change “Send NTLMv2 respone only” to “Send LM & NTLM — use NTLMv2 session security if negotiated”

restart the client

If you use a famillial vista try this.  You must modify the BDR

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
DWORD named : LmCompatibilityLevel must set to 1

unresolved externals and function signatures

unresolved externals and function signatures

Build issues can be extremely aggravating and hard to track down.  I spent quite a bit of time  tracking down a link error where everything seemed in order.  Function declaration and implementation of a library function matched the call in my application.  After much trial and error I decided to get forensic on the compiler.  I looked at the mangled function signature of the  library file (dropped the .lib file into Visual Studio) and compared it with the mangled function signature in the output window where it was reporting an unresolved external.  I used the command line program undname to show me the user-friendly function signatures and the difference was one used __cdecl and the other used __stdcall.  I was then able to find that my application was using the C/C++…Advanced…Calling Convention…__stdcall (/Gz) whereas the library was using __cdecl (/Gd).  Comparing file signatures between what was actually compiled into the library and what is expected in the application can expose several inconsistant settings. Another one might be the General…Character Set settings.