<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Improving JPSpan page load performance</title>
	<atom:link href="http://blog.joshuaeichorn.com/archives/2005/07/15/improving-jpspan-page-load-performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.joshuaeichorn.com/archives/2005/07/15/improving-jpspan-page-load-performance/</link>
	<description>The weblog of Joshua Eichorn, AJAX, PHP and Open Source</description>
	<pubDate>Fri, 05 Sep 2008 21:35:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1-alpha</generator>
		<item>
		<title>By: Joshua Eichorn</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/07/15/improving-jpspan-page-load-performance/#comment-4549</link>
		<dc:creator>Joshua Eichorn</dc:creator>
		<pubDate>Fri, 02 Sep 2005 20:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=158#comment-4549</guid>
		<description>The default JPSpan encoding type is XML, it doesn't suffer from this bug, but gives you the exact same result.

The default encoding for HTML_AJAX is JSON (in both directions).

If your using JPSpan with the default XML serializer or HTML_AJAX with JSON you'll be able to transparently move JavaScript datatypes to PHP ones and vice versus.

Minus any bugs you hit of course, but both have worked well for me.  Also im the author of HTML_AJAX, just to be clear, but its goals is to support everything JPSpan does plus more while being lighter weight and faster.</description>
		<content:encoded><![CDATA[<p>The default JPSpan encoding type is XML, it doesn&#8217;t suffer from this bug, but gives you the exact same result.</p>
<p>The default encoding for HTML_AJAX is JSON (in both directions).</p>
<p>If your using JPSpan with the default XML serializer or HTML_AJAX with JSON you&#8217;ll be able to transparently move JavaScript datatypes to PHP ones and vice versus.</p>
<p>Minus any bugs you hit of course, but both have worked well for me.  Also im the author of HTML_AJAX, just to be clear, but its goals is to support everything JPSpan does plus more while being lighter weight and faster.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Nijs</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/07/15/improving-jpspan-page-load-performance/#comment-4548</link>
		<dc:creator>Patrick Nijs</dc:creator>
		<pubDate>Fri, 02 Sep 2005 20:37:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=158#comment-4548</guid>
		<description>Well, like I stated before, the main reason we are using JPSpan is because JPSpan can serialize an array of data client-side through Javascript.

It adds structure to POSTDATA which normally without JPSpan or serialize functions, isn't structured.

So with this functionality in mind, are you still recommending HTML_AJAX? (Haven't quite looked at it yet...)</description>
		<content:encoded><![CDATA[<p>Well, like I stated before, the main reason we are using JPSpan is because JPSpan can serialize an array of data client-side through Javascript.</p>
<p>It adds structure to POSTDATA which normally without JPSpan or serialize functions, isn&#8217;t structured.</p>
<p>So with this functionality in mind, are you still recommending HTML_AJAX? (Haven&#8217;t quite looked at it yet&#8230;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua Eichorn</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/07/15/improving-jpspan-page-load-performance/#comment-4547</link>
		<dc:creator>Joshua Eichorn</dc:creator>
		<pubDate>Fri, 02 Sep 2005 20:00:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=158#comment-4547</guid>
		<description>In the email i got things make sense.

As far as I can tell you one of the few people using the PHP serialzer in JPSpan, I wouldn't really recommend using it, since its format includes string sizes its always going to be really brittle when generated from other languages.

Also it can be used to create an instance of any class thats already been included which can be a security risk.  If you really want the added performance this gives you I would recommend writing your own version of unserialize that won't create new objects or only creates ones on a whitelist.  You could also cover this bug in that case.

You might also want to have a look at HTML_AJAX, which uses JSON by default in both directions.</description>
		<content:encoded><![CDATA[<p>In the email i got things make sense.</p>
<p>As far as I can tell you one of the few people using the PHP serialzer in JPSpan, I wouldn&#8217;t really recommend using it, since its format includes string sizes its always going to be really brittle when generated from other languages.</p>
<p>Also it can be used to create an instance of any class thats already been included which can be a security risk.  If you really want the added performance this gives you I would recommend writing your own version of unserialize that won&#8217;t create new objects or only creates ones on a whitelist.  You could also cover this bug in that case.</p>
<p>You might also want to have a look at HTML_AJAX, which uses JSON by default in both directions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Nijs</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/07/15/improving-jpspan-page-load-performance/#comment-4546</link>
		<dc:creator>Patrick Nijs</dc:creator>
		<pubDate>Fri, 02 Sep 2005 19:52:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=158#comment-4546</guid>
		<description>Sorry for the code messing up my comments above...</description>
		<content:encoded><![CDATA[<p>Sorry for the code messing up my comments above&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Nijs</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/07/15/improving-jpspan-page-load-performance/#comment-4545</link>
		<dc:creator>Patrick Nijs</dc:creator>
		<pubDate>Fri, 02 Sep 2005 19:50:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=158#comment-4545</guid>
		<description>Hi Joshua, 

That was a quick reply ;)

Well, in my Smarty (http://smarty.php.net) templates, I've defined following in the -section of my HTML-output:

{php}
require_once 'JPSpan.php';
require_once JPSPAN . 'Include.php';
JPSpan_Include_Register('util/data.js');
JPSpan_Include_Register('encode/php.js');
{/php}


{php}
JPSpan_Includes_Display();
{/php}


And then I am calling this function to serialize the POST-values and send the serialized string to a php-page:




function postForm() {

	var Encoder = new JPSpan_Encode_PHP();
	var data = new Array();
	var serialized_string;

	data["textfield"] = document.getElementById('textfield').value;
    serialized_string = Encoder.encode(data);

	alert(serialized_string);

	document.serialize.data.value = serialized_string;
	document.serialize.submit();

}






" method="post"&#62;




" method="post"&#62;







Now in FireFox I get this when I POST an ENTER in my TEXTAREA:
HTTP_POST String:
a:1:{s:9:"textfield";s:1:"
";}

Notice:  unserialize(): Error at offset 27 of 31 bytes in c:\htdocs\temp\serialize_bleeding_edge.php on line 15

As you see, FireFox counts this enter only as 1 character.
It also goes wrong when I'm using Debian Testing as my PHP-enabled webserver.</description>
		<content:encoded><![CDATA[<p>Hi Joshua, </p>
<p>That was a quick reply <img src='http://blog.joshuaeichorn.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Well, in my Smarty (http://smarty.php.net) templates, I&#8217;ve defined following in the -section of my HTML-output:</p>
<p>{php}<br />
require_once &#8216;JPSpan.php&#8217;;<br />
require_once JPSPAN . &#8216;Include.php&#8217;;<br />
JPSpan_Include_Register(&#8217;util/data.js&#8217;);<br />
JPSpan_Include_Register(&#8217;encode/php.js&#8217;);<br />
{/php}</p>
<p>{php}<br />
JPSpan_Includes_Display();<br />
{/php}</p>
<p>And then I am calling this function to serialize the POST-values and send the serialized string to a php-page:</p>
<p>function postForm() {</p>
<p>	var Encoder = new JPSpan_Encode_PHP();<br />
	var data = new Array();<br />
	var serialized_string;</p>
<p>	data["textfield"] = document.getElementById(&#8217;textfield&#8217;).value;<br />
    serialized_string = Encoder.encode(data);</p>
<p>	alert(serialized_string);</p>
<p>	document.serialize.data.value = serialized_string;<br />
	document.serialize.submit();</p>
<p>}</p>
<p>&#8221; method=&#8221;post&#8221;&gt;</p>
<p>&#8221; method=&#8221;post&#8221;&gt;</p>
<p>Now in FireFox I get this when I POST an ENTER in my TEXTAREA:<br />
HTTP_POST String:<br />
a:1:{s:9:&#8221;textfield&#8221;;s:1:&#8221;<br />
&#8220;;}</p>
<p>Notice:  unserialize(): Error at offset 27 of 31 bytes in c:\htdocs\temp\serialize_bleeding_edge.php on line 15</p>
<p>As you see, FireFox counts this enter only as 1 character.<br />
It also goes wrong when I&#8217;m using Debian Testing as my PHP-enabled webserver.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua Eichorn</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/07/15/improving-jpspan-page-load-performance/#comment-4544</link>
		<dc:creator>Joshua Eichorn</dc:creator>
		<pubDate>Fri, 02 Sep 2005 19:26:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=158#comment-4544</guid>
		<description>Patrick:
I haven't seen this happen, \r\n is two characters so getting the wrong count from firefox does sound like a bug.  Are you using the default xml serializer in JPSpan or something else.</description>
		<content:encoded><![CDATA[<p>Patrick:<br />
I haven&#8217;t seen this happen, \r\n is two characters so getting the wrong count from firefox does sound like a bug.  Are you using the default xml serializer in JPSpan or something else.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Nijs</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/07/15/improving-jpspan-page-load-performance/#comment-4543</link>
		<dc:creator>Patrick Nijs</dc:creator>
		<pubDate>Fri, 02 Sep 2005 19:23:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=158#comment-4543</guid>
		<description>I am using JPSpan too to serialize the POST-string and get it to a PHP page which can then unserialize the POST-values.
But I'm having problems with enters in Mozilla Firefox v1.0.6.
It seems that Mozilla is counting an \r\n (chr(13) &#38;&#38; chr(10)) as 1 character, while Microsoft Internet Explorer v6 counts an \r\n as two characters.
PHP will unserialize a JPSpan serialized string correctly with Internet Explorer, but will generate an error on a serialized string POST'ed by FireFox, because the string length is too short (differs 1 character on every enter).
Are you familiar with this?

Patrick</description>
		<content:encoded><![CDATA[<p>I am using JPSpan too to serialize the POST-string and get it to a PHP page which can then unserialize the POST-values.<br />
But I&#8217;m having problems with enters in Mozilla Firefox v1.0.6.<br />
It seems that Mozilla is counting an \r\n (chr(13) &amp;&amp; chr(10)) as 1 character, while Microsoft Internet Explorer v6 counts an \r\n as two characters.<br />
PHP will unserialize a JPSpan serialized string correctly with Internet Explorer, but will generate an error on a serialized string POST&#8217;ed by FireFox, because the string length is too short (differs 1 character on every enter).<br />
Are you familiar with this?</p>
<p>Patrick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua Eichorn</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/07/15/improving-jpspan-page-load-performance/#comment-4201</link>
		<dc:creator>Joshua Eichorn</dc:creator>
		<pubDate>Sat, 16 Jul 2005 22:34:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=158#comment-4201</guid>
		<description>It shoudln't be that hard to do that, but if you use this code im not sure that it matters unless your using multiple pages to expose the stub classes.</description>
		<content:encoded><![CDATA[<p>It shoudln&#8217;t be that hard to do that, but if you use this code im not sure that it matters unless your using multiple pages to expose the stub classes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Bulman</title>
		<link>http://blog.joshuaeichorn.com/archives/2005/07/15/improving-jpspan-page-load-performance/#comment-4200</link>
		<dc:creator>Mike Bulman</dc:creator>
		<pubDate>Sat, 16 Jul 2005 13:40:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.joshuaeichorn.com/?p=158#comment-4200</guid>
		<description>I've actually been using JPSpan a lot since I discovered it.  I am in the middle of creating an application that will use multiple JPSpan servers.  I realized that doing this meant forcing the user to download 12KB of the same javascript code (the base JPSpan code) for every server.  Since I am manually crunching javascript anyway, I decided to break this code up into a 12KB base.js and multiple javascript files for each server.  This caused some hassle, but I didn't see any other way around it.

Any chance future functionality might allow the postoffice too only output server specific javascript?</description>
		<content:encoded><![CDATA[<p>I&#8217;ve actually been using JPSpan a lot since I discovered it.  I am in the middle of creating an application that will use multiple JPSpan servers.  I realized that doing this meant forcing the user to download 12KB of the same javascript code (the base JPSpan code) for every server.  Since I am manually crunching javascript anyway, I decided to break this code up into a 12KB base.js and multiple javascript files for each server.  This caused some hassle, but I didn&#8217;t see any other way around it.</p>
<p>Any chance future functionality might allow the postoffice too only output server specific javascript?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
