<?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"
	>

<channel>
	<title>ChrisDevBox</title>
	<atom:link href="http://www.chrisdevbox.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chrisdevbox.com/blog</link>
	<description>Chrisdevbox updates!</description>
	<pubDate>Tue, 21 Oct 2008 22:37:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>How to install FFMPEG on CentOS (The easy way)</title>
		<link>http://www.chrisdevbox.com/blog/2008/10/21/how-to-install-ffmpeg-on-centos-the-easy-way/</link>
		<comments>http://www.chrisdevbox.com/blog/2008/10/21/how-to-install-ffmpeg-on-centos-the-easy-way/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 22:36:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[How to]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Utility]]></category>

		<category><![CDATA[encoding]]></category>

		<category><![CDATA[ffmpeg]]></category>

		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.chrisdevbox.com/blog/?p=39</guid>
		<description><![CDATA[
If you are looking to do some video encoding the &#8220;cheap&#8221; way, then you need to install FFMPEG.  If you are a CentOS junkie like me, then this is how you do it:

Code:
vi /etc/yum.repos.d/dag.repo

Insert

Code:
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

Now run yum update
After that look for ffmpeg (yum list ffmpeg) and install it&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" src="http://ffmpeg.mplayerhq.hu/ffmpeg-logo.png" alt="" /></p>
<p>If you are looking to do some video encoding the &#8220;cheap&#8221; way, then you need to install FFMPEG.  If you are a CentOS junkie like me, then this is how you do it:</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Code:</div>
<pre class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; height: 34px; text-align: left;" dir="ltr">vi /etc/yum.repos.d/dag.repo</pre>
</div>
<p>Insert</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">Code:</div>
<pre class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; height: 98px; text-align: left;" dir="ltr">[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1</pre>
</div>
<p>Now run yum update</p>
<p>After that look for ffmpeg (yum list ffmpeg) and install it&#8230; (yum install ffmpeg)</p>
<p>That&#8217;s it! On my next post I&#8217;ll add some ffmpeg tricks and tips.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdevbox.com/blog/2008/10/21/how-to-install-ffmpeg-on-centos-the-easy-way/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Testing Video Comments</title>
		<link>http://www.chrisdevbox.com/blog/2008/09/17/testing-video-comments/</link>
		<comments>http://www.chrisdevbox.com/blog/2008/09/17/testing-video-comments/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 05:43:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Utility]]></category>

		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[video comment]]></category>

		<guid isPermaLink="false">http://www.chrisdevbox.com/blog/?p=38</guid>
		<description><![CDATA[So, I&#8217;m researching video comments&#8230; I ran into Riffly.  They happen to have a plugin for Wordpress.  The only drawback is that little ad at the bottom and the super pixelated output&#8230; but is FREE, so who cares. 
TO test, please add a comment.  
http://riffly.com/
]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;m researching video comments&#8230; I ran into Riffly.  They happen to have a plugin for Wordpress.  The only drawback is that little ad at the bottom and the super pixelated output&#8230; but is FREE, so who cares. </p>
<p>TO test, please add a comment.  </p>
<p>http://riffly.com/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdevbox.com/blog/2008/09/17/testing-video-comments/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The inside scoop on Wikipedia &#038; DBpedia.org</title>
		<link>http://www.chrisdevbox.com/blog/2008/06/30/the-inside-scoop-on-wikipedia-and-dbpedia-org/</link>
		<comments>http://www.chrisdevbox.com/blog/2008/06/30/the-inside-scoop-on-wikipedia-and-dbpedia-org/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 07:45:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Cache]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Semantic Web]]></category>

		<category><![CDATA[dbpedia]]></category>

		<category><![CDATA[freebase]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[rdf]]></category>

		<category><![CDATA[semantic]]></category>

		<category><![CDATA[wikipedia]]></category>

		<guid isPermaLink="false">http://www.chrisdevbox.com/blog/?p=30</guid>
		<description><![CDATA[
Since the creation and launch of Wikipedia back in 2001 many people from all over the world have been busy collaborating, adding and updating content on this very popular wiki web.
The wiki concept started a long time ago  back in the early 1990&#8217;s, nevertheless, Wikipedia, even though it hasn&#8217;t been around too long, it [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.chrisdevbox.com/blog/wp-content/uploads/2008/06/dbpedia_logo.png"><img class="alignnone size-medium wp-image-32" title="dbpedia_logo" src="http://www.chrisdevbox.com/blog/wp-content/uploads/2008/06/dbpedia_logo.png" alt="" width="194" height="120" /></a><a href="http://www.chrisdevbox.com/blog/wp-content/uploads/2008/06/600px-wikipedia-logopreview.png"><img class="alignnone size-thumbnail wp-image-33" title="600px-wikipedia-logopreview" src="http://www.chrisdevbox.com/blog/wp-content/uploads/2008/06/600px-wikipedia-logopreview-150x150.png" alt="" width="150" height="150" /></a></p>
<p>Since the creation and launch of Wikipedia back in 2001 many people from all over the world have been busy collaborating, adding and updating content on this very popular wiki web.</p>
<p>The <a href="http://en.wikipedia.org/wiki/Wiki" target="_blank">wiki</a> concept started a long time ago  back in <a href="http://c2.com/cgi/wiki" target="_blank">the early 1990&#8217;s</a>, nevertheless, Wikipedia, even though it hasn&#8217;t been around too long, it is by far the biggest and most active wiki on the web.</p>
<p>The amount of valuable data that has been accumulating on Wikipedia is already in the millions.  The biggest challenge now is making all of that data relevant and meaningful to users exploring and searching for information.</p>
<p>Most people arrive into Wikipedia via Google&#8230; for example, if you do a quick google search on pretty much anything you&#8217;ll most likely get Wikipedia at the very top of the search results.  That&#8217;s due to Wikipedia&#8217;s huge link popularity and <a href="http://www.google.com/corporate/tech.html" target="_blank">page ranking</a> (Different topic).</p>
<p><span id="more-30"></span></p>
<p>Although Wikipedia is public and the data in it is rich and can be used or referenced anywhere on the web,  because of the simple nature of a Wiki, the data structure inside Wikipedia articles are a total mess, thats in terms of database schema.</p>
<p>This creates a real challenge when you need to extract and use the data somewhere else.  Well, a few companies out there are trying to solve that problem and create a data structure on top of Wikipedia.  One these companies is DBpedia.org.</p>
<p>In their own words:</p>
<blockquote><p><a href="http://wiki.dbpedia.org/About" target="_blank"><strong>DBpedia</strong></a> is a community effort to extract structured information from Wikipedia and to make this information available on the Web. DBpedia allows you to ask sophisticated queries against Wikipedia and to link other datasets on the Web to Wikipedia data.</p></blockquote>
<p>With companies like DBpedia facilitating this data structure many other companies are now tackling the &#8220;relevancy&#8221; and &#8220;meaningful&#8221; challenge with Wikipedia&#8217;s vast amount of information. For example <a href="http://wiki.dbpedia.org/About" target="_blank">Powerset.com</a> and <a href="http://www.freebase.com/" target="_blank">Freebase.com.<br />
</a></p>
<p>Well, I decided to do my own experiment.  I downloaded the title and short abstract datasets from DBpedia.org and loaded them into mysql.  I think I used up about 5 gigs of space on my server during this process.  Anyway, I also added a search / typeahead / auto-complete feature.</p>
<p>Initially this was taking a LONG time to query/wildcard against 2+million records, so I decided to add 200k records into a <a href="http://dev.mysql.com/doc/refman/5.0/en/memory-storage-engine.html" target="_blank">MEMORY table in MySQL </a>and that worked really nicely&#8230; took about 3 hours to load the heap though!</p>
<p>Obviously, if you were doing this for comercial purposes you would build something a lot more robust!</p>
<p>Without further a due here is the example:</p>
<p><a href="http://www.chrisdevbox.com/lab/dbpedia/index.html">http://www.chrisdevbox.com/lab/dbpedia/index.html</a></p>
<p>And here is a quick screenshot:</p>
<p><a href="http://www.chrisdevbox.com/lab/dbpedia/index.html" target="_self"><img class="alignnone size-medium wp-image-31" title="picture-2" src="http://www.chrisdevbox.com/blog/wp-content/uploads/2008/06/picture-2-300x256.png" alt="" width="300" height="256" /></a></p>
<p>If you would like to know the recipe on how I created the above example send me a comment/note&#8230; I might post a tutorial! <img src='http://www.chrisdevbox.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdevbox.com/blog/2008/06/30/the-inside-scoop-on-wikipedia-and-dbpedia-org/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Why should you avoid .htaccess files</title>
		<link>http://www.chrisdevbox.com/blog/2008/06/26/why-should-you-avoid-htaccess-files/</link>
		<comments>http://www.chrisdevbox.com/blog/2008/06/26/why-should-you-avoid-htaccess-files/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 14:20:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Apache]]></category>

		<category><![CDATA[Performance]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://www.chrisdevbox.com/blog/?p=25</guid>
		<description><![CDATA[
In order to make Apache .htaccess work on your servers you also need to add the AllowOverride directive inside
The first of these is performance. When AllowOverride is set to allow the use of .htaccess files, Apache will look in every directory for .htaccess files. Thus, permitting .htaccess files causes a performance hit, whether or not [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.chrisdevbox.com/blog/wp-content/uploads/2008/06/apache_logo2.png"><img class="aligncenter size-medium wp-image-28" title="apache_logo2" src="http://www.chrisdevbox.com/blog/wp-content/uploads/2008/06/apache_logo2.png" alt="" width="150" height="149" /></a></p>
<p>In order to make Apache .htaccess work on your servers you also need to add the AllowOverride directive inside</p>
<blockquote><p>The first of these is performance. When AllowOverride is set to allow the use of .htaccess files, Apache will look in every directory for .htaccess files. Thus, permitting .htaccess files causes a performance hit, whether or not you actually even use them! Also, the .htaccess file is loaded every time a document is requested.</p></blockquote>
<p>If you are running a big site and you are concern about performance then you should start by removing .htaccess files and moving them to your config director.</p>
<p><span id="more-25"></span></p>
<p>Most distributions have a directory from which any file that ends with .conf gets included when you restart Apache (Example RedHat/Fedora/Centos: /etc/httpd/conf.d).</p>
<blockquote><p>The second consideration is one of security. You are permitting users to modify server configuration, which may result in changes over which you have no control. Carefully consider whether you want to give your users this privilege. Note also that giving users less privileges than they need will lead to additional technical support requests. Make sure you clearly tell your users what level of privileges you have given them. Specifying exactly what you have set <code class="directive"><a href="http://www.chrisdevbox.com/blog/mod/core.html#allowoverride">AllowOverride</a></code> to, and pointing them to the relevant documentation, will save yourself a lot of confusion later.</p></blockquote>
<p>You can find all this info at the <a href="http://httpd.apache.org/docs/2.0/howto/htaccess.html">Apache website as well</a>.  Is worth reading it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdevbox.com/blog/2008/06/26/why-should-you-avoid-htaccess-files/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Quick guide on how to choose a programming language</title>
		<link>http://www.chrisdevbox.com/blog/2008/06/17/quick-guide-on-how-to-choose-a-programming-language/</link>
		<comments>http://www.chrisdevbox.com/blog/2008/06/17/quick-guide-on-how-to-choose-a-programming-language/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 22:19:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[How to]]></category>

		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[c#]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.chrisdevbox.com/blog/?p=23</guid>
		<description><![CDATA[I know, is not an easy thing, just don&#8217;t go with your gut feeling, make a solid assessment based your own experience, market, location and type of project (Just to keep it simple).
Most programmers will lean towards their favorite programming language and will give you a biased opinion. Some are more objective and willing to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.chrisdevbox.com/blog/wp-content/uploads/2008/06/trends_programming.gif"></a>I know, is not an easy thing, just don&#8217;t go with your gut feeling, make a solid assessment based your own experience, market, location and type of project (Just to keep it simple).</p>
<p>Most programmers will lean towards their favorite programming language and will give you a biased opinion. Some are more objective and willing to see beyond their comfort zone.</p>
<p><span id="more-23"></span></p>
<p>If you are in a position of leadership you need to be able to make that decision without too much hesitation.</p>
<p>Things you need to consider:</p>
<ol>
<li><strong>Experience</strong>: Although your decision should not be made based on your strongest programming language experience does play a big part. </li>
<li><strong>Market</strong>: What programming language has the most resources out there (Code samples, forums, etc). You can test by doing a quick search with simple terms like &#8220;Threads C#&#8221; or &#8220;Database PHP&#8221; using Google.</li>
<li><strong>Location</strong>: What is the predominant programming language in your area? You can find out by doing a quick local search on popular career search engines like monster.com or careerbuilder.com.  This is important when you need to staff up. </li>
<li><strong>Type</strong>: This is probably the most important one. You need to pick the right language for the right type of project. Let&#8217;s say you wanted to build a new wiki site. The logical thing to do is to use mediawiki (PHP) instead of writing a wiki from scratch using C# or Java.</li>
</ol>
<p>I&#8217;m trying to keep it simple, there are other criteria you need to consider, but these are the most important I believe. Please send me comments if you feel I&#8217;m missing anything.</p>
<p>Here is a <a href="http://www.google.com/trends?q=c%23%2C+php%2C+java%2C+python%2C+rubi&amp;ctab=0&amp;geo=US&amp;geor=all&amp;date=all&amp;sort=0" target="_blank">quick Google trends report </a>on language popularity.  Dont&#8217; use this to base your decision though! <img src='http://www.chrisdevbox.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><img class="aligncenter size-full wp-image-24" title="Programming Language Trends" src="http://www.chrisdevbox.com/blog/wp-content/uploads/2008/06/trends_programming.gif" alt="" width="587" height="283" /></p>
<p>If you need help picking a programming a language post a comment.  I&#8217;ll try to help.</p>
<p>Also, you can never go wrong with C#, PHP or Java.  Some people may argue that PHP or C# are not high performance. </p>
<p>PHP has a few really good case studies such as Digg.com, Facebook.com and Chickipedia.com.  C# has microsoft.com and of course BREAK.COM! </p>
<p>These are sites sustaining huge amounts of traffic, but they execute really fast because of the way they were built and scaled.</p>
<p>The key is knowing how to scale! The challenge is finding good architects and programmers, which I&#8217;ll cover on a different article.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdevbox.com/blog/2008/06/17/quick-guide-on-how-to-choose-a-programming-language/feed/</wfw:commentRss>
		</item>
		<item>
		<title>YouTube video downloader DEMO (Video)</title>
		<link>http://www.chrisdevbox.com/blog/2008/06/16/youtube-downloader-demo-wvideo/</link>
		<comments>http://www.chrisdevbox.com/blog/2008/06/16/youtube-downloader-demo-wvideo/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 06:37:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[DEMO]]></category>

		<category><![CDATA[Hacks]]></category>

		<category><![CDATA[Utility]]></category>

		<category><![CDATA[downloader]]></category>

		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://www.chrisdevbox.com/blog/?p=22</guid>
		<description><![CDATA[Earlier post: http://www.chrisdevbox.com/blog/2008/06/09/youtube-video-downloader/

]]></description>
			<content:encoded><![CDATA[<p>Earlier post: <a href="http://www.chrisdevbox.com/blog/2008/06/09/youtube-video-downloader/">http://www.chrisdevbox.com/blog/2008/06/09/youtube-video-downloader/</a><br />
<object width="464" height="392"><param name="movie" value="http://embed.break.com/NTIwOTMw"></param><param name="allowScriptAccess" value="always"></param><embed src="http://embed.break.com/NTIwOTMw" type="application/x-shockwave-flash" width="464" height="392"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdevbox.com/blog/2008/06/16/youtube-downloader-demo-wvideo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to display your Break.com videos on your website, simple JS/JSON hack</title>
		<link>http://www.chrisdevbox.com/blog/2008/06/14/how-to-display-your-breakcom-videos-on-your-website-simple-jsjson-hack/</link>
		<comments>http://www.chrisdevbox.com/blog/2008/06/14/how-to-display-your-breakcom-videos-on-your-website-simple-jsjson-hack/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 02:29:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Hacks]]></category>

		<category><![CDATA[Mashup]]></category>

		<category><![CDATA[break.com]]></category>

		<category><![CDATA[JSON]]></category>

		<category><![CDATA[web api]]></category>

		<guid isPermaLink="false">http://www.chrisdevbox.com/blog/?p=21</guid>
		<description><![CDATA[This is a simple and easy tutorial on how to retrieve (in real-time) all your videos from break.com and put them on your website using JavaScript.
In real-time meaning a call to break.com&#8217;s WEB API will be made every time you reload the page.
Now, this is not a feature they have exposed to the public yet, [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple and easy tutorial on how to retrieve (in real-time) all your videos from break.com and put them on your website using JavaScript.</p>
<p>In real-time meaning a call to break.com&#8217;s WEB API will be made every time you reload the page.</p>
<blockquote><p>Now, this is not a feature they have exposed to the public yet, but it is there in case you are nerdy enough to figure it out.  So this is really a good ol&#8217; innocent hack <img src='http://www.chrisdevbox.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p></blockquote>
<p><span id="more-21"></span></p>
<p>Anyway, here is how you do it</p>
<ol>
<li>First, before we get started you need to install <a href="https://addons.mozilla.org/en-US/firefox/addon/1843">firebug </a>(Firefox plugin) or <a href="http://www.charlesproxy.com/">charles proxy</a> (or any other http packet sniffer you are familiar with)</li>
<li>Get familiar packet sniffing, go to a few sites, check the requests and responses.</li>
<li>Ok, now go to the site and navigate your break.com home page (example: break.com/ScarFace)</li>
<li>Inside Charles or Firebug look for a URL request that starts with profile-websvc.break.com (pretty fancy naming convention, I wonder who came up with it)</li>
<li>Now look for a URL that has the following path: /Membership/Handlers/Profile/Folders/</li>
<li>Copy the full URL, should be something like this</li>
</ol>
<p><a href="http://profile-websvc.break.com/Membership/Handlers/Profile/Folders/FolderHandler.ashx?" target="_blank">http://profile-websvc.break.com/Membership/Handlers/Profile/Folders/FolderHandler.ashx?<br />
invoke=getmemberfoldertree&amp;siteId=1&amp;mid=YmZgonOnC5zw2zpAB1Bnkw==&amp;<br />
callback=breakFoldersObj.renderContentFolders&amp;noCacheIE=1213496038109</a></p>
<p><em>Note: The above is a JSON string encapsulated inside a callback/wrapper method.</em></p>
<p>Now you probably don&#8217;t need the whole thing (URL), but for this example we will.  If you click on the link above (Inside Firefox) it will display the JSON string for ya and the callback function.  If you are a savvy JavaScript developer that&#8217;s all you need and you can go on and build your mashup.</p>
<p>If you need some extra help you can take a look at my own example here:</p>
<p><a href="http://www.chrisdevbox.com/lab/breakapi/myvideos.html">http://www.chrisdevbox.com/lab/breakapi/myvideos.html</a></p>
<p>In order to make the embeds work you&#8217;ll need to download the base64 js utility.</p>
<p>Here is the full source</p>
<p><a href="http://www.chrisdevbox.com/lab/breakapi/myvideos.code.html">http://www.chrisdevbox.com/lab/breakapi/myvideos.code.html</a></p>
<p>You&#8217;ll see the call to the base64 utils in there.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdevbox.com/blog/2008/06/14/how-to-display-your-breakcom-videos-on-your-website-simple-jsjson-hack/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The mistery behind cookies&#8230; are they good or bad?</title>
		<link>http://www.chrisdevbox.com/blog/2008/06/12/the-mistery-behind-cookies-are-they-good-or-bad/</link>
		<comments>http://www.chrisdevbox.com/blog/2008/06/12/the-mistery-behind-cookies-are-they-good-or-bad/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 23:09:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Hacks]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[cookies]]></category>

		<category><![CDATA[hack]]></category>

		<category><![CDATA[http]]></category>

		<category><![CDATA[packet]]></category>

		<guid isPermaLink="false">http://www.chrisdevbox.com/blog/?p=19</guid>
		<description><![CDATA[Cookies are great, I eat them all the time, however, this article is about a different type of cookie.  Browser /HTTP cookies.  The big question is: Are HTTP cookies good or bad.  I keep getting this question from non-techy people and some techy people &#8220;think&#8221; they know the answer&#8230; (Including me! jk)
I [...]]]></description>
			<content:encoded><![CDATA[<p>Cookies are great, I eat them all the time, however, this article is about a different type of cookie.  Browser /HTTP cookies.  The big question is: Are HTTP cookies good or bad.  I keep getting this question from non-techy people and some techy people &#8220;think&#8221; they know the answer&#8230; (Including me! jk)</p>
<p>I don&#8217;t have the right answer, but I&#8217;ll clarify things for you, and then you can make your own judgement whether cookies are good or bad.</p>
<blockquote><p>Is really how you used them.  In the hands of a sloppy programmer HTTP cookies can be VERY bad, but if you are a good and detailed-oriented programmer, cookies are going to be VERY good (sometimes!)</p></blockquote>
<p><em>&#8220;The term &#8220;cookie&#8221; is derived from &#8220;</em><a title="Magic cookie" href="http://en.wikipedia.org/wiki/Magic_cookie"><em>magic cookie</em></a><em>,&#8221; a well-known concept in UNIX computing which inspired both the idea and the name of HTTP cookies&#8221;. - Wikipedia</em> In a nutshell, cookies are text files stored in your computer containing data that&#8217;s typically set by a server.</p>
<p>In order to truly understand cookies you also need to understand HTTP packets and a little bit of how the internet works.  I&#8217;ll cover a little bit of everything here.</p>
<p><span id="more-19"></span></p>
<p>So cookies are text files stored in your computer, but how do they get there? First let&#8217;s understand how browsers work:</p>
<ol>
<li><strong>Type URL</strong>: User types a domain name like <a href="http://www.google.com">www.google.com</a></li>
<li>Browser makes a DNS lookup via your OS to get the &#8220;REAL&#8221; location of google.com.  If you are using windows, like most of you are, you can see your DNS cache by running the following command: ipconfig /displaydns  You can flush it if you like, just run iplookup help for a list of commands.</li>
<li>Internall DNS lookup will return an IP address (<a href="http://en.wikipedia.org/wiki/Internet_Protocol">What&#8217;s an IP address</a>?), is like you looking up a business &#8220;Pizza Hut&#8221; and finding the &#8220;REAL&#8221; address.  Now we have the &#8220;REAL&#8221; address of google (For your area)</li>
<li>Browser (via WinSock / if using windows) will execute an HTTP GET (or POST, HEAD, depending on what you are doing) against google.com&#8217;s IP address.  What is that mean?  It means it will send a packet to the server hosting google.com.  Example:</li>
<li><span style="font-family: Courier New;">GET <a href="http://www.google.com/">http://www.google.com/</a> HTTP/1.1 </span></li>
<li><strong>Get data</strong>: The server then returns the body of the document index.html from the server.  You can actually copy+paste the above request (#5) inside a telnet session and it will do the same.  On any type of shell/dos command prompt you type:  telnet google.com 80 and then copy+paste the line above and hit enter a couple of times.  Pretty cool huh?</li>
<li><strong>Render</strong>:  Finally! the browser renders the <a href="http://en.wikipedia.org/wiki/HTML">HTML</a> (That&#8217;s a whole different topic).  So now you should see the google home page.  But what does this have to do with COOKIES!?  Well a lot&#8230; see below.</li>
</ol>
<p>Now that you understand how browsers work, let&#8217;s dig deeper (Ohh yeah, digg this if you like it).</p>
<p>Between &#8220;Get data&#8221; and &#8220;Render&#8221; (#6 and #7) there are a few things that happen in the background without you even knowing.  This is where cookies are born or placed in the oven.</p>
<p>Ok this is what happens:</p>
<p><strong>Read Response:</strong> When the server sends the index.html document back to the browser (or client) it sends a set of instructions and additional information about the server called HTTP Response.  For example, if I did a get on google this is what I get.</p>
<p><span style="color: #888888;"><em>HTTP/1.1 200 OK<br />
Cache-Control: private, max-age=0<br />
Date: Thu, 12 Jun 2008 22:24:20 GMT<br />
Expires: -1<br />
Content-Type: text/html; charset=ISO-8859-1<br />
Set-Cookie: PREF=ID=43d956b23a80fb8d:TM=1213309460:LM=1213309460:S=TeCN3DjIy3-qWAzZ; expires=Sat, 12-Jun-2010 22:24:20 GMT; path=/; domain=.google.com<br />
Server: gws<br />
Content-Length: 0</em></span></p>
<p><em>Note: You can see the above example by doing the following, type telnet google.com 80, then type HEAD </em><a href="http://www.google.com/"><em>http://www.google.com/</em></a><em> HTTP/1.1.  Is works like MAGIC!</em></p>
<p>Ignore everything except for &#8220;Set-Cookie&#8221;.  That line tells the browser to store that data inside a text file in your browser&#8217;s temporary folder (on windows xp C:\Documents and Settings\csanz\Local Settings\Temporary Internet Files), so google can access it later.  Those values seem pretty cryptic, but I could still tamper with them if I wanted to.</p>
<p>So this covers ALL the basics&#8230; browsers, cookies, packets, server response, etc.  so back to cookies.</p>
<p>Cookies are used for keeping user information, so let&#8217;s say when you log on to wellsfargo the server needs to remember your identity in order for you to navigate your account, so wellsfargo drops your personal ID inside a cookie.</p>
<p>Now start thinking like a hacker&#8230; hmm the server sends a response similar to the one above with the SET-Cookies info.  Let&#8217;s pretend wellfargo hired a very sloppy programmer, this is the kind of response you would get from his login form:</p>
<p><em><span style="color: #888888;">Set-Cookie: username=chris;password=test</span></em></p>
<p>So your own cookie info would travel through the web in clear-text.  Hmm very bad.  So how would you tamper with that? (hack)  Before jumping into hacking mode let&#8217;s try to make the request using the info above first</p>
<p><span style="color: #888888;"><em>GET </em></span><a href="http://www.wellsfargo.com/myaccount/"><span style="color: #888888;"><em>http://www.wellsfargo.com/myaccount/</em></span></a><span style="color: #888888;"><em> HTTP/1.1<br />
Cookie: username=chris;password=test</em></span></p>
<p><em>Note: This is just an example, if you try the above it won&#8217;t work.</em></p>
<p>The above request returns your account info from the server, basically wellfargo&#8217;s account info home page, you can navigate any other page using this info.</p>
<p>Now, are you still thinking &#8220;How is that bad?&#8221;.  If you are then you need to keep reading.</p>
<p>Before I go on wellsfargo is extremely secured, so this is not an issue for them.  They use secured socked layer (SSL), so the info above traveling back in forth looks like this (@#$@#&amp;^*^*^DSFSDFKJLDF), very hard to decrypt.  Wellsfargo customers you are safe.</p>
<p>Ok, let&#8217;s continue with the example.  Let&#8217;s say I wanted to access someone else&#8217;s account info.  How would you do it with all the knowledge you have now?</p>
<p>You do the same request with many different combinations of users names and passwords until you hit the jackpot.  BUT, you do not do this manually of course, you write a program.  I&#8217;m not saying that I would do it *wink*, but this is what a hacker would do.</p>
<p>So how do you prevent the above situation from happening?</p>
<p>Well you have many options, but these are the ones I recommend:</p>
<ul>
<li>Use <a href="http://en.wikipedia.org/wiki/Secure_Sockets_Layer">SSL, specially if you are handling credit card info OR</a></li>
<li><a href="http://en.wikipedia.org/wiki/Encryption">Encrypt </a>your cookie values, makes it hard for hackers to tamper your cookie values</li>
</ul>
<p>So that&#8217;s the mistery behind cookies.  So your best bet is to stay away from smaller and obscure websites when it comes to sharing private info like your credit card, social security etc.</p>
<p>The site itself may not be the bad guy, but if they have a sloppy programmers they &#8220;may&#8221; be vulnerable to sloppy code and smart hackers.</p>
<p>That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdevbox.com/blog/2008/06/12/the-mistery-behind-cookies-are-they-good-or-bad/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Pull data from Google Search API and decode JSON string using PHP</title>
		<link>http://www.chrisdevbox.com/blog/2008/06/11/pull-data-from-google-search-api-and-decode-json-string-using-php/</link>
		<comments>http://www.chrisdevbox.com/blog/2008/06/11/pull-data-from-google-search-api-and-decode-json-string-using-php/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 05:04:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JSON]]></category>

		<category><![CDATA[Mashup]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[API]]></category>

		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.chrisdevbox.com/blog/?p=17</guid>
		<description><![CDATA[PHP has a built-in function that can decode a JSON string and turn into an object or an object tree and is called PHP-JSON.  This is very helpful for when you need to integrate or mashup with other application such as the google APIs.  Here is a quick simple example:
&#60;?php
$json_str = &#8216;{ &#8220;name&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>PHP has a built-in function that can decode a JSON string and turn into an object or an object tree and is called <a href="http://wiki.chrisdevbox.com/index.php/Php-json">PHP-JSON</a>.  This is very helpful for when you need to integrate or mashup with other application such as the google APIs.  Here is a quick simple example:</p>
<p><em><span style="color: #888888;">&lt;?php<br />
$json_str = &#8216;{ &#8220;name&#8221; : &#8220;chris&#8221;}&#8217;;<br />
$obj = json_decode($json_str);<br />
echo $obj-&gt;name;<br />
echo &#8220;\n&#8221;;</span></em></p>
<p>The above will return:</p>
<p><span style="color: #ff0000;"><em>chris</em></span></p>
<p><span id="more-17"></span></p>
<p>Here is a more complex example using the actual Google Searh API:</p>
<p><span style="color: #808080;"><em>&lt;?php</em></span></p>
<p><span style="color: #808080;"><em>$url = &#8220;http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;q=Paris%20Hilton&#8221;;</em></span></p>
<p><span style="color: #808080;"><em>// sendRequest<br />
// note how referer is set manually<br />
$ch = curl_init();<br />
curl_setopt($ch, CURLOPT_URL, $url);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />
curl_setopt($ch, CURLOPT_REFERER, &#8220;http://www.chrisdevbox.com/&#8221;);<br />
$body = curl_exec($ch);<br />
//echo $body;<br />
curl_close($ch);</em></span></p>
<p><span style="color: #808080;"><em>// now, process the JSON string<br />
$json = json_decode($body);<br />
// now have some fun with the results&#8230;<br />
print_r($json);</em></span></p>
<p><a href="http://www.chrisdevbox.com/lab/jsonphp/google.php" target="_blank">Here is the output</a></p>
<p>And <a href="http://www.chrisdevbox.com/lab/jsonphp/google.php.txt">here is the source code</a></p>
<p>Pretty cool huh?  I think the coolest part is the fact that you can pretty much pull anything from google using this&#8230; including <a href="http://code.google.com/apis/ajaxsearch/documentation/">video, news, blogs</a>, etc&#8230;  I&#8217;ll be writing another article on that.  Stay tuned.</p>
<p>BTW, <a href="http://wiki.chrisdevbox.com/index.php/Php-json">PHP-JSON</a> comes built in with PHP 5.2, for earlier version you&#8217;ll have to download, compile and install.</p>
<p>Simple steps</p>
<ul>
<li>wget http://aurore.net/projects/php-json/php-json-ext-1.2.1.tar.bz2</li>
<li>tar xvf php-json-ext-1.2.1.tar.bz2</li>
<li>cd php-json-ext-1.2.1</li>
<li>phpize</li>
<li>./configure</li>
<li>make</li>
<li>make install</li>
<li>vi /etc/php.ini</li>
<li>Add the following:</li>
<li>extension=json.so</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdevbox.com/blog/2008/06/11/pull-data-from-google-search-api-and-decode-json-string-using-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SQL Server 2008 Release Candidate 0 is Out!</title>
		<link>http://www.chrisdevbox.com/blog/2008/06/10/sql-server-2008-release-candidate-0-is-out/</link>
		<comments>http://www.chrisdevbox.com/blog/2008/06/10/sql-server-2008-release-candidate-0-is-out/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 19:00:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Database]]></category>

		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[DB]]></category>

		<category><![CDATA[Release Candidate]]></category>

		<guid isPermaLink="false">http://www.chrisdevbox.com/blog/?p=16</guid>
		<description><![CDATA[For all super DB geeks out there, you can now try the new SQL Server 2008 Release Candidate 0.  I recommend you install it on a virtual machine (Just in case).  Anyway, here is the link.
http://www.microsoft.com/downloads/details.aspx?FamilyId=35F53843-03F7-4ED5-8142-24A4C024CA05&#38;displaylang=en
I&#8217;m going to review and provide more details on a different/new post.
Here is the official website (Bookmark!)
http://www.microsoft.com/sqlserver/2008/en/us/default.aspx
]]></description>
			<content:encoded><![CDATA[<p>For all super DB geeks out there, you can now try the new SQL Server 2008 Release Candidate 0.  I recommend you install it on a virtual machine (Just in case).  Anyway, here is the link.</p>
<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=35F53843-03F7-4ED5-8142-24A4C024CA05&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyId=35F53843-03F7-4ED5-8142-24A4C024CA05&amp;displaylang=en</a></p>
<p>I&#8217;m going to review and provide more details on a different/new post.</p>
<p>Here is the official website (Bookmark!)</p>
<p><a href="http://www.microsoft.com/sqlserver/2008/en/us/default.aspx">http://www.microsoft.com/sqlserver/2008/en/us/default.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdevbox.com/blog/2008/06/10/sql-server-2008-release-candidate-0-is-out/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
