<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Jakash3&#039;s Blog</title>
	<atom:link href="http://jakash3.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jakash3.wordpress.com</link>
	<description>The art of electronic witchcraft</description>
	<lastBuildDate>Fri, 27 Jan 2012 21:07:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='jakash3.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Jakash3&#039;s Blog</title>
		<link>http://jakash3.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://jakash3.wordpress.com/osd.xml" title="Jakash3&#039;s Blog" />
	<atom:link rel='hub' href='http://jakash3.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Almost accurate float to string algorithm</title>
		<link>http://jakash3.wordpress.com/2012/01/03/almost-accurate-float-to-string-algorithm/</link>
		<comments>http://jakash3.wordpress.com/2012/01/03/almost-accurate-float-to-string-algorithm/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 06:13:54 +0000</pubDate>
		<dc:creator>jakash3</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://jakash3.wordpress.com/?p=740</guid>
		<description><![CDATA[On machine 12.341 results in &#8220;12.340999&#8243;. Close enough eh? Once I get this perfect, I&#8217;ll make it into a template function with specifications for making the string in &#8216;e&#8217; notation.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=740&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>On machine 12.341 results in &#8220;12.340999&#8243;. Close enough eh? Once I get this perfect, I&#8217;ll make it into a template function with specifications for making the string in &#8216;e&#8217; notation.<br />
<pre class="brush: cpp;">
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;cmath&gt;
#include &lt;cstdio&gt;

std::string ftos(float f, int precis = 6) {
	int e, i;
	std::string buf;
	int whole;
	bool neg;
	
	/* Check for nan or [-]inf */
	if (isnan(f)) return std::string(&quot;nan&quot;);
	else if (e = isinf(f)) {
		if (e &lt; 0) return std::string(&quot;-inf&quot;);
		else return std::string(&quot;inf&quot;);
	}
	
	/* Check for negative and convert to positive */
	if (f &lt; 0) { neg = true; f *= -1.0; }
	
	/* Extract whole number */
	for (whole = 0; f &gt;= 1.0; f -= 1.0, whole++);
	
	/* Convert whole number to string */
	if (neg) buf.push_back('-');
	char tmp[64];
	sprintf(tmp, &quot;%d&quot;, whole);
	buf.append(tmp);
	
	if (f == 0.0) return buf;
	buf.push_back('.');
	
	/* Loop through each floating digit in precision */
	for (i = 0; i &lt; precis; i++) {
		if (f == 0.0) break;
		
		/* Shift next floating digit to whole number */
		f *= 10.0;
		/* Extract whole number */
		for (whole = 0; f &gt;= 1.0; f -= 1.0, whole++);
		/* Convert to character */
		buf.push_back(whole + '0');
	}
	
	/* Fill with leading 0's for precision */
	if (f == 0.0 &amp;&amp; i &lt; precis)
		for (; i &lt; precis; i++)
			buf.push_back('0');
			
	return buf;
}

int main() {
	std::cout &lt;&lt; ftos(12.341) &lt;&lt; std::endl;
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jakash3.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jakash3.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jakash3.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jakash3.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jakash3.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jakash3.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jakash3.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jakash3.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jakash3.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jakash3.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jakash3.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jakash3.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jakash3.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jakash3.wordpress.com/740/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=740&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jakash3.wordpress.com/2012/01/03/almost-accurate-float-to-string-algorithm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8244ddd5d5539eb5f9acb17709a8b022?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jakash3</media:title>
		</media:content>
	</item>
		<item>
		<title>Integer to string template function</title>
		<link>http://jakash3.wordpress.com/2012/01/01/integer-to-string-template-function/</link>
		<comments>http://jakash3.wordpress.com/2012/01/01/integer-to-string-template-function/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 21:34:55 +0000</pubDate>
		<dc:creator>jakash3</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[int to string algorithm]]></category>
		<category><![CDATA[itoa source]]></category>
		<category><![CDATA[itoa.c]]></category>

		<guid isPermaLink="false">http://jakash3.wordpress.com/?p=736</guid>
		<description><![CDATA[Convert any integer type, to any c++ string type (char or wchar_t) using this template function:<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=736&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Convert any integer type, to any c++ string type (char or wchar_t) using this template function:<br />
<pre class="brush: cpp;">
#include &lt;string&gt;
#include &lt;algorithm&gt;
#include &lt;iostream&gt;

template &lt;typename Int_T, typename Char_T&gt;
std::basic_string&lt;Char_T&gt; itoa(Int_T num, int base) {
	std::basic_string&lt;Char_T&gt; buf;
	buf.push_back(0);
	bool neg;
	
	if (num &lt; 0) { neg = true; num *= -1; }
	
	int i, j;
	Char_T digits[36];
	for (j = 0, i = '0'; i &lt;= '9'; i++, j++) digits[j] = i;
	for (i = 'a'; i &lt;= 'z'; i++, j++) digits[j] = i;
	
	do {
		buf.push_back(digits[num % base]);
		num /= base;
	} while (num != 0);
	if (neg) buf.push_back('-');
	std::reverse(buf.begin(), buf.end());
	return buf;
}

int main() {
	std::wcout &lt;&lt; L&quot;-12 in binary is &quot; &lt;&lt;
	itoa&lt;int, wchar_t&gt;(-12, 2) &lt;&lt;
	std::endl;
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jakash3.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jakash3.wordpress.com/736/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jakash3.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jakash3.wordpress.com/736/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jakash3.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jakash3.wordpress.com/736/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jakash3.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jakash3.wordpress.com/736/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jakash3.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jakash3.wordpress.com/736/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jakash3.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jakash3.wordpress.com/736/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jakash3.wordpress.com/736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jakash3.wordpress.com/736/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=736&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jakash3.wordpress.com/2012/01/01/integer-to-string-template-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8244ddd5d5539eb5f9acb17709a8b022?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jakash3</media:title>
		</media:content>
	</item>
		<item>
		<title>Create iterator from static array</title>
		<link>http://jakash3.wordpress.com/2011/12/31/create-iterator-from-static-array/</link>
		<comments>http://jakash3.wordpress.com/2011/12/31/create-iterator-from-static-array/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 07:19:06 +0000</pubDate>
		<dc:creator>jakash3</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://jakash3.wordpress.com/?p=732</guid>
		<description><![CDATA[This class allows you to construct an iterator for any static array. This is a template iterator. Example: PROTIP: For wide character strings, you can use char_iterator(wchar_t*). Also there&#8217;s const_char_iterator, which works on constant arrays.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=732&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This class allows you to construct an iterator for any static array. This is a template iterator.<br />
<pre class="brush: cpp;">
#ifndef CHAR_ITERATOR_H
#define CHAR_ITERATOR_H
#include &lt;iterator&gt;

template &lt;typename T&gt;
class char_iterator : public std::iterator&lt;std::random_access_iterator_tag, T&gt;
{
	T* ptr;
public:
	char_iterator() : ptr(0) {}
	char_iterator(T* p) : ptr(p) {}
	char_iterator(const char_iterator&amp; bsi) : ptr(bsi.ptr) {}
	char_iterator&lt;T&gt;&amp; operator= (const char_iterator&lt;T&gt;&amp; bsi) { ptr = bsi.ptr; return *this; }
	bool operator== (const char_iterator&lt;T&gt;&amp; bsi) { return ptr == bsi.ptr; }
	bool operator!= (const char_iterator&lt;T&gt;&amp; bsi) { return ptr != bsi.ptr; }
	T&amp; operator*() { return *ptr; }
	char_iterator&lt;T&gt;&amp; operator++ () { ptr = &amp;ptr[1]; return *this; }
	char_iterator&lt;T&gt; operator++ (int) {
		char_iterator&lt;T&gt; tmp(*this);
		this-&gt;operator++();
		return tmp;
	}
	char_iterator&lt;T&gt;&amp; operator-- () { ptr = &amp;ptr[-1]; return *this; }
	char_iterator&lt;T&gt; operator-- (int) {
		char_iterator&lt;T&gt; tmp(*this);
		this-&gt;operator--();
		return tmp;
	}
	T* operator-&gt; () { return ptr; }
	char_iterator&lt;T&gt;&amp; operator+= (int i) { ptr += (&amp;ptr[1] - ptr) * i; return *this; }
	char_iterator&lt;T&gt; operator+ (int i) {
		char_iterator&lt;T&gt; tmp(*this);
		tmp += i;
		return tmp;
	}
	char_iterator&lt;T&gt;&amp; operator-= (int i) { ptr -= (&amp;ptr[1] - ptr) * i; return *this; }
	char_iterator&lt;T&gt; operator- (int i) {
		char_iterator&lt;T&gt; tmp(*this);
		tmp -= i;
		return tmp;
	}
	bool operator&lt; (const char_iterator&lt;T&gt;&amp; ci) { return ptr &lt; ci.ptr; }
	bool operator&gt; (const char_iterator&lt;T&gt;&amp; ci) { return ptr &gt; ci.ptr; }
	bool operator&lt;= (const char_iterator&lt;T&gt;&amp; ci) { return ptr &lt;= ci.ptr; }
	bool operator&gt;= (const char_iterator&lt;T&gt;&amp; ci) { return ptr &gt;= ci.ptr; }
	T&amp; operator[] (int i) { return ptr[i]; }
	operator T* () { return ptr; }
	operator const T* () { return ptr; }
};

template &lt;typename T&gt;
class const_char_iterator : public std::iterator&lt;std::random_access_iterator_tag, T&gt;
{
	const T* ptr;
public:
	const_char_iterator() : ptr(0) {}
	const_char_iterator(const T* p) : ptr(p) {}
	const_char_iterator(const const_char_iterator&amp; bsi) : ptr(bsi.ptr) {}
	const_char_iterator&lt;T&gt;&amp; operator= (const const_char_iterator&lt;T&gt;&amp; bsi) { ptr = bsi.ptr; return *this; }
	bool operator== (const const_char_iterator&lt;T&gt;&amp; bsi) { return ptr == bsi.ptr; }
	bool operator!= (const const_char_iterator&lt;T&gt;&amp; bsi) { return ptr != bsi.ptr; }
	T operator*() { return *ptr; }
	const_char_iterator&lt;T&gt;&amp; operator++ () { ptr = ptr[i]; return *this; }
	const_char_iterator&lt;T&gt; operator++ (int) {
		const_char_iterator&lt;T&gt; tmp(*this);
		this-&gt;operator++();
		return tmp;
	}
	const_char_iterator&lt;T&gt;&amp; operator-- () { ptr = ptr[-1]; return *this; }
	const_char_iterator&lt;T&gt; operator-- (int) {
		const_char_iterator&lt;T&gt; tmp(*this);
		this-&gt;operator--();
		return tmp;
	}
	T* operator-&gt; () { return ptr; }
	const_char_iterator&lt;T&gt;&amp; operator+= (int i) { ptr = (&amp;ptr[1] - ptr) * i; return *this; }
	const_char_iterator&lt;T&gt; operator+ (int i) {
		const_char_iterator&lt;T&gt; tmp(*this);
		tmp += i;
		return tmp;
	}
	const_char_iterator&lt;T&gt;&amp; operator-= (int i) { ptr = (&amp;ptr[1] - ptr) * i; return *this; }
	const_char_iterator&lt;T&gt; operator- (int i) {
		const_char_iterator&lt;T&gt; tmp(*this);
		tmp -= i;
		return tmp;
	}
	bool operator&lt; (const const_char_iterator&lt;T&gt;&amp; ci) { return ptr &lt; ci.ptr; }
	bool operator&gt; (const const_char_iterator&lt;T&gt;&amp; ci) { return ptr &gt; ci.ptr; }
	bool operator&lt;= (const const_char_iterator&lt;T&gt;&amp; ci) { return ptr &lt;= ci.ptr; }
	bool operator&gt;= (const const_char_iterator&lt;T&gt;&amp; ci) { return ptr &gt;= ci.ptr; }
	T operator[] (int i) { return ptr[i]; }
	operator const T* () { return ptr; }
};

#endif
 </pre></p>
<p>Example:<br />
<pre class="brush: cpp;">
#include &quot;char_iterator.h&quot;
#include &lt;algorithm&gt;
#include &lt;iostream&gt;
#include &lt;cstring&gt;
using namespace std;

int main() {
    char s[256];
    strcpy(s, &quot;hello world!&quot;);
    replace(char_iterator&lt;char&gt;(s), char_iterator&lt;char&gt;(s + strlen(s)), 'l', 'q');
    cout &lt;&lt; s &lt;&lt; endl;
        
}
 </pre><br />
PROTIP: For wide character strings, you can use char_iterator(wchar_t*).<br />
Also there&#8217;s const_char_iterator, which works on constant arrays.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jakash3.wordpress.com/732/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jakash3.wordpress.com/732/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jakash3.wordpress.com/732/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jakash3.wordpress.com/732/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jakash3.wordpress.com/732/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jakash3.wordpress.com/732/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jakash3.wordpress.com/732/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jakash3.wordpress.com/732/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jakash3.wordpress.com/732/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jakash3.wordpress.com/732/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jakash3.wordpress.com/732/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jakash3.wordpress.com/732/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jakash3.wordpress.com/732/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jakash3.wordpress.com/732/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=732&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jakash3.wordpress.com/2011/12/31/create-iterator-from-static-array/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8244ddd5d5539eb5f9acb17709a8b022?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jakash3</media:title>
		</media:content>
	</item>
		<item>
		<title>New C++ library project</title>
		<link>http://jakash3.wordpress.com/2011/12/29/new-c-library-project/</link>
		<comments>http://jakash3.wordpress.com/2011/12/29/new-c-library-project/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 02:49:44 +0000</pubDate>
		<dc:creator>jakash3</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://jakash3.wordpress.com/?p=726</guid>
		<description><![CDATA[I&#8217;ve decided that I&#8217;m starting a new c++ library project instead of a 2nd version of AXCEL. It&#8217;s called CodeTherapy and is hosted at github: https://github.com/Jakash3/codetherapy It&#8217;s currently undergoing development. But you can watch my progress as I upload and modify source files to the repo. The stream classes will be redesigned. Instead of having [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=726&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided that I&#8217;m starting a new c++ library project instead of a 2nd version of AXCEL. It&#8217;s called CodeTherapy and is hosted at github: </p>
<p><a href="https://github.com/Jakash3/codetherapy">https://github.com/Jakash3/codetherapy</a></p>
<p>It&#8217;s currently undergoing development. But you can watch my progress as I upload and modify source files to the repo.</p>
<p>The stream classes will be redesigned. Instead of having pure virtual functions in the stream classes, they will be virtual functions with a default behavior of failing and setting the last error associated with the object to ENOTSUP (Not supported). Derived classes of stream will have to at least implement getc or putc member functions while functions like seek, tell, flush, peek, and sync will be optional to implement. The programmer then can override readable, writable, seekable, buffered, and peekable boolean functions which specify which set of optional functions are supported.</p>
<p>The string and bytes classes will be integrated with the STL.</p>
<p>My goal is to have the library handle code like this:<br />
<pre class="brush: cpp;">
stream s = fopen(&quot;foo.txt&quot;, &quot;w&quot;);
s.puts(&quot;hello world!&quot;);
s.close();
...
lnstream s = tcp::connect(&quot;www.google.com&quot;, &quot;80&quot;);
s &lt;&lt; &quot;GET &quot; &lt;&lt; resource &lt;&lt; &quot; HTTP/1.1\r\nHost: www.google.com\r\n\r\n&quot;;
string header = s.drink(&quot;\r\n\r\n&quot;);
...
s.close();
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jakash3.wordpress.com/726/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jakash3.wordpress.com/726/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jakash3.wordpress.com/726/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jakash3.wordpress.com/726/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jakash3.wordpress.com/726/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jakash3.wordpress.com/726/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jakash3.wordpress.com/726/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jakash3.wordpress.com/726/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jakash3.wordpress.com/726/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jakash3.wordpress.com/726/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jakash3.wordpress.com/726/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jakash3.wordpress.com/726/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jakash3.wordpress.com/726/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jakash3.wordpress.com/726/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=726&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jakash3.wordpress.com/2011/12/29/new-c-library-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8244ddd5d5539eb5f9acb17709a8b022?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jakash3</media:title>
		</media:content>
	</item>
		<item>
		<title>String to floating point decimal</title>
		<link>http://jakash3.wordpress.com/2011/12/27/string-to-floating-point-decimal/</link>
		<comments>http://jakash3.wordpress.com/2011/12/27/string-to-floating-point-decimal/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 23:50:01 +0000</pubDate>
		<dc:creator>jakash3</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[atof.c]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[strtod.c]]></category>

		<guid isPermaLink="false">http://jakash3.wordpress.com/?p=723</guid>
		<description><![CDATA[<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=723&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><pre class="brush: cpp;">
#include &lt;iostream&gt;
#include &lt;cctype&gt;
#include &lt;cstdlib&gt;
using namespace std;

/*
 *	stof by Jakash3
 *	Converts a string to floating point decimal using
 *	specified floating point type template
 *	The string should be in the form:
 *	[+-]?[0123456789].([.][0123456789]+)?[ ]*([eE][+-]?[0123456789]+)?
 *
 *	Example strings:
 *	25, 3.5, 3.500, 3.5e6, 3.5 e-5, 3.5E5, 3.5E-4, 3.5 e+8
 */
template &lt;typename T&gt;
T stof(const char* s) {
	T val = 0;			/* Integer part */
	T frac = 0;			/* Fractional part */
	bool neg = false;	/* Sign flag */
	
	/* Skip whitespace */
	while (isspace(*s)) s++;
	
	/* Check for sign */
	if (*s == '-') { neg = true; s++; }
	else if (*s == '+') s++;
	
	/* Read integer part */
	while (isdigit(*s))
		val = val * 10 + (*(s++) - '0');
	
	/* Read fractional part */	
	if (*s == '.') {
		T q;
		for (s++; isdigit(*s); s++); s--;
		do {
			q = *s - '0';
			frac = frac / 10 + q / 10;
		} while (isdigit(*(--s)));
		while (isdigit(*(++s))) s++;
	}
	
	/* Skip whitespace */
	while (isspace(*s)) s++;
	
	/* Combine integer and fractional part, and apply sign */
	val += frac;
	if (neg) val *= -1;
	
	/* Process E notation */
	if (*s == 'e' || *s == 'E') {
		int j = atoi(++s);
		if (j == 0) return val;
		for (int i = 0; i != j; (j &gt; 0) ? i++ : i--)
			(j &gt; 0) ? val *= 10 : val *= -10;
	}
	
	return val;
}

int main() {
	float f;
	string s;
	cout &lt;&lt; &quot;Enter float: &quot;;
	getline(cin, s);
	cout &lt;&lt; &quot;You entered &quot; &lt;&lt; stof&lt;float&gt;(s.c_str()) &lt;&lt; endl;
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jakash3.wordpress.com/723/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jakash3.wordpress.com/723/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jakash3.wordpress.com/723/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jakash3.wordpress.com/723/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jakash3.wordpress.com/723/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jakash3.wordpress.com/723/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jakash3.wordpress.com/723/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jakash3.wordpress.com/723/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jakash3.wordpress.com/723/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jakash3.wordpress.com/723/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jakash3.wordpress.com/723/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jakash3.wordpress.com/723/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jakash3.wordpress.com/723/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jakash3.wordpress.com/723/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=723&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jakash3.wordpress.com/2011/12/27/string-to-floating-point-decimal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8244ddd5d5539eb5f9acb17709a8b022?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jakash3</media:title>
		</media:content>
	</item>
		<item>
		<title>My updated string to int function</title>
		<link>http://jakash3.wordpress.com/2011/12/25/my-updated-string-to-int-function/</link>
		<comments>http://jakash3.wordpress.com/2011/12/25/my-updated-string-to-int-function/#comments</comments>
		<pubDate>Sun, 25 Dec 2011 18:36:28 +0000</pubDate>
		<dc:creator>jakash3</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[atoi]]></category>
		<category><![CDATA[atoi.c]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[stoi]]></category>
		<category><![CDATA[string to int]]></category>

		<guid isPermaLink="false">http://jakash3.wordpress.com/?p=718</guid>
		<description><![CDATA[<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=718&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><pre class="brush: cpp;">
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;cstring&gt;
#include &lt;cctype&gt;
using namespace std;

/* 
 * stoi by Jakash3
 * Converts a string to integer using specified base
 * and integer type template.
 * if base is 0, the base is then determined by a 0x, 0
 * or no prefix in the string.
 */
template &lt;typename T&gt;
T stoi(const char* s, int base) {
	T num = 0;
	bool negative = false;
	static const char digits[] = &quot;0123456789abcdefghijklmnopqrxtuvwxyz&quot;;
	
	/* Skip leading whitespace */
	while (isspace(*s)) s++;
	
	/* Check for sign */
	if (*s == '-') { negative = true; s++; }
	else if (*s == '+') s++;
	
	/* Check for base prefix */
	if (*s == '0') {
		s++;
		if (*s == 'x' || *s == 'X') {
			if (base == 0) base = 16;
			else if (base != 16) return 0;
			s++;
		} else if (isdigit(*s)) {
			if (base == 0) base = 8;
		} else if (*s == 0) return 0;
	} else if (*s == 0) return 0;
	else if (base == 0) base = 10;
	
	/* Loop through each digit */
	for (int digit; *s; s++) {
	
		/* Look for digit in the list of digits */
		const char *where = strchr(digits, tolower(*s));
		
		/* Check for valid digit */
		if (where == NULL) break;
		digit = where - digits;
		if (digit &gt;= base) break;
		
		/* Shift the number and add the new digit */
		num  = num * base + digit;
	}
	
	/* Handle negative numbers */
	if (negative) return -num;
	
	/* Done */
	return num;
}

int main() {
	string s;
	cout &lt;&lt; &quot;Enter a number: &quot;;
	getline(cin, s);
	cout &lt;&lt; stoi&lt;int&gt;(s.c_str(), 0) &lt;&lt; endl;
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jakash3.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jakash3.wordpress.com/718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jakash3.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jakash3.wordpress.com/718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jakash3.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jakash3.wordpress.com/718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jakash3.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jakash3.wordpress.com/718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jakash3.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jakash3.wordpress.com/718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jakash3.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jakash3.wordpress.com/718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jakash3.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jakash3.wordpress.com/718/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=718&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jakash3.wordpress.com/2011/12/25/my-updated-string-to-int-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8244ddd5d5539eb5f9acb17709a8b022?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jakash3</media:title>
		</media:content>
	</item>
		<item>
		<title>conio.h for Linux</title>
		<link>http://jakash3.wordpress.com/2011/12/23/conio-h-for-linux/</link>
		<comments>http://jakash3.wordpress.com/2011/12/23/conio-h-for-linux/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 05:21:49 +0000</pubDate>
		<dc:creator>jakash3</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[clrscr]]></category>
		<category><![CDATA[conio.h]]></category>
		<category><![CDATA[getch]]></category>
		<category><![CDATA[getche]]></category>
		<category><![CDATA[gotoxy]]></category>
		<category><![CDATA[kbhit]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://jakash3.wordpress.com/?p=712</guid>
		<description><![CDATA[For those of you who like to make command-line RPGs in C using conio.h, but disappointed because conio.h library is not available in Linux. Your wait is over!
I have included a modern GNU/Linux implementation of the old MS-DOS conio.h library. Included functions are getch, getche, kbhit, gotoxy, and clrscr.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=712&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For those of you who like to make command-line RPGs in C using conio.h, but disappointed because conio.h library is not available in Linux. Your wait is over!<br />
I have included a modern GNU/Linux implementation of the old MS-DOS conio.h library. Included functions are getch, getche, kbhit, gotoxy, and clrscr.</p>
<p>Header:<br />
<pre class="brush: cpp;">
/*
 *	terminal_io.h
 *	Author: Jakash3
 *	Date: 22 Dec 2011
 *	Some conio.h functions for GNU/Linux
 */
#ifndef TERMINAL_IO
#define TERMINAL_IO

#include &lt;stdio.h&gt;
#include &lt;unistd.h&gt;
#include &lt;termios.h&gt;
#include &lt;sys/select.h&gt;

// Turns terminal line buffering on or off
void terminal_lnbuf(int yn);

// Turns terminal keyboard echo on or off
void terminal_echo(int yn);

// Get next immediate character input (no echo)
int getch();

// Get next immediate character input (with echo)
int getche();

// Check if a key has been pressed at terminal
int kbhit();

// Set cursor position
void gotoxy(int x, int y);

// Clear terminal screen and set cursor to top left
void clrscr();

#endif
</pre><br />
Source:<br />
<pre class="brush: cpp;">
#include &quot;terminal_io.h&quot;

void terminal_lnbuf(int yn) {
	struct termios oldt, newt;
	tcgetattr(0, &amp;oldt);
	newt = oldt;
	newt.c_lflag &amp;= (yn ? ICANON : ~ICANON);
	tcsetattr(0, TCSANOW, &amp;newt);
}

void terminal_echo(int yn) {
	struct termios oldt, newt;
	tcgetattr(0, &amp;oldt);
	newt = oldt;
	newt.c_lflag &amp;= (yn ? ECHO : ~ECHO);
	tcsetattr(0, TCSANOW, &amp;newt);
}

void gotoxy(int x, int y) { printf(&quot;\x1B[%d;%df&quot;, y, x); }

void clrscr() { printf(&quot;\x1B[2J\x1B[0;0f&quot;); }

int getch() {
	register int ch;
	terminal_lnbuf(0);
	terminal_echo(0);
	ch = getchar();
	terminal_lnbuf(1);
	terminal_echo(1);
	return ch;
}

int getche() {
	register int ch;
	terminal_lnbuf(0);
	ch = getchar();
	terminal_lnbuf(1);
	return ch;
}

int kbhit() {
	register int ret;
	fd_set fds;
	terminal_lnbuf(0);
	terminal_echo(0);
	struct timeval tv;
	tv.tv_sec = 0;
	tv.tv_usec = 0;
	FD_ZERO(&amp;fds);
	FD_SET(0, &amp;fds);
	select(1, &amp;fds, 0, 0, &amp;tv);
	ret = FD_ISSET(0, &amp;fds);
	terminal_lnbuf(1);
	terminal_echo(1);
	return ret;
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jakash3.wordpress.com/712/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jakash3.wordpress.com/712/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jakash3.wordpress.com/712/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jakash3.wordpress.com/712/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jakash3.wordpress.com/712/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jakash3.wordpress.com/712/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jakash3.wordpress.com/712/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jakash3.wordpress.com/712/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jakash3.wordpress.com/712/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jakash3.wordpress.com/712/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jakash3.wordpress.com/712/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jakash3.wordpress.com/712/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jakash3.wordpress.com/712/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jakash3.wordpress.com/712/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=712&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jakash3.wordpress.com/2011/12/23/conio-h-for-linux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8244ddd5d5539eb5f9acb17709a8b022?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jakash3</media:title>
		</media:content>
	</item>
		<item>
		<title>Updated 4chan thread downloader</title>
		<link>http://jakash3.wordpress.com/2011/11/12/updated-4chan-thread-downloader/</link>
		<comments>http://jakash3.wordpress.com/2011/11/12/updated-4chan-thread-downloader/#comments</comments>
		<pubDate>Sat, 12 Nov 2011 23:37:39 +0000</pubDate>
		<dc:creator>jakash3</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://jakash3.wordpress.com/?p=705</guid>
		<description><![CDATA[This is updated for the version of AXCEL which was uploaded on 11/12/2011. Compiled windows binary included. Download: http://www.mediafire.com/?jyjjq712nqp5l2f Code:<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=705&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is updated for the version of AXCEL which was uploaded on 11/12/2011. Compiled windows binary included.<br />
Download: <a href="http://www.mediafire.com/?jyjjq712nqp5l2f">http://www.mediafire.com/?jyjjq712nqp5l2f</a></p>
<p>Code:<br />
<pre class="brush: php;">
#include &quot;axcel/axcel.h&quot;
use fs;
use net;

struct fcpost {
	string author;
	string img;
	long double size;
	ulong height;
	ulong width;
};

int main(int argc, char** argv) {
	unless (argc &gt; 1)
		die (
			&quot;4chan Thread Downloader by Jakash3\n&quot;
			&quot;Download all images from a thread\n&quot;
			&quot;Usage: %s THREAD_URL [-o dir] [-s max] [-d height width] &quot;
			&quot;[-a author]\n\n&quot;
			&quot;-o dir            Output directory\n&quot;
			&quot;-s max            Maximum size in kilobytes\n&quot;
			&quot;-d height width   Maximum height and width\n&quot;
			&quot;-a author         Only download images from this author\n&quot;,
			argv[0]
		);
	
	fcpost post;
	socket::tcp sock;
	http::header head;
	http::response response;
	string s = argv[1], t, u;
	file f;
	ulong i, j, k;
	data d;
	
	long double max = 0;
	ulong height = 0, width = 0;
	string author;

	for (i = 2; i &lt; argc; i++) {
		if (eq(argv[i], &quot;-o&quot;)) cd(argv[++i]);
		else if (eq(argv[i], &quot;-s&quot;)) max = stof&lt;long double&gt;(argv[++i]);
		else if (eq(argv[i], &quot;-a&quot;)) author = argv[++i];
		else if (eq(argv[i], &quot;-d&quot;)) {
			height = stoi&lt;ulong&gt;(argv[++i]);
			width = stoi&lt;ulong&gt;(argv[++i]);
		}
	}
	s = s.munch(&quot;http://&quot;).burn('#');
	unless (sock.connect(s.burn('/'), &quot;80&quot;)) {
		con.put(&quot;Failed to connect: &quot;).echo(sock.error());
		return 1;
	}
	sock &lt;&lt;
		&quot;GET /&quot; &lt;&lt; s.slurp('/') &lt;&lt; &quot; HTTP/1.1\r\n&quot;
		&quot;Host: &quot; &lt;&lt; s.burn('/') &lt;&lt; &quot;\r\n\r\n&quot;;
	response = sock.drink(&quot;\r\n&quot;);
	head = sock.drink(&quot;\r\n\r\n&quot;);

	con.put(response);
	if (response.code != 200) { sock.close(); return 1; }
	s = sock.drink(&quot;&lt;/html&gt;&quot;);
	sock.close();

	for (s.rewind(), t = s.gets(); !t.ends(&quot;&lt;/html&gt;&quot;); t = s.gets()) {
		if (t.str(&quot;&lt;a href=\&quot;http://images.4chan.org&quot;) == -1) continue;

		post.author = t.slurp(&quot;&lt;span class=\&quot;commentpostername\&quot;&gt;&quot;).burn('&lt;');
		post.img = t.slurp(&quot;&lt;span class=\&quot;filesize\&quot;&gt;&quot;).slurp(&quot;&lt;a href=\&quot;&quot;).burn('\&quot;');
		u = t.slurp(&quot;&lt;span class=\&quot;filesize\&quot;&gt;&quot;).slurp(&quot;-(&quot;);
		if (u.slurp(' ').starts(&quot;KB&quot;)) post.size = stof&lt;long double&gt;(u.burn(' '));
		else if (u.slurp(' ').starts(&quot;MB&quot;)) post.size = stof&lt;long double&gt;(u.burn(' ')) * 1024;
		else post.size = 0;
		post.height = atoi(u.slurp(&quot;, &quot;));
		post.width = atoi(u.slurp('x'));
		
		if (max) if (post.size &gt; max) continue;
		if (height) if (post.height &gt; height) continue;
		if (width) if (post.width &gt; width) continue;
		unless (author.empty()) if (post.author != author) continue;
		
		unless (f.open(post.img.rslurp('/'), &quot;wb&quot;)) {
			con &lt;&lt;
				&quot;Error opening &quot; &lt;&lt; post.img.rslurp('/') &lt;&lt; &quot; for writing: &quot; &lt;&lt;
				f.error() &lt;&lt; &quot;\n&quot;;
			return 1;
		}
		sock = socket::tcp();
		unless (sock.connect(&quot;images.4chan.org&quot;, &quot;80&quot;)) {
			con &lt;&lt; &quot;Error connecting to images.4chan.org: &quot; &lt;&lt; sock.error() &lt;&lt; &quot;\n&quot;;
			return 1;
		}

		u.clear();
		con.put(post.img);
		sock &lt;&lt;
			&quot;GET &quot; &lt;&lt; post.img.slurp(&quot;.org&quot;) &lt;&lt; &quot; HTTP/1.1\r\n&quot;
			&quot;Host: images.4chan.org\r\n\r\n&quot;;
		response = sock.drink(&quot;\r\n&quot;);
		if (response.code != 200) con.echo(&quot; FAILED&quot;);
		else con.echo();
		head = sock.drink(&quot;\r\n\r\n&quot;);
		j = atoi((string)head[&quot;Content-Length&quot;].var());
		con &lt;&lt; &quot;Downloaded 0 / &quot; &lt;&lt; j / 1024 &lt;&lt; &quot; KB&quot;;
		for (i = 0, k = 1024; i &lt; j; i++) {
			f.putc(sock.getc());
			if (i == k) {
				con.putcr();
				con &lt;&lt; &quot;Downloaded &quot; &lt;&lt; i / 1024 &lt;&lt;
				&quot;/&quot; &lt;&lt; j / 1024 &lt;&lt; &quot; KB&quot;;
				k += 1024;
			}
		}
		con.echo();
		con.echo();
		f.close();
		sock.close();
	}
	return 0;
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jakash3.wordpress.com/705/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jakash3.wordpress.com/705/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jakash3.wordpress.com/705/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jakash3.wordpress.com/705/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jakash3.wordpress.com/705/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jakash3.wordpress.com/705/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jakash3.wordpress.com/705/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jakash3.wordpress.com/705/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jakash3.wordpress.com/705/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jakash3.wordpress.com/705/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jakash3.wordpress.com/705/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jakash3.wordpress.com/705/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jakash3.wordpress.com/705/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jakash3.wordpress.com/705/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=705&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jakash3.wordpress.com/2011/11/12/updated-4chan-thread-downloader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8244ddd5d5539eb5f9acb17709a8b022?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jakash3</media:title>
		</media:content>
	</item>
		<item>
		<title>A short story</title>
		<link>http://jakash3.wordpress.com/2011/11/03/a-short-story/</link>
		<comments>http://jakash3.wordpress.com/2011/11/03/a-short-story/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 23:11:23 +0000</pubDate>
		<dc:creator>jakash3</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://jakash3.wordpress.com/?p=697</guid>
		<description><![CDATA[This is my first non-coding post. This was a class assignment, supposed to be my made up greek myth story. Even though I got off track from having it be a greek myth, people still thought it was pretty good so I will share it. The title is &#8220;Transfer&#8221;: Chris was nothing more than what [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=697&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is my first non-coding post. This was a class assignment, supposed to be my made up greek myth story. Even though I got off track from having it be a greek myth, people still thought it was pretty good so I will share it. The title is &#8220;Transfer&#8221;:</p>
<p>	Chris was nothing more than what appeared to be an average boring highschool loner. He lived around an urban city, where life moves fast in accordance to the state of trance everybody goes through from weekday to weekday. The alarm goes off; the sound of bustling cars, pedestrians, and the various music that comes accompanied with hologram street advertisements starts playing. Chris grudgingly gets up, selects his outfit for the day from the menu displayed on his mirror, and after a few more preparations he&#8217;s off to school. As soon as the streetlight gave the signal, everybody including Chris started to walk to the other side of the street; everybody facing forward, walking at the same pace, having the same blank expression on all their faces. </p>
<p>	However, when Chris got to the other side he came to realize that he&#8217;s more late than he thought and decided to take a shortcut through an unfamiliar area, where an abandoned factory is located. As it became apparent that he was breaking off his daily trail, his pet hologram which was part of his reality augmentation vision spawned into his view. These pets are assigned to every student in the district, their artificial intelligence are based on the assigned student&#8217;s schedule. Whenever the student gets off track from their destination, these entities hint to their user where to go. The software includes an agenda, date and time display, school news feed, student&#8217;s schedule and ID, and among other things a signal to allow the student&#8217;s location to be tracked. The digital shark began to speak and said: “Chris are you lost? School is that way!” as he pointed to the opposite direction of where Chris was walking. Chris always gets annoyed by this startup spyware program, and with a little hack he terminated it. </p>
<p>	When Chris reached the factory, he decided that he was just going to ditch school today. He&#8217;s already very late and the whole place looked interesting to explore anyways. He effortlessly pushed an already partially open metal door. Inside you could see mostly empty space, with trees and plants growing in and around the pillars and cracks. You could also literally see the light rays shine through the windows on such a bright morning. What made it even more interesting was that none of the walls had animated interfaces or location labels and the floors were lacking moving directional arrows. It was a plain old factory probably built at the beginning of the 21st century. </p>
<p>“What could it have been like?” Chris said to himself. “I know&#8230;” said a female voice from an unknown direction.<br />
“What? Who are you? Reveal yourself!”<br />
“Calm yourself child.”<br />
From behind the palm plants, a really hot 18 year old girl walks out. Wearing nothing&#8230;.except a plain white dress.<br />
“Child? We&#8217;re like the same age. And why are you here?”<br />
“Same reason. I love candy.”<br />
“Did you follow me here?”<br />
“Why would I follow a hopeless mortal like yourself? I am Artemis: Goddess of the Forest, and I&#8217;m here to eat your soul.”<br />
“&#8230;.okay”<br />
“But seriously this is my house. Why would you come here? Don&#8217;t you usually play with your devices of electronic computation like the rest of the other humans? This place is too boring for you.”<br />
“I don&#8217;t know, I&#8217;m tired of doing the same thing everyday.”<br />
“Ooh a free thinker, you must think you&#8217;re special.”<br />
“Just leave me alone.”<br />
“Again, it is actually you that must leave me alone. This is my house.”<br />
“Whatever you are not fartemis or whatever it&#8217;s called. Where did you get a funny name like that?”<br />
“All of mankind&#8217;s information at your fingertips anytime you want and yet you are still ignorant enough to not know about Greek mythology? Hades has done a good job at brainwashing all of you.”<br />
“Hades who? Never mind, I&#8217;ll just go home.”<br />
“Good.”</p>
<p>	Chris walked out of the building. But instead of going home like he said he would, Chris went back into the factory from a different entrance. As Chris explored the factory, weird things started to happen. Droplets of water would stop in mid-air, a rush of blowing wind would be followed by a rush of sucking wind as if time would be going backwards, generally many things that didn&#8217;t follow the normal rules of time and gravity were happening. Of course, none of this phased Chris as the distinction between reality and virtual reality has been blurred in this time period. Chris thought to himself: “Maybe this factory is newer but it&#8217;s graphics have been messed up from not being maintained.”. Chris soon realized that there was something not normal going on when he found that he was able to control objects with his hand gestures despite not having a system operator&#8217;s access card. The objects he was manipulating were even solid, that means they were real! In experiencing the pure magical precision, Chris came to realize the obviousness of reality.  </p>
<p>	Chris played for hours using his new found powers. He would jump high in the air and fall down on his back slowly and gracefully as if he was underwater. Everything would just flow naturally in slow motion like feathers, even the reflections that would shine from water droplets in the air would slowly change shape as they became affected by the diminished forces of gravity. Chris came to appreciate the beauty of seeing the results of molecular actions at a tempo where he is able to comprehend and predict everything that would happen. The rainbows of light rays even adjusted to this precision of gravity, blinding the now meaningless issues of the outside world. At this point hours have passed into late hours of the day, Chris has lost all track of time and continues to amaze himself even though he is in a spooky factory at night now. </p>
<p>	Good things can&#8217;t last forever. Even though Chris is experiencing a whole new reality, he cannot leave behind the reality of his own world. Black cars show up outside the factory. Men with jumpsuits barge in and invade. Chris comes back to normal as they shine flashlights in his eyes and handcuff him.  When Chris is taken outside, he is blinded by the lights of the cars. Everything happened so fast now and it was all just a blur to Chris, the last thing he remembered was seeing an agent in a black suit making the command: “clean it up”. The entire factory was blocked off, chemicals were sprayed everywhere, and then the building was dismantled. </p>
<p>	Chris woke up in his bed the next morning not knowing what to believe. He went back to the factory only to discover that it has been replaced by an empty parking lot. At this moment nothing felt more lonely and empty. To lose something that he only got to experience once in what is otherwise a boring life filled with boundaries. No one will ever believe his story, as he can barely even believe it himself. It&#8217;s something that he wouldn&#8217;t even be able to describe in words of what happened; something that only the person experiencing it would understand. He looked back at the city where he saw his classmates walk across the same street going to school in almost identical expressionless fashion again.  Always looking the same direction, everybody else doing the same thing every morning. With nothing left but curiosity, Chris began his research on Greek gods.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jakash3.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jakash3.wordpress.com/697/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jakash3.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jakash3.wordpress.com/697/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jakash3.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jakash3.wordpress.com/697/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jakash3.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jakash3.wordpress.com/697/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jakash3.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jakash3.wordpress.com/697/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jakash3.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jakash3.wordpress.com/697/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jakash3.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jakash3.wordpress.com/697/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=697&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jakash3.wordpress.com/2011/11/03/a-short-story/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8244ddd5d5539eb5f9acb17709a8b022?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jakash3</media:title>
		</media:content>
	</item>
		<item>
		<title>4chan image downloader</title>
		<link>http://jakash3.wordpress.com/2011/10/10/4chan-image-downloader/</link>
		<comments>http://jakash3.wordpress.com/2011/10/10/4chan-image-downloader/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 23:25:18 +0000</pubDate>
		<dc:creator>jakash3</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://jakash3.wordpress.com/?p=693</guid>
		<description><![CDATA[I made this because it gets inconvenient when ppl dump nice prn in /s/ without uploading it to a file host. Download windows binary here: http://www.mediafire.com/?qzau3k7rv2o253v This code is outdated, since newer versions of axcel has been released:<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=693&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I made this because it gets inconvenient when ppl dump nice prn in /s/ without uploading it to a file host.<br />
Download windows binary here: <a href="http://www.mediafire.com/?qzau3k7rv2o253v">http://www.mediafire.com/?qzau3k7rv2o253v</a></p>
<p>This code is outdated, since newer versions of axcel has been released:<br />
<pre class="brush: php;">
#include &quot;axcel.h&quot;
using namespace axcel;

struct fcpost {
	String author;
	String img; 
	long double size; 
	ulong height; 
	ulong width;
};

int main(int argc, char** argv) {
	unless (argc &gt; 1)
		die(
			&quot;4chan Thread Downloader by Jakash3\n&quot;
			&quot;Download all images from a thread\n&quot;
			&quot;Usage: %s THREAD_URL [-o dir] [-s max] [-d height width] [-a author]\n\n&quot;
			&quot;-o dir            Output directory of files (default: current directory)\n&quot;
			&quot;-s max            Maximum size in kilobytes of images to download\n&quot;
			&quot;-d height width   Maximum height and width of images to download\n&quot;
			&quot;-a author         Only download images posted by specified author\n&quot;,
			argv[0]
		);
		
	TCP sock;
	String s = argv[1], t, u;
	File f;
	struct fcpost post;
	ulong i, j, k;
	
	long double max = 0;
	ulong height = 0, width = 0;
	String author;
	
	for (i = 2; i &lt; argc; i++) {
		if (eq(argv[i], &quot;-o&quot;)) cd(argv[++i]);
		else if (eq(argv[i], &quot;-s&quot;)) max = stof&lt;long double&gt;(argv[++i]);
		else if (eq(argv[i], &quot;-d&quot;)) { height = stoi&lt;ulong&gt;(argv[++i]); width = stoi&lt;ulong&gt;(argv[++i]); }
		else if (eq(argv[i], &quot;-a&quot;)) author = argv[++i];
	}
	s = s.munch(&quot;http://&quot;);
	unless (sock.connect(s.burn('/'), &quot;80&quot;))
		die (&quot;Failed to connect!\n&quot;);
	sock &lt;&lt;
		&quot;GET /&quot; &lt;&lt; s.slurp('/') &lt;&lt; &quot; HTTP/1.1\r\n&quot;
		&quot;Host: &quot; &lt;&lt; s.burn('/') &lt;&lt; &quot;\r\n\r\n&quot;;
	until (t.ends(&quot;\r\n\r\n&quot;)) t += sock.gets();
	con.echo(t.tok(0, '\r'));
	s.clear();
	for (i = 0, j = atoi(t.slurp(&quot;Content-Length: &quot;)); i &lt; j; i++)
		s += sock.getc();
	sock.close();
	for (s.rewind(), t = s.gets(); !s.eof(); t = s.gets()) {
		if (t.str(&quot;&lt;a href=\&quot;http://images.4chan.org&quot;) == -1) continue;
		post.author = t.slurp(&quot;&lt;span class=\&quot;commentpostername\&quot;&gt;&quot;).burn('&lt;');
		post.img = t.slurp(&quot;&lt;span class=\&quot;filesize\&quot;&gt;&quot;).slurp(&quot;&lt;a href=\&quot;&quot;).burn('\&quot;');
		u = t.slurp(&quot;&lt;span class=\&quot;filesize\&quot;&gt;&quot;).slurp(&quot;-(&quot;);
		if (u.slurp(' ').starts(&quot;KB&quot;)) post.size = stof&lt;long double&gt;(u.burn(' '));
		else if (u.slurp(' ').starts(&quot;MB&quot;)) post.size = stof&lt;long double&gt;(u.burn(' ')) * 1024;
		else post.size = 0;
		post.height = atoi(u.slurp(&quot;, &quot;));
		post.width = atoi(u.slurp('x'));
		if (max) if (post.size &gt; max) continue;
		if (height) if (post.height &gt; height) continue;
		if (width) if (post.width &gt; width) continue;
		if (!author.empty()) if (post.author != author) continue;
		if (!f.open(post.img.rslurp('/'), &quot;wb&quot;)) {
			con &lt;&lt; &quot;Failed to open &quot; &lt;&lt; post.img.rslurp('/') &lt;&lt; &quot; for writing!\n&quot;;
			return 1;
		}
		unless (sock.connect(&quot;images.4chan.org&quot;, &quot;80&quot;))
			die (&quot;Failed to connect to images.4chan.org!\n&quot;);
		u.clear();
		con.echo(post.img);
		sock &lt;&lt; &quot;GET &quot; &lt;&lt; post.img.slurp(&quot;.org&quot;) &lt;&lt; &quot; HTTP/1.1\r\nHost: images.4chan.org\r\n\r\n&quot;;
		until (u.ends(&quot;\r\n\r\n&quot;)) u += sock.gets();
		j = atoi(u.slurp(&quot;Content-Length: &quot;));
		con &lt;&lt; &quot;Downloaded 0 / &quot; &lt;&lt; j / 1024 &lt;&lt; &quot; KB&quot;;
		for (i = 0, k = 1024; i &lt; j; i++) {
			f.putc(sock.getc());
			if (i == k) {
				con.putcr(); con &lt;&lt; &quot;Downloaded &quot; &lt;&lt; i / 1024 &lt;&lt; &quot;/&quot; &lt;&lt; j / 1024 &lt;&lt; &quot; KB&quot;; k += 1024;
			}
		}
		con.echo();
		con.echo();
		f.close();
		sock.close();
	}
	
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jakash3.wordpress.com/693/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jakash3.wordpress.com/693/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jakash3.wordpress.com/693/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jakash3.wordpress.com/693/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jakash3.wordpress.com/693/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jakash3.wordpress.com/693/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jakash3.wordpress.com/693/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jakash3.wordpress.com/693/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jakash3.wordpress.com/693/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jakash3.wordpress.com/693/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jakash3.wordpress.com/693/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jakash3.wordpress.com/693/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jakash3.wordpress.com/693/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jakash3.wordpress.com/693/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jakash3.wordpress.com&amp;blog=9981752&amp;post=693&amp;subd=jakash3&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jakash3.wordpress.com/2011/10/10/4chan-image-downloader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8244ddd5d5539eb5f9acb17709a8b022?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jakash3</media:title>
		</media:content>
	</item>
	</channel>
</rss>
