Well today one such key combination actually paid off.
If you do Alt+Shift+Mouse Down+Drag XCode column selects! Two thumbs way up guys! I don't know about you but I use that feature all the time!
Thanks XCode, you just saved me a bunch of time.
If you have your code setup to do heap allocation tracking, _CTRDBG_LEAK_CHECK_DF and you'd like to break on a specific allocation, here's what you do once you've started debugging.
Add the following to the watch window.
Set the value to the allocation you'd like to break on. Now, if you're using the multi-threaded DLL runtime you'll have to provide a better context to the debugger. Like this.
So, if I'd like to see who allocated a hunk of memory, they were the 1000th caller, and they didn't free said memory, set the value to 1000, and the debugger will stop on allocation 1000.
Handy, big time handy.
Article on MSDN with more details, How to: Set Breakpoints on a Memory Allocation Number.
Having said that I think the web is great for services and it's super nice when the desktop application can be enhanced by a web service. We did this at Visio with the Find Shape feature. A web service for locating, and downloading, shapes from the web, into the desktop application. It worked quite well and gave you all the power and control of the desktop application.
Web only apps are still not there as a 100% replacement for the desktop, or client applications. Why do you think we have an iPhone SDK? Folks just couldn't do everything they wanted in the browser.
From what I know about AIR it has extreme limitations, some will see those limitations as a feature, which is true in some senses. If you have a HUGE investment in reusable frameworks, you cannot easily reuse those frameworks inside the AIR sandbox. That, for me, is a show stopper, which is quite unfortunate because it could be a great competitor to Microsoft's .NET if only you could reuse code more easily. Love or hate 'em, Microsoft has always done a great job of bringing old code into their new worlds. We've been able to bring critical frameworks into .NET very easily, and they behave like great .NET citizens.
So I could say "I built that on .NET, using C#, and Visual Studio". I have no idea how you describe that in the Adobe AIR/Flex/Flash/ActionScript world?
Would it be "I built that on AIR, using ActionScript, and the Flex IDE.", or something else all together?
I've been mixing AIR and Flex to mean the scripting language all week. I'm fairly certain AIR is equal to the .NET CLR?
Oh, and where does AIR fit into "Flash is being redefined?"
Hopefully we'll get some clear terms from Adobe soon, then maybe my pea brain can understand how everything works together.
The latest release seems to have really gone the wrong direction for the C/C++ developer, in my humble opinion. Editing, debugging, all great. The problem seems to lie in the auto completion/browsing capability. It's horribly slow. This morning, after 30-minutes, I finally had to kill off Visual Studio after right-clicking so I could "Go to Definition" of a method. Yes, I had other stuff to do so I left it alone hoping to come back and the hour glass disappear so I could work, no luck. Nuke it.
So, here I sit, waiting on a build to complete, and I make the mistake of right clicking on method name again. The IDE is now out to lunch, sorry Rob, no right mouse clicks for you, and you can forget ever seeing that menu you'd like to see.
Thing is I'll bet the C#, and Visual Basic crowd, are pretty pleased with it. All those nice little pop-up tool-tippy style helpers that allow you to dig into objects to inspect their values is pretty darned nice. Too bad it comes at the expense of the C/C++ side of the equation.
Maybe, just maybe, there are some settings I'm not aware of that will allow me to get better responsiveness from the bits I do like? I'll need to dig around and see if I can turn off some stuff to improve performance.
PS, I wonder, if the DNA of Visual Studio has a built in defense mechanism that causes it to misbehave in a VM on a Mac? It could happen...
PPS, it's still better than Vi, emacs, and gdb on Linux. Heaven forbid I have to work in that all day, every day.
PPPS, Note to the Linux world. Check out the great job the XCode guys did on their IDE. It uses gdb under the hood and allows you different views of the debugger, gdb console view and a nice GUI view that allows you to set breakpoints interactively.
PPPPS, I need to look at KDevelop again. Maybe it's much better than I give it credit for.
Yesterday Tom posted some very useful tips for debugging templates in gdb, thanks Tom, but man, can it get any more arcane?
In honor of Tom's hard work I thought I'd share the same tip, only mine will be for those of you using Visual Studio.
1) Locate the line of code you'd like to debug.
2) Left-Mouse click in the left 'gutter', the grey strip that runs down the left of your edit window.
3) Press F5, or select Debug > Start Debugging.
4) Wait to hit the breakpoint.
Favorite Linux debugging tip (not): "Just add some printf's to it"
Basically the compiler happily created one file with the same name over and over and over and was actually able to successfully link, not sure why that worked, but it did.
So when I went to link to this particular library I'd get a whole mess of unresolved external references.
I finally saw my problem this morning. So, word to the wise, remember the trailing backslash. Yes, this was a user error, but it was sure very easy to make that mistake.
First off here's my configuration, it plays heavily into the problem.
1) MacBook Pro
2) VMWare Fusion
3) Windows XP, running in VM
4) Shared fold on Mac for source code
5) Visual Studio 2008
6) Trolltech Qt
The big cluprit, the shared folder on the Mac. For some strange reason Visual Studio will lose its' brain after a while and can no longer write to .IDB/.PDB files on the HPFS volume. There's a lot going on in there, so it could be anything causing the problem. Anywho, to fix my problem I made sure all intermediate and binary files are being written to my XP volume, not the shared drive. It was easy to fix because we use environment variables to direct Visual Studio to the root of our codebases and where to write intermediate and finished binary files, there was one little problem. We auto generate our Visual Studio project files using a program, from Trolltech, called qmake. It's part of Qt, and is quite handy, but in this case it requires a small 'fix' to get around this problem.
By default qmake sets C/C++ > Output Files > Program Database File Name to '.', which in my case would write the .IDB/.PDB files to the shared Mac volume, which causes the strange behavior. No worries! We have the source code to qmake, so you need to make the following change to 'fix' this problem.
Open the file msvc_vcproj.cpp from \Qt\4.4.0\qmake\generators\win32, in the method initCompilerTool(), line 988 in Qt 4.4.0.
conf.compiler.ProgramDataBaseFileName = ".\\" ;
Rebuild qmake, and run qmake over your project files. That should help.
conf.compiler.ProgramDataBaseFileName = placement;
The real fix is this, do not build to your shared Mac drive, there's some sort of caching/permissions problem with it.
Oh, here's the original problem.
And all you Open Source zealots, please don't point out we have the code. We paid for it, and if they were shipping a binary only version they wouldn't have hard coded these settings. They would've been configurable, so I wouldn't have had to touch the code.
fatal error C1090: PDB API call failed, error code '23' : '(
fatal error C1090: PDB API call failed, error code '23' : '(
One interesting hit on Google produces this, a bug report marked as By Design. If you look in the comments for the report you'll see two comments saying it's still around. Why, yes, yes it is, and I'm experiencing it.
Hopefully I'll be able to find a workaround, or a fix for it, and soon. It's strange it's only happening for this one particular codebase, I've been building other things with Visual Studio 2008 for a while now, without issue.
Time to dig around a bit.
Please note, the code below is very simplified, and for demonstration purposes only. You'd want to wrap this is a way that makes sense for your application. ATL and MFC provide this sort of stuff, but you can roll your own.
So what does that do? It will dump something similar the following to the Output window...
// Yes, I know this is an unsafe CRT call. :-)
sprintf(buffer, "%s(%d): Debug Message\n", __FILE__, __LINE__);
c:\yoursource\yourfile.cpp(99): Debug Message
Now if you follow Sara's tip it will jump you right to the code that dumped out the message.
C# doesn't need to be all things to all people.
osql -E -S MACHINENAME\SQLEXPRESS
1> EXEC sp_grantlogin 'MACHINENAME\ACCOUNT'
1> USE databasename
1> EXEC sp_grantdbaccess 'MACHINENAME\ACCOUNT'
These three links just saved me!