<?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>Cow Computing &#187; Web</title>
	<atom:link href="http://www.cowcomputing.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cowcomputing.com</link>
	<description>Share Info about Cloud Computing &#38; Programming</description>
	<lastBuildDate>Thu, 22 Jul 2010 17:10:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>cURL Post Follow Location And Update Browser Address Bar</title>
		<link>http://www.cowcomputing.com/2010/07/23/curl-post-follow-location-and-update-browser-address-bar/</link>
		<comments>http://www.cowcomputing.com/2010/07/23/curl-post-follow-location-and-update-browser-address-bar/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 17:08:24 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[cURL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cowcomputing.com/?p=229</guid>
		<description><![CDATA[Often time, one might be using cURL to perform some post/get operations. Out of all, there&#8217;s a scenario where one might want to do a form post and have the user redirected thru the 302 status code issued by the server. This can be easily implemented using cURL, however, there&#8217;s a problem &#8212; The address [...]]]></description>
			<content:encoded><![CDATA[<p>Often time, one might be using cURL to perform some post/get operations. Out of all, there&#8217;s a scenario where one might want to do a form post and have the user redirected thru the 302 status code issued by the server. This can be easily implemented using cURL, however, there&#8217;s a problem &#8212; The address bar doesn&#8217;t update to the redirected URL. (e.g. Posting a form from &#8220;form.php&#8221;, and redirected to &#8220;result.php&#8221;, but then the browser&#8217;s address bar remains showing &#8220;form.php&#8221;).</p>
<p>In order to solve the above problem, here&#8217;s a little trick:</p>
<pre class="brush:php">
&lt;?php

// post param
$param = array('data' =&gt; 'abc');

$c = curl_init();
curl_setopt($c, CURLOPT_URL, "form.php");
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $param);
curl_setopt($c, CURLOPT_HEADER, 1);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
curl_exec($c);

// here's the trick
$redirectLocation = curl_getinfo($c, CURLINFO_EFFECTIVE_URL);
header("Location: $redirectLocation");

?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cowcomputing.com/2010/07/23/curl-post-follow-location-and-update-browser-address-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Data Object</title>
		<link>http://www.cowcomputing.com/2010/04/04/php-data-object/</link>
		<comments>http://www.cowcomputing.com/2010/04/04/php-data-object/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 14:53:54 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[PDO]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Transaction]]></category>

		<guid isPermaLink="false">http://www.cowcomputing.com/?p=207</guid>
		<description><![CDATA[Often time, when working on a website, certain database transactions have to be taken with great care (e.g. payment, account creation&#8230;). It&#8217;s definitely an advantage to make use of the Atomicity the database provides (e.g. mySQL). But How? Here&#8217;s i will show you how to use PDO to wrap a SQL insert statement such that [...]]]></description>
			<content:encoded><![CDATA[<p>Often time, when working on a website, certain database transactions have to be taken with great care (e.g. payment, account creation&#8230;). It&#8217;s definitely an advantage to make use of the Atomicity the database provides (e.g. mySQL). But How? Here&#8217;s i will show you how to use PDO to wrap a SQL insert statement such that it&#8217;s either done or no. (*it&#8217;s included with PHP5, and you have to enable the extension inside the php.ini)</p>
<pre class="brush:php">&lt;?php

$hostname = 'localhost';
$username = 'username';
$password = 'password';

try {
$dbh = new PDO("mysql:host=$hostname;dbname=mysql", $username, $password);

// Setting the notification to throw exception when error encountered
$dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$dbh-&gt;beginTransaction();
$count = $dbh-&gt;exec("INSERT INTO user(userID, name) VALUES ('1', 'Steve')");
$dbh-&gt;commit();

$dbh = null;
}
catch(PDOException $e)
{
$dbh-&gt;rollback();
echo $e-&gt;getMessage();
}

?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cowcomputing.com/2010/04/04/php-data-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Error: Cannot Modify Header Information</title>
		<link>http://www.cowcomputing.com/2010/03/08/wordpress-error-cannot-modify-header-information/</link>
		<comments>http://www.cowcomputing.com/2010/03/08/wordpress-error-cannot-modify-header-information/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 02:14:06 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Bug]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Header]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.cowcomputing.com/?p=198</guid>
		<description><![CDATA[Have you ever encountered the error: &#8220;Cannot modify header information&#8221; when you try to access the admin page of wordpress? The debug message might have suggested you to look at &#8220;pluggable.php&#8221;. When searching thru google, people often advise you to turn off installed-plugin one by one to see if the problem get resolved. The above [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever encountered the error: &#8220;Cannot modify header information&#8221; when you try to access the admin page of wordpress? The debug message might have suggested you to look at &#8220;pluggable.php&#8221;. When searching thru google, people often advise you to turn off installed-plugin one by one to see if the problem get resolved.</p>
<p>The above might work, but i would suggest you to try the following method before going thru the turn-off plugin cycle. For example, if you have modified &#8220;functions.php&#8221;, and the above header information header appeared right after, you can easily resolve this by removing all the extra whitespace before the &#8220;&lt;?php&#8221; and &#8220;?&gt;&#8221; tag. Viewing thru editor, you might not notice any whitespace, but try this trick:</p>
<ol>
<li>Remove the &#8220;&gt;&#8221; from the &#8220;?&gt;&#8221; tag at the end of file</li>
<li>Then keep holding Delete key (not backspace) for a few seconds. (*note that the cursor should be locate after the &#8220;?&#8221;)</li>
<li>You will notice some whitespace being deleted. Amazing isn&#8217;t it?</li>
<li>Add the &#8220;&gt;&#8221; after the &#8220;?&#8221; to properly close the php tag</li>
<li>Save the file, and try accessing it, the header information error should have been resolved</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.cowcomputing.com/2010/03/08/wordpress-error-cannot-modify-header-information/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML 5 nth-Child</title>
		<link>http://www.cowcomputing.com/2010/02/07/html-5-nth-child/</link>
		<comments>http://www.cowcomputing.com/2010/02/07/html-5-nth-child/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 08:45:15 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML5]]></category>

		<guid isPermaLink="false">http://www.cowcomputing.com/?p=174</guid>
		<description><![CDATA[As we all know, HTML 5 is on its way, and there&#8217;s going to be a huge addition to the current syntax. In this post, i shall share with you about the &#8220;nth-child&#8221; feature. Often, we would like to create a table or list with alternate row color as follow: // HTML Snippet &#60;div id="test-area"&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>As we all know, HTML 5 is on its way, and there&#8217;s going to be a huge addition to the current syntax. In this post, i shall share with you about the &#8220;nth-child&#8221; feature. Often, we would like to create a table or list with alternate row color as follow:</p>
<pre class="brush:html">// HTML Snippet
&lt;div id="test-area"&gt;
  &lt;ul&gt;
    &lt;li&gt;row 1&lt;/li&gt;
    &lt;li class="even-row"&gt;row 2&lt;/li&gt;
    &lt;li&gt;row 3&lt;/li&gt;
    &lt;li class="even-row"&gt;row 4&lt;/li&gt;
    &lt;li&gt;row 5&lt;/li&gt;
    &lt;li class="even-row"&gt;row 6&lt;/li&gt;
    &lt;li&gt;row 7&lt;/li&gt;
    &lt;li class="even-row"&gt;row 8&lt;/li&gt;
    &lt;li&gt;row 9&lt;/li&gt;
    &lt;li class="even-row"&gt;row 10&lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;
</pre>
<pre class="brush:css">// CSS Snippet
ul {
  list-style: none;
}

// color the even rows
.even-row {
  background-color: #ccc;
}
</pre>
<p><span id="more-174"></span>The above method is okay when you are working with simple rule, but how about if i only want 1, 7, 13, 19&#8230;(6n+1)th rows to be highlighted. Then you probably need to write some javascript and do calculation to do it. However, with HTML 5, we got a better yet easier way to accomplish this. We will be using the new property &#8220;nth-child&#8221;. Let me illustrate by rewriting the example above:</p>
<pre class="brush:html">// HTML Snippet
&lt;div id="test-area"&gt;
  &lt;ul&gt;
    &lt;li&gt;row 1&lt;/li&gt;
    &lt;li&gt;row 2&lt;/li&gt;
    &lt;li&gt;row 3&lt;/li&gt;
    &lt;li&gt;row 4&lt;/li&gt;
    &lt;li&gt;row 5&lt;/li&gt;
    &lt;li&gt;row 6&lt;/li&gt;
    &lt;li&gt;row 7&lt;/li&gt;
    &lt;li&gt;row 8&lt;/li&gt;
    &lt;li&gt;row 9&lt;/li&gt;
    &lt;li&gt;row 10&lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;
</pre>
<pre class="brush:css">// CSS Snippet
ul {
  list-style: none;
}

// Note that n is a special symbol here
li:nth-child(2n) {
  background-color: #ccc;
}
</pre>
<p>See the power of nth-child? We now no longer need to label alternate rows, instead, we use the nth-child property. We simply tell nth-child with the calculation (e.g. any integers like &#8220;1&#8243;, &#8220;3&#8243;, &#8220;5&#8243; or using the special &#8220;n&#8221; variable for help, like: &#8220;2n&#8221; representing alternative rows, &#8220;5n&#8221; representing every fifth rows or even the word &#8220;odd&#8221; and &#8220;even&#8221;&#8230; you might try to edit the code above to use &#8220;even&#8221; instead of &#8220;2n&#8221; to accomplish the same effect.), and it will apply the CSS for you. To learn more, you might try the <a href="http://www.cowcomputing.com/demo/nth-child-demo/">demo page</a> i made.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cowcomputing.com/2010/02/07/html-5-nth-child/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chinese URL &#8212; Good or Bad?</title>
		<link>http://www.cowcomputing.com/2009/12/08/chinese-url-good-or-bad/</link>
		<comments>http://www.cowcomputing.com/2009/12/08/chinese-url-good-or-bad/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 09:20:48 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Chinese]]></category>
		<category><![CDATA[ICANN]]></category>
		<category><![CDATA[non-latin]]></category>
		<category><![CDATA[URL]]></category>

		<guid isPermaLink="false">http://www.cowcomputing.com/?p=115</guid>
		<description><![CDATA[ICANN has announced the open-up of Non-Latin Characters&#8217; URL for registration. If everything is good, the service will commenced mid-2010. So there will be another battle of url registration. Afterall, is having Chinese URL available, good or bad? On the POSITIVE side: First, it creates lots more space/possibility for meaningful URL, as current latin url [...]]]></description>
			<content:encoded><![CDATA[<p>ICANN has announced the open-up of Non-Latin Characters&#8217; URL for registration. If everything is good, the service will commenced mid-2010. So there will be another battle of url registration.</p>
<p>Afterall, is having Chinese URL available, good or bad?</p>
<p>On the <strong>POSITIVE</strong> side: First, it creates lots more space/possibility for meaningful URL, as current latin url has been exhaustively registered by bulk registration. Meaningful and Short URL is hard to create. Second, chinese url is more familiar to chinese people and they can easily remembered the address. Third, It&#8217;s another $$ opportunity. Lastly, some proper rule could be implemented on top of the new registration procedure to reduce the chance of abusing url registration.</p>
<p>On the <strong>NEGATIVE</strong> side: First, chinese url doesn&#8217;t sound meaningful to any foreigner, and in particular, it requires users to know chinese typing in order to access the website, which limits business (of course, it could be solved by purchasing TWO sets of URL, Chinese and English). Second, on the technical aspect, it creates trouble for writing regular expression, since some programming language like PHP, doesn&#8217;t have a easy way to match unicode characters, and another set of regular expression specifically addressing unicode would need to be added to current working web app to extend its functionality to accommodate chinese url (e.g. to validate website address / email address). Third, headers (e.g. HTTP, SOAP or so&#8230;) will need to be able to handle unicode or at least Chinese Character, which is another big changes.</p>
<p>It could be seen that Chinese URL has its own use, but is it necessary?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cowcomputing.com/2009/12/08/chinese-url-good-or-bad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
