Deleting folders that refuse to be deleted…

Sometimes when you want to delete a folder in windows you get a very useful message “Could not find this item… this is no longer located in …”, (yes, the very item you just tried to delete).

So after a bit of cursing, making sure that you are indeed the admin of this box, praying to the windows gods you realise that maybe Windows Explorer is at fault.

Not to worry you think, you open up a cmd line console and navigate to the parent of the offending folder.

And like a true hacker you type

“rd c:\my\bad\folder”

only to be told once again, “The system cannot find the file specified.”

At this point your realise that the folder has spaces… so you think “no problem, I will quote the folder” and you now type

‘rd “c:\my\bad\folder “‘

with the correct number of spaces in the folder name.

Long story short… you cannot do that.

You cannot rename the folder, (I know you will try anyway, but you can’t)

So you Googled for a solution and here you are…

what you need to do is tell the command line to not trim the folder name and to do that, you have to add “\?\” in front, so now you type

‘rd /s /q “\\?\c:\my\bad\folder “‘

Complete with the extra spaces and so on… (I added the /s and /q flags because you forgot that the directory is not empty)

Debug Google test with Eclipse

You can add the google test library to Eclipse so you can compile the code, but you might want to actually build the whole thing at once without having to link libraries and whatever.

Of course this is possible as the full code is given to you…

  • Go to the Google Test Github project and download the latest release.
  • Unpack it whereever you want, and, of course make note of the project.
    We will call that folder <gfolder>
  • You then need to include the Google test file path, in eclipse,
    • The root of Google folder, “C/C++ build > Settings > Includes > Add include path” for <gfolder>
    • The include folder, “C/C++ build > Settings > Includes > Add include path” for <gfolder>, where the source files are included.

Then in you main( … ){ … } where you would normally include #include “gtest/gtest.h” or #include <gtest/gtest.h> add “#include “src/gtest-all.cc””

#include “src/gtest-all.cc”
#include “gtest/gtest.h”

int main(int argc, char** argv)
{
printf(“Running main() from gtest_main.cc\n”);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

Common issues with php-Apache installs

1- You see code instead of the script been run

Locate the file called httpd.conf and make sure you have something like

PHPIniDir “C:/Program Files (x86)/php”
AddType application/x-httpd-php .php .php5
LoadModule php5_module “C:/Program Files (x86)/php/php5apache2_2.dll”

And restart the Apache server

2- httpd.conf is either located in

C:\Program Files (x86)\Apache Software Foundation\Apache2.2\
or
C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf

I’ll add more later as I think of them…