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

<channel>
	<title>Strogn.com</title>
	<atom:link href="http://strogn.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://strogn.com</link>
	<description>Python, JS, C, and whatever else is making the world tick.</description>
	<pubDate>Mon, 27 Jul 2009 23:49:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>C&#8217;s Comeback!</title>
		<link>http://strogn.com/2009/07/27/cs-comeback/</link>
		<comments>http://strogn.com/2009/07/27/cs-comeback/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 23:49:41 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[C]]></category>

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

		<guid isPermaLink="false">http://strogn.com/?p=21</guid>
		<description><![CDATA[In my desire to finally completely work through K&#38;R I decided to start at the beginning. The fruit of today&#8217;s labor:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include &#60;stdio.h&#62;
main&#40;&#41;&#123;
	int fahr, celcius;
	int lower, upper, step;
	lower = 0;
	upper = 300;
	step = 20;
	fahr = lower;
	while &#40;fahr &#60;= upper&#41;&#123;
		celcius = &#40;fahr - 32&#41; / 1.8;
		printf&#40;&#34;%d\t%d\n&#34;, fahr, celcius&#41;;
		fahr = fahr + step;
	&#125;
&#125;

A very simple bit of C [...]]]></description>
			<content:encoded><![CDATA[<p>In my desire to finally completely work through K&amp;R I decided to start at the beginning. The fruit of today&#8217;s labor:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span>
main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">int</span> fahr<span style="color: #339933;">,</span> celcius<span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> lower<span style="color: #339933;">,</span> upper<span style="color: #339933;">,</span> step<span style="color: #339933;">;</span>
	lower <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
	upper <span style="color: #339933;">=</span> <span style="color: #0000dd;">300</span><span style="color: #339933;">;</span>
	step <span style="color: #339933;">=</span> <span style="color: #0000dd;">20</span><span style="color: #339933;">;</span>
	fahr <span style="color: #339933;">=</span> lower<span style="color: #339933;">;</span>
	<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>fahr <span style="color: #339933;">&lt;=</span> upper<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		celcius <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>fahr <span style="color: #339933;">-</span> <span style="color: #0000dd;">32</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color:#800080;">1.8</span><span style="color: #339933;">;</span>
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d<span style="color: #000099; font-weight: bold;">\t</span>%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> fahr<span style="color: #339933;">,</span> celcius<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		fahr <span style="color: #339933;">=</span> fahr <span style="color: #339933;">+</span> step<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>A very simple bit of C without a lot of depth of fancy hackery that converts the temps in Fahrenheit starting at 0 to 300 degrees in intervals of 20 to Celsius. </p>
]]></content:encoded>
			<wfw:commentRss>http://strogn.com/2009/07/27/cs-comeback/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Minimizing Documents</title>
		<link>http://strogn.com/2009/07/06/minimizing-documents/</link>
		<comments>http://strogn.com/2009/07/06/minimizing-documents/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 14:32:09 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Coding]]></category>

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

		<guid isPermaLink="false">http://strogn.com/?p=14</guid>
		<description><![CDATA[Recently I have been doing a bit of work using JS to build the entire DOM for a page after only passing it a JS Array of the contents, this technique works quite well to reduce server load as all the processing is done on the client&#8217;s site with identical templating information sent to everyone, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have been doing a bit of work using JS to build the entire DOM for a page after only passing it a JS Array of the contents, this technique works quite well to reduce server load as all the processing is done on the client&#8217;s site with identical templating information sent to everyone, and only an array that is different.</p>
<p>One problem while writing code this way is that I needed a simple way to insert an entire template into one line of JS code. Most everything was html, which meant new line and tab characters were pretty prevalent. All I needed was a simple script to strip out new lines and tabs, sounds like a perfect job for Python.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
<span style="color: #808080; font-style: italic;"># encoding: utf-8</span>
<span style="color: #483d8b;">&quot;&quot;&quot;
htmlMinimizer.py
&nbsp;
Created by Christopher King on 2009-07-03.
Copyright (c) 2009 Strogn Consulting. All rights reserved.
&quot;&quot;&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#imports</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">string</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#files and containers</span>
sourceFile = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'inputFile.html'</span>, <span style="color: #483d8b;">'rw'</span><span style="color: black;">&#41;</span>
destFile = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'outputFileOneLine.html'</span>, <span style="color: #483d8b;">'wb'</span><span style="color: black;">&#41;</span>
destContainer = <span style="color: #483d8b;">&quot;&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#itterative work</span>
<span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> sourceFile:
	lineContent = <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>line<span style="color: black;">&#41;</span>
	lineContent = lineContent.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: black;">&#41;</span>
	lineContent = lineContent.<span style="color: black;">rstrip</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
	destContainer = destContainer + lineContent
&nbsp;
<span style="color: #808080; font-style: italic;">#file writing</span>
destFile.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #008000;">str</span><span style="color: black;">&#40;</span>destContainer<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#file closing</span>
sourceFile.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
destFile.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#confirmation message</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Document Minimized!&quot;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://strogn.com/2009/07/06/minimizing-documents/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://strogn.com/2009/06/20/hello-world/</link>
		<comments>http://strogn.com/2009/06/20/hello-world/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 02:36:04 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Coding]]></category>

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

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

		<guid isPermaLink="false">http://strogn.com/?p=1</guid>
		<description><![CDATA[Ah, a fresh install of WordPress…. New design is out mostly and the time has come to apply some content. Normally I delete this post and start my ow but considering this is a programming / web design blog it seemed an appropriate enough title. So without further ado, the first bit of code:
Simple Python [...]]]></description>
			<content:encoded><![CDATA[<p>Ah, a fresh install of WordPress…. New design is out mostly and the time has come to apply some content. Normally I delete this post and start my ow but considering this is a programming / web design blog it seemed an appropriate enough title. So without further ado, the first bit of code:</p>
<h4>Simple Python snippet to parse a TSV(tab separated value) into a list:</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'fileName.tsv'</span>, <span style="color: #483d8b;">'rU'</span><span style="color: black;">&#41;</span>:
    lineEntry = line.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\t</span>'</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<h4>jQuery powered script to hide a given div on pageload</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.divToHide&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p> That&#8217;s all for now, check back again soon. </p>
]]></content:encoded>
			<wfw:commentRss>http://strogn.com/2009/06/20/hello-world/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
