8/9/2010Another quick one… You can run this stored procedure: exec sp_databases
Which should yield the following output:
or you could try this stored procedure: exec sp_helpdb
Which would yield some more extended information thus:
or if you just want the names, you could execute this “undocumented” stored procedure: exec sp_msforeachdb 'print ''?'''
Which will yield this:
Or you could do the manual step of executing the following select query: select name from sys.databases
Which will yield:
Enjoy C
FOLLOW ME:     8/2/2010Every so often, you run across the need to redirect a page somewhere else, like after a server migration when DNS isn’t used. By simply adding a HTTP-EQUIV meta tag to the <HEAD> of your page, you can redirect elsewhere in a jiffy. Syntax isn’t complex, but must be correct to function properly. Here’s the syntax: <HTML> <HEAD> <META HTTP-EQUIV="refresh" CONTENT="SECONDS_HERE;URL=REDIRECT_URL_HERE"> </HEAD> <BODY> </BODY> </HTML>
Later C
Technorati Tags: HTML Redirect
FOLLOW ME:     6/21/2010If you’re receiving this error, you’re probably trying to merge one XML node into another. Your code could look like this: XmlDocument xmlDoc = new XmlDocument();
...
xmlDoc.Load(strXmlFilePath);
XmlNode nodParent = xmlDoc.SelectSingleNode(strParentXPath); XmlNode nodFragment = xes.GetXmlNode(strFragmentXml).FirstChild;
...
nodParent.AppendChild(nodFragment);
You could even be trying .Clone()
XmlDocument xmlDoc = new XmlDocument(); ... xmlDoc.Load(strXmlFilePath); XmlNode nodParent = xmlDoc.SelectSingleNode(strParentXPath); XmlNode nodFragment = xes.GetXmlNode(strFragmentXml).FirstChild; ... nodParent.AppendChild(nodFragment.Clone());
But alas… the .ImportNode() is what is needed…
XmlDocument xmlDoc = new XmlDocument(); ... xmlDoc.Load(strXmlFilePath); XmlNode nodParent = xmlDoc.SelectSingleNode(strParentXPath); XmlNode nodFragment = xes.GetXmlNode(strFragmentXml).FirstChild; ... nodParent.ImportNode(nodFragment.Clone(), true);
Enjoy C
Technorati Tags: XML Merge
FOLLOW ME:    5/26/2010If you’ve built Windows apps you’ve probably come across the VSHOST.EXE and VSHOST.EXE.CONFIG files in your BIN\DEBUG folder while building the SETUP or deployment project. I’ve been asked many times what these files are an if they should be deployed with the application. The answer is… NO These files are part of the Visual Studio Hosting Process used during debugging and should NOT be deployed with your app. For more see this MSDN article. Later C
5/4/2010As a SharePoint Developer, you may run across this error at some point. It is most common when you’re trying to recompile a SharePoint binary, from a Visual Studio session ON the actual SharePoint server. Of course, in most normal situations, it’s unthinkable to run the compiler on the server, but as SharePoint developers, we know there is no other way to code for the platform so it’s pretty much SOP for us. The problem lies in the locks that are taken by the compiler process on the debug info file. Often the locks are taken by your last debug session and unfortunately the locks aren’t always released, even though you’re the same user from the same application. Call it a multi threading anomaly or something. Whatever it is, this happens in Visual Studio 2008. Enter Process Explorer! This little gem by Mark Russinovich from SysInternals, has been around for a long time, now in it’s 12th version. Microsoft bought SysInternals a couple of years ago, and with it, Mark’s great mind. I must say, it was probably one of the smartest acquisitions that Redmond has ever made. But I digress. So, if you have Process Explorer installed (if you don’t, download it now and do so), it generally lives in the C:\Program Files\Process Explorer folder. To unlock your files and resume your compilation, follow these easy steps: -
Open Windows Explorer. -
Browse to the C:\Program Files\Process Explorer location, or any other alternative location where you may have installed Process Explorer to. -
-
Double click “Procexp.exe” to launch Process Explorer. -
Once Process Explorer opens, it will display a list of all active processes on your system. Odds are that your .pdb file is NOT shown here. -
In the top menu, click the “Find” menu item. -
In the drop down menu, click the “Find Handle or DLL” menu option. NOTE: If you’re a shortcut kinda guy or gal, you could have accessed this option with the “Ctrl+P” keyboard hotkey combo. -
-
In the Process Explorer Search dialog window, enter the name of your DLL, or in our case, the name of our .pdb file. -
Click “Search” or press “Enter”. -
-
Process Explorer displays the process that has the lock and wouldn’t you know it, it’s Visual Studio itself. -
Double click on the “devenv.exe” line. -
Process Explorer now closes the dialog window and the “devenv.exe” item is added to the displayed list. -
Right click the “devenv.exe” line in the displayed list. -
-
On the popup menu, click the “Close Handle” menu option. -
Process Explorer will display a warning message noting stability and crashes that may be caused by closing the handles on this file. Of course we understand this and we click “Yes”. Or alternatively, we don’t understand but as a Windows user, we blindly click “Yes” to just make the popup go away. -
-
After closing the handles, we return to Visual Studio and press F5 or click Rebuild and tada! -
Happy coding! Later C 4/12/2010SharePoint maintains some built in thumbnails that’s automatically generated when images are uploaded to the image library. This is in order to allow for the thumbnail view of the image library. Here’s an example from my blog. On the left side is the original image that exist in the image library. Click on the link to see the image in it’s full size. The right side is the SharePoint thumbnail. You can click it to see the size of the image. The formula is pretty simple… simply change the URL as follows: Original: http://www.cjvandyk.com/blog/Lists/Photos/042308_1817_VMWareSnaps3.png Thumb: http://www.cjvandyk.com/blog/Lists/Photos/_t/042308_1817_VMWareSnaps3_png.jpg As you can see, simply: -
Insert “_t/” in front of the file name, -
Replace any periods (.) with underscores (_) and finally, -
Append a “.jpg” at the end of the file name. As you can see, my example was actually a .png file, but the thumbnail is still a .jpg file. Enjoy C 3/29/2010*UPDATE* I had the opportunity to test this utility with Remote Desktop in full screen mode recently and it worked like a dream! OK, really quickly. I love playing my strategy games. One of my long time favorites has been Hearts of Iron II – Doomsday Armageddon. This game plays on my Netbook just fine, so it’s an easy one to spin up on the plane etc. The crew over at Paradox Interactive sure did a good job on the game’s logic engine. Anyway, as I said, I love playing this game. The only thing is that there’s one small problem with it on the Netbook. See, when you are playing full screen graphic games, things like system warnings of battery low status and the like, simply does not pop up over the game. As a result, you’d be playing your game happily when all of a sudden, the Netbook would start going into Hibernate. That’s all good and dandy, but see, the problem under Windows XP is that once you boot up out of Hibernate, the game doesn’t seem to restore itself and you’re forced to kill the task and reload the game. Not pretty. So I fired up Visual Studio 2008 quickly and just wrote a simple app that displays a warning message. I set it’s properties to pop up over everything else and then configured it as follows:  -
On the Display Properties screen, click the “Screen Saver” tab. -
One the Screen Saver tab, click the “Power” button.  -
On the Power Options Properties window, click the “Alarms” tab. -
On the Alarms Tab, click the “Alarm Action” button.  -
On the Low Battery Alarm Program window, click the “OK” button. -
On the Low Battery Alarm Actions window, click the “OK” button. -
On the Power Options Properties window, click the “OK” button. -
On the Display Properties window, click the “OK” button. Tired of clicking “OK” yet? OK, now go ahead and go play your game. When the battery low action triggers, this is what you’ll get: The popup message will actually occur even before the Windows system message as seen below. Hope you enjoy the utility. Later C
|
|
|
|
|