<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PeterKellner.net &#187; JavaScript</title>
	<atom:link href="http://peterkellner.net/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://peterkellner.net</link>
	<description>Microsoft Focussed, JavaScript (ExtJS, SenchaTouch &#38; Windows 8 Metro)</description>
	<lastBuildDate>Tue, 07 Feb 2012 21:14:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A SenchTouch2 Simple Example Using Tab Pages and Buttons</title>
		<link>http://peterkellner.net/2012/01/24/a-senchtouch2-simple-example-using-tab-pages-and-buttons/</link>
		<comments>http://peterkellner.net/2012/01/24/a-senchtouch2-simple-example-using-tab-pages-and-buttons/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 05:47:41 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Sencha]]></category>
		<category><![CDATA[SenchaTouch]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2012/01/24/a-senchtouch2-simple-example-using-tab-pages-and-buttons/</guid>
		<description><![CDATA[Again, I find myself going back to basics when trying to make my SenchaTouch2 Project work.&#160; Today, I updated my framework to Sencha’s latest alpha release of the tools (p4).&#160; I often make these examples because I’m trying to prove there is a SenchaTouch bug and usually find out it’s my bug somehow.&#160; So, since [...]]]></description>
			<content:encoded><![CDATA[<p>Again, I find myself going back to basics when trying to make my SenchaTouch2 Project work.&#160; Today, I updated my framework to <a href="http://www.sencha.com/">Sencha’s</a> latest alpha release of the tools (p4).&#160; I often make these examples because I’m trying to prove there is a <a href="http://www.sencha.com/products/touch/">SenchaTouch</a> bug and usually find out it’s my bug somehow.&#160; So, since I went to the trouble of making a simple example of two stand alone buttons that switch between <a href="http://docs.sencha.com/touch/2-0/#!/api/Ext.tab.Panel">tab</a> pages, I thought I’d blog it.</p>  <p>Here is what we get ultimately.&#160; When clicking on b1 or b2, the home and the contact tab are selected automatically (same as clicking on those two items in the tab bar).</p>  <p>One thing I find a little odd, is that to create the class, you say Ext.TabPanel and not Ext.tab.Panel. (OK, I just tested that and both work)</p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2012/01/image14.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2012/01/image_thumb12.png" width="244" height="233" /></a></p>  <p>And, here is the code:</p>  <pre class="csharpcode"><span class="kwrd">&lt;!</span><span class="html">DOCTYPE</span> <span class="attr">html</span><span class="kwrd">&gt;</span>

<span class="rem">&lt;!-- Auto Generated with Sencha Designer --&gt;</span>
<span class="rem">&lt;!-- Modifications to this file will be overwritten. --&gt;</span>
<span class="kwrd">&lt;</span><span class="html">html</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">head</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">meta</span> <span class="attr">http-equiv</span><span class="kwrd">=&quot;Content-Type&quot;</span> <span class="attr">content</span><span class="kwrd">=&quot;text/html; charset=utf-8&quot;</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">title</span><span class="kwrd">&gt;</span>AgelessST2<span class="kwrd">&lt;/</span><span class="html">title</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;sencha-touch-2.0.0-pr3/resources/css/sencha-touch.css&quot;</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">script</span> <span class="attr">type</span><span class="kwrd">=&quot;text/javascript&quot;</span> <span class="attr">src</span><span class="kwrd">=&quot;sencha-touch-2.0.0-pr3/sencha-touch-all-debug.js&quot;</span><span class="kwrd">&gt;&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span>
    
    &lt;script type=<span class="str">&quot;text/javascript&quot;</span>  &gt;

        Ext.setup({
            onReady: <span class="kwrd">function</span> () {

                <span class="kwrd">var</span> pan = Ext.create(<span class="str">'Ext.TabPanel'</span>, {
                    height: 150,
                    defaults: {
                        styleHtmlContent: <span class="kwrd">true</span>
                    },
                    items: [
                        {

                            title: <span class="str">'Home'</span>,
                            html: <span class="str">'Home Screen'</span>
                        },
                        {

                            title: <span class="str">'Contact'</span>,
                            html: <span class="str">'Contact Screen'</span>
                        }
                    ]
                });

                <span class="kwrd">var</span> buttonPannel = Ext.create(<span class="str">'Ext.Panel'</span>, {
                    layout: <span class="str">'hbox'</span>,
                    items: [
                            {
                                xtype: <span class="str">'button'</span>,
                                text: <span class="str">'b1'</span>,
                                handler: <span class="kwrd">function</span> (button) {
                                    pan.setActiveItem(0);
                                }
                            },
                            {
                                xtype: <span class="str">'button'</span>,
                                text: <span class="str">'b2'</span>,
                                handler: <span class="kwrd">function</span> (button) {
                                    pan.setActiveItem(2);
                                }
                            }
                ]
                });

                Ext.Viewport.add({
                    fullscreen: <span class="kwrd">true</span>,
                    layout: <span class="str">'vbox'</span>,
                    items: [buttonPannel, pan]
                });
            }
        });

      
    
    
    <span class="kwrd">&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">body</span><span class="kwrd">&gt;&lt;/</span><span class="html">body</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">html</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>Hope this helps.


]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2012/01/24/a-senchtouch2-simple-example-using-tab-pages-and-buttons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a Simple 2 Card Carousel with SenchaTouch 2</title>
		<link>http://peterkellner.net/2012/01/09/building-a-simple-2-card-carousel-with-senchatouch-2/</link>
		<comments>http://peterkellner.net/2012/01/09/building-a-simple-2-card-carousel-with-senchatouch-2/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 21:58:01 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Sencha]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2012/01/09/building-a-simple-2-card-carousel-with-senchatouch-2/</guid>
		<description><![CDATA[It was surprisingly difficult for me to build a very simple Carousel application with SenchaTouch 2.0 so I thought I’d make a short blog post with the example code in the hopes it saves someone else some time.&#160; Basically, since this runs from the Sencha CDN, you should be able to paste this code directly [...]]]></description>
			<content:encoded><![CDATA[<p>It was surprisingly difficult for me to build a very simple <a href="http://www.sencha.com/learn/touch">Carousel</a> application with <a href="http://www.sencha.com/products/touch/">SenchaTouch</a> 2.0 so I thought I’d make a short blog post with the example code in the hopes it saves someone else some time.&#160; Basically, since this runs from the <a href="http://www.sencha.com/">Sencha</a> CDN, you should be able to paste this code directly into your web site as an html page and it should run directly.</p>  <p>The fact that you have to have an items array inside an items array is a little confusing as well as having to specify the height or nothing comes out.&#160; I’m used to using flex: 1 to get the width right, but I had forgotten about height.</p>  <p>Here is what is created and the html and <a href="http://en.wikipedia.org/wiki/JavaScript">JavaScript</a> code.</p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2012/01/image4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2012/01/image_thumb3.png" width="244" height="175" /></a></p>  <p>&#160;</p>  <p>and the html:</p>  <p>&#160;</p>  <pre class="csharpcode"><span class="kwrd">&lt;!</span><span class="html">DOCTYPE</span> <span class="attr">html</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">html</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">head</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">meta</span> <span class="attr">http-equiv</span><span class="kwrd">=&quot;Content-Type&quot;</span> <span class="attr">content</span><span class="kwrd">=&quot;text/html; charset=utf-8&quot;</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">title</span><span class="kwrd">&gt;</span>SenchaTouch 2.0 Carousel Example From PeterKellner.net<span class="kwrd">&lt;/</span><span class="html">title</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;http://extjs.cachefly.net/touch/sencha-touch-designer-edition/resources/css/sencha-touch.css&quot;</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">script</span> <span class="attr">type</span><span class="kwrd">=&quot;text/javascript&quot;</span> <span class="attr">src</span><span class="kwrd">=&quot;http://extjs.cachefly.net/touch/sencha-touch-designer-edition/sencha-touch-all-debug.js&quot;</span><span class="kwrd">&gt;&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span>
    &lt;script type=<span class="str">&quot;text/javascript&quot;</span>&gt;

        Ext.setup({
            fullscreen: <span class="kwrd">true</span>,
            onReady: <span class="kwrd">function</span> () {
                Ext.create(<span class="str">'Ext.Panel'</span>, {
                    fullscreen: <span class="kwrd">true</span>,
                    height: 200,
                    items: [{
                        xtype: <span class="str">'carousel'</span>,
                        height: 200,
                        items: [
                                {
                                    title: <span class="str">'title card 1'</span>,
                                    html: <span class="str">'card1'</span>,
                                    cls: <span class="str">'card1'</span>
                                },
                                {
                                    title: <span class="str">'title card 2'</span>,
                                    html: <span class="str">'card2'</span>,
                                    cls: <span class="str">'card2'</span>
                                }
                            ]
                    }]
                });
            }
        });
    <span class="kwrd">&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">body</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">body</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">html</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>HTH’s</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2012/01/09/building-a-simple-2-card-carousel-with-senchatouch-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>With Windows 8 Metro HTML5/CSS3/JavaScript/WinRT, Read Any File From Project Directory</title>
		<link>http://peterkellner.net/2012/01/03/with-windows-8-metro-html5css3javascriptwinrt-read-any-file-from-project-directory/</link>
		<comments>http://peterkellner.net/2012/01/03/with-windows-8-metro-html5css3javascriptwinrt-read-any-file-from-project-directory/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 21:25:23 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Visual Studio 2011 Developer Preview]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[Windows 8 Metro]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2012/01/03/with-windows-8-metro-html5css3javascriptwinrt-read-any-file-from-project-directory/</guid>
		<description><![CDATA[One of the standard things we programmers do is to read static files from our project directory.&#160; That is, say you put a json file such as /data/stats_data.json at the root of your Visual Studio 2011 PreRelease Developer Edition project and you want to read it and convert it to a JavaScript object using WinRT [...]]]></description>
			<content:encoded><![CDATA[<p>One of the standard things we programmers do is to read static files from our project directory.&#160; That is, say you put a <a href="http://json.org">json</a> file such as /data/stats_data.json at the root of your <a href="http://msdn.microsoft.com/en-us/vstudio/hh127353">Visual Studio 2011 PreRelease Developer Edition</a> project and you want to read it and convert it to a JavaScript object using <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx">WinRT</a> (JSON.parse(..)).&#160; This post explains how to do that using the <a href="http://msdn.microsoft.com/en-us/windows/apps">Metro App Development Framework with JavaScript.</a></p>  <p>&#160;</p>  <div>   <div style="width: 450px; float: right">     <p>By way of background, this post was motivated by two threads I had with a great support helper on the MSDN forums named <a href="http://social.msdn.microsoft.com/profile/jpsanders/?ws=usercard-mini">Jeff Sanders</a>.&#160; The links are here:&#160; <a href="http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/4f27f674-8952-4e4e-bb17-dcdff74d0790">Thread 1</a>&#160; and <a href="http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/6c989bba-0455-41db-b414-7a30fd6904b5">Thread 2</a>.</p>   </div>    <div>     <p><a href="http://social.msdn.microsoft.com/profile/jpsanders/?ws=usercard-mini"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2012/01/image2.png" width="184" height="244" /></a></p>   </div> </div>  <p>&#160;</p>  <p>First, let’s look at the basic empty project by creating a Blank Application as follows:</p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2012/01/image.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2012/01/image_thumb.png" width="394" height="370" /></a></p>  <p>&#160;</p>  <p>Then, drop some JavaScript into a new data directory which is what we plan on reading into our <a href="http://javascript.org">JavaScript</a>.</p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2012/01/image7.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2012/01/image7_thumb.png" width="266" height="261" /></a></p>  <p>&#160;</p>  <p>Now, let’s add some code to the default.js file and one function called ReadAllDataFile that actually does the heavy lifting.&#160; Add to the default.html just one div tag in the body so we can prove we did something good, and run it.&#160; Below is the project that has all this in it. </p>  <table cellspacing="0" cellpadding="2" width="400" border="1"><tbody>     <tr>       <td width="114">Link To Download Project: </td>        <td valign="top" width="348">&#160; <div id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:80f27518-7944-460f-bd09-3c2747ae89e2" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px"><p> <a href="http://peterkellner.net/wp/wp/wp-content/uploads/2012/01/MetroJSApp1.zip" target="_blank">Visual Studio 2011 Project With Source</a></p></div>       </td>     </tr>   </tbody></table>  <p>&#160;</p>  <p>And the explanation for the code pasted to the bottom with line numbers now (though it’s pretty self explanatory).&#160; If you feel the urge to cut and paste the code, you will get annoyed with my line numbers. I’d suggest grabbing the zip file of the project from above and using that code for pasting purposes.</p>  <ul>   <ul>     <li><u>Line 57</u> simple is the code that executes when the app launches. All it does is call our function ReadAllDataFile with the local path to the file we want.</li>      <li><u>Lines 4 and 5</u> get the location of our project. Remember, out deployment is actually copied some place totally different and packaged for running.&#160; It is not running in our local directory so it’s important that whatever file you reference be a part of your solution.</li>      <li><u>Lines 7 and 8</u> basically create a “promise” which when the file is accessed, will return and execute the anonymous function we are passing it (starting with ..(function(stream) {…).</li>      <li><u>Line 15</u> completes after the promise to read the file.</li>      <li><u>Line 19</u> should actually be enough, but I found that some json files have wide characters in them causing it to crash.&#160; The workaround is to read the bytes and convert them while stripping out the higher order characters.&#160; Remember, this is a simple example, you may want those high order characters.</li>      <li><u>Lines 36 and 37</u> grab the population of the state of New York (my home state) from the JSON file.</li>      <li><u>Line 40</u> displays it on the web page as follows:</li>   </ul> </ul>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2012/01/image1.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2012/01/image_thumb1.png" width="244" height="150" /></a></p>  <p>(Tablet Simulator Screen Shot With Result Above)</p>  <p>default.js:</p>  <div class="csharpcode">   <pre><span class="lnum">   1:  </span><span class="rem">// read the file you want</span></pre>

  <pre><span class="lnum">   2:  </span><span class="kwrd">function</span> ReadAllDataFile(fileNameInLocalTree) {</pre>

  <pre><span class="lnum">   3:  </span>    </pre>

  <pre><span class="lnum">   4:  </span>    <span class="kwrd">var</span> package = Windows.ApplicationModel.Package.current;</pre>

  <pre><span class="lnum">   5:  </span>    <span class="kwrd">var</span> installedLocation = package.installedLocation;</pre>

  <pre><span class="lnum">   6:  </span>&#160;</pre>

  <pre><span class="lnum">   7:  </span>    installedLocation.createFileAsync(fileNameInLocalTree, Windows.Storage.CreationCollisionOption.openIfExists).then(<span class="kwrd">function</span> (dataFile) {</pre>

  <pre><span class="lnum">   8:  </span>        dataFile.openAsync(Windows.Storage.FileAccessMode.read).then(<span class="kwrd">function</span> (stream) {</pre>

  <pre><span class="lnum">   9:  </span>            <span class="kwrd">var</span> size = stream.size;</pre>

  <pre><span class="lnum">  10:  </span>            <span class="kwrd">if</span> (size == 0) {</pre>

  <pre><span class="lnum">  11:  </span>                <span class="rem">// Data not found</span></pre>

  <pre><span class="lnum">  12:  </span>            }</pre>

  <pre><span class="lnum">  13:  </span>            <span class="kwrd">else</span> {</pre>

  <pre><span class="lnum">  14:  </span>                <span class="kwrd">var</span> inputStream = stream.getInputStreamAt(0);</pre>

  <pre><span class="lnum">  15:  </span>                <span class="kwrd">var</span> reader = <span class="kwrd">new</span> Windows.Storage.Streams.DataReader(inputStream);</pre>

  <pre><span class="lnum">  16:  </span>&#160;</pre>

  <pre><span class="lnum">  17:  </span>                reader.loadAsync(size).then(<span class="kwrd">function</span> () {</pre>

  <pre><span class="lnum">  18:  </span>&#160;</pre>

  <pre><span class="lnum">  19:  </span>                    <span class="rem">//var contents = reader.readString(size); // fails with multibyte error if bad data (see legislators.getList.json)</span></pre>

  <pre><span class="lnum">  20:  </span>&#160;</pre>

  <pre><span class="lnum">  21:  </span>                    <span class="rem">// allocate the full array so readBytes can insert it in full</span></pre>

  <pre><span class="lnum">  22:  </span>                    <span class="kwrd">var</span> array = <span class="kwrd">new</span> Array(size);</pre>

  <pre><span class="lnum">  23:  </span>                    reader.readBytes(array);</pre>

  <pre><span class="lnum">  24:  </span>                    </pre>

  <pre><span class="lnum">  25:  </span>                    <span class="kwrd">var</span> newString = <span class="str">&quot;&quot;</span>;</pre>

  <pre><span class="lnum">  26:  </span>                    <span class="kwrd">for</span> (<span class="kwrd">var</span> i = 0; i &lt; array.length; i++) {</pre>

  <pre><span class="lnum">  27:  </span>                        <span class="rem">// only printable characters (include spaces because could be part of names) (very rough here)</span></pre>

  <pre><span class="lnum">  28:  </span>                        <span class="rem">// http://www.csgnetwork.com/asciiset.html</span></pre>

  <pre><span class="lnum">  29:  </span>                        <span class="kwrd">if</span> (array[i] &gt;= 32 &amp;&amp; array[i] &lt;= 126) {</pre>

  <pre><span class="lnum">  30:  </span>                            <span class="kwrd">var</span> c = String.fromCharCode(array[i]);</pre>

  <pre><span class="lnum">  31:  </span>                            newString += c;</pre>

  <pre><span class="lnum">  32:  </span>                        }</pre>

  <pre><span class="lnum">  33:  </span>                    }</pre>

  <pre><span class="lnum">  34:  </span>&#160;</pre>

  <pre><span class="lnum">  35:  </span>                    </pre>

  <pre><span class="lnum">  36:  </span>                    <span class="kwrd">var</span> result = JSON.parse(newString);</pre>

  <pre><span class="lnum">  37:  </span>                    <span class="kwrd">var</span> newYorkPopulation = result.NY.P001001;</pre>

  <pre><span class="lnum">  38:  </span>&#160;</pre>

  <pre><span class="lnum">  39:  </span>                    <span class="rem">// output to the screen</span></pre>

  <pre><span class="lnum">  40:  </span>                    document.getElementById(<span class="str">'outputhere'</span>).innerHTML = <span class="str">&quot;New York Population: &quot;</span> + newYorkPopulation;</pre>

  <pre><span class="lnum">  41:  </span>                    </pre>

  <pre><span class="lnum">  42:  </span>                });</pre>

  <pre><span class="lnum">  43:  </span>            }</pre>

  <pre><span class="lnum">  44:  </span>        })</pre>

  <pre><span class="lnum">  45:  </span>    });</pre>

  <pre><span class="lnum">  46:  </span>}</pre>

  <pre><span class="lnum">  47:  </span>&#160;</pre>

  <pre><span class="lnum">  48:  </span>(<span class="kwrd">function</span> () {</pre>

  <pre><span class="lnum">  49:  </span>    <span class="str">'use strict'</span>;</pre>

  <pre><span class="lnum">  50:  </span>    <span class="rem">// Uncomment the following line to enable first chance exceptions.</span></pre>

  <pre><span class="lnum">  51:  </span>    Debug.enableFirstChanceException(<span class="kwrd">true</span>);</pre>

  <pre><span class="lnum">  52:  </span>&#160;</pre>

  <pre><span class="lnum">  53:  </span>    WinJS.Application.onmainwindowactivated = <span class="kwrd">function</span> (e) {</pre>

  <pre><span class="lnum">  54:  </span>        <span class="kwrd">if</span> (e.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {</pre>

  <pre><span class="lnum">  55:  </span>            </pre>

  <pre><span class="lnum">  56:  </span>            <span class="rem">// start of my insert code            </span></pre>

  <pre><span class="lnum">  57:  </span>            ReadAllDataFile(<span class="str">&quot;\data\\states_data.json&quot;</span>);</pre>

  <pre><span class="lnum">  58:  </span>            <span class="rem">// end of my insert code</span></pre>

  <pre><span class="lnum">  59:  </span>        }</pre>

  <pre><span class="lnum">  60:  </span>    }</pre>

  <pre><span class="lnum">  61:  </span>&#160;</pre>

  <pre><span class="lnum">  62:  </span>    WinJS.Application.start();</pre>

  <pre><span class="lnum">  63:  </span>})();</pre>
</div>
<style type="text/css">







.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<p>Hope this Helps!&#160; Remember, these are pre-beta bits so things could change when production comes a long.&#160; Feel free to add comments to this post and let me know if it stops working.&#160; </p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2012/01/03/with-windows-8-metro-html5css3javascriptwinrt-read-any-file-from-project-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building A Windows 8 Metro Style JavaScript / HTML5 / CSS3 App Using ListView</title>
		<link>http://peterkellner.net/2011/12/27/building-a-windows-8-metro-style-javascript-html5-css3-app-using-listview/</link>
		<comments>http://peterkellner.net/2011/12/27/building-a-windows-8-metro-style-javascript-html5-css3-app-using-listview/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 22:08:36 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[.NET 4.5]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[Windows 8 Metro]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2011/12/27/building-a-windows-8-metro-style-javascript-html5-css3-app-using-listview/</guid>
		<description><![CDATA[&#160;  Background  The new Windows 8 Developer environment is seriously under documented at this point in it’s product life.&#160; Microsoft released a “Developer Preview” at the Build Conference in September, than has not done any noticeable updates or improvement on those bits.&#160; The Video’s online from build are very helpful because you can [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>  <h3>Background</h3>  <p>The new <a href="http://msdn.microsoft.com/en-us/library/windows/apps/">Windows 8 Developer environment</a> is seriously under documented at this point in it’s product life.&#160; <a href="http://www.microsoft.com/en-us/default.aspx">Microsoft</a> released a “Developer Preview” at the <a href="http://www.buildwindows.com/">Build Conference</a> in September, than has not done any noticeable updates or improvement on those bits.&#160; The Video’s online from build are very helpful because you can go through them in slow motion and see how to make things work.&#160; In this article, I’m going to go through the steps necessary in a lot of detail to build a simple list read-only list viewer of US Congress legislators in California.&#160; At the end, we’ll have something like the following working:</p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/12/image10.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/12/image_thumb9.png" width="343" height="226" /></a></p>  <p>(actual tablet from build running the app)</p>  <p>&#160;</p>  <p>and the completed solution from Visual Studio 2011 (it’s always nice to have source)</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:1e923b73-d9ba-469f-ad29-75379fe3c99f" class="wlWriterSmartContent">   <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/12/CongressApp.zip" target="_blank">Visual Studio Project</a></p> </div>  <p>&#160;</p>  <h3>Getting Visual Studio 2011 Going To Create The Project</h3>  <p>First, launch <a href="http://msdn.microsoft.com/en-us/vstudio/hh127353">Visual Studio 2011</a> and give the standard File/New Project choice and chose JavaScript / Windows Metro Style / Fixed Layout Application as follows:</p>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/12/image11.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/12/image_thumb10.png" width="428" height="320" /></a></p>  <p>&#160;</p>  <p>Notice, there are two files we will primary work with, default.js and default.html. </p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/12/image12.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/12/image_thumb11.png" width="244" height="237" /></a></p>  <p>The default.html is a very classic html page with just the standard html doctype, some JavaScript includes, a style sheet and a simple div container.&#160; The default.js is actually what gives this page life.</p>  <p>One thing you’ll quickly discover if you have done much web development before (particularly JavaScript) is that unlike XAML in Visual Studio, there is no design view.&#160; This shouldn’t be an entire surprise because in Microsoft’s ASP.NET MVC, there also is know design view for html files.&#160; However, there is a really big difference here that I don’t see people pointing out clearly enough.&#160; I’m going to say it twice for emphasis.&#160; When you run your Metro App, there is no IE Debug, Firebug or Chrome Developer Tools to look at what are running (OK, I’ll spare saying it again, but this is really critical).&#160; The way most of us do web development that depends on a lot of JavaScript is to launch the application in the browser, then dive into the browser’s debugger and do all there debugging from there (that is by running the Visual Studio project outside the Visual Studio debugger.</p>  <p>Blend to the rescue! (more like fire, and without <a href="http://msdn.microsoft.com/en-us/windows/apps/br229516.aspx">Expression Blend</a>, the house would burn down).&#160; When you right click on the HTML file (as shown below) and open in blend, you will now see the page as if it were being run.&#160; I’ve noticed that if I load my JavaScript data stores from local arrays, those actually render, but if I try to pull data from a live data source they do not.&#160; I’m guessing that’s my misunderstanding for how to do it, rather than a product short coming.</p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/wp/wp/wp-content/uploads/2011/12/image13.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/wp/wp/wp-content/uploads/2011/12/image_thumb12.png" width="244" height="203" /></a></p>  <p>&#160;</p>  <h3>Putting Down the ListView in HTML</h3>  <p>Let’s get down to some real work here.&#160; First, let’s open the default.html and put down a listview.&#160; Before though, let’s look at what the template gives us (it’s very simple and boring).</p>  <pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">body</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">data-win-control</span><span class="kwrd">=&quot;WinJS.UI.ViewBox&quot;</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;fixed-layout&quot;</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">p</span><span class="kwrd">&gt;</span>Content goes here<span class="kwrd">&lt;/</span><span class="html">p</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">body</span><span class="kwrd">&gt;</span></pre>

<p>We’ll add all our stuff to the “Content goes here”.&#160; Fist, let’s add the listview control as follows:</p>

<pre class="csharpcode">&lt;div id=<span class="str">&quot;listview&quot;</span>
   <span class="kwrd">class</span>=<span class="str">&quot;flipView&quot;</span>
   data-win-control=<span class="str">&quot;WinJS.UI.ListView&quot;</span> 
   data-win-options=<span class="str">&quot;{dataSource: itemDataSource, itemRenderer: personTemplate,
       layout: {type: WinJS.UI.GridLayout, maxRows:2}}&quot;</span>
     style=<span class="str">&quot;margin: 15px 15px 15px 15px; left: -3px; top: 10px; height: 100%;width: 100%&quot;</span>&gt;
&lt;/div&gt;</pre>

<p>and the template itself:</p>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span><span class="kwrd">=&quot;personTemplate&quot;</span> <span class="attr">data-win-control</span><span class="kwrd">=&quot;WinJS.Binding.Template&quot;</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">style</span><span class="kwrd">=&quot;width: 100%;height: 100%&quot;</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">style</span><span class="kwrd">=&quot;margin: 15px 15px 15px 15px&quot;</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">img</span> <span class="attr">data-win-bind</span><span class="kwrd">=&quot;src: govtrack_id convertGovTrackIdToImgTag&quot;</span> 
        <span class="attr">alt</span><span class="kwrd">=&quot;Databound image&quot;</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">h3</span><span class="kwrd">&gt;</span>
        Rep <span class="kwrd">&lt;</span><span class="html">span</span> <span class="attr">class</span><span class="kwrd">=&quot;content&quot;</span> <span class="attr">data-win-bind</span><span class="kwrd">=&quot;innerText: firstname&quot;</span><span class="kwrd">&gt;</span>
         <span class="kwrd">&lt;/</span><span class="html">span</span><span class="kwrd">&gt;</span><span class="attr">&amp;nbsp;</span><span class="kwrd">&lt;</span><span class="html">span</span> <span class="attr">class</span><span class="kwrd">=&quot;letter&quot;</span>
            <span class="attr">data-win-bind</span><span class="kwrd">=&quot;innerText: lastname&quot;</span><span class="kwrd">&gt;</span>
         <span class="kwrd">&lt;/</span><span class="html">span</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">h3</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>Remembering that any style that begins with data- is ignored by html and can be handled by the program for doing template type stuff, you see here that we have a windows control declared which is based in the WinRT runtime (WinJS.UI.ListView).&#160; We also have options set declaratively here in the data-win-options.&#160; All those can be set in the default.js file which is often easier because the intellisense helps us.</p>

<p>Explaining the options is as follows:</p>

<ol>
  <ol>
    <li>datasource:&#160; defined in the default.js and is what we refer to this listview’s data source with </li>

    <li>itemRenderer: next, I’ll explain this. It points at the div that has the actual rendered template </li>

    <li>layout: just says what kind of layout. in our case, GridLayout. </li>

    <li>style: should really be set in a class but I got a little lazy since I’m not so good at the CSS stuff </li>
  </ol>
</ol>

<p>And, don’t forget to update your depencies (namespaces for all your c# folks out there).&#160; Here are the ones you need to replace in your html file.</p>

<pre class="csharpcode">    <span class="kwrd">&lt;</span><span class="html">script</span> <span class="attr">type</span><span class="kwrd">=&quot;text/javascript&quot;</span> <span class="attr">src</span><span class="kwrd">=&quot;WinJS/js/base.js&quot;</span><span class="kwrd">&gt;&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span>
    &lt;script type=<span class="str">&quot;text/javascript&quot;</span> src=<span class="str">&quot;WinJS/js/ui.js&quot;</span>&gt;&lt;/script&gt;
    &lt;script type=<span class="str">&quot;text/javascript&quot;</span> src=<span class="str">&quot;WinJS/js/binding.js&quot;</span>&gt;&lt;/script&gt;
    &lt;script type=<span class="str">&quot;text/javascript&quot;</span> src=<span class="str">&quot;WinJS/js/controls.js&quot;</span>&gt;&lt;/script&gt;
    &lt;script type=<span class="str">&quot;text/javascript&quot;</span> src=<span class="str">&quot;WinJS/js/res.js&quot;</span>&gt;&lt;/script&gt;
    &lt;script type=<span class="str">&quot;text/javascript&quot;</span> src=<span class="str">&quot;WinJS/js/animations.js&quot;</span>&gt;&lt;/script&gt;
    &lt;script type=<span class="str">&quot;text/javascript&quot;</span> src=<span class="str">&quot;WinJS/js/uicollections.js&quot;</span>&gt;&lt;/script&gt;
    &lt;script type=<span class="str">&quot;text/javascript&quot;</span> src=<span class="str">&quot;WinJS/js/wwaapp.js&quot;</span>&gt;<span class="kwrd">&lt;/</span><span class="html">script</span><span class="kwrd">&gt;</span></pre>

<p>&#160;</p>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>&#160;</p>

<h3>JavaScript File Update</h3>

<p>Finally, let’s update the JavaScript file.&#160; First, we need to create a simple array that we will databind to.&#160; Then, we need to associate that array with the itemDataSource and finally execute.&#160; The only thing tricky we have here is a Converter that takes an Id and build an image src tag for the image control itself.&#160; Notice that the converter is called convertGovTrackIdToImgTag.&#160; It takes in a govTrackId and returns the full blown URL to tick in the image url.</p>

<p>All the source is below.</p>

<p>Hope this helps!</p>

<p>&#160;</p>

<p>&#160;</p>

<pre class="csharpcode">convertGovTrackIdToImgTag = WinJS.Binding.converter(<span class="kwrd">function</span> (govTrackId) {
    <span class="kwrd">var</span> retUrl = <span class="str">'http://www.govtrack.us/data/photos/'</span> + govTrackId + <span class="str">'-50px.jpeg'</span>;
    <span class="kwrd">return</span> retUrl;
});


<span class="kwrd">var</span> itemDataSource = {};

(<span class="kwrd">function</span> () {
    <span class="str">'use strict'</span>;
    <span class="rem">// Uncomment the following line to enable first chance exceptions.</span>
    Debug.enableFirstChanceException(<span class="kwrd">true</span>);

    <span class="rem">//allLegislatorsCreateFile();</span>


    WinJS.Application.onmainwindowactivated = <span class="kwrd">function</span> (e) {
        <span class="kwrd">if</span> (e.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {

            <span class="kwrd">var</span> items = [];
            <span class="kwrd">var</span> itemsFresh = [{
                firstname: <span class="str">&quot;Barack&quot;</span>,
                lastname: <span class="str">&quot;Obama&quot;</span>,
                govtrack_id: <span class="str">&quot;400629&quot;</span>
            },
            {
                firstname: <span class="str">&quot;Adam&quot;</span>,
                lastname: <span class="str">&quot;Smith&quot;</span>,
                govtrack_id: <span class="str">&quot;400379&quot;</span>
            },
            {
                firstname: <span class="str">&quot;Adrian&quot;</span>,
                lastname: <span class="str">&quot;Smith&quot;</span>,
                govtrack_id: <span class="str">&quot;412217&quot;</span>
            }];
            items.push(itemsFresh[0]);
            items.push(itemsFresh[1]);
            items.push(itemsFresh[2]);

            itemDataSource = <span class="kwrd">new</span> WinJS.UI.ArrayDataSource(items);
            WinJS.UI.processAll();
        }
    }
    WinJS.Application.start();
})();</pre>
<style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style><style type="text/css">



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2011/12/27/building-a-windows-8-metro-style-javascript-html5-css3-app-using-listview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Great ExtJS Meetup in Palo Alto Tonight at ExtJS&#8217;s New Office</title>
		<link>http://peterkellner.net/2010/02/24/extjs-meetup-paloalto-office/</link>
		<comments>http://peterkellner.net/2010/02/24/extjs-meetup-paloalto-office/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 06:46:54 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2010/02/24/extjs-meetup-paloalto-office/</guid>
		<description><![CDATA[Yet another great meetup with the ExtJS San Francisco Group (though not meeting in San Francisco this time).&#160; ExtJS has moved it’s main office and developers out here to Palo Alto, California and volunteered to host our meetup.&#160; They provided pizza and beer and I’d say it was our most successful event so far!&#160; http://www.meetup.com/The-San-Francisco-ExtJS-Meetup-Group/calendar/12527913/ [...]]]></description>
			<content:encoded><![CDATA[<p>Yet another great meetup with the ExtJS San Francisco Group (though not meeting in San Francisco this time).&#160; ExtJS has moved it’s main office and developers out here to Palo Alto, California and volunteered to host our meetup.&#160; They provided pizza and beer and I’d say it was our most successful event so far!&#160;</p> <p><a title="http://www.meetup.com/The-San-Francisco-ExtJS-Meetup-Group/calendar/12527913/" href="http://www.meetup.com/The-San-Francisco-ExtJS-Meetup-Group/calendar/12527913/">http://www.meetup.com/The-San-Francisco-ExtJS-Meetup-Group/calendar/12527913/</a></p> <p>Most of the ExtJS team stayed until after 9.&#160; The team introduced themselves to start the event, then we got presentations of all kind of cool upcoming technologies from ExtJS that we promised not share because it was top secret. <img src='http://peterkellner.net/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p> <p>I’ve posted more pictures to FaceBook at the following URL:&#160; <a href="http://www.facebook.com/r.php?i=1&amp;invid=741014917&amp;key=32D3XZ5ZRTXC2GLHUB5VPVWTSRKK4T" target="_blank">Click Here</a>&#160; I believe you will have to create a facebook account if you don’t have one to view them.&#160; It would be great if everyone can Tag themselves so next time we will all know each other.</p> <p>Abe invited us all back so I’m sure we will have the chance to all see each other again.&#160; Here are a couple shots, including the rock band at the end of he meeting starring Tommy.</p> <p><a href="http://peterkellner.net/FilesForWebDownload/GreatExtJSMeetupinPaloAltoTonightatExtJS_13F51/PeterStartingMeeting.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="PeterStartingMeeting" border="0" alt="PeterStartingMeeting" src="http://peterkellner.net/FilesForWebDownload/GreatExtJSMeetupinPaloAltoTonightatExtJS_13F51/PeterStartingMeeting_thumb.jpg" width="387" height="291" /></a></p> <p>(above picture courtesy of <a href="http://mankzblog.wordpress.com/2010/02/27/pictures-from-latest-ext-js-meetup-in-palo-alto-at-ext-hq/" target="_blank">Mats</a>)</p> <span id="more-526"></span> <p><a href="http://peterkellner.net/FilesForWebDownload/GreatExtJSMeetupinPaloAltoTonightatExtJS_13F51/DSC_0100.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="DSC_0100" border="0" alt="DSC_0100" src="http://peterkellner.net/FilesForWebDownload/GreatExtJSMeetupinPaloAltoTonightatExtJS_13F51/DSC_0100_thumb.jpg" width="389" height="259" /></a></p> <p><a href="http://peterkellner.net/FilesForWebDownload/GreatExtJSMeetupinPaloAltoTonightatExtJS_13F51/DSC_0098.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="DSC_0098" border="0" alt="DSC_0098" src="http://peterkellner.net/FilesForWebDownload/GreatExtJSMeetupinPaloAltoTonightatExtJS_13F51/DSC_0098_thumb.jpg" width="403" height="268" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2010/02/24/extjs-meetup-paloalto-office/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Combining JavaScript and CSS to Make Pages Load Faster</title>
		<link>http://peterkellner.net/2009/11/10/javascript-minify-csharp-css/</link>
		<comments>http://peterkellner.net/2009/11/10/javascript-minify-csharp-css/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 20:26:03 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/11/10/javascript-minify-csharp-css/</guid>
		<description><![CDATA[ We are in the process of “speeding up” our ExtJS application.&#160; I’m just finally figuring out the rules of the road for doing this.&#160; Here are a couple of rules I believe to be true     Combine and Minify All JavaScript     Combine All CSS that are in [...]]]></description>
			<content:encoded><![CDATA[<p> We are in the process of “speeding up” our <a href="http://extjs.com">ExtJS</a> application.&#160; I’m just finally figuring out the rules of the road for doing this.&#160; Here are a couple of rules I believe to be true</p>  <ul>   <li>Combine and Minify All JavaScript </li>    <li>Combine All CSS that are in the same directory (because of relative paths) </li>    <li>Put the CSS above the <a href="http://www.javascript.com/">JavaScript</a> includes </li> </ul>  <p>We are using a library <a title="http://atashbahar.com/post/Combine-minify-compress-JavaScript-files-to-load-ASPNET-pages-faster.aspx" href="http://atashbahar.com/post/Combine-minify-compress-JavaScript-files-to-load-ASPNET-pages-faster.aspx">http://atashbahar.com/post/Combine-minify-compress-JavaScript-files-to-load-ASPNET-pages-faster.aspx</a> and it’s working well for us.&#160; This project does a nice job of calling a minifier, gzipping and caching.</p>  <p>Hoe this helps!</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/11/10/javascript-minify-csharp-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To View JSON in a Pretty Way</title>
		<link>http://peterkellner.net/2009/11/06/formatting-json-best-tool/</link>
		<comments>http://peterkellner.net/2009/11/06/formatting-json-best-tool/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 16:49:04 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[JSON]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/11/06/formatting-json-best-tool/</guid>
		<description><![CDATA[Cutting to the chase, I choose Vladimir Bodurov’s Color Formatter!  For the past year or so, I’ve been working on a project that uses Microsoft’s ASP.NET MVC for providing data to our pure JavaScript application.&#160; That is, there are no web forms, no dynamic HTML generation, just 100% JavaScript running on the client.&#160; I’m [...]]]></description>
			<content:encoded><![CDATA[<p>Cutting to the chase, I choose <a href="http://blog.bodurov.com/Formatter-and-colorer-of-raw-JSON-code">Vladimir Bodurov’s Color Formatter!</a></p>  <p>For the past year or so, I’ve been working on a project that uses Microsoft’s <a href="http://www.asp.net/mvc/">ASP.NET MVC</a> for providing data to our pure JavaScript application.&#160; That is, there are no web forms, no dynamic HTML generation, just 100% JavaScript running on the client.&#160; I’m using a library called <a href="http://extjs.com">ExtJS</a> which gives us high quality “forms like” user interactions and MVC for getting the data.&#160; That is, the Application looks like this:</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/HowToViewJSONinaPrettyWay_741F/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/HowToViewJSONinaPrettyWay_741F/image_thumb.png" width="231" height="283" /></a></p>  <p>The data retrieval URL used by the JavaScript look like:</p> <span id="more-378"></span>  <p><a href="http://www.mycompany.com/data/Company/Get">http://www.mycompany.com/data/Company/Get</a></p>  <p>And, the JSON that comes back using either FireBug or Fiddler looks like this:</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/HowToViewJSONinaPrettyWay_741F/image_3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/HowToViewJSONinaPrettyWay_741F/image_thumb_3.png" width="244" height="170" /></a></p>  <p>Problem is that it’s hard to read the JSON data.&#160; <a href="http://getfirebug.com/">Firebug</a> does a reasonable job of formatting, but it’s still not perfect.&#160; Up until now, the way I always have formatted the data is to type into <a href="http://www.bing.com/search?q=format+json&amp;form=QBLH&amp;qs=n">bing</a> or <a href="http://www.google.com/search?hl=en&amp;source=hp&amp;q=json+format&amp;rlz=1R2GGLL_enUS341&amp;aq=f&amp;oq=&amp;aqi=g-p2g4g-s1g3">Google</a> “format json” and the first reasonable choice has been <a title="http://jsonformat.com/" href="http://jsonformat.com/">http://jsonformat.com/</a>.&#160; Cutting and pasting my data into it shows:</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/HowToViewJSONinaPrettyWay_741F/image_4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/HowToViewJSONinaPrettyWay_741F/image_thumb_4.png" width="244" height="241" /></a></p>  <p>However, my new favorite JSON Formatter&#160; makes the data look like this:</p>  <p>( <a title="http://www.bodurov.com/JsonFormatter/" href="http://www.bodurov.com/JsonFormatter/">http://www.bodurov.com/JsonFormatter/</a> )</p>  <p>(more information at: <a title="http://blog.bodurov.com/Formatter-and-colorer-of-raw-JSON-code" href="http://blog.bodurov.com/Formatter-and-colorer-of-raw-JSON-code">http://blog.bodurov.com/Formatter-and-colorer-of-raw-JSON-code</a>)</p>  <p>And, it’s available as simple html you can run on your own server here at codeplex:</p>  <p><a title="http://www.codeplex.com/QuickJsonFormatter/Release/ProjectReleases.aspx?ReleaseId=10136" href="http://www.codeplex.com/QuickJsonFormatter/Release/ProjectReleases.aspx?ReleaseId=10136">http://www.codeplex.com/QuickJsonFormatter/Release/ProjectReleases.aspx?ReleaseId=10136</a></p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/HowToViewJSONinaPrettyWay_741F/image_5.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/HowToViewJSONinaPrettyWay_741F/image_thumb_5.png" width="305" height="393" /></a></p>  <p>IMHO, much cleaner, shows me the data both before and after, as well as colorizes it which always makes me happy.</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/11/06/formatting-json-best-tool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Book Review of Object Oriented JavaScript by Stoyan Stefanov</title>
		<link>http://peterkellner.net/2009/08/30/book-review-of-object-oriented-javascript-by-stoyan-stefanov/</link>
		<comments>http://peterkellner.net/2009/08/30/book-review-of-object-oriented-javascript-by-stoyan-stefanov/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 14:55:36 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[Book Reviews]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/08/30/book-review-of-object-oriented-javascript-by-stoyan-stefanov/</guid>
		<description><![CDATA[ For the past year or so, I’ve been spending part time learning JavaScript.&#160; My reason has been we use ExtJS extensively in my company and it’s written in JavaScript.&#160; ExtJS is very object oriented so any book that tries to present JavaScript in an OO fashion is a big help.   &#160;  [...]]]></description>
			<content:encoded><![CDATA[<p> For the past year or so, I’ve been spending part time learning JavaScript.&#160; My reason has been we use ExtJS extensively in my company and it’s written in JavaScript.&#160; ExtJS is very object oriented so any book that tries to present JavaScript in an OO fashion is a big help.</p> <span id="more-347"></span>  <p>&#160;<iframe style="width: 150px; height: 240px" marginheight="0" src="http://rcm.amazon.com/e/cm?t=petkelsblo-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=1847194141&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" frameborder="0" marginwidth="0" scrolling="no"></iframe><a type="amzn" asin="1847194141"></a></p>  <p>This book lives up to it’s billing.&#160; It starts out going through JavaScript in general, but then moves on to the OO constructs it advertises.&#160; For example, Chapter 4 titled simply “Objects” goes through all the basics.</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/BookReviewofObjectOrientedJavaScriptbySt_6C4A/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/BookReviewofObjectOrientedJavaScriptbySt_6C4A/image_thumb.png" width="447" height="283" /></a></p>  <p>I strongly recommend this book to anyone learning JavaScript for use in an OO environment.</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/08/30/book-review-of-object-oriented-javascript-by-stoyan-stefanov/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Set JavaScript Programmatically on a Page in ASP.NET with Parameters</title>
		<link>http://peterkellner.net/2009/05/03/including-javascript-aspnet-pageload-clientscriptmanager/</link>
		<comments>http://peterkellner.net/2009/05/03/including-javascript-aspnet-pageload-clientscriptmanager/#comments</comments>
		<pubDate>Sun, 03 May 2009 23:42:50 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 3.5]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/05/03/including-javascript-aspnet-pageload-clientscriptmanager/</guid>
		<description><![CDATA[Programmatically setting JavaScript into an ASP.NET page is very straight forward when you do it in code.&#160; That is, in my case, I simply put it in the Page_Load event of the page and have it load from there.&#160; I’m currently working on an ExtJS project that requires me to show some details on a [...]]]></description>
			<content:encoded><![CDATA[<p>Programmatically setting <a href="http://JavaScript.org">JavaScript</a> into an <a href="http://asp.net">ASP.NET</a> page is very straight forward when you do it in code.&#160; That is, in my case, I simply put it in the Page_Load event of the page and have it load from there.&#160; I’m currently working on an <a href="http://extjs.com">ExtJS</a> project that requires me to show some details on a page that I want to show with <a href="http://www.webopedia.com/TERM/J/JavaScript.html">JavaScript</a>.&#160; I’ve nicely modularized all the JavaScript into a name space so the code that I want to include on my ASP.NET Page looks like the following:</p>  <div class="csharpcode">   <pre class="alt">&lt;script type=<span class="str">&quot;text/javascript&quot;</span> language=<span class="str">&quot;javascript&quot;</span> &gt;</pre>

  <pre>    ASPWeb.newsGrid.loadTypeId = 229490;</pre>

  <pre class="alt">    ASPWeb.newsGrid.init();</pre>

  <pre>&lt;/script&gt;</pre>
</div>

<br /><span id="more-300"></span>

<p>To put the same code in, but substitute the loadTypeId with something meanful, here is the C# code you need to put in your Page_Load C# code.</p>

<div class="csharpcode">
  <pre class="alt">  <span class="kwrd">protected</span> <span class="kwrd">void</span> Page_Load(<span class="kwrd">object</span> sender, EventArgs e)</pre>

  <pre>        {</pre>

  <pre class="alt">            <span class="kwrd">if</span> (!IsPostBack)</pre>

  <pre>            {</pre>

  <pre class="alt">                LabelEntityType.Text = EntityTypeId.ToString();</pre>

  <pre>                LabelEntityId.Text = EntityId.ToString();</pre>

  <pre class="alt">            }</pre>

  <pre>            <span class="rem">// The JavaScript needs to be registed on every post back.  Not just first time.</span></pre>

  <pre class="alt">            <span class="rem">// Define the name and type of the client scripts on the page.</span></pre>

  <pre>            <span class="kwrd">const</span> <span class="kwrd">string</span> csname1 = <span class="str">&quot;LoadDetailsGridScript&quot;</span>;</pre>

  <pre class="alt">            Type cstype = <span class="kwrd">this</span>.GetType();</pre>

  <pre>            <span class="rem">// Get a ClientScriptManager reference from the Page class.</span></pre>

  <pre class="alt">            ClientScriptManager cs = Page.ClientScript;</pre>

  <pre>            <span class="rem">// Check to see if the startup script is already registered.</span></pre>

  <pre class="alt">            <span class="kwrd">if</span> (!cs.IsStartupScriptRegistered(cstype, csname1))</pre>

  <pre>            {</pre>

  <pre class="alt">                <span class="rem">//ASPWeb.newsGrid.loadTypeId = 229490;</span></pre>

  <pre>                <span class="rem">//ASPWeb.newsGrid.init();</span></pre>

  <pre class="alt">                <span class="kwrd">const</span> <span class="kwrd">string</span> cstext1 = </pre>

  <pre>                    <span class="str">&quot;ASPWeb.newsGrid.EntityId = {0};ASPWeb.newsGrid.EntityTypeId = 1; ASPWeb.newsGrid.init();&quot;</span>;</pre>

  <pre class="alt">                cs.RegisterStartupScript(cstype, csname1, String.Format(cstext1, LabelEntityId.Text), <span class="kwrd">true</span>);</pre>

  <pre>            }</pre>

  <pre class="alt">        }</pre>
</div>

<p>I found this code on line at this MSDN location.</p>

<p><a title="http://msdn.microsoft.com/en-us/library/z9h4dk8y.aspx" href="http://msdn.microsoft.com/en-us/library/z9h4dk8y.aspx">http://msdn.microsoft.com/en-us/library/z9h4dk8y.aspx</a></p>

<p>Hope this Helps!!!</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/05/03/including-javascript-aspnet-pageload-clientscriptmanager/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Great JavaScript Meetup In San Francsico Last Night!</title>
		<link>http://peterkellner.net/2009/04/30/javascript-meetup-san-francisco-douglascrockford/</link>
		<comments>http://peterkellner.net/2009/04/30/javascript-meetup-san-francisco-douglascrockford/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 17:48:52 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/04/30/javascript-meetup-san-francisco-douglascrockford/</guid>
		<description><![CDATA[&#160;  My guess is 75 people showed up at Dolores Labs last night for this meetup.&#160; It lasted about two hours and had about 6 great presentations.&#160; Douglas Crockford kicked it off with a discussion on upcoming security models around new versions of JavaScript followed by several other presentations that included a Google engineer [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>  <p>My guess is 75 people showed up at <a href="http://doloreslabs.com">Dolores Labs</a> last night for this <a href="http://www.meetup.com/jsmeetup/calendar/10185190/">meetup</a>.&#160; It lasted about two hours and had about 6 great presentations.&#160; <a href="http://www.crockford.com/javascript/">Douglas Crockford</a> kicked it off with a discussion on upcoming security models around new versions of JavaScript followed by several other presentations that included a Google engineer showing cool Google Labs projects, several JavaScript frameworks and other very cool things.&#160; Dolores Labs is down a small alley where I was sure I was lost.&#160; Marked 83A was a non descript door with two flights of stairs. Then, a roomful of engineers, lots of ethernet connections, beer and pizza.&#160; What else could we ask for.</p>  <p>Below are some fun pictures I took. Not sure if it does justice to the fun that was had.</p>  <p>Many thanks to <a href="http://zellunit.com/">Matt Humphrey</a> for organizing the event.&#160; Job well done!!!</p>  <p>&#160;</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/GreatJavaScriptMeetupInSanFrancsicoLastN_75E0/IMG_1353.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_1353" border="0" alt="IMG_1353" src="http://peterkellner.net/FilesForWebDownload/GreatJavaScriptMeetupInSanFrancsicoLastN_75E0/IMG_1353_thumb.jpg" width="244" height="184" /></a> <a href="http://peterkellner.net/FilesForWebDownload/GreatJavaScriptMeetupInSanFrancsicoLastN_75E0/IMG_1354.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_1354" border="0" alt="IMG_1354" src="http://peterkellner.net/FilesForWebDownload/GreatJavaScriptMeetupInSanFrancsicoLastN_75E0/IMG_1354_thumb.jpg" width="244" height="184" /></a></p>  <p>&#160;<a href="http://peterkellner.net/FilesForWebDownload/GreatJavaScriptMeetupInSanFrancsicoLastN_75E0/IMG_1356.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_1356" border="0" alt="IMG_1356" src="http://peterkellner.net/FilesForWebDownload/GreatJavaScriptMeetupInSanFrancsicoLastN_75E0/IMG_1356_thumb.jpg" width="244" height="184" /></a> <a href="http://peterkellner.net/FilesForWebDownload/GreatJavaScriptMeetupInSanFrancsicoLastN_75E0/IMG_1357.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_1357" border="0" alt="IMG_1357" src="http://peterkellner.net/FilesForWebDownload/GreatJavaScriptMeetupInSanFrancsicoLastN_75E0/IMG_1357_thumb.jpg" width="244" height="184" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/04/30/javascript-meetup-san-francisco-douglascrockford/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speaking Wednesday May 20th, 6:30PM, Microsoft Office San Francisco on ExtJS and ASP.NET Membership!</title>
		<link>http://peterkellner.net/2009/04/20/speaking-aspnet-extjs-microsoft-sanfrancisco-high-perf-javascript/</link>
		<comments>http://peterkellner.net/2009/04/20/speaking-aspnet-extjs-microsoft-sanfrancisco-high-perf-javascript/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 04:59:38 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 3.5]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Membership]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/04/20/speaking-aspnet-extjs-microsoft-sanfrancisco-high-perf-javascript/</guid>
		<description><![CDATA[&#160;  Come hear about how to see ExtJS integrated with ASP.NET for awesome Membership and Profile Management!&#160; I will speaking at the Microsoft Office at a meeting of Bay.Net Users Group.  http://www.baynetug.org/DesktopModules/DetailXEvents.aspx?ItemID=378&#38;mid=49  ASP.NET: Membership with Profile and High Performance ExtJS JavaScript Interface  When:&#160;   Wednesday, 5/20/2009 at 6:30 PM  [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>  <p>Come hear about how to see <a href="http://extjs.com/">ExtJS</a> integrated with <a href="http://asp.net">ASP.NET</a> for awesome Membership and Profile Management!&#160; I will speaking at the <a href="http://www.microsoft.com/en/us/default.aspx">Microsoft</a> Office at a meeting of <a href="http://www.baynetug.org/DesktopDefault.aspx">Bay.Net Users Group</a>.</p>  <p><a title="http://www.baynetug.org/DesktopModules/DetailXEvents.aspx?ItemID=378&amp;mid=49" href="http://www.baynetug.org/DesktopModules/DetailXEvents.aspx?ItemID=378&amp;mid=49">http://www.baynetug.org/DesktopModules/DetailXEvents.aspx?ItemID=378&amp;mid=49</a></p>  <p>ASP.NET: Membership with Profile and High Performance <a href="http://extjs.com/">ExtJS</a> JavaScript Interface</p>  <h3>When:&#160; </h3>  <p>Wednesday, 5/20/2009 at 6:30 PM</p>  <h3>Where:&#160; </h3>  <p><strong>Microsoft Office, 835 Market Street, Suite 700, San Francisco</strong></p>  <h3>Event Description</h3>  <p><em>In this session, we will demonstrate building a super rich JavaScript interface to the standard ASP.NET Membership and Profile services. That is, built into ASP.NET are wonderful providers that allow you to validate and store user credentials typically to a database. It also lets you store other information such as pictures, first and last names, as well as anything else you may want to store. In this session we will build a highly performing, 100% JavaScript UI to maintain hundreds of thousands of users. As part of this solution, techniques for using REST based services to access this information will be presented. Once you see this, it will be hard to ever use web forms again.</em></p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/04/20/speaking-aspnet-extjs-microsoft-sanfrancisco-high-perf-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Come See Me at VSLive in Las Vegas, June 9th (2 Sessions)</title>
		<link>http://peterkellner.net/2009/04/17/vslive-lasvegas-extjs-aspnet-high-performance/</link>
		<comments>http://peterkellner.net/2009/04/17/vslive-lasvegas-extjs-aspnet-high-performance/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 00:27:20 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 2.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Speaking]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/04/17/vslive-lasvegas-extjs-aspnet-high-performance/</guid>
		<description><![CDATA[ I’m doing two sessions at VS-Live in June.&#160; Both sessions are in the asp.net track. One is on High Speed performance in ASP.Net, and the other is on using ExtJS (a brilliantly fast rich JavaScript library).&#160; Hope to see you there!  Here are the descriptions:  VM1  Build Blazingly Fast ASP.NET Apps [...]]]></description>
			<content:encoded><![CDATA[<p> I’m doing two sessions at <a href="http://vslive.com/2009/lasvegas/">VS-Live</a> in June.&#160; Both sessions are in the asp.net track. One is on High Speed performance in ASP.Net, and the other is on using <a href="http://extjs.com/">ExtJS</a> (a brilliantly fast rich JavaScript library).&#160; Hope to see you there!</p>  <p>Here are the descriptions:</p>  <p>VM1</p>  <h3><strong>Build Blazingly Fast ASP.NET Apps with 100% Clientside UI ExtJS</strong></h3>  <p><a href="http://vslive.com/speakers.aspx#kellner">Peter Kellner </a></p>  <p><strong>Intermediate</strong></p>  <p>Need a web application that has the responsiveness and interactivity of a forms app but still looks and feels like a web? One of the best kept secrets (at least to the Microsoft community) is ExtJS. It&#8217;s a different paradigm then we are all use to, but the results are spectacular. <a href="http://extjs.com/deploy/dev/examples/samples.html">Take a look at this url</a> and you will see as well as learn how to do this yourself. The hardest part is shuttling the data back and forth. A lot of this session will be talking about how to do a real world app that does this. Once you go this way, you&#8217;ll be gone from serverside forms for almost ever.</p> <span id="more-292"></span>  <p>VM10</p>  <h3>Building High Performance ASP.NET Web Applications </h3>  <p><a href="http://vslive.com/speakers.aspx#kellner">Peter Kellner </a></p>  <p><strong>Intermediate</strong></p>  <p>Topics will include appropriate use of Cache and Session State, as well as how and when to use them. Viewstate management and methods to minimize its use will be discussed. Code to pop up a warning when a threshold is met in development will be shown. When and how to take advantage of Server Farms will be discussed, as well as trouble shooting techniques to find problems. The evils of Server Affinity, as well as a common pattern for caching database queries will be shown to be wrong. Time permitting, we will talk about using Microsoft’s Ajax.asp.net with UpdatePanel and webservices and how these affect performance and scalability.</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/04/17/vslive-lasvegas-extjs-aspnet-high-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Framework Scanner, Written in ExtJS by Mats Bryntse</title>
		<link>http://peterkellner.net/2009/01/23/javascript-framework-scanner-globals-collisions-mats/</link>
		<comments>http://peterkellner.net/2009/01/23/javascript-framework-scanner-globals-collisions-mats/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 16:55:37 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://peterkellner.net/?p=237</guid>
		<description><![CDATA[Mats Bryntse, a great web developer and ExtJS expert has written a very cool utility that let&#8217;s you see how well the different JavaScript frameworks play with each other.&#160; Specifically, he looks at many of the most popular frameworks and calculates how many globals each one uses.&#160; This is important because if you happen to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mankzblog.wordpress.com/">Mats Bryntse</a>, a great web developer and <a href="http://extjs.com">ExtJS</a> expert has written a very cool utility that let&#8217;s you see how well the different JavaScript frameworks play with each other.&#160; Specifically, he looks at many of the most popular frameworks and calculates how many globals each one uses.&#160; This is important because if you happen to have multiple frameworks in your application (which is completely reasonable to do), you may have problems.&#160; The URL is as follows and must be run in Firefox).</p>  <p><a title="http://mankz.com/code/GlobalCheck.htm" href="http://mankz.com/code/GlobalCheck.htm">http://mankz.com/code/GlobalCheck.htm</a></p>  <p>Here is an example result:</p> <span id="more-237"></span>  <p><a href="http://peterkellner.net/FilesForWebDownload/FrameworkScannerWritteninExtJSbyMatsBrin_7D73/image.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/FrameworkScannerWritteninExtJSbyMatsBrin_7D73/image_thumb.png" width="359" height="189" /></a></p>  <p>Don&#8217;t forget to push the &quot;Start Analysis&quot; button on the tool bar and you will see a collision matrix.&#160; For me, this is of particular interest because I use both <a href="http://extjs.com">ExtJS</a> as well as <a href="http://www.asp.net/ajax/">Microsoft Ajax</a> and I have a collision between string.format which has caused me problems.&#160; Here is what that collision matrix looks like:</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/FrameworkScannerWritteninExtJSbyMatsBrin_7D73/image_4.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/FrameworkScannerWritteninExtJSbyMatsBrin_7D73/image_thumb_4.png" width="348" height="248" /></a></p>  <p>This is a great tool!&#160; Nice to have such smart guys looking to make the world more transparent.</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/01/23/javascript-framework-scanner-globals-collisions-mats/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>First San Francisco Meetup of ExtJS Group</title>
		<link>http://peterkellner.net/2008/12/10/extjs-meetup-sanfrancisco/</link>
		<comments>http://peterkellner.net/2008/12/10/extjs-meetup-sanfrancisco/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 17:08:07 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2008/12/10/extjs-meetup-sanfrancisco/</guid>
		<description><![CDATA[http://www.meetup.com/The-San-Francisco-ExtJS-Meetup-Group/  As many of you know, I&#8217;m learning the JavaScript library ExtJS.&#160; It&#8217;s basically a very rich development api that allows you to make totally awesome client side control 100% in JavaScript.&#160; It has control that include Grid, Dropdown, Calendar, Image, Drag and Drop, Toolbars, etc.&#160; With ExtJS, you can in a very straight [...]]]></description>
			<content:encoded><![CDATA[<p><a title="http://www.meetup.com/The-San-Francisco-ExtJS-Meetup-Group/" href="http://www.meetup.com/The-San-Francisco-ExtJS-Meetup-Group/">http://www.meetup.com/The-San-Francisco-ExtJS-Meetup-Group/</a></p>  <p>As many of you know, I&#8217;m learning the <a href="https://wiki.mozilla.org/JavaScript:Home_Page">JavaScript</a> library <a href="http://extjs.com/">ExtJS</a>.&#160; It&#8217;s basically a very rich development api that allows you to make totally awesome client side control 100% in JavaScript.&#160; It has control that include Grid, Dropdown, Calendar, Image, Drag and Drop, Toolbars, etc.&#160; With ExtJS, you can in a very straight forward way, make interfaces that look like the following:</p>  <p><a href="http://extjs.com/deploy/dev/examples/view/chooser.html"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://peterkellner.net/blogimages/FirstSanFranciscoMeetupofExtJSGroup_8067/image.png" width="441" height="236" /></a></p> <span id="more-219"></span>  <p>You can see lots of examples of using ExtJS (usually called E-X-T) here:&#160; <a title="http://extjs.com/deploy/dev/examples/samples.html" href="http://extjs.com/deploy/dev/examples/samples.html">http://extjs.com/deploy/dev/examples/samples.html</a></p>  <p>At our first meetup, we talked about EXT some and also raffled off a copy of the new <a href="http://www.amazon.com/exec/obidos/ASIN/1847195148/petkelsblo-20">ExtJS book</a> called <a href="http://peterkellner.net/2008/11/28/extjs-bookreview/">Learning Ext JS</a> generously given to us by one of the authors, Shea Frederick.&#160; We also talked about things we could do together as a group. For our first group project, we decided to work on the <a href="http://www.siliconvalley-codecamp.com/Sessions.aspx">sessions page of Silicon Valley Code Camp</a> (the site I wrote) and make that page EXTd.&#160; We broke down parts of that into little pieces and each of us went home with a small assignment to work on.&#160; We plan on meeting again January 20th, 2009 and continue the fun.</p>  <p>Oh, here is a picture of us in our first meetup at the Courtyard Marriott at 2nd and Folsom (San Francisco)</p>  <p><a href="http://peterkellner.net/blogimages/FirstSanFranciscoMeetupofExtJSGroup_8067/clip_image002.jpg"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="clip_image002" src="http://peterkellner.net/blogimages/FirstSanFranciscoMeetupofExtJSGroup_8067/clip_image002_thumb.jpg" width="386" height="211" /></a></p>  <p>And, in case you forgot, here is the link.&#160; Our next meetup is January 20th,2009. Come Join us!</p>  <p><a title="http://www.meetup.com/The-San-Francisco-ExtJS-Meetup-Group/" href="http://www.meetup.com/The-San-Francisco-ExtJS-Meetup-Group/">http://www.meetup.com/The-San-Francisco-ExtJS-Meetup-Group/</a></p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2008/12/10/extjs-meetup-sanfrancisco/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Basic DomHelper with ExtJS Library, creating simple div tags and anchors</title>
		<link>http://peterkellner.net/2008/11/24/domhelper-extjs-tutorial/</link>
		<comments>http://peterkellner.net/2008/11/24/domhelper-extjs-tutorial/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 15:48:25 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2008/11/24/domhelper-extjs-tutorial/</guid>
		<description><![CDATA[As I&#8217;m learning ExtJS I plan on publishing the things I figure out.&#160; For those that don&#8217;t know, ExtJS is a very rich JavaScript library that gives you all kinds of capabilities that work cross browsers.&#160; Trees, Grid&#8217;s, Panels, Layouts and all kind of stuff.&#160; For an idea of the kinds of things you can [...]]]></description>
			<content:encoded><![CDATA[<p>As I&#8217;m learning ExtJS I plan on publishing the things I figure out.&#160; For those that don&#8217;t know, <a href="http://www.extjs.com">ExtJS</a> is a very rich JavaScript library that gives you all kinds of capabilities that work cross browsers.&#160; Trees, Grid&#8217;s, Panels, Layouts and all kind of stuff.&#160; For an idea of the kinds of things you can do, check out the demos at there site at this URL:&#160; <a title="http://extjs.com/deploy/dev/examples/samples.html" href="http://extjs.com/deploy/dev/examples/samples.html">http://extjs.com/deploy/dev/examples/samples.html</a>. </p>  <p>It&#8217;s pretty amazing the kinds of things that can be done with just client side JavaScript.&#160; At the core of ExtJS are some very useful JavaScript methods.&#160; In order to take advantage of the more sophisticated features, it&#8217;s helpful to know the basics first.&#160; In this article, I plan on going through a simple example that will ultimately product html that looks like the following.</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/BasicDomHelperwithExtJSLibrarycreatingsi_819B/image.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/BasicDomHelperwithExtJSLibrarycreatingsi_819B/image_thumb.png" width="544" height="364" /></a></p> <span id="more-184"></span>  <p>Notice that I&#8217;m showing this as a screen capture from firebug.&#160; If I were to do a view/source, this is what it would show.</p>  <p><a href="http://peterkellner.net/FilesForWebDownload/BasicDomHelperwithExtJSLibrarycreatingsi_819B/image_3.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/BasicDomHelperwithExtJSLibrarycreatingsi_819B/image_thumb_3.png" width="540" height="405" /></a></p>  <p>Welcome to JavaScript!&#160; The colors div is generated on the fly.&#160; I&#8217;m not 100% sure, but I think this has bad implications for SEO (Search Engine Optimization). More for another post later.&#160; I need to do some experiments.</p>  <p>So, let&#8217;s dive into the code that is needed to generate this.&#160; My plan here is to show the code, then explain it line by line.&#160; ExtJS is very powerful and DomHelper is one of the cornerstone classes.</p>  <pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  1: Ext.onReady(<span style="color: #0000ff">function</span>() {
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  2: 
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  3:   Ext.BLANK_IMAGE_URL = 'Images/s.gif';
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  4: 
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  5:   Ext.QuickTips.init();
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  6: 
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  7:   <span style="color: #0000ff">var</span> colorArray = <span style="color: #0000ff">new</span> <span style="color: #0000ff">Array</span>('red', 'green', 'blue', 'orange');
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  8: 
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">  9:   <span style="color: #0000ff">var</span> colorObject = [{
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 10:         id : 'pink',
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 11:         html : 'pink-HTML',
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 12:         tag : 'a',
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 13:         href : 'http:<span style="color: #008000">//www.mycolor.com/pink'</span>
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 14:       }];
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 15: 
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 16:   <span style="color: #0000ff">var</span> myColor = <span style="color: #0000ff">new</span> Object;
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 17:   myColor.id = 'purple';
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 18:   myColor.html = 'purple-HTML';
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 19:   myColor.tag = 'a';
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 20:   myColor.href = 'http:<span style="color: #008000">//www.mycolor.com/purple'</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 21:   colorObject.push(myColor);
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 22: 
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 23:   <span style="color: #0000ff">for</span> (i = 0; i &lt; colorArray.<span style="color: #0000ff">length</span>; i++) {
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 24:     <span style="color: #0000ff">var</span> colorToAdd = <span style="color: #0000ff">new</span> Object;
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 25:     colorToAdd.id = colorArray[i];
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 26:     colorToAdd.html = colorArray[i] + '-HTML';
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 27:     colorToAdd.tag = 'a';
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 28:     colorToAdd.href = 'http:<span style="color: #008000">//www.mycolor.com/' + colorArray[i];</span>
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 29:     colorObject.push(colorToAdd);
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 30:   }
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 31: 
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 32:   <span style="color: #0000ff">var</span> colorsDivId = Ext.DomHelper.append(<span style="color: #0000ff">document</span>.body, [{
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 33:             id : 'colors'
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 34:           }]);
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 35: 
</pre><pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 36:   Ext.DomHelper.append(colorsDivId, colorObject);
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"> 37: });</pre></pre>

<p>So, here is what is going on above.</p>

<p>Line 1 is the basic code that you use that tells the JavaScript to start executing after the browser DOM is completely constructed.&#160; if you don&#8217;t do this, you will get errors when you try and access things like Document.body.</p>

<p>Line 3 does something important, but I don&#8217;t quite understand what. If you don&#8217;t do this, you&#8217;ll find your ExtJS boxes and other graphics look funny.&#160; Hopefully, someone will put a comment on this blog post and then I&#8217;ll update this comment.</p>

<p>Line 7 is where the fun begins.&#160; My plan is to add a bunch of color hyperlinks to the page using different methods.&#160; Here, I&#8217;m simply initializing a JavaScript array of colors.</p>

<p>Line 9-15 initalizes a JavaScript array with one object that has multiple properties.&#160; These will be all associated with one anchor tag.</p>

<p>Line 16-21 creates a simple JavaScript object and assigns the properties of the html anchor tag.</p>

<p>Lines 24-30 iterates through the colors array and builds and array of objects and adds them to the colorObject array.</p>

<p>Line 32 adds a div tag to the body of the page dynamically (id=&#8217;colors&#8217;)</p>

<p>line 36 adds the colection of hyperlinks to the just created tag (id=&#8217;colors&#8217;)</p>

<p>And, that&#8217;s it.&#160; This created the html shown at the top.</p>

<p>Here&#8217;s the code: </p>

<p><a href="/FilesForWebDownload/BasicDomHelperwithExtJSLibrarycreatingsi_819B/ExtTutorial1.zip">ExtTutorial1.zip</a></p>

<p>Good luck!&#160; I&#8217;ll try and keep publishing as I learn.&#160; ExtJS is awesome!&#160; The doc&#8217;s are just a little lacking IMHO.</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2008/11/24/domhelper-extjs-tutorial/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ExtJS Training with our leaders!</title>
		<link>http://peterkellner.net/2008/11/04/extjs-training-coolite-javascript/</link>
		<comments>http://peterkellner.net/2008/11/04/extjs-training-coolite-javascript/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 23:53:38 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2008/11/04/extjs-training-coolite-javascript/</guid>
		<description><![CDATA[For my current project, I&#8217;m focused on delivering the fastest and best user experience possible for our web site.&#160; To deliver this, it is necessary to really focus on delivering client side code.&#160; After doing a bunch of research, the very clear answer to me is to use a Library called ExtJS combined with a [...]]]></description>
			<content:encoded><![CDATA[<p>For my current project, I&#8217;m focused on delivering the fastest and best user experience possible for our web site.&#160; To deliver this, it is necessary to really focus on delivering client side code.&#160; After doing a bunch of research, the very clear answer to me is to use a Library called <a href="http://extjs.com/">ExtJS</a> combined with a very nice integration tool suite for the .net called <a href="http://coolite.com/">Coolite</a>. It&#8217;s basically a very rich interactive JavaScript library that is extremely customizable.&#160; To that end, I&#8217;m taking a week training class from <a href="http://extjs.com/">ExtJS</a>.&#160; We&#8217;ve had our first day which has focused on CSS and <a href="http://www.javascript.com/">JavaScript</a> basics with an eye towards the patterns used in <a href="http://extjs.com/">ExtJS</a>.</p> <span id="more-182"></span>  <p>For those who know what ExtJS is, I have solved the first mystery and it&#8217;s only days one.&#160; It seems that that call it EXT (pronounced E-X-T).&#160; Also, if your curious of what ExtJS can do, take a look at the <a href="http://coolite.com/">Coolite Demos</a> here.</p>  <p>Here is a picture of me with some <a href="http://extjs.com/company/">ExtJS folks</a> (Me, Jack Slocom, Abraham Elias and our instructor Aaron Conran).&#160; Abraham (their CEO) and I are both learning ExtJS while Jack and Aaron pretty much invented it.&#160; Hopefully that will change by the end of the week (I mean the part about Abraham and I).</p>  <p><img alt="ExtJS Training" src="http://peterkellner.net/misc/ExtJSTraining2t.jpg" /></p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2008/11/04/extjs-training-coolite-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My Two JavaScript Favorite Books:, &quot;JavaScript: The Good Parts&quot; and &quot;JavaScript: The Definitive Guide&quot;</title>
		<link>http://peterkellner.net/2008/10/11/javascript-book-review-douglas-crockford-david-flanagan/</link>
		<comments>http://peterkellner.net/2008/10/11/javascript-book-review-douglas-crockford-david-flanagan/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 14:20:03 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[Book Reviews]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2008/10/11/javascript-book-review-douglas-crockford-david-flanagan/</guid>
		<description><![CDATA[I&#8217;ve been working on a project lately that requires a lot of JavaScript, and if any of you are like me, you&#8217;ve had trouble learning the language well.&#160; Over the years, I&#8217;ve taken several runs at it but have not been successful.&#160; Sure, I could always to basic stuff, but it seemed that when ever [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a project lately that requires a lot of <a href="http://www.w3schools.com/js/default.asp">JavaScript</a>, and if any of you are like me, you&#8217;ve had trouble learning the language well.&#160; Over the years, I&#8217;ve taken several runs at it but have not been successful.&#160; Sure, I could always to basic stuff, but it seemed that when ever I need to do anything useful, I just could not figure it out.&#160; Well, times have changed.&#160; Mostly based on my need to know the language, I am really starting to feel good about the language. I&#8217;m understanding scoping, I can throw functions and arrays around as well as actually do useful stuff.</p> <span id="more-174"></span>  <p>My path to success has been two books.&#160; First, <a href="http://www.crockford.com/">Douglas Crockford&#8217;s</a> JavaScript: The Good Parts is really all about the why.&#160; That is, what is good and what is not.&#160; It not only tells you how to do things (though in very compact language), it tells you why.&#160; One very nice thing it does it explains the rational for things and&#160; where compromises have been made.&#160; It&#8217;s short and dense.&#160; That is, kind of K&amp;G for c, it does not mince words.&#160; I&#8217;m on my 3rd pass now and still learning things.</p>  <p>When I need more words, I go to the other book.&#160; JavaScript: The Definitive Guide by <a href="http://www.davidflanagan.com/">David Flanagan</a>.&#160; It doe a great job of explaining in details all the little parts of JavaScript in a non-dense way.&#160; It&#8217;s about 4 times longer than The Good Parts and does get a little wordy at times, but for me, I often need the extra words.</p>  <p>I could not live without both of these books.</p>  <p>&#160;</p>  <table border="0" cellspacing="0" cellpadding="5" width="400"><tbody>     <tr>       <td valign="top" width="200">         <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:4c630182-ec9a-4467-a97d-56defc0e9546" class="wlWriterSmartContent">           <table border="0" cellspacing="0" cellpadding="2" width="400"><tbody>               <tr>                 <td valign="top" width="400">                   <p><a title="Amazon.com: JavaScript" href="http://www.amazon.com/exec/obidos/ASIN/0596517742/petkelsblo-20"><img border="0" align="left" src="http://images.amazon.com/images/P/0596517742.01.MZZZZZZZ.jpg" />Amazon.com: JavaScript</a></p>                 </td>               </tr>             </tbody></table>         </div>       </td>        <td valign="top" width="200">         <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:5e8fe7b9-ac28-4267-a9c5-a7ea245a302c" class="wlWriterSmartContent">           <table border="0" cellspacing="0" cellpadding="2" width="400"><tbody>               <tr>                 <td valign="top" width="400">                   <p><a title="Amazon.com: JavaScript" href="http://www.amazon.com/exec/obidos/ASIN/0596101996/petkelsblo-20"><img border="0" align="left" src="http://images.amazon.com/images/P/0596101996.01.MZZZZZZZ.jpg" />Amazon.com: JavaScript</a></p>                 </td>               </tr>             </tbody></table>         </div>       </td>     </tr>   </tbody></table>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2008/10/11/javascript-book-review-douglas-crockford-david-flanagan/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Smallest xmlHttp I Could Do And Still Get It Wrong</title>
		<link>http://peterkellner.net/2008/09/29/xmlhttp-ajax-microsoft-pageload-virtualearth/</link>
		<comments>http://peterkellner.net/2008/09/29/xmlhttp-ajax-microsoft-pageload-virtualearth/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 14:11:05 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[Atlas/AJAX]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2008/09/29/xmlhttp-ajax-microsoft-pageload-virtualearth/</guid>
		<description><![CDATA[I&#8217;ve just started my journey into the land of JavaScript for real and am learning things most of you already know.&#160; For example, as the Silicon Valley Code Camp coordinator and web site author, I just recently decided to add a Virtual Earth Map showing attendees and speakers (see the home page).&#160; I wrote a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just started my journey into the land of JavaScript for real and am learning things most of you already know.&#160; For example, as the <a href="http://www.siliconvalley-codecamp.com/">Silicon Valley Code Camp</a> coordinator and web site author, I just recently decided to add a <a href="http://dev.live.com/virtualearth/">Virtual Earth</a> Map showing attendees and speakers (see the home page).&#160; I wrote a simple web response handler that returns all the data in <a href="http://www.json.org/">JSON</a> so I could plot the data.&#160; Then, after a couple searches on the web, I found a way to send a request to the service asynchronously and get the result. The code looks something like this:</p> <span id="more-172"></span>  <p>&#160;</p>  <div class="csharpcode">   <pre class="alt"> <span class="kwrd">function</span> pageLoad() {</pre>

  <pre>        req = <span class="kwrd">new</span> ActiveXObject(<span class="str">&quot;Msxml2.XMLHTTP&quot;</span>);</pre>

  <pre class="alt">        <span class="kwrd">if</span> (req) {</pre>

  <pre>            req.onreadystatechange = processStateChange;</pre>

  <pre class="alt">            req.open(<span class="str">&quot;GET&quot;</span>, <span class="str">&quot;AttendeeZipCode.ashx&quot;</span>, <span class="kwrd">true</span>);</pre>

  <pre>            req.send();</pre>

  <pre class="alt">        }</pre>

  <pre>    }</pre>

  <pre class="alt">&#160;</pre>

  <pre>    <span class="kwrd">function</span> processStateChange() {</pre>

  <pre class="alt">        statusDiv = document.getElementById(<span class="str">&quot;stats&quot;</span>);</pre>

  <pre>        <span class="kwrd">if</span> (req.readyState == 0) { statusDiv.innerHTML = <span class="str">&quot;UNINITIALIZED&quot;</span>; }</pre>

  <pre class="alt">        <span class="kwrd">if</span> (req.readyState == 1) { statusDiv.innerHTML = <span class="str">&quot;LOADING&quot;</span>; }</pre>

  <pre>        <span class="kwrd">if</span> (req.readyState == 2) { statusDiv.innerHTML = <span class="str">&quot;LOADED&quot;</span>; }</pre>

  <pre class="alt">        <span class="kwrd">if</span> (req.readyState == 3) { statusDiv.innerHTML = <span class="str">&quot;INTERACTIVE&quot;</span>; }</pre>

  <pre>        <span class="kwrd">if</span> (req.readyState == 4) {</pre>

  <pre class="alt">            <span class="rem">//statusDiv.innerHTML = &quot;COMPLETE&quot;;</span></pre>

  <pre>            GetMap();</pre>

  <pre class="alt">            <span class="rem">//statusDiv.innerHTML = req.responseText;</span></pre>

  <pre>            <span class="kwrd">var</span> dataObject = json_parse(req.responseText);</pre>

  <pre class="alt">&#160;</pre>

  <pre>            CreateLayerAttendees();</pre>

  <pre class="alt">            CreateLayerSpeakers();</pre>

  <pre>            <span class="kwrd">var</span> points = <span class="kwrd">new</span> Array();</pre>

  <pre class="alt">            <span class="kwrd">for</span> (<span class="kwrd">var</span> i = 0; i &lt; dataObject.length; i++) {</pre>

  <pre>                <span class="kwrd">var</span> lattitude = dataObject[i].lattitude;</pre>

  <pre class="alt">                <span class="kwrd">var</span> longitude = dataObject[i].longitude;</pre>

  <pre>                points[i] = <span class="kwrd">new</span> VELatLong(lattitude, longitude);</pre>

  <pre class="alt">                <span class="kwrd">if</span> (dataObject[i].isSpeaker) {</pre>

  <pre>                    AddOnePin(layerSpeaker, lattitude, longitude, <span class="str">&quot;x&quot;</span>, <span class="str">&quot;x&quot;</span>, <span class="kwrd">true</span>);</pre>

  <pre class="alt">                }</pre>

  <pre>                <span class="kwrd">else</span> {</pre>

  <pre class="alt">                    AddOnePin(layerAttendee, lattitude, longitude, <span class="str">&quot;x&quot;</span>, <span class="str">&quot;x&quot;</span>, <span class="kwrd">false</span>);</pre>

  <pre>                }</pre>

  <pre class="alt">                AddOnePin(layerAttendee, lattitude, longitude, <span class="str">&quot;x&quot;</span>, <span class="str">&quot;x&quot;</span>,dataObject[i].isSpeaker);</pre>

  <pre>            }</pre>

  <pre class="alt">            map.SetMapView(points);</pre>

  <pre>        }</pre>

  <pre class="alt">    }</pre>
</div>
<style type="text/css">

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<p>Well, that worked great until I ran it on Firefox and Chrome.&#160; Basically, nothing happened.&#160; So, off to my smart friends at the local <a href="https://sv-web-jug.dev.java.net/">Java Users Group</a> and they suggested I should use a JavaScript library because my solution only works for IE.&#160; With that hint, I grabbed my favorite AJAX book by <a href="http://peterkellner.net/2007/11/26/ajaxinactionbookreview/">Alessandro Gallo, Ajax in Action</a> and started reading.&#160; Turns out, there is indeed a Microsoft Ajax Library solution to this and here it is.</p>

<div class="csharpcode">
  <pre class="alt"> <span class="kwrd">function</span> pageLoad() {</pre>

  <pre>            <span class="kwrd">var</span> request = <span class="kwrd">new</span> Sys.Net.WebRequest();</pre>

  <pre class="alt">            request.set_url(<span class="str">&quot;AttendeeZipCode.ashx&quot;</span>);</pre>

  <pre>            request.add_completed(onRequestCompleted);</pre>

  <pre class="alt">            request.invoke();</pre>

  <pre>        }</pre>

  <pre class="alt">&#160;</pre>

  <pre>        <span class="kwrd">function</span> onRequestCompleted(executor, args) {</pre>

  <pre class="alt">            processResults(executor.get_responseData());</pre>

  <pre>        }</pre>
</div>

<p>Now, Firefox, Chrome, and IE all work!&#160; and, look what a nice result we get.</p>

<p><a href="http://www.siliconvalley-codecamp.com/Default.aspx"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://www.peterkellner.net/FilesForWebDownload/TheSmallestxmlHttpICouldDoAndStillGetItW_64F0/image_thumb.png" width="232" height="244" /></a></p>

<p>Hope this helps!</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2008/09/29/xmlhttp-ajax-microsoft-pageload-virtualearth/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using MapPath with WCF Service, Setting aspNetCompatibilityEnabled to true</title>
		<link>http://peterkellner.net/2008/08/18/using-mappath-with-wcf-aspnetcompatibilityenabled/</link>
		<comments>http://peterkellner.net/2008/08/18/using-mappath-with-wcf-aspnetcompatibilityenabled/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 17:05:46 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2008/08/18/using-mappath-with-wcf-aspnetcompatibilityenabled/</guid>
		<description><![CDATA[I&#8217;m just starting out using WCF in an application for the first time.&#160; I&#8217;m using Visual Studio 2008 sp1 and created an asp.net web site from the standard create project wizard.&#160; I then created a simple AJAX&#8211;enabled WCF Service as follows:    I then added some code to the service that looks like [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m just starting out using <a href="http://msdn.microsoft.com/en-us/netframework/aa663324.aspx">WCF</a> in an application for the first time.&#160; I&#8217;m using <a href="http://msdn.microsoft.com/en-us/vstudio/default.aspx">Visual Studio 2008</a> sp1 and created an asp.net web site from the standard create project wizard.&#160; I then created a simple <a href="http://www.asp.net/ajax/default.aspx?wwwaspnetrdirset=1">AJAX</a>&#8211;enabled <a href="http://msdn.microsoft.com/en-us/library/ms733766.aspx">WCF Service</a> as follows:</p>  <p><a href="http://peterkellner.net/wp/wp-content/uploads/2008/08/image.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://peterkellner.net/wp/wp-content/uploads/2008/08/image-thumb.png" width="381" height="260" /></a></p>  <p>I then added some code to the service that looks like the following (using MapPath):</p> <span id="more-135"></span>   <pre class="csharpcode">[ServiceContract(Namespace = <span class="str">&quot;&quot;</span>)]

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

<span class="kwrd">public</span> <span class="kwrd">class</span> TrackData

{
    <span class="rem">// Add [WebGet] attribute to use HTTP GET</span>
    [OperationContract]

    <span class="kwrd">public</span> List&lt;TrackDataList&gt; RetrieveTrackDataByLap(<span class="kwrd">int</span> excerciseId, <span class="kwrd">int</span> lapNumberToShow)

    {
        var listTrackData = <span class="kwrd">new</span> List&lt;TrackDataList&gt;();

        <span class="kwrd">string</span> fileName = HttpContext.Current.Server.MapPath(<span class="str">&quot;~/App_Data/sample.tcl&quot;</span>);

        Activity activity = GarminUtils.ConvertTCS(fileName);

I call it with JavaScript <span class="kwrd">as</span> follows:

<span class="rem">/// &lt;reference path=&quot;MapLive.aspx&quot; /&gt;</span>

<span class="rem">/// &lt;reference path=&quot;../VEJS/VeJavaScriptIntellisenseHelper.js&quot; /&gt;</span>

function pageLoad() {

    TrackData.RetrieveTrackDataByLap(0, 0, OnRetrieveTrackDataByLapComplete);

}

function OnRetrieveTrackDataByLapComplete(TrackDataList) {

    alert(<span class="str">'OnRetrieveTrackDataByLapComplete called'</span>);

}</pre>

<p>And, I&#8217;m surprised to find that I get a JavaScript error saying MapPath is undefined.&#160; So, after a little digging I discover that I need to set aspNetCompatibilityEnabled to true in my web.config as follows:</p>

<p><a href="http://peterkellner.net/wp/wp-content/uploads/2008/08/xx.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="xx" src="http://peterkellner.net/wp/wp-content/uploads/2008/08/xx-thumb.png" width="421" height="189" /></a></p>

<p>By default, it is set to false.&#160; Hope this Helps!</p>]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2008/08/18/using-mappath-with-wcf-aspnetcompatibilityenabled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 4/13 queries in 0.008 seconds using disk

Served from: peterkellner.net @ 2012-02-10 04:22:22 -->
