Posted by Jaime | Posted in Coding | Posted on 25-04-2011
If you need to set a boost shared_ptr to NULL, then you can do it like this:
So, if you have a function that returns a boost shared_ptr and you want to pass NULL to represent either an error state or a not-found state, you can do this:
typedef boost::shared_ptr<OohClass> OohClassPtr;
typedef std::map< const char*, OohClassPtr > OohClassMap;
OohClassPtr FindMyClass( const char* key, OohClassMap& ocmRef )
OohClassMap::iterator itr = ocmRef.find(key);
if (itr != ocmRef.end())
ptr = itr->second;
ptr = boost::shared_ptr<OohClass>();
Posted by Jaime | Posted in Coding, Tip | Posted on 25-04-2011
There used to be a button that would toggle you between the header file and implementation file that currently had the focus in Visual Studio.
For reasons unknown to me, that feature was taken out in Visual Studio.
Here is a macro though that brings that functionality back: I want my toggle button back!
Posted by Jaime | Posted in Coding, Tip | Posted on 22-04-2011
Within a Visual Studio C++ solution, you can copy a file to a known location as part of the build process.
To do that, you have so set the “Custom Build Step” parameters found in the Visual Studio project’s property page:
Command line: copy "$(InputPath)" "$(TargetDir)" > nul
Description: Copying $(InputFileName)
Note, the first line is the actual copy command. If you want to see the command without executing it, you can place @echo in front of the command.
Also note, the second line prints some text to the output screen, so you know what is going on.
For some projects, I have to run Visual Studio in adminstrator mode, otherwise the IDE is unable to copy the file to the restricted location.
I found instructions on how to run Visual Studio in administrative mode at: gottoknow dot com :
- Click the ‘Start’ button.
- Click ‘All Programs’
- In the menu, locate and click on the folder that says ‘Microsoft Visual Studio 2010’ (your version might be 2005, or 2008).
- Now right-click on the ‘Microsoft Visual Studio 2010’ program file, which will bring up the ‘Properties’ pop-up box.
- Select the ‘Compatibility’ tab, and then in the Privilege Level section, check the box next to “Run this program as an administrator”
- Click the ‘Apply’ button, then click the ‘OK’ button.
- Now each time you open Microsoft Visual Studio 2010, it will be running in (Administrator) mode.
Posted by Jaime | Posted in Coding | Posted on 20-04-2011
I found this useful tool, thanks to my coworker, that is an alternative to using the otool tool: MacDependency
Posted by Jaime | Posted in Coding | Posted on 18-04-2011
Right now I’m dealing with some code of mine that isn’t working on a Microsoft product.
I got a webcam, a Microsoft Life Cam VX1000, that doesn’t want to work with DirectX.
It’s weird. A Microsoft product that doesn’t want to work with a Microsoft SDK.
I see on the web though that there are a lot of people who have the same problem.
When I get a solution, I’ll post the answer to help anyone else who is having the same problem.