<?xml version="1.0" encoding="iso-8859-1"?><rss version="0.91">
    <channel>
        <title>phpguru.org - Richard Heyes' ramblings and code</title>
        <link>http://www.phpguru.org/</link>
        <description>
            Quality PHP, Javascript and C# code, along with a mild smattering of humour.
        </description>

                    <item>
                <title>July 3rd RGraph release</title>
                <link>http://www.phpguru.org/article/419</link>
                <pubDate>Fri, 03 Jul 2009 06:38:43 -0400</pubDate>
                <description>
                    <![CDATA[<p class="firstLetter">The weather is a little more comfortable (ie I'm not melting) so here's todays <a href="http://www.rgraph.net" target="_blank">RGraph</a> release. It changes the behaviour of the line chart slightly for the better, in terms of handling NULL values, allows multiple datasets with the Scatter chart (which are only really noticeable if you have lines enabled) and a few other minor things.

<ul>
  <li>Better handle NULL values in the line chart</li>
  <li>Multiple datasets are now permitted withe the Scatter chart</li>
  <li>Miscellaneous improvements to the docs</li>
  <li>Caching and performance enhancements</li>
  <li>Scatter chart now allows multiple datasets</li>
  <li>Scatter chart can now have a key</li>
</ul>]]>
                </description>
            </item>
                    <item>
                <title>RGraph featured in JSmag</title>
                <link>http://www.phpguru.org/article/417</link>
                <pubDate>Thu, 02 Jul 2009 05:50:01 -0400</pubDate>
                <description>
                    <![CDATA[<p class="firstLetter"><a href="http://www.jsmag.com" target="_blank" rel="nofollow">JSMag</a> has an article in their July issue rounding up various graphing libraries, of which one of them is <a href="http://www.rgraph.net" target="_blank">RGraph</a>. And I think it fares rather well. In case you're wondering JSMag is an electronic (ie .pdf) magazine covering all things Javascript, and I've previously written for it (June issue - canvas article).]]>
                </description>
            </item>
                    <item>
                <title>Mozilla Firefox 3.5 released</title>
                <link>http://www.phpguru.org/article/416</link>
                <pubDate>Tue, 30 Jun 2009 04:20:26 -0400</pubDate>
                <description>
                    <![CDATA[<p class="firstLetter"><a href="http://www.getfirefox.com" target="_blank" rel="nofollow">
    <img src="/images/firefox3.5.jpg" style="float: right; border: 0" border="0" target="_blank" />
</a>

<p>
    Months late (six I think) but well worth it, <a href="http://www.getfirefox.com" rel="nofollow" target="_blank">Mozilla Firefox 3.5</a> has finally
    been released. Lots of new things, including improvements
    to the canvas support, geolocation, private browsing, HTML5 video support and HTML5 audio support (to name but a few), which will
    surely help it maintain the title of number one browser available. Perhaps not the most popular, but that's slowly changing if the statistics I use
    are anything to go by. If anything, anyone who upgrades will be able to use my canvas based <a href="http://www.rgraph.net" target="_blank">
    RGraph</a> graphing software. I'd say that's reason enough alone to upgrade...
</p>]]>
                </description>
            </item>
                    <item>
                <title>Javascript registry class using HTML5 DOM storage</title>
                <link>http://www.phpguru.org/article/415</link>
                <pubDate>Wed, 24 Jun 2009 06:45:18 -0400</pubDate>
                <description>
                    <![CDATA[<p class="firstLetter">    <script type="text/javascript" src="/javascript/Registry.js" ></script>

    <script type="text/javascript">
        sr = new Registry('session'); // Get a session registry object
        lr = new Registry('local');   // Get a local registry object
        
        r = sr;
    </script>

    <p>
        This is a simple wrapper around the local and session storage API. It doesn't do anything special, it's just a nicer API.
    </p>

    <table border="0">
        <tr>
            <th>Storage type:</th>
            <th>Name:</th>
            <th>Value:</th>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>
                <select name="type" onchange="if (this.value == 'session') r = sr; else r = lr;">
                    <option value="session" selected="selected">Session</option>
                    <option value="local">Local</option>
                </select>
            </td>
            <td><input type="text" id="name" /></td>
            <td><input type="text" id="value" /></td>
            <td><input type="submit" value="&laquo; Get" onclick="v = r.Get(document.getElementById('name').value); document.getElementById('value').value = v; alert('value is: ' + v);" /></td>
            <td><input type="submit" value="Set &raquo;"  onclick="r.Set(document.getElementById('name').value, document.getElementById('value').value); alert('Value has been set: ' + document.getElementById('name').value + '=' + document.getElementById('value').value)" /></td>
        </tr>
    </table>
    
    <p>
        You can get the code <a href="/javascript/Registry.js"><b>here</b></a>.
    </p>
    
    <h3>Usage</h3>
    
    <pre class="code">// Create the registry, this can be "session" or "local" and defaults to "session" anyway.
settings = new Registry('session');

// Store something in the registry
settings.Set('name', 'value');

// Get it back from the registry
myVar = settings.Get('name');
</pre>

    <h3>Compatibility</h3>
    
    <p>
        With it being HTML5, only the following browsers are supported:
    </p>
    
    <ul>
        <li>Firefox 3.5</li>
        <li>Safari 4</li>
        <li>Internet Explorer 8 (!)</li>
    </ul>
    
    <h3>Update - 27th June 2009</h3>

    <p>
        Just read that if you want to find out what's in the storage areas, you can find that information out by using the "databases"
        option in Safaris introspection tool. Very useful.
    </p>
</body>
</html>]]>
                </description>
            </item>
                    <item>
                <title>June 20th RGraph release</title>
                <link>http://www.phpguru.org/article/414</link>
                <pubDate>Sat, 20 Jun 2009 06:39:20 -0400</pubDate>
                <description>
                    <![CDATA[<p class="firstLetter">Morning campers. This release adds persistent annotations using HTML5 DOM storage. A feature that is part of Firefox 3.5, Safari 4 and MSIE 8. Annotations continue to work on Chrome 2, but simply will not persist across page refreshes. A few other little things have been updated and refined, including:

<ul>
  <li>Code optimisations</li>
 <li>Persistent annotations</li>
 <li>Labels can now be shown above bars on basic and grouped bar charts</li>
 <li>Connecting line can be shown on the Scatter chart</li>
</ul>]]>
                </description>
            </item>
                    <item>
                <title>HTML5 DOM Storage</title>
                <link>http://www.phpguru.org/article/413</link>
                <pubDate>Sun, 14 Jun 2009 13:05:10 -0400</pubDate>
                <description>
                    <![CDATA[<p class="firstLetter"><div style="float: right; width: 210px; text-align: center">
    <div style="border: 2px dashed gray; background-color: #eee; text-align: center; padding: 5px; margin: 10px">
        <input type="text" id="myText" style="width: 170px" value="Sample text..." onclick="if (this.value == 'Sample text...') this.value = ''" /><br />
        <button onclick="window.localStorage['myString'] = document.getElementById('myText').value; alert('Value has been set. Now you can close all open browser windows and reopen this page. As if by magic the value will reappear!')" style="width: 170px">Set value</button>
    </div>

    <span style="width: 150px; color: gray">This example will only work on Firefox 3.5, Safari 4 and (shock!) MSIE 8.</span>
</div>

<h3>What is it?</h3>

<p>
    HTML5 DOM Storage is something new in HTML5 which can be used to store data in the users browser. It has a few advantages over cookies:
</p>

<ul>
    <li>You can store more data than cookies (roughly 5-10k)</li>
    <li>It doesn't get sent back and forth to the web server</li>
    <li>Simpler to access</li>
</ul>

<h3>Browser support</h3>

<p>
    At the moment (14th June 2009) browser support is limited to the following:
</p>

<ul>
    <li>Internet Explorer 8 (!)</li>
    <li>Firefox 3.5</li>
    <li>Safari 4</li>
</ul>

<p>
    Because client support is limited, you can't really use it yet on public websites. However on internal websites where you have
    some degree of control over this, it wouldn't be out of the realms of plausability to use it.
</p>

<p>
    Firefox has supposedly supported this since version 2, but the documentation refers to something called "globalStorage"
    instead of "localStorage", so who knows.
</p>

<h3>Possible uses</h3>

<p>
    Use your imagination. Without thinking further about it, I'd be hesitant to store sensitive information using it, but
    because you can store all sorts of data in there (eg user prefs), and because it doesn't get sent back and forth to the server,
    it has the potential to lower bandwidth bills.
</p>

<h3>Example code</h3>

<p>
    Using it is very easy. You talk to it by simply using an associative array. You do need to know the correct key in advance though,
    so this does afford some degree of anonymity. I wouldn't rely on it for security though. To set something you do this:
</p>

<code><span style="color: #000000">
window.localStorage['myData']&nbsp;=&nbsp;'foo';</span>
</code>

<p>
    And to get something back you simply read that same array:
</p>

<code><span style="color: #000000">
var&nbsp;blarg&nbsp;=&nbsp;window.localStorage['myData'];</span>
</code>

<p>
    Yes, I know what you're thinking: "Bugger me senseless that's hard". Well... yeah. There's also window.sessionStorage
    which as the name suggests is limited to the current session, and when the session ends (ie you close the window) the data goes.
    In my tests in Firefox, sessions were limited to tabs - so different tabs means different sessions.
</p>

<h3>References</h3>

<p>
    The Quirksmode article was very useful to me in figuring it out, so I suggest you read that.
</p>

<ul>
  <li><a href="https://developer.mozilla.org/en/DOM/Storage" rel="nofollow" target="_blank">https://developer.mozilla.org/en/DOM/Storage</a></li>
  <li><a href="http://www.quirksmode.org/blog/archives/2009/06/html5_storage_t.html" target="_blank" rel="nofollow">http://www.quirksmode.org/blog/archives/2009/06/html5_storage_t.html</a></li>
</ul>


<script type="text/javascript">
    if (window.localStorage && window.localStorage['myString']) {
       document.getElementById('myText').value = window.localStorage['myString'];
    }
</script>]]>
                </description>
            </item>
                    <item>
                <title>June 6th RGraph release</title>
                <link>http://www.phpguru.org/article/411</link>
                <pubDate>Sat, 06 Jun 2009 07:25:58 -0400</pubDate>
                <description>
                    <![CDATA[<p class="firstLetter">As we edge closer to Firefox 3.5 being released, so does RGraph, and I get less and less to do. As such, this release fixes only a few things, and doesn't add any ground breaking new features.

<ul>
  <li>On graphs that support tooltips, you can now have tooltips at the same time as context menus</li>
  <li>Fixes to hiding the palette in Chrome</li>
  <li>Fixed a palette resizing bug</li>
  <li>Made "expand" tooltips a little smoother</li>
  <li>Changed name of <b>ShowPalette</b> function to <b>RGraph.Showpalette</b></li>
  <li>Fixed minor Pie chart tooltip/cursor bugs</li>
</ul>

<p style="float: right"><a href="http://www.rgraph.net">Download &raquo;</a></a>

<br clear="all" />]]>
                </description>
            </item>
            </channel>
</rss>