<?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>dr_drsh Place &#187; Javascript</title>
	<atom:link href="http://mostafa.mosmar.com/blog/category/technical/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://mostafa.mosmar.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 06 Nov 2009 00:42:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Web-based WYSIWYG Form designer</title>
		<link>http://mostafa.mosmar.com/blog/2008/04/14/wysiwyg-form-designer/</link>
		<comments>http://mostafa.mosmar.com/blog/2008/04/14/wysiwyg-form-designer/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 22:21:50 +0000</pubDate>
		<dc:creator>مصطفى</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[GSoC]]></category>
		<category><![CDATA[JForms]]></category>
		<category><![CDATA[WYSIWYG]]></category>

		<guid isPermaLink="false">http://mostafa.mosmar.com/blog/2008/04/14/wysiwyg-form-designer/</guid>
		<description><![CDATA[A few days ago I decided to suppress my &#8220;conservative&#8221; stance towards massive Javascript usage and started working on a WYSIWYG editor for HTML Forms, The application resembles drag-and-drop GUI editors, I&#8217;ve spent lot of time in building the codebase to make it as Object oriented as possible. The codebase is simply composed of two [...]]]></description>
			<content:encoded><![CDATA[<p class="english-text" >A few days ago I decided to suppress my &#8220;conservative&#8221; stance towards massive Javascript usage and started working on a WYSIWYG editor for HTML Forms, The application resembles drag-and-drop GUI editors, I&#8217;ve spent lot of time in building the codebase to make it as Object oriented as possible.</p>
<p class="english-text" >The codebase is simply composed of two parts, Core and pluginis &#8220;Elements&#8221;</p>
<p class="english-text" >Each draggable element is handled by a 2 files </p>
<ul class="english-text" >
<li>A javascript file that does the rendering and the event handling &#8220;Events are triggered by the core and passed down to each individual element&#8221;.</li>
<li>A php file that defines what properties the element has, these information are used by the core to generate property page, this file is just meant to hold configuration parameters, no actual coding involved.</li>
</ul>
<p class="english-text" >Adding a new element would just require writing two files and the core handles the rest.</p>
<p class="english-text" >I&#8217;m using <a href="http://www.prototypejs.org">Prototype</a>, <a href="http://script.aculo.us/">script.aculo.us</a> and <a href="http://www.webtoolkit.info/javascript-context-menu.html">Webtoolkit context menu</a>, No true AJAX has been used so far, everything is done on the client side.</p>
<p class="english-text" >Now the question is , what does the end user see?</p>
<ul class="english-text" >
<li>Drag and drop environment</li>
<li>Context menu for each element</li>
<li>Properties for each element</li>
<li>Simple keyboard interaction &#8220;Selected element can be deleted by pressing the (del) button (except textfield and textarea)&#8221;</li>
</ul>
<p class="english-text" >I&#8217;ve tested this on FF2 and IE6.</p>
<p class="english-text" >What I really need to implement right now is the &#8220;Resize&#8221; function</p>
<p class="english-text" >Why don&#8217;t you check <a href="http://mosmar.com/wysiwyg">A demo of the code in action</a></p>
<p class="english-text" >I plan to turn this into a Joomla! forms component soon Insh&#8217;Allah. </p>
<p class="english-text" ><em>Update:</em> My Proposal to Google Summer of Code has been accepted and I&#8217;ll be working on implementing this form editor as a Joomla! 1.5 component, You can find more information about my progress on <a href="http://developer.joomla.org/gsoc2008/forms.html">my GSoC blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mostafa.mosmar.com/blog/2008/04/14/wysiwyg-form-designer/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>parseInt() and leading zeros</title>
		<link>http://mostafa.mosmar.com/blog/2007/06/07/parseint-and-leading-zeros/</link>
		<comments>http://mostafa.mosmar.com/blog/2007/06/07/parseint-and-leading-zeros/#comments</comments>
		<pubDate>Thu, 07 Jun 2007 06:03:41 +0000</pubDate>
		<dc:creator>مصطفى</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://mostafa.mosmar.com/blog/2007/06/07/parseint-on-firefox/</guid>
		<description><![CDATA[I used parseInt() earlier to extract the number from a string coming for an input field, the numbers always had a leading zero, like &#8220;09 , 08, 07&#8243; , When I sent these apparently &#8220;normal&#8221; and &#8220;easy-to-convert&#8221; values , parseInt() always returned 0! . I had no doubts about parseInt() I thought it was my [...]]]></description>
			<content:encoded><![CDATA[<p class="english-text" >I used parseInt() earlier to extract the number from a string coming for an input field, the numbers always had a leading zero, like &#8220;09 , 08, 07&#8243; , When I sent these apparently &#8220;normal&#8221; and &#8220;easy-to-convert&#8221; values , parseInt() always returned 0! .</p>
<p class="english-text" >I had no doubts about parseInt() I thought it was my code that&#8217;s causing this problem, I double checked everything and I finally turned to parseInt() ,Everything seemed to work very well &#8220;Before&#8221; parseInt() enters.</p>
<p class="english-text" >I check <a href="http://www.w3schools.com/jsref/jsref_parseInt.asp">w3schools</a> and found this</p>
<blockquote class="english-text"  cite="http://www.w3schools.com/jsref/jsref_parseInt.asp">
<div>
If the radix parameter is omitted, JavaScript assumes the following:</p>
<p>    * If the string begins with &#8220;0x&#8221;, the radix is 16 (hexadecimal)<br />
    * If the string begins with &#8220;0&#8243;, the radix is 8 (octal). This feature is deprecated<br />
    * If the string begins with any other value, the radix is 10 (decimal)
</p></div>
</blockquote>
<p class="english-text" >so if the string begins with &#8220;0&#8243; , the radix is automatically assumed to be 8 (octal) but it seems that this feature is still Not deprecated on FF 2.0.0.4 (not sure about IE) .</p>
<p class="english-text" >To fix this I had to force parseInt() to use Decimal numeral system by explicitly specifying the radix (10). </p>
<p class="english-text" >Example:</p>
<input value="09" type="text" name="test" id="test" />
<input type="button" value="Go!" onclick="javascript:test()" />
<script type="text/javascript">
function test(){
var number = document.getElementById("test").value;
var message = "\nparseInt() without radix specified = " + parseInt(number) + "\n\n" + "parseInt() with radix explicitly set to (10) = " + parseInt(number,10);
alert(message);
}
</script></p>
<p class="english-text" ><em><strong>Update June 9th 2007: </strong></em>I&#8217;ve came to discover that this issue is very well known and <a href="http://www.google.com/search?source=ig&#038;hl=en&#038;q=parseInt+with+leading+zeros&#038;btnG=Google+Search">well documented all over the web</a> , The funny thing is that <a href="http://support.microsoft.com/kb/191434">Microsoft&#8217;s Solution</a> is based on &#8220;manual&#8221; approach &#8220;that is using a loop that removes every leading &#8217;0&#8242; by string functions!&#8221;, although specifying the radix explicitly would solve the whole situation.</p>
]]></content:encoded>
			<wfw:commentRss>http://mostafa.mosmar.com/blog/2007/06/07/parseint-and-leading-zeros/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
