<?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>Kyle Krafka &#124; Kyle Krafka</title>
	<atom:link href="http://www.kylekrafka.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kylekrafka.com</link>
	<description>My Slice of the Web</description>
	<lastBuildDate>Mon, 27 May 2013 20:12:36 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Automatically Entering Online Contests</title>
		<link>http://www.kylekrafka.com/blog/2013/03/12/automated-contest-entry/</link>
		<comments>http://www.kylekrafka.com/blog/2013/03/12/automated-contest-entry/#comments</comments>
		<pubDate>Tue, 12 Mar 2013 19:02:49 +0000</pubDate>
		<dc:creator>Kyle Krafka</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[contest]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.kylekrafka.com/?p=192</guid>
		<description><![CDATA[As a geek, any time I have to do something more than a few times in a row, I start to ask the question, &#8220;Can this be automated?&#8221;  So when an online contest comes along requiring some mundane task, my mind gets in problem-solving mode and looks for the better &#8230;]]></description>
				<content:encoded><![CDATA[<p><img class="aligncenter size-large wp-image-354" alt="sweepstakes-entry" src="http://www.kylekrafka.com/wp-content/uploads/2013/03/sweepstakes-entry-1024x411.png" width="660" height="264" /></p>
<p>As a geek, any time I have to do something more than a few times in a row, I start to ask the question, &#8220;Can this be automated?&#8221;  So when an online contest comes along requiring some mundane task, my mind gets in problem-solving mode and looks for the better way to win.  Now, there is an ethical question here that needs to be addressed, but as long as the game&#8217;s rules don&#8217;t prohibit automated entries and the entry form doesn&#8217;t include a CAPTCHA, I&#8217;m not sure there&#8217;s a problem.</p>
<p>A number of years back, there was a Flash game on a band&#8217;s website.  Essentially, it was Whac-A-Mole, where the band members popped up randomly and you had to click them.  Each click earned you a point and if you missed enough times, the game ended.  Ultimately, it was a game of patience, not skill.  The highest scores (those who would win prizes) indicated they had played the game for around a day, or more likely, automated the process.  I automated it simply by having my mouse click all of the locations over and over.  I used a program, but now I would probably code something up using Java&#8217;s Robot class.</p>
<p>Just recently, I found a contest that offered a daily game, then daily entry to the contest.  Really, you didn&#8217;t have to play the game to enter the contest, though.  And, the entry form is pretty simple: fill it out and click &#8220;Submit.&#8221;  Every day.  So I took it as an opportunity to learn a little bit about automating HTTP POST requests, which is how most web forms operate.  It really wasn&#8217;t hard, but to do it exactly the way I did it, you&#8217;ll need a bit of knowledge about HTTP requests, and an always-on Linux server.</p>
<p>The program at the center of it all is <strong>curl</strong>.  That&#8217;s what will send the HTTP POST request and return the contest server&#8217;s response (likely in HTML).  I also used <strong>shuf</strong> to generate random numbers in a range, and <strong>cron</strong>, <strong>at</strong>, and <strong>sleep</strong> to schedule the script to run in a random time frame each day.</p>
<p>First, the scripts. I put this in my home directory as <code>enterContest.sh</code> (with appropriate permissions):</p>
<pre class="brush: bash; title: ; notranslate">#!/bin/bash
# Mar. 11, 2013 by KJK
sleep $(shuf -i 0-59 -n 1)
echo &quot;===== $(date) =====&quot; &gt;&gt; /home/MYACCOUNT/enterContest.log
curl --data &quot;loadStage=2&amp;contest=THEGAME&amp;time=$(shuf -i 60000-780000 -n 1)&amp;email=MYEMAIL&amp;password=MYPASSWORD&amp;comment=&amp;SUBMIT=Enter&quot; http://www.theurl.com/action/of/form &gt;&gt; /home/MYACCOUNT/enterContest.log
echo &quot;

&quot; &gt;&gt; /home/MYACCOUNT/enterContest.log</pre>
<p>Then, I put a file called <code>enterContest</code> in the <code>/etc/cron.daily</code> directory which automatically makes it run daily:</p>
<pre class="brush: bash; title: ; notranslate">#!/bin/bash
at -f /home/MYACCOUNT/enterContest.sh now + $(shuf -i 1-480 -n 1) minutes</pre>
<p>In the second script, all it&#8217;s doing is calling the first script at a random time in a range. This is necessary because scripts in <code>cron.daily</code> are executed at the same time every day. <code>at -f</code> executes a file at a later time, and the <code>shuf</code> command (in parenthesis) is a nice little tool to generate a random number.</p>
<p>The first script pauses some number of seconds because I don&#8217;t think <code>at</code> will delay with anything finer than minute precision, and I didn&#8217;t want the request going in with the same seconds part of timestamp every day. Then, the two echo lines are simply to log the response for later review. <code>curl</code> is doing all of the work. Though the string with all of the <code>&amp;</code> symbols looks like a GET request in a URL, it&#8217;s actually the POST data: still just named values. The URL is the <code>action</code> attribute of the form (where the data should be delivered) and the end of the line specifies the response should be logged to a file. The different variables in the POST data string are all named fields in the form. <code>loadStage</code> and <code>contest</code> were hidden fields, so I just copied the hard-coded values. <code>time</code> was the number of seconds I spent playing the game, so I randomized that. I didn&#8217;t fill out <code>comment</code> at all, as it was an optional field. <code>password</code> is written and sent over the web in plain text, but that&#8217;s not much different than what would happen if I were to use a web browser. It&#8217;s the responsibility of the web developers to enable HTTPS instead of HTTP.  Developers can prevent automated entries by employing the use of a CAPTCHA, but they still have weaknesses (e.g. modern computer vision algorithms, crowdsourcing).</p>
<p>So far, I haven&#8217;t won anything with this script yet, but according to the log, I&#8217;ve entered the contest every day.  Taking the time to write the script will end up saving time in the long run.  I&#8217;m just satisfied to know that it can be done!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kylekrafka.com/blog/2013/03/12/automated-contest-entry/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why KJKJava?</title>
		<link>http://www.kylekrafka.com/blog/2013/03/12/why-kjkjava/</link>
		<comments>http://www.kylekrafka.com/blog/2013/03/12/why-kjkjava/#comments</comments>
		<pubDate>Tue, 12 Mar 2013 19:02:11 +0000</pubDate>
		<dc:creator>Kyle Krafka</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[name]]></category>
		<category><![CDATA[screen name]]></category>
		<category><![CDATA[username]]></category>

		<guid isPermaLink="false">http://www.kylekrafka.com/?p=201</guid>
		<description><![CDATA[Whenever I need to register a username and I don&#8217;t use my real name for whatever reason, I use &#8220;kjkjava.&#8221; (Spell check always changes that to &#8220;kick java.&#8221;) KJK are my initials and I first used it as my AIM screen name back in middle school. I was never a &#8230;]]></description>
				<content:encoded><![CDATA[<p><img class="aligncenter size-large wp-image-352" alt="kjkjava" src="http://www.kylekrafka.com/wp-content/uploads/2013/03/kjkjava-1024x354.png" width="660" height="228" /></p>
<p>Whenever I need to register a username and I don&#8217;t use my real name for whatever reason, I use &#8220;kjkjava.&#8221; (Spell check always changes that to &#8220;kick java.&#8221;) KJK are my initials and I first used it as my AIM screen name back in middle school. I was never a huge fan of it, but it stuck, and I grew into it.</p>
<p>Back then, I was learning how to make websites and didn&#8217;t really make a distinction between HTML (which I understood) and JavaScript (which I copied and pasted). In fact, I don&#8217;t even think I knew there was a difference between Java and JavaScript. I certainly didn&#8217;t know Java. But I do now! It&#8217;s currently my language of choice because I teach it. Also, I didn&#8217;t drink coffee then, but I love it now! How perfect!</p>
<p>In the screenshot above, you can see my first website on Geocities.  Also, there&#8217;s a chat log from an IRC channel I hung out in with a couple of friends.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kylekrafka.com/blog/2013/03/12/why-kjkjava/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Goals for this Site</title>
		<link>http://www.kylekrafka.com/blog/2013/02/17/goals-for-this-site/</link>
		<comments>http://www.kylekrafka.com/blog/2013/02/17/goals-for-this-site/#comments</comments>
		<pubDate>Mon, 18 Feb 2013 03:29:19 +0000</pubDate>
		<dc:creator>Kyle Krafka</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[goal]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://kylekrafka.com/?p=123</guid>
		<description><![CDATA[Overarching Goals Central place for people to connect with, and learn about, me Contact information Place to share… Things I&#8217;ve created or done Things I&#8217;ve learned about Other thoughts and ideas that are bigger than a Facebook status or a tweet Two Main Reasons for the Redesign Why is it &#8230;]]></description>
				<content:encoded><![CDATA[<h3><img class="aligncenter size-large wp-image-350" alt="website-goals" src="http://www.kylekrafka.com/wp-content/uploads/2013/02/website-goals-1024x354.png" width="660" height="228" /></h3>
<h3>Overarching Goals</h3>
<ul>
<li>Central place for people to connect with, and learn about, me</li>
<li>Contact information</li>
<li>Place to share…
<ul>
<li>Things I&#8217;ve created or done</li>
<li>Things I&#8217;ve learned about</li>
<li>Other thoughts and ideas that are bigger than a Facebook status or a tweet</li>
</ul>
</li>
</ul>
<h3>Two Main Reasons for the Redesign</h3>
<p>Why is it that after designing numerous websites for other people, it&#8217;s so hard for me to design my own?  I&#8217;ve had this domain, kylekrafka.com, for years now, but I&#8217;ve not yet been fully satisfied with the website on it.  When I first purchased it, I went to considerable effort to write a site from scratch using clean and valid HTML/CSS/PHP.  I made images sprites for rollovers, wrote some good copy, and employed all the SEO techniques I knew (even though I don&#8217;t have much competition for &#8220;Kyle Krafka&#8221; searches).  Technically, I had designed my dream website.  Why then, did I never publicize it?  Why did I never announce its release on Facebook?  I wasn&#8217;t really happy with it, and in retrospect, I think this lack of pride was due to two problems: I&#8217;m not a graphic designer, and it wasn&#8217;t easy enough to add new content.</p>
<p>I have a great appreciation for quality design work, and I know how to work with design software, but that doesn&#8217;t make me a designer.  I was never really satisfied with the way my site looked, and I couldn&#8217;t put my finger on the problem.  This time around, I decided to suck it up, and use someone else&#8217;s talent.  No, it&#8217;s no longer entirely my work, but I&#8217;m okay with that.  I&#8217;ll stick to what I&#8217;m good with and I doubt anyone else will care.</p>
<p>As for adding new content, I had to make layouts in HTML, manually resize images, put everything in appropriate directories, update any files that would link to the new content, then upload via FTP.  No, it wasn&#8217;t terrible, and I knew how to do it all, but when my focus was on something worth sharing, I didn&#8217;t like the distractions.  The better solution is to have an administrative interface to edit in, and dynamically build pages from content in a database.  That&#8217;s not an easy solution to code up (if done right) but it&#8217;s definitely a more enjoyable experience for adding content.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kylekrafka.com/blog/2013/02/17/goals-for-this-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is this thing on?</title>
		<link>http://www.kylekrafka.com/blog/2013/01/18/hello-world/</link>
		<comments>http://www.kylekrafka.com/blog/2013/01/18/hello-world/#comments</comments>
		<pubDate>Fri, 18 Jan 2013 11:41:45 +0000</pubDate>
		<dc:creator>Kyle Krafka</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://wordpress.kylekrafka.com/?p=1</guid>
		<description><![CDATA[Whoa.  Does this thing work!? Sure does!  Sweet.  Check out this picture.]]></description>
				<content:encoded><![CDATA[<p>Whoa.  Does this thing work!?</p>
<p>Sure does!  Sweet.  Check out this picture.</p>
<p><img class="aligncenter size-large wp-image-348" alt="birds-on-wire" src="http://www.kylekrafka.com/wp-content/uploads/2013/01/birds-on-wire-1024x682.jpg" width="660" height="439" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kylekrafka.com/blog/2013/01/18/hello-world/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
