Navigation

Search

Categories

On this page

Dont touch a compiler on monday
Useful Dos command
Duplicate submit bar in SharePoint surveys

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 120
This Year: 1
This Month: 0
This Week: 0
Comments: 40

Sign In
Pick a theme:

# Monday, August 07, 2006
Monday, August 07, 2006 10:11:45 AM (Mountain Daylight Time, UTC-06:00) ( All things Microsoft | Code )

Some people (like myself) should learn not to touch a compiler on Monday mornings (before the third cup of coffee at least)

I don't know why I couldn't remember how to do this, but I feel like a noob.

I was just trying to build a Xml Document in memory with a XmlWriter and a MemoryStream simple stuff right?

XmlWriterSettings settings = new XmlWriterSettings();

settings.Indent = true;

settings.OmitXmlDeclaration = false;

MemoryStream strm = new MemoryStream();

using (XmlWriter w = XmlWriter.Create(strm, settings)) {

...

}

Now what if you want to get that back into a string? Say for use in a web-service query or something. like, I don't know, the SharePoint 2003 Search Web Service.

That conversion back to a string might look something like this.

string s;
System.O.MemoryStream ms;
System.IO.StreamReader sr = new System.IO.StreamReader(ms));
s = sr.ReadToEnd();
sr.Close();
ms.Close();

Of course later in the day, I decided to actually download the Research Service SDK, grab a copy of the QueryPacket Schema I was working against, generated a class against it with the XSD tool, and subclassed it to make sure I was submitting a valid search request. All was well with the world again, and I didn't feel so horribly inept for a Monday morning. Yeah me!

Comments [0] | | # 
# Wednesday, July 19, 2006
Wednesday, July 19, 2006 10:06:00 AM (Mountain Daylight Time, UTC-06:00) ( )

Downloading open source (the unix variety) means that you end up having a folder called DOC with a bunch of plain-text files that have no extension

Windows doesn't really know what to do with that, because it uses the extension (whats after the last dot) to assign a mime-type and associate default shell commands.

Sometimes you want to rename those files to reflect that they're plain-text ascii files so you can open it with notepad (and friends)

open your shell, and run the following after changing your working directory to the afore mentioned DOC folder

for /f %i in ('dir /b') do @rename %i %i.txt

bitchin'

Comments [0] | | # 
# Thursday, July 13, 2006
Thursday, July 13, 2006 3:19:35 PM (Mountain Daylight Time, UTC-06:00) ( )

Per the awesome post from Jim Duncan http://dev.collutions.com/blog/Pages/CloneToolbar.aspx

<img src="/_layouts/images/blank.gif" onload="CloneToolBarAndInsertAfter(this)">
  <script language="javascript">
<!--
function CloneToolBarAndInsertAfter(element)
{
 var i = 0;
 var theTables;
 var theNewToolBar = document.createElement("TABLE");
 var theTables = document.all.tags("TABLE");
 while (theTables[i].className != "ms-toolbar") i++;
 theNewToolBar = theTables[i].cloneNode(true);
 element.insertAdjacentElement('afterEnd',theNewToolBar);
}

//-->
</script>

Comments [0] | | #