<?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>My Blog</title>
	<atom:link href="http://rewiv.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://rewiv.com/blog</link>
	<description>My Personal Blog</description>
	<lastBuildDate>Fri, 09 Apr 2010 20:22:47 +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>Finding Extensions in PHP without Reading the Mime Type</title>
		<link>http://rewiv.com/blog/2009/12/12/finding-extensions-in-php-without-reading-the-mime-type/</link>
		<comments>http://rewiv.com/blog/2009/12/12/finding-extensions-in-php-without-reading-the-mime-type/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 23:19:56 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[file handling]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://rewiv.com/blog/?p=26</guid>
		<description><![CDATA[<p>For all you geeks, finding an extension, cross platform, because application/type doesn&#8217;t always work with <span><span style="margin-left: 0px ! important;"><code>$_FILES</code><code>[</code><code>'file'</code><code>][</code><code>'type'</code><code>] </code></span></span>cross platform.</p>
<p><span id="more-26"></span></p>
<p>The mime information is read differently, I ran into this problem on unix when somebody uploaded a pdf edited on a windows machine.</p>
<pre>function findExt($f) {
<del datetime="2010-04-09T20:22:53+00:00"><span style="padding-left: 30px;">$var = $f;</span>
<span style="padding-left: 30px;">$explode = explode('.', $var);</span>
<span style="padding-left: 30px;">$num = count($explode);</span>
<span style="padding-left: 30px;">$ext = strtolower($explode[$num - 1]);</span>
<span style="padding-left: 30px;">return $ext;</span></del>

<span style="padding-left: 30px;">return substr(strrchr($f, '.'), 1);</span>
}</pre>
<p>Then call it as;</p>
<pre>if(in_array(findExt($file), $acceptedArray)) {
<span style="padding-left: 60px;">// Do Something</span>
} else {
<span style="padding-left: 60px;">// Do something else</span>
}</pre>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-german">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://rewiv.com/blog/2009/12/12/finding-extensions-in-php-without-reading-the-mime-type/&amp;t=Finding+Extensions+in+PHP+without+Reading+the+Mime+Type" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Finding+Extensions+in+PHP+without+Reading+the+Mime+Type+-+http://sl.ly/382e4&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-friendfeed">
			<a href="http://www.friendfeed.com/share?title=Finding+Extensions+in+PHP+without+Reading+the+Mime+Type&amp;link=http://rewiv.com/blog/2009/12/12/finding-extensions-in-php-without-reading-the-mime-type/" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a>
		</li>
		<li class="shr-pingfm">
			<a href="http://ping.fm/ref/?link=http://rewiv.com/blog/2009/12/12/finding-extensions-in-php-without-reading-the-mime-type/&amp;title=Finding+Extensions+in+PHP+without+Reading+the+Mime+Type&amp;body=For%20all%20you%20geeks%2C%20finding%20an%20extension%2C%20cross%20platform%2C%20because%20application%2Ftype%20doesn%27t%20always%20work%20with%20%24_FILES%5B%27file%27%5D%5B%27type%27%5D%20cross%20platform.%0D%0A%0D%0A%0D%0A%0D%0AThe%20mime%20information%20is%20read%20differently%2C%20I%20ran%20into%20this%20problem%20on%20unix%20when%20somebody%20uploaded%20a%20pdf%20edited%20on%20a%20windows%20machine.%0D%0Afunction%20find" rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://rewiv.com/blog/2009/12/12/finding-extensions-in-php-without-reading-the-mime-type/&amp;title=Finding+Extensions+in+PHP+without+Reading+the+Mime+Type" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://rewiv.com/blog/2009/12/12/finding-extensions-in-php-without-reading-the-mime-type/&amp;title=Finding+Extensions+in+PHP+without+Reading+the+Mime+Type" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://rewiv.com/blog/2009/12/12/finding-extensions-in-php-without-reading-the-mime-type/&amp;title=Finding+Extensions+in+PHP+without+Reading+the+Mime+Type" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://rewiv.com/blog/2009/12/12/finding-extensions-in-php-without-reading-the-mime-type/&amp;title=Finding+Extensions+in+PHP+without+Reading+the+Mime+Type" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-mail">
			<a href="mailto:?subject=%22Finding%20Extensions%20in%20PHP%20without%20Reading%20the%20Mime%20Type%22&amp;body=Link: http://rewiv.com/blog/2009/12/12/finding-extensions-in-php-without-reading-the-mime-type/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A For%20all%20you%20geeks%2C%20finding%20an%20extension%2C%20cross%20platform%2C%20because%20application%2Ftype%20doesn%27t%20always%20work%20with%20%24_FILES%5B%27file%27%5D%5B%27type%27%5D%20cross%20platform.%0D%0A%0D%0A%0D%0A%0D%0AThe%20mime%20information%20is%20read%20differently%2C%20I%20ran%20into%20this%20problem%20on%20unix%20when%20somebody%20uploaded%20a%20pdf%20edited%20on%20a%20windows%20machine.%0D%0Afunction%20find" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></description>
		<wfw:commentRss>http://rewiv.com/blog/2009/12/12/finding-extensions-in-php-without-reading-the-mime-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restricting an input field to only numbers with preg_match_all() (PHP)</title>
		<link>http://rewiv.com/blog/2009/05/07/restricting-an-input-field-to-only-numbers-with-preg_match_all-php/</link>
		<comments>http://rewiv.com/blog/2009/05/07/restricting-an-input-field-to-only-numbers-with-preg_match_all-php/#comments</comments>
		<pubDate>Thu, 07 May 2009 21:12:09 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[validate]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://rewiv.com/blog/?p=15</guid>
		<description><![CDATA[<p>This is a pretty easy way to restrict a field to only numbers.<br />
The \D in the preg match is short for [^0-9], which will match all characters, except 0-9.<br />
I&#8217;m new to the regex, so there might be a better way to do this.  But this works for me.</p>
<p><span id="more-15"></span><br />
I like to do all the validating on the server side, just in case someone has javascript disabled.</p>
<pre>&lt;?php
	if(isset($_POST['submit'])) {

		preg_match_all("/\D/i", $_POST['number'], $matches);

		if(!$matches[0][0]) {

			print("Your right " . $_POST['number'] . " is a number!");
				exit;

		}
		else {

			print("That is not a number!");
			exit;
		}

	}

?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;

&lt;head&gt;
	&lt;title&gt;Preg Match All&lt;/title&gt;
	&lt;meta http-equiv="content-type" content="text/html;charset=utf-8" /&gt;
	&lt;meta name="generator" content="Geany 0.18svn" /&gt;
&lt;/head&gt;

&lt;body&gt;
	&lt;form id="preg_match_all" name="preg_match_all" method="post" action="&lt;?php $_SERVER['PHP_SELF']; ?&gt;"&gt;
		Enter a Number : &lt;input type="text" name="number" /&gt;
		&lt;input type="submit" value="submit" name="submit" /&gt;
	&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-german">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://rewiv.com/blog/2009/05/07/restricting-an-input-field-to-only-numbers-with-preg_match_all-php/&amp;t=Restricting+an+input+field+to+only+numbers+with+preg_match_all%28%29+%28PHP%29" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Restricting+an+input+field+to+only+numbers+with+preg_match_all%28%29+%28PHP%29+-+http://sl.ly/9ecaf&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-friendfeed">
			<a href="http://www.friendfeed.com/share?title=Restricting+an+input+field+to+only+numbers+with+preg_match_all%28%29+%28PHP%29&amp;link=http://rewiv.com/blog/2009/05/07/restricting-an-input-field-to-only-numbers-with-preg_match_all-php/" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a>
		</li>
		<li class="shr-pingfm">
			<a href="http://ping.fm/ref/?link=http://rewiv.com/blog/2009/05/07/restricting-an-input-field-to-only-numbers-with-preg_match_all-php/&amp;title=Restricting+an+input+field+to+only+numbers+with+preg_match_all%28%29+%28PHP%29&amp;body=This%20is%20a%20pretty%20easy%20way%20to%20restrict%20a%20field%20to%20only%20numbers.%0D%0AThe%20%5CD%20in%20the%20preg%20match%20is%20short%20for%20%5B%5E0-9%5D%2C%20which%20will%20match%20all%20characters%2C%20except%200-9.%0D%0AI%27m%20new%20to%20the%20regex%2C%20so%20there%20might%20be%20a%20better%20way%20to%20do%20this.%20%20But%20this%20works%20for%20me.%0D%0A%0D%0A%0D%0AI%20like%20to%20do%20all%20the%20validating%20on%20the%20server%20side" rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://rewiv.com/blog/2009/05/07/restricting-an-input-field-to-only-numbers-with-preg_match_all-php/&amp;title=Restricting+an+input+field+to+only+numbers+with+preg_match_all%28%29+%28PHP%29" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://rewiv.com/blog/2009/05/07/restricting-an-input-field-to-only-numbers-with-preg_match_all-php/&amp;title=Restricting+an+input+field+to+only+numbers+with+preg_match_all%28%29+%28PHP%29" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://rewiv.com/blog/2009/05/07/restricting-an-input-field-to-only-numbers-with-preg_match_all-php/&amp;title=Restricting+an+input+field+to+only+numbers+with+preg_match_all%28%29+%28PHP%29" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://rewiv.com/blog/2009/05/07/restricting-an-input-field-to-only-numbers-with-preg_match_all-php/&amp;title=Restricting+an+input+field+to+only+numbers+with+preg_match_all%28%29+%28PHP%29" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-mail">
			<a href="mailto:?subject=%22Restricting%20an%20input%20field%20to%20only%20numbers%20with%20preg_match_all%28%29%20%28PHP%29%22&amp;body=Link: http://rewiv.com/blog/2009/05/07/restricting-an-input-field-to-only-numbers-with-preg_match_all-php/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A This%20is%20a%20pretty%20easy%20way%20to%20restrict%20a%20field%20to%20only%20numbers.%0D%0AThe%20%5CD%20in%20the%20preg%20match%20is%20short%20for%20%5B%5E0-9%5D%2C%20which%20will%20match%20all%20characters%2C%20except%200-9.%0D%0AI%27m%20new%20to%20the%20regex%2C%20so%20there%20might%20be%20a%20better%20way%20to%20do%20this.%20%20But%20this%20works%20for%20me.%0D%0A%0D%0A%0D%0AI%20like%20to%20do%20all%20the%20validating%20on%20the%20server%20side" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></description>
		<wfw:commentRss>http://rewiv.com/blog/2009/05/07/restricting-an-input-field-to-only-numbers-with-preg_match_all-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install your Linksys WMP110 wireless card on linux</title>
		<link>http://rewiv.com/blog/2008/09/08/how-to-install-your-linksys-wmp110-wireless-gn-card-on-linux/</link>
		<comments>http://rewiv.com/blog/2008/09/08/how-to-install-your-linksys-wmp110-wireless-gn-card-on-linux/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 23:20:04 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[drivers]]></category>
		<category><![CDATA[ndiswrapper]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://www.rewiv.com/blog/?p=1</guid>
		<description><![CDATA[<p>I run Ubuntu, but I imaging it would probably be the same for most distributions.<br />
Install ndiswrapper, use your repos package search.  On Ubuntu it is already installed.</p>
<p><span id="more-1"></span><br />
<code><br />
yum search ndiswrapper<br />
</code><br />
or<br />
<code><br />
aptitude search ndiswrapper.<br />
</code></p>
<p>If you need to build from source, check out this <a title="How-To: Compile ndiswrapper" href="http://ubuntuforums.org/showthread.php?t=104539&amp;highlight=compile+ndiswrapper+source" target="_blank">post</a>.</p>
<p>Download the driver files <a href="http://rewiv.com/blog/wp-content/uploads/2008/11/ar5416.tar.bz2">here</a>.  You can also snag them from the cd that comes with your Linksys card.</p>
<p><code><br />
tar -jxvf ar5416.tar.bz2<br />
cd ar5416<br />
ndiswrapper -i net5416.inf<br />
</code></p>
<p>Not sure if you have to use all three of these, but I do just cause it makes me feel better.</p>
<p><code><br />
ndiswrapper -m<br />
ndiswrapper -mi<br />
ndiswrapper -ma<br />
</code></p>
<p>then</p>
<p><code><br />
sudo modprobe -r ndiswrapper<br />
sudo modprobe ndiswrapper<br />
</code></p>
<p>This is what worked for me.</p>
<p>Hope it works for you.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-german">
<ul class="socials">
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://rewiv.com/blog/2008/09/08/how-to-install-your-linksys-wmp110-wireless-gn-card-on-linux/&amp;t=How+to+install+your+Linksys+WMP110+wireless+card+on+linux" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=How+to+install+your+Linksys+WMP110+wireless+card+on+linux+-+http://sl.ly/745d2&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-friendfeed">
			<a href="http://www.friendfeed.com/share?title=How+to+install+your+Linksys+WMP110+wireless+card+on+linux&amp;link=http://rewiv.com/blog/2008/09/08/how-to-install-your-linksys-wmp110-wireless-gn-card-on-linux/" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a>
		</li>
		<li class="shr-pingfm">
			<a href="http://ping.fm/ref/?link=http://rewiv.com/blog/2008/09/08/how-to-install-your-linksys-wmp110-wireless-gn-card-on-linux/&amp;title=How+to+install+your+Linksys+WMP110+wireless+card+on+linux&amp;body=I%20run%20Ubuntu%2C%20but%20I%20imaging%20it%20would%20probably%20be%20the%20same%20for%20most%20distributions.%0D%0AInstall%20ndiswrapper%2C%20use%20your%20repos%20package%20search.%20%20On%20Ubuntu%20it%20is%20already%20installed.%0D%0A%0D%0A%0D%0A%0D%0A%0D%0Ayum%20search%20ndiswrapper%0D%0A%0D%0Aor%0D%0A%0D%0Aaptitude%20search%20ndiswrapper.%0D%0A%0D%0A%0D%0AIf%20you%20need%20to%20build%20from%20source%2C%20check%20out%20this%20post." rel="nofollow" class="external" title="Ping this on Ping.fm">Ping this on Ping.fm</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://rewiv.com/blog/2008/09/08/how-to-install-your-linksys-wmp110-wireless-gn-card-on-linux/&amp;title=How+to+install+your+Linksys+WMP110+wireless+card+on+linux" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://rewiv.com/blog/2008/09/08/how-to-install-your-linksys-wmp110-wireless-gn-card-on-linux/&amp;title=How+to+install+your+Linksys+WMP110+wireless+card+on+linux" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://rewiv.com/blog/2008/09/08/how-to-install-your-linksys-wmp110-wireless-gn-card-on-linux/&amp;title=How+to+install+your+Linksys+WMP110+wireless+card+on+linux" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://rewiv.com/blog/2008/09/08/how-to-install-your-linksys-wmp110-wireless-gn-card-on-linux/&amp;title=How+to+install+your+Linksys+WMP110+wireless+card+on+linux" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-mail">
			<a href="mailto:?subject=%22How%20to%20install%20your%20Linksys%20WMP110%20wireless%20card%20on%20linux%22&amp;body=Link: http://rewiv.com/blog/2008/09/08/how-to-install-your-linksys-wmp110-wireless-gn-card-on-linux/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A I%20run%20Ubuntu%2C%20but%20I%20imaging%20it%20would%20probably%20be%20the%20same%20for%20most%20distributions.%0D%0AInstall%20ndiswrapper%2C%20use%20your%20repos%20package%20search.%20%20On%20Ubuntu%20it%20is%20already%20installed.%0D%0A%0D%0A%0D%0A%0D%0A%0D%0Ayum%20search%20ndiswrapper%0D%0A%0D%0Aor%0D%0A%0D%0Aaptitude%20search%20ndiswrapper.%0D%0A%0D%0A%0D%0AIf%20you%20need%20to%20build%20from%20source%2C%20check%20out%20this%20post." rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></description>
		<wfw:commentRss>http://rewiv.com/blog/2008/09/08/how-to-install-your-linksys-wmp110-wireless-gn-card-on-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
