<?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</title>
	<atom:link href="http://www.cowcomputing.com/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</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>Mapping Network Drive in Windows 7</title>
		<link>http://www.cowcomputing.com/2010/06/05/mapping-network-drive-in-windows-7/</link>
		<comments>http://www.cowcomputing.com/2010/06/05/mapping-network-drive-in-windows-7/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 08:17:15 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Map Network Drive]]></category>
		<category><![CDATA[Security Policy]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://www.cowcomputing.com/?p=217</guid>
		<description><![CDATA[Unlike Windows XP, mapping a network drive in Windows 7 is a nightmare. It is possible that during the mapping of a network drive, no matter how hard you try to enter your credentials or the drive is actually password-less, it still prompt you for a password repeatedly. This is annoying and is due to [...]]]></description>
			<content:encoded><![CDATA[<p>Unlike Windows XP, mapping a network drive in Windows 7 is a nightmare. It is possible that during the mapping of a network drive, no matter how hard you try to enter your credentials or the drive is actually password-less, it still prompt you for a password repeatedly. This is annoying and is due to the security settings on Network Security. I shall introduce you two method to get around this annoying problem. *Do note that, for Windows 7 Home edition, the security setting is not available (RIDICULOUS isn&#8217;t it?), either you upgrade to Professional / Ultimate Edition or you could use Method 2 to achieve that (HURRAY!)</p>
<p><strong><span style="text-decoration: underline;">Method 1 (Windows 7 Professional / Ultimate Edition)</span></strong></p>
<ol>
<li>Under &#8220;Control Panel&#8221;, find &#8220;System and Security&#8221;</li>
<li>Open &#8220;Administrative Tools&#8221;</li>
<li>Double Click &#8220;Local Security Policy&#8221;</li>
<li>Expand &#8220;Local Policies&#8221;</li>
<li>Click &#8220;Security Options&#8221; and Scroll to find &#8220;Network Security: LAN Manager Authentication Level&#8221;</li>
<li>Choose &#8220;Send LM &amp; NTLM, use NTLMv2 session security is negotiated&#8221; for the drop down.</li>
<li>Done. you can now map network drive as normal (like in XP)</li>
</ol>
<p><span id="more-217"></span><br />
<strong><span style="text-decoration: underline;"> Method 2 (Windows 7 Home Edition)</span></strong></p>
<ol>
<li> Use notepad and save the snippet below as win7fix.reg
<pre class="brush:bash">Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"lmcompatibilitylevel"=dword:00000002</pre>
</li>
<li>Double click the win7fix.reg you just create to run it</li>
<li>Press &#8220;Yes&#8221; to add that into registry</li>
<li>Done. you can now map network drive as normal (like in XP)</li>
</ol>
<p><br/></p>
<h6>ref. <a href="http://www.ntnu.no/itinfo/read_article.php?aid=711">http://www.ntnu.no/itinfo/read_article.php?aid=711</a></h6>
]]></content:encoded>
			<wfw:commentRss>http://www.cowcomputing.com/2010/06/05/mapping-network-drive-in-windows-7/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>White List or Black List</title>
		<link>http://www.cowcomputing.com/2010/04/30/white-list-or-black-list/</link>
		<comments>http://www.cowcomputing.com/2010/04/30/white-list-or-black-list/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 13:56:39 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Black List]]></category>
		<category><![CDATA[Code Readability]]></category>
		<category><![CDATA[Logic]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[White List]]></category>

		<guid isPermaLink="false">http://www.cowcomputing.com/?p=211</guid>
		<description><![CDATA[Ever get stuck in deciding whether to use white list or black list during application development? Imagine, when you have to create an user management module, where certain users would have more access than the others. Will you pick white list or black list when you are writing the logic? e.g. White List &#60;?php // [...]]]></description>
			<content:encoded><![CDATA[<p>Ever get stuck in deciding whether to use white list or black list during application development? Imagine, when you have to create an user management module, where certain users would have more access than the others. Will you pick white list or black list when you are writing the logic? e.g.</p>
<p><span style="text-decoration: underline;"><strong>White List</strong></span></p>
<pre class="brush:php">&lt;?php

// White List
// userid from 1 to 10
if ($userid == 1 || 3 || 5) {
// then allow access to manager admin module
} else {
// normal member module
}

?&gt;</pre>
<p><span id="more-211"></span><br />
<span style="text-decoration: underline;"><strong>Black List</strong></span></p>
<pre class="brush:php">&lt;?php

// Black List
// userid from 1 to 10
if ($userid != 1 || 3 || 5) {
// normal member module
} else {
// then allow access to manager admin module
}

?&gt;</pre>
<p>Both White List and Black List has its own advantage. White List offers better control and security (take the above for instance, when you forgotten to add a particular userid to the black list, anonymous access to admin module would happen; while missing an userid in whitelist would simply cause that user not able to access admin module which is less damaging); while Black List can help reduce the length of the code to get the same logic done.</p>
<p>In my opinion, lots of developers would pick Black List as the preferred approach, since it&#8217;s shorter and faster to write.</p>
<p>There are two guideline which i would suggest to follow when making the decision:</p>
<ol>
<li>Security Concern: Try to use White List whenever possible since it provide better security (this is an important factor especially when your application is already serving more than million of people).</li>
<li>Efficiency: Only use Black List when you have a huge amount of checking to do, which make White List not reasonable. (e.g. White-Listing over thousands/millions of tags created by users)</li>
</ol>
<p>So far i have been following the above rules as far as possible, and it reduces logic bugs and gives better code readability.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cowcomputing.com/2010/04/30/white-list-or-black-list/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>Jailkit &#8211; Limit User Account on Linux</title>
		<link>http://www.cowcomputing.com/2010/03/12/jailkit-limit-user-account-on-linux/</link>
		<comments>http://www.cowcomputing.com/2010/03/12/jailkit-limit-user-account-on-linux/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 07:16:07 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[chroot]]></category>
		<category><![CDATA[User Account]]></category>

		<guid isPermaLink="false">http://www.cowcomputing.com/?p=201</guid>
		<description><![CDATA[There&#8217;s once I was required to setup a limited shell access user account on a commercial hardware product, in which to secure the original system from being modified and at the same time to provide a flexible environment for general work. I was on the way to make use of chroot command. Then i was [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s once I was required to setup a limited shell access user account on a commercial hardware product, in which to secure the original system from being modified and at the same time to provide a flexible environment for general work. I was on the way to make use of chroot command. Then i was lucky to came across <a href="http://olivier.sessink.nl/jailkit">Jailkit</a>, which saved me a lot of time. So, i would like to use this post to give a little introduction on how to use it.</p>
<pre class="brush:bash"># First, let's create a directory for the jail account
mkdir /jail
chown root:root /jail

# Then we create a new user account specially for jail account
# *replace &lt;group name&gt;, &lt;username&gt;, &lt;password&gt; with your own value
groupadd &lt;group name&gt;
useradd -d /home/jail -g &lt;group name&gt; -p &lt;password&gt; &lt;username&gt;

# For example, if we only want to allow the jail account to have ssh and basic shell access
jk_init -v -j /jail basicshell ssh

# Then we shall jail the user account we previously created to the jail directory
jk_jailuser -m -j /jail &lt;username&gt;
</pre>
<p><span id="more-201"></span><br />
Now the jail account and file system is ready, however if you want more control, we can do the following.</p>
<pre class="brush:bash"># OPTIONAL: Edit /jail/etc/passwd file and /jail/etc/group file to further limit the access
# The following further limit the user logged in jail account to have only access to bash
# Assume the jail user account &amp; group = jail_user, and we edit the passwd file
jail_user:x:1016:1016:/home/jail:/bin/bash

# edit group file
jail_user:x:1016
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cowcomputing.com/2010/03/12/jailkit-limit-user-account-on-linux/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>Finding Files with particular extension or Pattern in Java</title>
		<link>http://www.cowcomputing.com/2010/03/04/finding-files-with-particular-extension-or-pattern-in-java/</link>
		<comments>http://www.cowcomputing.com/2010/03/04/finding-files-with-particular-extension-or-pattern-in-java/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 09:16:53 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[Pattern]]></category>
		<category><![CDATA[RegExp]]></category>
		<category><![CDATA[Regular Expression]]></category>

		<guid isPermaLink="false">http://www.cowcomputing.com/?p=196</guid>
		<description><![CDATA[Often, to find a file with a particular extension or naming pattern within a directory, we might implement as below: // The directory which search would be conducted File directoryForSearch = new File("C:\folder"); // This may not be the best way to accomplish the task, please bear me with it File[] allFile = directoryForSearch.listFiles(); File[] [...]]]></description>
			<content:encoded><![CDATA[<p>Often, to find a file with a particular extension or naming pattern within a directory, we might implement as below:</p>
<pre class="brush:java">// The directory which search would be conducted
File directoryForSearch = new File("C:\folder");

// This may not be the best way to accomplish the task, please bear me with it
File[] allFile = directoryForSearch.listFiles();
File[] resultFile = new File[allFile.length];
int resultCount = 0;

// loop thru the list of files to find the required files
for(int i=0; i&lt;allFile.length; i++)
{
    if(allFile[i].getName().matches(".*\\.java")
    {
        resultFile[resultCount] = allFile[i];
        resultCount++;
    }
}</pre>
<p><span id="more-196"></span>In fact, there is a more convenient way to get the above task done. It&#8217;s not hard at all, however people might have often omitted it. We shall make use of &#8220;FilenameFilter&#8221; to filter the files instead of looping.</p>
<pre class="brush:java">// The directory which search would be conducted
File directoryForSearch = new File("C:\folder");

// Using FilenameFilter to do the filtering job
File[] resultFile = directoryForSearch.listFiles(new FilenameFilter()
{
    public boolean accept(File dir, String name)
    {
        // Here we try to match file with extension ".java"
        // Returning YES/TRUE indicate the acceptance of the file else ignore
        return name.matches(".*\\.java");
    }
}</pre>
<p>This code reduction and performance improvement would definitely help when one is trying to implement a complex file search.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cowcomputing.com/2010/03/04/finding-files-with-particular-extension-or-pattern-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some Hidden Mac&#8217;s Tips (Terminal Cmd)</title>
		<link>http://www.cowcomputing.com/2010/03/03/some-hidden-macs-tips-terminal-cmd/</link>
		<comments>http://www.cowcomputing.com/2010/03/03/some-hidden-macs-tips-terminal-cmd/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 14:27:36 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.cowcomputing.com/?p=192</guid>
		<description><![CDATA[In this post, i would like to share a couple of hidden terminal command on mac to help unlocking some useful feature. To use these feature, simply type the command as if it&#8217;s shown on the terminal, andd there you go. Using current Screensaver as the Wallpaper. This can be gorgeous, however, depending on which [...]]]></description>
			<content:encoded><![CDATA[<p>In this post, i would like to share a couple of hidden terminal command on mac to help unlocking some useful feature. To use these feature, simply type the command as if it&#8217;s shown on the terminal, andd there you go.</p>
<ol>
<li>Using current Screensaver as the Wallpaper. This can be gorgeous, however, depending on which screensaver you pick, it might take up some CPU &amp; memory. (*To stop it, simple press &#8220;Ctrl+C&#8221;)
<pre class="brush:bash">/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background
</pre>
</li>
<li>Enable hidden files/folders be shown on Finder. This is very useful in particular when you want to locate some important hidden files like &#8220;.ssh&#8221; or &#8220;.bash_rc&#8221;.
<pre class="brush:bash">// Change TRUE to FALSE to disable the effect
defaults write com.apple.finder AppleShowAllFiles YES

// Restart the finder to take effect
killall Finder</pre>
</li>
<li>Enable the highlight effect on Stack (Highlight the icon when mouse hover)
<pre class="brush:bash">// Change yes to no to cancel the effect
defaults write com.apple.dock mouse-over-hilte-stack -boolean yes

// Restart the Dock to take effect
killall Dock</pre>
</li>
<p><span id="more-192"></span></p>
<li>Allow dashboard widgets to be dragged and run on Desktop
<pre class="brush:bash">// Change YES to NO to cancel the effect
defaults write com.apple.dashboard devmode YES</pre>
</li>
<li>Enable debug menu for Safari. I use it alot when doing web development (tho i prefer firefox with firebug)
<pre class="brush:bash">// Change 1 to 0 to cancel the effect
defaults write com.apple.safari IncludeDebugMenu 1</pre>
</li>
<li>Disable the annoying crash report dialog.
<pre class="brush:bash">Change none to prompt to cancel the effect
defaults write com.apple.CrashReporter DialogType none</pre>
</li>
</ol>
<p>There are more useful commands around, and above are just some useful ones which i have been using.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cowcomputing.com/2010/03/03/some-hidden-macs-tips-terminal-cmd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fsutil &#8211; The Useful Administrative Tools in Windows</title>
		<link>http://www.cowcomputing.com/2010/02/08/fsutil-the-useful-administrative-tools-in-windows/</link>
		<comments>http://www.cowcomputing.com/2010/02/08/fsutil-the-useful-administrative-tools-in-windows/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 08:51:41 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[Fsutil]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://www.cowcomputing.com/?p=187</guid>
		<description><![CDATA[Fsutil is a command-line utility for performing file system related tasks,  such as displaying/managing file or drive properties, dismounting or extending a volume etc. Fsutil is a very powerful tool and is meant to be used by system administrator to perform advance operations. In this post, i will try to share my knowledge on fsutil [...]]]></description>
			<content:encoded><![CDATA[<p>Fsutil is a command-line utility for performing file system related tasks,  such as displaying/managing file or drive properties, dismounting or extending a volume etc. Fsutil is a very powerful tool and is meant to be used by system administrator to perform advance operations. In this post, i will try to share my knowledge on fsutil to perform some simple yet useful tasks.</p>
<p>(*Do learn about what you are doing before executing a command.)</p>
<p>1. Creating a file of a specific size instantly, e.g. 1GB</p>
<pre class="brush:bash"># fsutil file createnew &lt;filename&gt; &lt;filesize&gt;
fsutil file createnew testfile 1073741824
</pre>
<p><span id="more-187"></span>2. Disabling short file names. Default windows will create 8.3 character length file name for every file/folder you create. This is to provide compatibility to some program which based on DOS. Often, this is not needed, and can be set to true, which in turns speed up windows.</p>
<pre class="brush:bash"># fsutil behavior set disable8dot3 {1|0}
fsutil behavior set disable8dot3 1
</pre>
<p>3. Disabling timestamp for last access to a file. You might disable to function where windows keep track of the last access timestamp for files.</p>
<pre class="brush:bash"># fsutil behavior set disablelastaccess {1|0}
fsutil behavior set disablelastaccess 1
</pre>
<p>4. Disabling Vista&#8217;s Encryption File System. If security is not a concern, and your system is in need of extra resources, you might choose to disable to EFS that vista provides.</p>
<pre class="brush:bash"># fsutil behavior set disableencryption {1|0}
fsutil behavior set disableencryption 1
</pre>
<p>* 2 &amp; 3 &amp; 4, in fact behavior got another sub-command in addition to &#8220;set&#8221; &#8212; &#8220;query&#8221;. You may use it to query the current setting for a specific property.</p>
<pre class="brush:bash"># The following command can be used to query the current setting of disable8dot3
fsutil behavior query disable8dot3</pre>
<p>5. List all drives in a computer. This could easily retrieve and echo all the drives connected on this computer including remote drives.</p>
<pre class="brush:bash">fsutil fsinfo drives
</pre>
<p>6. Check a drive&#8217;s type e.g. CD-ROM. Sometimes, in script, you might use it to determine which drive is a CD-ROM.</p>
<pre class="brush:bash"># fsutil fsinfo drivetype &lt;volume name&gt;
fsutil fsinfo drivetype C:
</pre>
<p>7. List information for the specified drive. This shall show a list of supported properties such as &#8220;Case-sensitive File Name&#8221;, &#8220;Sparse Files&#8221; etc.</p>
<pre class="brush:bash"># fsutil fsinfo volumeinfo &lt;full volume path&gt;
fsutil fsinfo volumeinfo C:\
</pre>
<p>8. Query the free space of a drive. To identify how much free space is left exactly for a specific drive.</p>
<pre class="brush:bash"># fsutil volume diskfree &lt;volume name&gt;
fsutil volume diskfree C:
</pre>
<p>9. Dismount a volume. *Use it carefully*</p>
<pre class="brush:bash"># fsutil volume dismount &lt;full volume path&gt;
fsutil volume dismount C:\
</pre>
<p>Above only listed some useful command for your reference, and it&#8217;s not complete. For further information, you can refer to <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/fsutil.mspx?mfr=true">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cowcomputing.com/2010/02/08/fsutil-the-useful-administrative-tools-in-windows/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>
	</channel>
</rss>
