﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>Cool Programming</title>
    <link>http://www.kbcafe.com/csharp/</link>
    <description>Cool Programming Tips with C#</description>
    <managingEditor>webmaster@kbcafe.com</managingEditor>
    <webMaster>webmaster@kbcafe.com</webMaster>
    <pubDate>Wed, 28 Jun 2006 17:12:31 GMT</pubDate>
    <lastBuildDate>Wed, 28 Jun 2006 17:12:31 GMT</lastBuildDate>
    <copyright>Copyright 2005 Randy Charles Morin</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <url>http://www.kbcafe.com/csharp/logo.jpg</url>
      <title>Cool Programming</title>
      <link>http://www.kbcafe.com/csharp/</link>
    </image>
    <rar:archive xmlns:rar="http://tempuri.org">http://www.kbcafe.com/csharp/archive.xml</rar:archive>
    <item>
      <title>Regular Expressions in Javascript</title>
      <description>&lt;P&gt;I've been working today with regular expressions in javascript, trying to validate XSD types using the string.match(/../) javascript function. I found a lot of regular expressions at the &lt;A href="http://www.regexlib.com/"&gt;Regular Expression Library&lt;/A&gt;, but pretty much every regex there has some limitation, so I had to write my own. The best tutorial for writing my own was at &lt;A href="http://www.irt.org/articles/js049/index.htm#4"&gt;Internet Related Technologies&lt;/A&gt;. Some of my own follow.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;boolean&lt;BR&gt;d.match(/^(true|false|0|1)$/)&lt;/LI&gt;
&lt;LI&gt;integer&lt;BR&gt;d.match(/^[-+]?\d+$/)&lt;/LI&gt;
&lt;LI&gt;nonNegativeInteger&lt;BR&gt;d.match(/^[+]?\d+$/)&lt;/LI&gt;
&lt;LI&gt;positiveInteger&lt;BR&gt;d.match(/^[+]?0*[1-9]\d*$/)&lt;/LI&gt;
&lt;LI&gt;negativeInteger&lt;BR&gt;d.match(/^-0*[1-9]\d*$/)&lt;/LI&gt;
&lt;LI&gt;nonPositiveInteger&lt;BR&gt;d.match(/^(-\d+|[-+]?0+)$/)&lt;/LI&gt;
&lt;LI&gt;decimal&lt;BR&gt;d.match(/^[-+]?(\d*\.\d+|\d+)$/)&lt;/LI&gt;
&lt;LI&gt;hexBinary&lt;BR&gt;d.match(/^[0-9a-fA-F]+$/)&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;I'll post others in the comments, as I discover them.&lt;BR&gt;&lt;/P&gt;</description>
      <link>http://www.kbcafe.com/csharp/?guid=20060628101231</link>
      <pubDate>Wed, 28 Jun 2006 17:12:31 GMT</pubDate>
      <guid>http://www.kbcafe.com/csharp/?guid=20060628101231</guid>
      <comments>http://www.kbcafe.com/csharp/?guid=20060628101231</comments>
      <trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://www.kbcafe.com/csharp/trackback.aspx?guid=20060628101231</trackback:ping>
      <wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.kbcafe.com/csharp/commentapi.aspx?guid=20060628101231</wfw:comment>
      <wfw:commentRSS xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.kbcafe.com/csharp/20060628101231.xml</wfw:commentRSS>
      <category>RegularExpressions</category>
      <category>javascript</category>
    </item>
    <item>
      <title>XmlWriter</title>
      <description>&lt;P&gt;I've always found the &lt;A href="http://www.kbcafe.com/csharp/XmlWriter.zip"&gt;XmlWriter&lt;/A&gt; in System.Xml to be quite verbose. I spent the last hour writing my own, less verbose version. Here's a small sample.&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;kb.xml.&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Node&lt;/FONT&gt;&lt;FONT size=2&gt; n = kb.xml.&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Node&lt;/FONT&gt;&lt;FONT size=2&gt;.Root(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;Element1&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"&lt;/FONT&gt;&lt;FONT size=2&gt;);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;n = n.Element&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;Element2&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"&lt;/FONT&gt;&lt;FONT size=2&gt;);&lt;BR&gt;&lt;/FONT&gt;n.Attribute(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;Attr1"&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"value1"&lt;/FONT&gt;&lt;FONT size=2&gt;);&lt;BR&gt;n.Attribute(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;Attr2"&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"value2"&lt;/FONT&gt;&lt;FONT size=2&gt;);&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;As you can see, this is much less verbose than the equivalent XmlWriter. What's even better is that the kb.xml.Node class is simply a wrapper around System.Xml.XmlNode, so you can quickly get&amp;nbsp;to the DOM.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.kbcafe.com/csharp/XmlWriter.zip"&gt;http://www.kbcafe.com/csharp/XmlWriter.zip&lt;/A&gt;&lt;/P&gt;</description>
      <link>http://www.kbcafe.com/csharp/?guid=20060622190903</link>
      <pubDate>Fri, 23 Jun 2006 02:09:03 GMT</pubDate>
      <guid>http://www.kbcafe.com/csharp/?guid=20060622190903</guid>
      <comments>http://www.kbcafe.com/csharp/?guid=20060622190903</comments>
      <trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://www.kbcafe.com/csharp/trackback.aspx?guid=20060622190903</trackback:ping>
      <wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.kbcafe.com/csharp/commentapi.aspx?guid=20060622190903</wfw:comment>
      <wfw:commentRSS xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.kbcafe.com/csharp/20060622190903.xml</wfw:commentRSS>
      <category>c#</category>
      <category>xml</category>
    </item>
    <item>
      <title>C# or PHP/Python/Ruby</title>
      <description>Two years ago, people were telling me I should be using PHP, not C#. Last year it was Python, not C#. This year, it's Ruby not C#. Can you tell me the constant?</description>
      <link>http://www.kbcafe.com/csharp/?guid=20060614130931</link>
      <pubDate>Wed, 14 Jun 2006 20:09:31 GMT</pubDate>
      <guid>http://www.kbcafe.com/csharp/?guid=20060614130931</guid>
      <comments>http://www.kbcafe.com/csharp/?guid=20060614130931</comments>
      <trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://www.kbcafe.com/csharp/trackback.aspx?guid=20060614130931</trackback:ping>
      <wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.kbcafe.com/csharp/commentapi.aspx?guid=20060614130931</wfw:comment>
      <wfw:commentRSS xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.kbcafe.com/csharp/20060614130931.xml</wfw:commentRSS>
      <category>C#</category>
      <category>php</category>
      <category>python</category>
      <category>ruby</category>
    </item>
    <item>
      <title>MSDN Search Sucks</title>
      <description>&lt;P&gt;For years, I struggled with Microsoft's online MSDN search. Then Google&amp;nbsp;got so good that you could search MSDN better using Google. With recent MSDN changes (new msdn2 domain), it would seem that's no longer the case. So, I thought to myself, how hard would it be to write my own. Turns out, &lt;A href="http://www.kbcafe.com/msdn.aspx"&gt;it wasn't that hard&lt;/A&gt;&amp;nbsp;and it rocks!&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.kbcafe.com/msdn.aspx"&gt;http://www.kbcafe.com/msdn.aspx&lt;/A&gt;&lt;/P&gt;</description>
      <link>http://www.kbcafe.com/csharp/?guid=20060613093022</link>
      <pubDate>Tue, 13 Jun 2006 16:30:22 GMT</pubDate>
      <guid>http://www.kbcafe.com/csharp/?guid=20060613093022</guid>
      <comments>http://www.kbcafe.com/csharp/?guid=20060613093022</comments>
      <trackback:ping xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">http://www.kbcafe.com/csharp/trackback.aspx?guid=20060613093022</trackback:ping>
      <wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.kbcafe.com/csharp/commentapi.aspx?guid=20060613093022</wfw:comment>
      <wfw:commentRSS xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.kbcafe.com/csharp/20060613093022.xml</wfw:commentRSS>
      <category>msdn</category>
      <category>search</category>
    </item>
  </channel>
</rss>
