RSS Feed
LinkedIn
Delicious
Skip to main content

Cornelius J. van Dyk's SharePoint Brain Dump

Rate this blog:
Go Search
Home
Step-by-Step Guides
Downloads
Post Archive
Capacity Planning
Architecture & Topology
Support Forums
SharePoint Team Blog
  

Cornelius J. van Dyk's SharePoint Brain Dump > Categories
How do I - Get a list of all databases attached to my SQL Server 2008 R2 database server

Another quick one…  You can run this stored procedure:

exec sp_databases

Which should yield the following output:

image

or you could try this stored procedure:

exec sp_helpdb

Which would yield some more extended information thus:

image

or if you just want the names, you could execute this “undocumented” stored procedure:

exec sp_msforeachdb 'print ''?'''

Which will yield this:

image

Or you could do the manual step of executing the following select query:

select name from sys.databases

Which will yield:

image

 

Enjoy
C

FOLLOW ME:

Creating a HTML Redirect page

Every 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:

FOLLOW ME:



The node to be inserted is from a different document context

If 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:

FOLLOW ME:    



What is this – _.vshost.exe and _.vshost.exe.config files in my BIN compile folder

If 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



Latest SharePoint 2010 SDK available for download

Come and get it!  The latest SharePoint 2010 SDK is now available for download from Microsoft Downloads.  Get it here:

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=f0c9daf3-4c54-45ed-9bde-7b4d83a8f26f

Happy coding!
C

Technorati Tags: ,

Share :


How do I – Solve the – Unexpected error creating debug information file .pdb. The process cannot access the file because it is being used by another process. – compiler error?

As a SharePoint Developer, you may run across this error at some point. 

image

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:

  1. Open Windows Explorer.
  2. Browse to the C:\Program Files\Process Explorer location, or any other alternative location where you may have installed Process Explorer to.
  3. image
  4. Double click “Procexp.exe” to launch Process Explorer.
  5. 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.
  6. In the top menu, click the “Find” menu item.
  7. 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.
  8. image
  9. In the Process Explorer Search dialog window, enter the name of your DLL, or in our case, the name of our .pdb file.
  10. Click “Search” or press “Enter”.
  11. image
  12. Process Explorer displays the process that has the lock and wouldn’t you know it, it’s Visual Studio itself.
  13. Double click on the “devenv.exe” line.
  14. Process Explorer now closes the dialog window and the “devenv.exe” item is added to the displayed list.
  15. Right click the “devenv.exe” line in the displayed list.
  16. image
  17. On the popup menu, click the “Close Handle” menu option.
  18. 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.
  19. image
  20. After closing the handles, we return to Visual Studio and press F5 or click Rebuild and tada! 
  21. image

Happy coding!

Later
C



SharePoint built in automatic thumbnails for an image library

SharePoint 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

Technorati Tags: ,

Share :


Utility – Battery Low

*UPDATE* I had the opportunity to test this utility with Remote Desktop in full screen mode recently and it worked like a dream! 

image

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:

  • Download my BatteryLow utility.  Place it somewhere on your hard drive. 
  • Right click anywhere on your desktop background.
  • On the popup menu, click “Properties”.

image

  • On the Display Properties screen, click the “Screen Saver” tab.
  • One the Screen Saver tab, click the “Power” button.

image

  • On the Power Options Properties window, click the “Alarms” tab.
  • On the Alarms Tab, click the “Alarm Action” button.

image

  • On the Low Battery Alarm Actions window, click the “Configure Program” button.

image

  • On the Low Battery Alarm Program window, click the “Browse” button.
  • Browse to the BatteryLow utility location and double click the file.

image

  • 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:

image

The popup message will actually occur even before the Windows system message as seen below.

image

Hope you enjoy the utility.

Later
C

Technorati Tags: ,,
Share :


1 - 10 Next