<?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>Online Cortex &#187; Programming</title>
	<atom:link href="http://www.huginn.com/knuth/blog/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.huginn.com/knuth/blog</link>
	<description>Thoughts on Science and Technology</description>
	<lastBuildDate>Thu, 03 Jun 2010 04:26:55 +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>Multiple Submit Buttons on Forms: Part II</title>
		<link>http://www.huginn.com/knuth/blog/2009/03/05/multiple-submit-buttons-on-forms-part-ii/</link>
		<comments>http://www.huginn.com/knuth/blog/2009/03/05/multiple-submit-buttons-on-forms-part-ii/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 05:14:04 +0000</pubDate>
		<dc:creator>drknuth</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Space]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[launch]]></category>
		<category><![CDATA[multiple buttons]]></category>
		<category><![CDATA[multiple submit buttons]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[submit]]></category>
		<category><![CDATA[submit buttons in forms]]></category>
		<category><![CDATA[two buttons]]></category>
		<category><![CDATA[two submit buttons]]></category>
		<category><![CDATA[URL]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.huginn.com/knuth/blog/?p=360</guid>
		<description><![CDATA[This is Part II in a discussion on how to incorporate multiple submit buttons on html forms.
Part I focused on having multiple submit buttons that performed completely different actions, such as going to different web pages.  Here we consider multiple submit buttons that launch the same php application, but take different actions within that application.
Here [...]]]></description>
			<content:encoded><![CDATA[<p>This is Part II in a discussion on how to incorporate multiple submit buttons on html forms.</p>
<p><a href="http://www.huginn.com/knuth/blog/2009/02/14/multiple-submit-buttons-on-forms/" target="_self">Part I focused on having multiple submit buttons</a> that performed completely different actions, such as going to different web pages.  Here we consider multiple submit buttons that launch the same php application, but take different actions within that application.</p>
<p>Here we have a simple form with three submit buttons:</p>
<p>&lt;form name=&#8221;categories&#8221; method=&#8221;get&#8221; action=&#8221;action.php&#8221;&gt;<br />
&lt;input type=&#8221;submit&#8221; name=&#8221;Submit_1&#8243; value=&#8221;Submit&#8221;&gt;<br />
&lt;input type=&#8221;submit&#8221; name=&#8221;Submit_2&#8243; value=&#8221;Submit&#8221;&gt;<br />
&lt;input type=&#8221;submit&#8221; name=&#8221;Submit_3&#8243; value=&#8221;Submit&#8221;&gt;<br />
&lt;/form&gt;</p>
<p>I am using the <a href="http://www.htmlcodetutorial.com/forms/_FORM_METHOD_GET.html" target="_blank">get method</a> so that you can see what actually gets sent along with the url.<br />
When you click on Submit_1 you see this URL:</p>
<p>http://www.urlkazoo.com/action.php?Submit_1=Submit</p>
<p>You can see that it is passing the name of the Submit button as a parameter.  To use this information, one simply needs to identify which parameter is being passed.  We can do this in the php code in action.php.  Here is a php snippet:</p>
<p>// Test is Submit_1 is defined<br />
if (isset($_REQUEST["Submit_1"]))<br />
{<br />
$button = 1;<br />
}<br />
// Test is Submit_2 is defined<br />
if (isset($_REQUEST["Submit_2"]))<br />
{<br />
$button = 2;<br />
}<br />
// Test is Submit_3 is defined<br />
if (isset($_REQUEST["Submit_3"]))<br />
{<br />
$button = 3;<br />
}</p>
<p>Of course the code above can be simplified using else statements.<br />
But the point is to demonstrate that we can determine which button was pressed by figuring out which button&#8217;s name has been passed along as a parameter.</p>
<p>From here you can go on to perform different functions based on which submit button was pressed.</p>
<p>Good Luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.huginn.com/knuth/blog/2009/03/05/multiple-submit-buttons-on-forms-part-ii/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why doesn&#8217;t my CSS work?</title>
		<link>http://www.huginn.com/knuth/blog/2009/02/18/why-doesnt-my-css-work/</link>
		<comments>http://www.huginn.com/knuth/blog/2009/02/18/why-doesnt-my-css-work/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 21:58:44 +0000</pubDate>
		<dc:creator>drknuth</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[CSS stylesheet broken not working cascading style sheet validator]]></category>

		<guid isPermaLink="false">http://www.huginn.com/knuth/blog/?p=342</guid>
		<description><![CDATA[It seems that I am always banging my head against the CSS wall screaming &#8220;What is wrong with my CSS code?&#8221; and &#8220;Why doesn&#8217;t it work?&#8221;  Today I came across the blog CSSNewbie and they had a nice article on the top five reasons why CSS doesn&#8217;t work.
The basic reasons are:

Missing bracket
Missing semicolon
Misspelled Class [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that I am always banging my head against the CSS wall screaming &#8220;What is wrong with my CSS code?&#8221; and &#8220;Why doesn&#8217;t it work?&#8221;  Today I came across the blog <a href="http://www.cssnewbie.com" target="_blank">CSSNewbie</a> and they had a nice article on the <a href="http://www.cssnewbie.com/five-quick-css-fixes/" target="_blank">top five reasons why CSS doesn&#8217;t work</a>.</p>
<p>The basic reasons are:</p>
<ol>
<li>Missing bracket</li>
<li>Missing semicolon</li>
<li>Misspelled Class or ID</li>
<li>Misspelled Properties or Value</li>
<li>Bad CSS Value</li>
</ol>
<p>Guess which one haunted me?</p>
<p>#1 of course!<br />
What I didn&#8217;t know is that CSS loads until there is an error and then it stops.  I had a CSS file that I linked to in the &lt;head&gt; section of my page and after it I had some style tags with some additional CSS definitions.  I saw that half of my CSS stylesheet worked and the other half didn&#8217;t, but the commands listed after the included stylesheet worked.  So I was very confused.</p>
<p>It turns out that the CSS stylesheet stopped loading after the parse error, so only the commands defined in the beginning worked.  But when it got to the new style tags, it read those just fine.</p>
<p>To find the error, I used a CSS Validator.<br />
Specifically, I went to:</p>
<p><a href="http://jigsaw.w3.org/css-validator/" target="_blank">W3C CSS Validation Service</a><br />
<a href="http://jigsaw.w3.org/css-validator/" target="_blank">http://jigsaw.w3.org/css-validator/</a></p>
<p>and gave it the URI to my CSS stylesheet.<br />
They found the error.</p>
<p>Good Luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.huginn.com/knuth/blog/2009/02/18/why-doesnt-my-css-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple Submit Buttons on Forms</title>
		<link>http://www.huginn.com/knuth/blog/2009/02/14/multiple-submit-buttons-on-forms/</link>
		<comments>http://www.huginn.com/knuth/blog/2009/02/14/multiple-submit-buttons-on-forms/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 08:56:58 +0000</pubDate>
		<dc:creator>drknuth</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Solutions]]></category>
		<category><![CDATA[html tutorial forms submit button multiple]]></category>

		<guid isPermaLink="false">http://www.huginn.com/knuth/blog/?p=251</guid>
		<description><![CDATA[I recently encountered the challenge of including multiple submit buttons on an html form.  Wading through the noise on various blogs and help sites was painful.  I finally found the following solution that works, and decided to post this little tutorial&#8230;
&#60;form name=myFORM type=post action=default.html&#62;
&#60;input type=&#8217;submit&#8217; value=&#8217;Open Default Site&#8217; onclick=&#8221;this.form.target=&#8217;_blank&#8217;;return true;&#8221;&#62;
&#60;input type=&#8217;submit&#8217; value=&#8217;Open Special Site&#8217; onclick=&#8221;myFORM.action=&#8217;special.html&#8217;; [...]]]></description>
			<content:encoded><![CDATA[<p>I recently encountered the challenge of including multiple submit buttons on an html form.  Wading through the noise on various blogs and help sites was painful.  I finally found the following solution that works, and decided to post this little tutorial&#8230;</p>
<p><span style="font-family: Verdana; color: blue; font-size: x-small;">&lt;form name=myFORM type=post action=default.html&gt;</span></p>
<p><span style="font-family: Verdana; color: blue; font-size: x-small;">&lt;input type=&#8217;submit&#8217; value=&#8217;Open Default Site&#8217; onclick=&#8221;this.form.target=&#8217;_blank&#8217;;return true;&#8221;&gt;<br />
&lt;input type=&#8217;submit&#8217; value=&#8217;Open Special Site&#8217; onclick=&#8221;myFORM.action=&#8217;special.html&#8217;;  return true;&#8221;&gt; &lt;/form&gt;</span></p>
<p>Note that the default action of the form is defined in the first line by:<br />
<span style="font-family: Verdana; color: blue; font-size: x-small;">action=default.html</span><br />
Both buttons are of type Submit, but they have different values, which reflect what the buttons actually say.</p>
<p>The command in the first button<br />
<span style="font-family: Verdana; color: blue; font-size: x-small;">onclick=&#8221;this.form.target=&#8217;_blank&#8217;;return true;&#8221;</span><br />
instructs it to follow the default action, which is to open default.html in a new window (indicated by <span style="font-family: Verdana; color: blue; font-size: x-small;">target=&#8217;_blank&#8217;</span>).</p>
<p>The command in the second button<br />
<span style="font-family: Verdana; color: blue; font-size: x-small;">onclick=&#8221;myFORM.action=&#8217;special.html&#8217;;  return true;&#8221;</span><br />
instructs it to take on a new action, which is to open special.html</p>
<p>You can keep adding additional submit buttons this way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.huginn.com/knuth/blog/2009/02/14/multiple-submit-buttons-on-forms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MATLAB Packages for the NXT</title>
		<link>http://www.huginn.com/knuth/blog/2009/02/11/matlab-packages-for-the-nxt/</link>
		<comments>http://www.huginn.com/knuth/blog/2009/02/11/matlab-packages-for-the-nxt/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 07:28:48 +0000</pubDate>
		<dc:creator>drknuth</dc:creator>
				<category><![CDATA[Lego]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[Robotics]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[MATLAB]]></category>

		<guid isPermaLink="false">http://www.huginn.com/knuth/blog/?p=245</guid>
		<description><![CDATA[Brickengineer announces MATLAB packages for the LEGO NXT Robotics system:
There are now several MATLAB packages for robotics, and specifically for the NXT. One paradigm is to run the code on a PC and have it communicate direct commands to the NXT Brick via Bluetooth or USB. I have found this paradigm to be a bit [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.brickengineer.com/pages/2009/02/11/matlab-packages-for-the-nxt/" target="_blank">Brickengineer announces MATLAB packages for the LEGO NXT Robotics system</a>:</p>
<p>There are now several MATLAB packages for robotics, and specifically for the NXT. One paradigm is to run the code on a PC and have it communicate direct commands to the NXT Brick via Bluetooth or USB. I have found this paradigm to be a bit dangerous since in the event of a MATLAB crash or a miscommunication, the NXT Brick will continue with its last command until ordered to stop. This has the potential to destroy your robot. The paradigm that I prefer to use is to write several programs that run on the brick. These programs take commands from files on the brick that can be uploaded rapidly from the PC. The MATLAB code then is in charge of sending the command files and starting and stopping programs. In the event of a MATLAB crash or communication failure, the software running on the NXT Brick can be designed to terminate gracefully.</p>
<p>Here are the MATLAB packages that I know of. The first two are specifically geared toward the NXT; whereas the last is a general robotics package.</p>
<p>* LEGO MINDSTORMS NXT Toolkit for MATLAB and Simulink<br />
<a href="http://www.mathworks.com/programs/mindstorms/" target="_blank">http://www.mathworks.com/programs/mindstorms/</a><br />
* Robotics Toolbox for MATLAB (Release 7.1) (P.I. Corke)<br />
<a href="http://" target="_blank">http://petercorke.com/Robotics%20Toolbox.html</a><br />
* RWTH Mindstorms NXT Toolbox for Matlab<br />
<a href="http://www.mindstorms.rwth-aachen.de/" target="_blank">http://www.mindstorms.rwth-aachen.de/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.huginn.com/knuth/blog/2009/02/11/matlab-packages-for-the-nxt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource</title>
		<link>http://www.huginn.com/knuth/blog/2009/01/31/warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result-resource/</link>
		<comments>http://www.huginn.com/knuth/blog/2009/01/31/warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result-resource/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 00:44:08 +0000</pubDate>
		<dc:creator>drknuth</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[mysql_num_rows]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.huginn.com/knuth/blog/?p=225</guid>
		<description><![CDATA[This is a note on an error that I have gotten several times when writing php scripts with mySQL.
The error is:
Warning:  mysql_num_rows(): supplied argument is not a valid MySQL result resource
The offending code snippet essentially looks like this:
$result = mysql_query(&#8220;$query_STRING&#8221; );
if (mysql_num_rows($result) &#62; 0)
{
which then continues on&#8230;
Note that $query_STRING is a string variable that [...]]]></description>
			<content:encoded><![CDATA[<p>This is a note on an error that I have gotten several times when writing php scripts with mySQL.</p>
<p>The error is:</p>
<blockquote><p><strong>Warning</strong>:  mysql_num_rows(): supplied argument is not a valid MySQL result resource</p></blockquote>
<p>The offending code snippet essentially looks like this:</p>
<blockquote><p>$result = mysql_query(&#8220;$query_STRING&#8221; );<br />
if (mysql_num_rows($result) &gt; 0)<br />
{</p>
<p>which then continues on&#8230;</p></blockquote>
<p>Note that $query_STRING is a string variable that contains the mySQL query.</p>
<p>The problem with this error message is that it is typically due to a problem in the query itself, and there can be many causes.  To catch the cause, change the line that performs the query to:</p>
<blockquote><p>$result = mysql_query(&#8220;$query_STRING&#8221; ) or die(mysql_error());</p></blockquote>
<p>The statement die(mysql_error()) will catch the true error and with luck give you a more meaningful error message.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.huginn.com/knuth/blog/2009/01/31/warning-mysql_num_rows-supplied-argument-is-not-a-valid-mysql-result-resource/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
