<?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>Gray&#039;s blog &#187; Uncategorized</title>
	<atom:link href="http://graysblog.org/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://graysblog.org</link>
	<description>Web Developer, Platform Coder, Coding Samurai, Person.</description>
	<lastBuildDate>Thu, 06 May 2010 20:06:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Holy ****!</title>
		<link>http://graysblog.org/2010/05/06/holy/</link>
		<comments>http://graysblog.org/2010/05/06/holy/#comments</comments>
		<pubDate>Thu, 06 May 2010 20:06:03 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[new posts]]></category>

		<guid isPermaLink="false">http://graysblog.org/?p=271</guid>
		<description><![CDATA[It&#8217;s been a while since my last post, mainly since I have little to nothing to write about these days. It&#8217;s nearing summer, the air is getting warmer (and then in Seattle, suddenly colder..).
Looking back today I realized something like 60% of the posts on my blog are absolute crap. And I mean absolute-crap. Eventually, [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since my last post, mainly since I have little to nothing to write about these days. It&#8217;s nearing summer, the air is getting warmer (and then in Seattle, suddenly colder..).</p>
<p>Looking back today I realized something like 60% of the posts on my blog are absolute crap. And I mean absolute-crap. Eventually, sometime around this summer I&#8217;ll be posting a new portfolio/blog site for myself that will contain newer, better content.</p>
]]></content:encoded>
			<wfw:commentRss>http://graysblog.org/2010/05/06/holy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing webapps in QuickBasic 4.5</title>
		<link>http://graysblog.org/2010/02/27/writing-webapps-in-quickbasic-4-5/</link>
		<comments>http://graysblog.org/2010/02/27/writing-webapps-in-quickbasic-4-5/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 04:04:07 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cgi]]></category>
		<category><![CDATA[cgi-bin]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[qb]]></category>
		<category><![CDATA[qbasic]]></category>
		<category><![CDATA[quickbasic]]></category>
		<category><![CDATA[xampp]]></category>

		<guid isPermaLink="false">http://graysblog.org/?p=260</guid>
		<description><![CDATA[Disclaimer: I realize this has no real valuable use whatsoever.
First off, credit where credit is due, when I initially had to setup the CGI I ran into a problem solved buy a guy on reddit, who managed to write a website clone in quickbasic. You have to do a simple C++ stub app that can [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>Disclaimer: I realize this has no real valuable use whatsoever.</em></strong></p>
<p>First off, credit where credit is due, when I initially had to setup the CGI I ran into a problem solved buy a guy on reddit, who managed to write a website clone in quickbasic. You have to do a simple C++ stub app that can direct the output from quickbasic apps into the server.</p>
<p>In order to pull this off, you&#8217;ll need a copy of the following tools:<br />
<strong>1.</strong> Dev C++ (For compiling the stub app, to make your life easier, grab the one with a compiler built into the install) <a href="http://www.bloodshed.net/devcpp.html">here</a></p>
<p><strong>2.</strong>Quickbasic 4.5 (capable of generating EXE files) <a href="http://www.phatcode.net/downloads.php?id=172">here</a></p>
<p>I also recommend xampp, very quick installation, works perfectly for this example. Grab it <a href="http://www.apachefriends.org/en/xampp.html">here</a></p>
<hr />
<p>Now, to actually install quickbasic from this zip on windows, you have to create a fake A drive, or copy the files to a floppy.</p>
<p>The trick to doing this is a command line trick called <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/subst.mspx?mfr=true">subst</a></p>
<p>So, copy the quickbasic disk1 folder from the download, place it in a folder on C: like, FLOPPY1 and run this:<br />
subst a: C:\FLOPPY1</p>
<p>Run the quickbasic setup app on the fake disk, when prompted to insert another disk, copy the contents of disk2 into the fake drive. Hopefully you&#8217;ll be able to run quickbasic now, and be greeted by this screen:</p>
<div id="attachment_261" class="wp-caption alignleft" style="width: 310px"><a href="http://graysblog.org/wp-content/uploads/2010/02/qb.png"><img class="size-medium wp-image-261" title="qb" src="http://graysblog.org/wp-content/uploads/2010/02/qb-300x155.png" alt="QuickBasic 4.5 welcome screen" width="300" height="155" /></a><p class="wp-caption-text">QuickBasic 4.5 welcome screen</p></div>
<p>Once your in quickbasic, navigate the menus with ALT or your mouse, type out this simple program:</p>
<div class="codesnip-container" >PRINT &#8220;Content-Type: text/html&#8221;<br />
PRINT &#8220;&#8221;<br />
PRINT &#8220;&#8221;</div>
<div class="codesnip-container" >PRINT &#8220;</div>
<div class="codesnip-container" >&lt;h1&gt;Hello World!&lt;/h1&gt;</div>
<div class="codesnip-container" >&#8221;<br />
PRINT &#8220;&#8221;</div>
<p>Move over to the run menu and hit make EXE file, save your app. The app will be in the saved file directory, take it, rename it something simple (e.g. &#8216;app.exe&#8217;) and close.</p>
<p>Now, open up dev C++, navigate to File-&gt;New-&gt;Project and select console application, select C++ for the language, copy and paste this code into main.cpp:</p>
<div class="codesnip-container" >#include &lt;iostream&gt;<br />
#include &lt;string&gt;<br />
#include &lt;stdio.h&gt;<br />
int main(int argc, char *argv[])<br />
{<br />
std::string piper;<br />
FILE* data = popen(&#8220;app.exe&#8221;,&#8221;r&#8221;);</p>
<p>for(char c = getc(data);c != EOF;c = getc(data))<br />
{<br />
piper.push_back(c);<br />
}<br />
pclose(data);</p></div>
<div class="codesnip-container" >std::cout &lt;&lt; piper;<br />
return 0;<br />
}</div>
<p>Press ctrl+F9 to compile or select compile from the menu. Open the directory where you saved the project, and copy the generated EXE file over to your cgi-bin directory (in htdocs for apache, with xampp it&#8217;s in the root directory of xampp/cgi-bin).</p>
<p>Now, with the stub in cgi-bin, rename your compiled quickbasic app to &#8216;app.exe&#8217;, and copy it to cgi-bin. Navigate to <a href="http://localhost/cgi-bin/stub.exe">http://localhost/cgi-bin/stub.exe</a> where stub.exe is whatever your compiled C++ application is called, you should now see a screen something like this:</p>
<div id="attachment_263" class="wp-caption alignleft" style="width: 310px"><a href="http://graysblog.org/wp-content/uploads/2010/02/helloworld.png"><img class="size-medium wp-image-263" title="hello world" src="http://graysblog.org/wp-content/uploads/2010/02/helloworld-300x107.png" alt="hello world from quickbasic" width="300" height="107" /></a><p class="wp-caption-text">hello world from quickbasic</p></div>
<p>Now you can run your webapps and display output in the browser, all you need now is to parse CGI variables, which is done via the ENVIRON$ function.</p>
<div class="codesnip-container" >PRINT &#8220;Content-Type: text/html&#8221;<br />
PRINT &#8220;&#8221;<br />
PRINT &#8220;&#8221;<br />
PRINT &#8220;</div>
<div class="codesnip-container" >&lt;h1&gt;Hello World!&lt;/h1&gt;</div>
<div class="codesnip-container" >&#8221;<br />
PRINT ENVIRON$(&#8220;QUERY_STRING&#8221;)<br />
PRINT &#8220;&#8221;</div>
<p>QUERY_STRING is set by the CGI gateway, accessing this page with a url like http://localhost/cgi-bin/qload.exe?bla would print:<br />
&#8220;Hello World! bla&#8221;</p>
<p>This has no real practical use anymore, but it&#8217;s just interesting to try out. Also, sorry about the code blocks here being screwed up, wordpress managed to mangle them.</p>
]]></content:encoded>
			<wfw:commentRss>http://graysblog.org/2010/02/27/writing-webapps-in-quickbasic-4-5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>X-ID3 header in modern web servers</title>
		<link>http://graysblog.org/2010/01/18/x-id3-header-in-modern-web-servers/</link>
		<comments>http://graysblog.org/2010/01/18/x-id3-header-in-modern-web-servers/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 14:38:04 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[headers]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[id3]]></category>
		<category><![CDATA[lighthttpd]]></category>
		<category><![CDATA[x-id3]]></category>

		<guid isPermaLink="false">http://graysblog.org/?p=258</guid>
		<description><![CDATA[I&#8217;ll keep this post short and straight to the point, it just seems like this idea should have followed suit right after streaming media became a common feature in HTTP Servers (e.g. lighthttpd).
With the standard format for online music being MP3 files, and the versatile format of streaming MP3&#8217;s (can be played while downloading), I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll keep this post short and straight to the point, it just seems like this idea should have followed suit right after streaming media became a common feature in HTTP Servers (e.g. lighthttpd).</p>
<p>With the standard format for online music being MP3 files, and the versatile format of streaming MP3&#8217;s (can be played while downloading), I see no reason why we shouldn&#8217;t be able to add some minimal support for these files in the web server.</p>
<p>It seems like a good idea to me to build an apache module in for MP3 metadata. It could be configured / disabled &amp; enabled via the apache.conf file, preferably something that works with ID3 and HTTP headers. Which is why I propose the x-id3 header standard.</p>
<p>It should be simple enough, basically parsed Mp3 metadata in the Id3 format, passed in the HTTP headers in the following format:</p>
<div class="codesnip-container" >x-id3-(id3 field name): Content</div>
<p>Just like every other HTTP header, I don&#8217;t know. Seems pretty basic and overlooked to me. I&#8217;d like to hear your thoughts though, so leave a comment with your opinion / ideas.</p>
<p><em>[Disclaimer: wrote this after pulling an all-nighter, so if it's written poorly, my bad]</em></p>
]]></content:encoded>
			<wfw:commentRss>http://graysblog.org/2010/01/18/x-id3-header-in-modern-web-servers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Welcome to 2010. (And some new years resolutions..)</title>
		<link>http://graysblog.org/2010/01/07/welcome-to-2010-and-some-new-years-resolutions/</link>
		<comments>http://graysblog.org/2010/01/07/welcome-to-2010-and-some-new-years-resolutions/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 06:57:47 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[back]]></category>
		<category><![CDATA[welcome]]></category>

		<guid isPermaLink="false">http://graysblog.org/?p=256</guid>
		<description><![CDATA[Howdy,
Man it&#8217;s been a while since I posted, so much on my plate and not a ton to post about. And the whole &#8216;not having time&#8217; thing. Since I last posted we made it to 2010. Hell yea!
In my last year of blogging, looking back I did some pretty stupid stuff. Especially as far as [...]]]></description>
			<content:encoded><![CDATA[<p>Howdy,</p>
<p>Man it&#8217;s been a while since I posted, so much on my plate and not a ton to post about. And the whole &#8216;not having time&#8217; thing. Since I last posted we made it to 2010. Hell yea!</p>
<p>In my last year of blogging, looking back I did some pretty stupid stuff. Especially as far as my code went. Yikes.. But, although a bit late, this year I will actually set some <strong>solid</strong> new years goals that I can hopefully meet.</p>
<ol>
<li>By midyear, I hope to have a consistent revenue stream from online worth monthly. i.e. earning $xxxx a month. Would be nice to have a steady income stream.</li>
<li>Be more successful with managing money.</li>
<li>Post more on my blog in 2010, blog neglect must end!</li>
</ol>
<p>Hopefully I&#8217;ll be able to stick to these ones, it shouldn&#8217;t be <em>*too*</em> hard.  Also, hopefully I should be back into the posting routinely scenario next week.. Maybe..</p>
]]></content:encoded>
			<wfw:commentRss>http://graysblog.org/2010/01/07/welcome-to-2010-and-some-new-years-resolutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Axcid Search Engine</title>
		<link>http://graysblog.org/2009/10/21/axcid-search-engine/</link>
		<comments>http://graysblog.org/2009/10/21/axcid-search-engine/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 00:52:44 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[axcid]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[riptune]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[tunebin]]></category>

		<guid isPermaLink="false">http://graysblog.org/?p=243</guid>
		<description><![CDATA[Sup,
So last night (10-20-09) I made a tweak to the search engine part of Axcid that greatly improved the service. So before yesterday, keyword searches such as:
mac dre, dr dre, rem
would return nothing. Also words under 4 letters in length weren&#8217;t counted, resulting in less relevance in search results &#038; various other bugs. Last night [...]]]></description>
			<content:encoded><![CDATA[<p>Sup,</p>
<p>So last night (10-20-09) I made a tweak to the search engine part of Axcid that greatly improved the service. So before yesterday, keyword searches such as:</p>
<p>mac dre, dr dre, rem</p>
<p>would return nothing. Also words under 4 letters in length weren&#8217;t counted, resulting in less relevance in search results &#038; various other bugs. Last night I set out to correct that and did so successfully.</p>
<p>You&#8217;ll notice that specific searches now get more results, as well as the searches above which before returned nothing, now all return results.</p>
<p>This is just another step for Axcid&#8217;s future as a search engine, it gets better nearly every day.</p>
]]></content:encoded>
			<wfw:commentRss>http://graysblog.org/2009/10/21/axcid-search-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Riptune</title>
		<link>http://graysblog.org/2009/09/27/riptune/</link>
		<comments>http://graysblog.org/2009/09/27/riptune/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 05:58:40 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://graysblog.org/?p=236</guid>
		<description><![CDATA[It&#8217;s like tunebin was a while ago:
http://riptune.org/
+ the conf*ulator radio/playlist thing. powered by the wonderful and awesome axcid.
]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s like tunebin was a while ago:</p>
<p><a href="http://riptune.org/">http://riptune.org/</a></p>
<p>+ the conf*ulator radio/playlist thing. powered by the wonderful and awesome axcid.</p>
]]></content:encoded>
			<wfw:commentRss>http://graysblog.org/2009/09/27/riptune/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>@Android Developers</title>
		<link>http://graysblog.org/2009/09/26/android-developers/</link>
		<comments>http://graysblog.org/2009/09/26/android-developers/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 06:16:58 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[cyanogen]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://graysblog.org/?p=234</guid>
		<description><![CDATA[http://developer.yahoo.com/everything.html
It&#8217;s all there. Prettymuch everything that needs to be replaced. Collective effort anyone?
]]></description>
			<content:encoded><![CDATA[<p>http://developer.yahoo.com/everything.html</p>
<p>It&#8217;s all there. Prettymuch everything that needs to be replaced. Collective effort anyone?</p>
]]></content:encoded>
			<wfw:commentRss>http://graysblog.org/2009/09/26/android-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android got screwed over</title>
		<link>http://graysblog.org/2009/09/26/android-got-screwed-over/</link>
		<comments>http://graysblog.org/2009/09/26/android-got-screwed-over/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 05:28:59 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[cyanogen]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://graysblog.org/?p=232</guid>
		<description><![CDATA[Let me just start by saying, since the start I have been an android supporter, and have invested a good $1000 or so into the platform as far as phones go.
Anyways, I did not use the &#8216;official&#8217; rom, I used the rooted Cyanogen Mod. Which just received a cease and desist order from Google. Google&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Let me just start by saying, since the start I have been an android supporter, and have invested a good $1000 or so into the platform as far as phones go.</p>
<p>Anyways, I did not use the &#8216;official&#8217; rom, I used the rooted Cyanogen Mod. Which just received a cease and desist order from Google. Google&#8217;s official response seems to boil down to &#8216;Android is open, but google apps are not&#8217;. The bottomline being the phone doesn&#8217;t really function without those apps.</p>
<p>So here&#8217;s whats out:<br />
-Contacts Sync<br />
-Maps<br />
-Youtube<br />
-Gmail<br />
-Google Talk<br />
-And last, but most important, the &#8216;android market&#8217;</p>
<p>And anything else not in the android source tree.</p>
<p>Most of the community could probably live without those except android market, after all, the latest maps.apk can be downloaded and installed from android market. Without the market there is no consumer friendly way to install apps on the phone. Ouch.</p>
<p>Some people (Including myself) have kicked around the solution of rebuilding those apps. I personally like that idea and the idea of a &#8216;google stripped&#8217; android. Most of what they provided could be recreated with public API&#8217;s.</p>
<p>It&#8217;s just something to think about though, with no real commercial open mobile os, developers are being placed in a walled garden no matter where they go.</p>
<p>I guess it&#8217;s a waiting game now for a developer to start the &#8216;openandroid&#8217; tree or whatever it will be called. But I look forward to the day when that project starts with curiosity.</p>
]]></content:encoded>
			<wfw:commentRss>http://graysblog.org/2009/09/26/android-got-screwed-over/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rebuilding a HTC Music Adapter (EMU Headphone Adapter)</title>
		<link>http://graysblog.org/2009/09/01/rebuilding-a-htc-music-adapter-emu-headphone-adapter/</link>
		<comments>http://graysblog.org/2009/09/01/rebuilding-a-htc-music-adapter-emu-headphone-adapter/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 18:27:11 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[adapter]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[emu]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[headphone]]></category>
		<category><![CDATA[htc]]></category>
		<category><![CDATA[repair]]></category>

		<guid isPermaLink="false">http://graysblog.org/?p=228</guid>
		<description><![CDATA[Wassup?
After having at _least_ THREE &#8216;g1 headphone adapters&#8217; die on me within the space of 5 months, and having to spend more then $10 a piece to replace them, I got sick of paying for these rubbish wires. The phone is great but the headphone adapters are not, but I managed to pull my self [...]]]></description>
			<content:encoded><![CDATA[<p>Wassup?</p>
<p>After having at _least_ <strong>THREE</strong> &#8216;g1 headphone adapters&#8217; die on me within the space of 5 months, and having to spend more then $10 a piece to replace them, I got sick of paying for these rubbish wires. The phone is great but the headphone adapters are not, but I managed to pull my self a Hi-Fi one with just a bit of DIY and Tape.</p>
<p><strong>What you need:</strong><br />
(Minimum)<br />
- A lighter<br />
- Electrical Tape<br />
- Wire Strippers<br />
- Something with a 3.5 audio jack on the end (In my case, half of a audio splitter)</p>
<p><strong>Connecting the wires:</strong></p>
<p>First at the tip of each wire you see after stripping the coat from the original EMU connector cord, run a flame from the lighter under the wire until it catches fire, then blow it out. This exposes the wire by removing the chemical coating.</p>
<p>The annoying part about these (And I didn&#8217;t care to do much trial and error as to what does what) is that with Android, if several wires are not connected it won&#8217;t detect it as headphones.</p>
<p>In order to wire this up, you should have left, right and &#8216;center&#8217; (gnd) coming from your 3.5 jack. See picture (http://graysblog.org/wp-content/uploads/2009/09/IMAG0010.jpg). All bronze / semibronze wires should be tied together and used as the gnd/center (at the ends where they were opened by burn). The blue and the white wire are microphone / button wires. You can safely set them aside.</p>
<p>The red(Organish) and green wires are respectively, right and left channel. See picture.</p>
<p>Wires all done:</p>
<p><img src="http://graysblog.org/wp-content/uploads/2009/09/IMAG0010-300x200.jpg" alt="In Progress" title="In Progress" width="300" height="200" class="alignleft size-medium wp-image-230" /></p>
<p>http://graysblog.org/wp-content/uploads/2009/09/IMAG0010.jpg</p>
<p><strong>Taping it all up:</strong></p>
<p>Alright this is pretty simple, the way I like to do it is a strip of tape on every separate connection you make, then tape everything up. I&#8217;d advise listening to the headphones while doing this, the risk of shortage is low and it ensures that it works. No solder or mess. And for lazy people like me little work</p>
<p>Finished Product<br />
<div id="attachment_229" class="wp-caption alignleft" style="width: 210px"><img src="http://graysblog.org/wp-content/uploads/2009/09/IMAG0011-200x300.jpg" alt="And.. It&#039;s done" title="Finished Product" width="200" height="300" class="size-medium wp-image-229" /><p class="wp-caption-text">And.. It's done</p></div></p>
<p>Surprisingly this works well, and the audio quality is great. </p>
<p>I apologize for the crap quality of this &#8216;miniguide&#8217;, I was rushed and just wanted the info out there</p>
<p>References:<br />
(Soldering the wires)</p>
<p>http://hackaday.com/2009/05/24/soldering-headphone-wire/</p>
<p>http://www.alexwhittemore.com/?p=205</p>
<p>(Pinout)</p>
<p>http://androidforums.com/t-mobile-g1/4480-how-create-emu-3-5mm-headphone-jack-adaptor.html</p>
]]></content:encoded>
			<wfw:commentRss>http://graysblog.org/2009/09/01/rebuilding-a-htc-music-adapter-emu-headphone-adapter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python</title>
		<link>http://graysblog.org/2009/08/30/python/</link>
		<comments>http://graysblog.org/2009/08/30/python/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 06:09:23 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[updates]]></category>

		<guid isPermaLink="false">http://graysblog.org/?p=224</guid>
		<description><![CDATA[Alright so it&#8217;s been a while since I posted anything and I wanted to put something out there, while I have been working a lot on many projects I couldn&#8217;t really speak of, I have a few quick things to update you on before I get on to the main content:
First thing, the staff of [...]]]></description>
			<content:encoded><![CDATA[<p>Alright so it&#8217;s been a while since I posted anything and I wanted to put something out there, while I have been working a lot on many projects I couldn&#8217;t really speak of, I have a few quick things to update you on before I get on to the main content:</p>
<p>First thing, the staff of Opensock have acquired MMOCCForum, this is pretty exciting and we are going to help get that place in shape.<br />
Second, Axcid.org has had a complete rewrite of it&#8217;s API, now including keyword search. <a href="http://tunebin.info">http://tunebin.info/</a> does a great job showing this.</p>
<p>Alright now onto the main content of the post:</p>
<p>After hating python and it&#8217;s syntax for a few years, I got the push of actually LEARNING the language, including some of it&#8217;s many libraries and functions. Once you get used to it, the syntax isn&#8217;t too bad actually. It&#8217;s actually pretty easy, for example:</p>
<pre>
<div class="codesnip-container" >
<div class="python codesnip" style="font-family:monospace;"><span class="kw1">import</span> system, <span class="kw3">string</span>

<span class="st0">&quot;&quot;&quot; Python block style comments &quot;&quot;&quot;</span>
<span class="co1"># Python one line bash-style comments</span>

<span class="co1"># Rather then braces for syntax blocking, python uses whitespace</span>

<span class="co1">#Functions in python must be declared before use, unlike in javascript.</span>

<span class="co1"># The Syntax for this is def</span>

<span class="co1"># e.g.</span>

<span class="kw1">def</span> SayHello<span class="br0">&#40;</span>text<span class="br0">&#41;</span>:
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># This is the body of the function</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">print</span><span class="br0">&#40;</span>text<span class="br0">&#41;</span>

<span class="co1"># Say Hello would be considered a 'function alias', and would be used like this:</span>

SayHello<span class="br0">&#40;</span><span class="st0">&quot;test&quot;</span><span class="br0">&#41;</span>

<span class="co1"># Some built in python functions</span>
<span class="kw3">string</span> = <span class="st0">&quot;123&quot;</span> <span class="co1"># set a variable</span>
integer = <span class="kw2">int</span><span class="br0">&#40;</span><span class="kw3">string</span><span class="br0">&#41;</span> <span class="co1"># Convert string to integer</span>
<span class="kw3">string</span> = <span class="kw2">str</span><span class="br0">&#40;</span>integer<span class="br0">&#41;</span> <span class="co1"># Convert integer to string</span>

<span class="co1"># And block statements use : to start the block, e.g.</span>

<span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw3">string</span> = <span class="kw2">str</span><span class="br0">&#40;</span>integer<span class="br0">&#41;</span><span class="br0">&#41;</span>:
&nbsp; &nbsp; &nbsp; &nbsp; SayHello<span class="br0">&#40;</span><span class="kw2">str</span><span class="br0">&#40;</span>integer<span class="br0">&#41;</span><span class="br0">&#41;</span>

&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Else if is elif</span>
&nbsp; &nbsp; &nbsp; &nbsp; 
<span class="kw1">elif</span> <span class="br0">&#40;</span><span class="kw3">string</span> = <span class="kw2">int</span><span class="br0">&#40;</span><span class="kw3">string</span><span class="br0">&#41;</span><span class="br0">&#41;</span>:
&nbsp; &nbsp; &nbsp; &nbsp; SayHello<span class="br0">&#40;</span><span class="st0">&quot;Oh..&quot;</span><span class="br0">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1"># Not gonna reach this</span>

<span class="kw1">else</span>:
&nbsp; &nbsp; &nbsp; &nbsp; SayHello<span class="br0">&#40;</span><span class="st0">&quot;Else reached, so none of them was correct&quot;</span><span class="br0">&#41;</span></div>
</div>
</pre>
<p>Just for an example of python, Axcid&#8217;s new JSON api can be used like this:</p>
<pre>
<div class="codesnip-container" >
<div class="python codesnip" style="font-family:monospace;"><span class="co1"># axcid</span>
<span class="kw1">import</span> <span class="kw3">sys</span>, <span class="kw3">string</span>, <span class="kw3">urllib</span>
<span class="kw1">import</span> simplejson <span class="kw1">as</span> json

AXCID_URL=<span class="st0">&quot;http://two.axcid.org/new/api/?method=search.keyword&amp;format=json&amp;allpages=1&amp;q=&quot;</span>

<span class="kw1">def</span> GetResults<span class="br0">&#40;</span>query<span class="br0">&#41;</span>:
&nbsp; &nbsp; &nbsp; &nbsp; query = query.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">&quot; &quot;</span>, <span class="st0">&quot;%20&quot;</span><span class="br0">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; url = AXCID_URL+query
&nbsp; &nbsp; &nbsp; &nbsp; f = <span class="kw3">urllib</span>.<span class="me1">urlopen</span><span class="br0">&#40;</span>url<span class="br0">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; obj = json.<span class="me1">load</span><span class="br0">&#40;</span>f<span class="br0">&#41;</span>

&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="br0">&#40;</span>obj<span class="br0">&#91;</span><span class="st0">&quot;track&quot;</span><span class="br0">&#93;</span><span class="br0">&#41;</span></div>
</div>
</pre>
<p>And the result from that:</p>
<pre>
<div class="codesnip-container" >
<div class="python codesnip" style="font-family:monospace;">results = GetResults<span class="br0">&#40;</span><span class="st0">&quot;sublime&quot;</span><span class="br0">&#41;</span>

<span class="kw1">if</span> <span class="br0">&#40;</span>results<span class="br0">&#41;</span>:
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> track <span class="kw1">in</span> results:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">print</span><span class="br0">&#40;</span>track<span class="br0">&#91;</span><span class="st0">&quot;title&quot;</span><span class="br0">&#93;</span>+<span class="st0">&quot; - &quot;</span> + track<span class="br0">&#91;</span><span class="st0">&quot;artist&quot;</span><span class="br0">&#93;</span></div>
</div>
</pre>
<p>Writing a IRC bot in python the other day was simple as well. And a python-spidermonkey binding exists so it would be possible to bind the syntax of JS to python, <a href="http://github.com/davisp/python-spidermonkey/tree/master">Python-Spidermoney</a></p>
<p>Anyways, that&#8217;s all for my update. Hope it was useful to someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://graysblog.org/2009/08/30/python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
