<?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>Teh Blarg &#187; webdev</title>
	<atom:link href="http://raybdbomb.com/p/tag/webdev/feed" rel="self" type="application/rss+xml" />
	<link>http://raybdbomb.com</link>
	<description>Incessant babble and otherwise blarg</description>
	<lastBuildDate>Thu, 09 Sep 2010 04:49:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Conflicting form action element and property</title>
		<link>http://raybdbomb.com/p/conflicting-form-action-element-and-property.html</link>
		<comments>http://raybdbomb.com/p/conflicting-form-action-element-and-property.html#comments</comments>
		<pubDate>Wed, 17 Oct 2007 20:11:14 +0000</pubDate>
		<dc:creator>Raybdbomb</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://raybdbomb.com/p/conflicting-form-action-element-and-property.html</guid>
		<description><![CDATA[Problem:
I recently came across an issue where an HTML input element named &#8220;action&#8221; was conflicting with the enclosing form&#8217;s action property.  To clarify, there was a form setup thusly:
&#60;form action="index.php" method="post" name="searchForm" id="searchForm"&#62;
...
&#60;a onclick="changeAction();"&#62;Export File&#60;/a&#62;
&#60;input type="hidden" name="action" value="1" /&#62;
...
&#60;/form&#62;
Where the changeAction function is defined as
&#60;script&#62;
function changeAction(){
 var x = document.getElementById("searchForm");
 alert("original action: "+x.action);
 x.action [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong><br />
I recently came across an issue where an HTML input element named &#8220;action&#8221; was conflicting with the enclosing form&#8217;s action property.  To clarify, there was a form setup thusly:</p>
<pre>&lt;form action="index.php" method="post" name="searchForm" id="searchForm"&gt;
...
&lt;a onclick="changeAction();"&gt;Export File&lt;/a&gt;
&lt;input type="hidden" name="action" value="1" /&gt;
...
&lt;/form&gt;</pre>
<p>Where the changeAction function is defined as</p>
<pre>&lt;script&gt;
function changeAction(){
 var x = document.getElementById("searchForm");
 alert("original action: "+x.action);
 x.action = 'export_csv.php';
 alert("new action: "+x.action);
 x.submit();
}
&lt;/script&gt;</pre>
<p>I found this function on <a href="http://www.w3schools.com/js/tryit.asp?filename=try_dom_form_action">w3schools</a>, and I was trying to figure out why it wouldn&#8217;t work for me.  It worked fine in Firefox, but not IE.  It finally occurred to me that in IE, document.getElementById(&#8220;searchForm&#8221;).action was the same as document.getElementById(&#8220;action&#8221;) &#8212; that is to say the .action was not the form&#8217;s <em>action</em> property, it was actually pointing to the input HTML element instead.  I would argue that this is a bug with IE, that any input named &#8216;action&#8217; would overwrite any direct access to the action form property.</p>
<p>This made it seemingly impossible for me to dynamically change the action of a form with the conflicting named input item.  </p>
<p>The obvious solution is to change the name of the input.  For most that would probably work OK, but I didn&#8217;t like that solution.  I <em>HAD</em> to get it <img src='http://raybdbomb.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p><strong>Solutions:</strong><br />
The first thing I tried was removing the input, then submitting the form.  This would work for most.  So that involved:</p>
<ol>
<li>Enclosing the input with a span with an ID I could reference &#8212; &#8216;action_input&#8217;.</li>
<li>Changing the changeAction function to clear the innerHTML of &#8216;action_input&#8217;, then submit.</li>
</ol>
<p>This works fine for most.  However, for me the new action I am setting retains the current page, it does not do a new page load.  This means that I need to be able to reset the action value after submitting, and it appears as though setting the innerHTML after a submit() does not work so well cross browser.  </p>
<p>I asked for help on efnet&#8217;s #javascript (IRC), and I was directed to the javascript function setAttribute.  After some searching, I found <a href="http://answers.google.com/answers/threadview?id=497058">that this doesn&#8217;t work</a>; in IE the getAttribute(&#8220;action&#8221;)/setAttribute(&#8220;action&#8221;, &#8220;newVal&#8221;) functions STILL reference the HTML input element, not the action property of the form.  </p>
<p>Upon more searching, I was directed to the changelog for <a href="http://ajaxanywhere.sourceforge.net/changelog.html">AjaxAnywhere</a>:</p>
<blockquote><p>1.1.0.2 &#8211; evolution : form &#8220;action&#8221; attribute is accessed by DOM to prevent collision with &lt;input name=&#8221;action&#8221; .. &gt;</p></blockquote>
<p>(Hey, at least someone else had this same issue!)</p>
<p>I perused their source code, and found this snippet (aa.js, line 130):</p>
<pre>var actionAttrNode = form.attributes["action"];</pre>
<p>So I tried that, and it worked beautifully in IE6, IE7 and Firefox 2.  The adjusted javascript function: </p>
<pre>function changeAction(){
 var x = document.getElementById("searchForm");
 x.attributes["action"].value = 'export_csv.php';
 x.submit();
 x.attributes["action"].value = 'index.php';
}</pre>
<p>Update: makk on efnet #javascript says that this doesn&#8217;t work with Safari.  There&#8217;s a workaround which makes it work, which I applied.  Here&#8217;s the final version of the function:</p>
<pre>function changeAction(){
 var x = document.getElementById("searchForm");
 x.attributes.getNamedItem('action').value = 'export_csv.php';
 x.submit();
 x.attributes.getNamedItem('action').value = 'index.php';
}</pre>
<p>Problem solved!</p>
]]></content:encoded>
			<wfw:commentRss>http://raybdbomb.com/p/conflicting-form-action-element-and-property.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Making a webroot a Subversion Repository</title>
		<link>http://raybdbomb.com/p/making-a-webroot-a-subversion-repository.html</link>
		<comments>http://raybdbomb.com/p/making-a-webroot-a-subversion-repository.html#comments</comments>
		<pubDate>Fri, 02 Feb 2007 07:00:12 +0000</pubDate>
		<dc:creator>Raybdbomb</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://raybdbomb.com/p/making-a-webroot-a-subversion-repository.html</guid>
		<description><![CDATA[So I setup a Subversion repository successfully.  Well, turns out it wasn&#8217;t complete.
My client would like to access and change files via Subversion instead of what they were currently using, FTP.  Moreover, they would like the files to exist in their webroot of their domain.  Their project is a web project, after [...]]]></description>
			<content:encoded><![CDATA[<p>So I <a href="http://raybdbomb.com/p/subversion-administration-and-usage.html">setup a Subversion repository</a> successfully.  Well, turns out it wasn&#8217;t complete.</p>
<p>My client would like to access and change files via Subversion instead of what they were currently using, FTP.  Moreover, they would like the files to exist in their webroot of their domain.  Their project is a web project, after all.</p>
<p>After some research and discussion with peers, I found out how to do this.  First, I had to add their directory as accessible via subversion.  I used <a href="http://subversion.tigris.org/faq.html#in-place-import">Subversion&#8217;s FAQ about in-place import</a> to do what I needed.  My exact commands were:<br />
<code># svn mkdir file:///home/svn/rep/{repname}/domain.com -m "Initial create"<br />
# cd /home/{user}<br />
# svn checkout file:///home/svn/rep/{repname}/domain.com<br />
# svn add *<br />
# svn commit -m "Initial version of files"</code></p>
<p>That seemed to work great, the repository was setup!  My client had access to read and write files to their repository, which is their webroot.  However, the webroot doesn&#8217;t auto-update, so any changes won&#8217;t take effect unless it&#8217;s manually updated.</p>
<p>Reading further in the Subversion FAQ, I found a way to <a href="http://subversion.tigris.org/faq.html#website-auto-update">auto update the files on the website</a>.<br />
I created a &#8220;Tiny C&#8221; app with the following code<br />
<code>#include &lt;stddef.h&gt;<br />
#include &lt;stdlib.h&gt;<br />
#include &lt;unistd.h&gt;<br />
int main(void)<br />
{<br />
  execl("/usr/local/bin/svn", "svn", "update", "/home/{user}/domain.com",<br />
        (const char *) NULL);<br />
  return(EXIT_FAILURE);<br />
}</code></p>
<p>Then compiled it</p>
<p><code>cc -o updaterepo postcommit.c</code></p>
<p>Then made updaterepo executable and gave it chmod +s, as suggested by the FAQ.  Of course I made it owned by {user} as well.  Then I created /home/svn/rep/{repname}/hooks/post-commit with the following content</p>
<p><code>#!/bin/sh<br />
/home/{user}/updaterepo</code></p>
<p>I tested a commit, and it worked!  </p>
]]></content:encoded>
			<wfw:commentRss>http://raybdbomb.com/p/making-a-webroot-a-subversion-repository.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Kuler: Visualizing Color Schemes</title>
		<link>http://raybdbomb.com/p/kuler-visualizing-color-schemes.html</link>
		<comments>http://raybdbomb.com/p/kuler-visualizing-color-schemes.html#comments</comments>
		<pubDate>Tue, 21 Nov 2006 21:47:54 +0000</pubDate>
		<dc:creator>Raybdbomb</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://raybdbomb.com/p/kuler-visualizing-color-schemes.html</guid>
		<description><![CDATA[Kuler from Adobe: visualizing color schemes for websites.  This is a great thing for some of us who are color-blind, or simply color-retarded.
Hat tip: Phil.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://kuler.adobe.com/">Kuler from Adobe</a>: visualizing color schemes for websites.  This is a great thing for some of us who are color-blind, or simply color-retarded.</p>
<p>Hat tip: <a href="http://eusef.com/2006/11/17/ok-so-rad-colors-from-adobe/">Phil</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://raybdbomb.com/p/kuler-visualizing-color-schemes.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IP to Location</title>
		<link>http://raybdbomb.com/p/ip-to-location.html</link>
		<comments>http://raybdbomb.com/p/ip-to-location.html#comments</comments>
		<pubDate>Tue, 03 Oct 2006 00:36:23 +0000</pubDate>
		<dc:creator>Raybdbomb</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://raybdbomb.com/p/ip-to-location.html</guid>
		<description><![CDATA[I found a nifty script that can tell information about the location of the person at a given IP.

http://api.hostip.info/country.php?ip=12.215.42.19
  US
http://api.hostip.info/get_html.php?ip=12.215.42.19
  Country: UNITED STATES (US)
  City: Sugar Grove, IL
http://api.hostip.info/get_html.php?ip=12.215.42.19&#038;position=true
  Country: UNITED STATES (US)
  City: Sugar Grove, IL
  Latitude: 41.7696
  Longitude: -88.4588

And more.  This is cool, thanks Andrew.
]]></description>
			<content:encoded><![CDATA[<p>I found a nifty script that can tell information about the location of the person at a given IP.<br />
<code></p>
<p>http://api.hostip.info/country.php?ip=12.215.42.19</p>
<p>  US</p>
<p>http://api.hostip.info/get_html.php?ip=12.215.42.19</p>
<p>  Country: UNITED STATES (US)<br />
  City: Sugar Grove, IL</p>
<p>http://api.hostip.info/get_html.php?ip=12.215.42.19&#038;position=true</p>
<p>  Country: UNITED STATES (US)<br />
  City: Sugar Grove, IL<br />
  Latitude: 41.7696<br />
  Longitude: -88.4588<br />
</code></p>
<p><a href="http://www.hostip.info/use.html">And more</a>.  This is cool, thanks Andrew.</p>
]]></content:encoded>
			<wfw:commentRss>http://raybdbomb.com/p/ip-to-location.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Redirecting from a WWW subdomain</title>
		<link>http://raybdbomb.com/p/redirecting-from-a-www-subdomain.html</link>
		<comments>http://raybdbomb.com/p/redirecting-from-a-www-subdomain.html#comments</comments>
		<pubDate>Tue, 13 Jun 2006 18:02:49 +0000</pubDate>
		<dc:creator>Raybdbomb</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://raybdbomb.com/p/redirecting-from-a-www-subdomain.html</guid>
		<description><![CDATA[To redirect all traffic on a site from www.raybdbomb.com to raybdbomb.com (or vice versa, as required), thanks to no-www.org:
In your .htaccess file
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

Where instead of domain.com, you put your domain.
]]></description>
			<content:encoded><![CDATA[<p>To redirect all traffic on a site from www.raybdbomb.com to raybdbomb.com (or vice versa, as required), thanks to <a href="http://no-www.org/">no-www.org</a>:<br />
<blockquote>In your .htaccess file<br />
RewriteEngine On<br />
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]<br />
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
</p></blockquote>
<p>Where instead of domain.com, you put your domain.</p>
]]></content:encoded>
			<wfw:commentRss>http://raybdbomb.com/p/redirecting-from-a-www-subdomain.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error for Cross Domain AJAX</title>
		<link>http://raybdbomb.com/p/error-for-cross-domain-ajax.html</link>
		<comments>http://raybdbomb.com/p/error-for-cross-domain-ajax.html#comments</comments>
		<pubDate>Wed, 12 Apr 2006 21:30:37 +0000</pubDate>
		<dc:creator>Raybdbomb</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://raybdbomb.com/p/error-for-cross-domain-ajax.html</guid>
		<description><![CDATA[I was running into an issue at my work.  When I clicked a certain link that was supposed to activate an AJAX portion of the site, in Firefox it wouldn&#8217;t work and in IE I would get:
This page is accessing information that is not under its control.  This is a security risk.  [...]]]></description>
			<content:encoded><![CDATA[<p>I was running into an issue at my work.  When I clicked a certain link that was supposed to activate an AJAX portion of the site, in Firefox it wouldn&#8217;t work and in IE I would get:</p>
<blockquote><p>This page is accessing information that is not under its control.  This is a security risk.  Do you want to continue?</p></blockquote>
<p>The problem was caused by doing an http.open on a domain that was other than that which the script was being run.  This wasn&#8217;t my intention, so to avoid this issue, I added some server-side host checking, and inserted it into the javascript where necessary:<br />
<code><br />
			function getSite(){<br />
				var host=&lt;?php echo "'http://".$_SERVER["HTTP_HOST"]."'"; ?&gt;;<br />
				if(host != 'http://host1'){<br />
					host+='/subdir';<br />
				}<br />
				return host;<br />
			}<br />
</code></p>
<p>I&#8217;m sure there&#8217;s an easier way, but this worked for me to utilize a &#8220;public&#8221; and &#8220;private&#8221; copy of this script without manually editing that value.</p>
]]></content:encoded>
			<wfw:commentRss>http://raybdbomb.com/p/error-for-cross-domain-ajax.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove HTML formatting</title>
		<link>http://raybdbomb.com/p/remove-html-formatting.html</link>
		<comments>http://raybdbomb.com/p/remove-html-formatting.html#comments</comments>
		<pubDate>Thu, 08 Sep 2005 23:25:46 +0000</pubDate>
		<dc:creator>Raybdbomb</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://raybdbomb.com/p/remove-html-formatting.html</guid>
		<description><![CDATA[I was looking for functionality to remove the html tags from text (i.e. anything of this format &#60;*&#62;).  I&#8217;m sure there&#8217;s a built-in PHP function to do this, but I couldn&#8217;t find one, so I made a function:

function get_plaintext($in){
  //goes from < to the next > and removes it.
  return stripslashes(preg_replace('/\< [^>]+\>/','',$in));
}
]]></description>
			<content:encoded><![CDATA[<p>I was looking for functionality to remove the html tags from text (i.e. anything of this format &lt;*&gt;).  I&#8217;m sure there&#8217;s a built-in PHP function to do this, but I couldn&#8217;t find one, so I made a function:<br />
<code><br />
function get_plaintext($in){<br />
  //goes from < to the next > and removes it.<br />
  return stripslashes(preg_replace('/\< [^>]+\>/','',$in));<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://raybdbomb.com/p/remove-html-formatting.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wordpress and Custom .htaccess</title>
		<link>http://raybdbomb.com/p/wordpress-and-custom-htaccess.html</link>
		<comments>http://raybdbomb.com/p/wordpress-and-custom-htaccess.html#comments</comments>
		<pubDate>Tue, 12 Jul 2005 15:59:43 +0000</pubDate>
		<dc:creator>Raybdbomb</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://raybdbomb.com/p/wordpress-and-custom-htaccess.html</guid>
		<description><![CDATA[I&#8217;ve found that there is a problematic combination involved with a server-writeable .htaccess file, and a .htaccess file that you have modified.  If you put in your own custom edits; for example a download redirection script, then click the Options -> Permalinks section of the weblog control panel, it will overwrite anything you have [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve found that there is a problematic combination involved with a server-writeable .htaccess file, and a .htaccess file that you have modified.  If you put in your own custom edits; for example a <a href="http://raybdbomb.com/p/download-tracking-and-counting.html">download redirection script</a>, then click the Options -> Permalinks section of the weblog control panel, it will overwrite anything you have done to the .htaccess file &#8220;automagically&#8221; (even without clicking the &#8220;Update Permalink Structure&#8221; button).</p>
<p>This might be a feature, but has caused me many a headache.  So, since I doubt I&#8217;ll be changing my permalink structure anytime soon, I made it unwriteable.  </p>
]]></content:encoded>
			<wfw:commentRss>http://raybdbomb.com/p/wordpress-and-custom-htaccess.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Table-less design</title>
		<link>http://raybdbomb.com/p/table-less-design.html</link>
		<comments>http://raybdbomb.com/p/table-less-design.html#comments</comments>
		<pubDate>Fri, 01 Jul 2005 17:35:33 +0000</pubDate>
		<dc:creator>Raybdbomb</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://raybdbomb.com/p/table-less-design.html</guid>
		<description><![CDATA[A List Apart has an article about table-less design with CSS which is essential for every web designer.
Edit 7/5/05:
I used this to convert a site I was making for my uncle from a &#8220;tabled&#8221; design to a &#8220;table-less&#8221; design.  It worked great.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.alistapart.com/">A List Apart</a> has an article about <a href="http://www.alistapart.com/articles/practicalcss/">table-less design</a> with CSS which is essential for every web designer.</p>
<p><em>Edit 7/5/05:</em><br />
I used this to convert a site I was making for my uncle from a &#8220;tabled&#8221; design to a &#8220;table-less&#8221; design.  It worked great.</p>
]]></content:encoded>
			<wfw:commentRss>http://raybdbomb.com/p/table-less-design.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Reference</title>
		<link>http://raybdbomb.com/p/css-reference.html</link>
		<comments>http://raybdbomb.com/p/css-reference.html#comments</comments>
		<pubDate>Wed, 30 Mar 2005 02:39:21 +0000</pubDate>
		<dc:creator>Raybdbomb</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://raybdbomb.com/03.29.2005/css-reference.html</guid>
		<description><![CDATA[w3schools has a great CSS Reference which I find very useful.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.w3schools.com">w3schools</a> has a great <a href="http://www.w3schools.com/css/css_reference.asp">CSS Reference</a> which I find very useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://raybdbomb.com/p/css-reference.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

