<?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>The Cowgirl Coder</title>
	<atom:link href="http://thecowgirlcoder.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://thecowgirlcoder.com</link>
	<description>An educational community for coders</description>
	<lastBuildDate>Tue, 31 Jan 2012 05:42:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to recruit a software developer. (Part 3)</title>
		<link>http://thecowgirlcoder.com/2012/01/31/how-to-recruit-a-software-developer-part-3/</link>
		<comments>http://thecowgirlcoder.com/2012/01/31/how-to-recruit-a-software-developer-part-3/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 05:42:50 +0000</pubDate>
		<dc:creator>tarah</dc:creator>
				<category><![CDATA[Ethics]]></category>
		<category><![CDATA[Social media]]></category>

		<guid isPermaLink="false">http://thecowgirlcoder.com/?p=412</guid>
		<description><![CDATA[As promised, we&#8217;ll talk about the traits of successful recruiters. Good recruiters look for people to fit a position, and pursue them individually. I&#8217;ve mentioned before that my name and resume pop on Google search results when a recruiter is looking for a senior web architect or development manager in the Seattle area. The best [...]]]></description>
			<content:encoded><![CDATA[<p>As promised, we&#8217;ll talk about the traits of successful recruiters.</p>
<p>Good recruiters look for people to fit a position, and pursue them individually. I&#8217;ve mentioned before that my name and resume pop on Google search results when a recruiter is looking for a senior web architect or development manager in the Seattle area. The best experiences I have ever had with recruiters come from these approaches, and they are instantly distinguishable from the usual. </p>
<p>One recruiter, Shannon Anderson from <a href="http://www.nuwestgroup.com/">NuWest Group</a> out of Bellevue, personifies this approach. She&#8217;s professional, spectacular at her job, and rarely presents more than a single candidate for a job. She matches people perfectly, and as a result, she gets a near perfect return on her investment and an ongoing relationship. It&#8217;s more like talking to a very friendly and competent matchmaker, and I&#8217;d encourage anyone to work with her or someone like her.</p>
<p>She makes personal connections, and takes her time getting to know her candidates.</p>
<p>Other great recruiters have a large database of positions, and instead of matching a candidate to a job, they match a job to a great candidate. Tara Gowland runs <a href="http://www.startuprecroot.com/">Startup Recroot</a>, a Seattle-based firm, and her approach is to find spectacular and competent people, and try to pair them with positions that she&#8217;ll seek out. Her approach to me was diffident, even shy, which was a refreshing change from the normal TRUMPETS BLARING approach. </p>
<p>Now, while I can recommend each of these firms, and most specifically these two recruiters, I can&#8217;t tell you about the positions for which I was either hired or interviewed, since that breaks some confidentiality agreements. However, if you find recruiters like these ladies, I heartily recommend that you not only work with them, but that you give them all the social media and blogging help you can. Firms that are ethical, helpful, and who have recruiters with personal and competent approaches are few and far between.</p>
<p>Find these firms, and work with them. They&#8217;re full disclosure, honest, and they&#8217;re great at what they do. Please feel free to leave other firms that you&#8217;ve been happy to work with in the comments. </p>
]]></content:encoded>
			<wfw:commentRss>http://thecowgirlcoder.com/2012/01/31/how-to-recruit-a-software-developer-part-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tarah Wheeler Van Vlack&#8217;s SCCC appearance POSTPONED DUE TO WEATHER</title>
		<link>http://thecowgirlcoder.com/2012/01/17/tarah-wheeler-van-vlacks-sccc-appearance-postponed-due-to-weather/</link>
		<comments>http://thecowgirlcoder.com/2012/01/17/tarah-wheeler-van-vlacks-sccc-appearance-postponed-due-to-weather/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 23:01:33 +0000</pubDate>
		<dc:creator>tarah</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thecowgirlcoder.com/?p=405</guid>
		<description><![CDATA[I will be appearing on February 8th instead. Stay safe; do not drive!]]></description>
			<content:encoded><![CDATA[<p>I will be appearing on February 8th instead. Stay safe; do not drive!</p>
]]></content:encoded>
			<wfw:commentRss>http://thecowgirlcoder.com/2012/01/17/tarah-wheeler-van-vlacks-sccc-appearance-postponed-due-to-weather/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to recruit a software developer. (Part 2)</title>
		<link>http://thecowgirlcoder.com/2012/01/12/how-to-recruit-a-software-developer-part-2/</link>
		<comments>http://thecowgirlcoder.com/2012/01/12/how-to-recruit-a-software-developer-part-2/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 06:10:56 +0000</pubDate>
		<dc:creator>tarah</dc:creator>
				<category><![CDATA[Ethics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://thecowgirlcoder.com/?p=400</guid>
		<description><![CDATA[We&#8217;ll continue with the problem of incentivization for recruiters. Recruiting must be the most outsourced, underfunded, middleman-heavy profession there is. There are several frustrations that go along with being heavily recruited by people who do not know or care whether you fit a given job description, and they range from the merely careless and time-profligate [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ll continue with the problem of incentivization for recruiters.</p>
<p>Recruiting must be the most outsourced, underfunded, middleman-heavy profession there is. There are several frustrations that go along with being heavily recruited by people who do not know or care whether you fit a given job description, and they range from the merely careless and time-profligate to the truly unethical.</p>
<p>(1) CARELESS: Recruiters who mass email everyone on CareerFinder and Monster with the word &#8220;Ruby&#8221; in their profile for an Austin, Texas-based junior web developer 3-month contract gig specializing in Ruby on Rails. </p>
<p>I am not a Ruby developer, I will not move to Austin, Texas, especially for a three month contract, and I&#8217;m not a junior ANYTHING. I have some skills with Ruby, meaning that I can install the necessary scripts, edit them, run them to operate a site, and I know enough to know when I need to call a specialist. This makes me able to list Ruby as a general low-level skill on my resume, but does not in any way qualify me for a development job on a site that solely uses Ruby for an environment. However, that keyword hits big with recruiters, and I get probably 15 emails a day from recruiters trying to get me to take a job for which I am unqualified and in a location to which I would not move. A simple glance at my resume with the words &#8220;Senior Development Manager and Web Architect&#8221; emblazoned across the top and a brief scan of my skillset tells anyone I am a skilled coder who has been moved up the chain to management, and would likely help those recruiters to target me far more efficiently. </p>
<p>(2) CARELESS: Recruiters who speak such poor English that their emails are unreadable&#8211;and that sometimes includes native English speakers. </p>
<p>I am glad that you&#8217;re &#8220;pleased for making time and hoping you will be helping me networking to fill VERY IMPORTANT positino immediatly in NEW YORKCITY as JAVA DEVELOPAR&#8221; [not a joke; I seem to be perpetually emailed by the recruiter version of Paul Christoforo], but I don&#8217;t need it filling my day. At the very minimum, have your job posts reviewed for content and grammar before sending them to thousands of developers.</p>
<p>(3) UNETHICAL: Recruiters who are paid by the emails they generate, not by the positions they fill.</p>
<p>This is a common problem among firms that have outsourced to the Philippines, India, Bangladesh, Malaysia&#8230;in fact, name your popular outsourcing destination in Asia, and you&#8217;ll find these recruiters, who are paid to send out as many emails as possible. They&#8217;re no better than spam, but because they&#8217;re targeted to you and have your email address, you can&#8217;t filter them the way you would filter a Cialis or pr0n ad. </p>
<p>(4) CARELESS: Recruiters who have not paid attention to your preferred location&#8211;and don&#8217;t care.</p>
<p>I will not take a job in South Dakota; I&#8217;m sorry. I&#8217;ve lived in several midwest states and think that South Dakota is quite eerily beautiful. I will not be transferring my life, my career, and my love of well-produced opera to Sioux Falls any time soon. </p>
<p>(5) UNETHICAL: Recruiters who expect you to do their job for them.</p>
<p>My final post will be the most egregious example I&#8217;ve found, combined with a horrific example of #6. The most common variety is this: </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
To better represent you, kindly fill out the skills inventory below. Thank you</p>
<p>1)       Agile/Scrum                                                                       (Beginner/Intermediate/Expert)         (Years of experience/Date Last used)<br />
2)       Software Development Proj Mgmt                                         (Beginner/Intermediate/Expert)         (Years of experience/Date Last used)<br />
3)       Web-Based Application architecture knowledge                       (Beginner/Intermediate/Expert)         (Years of experience/Date Last used)<br />
4)       Test Driven Development / XP                                              (Beginner/Intermediate/Expert)         (Years of experience/Date Last used)<br />
5)       Java development principals                                                  (Beginner/Intermediate/Expert)         (Years of experience/Date Last used)<br />
6)       Release Management                                                           (Beginner/Intermediate/Expert)         (Years of experience/Date Last used)</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>Remember that I get about 50 or so of these emails per day; this person doesn&#8217;t even want to read my resume, and instead wants me to fill out his paperwork for him. Note: this was for a position in California, making it irrelevant anyway. </p>
<p>(6) UNETHICAL: Recruiters who expect you to prep and interview with no information about the company. </p>
<p>This is the worst one. How can I know if I want to take a position if I&#8217;m not told: (1) what the salary will be, (2) where the company is physically located, (3) what benefits are available, and (4) to whom I would be reporting? This is just another version of wasting my time. I don&#8217;t talk anymore to recruiters who are secretive; they are occasionally fronts for disreputable companies who want a chance to sell you before you find out what their online reputation looks like.</p>
<p>Next, the traits of successful recruiters. </p>
]]></content:encoded>
			<wfw:commentRss>http://thecowgirlcoder.com/2012/01/12/how-to-recruit-a-software-developer-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tarah Wheeler Van Vlack to speak at Seattle Central Community College, Jan 18th, 3-5PM</title>
		<link>http://thecowgirlcoder.com/2012/01/11/tarah-wheeler-van-vlack-to-speak-at-seattle-central-community-college-jan-18th-3-5pm/</link>
		<comments>http://thecowgirlcoder.com/2012/01/11/tarah-wheeler-van-vlack-to-speak-at-seattle-central-community-college-jan-18th-3-5pm/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 06:43:04 +0000</pubDate>
		<dc:creator>tarah</dc:creator>
				<category><![CDATA[Encouragement]]></category>

		<guid isPermaLink="false">http://thecowgirlcoder.com/?p=395</guid>
		<description><![CDATA[Ladies and Gentlemen: I&#8217;ll be speaking as a joint guest of the Ignite program through Seattle Public Schools and the IT department at SCCC. People of all ages who want to know more about becoming a female programmer and entering technical careers are welcome to attend; I&#8217;ll be speaking on interview techniques, what to expect [...]]]></description>
			<content:encoded><![CDATA[<p>Ladies and Gentlemen:</p>
<p>I&#8217;ll be speaking as a joint guest of the Ignite program through Seattle Public Schools and the IT department at SCCC.</p>
<p>People of all ages who want to know more about becoming a female programmer and entering technical careers are welcome to attend; I&#8217;ll be speaking on interview techniques, what to expect from your colleagues, how to succeed, and the rewards of software and web development compared to many traditional women&#8217;s career paths.</p>
<p>Please let your friends and mentees know; I am looking forward to answering your questions and giving you the insider information you need to succeed!</p>
<div id="attachment_397" class="wp-caption alignnone" style="width: 480px"><a href="http://thecowgirlcoder.com/wp-content/uploads/2012/01/viewer.png"><img src="http://thecowgirlcoder.com/wp-content/uploads/2012/01/viewer-791x1024.png" alt="Tarah Wheeler Van Vlack, the Cowgirl Coder, to speak at SCCC 01/18/12 3-5PM" title="Tarah Wheeler Van Vlack, the Cowgirl Coder, to speak at SCCC 01/18/12 3-5PM" width="470" height="608" class="size-large wp-image-397" /></a><p class="wp-caption-text">Tarah Wheeler Van Vlack, the Cowgirl Coder, to speak at SCCC 01/18/12 3-5PM</p></div>
]]></content:encoded>
			<wfw:commentRss>http://thecowgirlcoder.com/2012/01/11/tarah-wheeler-van-vlack-to-speak-at-seattle-central-community-college-jan-18th-3-5pm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to recruit a software developer. (Part 1)</title>
		<link>http://thecowgirlcoder.com/2012/01/07/how-to-recruit-a-software-developer-part-1/</link>
		<comments>http://thecowgirlcoder.com/2012/01/07/how-to-recruit-a-software-developer-part-1/#comments</comments>
		<pubDate>Sat, 07 Jan 2012 05:59:36 +0000</pubDate>
		<dc:creator>tarah</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thecowgirlcoder.com/?p=390</guid>
		<description><![CDATA[I have a problem. Hundreds of people every week contact me to try to get me to work for them. In an economic downturn, this may sound like what I call a &#8216;high-class problem.&#8217; Noted examples of high-class problems include: paying taxes on your lottery winnings, being unable to make up your mind between your [...]]]></description>
			<content:encoded><![CDATA[<p>I have a problem. Hundreds of people every week contact me to try to get me to work for them.</p>
<p>In an economic downturn, this may sound like what I call a &#8216;high-class problem.&#8217; Noted examples of high-class problems include: paying taxes on your lottery winnings, being unable to make up your mind between your Harvard and Yale college acceptance letters, and getting a shopping cart dent in your Rolls Royce. </p>
<p>It may sound like I should have absolutely no problem finding my next contract or FTE position, but the truth is that I am bewildered by the sheer quantity of irrelevant job postings and shady headhunters by which I am besieged on a weekly basis. This is no joke: I  have hired a remote assistant whose sole job for me is to go through all my emails related to job postings. I have no way to process them all and still get coding, blogging, eating, and living done. I have an obligation to follow up on each posting that fits my skill set, and I am trying my best to do so&#8230;but there&#8217;s no way to spend hours per response following up on thousands of postings&#8211;99.7% of which are irrelevant due to location, skill set, or compensation level.</p>
<p>Then, we come to the issue of rude and unethical recruiters. I&#8217;ve had some recent encounters that inspired this series; I&#8217;ll be describing that situation as I discuss the ethics of recruitment from the other side&#8211;the people being recruited. I&#8217;m bombarded by recruiters who have the incentive to email as many people as possible, since they have no reason to care about the skill sets or fit of the people they&#8217;re slotting into jobs. They&#8217;re paid by the number of people they place, not the quality of the placement or its duration. That doesn&#8217;t add up to a recruitment culture of individualized attention and courtesy. I&#8217;m also constantly hit by emails demanding my time and effort without so much as a &#8216;please&#8217; and &#8216;thank you.&#8217;</p>
<p>Finally, there are rules that good recruiters follow which instantly get my attention and cause me to work with them. I&#8217;ll let you know what traits a recruiter possesses to make me work with them again and again.</p>
<p>So, over the next several days, I&#8217;ll be posting a multi-part series on how to recruit me. I want to be hired; people certainly want to hire me&#8211;so why is it so hard to be paired with a recruiter who has actually read my resume and thinks I&#8217;d be a great fit for their open position?</p>
<p>Welcome to the joy of being heavily recruited by thousands of clueless and careless headhunters who have your email address and phone number.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecowgirlcoder.com/2012/01/07/how-to-recruit-a-software-developer-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Third Edition Earthdawn Dice Roller in Java</title>
		<link>http://thecowgirlcoder.com/2011/12/02/third-edition-earthdawn-dice-roller-in-java/</link>
		<comments>http://thecowgirlcoder.com/2011/12/02/third-edition-earthdawn-dice-roller-in-java/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 09:18:31 +0000</pubDate>
		<dc:creator>tarah</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://thecowgirlcoder.com/?p=375</guid>
		<description><![CDATA[So, I play an RPG called Earthdawn; it&#8217;s a lot like D&#38;D, but for real nerds. One of the things we all do in my gaming group is write our own dice rollers; rolling actual dice is SO passé&#8211;and there&#8217;s an ongoing argument about whether or not a seeded random is more or less random [...]]]></description>
			<content:encoded><![CDATA[<p>So, I play an RPG called <a href="http://en.wikipedia.org/wiki/Earthdawn" target="_blank">Earthdawn</a>; it&#8217;s a lot like D&amp;D, but for <em>real</em> nerds.</p>
<p>One of the things we all do in my gaming group is write our own dice rollers; rolling actual dice is SO passé&#8211;and there&#8217;s an ongoing argument about whether or not a seeded random is more or less random than the natural flaws in dice and rolling surfaces. Java is the language in which I learned to write math, so I somewhat naturally write algorithms in Java without thinking. It&#8217;s easy enough to translate this into C# or whatever.</p>
<p>Ok, so, here&#8217;s the algorithm. In Earthdawn, dice rolls are predicated on the step level of the difficulty. You may have an attack roll at step 18 and a damage roll at step 22. In 3rd edition Earthdawn, that translates to rolling d12+d10+d8 to attack, and 2d12+2d6 for damage. Here&#8217;s the chart (click to embiggen):</p>
<p><a href="http://thecowgirlcoder.com/wp-content/uploads/2011/12/snapshot2.png"><img src="http://thecowgirlcoder.com/wp-content/uploads/2011/12/snapshot2-150x150.png" alt="" title="Step Dice" width="150" height="150" class="alignnone size-thumbnail wp-image-377" /></a></p>
<p>As you can see, there&#8217;s some kind of progression here; it turns out that the algorithm is a simple infinite series. There&#8217;s a jump in the number of dice every seven steps. Hence, the algorithm has a few simple steps:</p>
<p>(1) Divide the step number by 7.<br />
(2) Determine and store the <a href="http://mathworld.wolfram.com/FloorFunction.html" target="_blank">floor</a> and the <a href="http://www.cafeaulait.org/course/week2/15.html" target="_blank">modulus</a>.<br />
(3) Roll a number of d12s equal to (floor &#8211; 1).<br />
(4) Roll dice equal to the corresponding modulus (the first addition of dice past the 7 threshold will be 2d6, so if the modulus is 1, 2d6 are rolled and added).</p>
<p>That is the step algorithm such that no lookup is now necessary; Earthdawn has exploding dice and epic fails, however, so two things are necessary. Look at the exploding dice method; if you roll the maximum value of a die, you can roll it again. You can keep rolling that die until a value shows that is less than the maximum value, such that a d6 rolled with a result of 6 can be rerolled. On the second roll, 6 results. On the third roll, 2 results, so the total value of that die roll is 14. For epic fails, if you roll more than one die and all dice show ones, you have epically failed (similar to a fumble in D&#038;D, and with equivalent disastrous results). </p>
<p>Here&#8217;s my dice roller; click to embiggen:</p>
<p><a href="http://thecowgirlcoder.com/wp-content/uploads/2011/12/snapshot3.png"><img src="http://thecowgirlcoder.com/wp-content/uploads/2011/12/snapshot3-150x150.png" alt="" title="Dice Roller screenshot" width="150" height="150" class="alignnone size-thumbnail wp-image-382" /></a></p>
<p>So, here&#8217;s the code. It&#8217;s intended to be self-contained (you can see that I use a pic of <a href="http://www.fireflywiki.org/Firefly/MalcolmReynolds" target="_blank" class="broken_link">Captain Malcolm Reynolds</a>; just drop a pic in your file structure and reference it in the code if you want a background). Obviously this is bare-bones; you can adapt it at your leisure and to whatever GUI you desire. Any suggestions are welcome; I am always debugging this (and the JavaScript I&#8217;m using to display syntax highlighting is a little cranky, so forgive any indentation issues). If you can think of a way to optimize this algorithm, let me know; I always need bragging rights over the guys <img src='http://thecowgirlcoder.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">dice</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Color</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Dimension</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Graphics</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.GridLayout</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Image</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.event.ActionEvent</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.event.ActionListener</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Random</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.BorderFactory</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.ImageIcon</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.JButton</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.JCheckBox</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.JFrame</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.JLabel</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.JOptionPane</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.JPanel</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.JSpinner</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.JTextField</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.SpinnerModel</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.SpinnerNumberModel</span><span style="color: #339933;">;</span>
&nbsp;
@SuppressWarnings<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;serial&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ImagePanel <span style="color: #000000; font-weight: bold;">extends</span> <span style="color: #003399;">JPanel</span> <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399;">ActionListener</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">int</span> six <span style="color: #339933;">=</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> eight <span style="color: #339933;">=</span> <span style="color: #cc66cc;">8</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> ten <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> twelve <span style="color: #339933;">=</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> dice <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//counter for total number of dice</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> middle<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//step value entered by me.</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> fail<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//whether or not an epic fail happened.</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">JFrame</span> frame<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Random</span> r<span style="color: #339933;">;</span>
	<span style="color: #003399;">Image</span> img <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ImageIcon</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;img/MalcolmReynolds13.jpg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getImage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	SpinnerModel stepEntry <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SpinnerNumberModel<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">300</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	SpinnerModel karmaCounter <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SpinnerNumberModel<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">25</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">25</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	JSpinner stepSpinner <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JSpinner<span style="color: #009900;">&#40;</span>stepEntry<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	JSpinner karmaSpinner <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JSpinner<span style="color: #009900;">&#40;</span>karmaCounter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">JTextField</span> diceResult<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">JButton</span> myButton<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">JCheckBox</span> myCheck<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">JLabel</span> enterStep <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">JLabel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Enter Step Here.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		ImagePanel panel <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ImagePanel<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ImageIcon</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;img/MalcolmReynolds13.jpg&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getImage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">JFrame</span> frame <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">JFrame</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Tarah's Dice Roller Of Awesomeness&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			frame.<span style="color: #006633;">getContentPane</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>panel<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    frame.<span style="color: #006633;">pack</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    frame.<span style="color: #006633;">setVisible</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> ImagePanel<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> img<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ImageIcon</span><span style="color: #009900;">&#40;</span>img<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getImage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> ImagePanel<span style="color: #009900;">&#40;</span><span style="color: #003399;">Image</span> img<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">img</span> <span style="color: #339933;">=</span> img<span style="color: #339933;">;</span>
		<span style="color: #003399;">Dimension</span> size <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Dimension</span><span style="color: #009900;">&#40;</span>img.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>, img.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		setPreferredSize<span style="color: #009900;">&#40;</span>size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		setMinimumSize<span style="color: #009900;">&#40;</span>size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		setMaximumSize<span style="color: #009900;">&#40;</span>size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		setSize<span style="color: #009900;">&#40;</span>size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">JPanel</span> panel <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">JPanel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		add<span style="color: #009900;">&#40;</span>panel, <span style="color: #0000ff;">&quot;Center&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		myButton <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">JButton</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Roll The Dice.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		myButton.<span style="color: #006633;">addActionListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		myButton.<span style="color: #006633;">setBorder</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">BorderFactory</span>.<span style="color: #006633;">createLineBorder</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Color</span>.<span style="color: #006633;">black</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		diceResult <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">JTextField</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Roll Result&quot;</span>, <span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		diceResult.<span style="color: #006633;">setBorder</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">BorderFactory</span>.<span style="color: #006633;">createLineBorder</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Color</span>.<span style="color: #006633;">black</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		myCheck <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">JCheckBox</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Use Karma.&quot;</span>, <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		myCheck.<span style="color: #006633;">setBorder</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">BorderFactory</span>.<span style="color: #006633;">createLineBorder</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Color</span>.<span style="color: #006633;">black</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">GridLayout</span> myGrid <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">GridLayout</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		panel.<span style="color: #006633;">setLayout</span><span style="color: #009900;">&#40;</span>myGrid<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		panel.<span style="color: #006633;">setBorder</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">BorderFactory</span>.<span style="color: #006633;">createLineBorder</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Color</span>.<span style="color: #006633;">black</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		panel.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>enterStep<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		panel.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>stepSpinner<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		panel.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>myButton<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		panel.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>diceResult<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		panel.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>myCheck<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		panel.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>karmaSpinner<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		setVisible<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> paintComponent<span style="color: #009900;">&#40;</span><span style="color: #003399;">Graphics</span> g<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		g.<span style="color: #006633;">drawImage</span><span style="color: #009900;">&#40;</span>img, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> actionPerformed<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">boolean</span> useKarma <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		middle <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span><span style="color: #009900;">&#41;</span>stepSpinner.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;actionPerformed() thinks the step number is: &quot;</span> <span style="color: #339933;">+</span> middle<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>myCheck.<span style="color: #006633;">isSelected</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;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Using Karma.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			useKarma <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">int</span> decrease <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span><span style="color: #009900;">&#41;</span>karmaCounter.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
			karmaCounter.<span style="color: #006633;">setValue</span><span style="color: #009900;">&#40;</span>decrease<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #003399;">String</span> s <span style="color: #339933;">=</span> <span style="color: #003399;">Integer</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span>rollTheDice<span style="color: #009900;">&#40;</span>useKarma, middle, fail<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    diceResult.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">/////////////////////////////////////////////</span>
<span style="color: #666666; font-style: italic;">/////////////////MATHYNESS///////////////////</span>
<span style="color: #666666; font-style: italic;">/////////////////////////////////////////////</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//This is the Earthdawn Exploding Dice Method.</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> d <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> die<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">int</span> sides <span style="color: #339933;">=</span> die<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">int</span> result <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">int</span> roll<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">do</span> <span style="color: #009900;">&#123;</span>
			r <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Random</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            roll <span style="color: #339933;">=</span> r.<span style="color: #006633;">nextInt</span><span style="color: #009900;">&#40;</span>sides<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
            result <span style="color: #339933;">=</span> result <span style="color: #339933;">+</span> roll<span style="color: #339933;">;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;This is a d&quot;</span> <span style="color: #339933;">+</span> sides <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; roll with result: &quot;</span> <span style="color: #339933;">+</span> result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>roll <span style="color: #339933;">==</span> sides<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> oneToSeven <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> o<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">int</span> result <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>o <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			result <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>six<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>result <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				result <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>o <span style="color: #339933;">==</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			result <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>six<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>result <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				result <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>o <span style="color: #339933;">==</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			result <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>six<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>result <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				result <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>o <span style="color: #339933;">==</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			result <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>six<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>o <span style="color: #339933;">==</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			result <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>eight<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>o <span style="color: #339933;">==</span> <span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			result <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>ten<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>o <span style="color: #339933;">==</span> <span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			result <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>twelve<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> prefix <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">int</span> prefixTotal <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>p<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			prefixTotal <span style="color: #339933;">=</span> prefixTotal <span style="color: #339933;">+</span> d<span style="color: #009900;">&#40;</span>twelve<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			dice<span style="color: #339933;">++;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> prefixTotal<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> suffix <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> s<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">int</span> suffixTotal <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			suffixTotal <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>six<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> d<span style="color: #009900;">&#40;</span>six<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s <span style="color: #339933;">==</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			suffixTotal <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>eight<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> d<span style="color: #009900;">&#40;</span>six<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s <span style="color: #339933;">==</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			suffixTotal <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>eight<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> d<span style="color: #009900;">&#40;</span>eight<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s <span style="color: #339933;">==</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			suffixTotal <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>ten<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> d<span style="color: #009900;">&#40;</span>eight<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s <span style="color: #339933;">==</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			suffixTotal <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>ten<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> d<span style="color: #009900;">&#40;</span>ten<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s <span style="color: #339933;">==</span> <span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			suffixTotal <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>twelve<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> d<span style="color: #009900;">&#40;</span>ten<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			suffixTotal <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>twelve<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> suffixTotal<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> step <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> sn<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">int</span> result <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		fail <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">int</span> full <span style="color: #339933;">=</span> sn <span style="color: #339933;">/</span> <span style="color: #cc66cc;">7</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//will yield the d12s</span>
		<span style="color: #000066; font-weight: bold;">int</span> mod <span style="color: #339933;">=</span> sn <span style="color: #339933;">%</span> <span style="color: #cc66cc;">7</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//will yield the additive dice</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>sn <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">int</span> total <span style="color: #339933;">=</span> oneToSeven<span style="color: #009900;">&#40;</span>sn<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			result <span style="color: #339933;">=</span> total<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>sn <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">int</span> d12s <span style="color: #339933;">=</span> prefix<span style="color: #009900;">&#40;</span>full<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">int</span> rest <span style="color: #339933;">=</span> suffix<span style="color: #009900;">&#40;</span>mod<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			result <span style="color: #339933;">=</span> d12s <span style="color: #339933;">+</span> rest<span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>result <span style="color: #339933;">==</span> full<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				fail <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> rollTheDice<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">boolean</span> addKarma, <span style="color: #000066; font-weight: bold;">int</span> stepValue, <span style="color: #000066; font-weight: bold;">boolean</span> epicFail<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">boolean</span> addK <span style="color: #339933;">=</span> addKarma<span style="color: #339933;">;</span>
		dice <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">int</span> result <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		result <span style="color: #339933;">=</span> step<span style="color: #009900;">&#40;</span>stepValue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		epicFail <span style="color: #339933;">=</span> fail<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>addK <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">int</span> dK <span style="color: #339933;">=</span> d<span style="color: #009900;">&#40;</span>six<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			result <span style="color: #339933;">=</span> result <span style="color: #339933;">+</span> dK<span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>epicFail <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">true</span> <span style="color: #339933;">&amp;&amp;</span> dK <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #003399;">JOptionPane</span>.<span style="color: #006633;">showMessageDialog</span><span style="color: #009900;">&#40;</span>frame, <span style="color: #0000ff;">&quot;Epic FAIL.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>addK <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">true</span> <span style="color: #339933;">&amp;&amp;</span> epicFail <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">JOptionPane</span>.<span style="color: #006633;">showMessageDialog</span><span style="color: #009900;">&#40;</span>frame, <span style="color: #0000ff;">&quot;Epic FAIL.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://thecowgirlcoder.com/2011/12/02/third-edition-earthdawn-dice-roller-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The new resume lesson</title>
		<link>http://thecowgirlcoder.com/2011/12/01/the-new-resume-lesson/</link>
		<comments>http://thecowgirlcoder.com/2011/12/01/the-new-resume-lesson/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 01:11:38 +0000</pubDate>
		<dc:creator>tarah</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thecowgirlcoder.com/?p=371</guid>
		<description><![CDATA[Here&#8217;s something I didn&#8217;t think I&#8217;d be saying today: My resume isn&#8217;t perfect. There are three companies I&#8217;ve been dealing with over the last five weeks who were all based in multiple countries. I never thought to add my multiple language proficiencies to my resume; I have a hard time keeping my resume under four [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s something I didn&#8217;t think I&#8217;d be saying today:</p>
<p>My resume isn&#8217;t perfect. </p>
<p>There are three companies I&#8217;ve been dealing with over the last five weeks who were all based in multiple countries. I never thought to add my multiple language proficiencies to my resume; I have a hard time keeping my resume under four pages as it is, and that&#8217;s with leaving off references and most of my educational qualifications.</p>
<p>However, I&#8217;m near-fluent in French, quite good in German, and have a serious background in Mandarin, Spanish, Greek, and a smattering of a half-dozen other languages. I was coaching a female developer three weeks ago who was applying to a company with multiple locations worldwide&#8211;including Latin America, and never thought to tell her that her proficiency in Spanish should certainly come up during her interview. </p>
<p>As companies start to expand and acquire, you may find that your four years of German (no matter how rusty) can pay off. If you&#8217;re proficient in an Asian language, make sure it shows up on your resume in the skills section. If you speak Klingon, email me. I need a translation of Jabberwocky for an ongoing joke I have with my father. </p>
<p><a href="http://www76.pair.com/keithlim/jabberwocky/translations/jtklingon1.html" target="_blank">Oh, wait.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thecowgirlcoder.com/2011/12/01/the-new-resume-lesson/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preparing for technical interviews</title>
		<link>http://thecowgirlcoder.com/2011/11/08/preparing-for-technical-interviews/</link>
		<comments>http://thecowgirlcoder.com/2011/11/08/preparing-for-technical-interviews/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 23:25:49 +0000</pubDate>
		<dc:creator>tarah</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thecowgirlcoder.com/?p=365</guid>
		<description><![CDATA[Ladies, before I go any further, be aware that I have an instructional DVD up at: Tech Interview Help So, this isn&#8217;t an entirely disinterested post, but I do want to add some information for you. One of the best things you can do to prepare for interviews is to actually dev with the SDK [...]]]></description>
			<content:encoded><![CDATA[<p>Ladies, before I go any further, be aware that I have an instructional DVD up at:</p>
<p><a href="http://techinterviewhelp.com/" target="_blank">Tech Interview Help</a></p>
<p>So, this isn&#8217;t an entirely disinterested post, but I do want to add some information for you.</p>
<p>One of the best things you can do to prepare for interviews is to actually dev with the SDK and API that the company produces. I am in the Seattle area, and if I had an interview with Amazon S3, the first thing I&#8217;d be doing is setting up a bucket (not that I haven&#8217;t already done fifteen of these for various storage reasons) and transferring data to learn their system. I&#8217;d know the transfer protocols, the encryption levels, the likely physical network structure, and JFS if at all possible&#8211;at a BARE minimum. </p>
<p>If you have an interview with Microsoft&#8217;s IE10 team, you&#8217;d better be in front of IE6, 7, 8, and 9, knowing what major updates occurred between browser versions, which HTML versions were implemented where, security holes and how to plug them, and what cross-browser issues remain to be addressed, and that&#8217;s not even the bare minimum. </p>
<p><code><br />
public tip<br />
{<br />
    //Use the code of the team with which you're interviewing before you walk in the door.<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://thecowgirlcoder.com/2011/11/08/preparing-for-technical-interviews/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GeekGirlCon</title>
		<link>http://thecowgirlcoder.com/2011/10/08/geekgirlcon-2/</link>
		<comments>http://thecowgirlcoder.com/2011/10/08/geekgirlcon-2/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 21:45:26 +0000</pubDate>
		<dc:creator>tarah</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thecowgirlcoder.com/?p=362</guid>
		<description><![CDATA[What an amazing panel! Today, I, Liz Dahlstrom, and Qian Yi did a panel on &#8220;A Career As A Lady Coder.&#8221; We had a great time; the young ladies who asked questions were thoughtful, imaginative, and genuinely interested in careers as programmers. We hope that we encouraged you, challenged you, and mentored you, as we [...]]]></description>
			<content:encoded><![CDATA[<p>What an amazing panel! Today, I, Liz Dahlstrom, and Qian Yi did a panel on &#8220;A Career As A Lady Coder.&#8221;</p>
<p>We had a great time; the young ladies who asked questions were thoughtful, imaginative, and genuinely interested in careers as programmers. We hope that we encouraged you, challenged you, and mentored you, as we ourselves were mentored by the ladies who inspired us.</p>
<p>Best of luck!</p>
<p>For those of you looking for more help with technical interviews, head to <a href="http://techinterviewhelp.com/" title="Tech Interview Help" target="_blank">Tech Interview Help.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thecowgirlcoder.com/2011/10/08/geekgirlcon-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Python For Scripting</title>
		<link>http://thecowgirlcoder.com/2011/08/05/python-for-scripting/</link>
		<comments>http://thecowgirlcoder.com/2011/08/05/python-for-scripting/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 01:14:22 +0000</pubDate>
		<dc:creator>liz</dc:creator>
				<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://thecowgirlcoder.com/?p=357</guid>
		<description><![CDATA[Hi!  I&#8217;m Liz from Athenageek.  Tarah and I are writing guest posts in each other&#8217;s blogs on the scripting languages we love. I must make a confession before I continue with this post &#8211; I adore Python. It&#8217;s made me a better coder. I think about problems differently than I used to, I&#8217;m better at [...]]]></description>
			<content:encoded><![CDATA[<p>Hi!  I&#8217;m Liz from <a href="http://athenageek.wordpress.com/">Athenageek</a>.  Tarah and I are writing guest posts in each other&#8217;s blogs on the scripting languages we love.</p>
<p>I must make a confession before I continue with this post &#8211; I adore Python. It&#8217;s made me a better coder. I think about problems differently than I used to, I&#8217;m better at breaking them down into tiny components that are easy to code. My coding in other languages improved drastically as a direct result of learning Python &#8211; and using it in a Pythonic manner.</p>
<p>I used to use Bash for scripting. That&#8217;s what Bash is for, right? I use a Bash shell, so it only made sense.</p>
<p>One day, I was processing some xml scripts. I had multiple xml files with the same root node, and needed to put them all together into one big xml file. Frustrated at some sticking point or other, I decided to see if I could do it with Python. Oh, my goodness, it was SO EASY.</p>
<p>Before long, I had a string of utility files to handle common tasks that I was always scripting.</p>
<h2>Reusability</h2>
<p>When scripting, we often have tasks that we do over and over, but with slight changes. Rather than having a base set of methods that you copy out of and then change for each new usage, you can create utility files of classes and methods to use. Add methods to classes to handle new tasks, or allow new variables to be passed in for different usages. With Python&#8217;s named variables, you can change a method without effecting or needing to change other code that calls it.</p>
<p>One of the base tenants of Python is DRY (don&#8217;t repeat yourself). If you find yourself writing the same code more than once, put it in a place where it can be reused, like a method in a class or a function in a utility file.</p>
<p>Building up a libarary of these types of files is a great way to expand your toolbox. The longer you do it, the easier tasks become, because you&#8217;ve already done the work.  Lots of scripting projects are, &#8220;Just like the one you did for x, but with this minor change&#8221;.</p>
<h2>Testing</h2>
<p>Python the community is heavily in favor of testing. One reason this is helpful for scripting is the case I mentioned above, when you change a method to handle some new functionality that you need. How do you make sure this new fuctionality doesn&#8217;t break old code? You test it. Doctesting and unit testing are built in to Python, no hunting around for which framework is best, balancing framework versions with script versions, or figuring out how to import your framework on a different operating system.</p>
<h3>Doctesting</h3>
<p>I love doctesting. In one fell swoop, you are showing how to use code, documenting that code, and proving that it works as expected.</p>
<p>Doctesting is very easy to do. Let&#8217;s say we create a method to square a number.</p>
<pre>def square(numberIn):
    return numberIn * numberIn</pre>
<p>No documentation there, let&#8217;s fix that.</p>
<pre>def square(numberIn):
    """Returns the square of the number passed in"""
    return numberIn * numberIn</pre>
<p>The doctest actually goes inside the documentation you&#8217;ve just created.</p>
<pre>def square(numberIn):
    """Returns the square of the number passed in</pre>
<pre>    &gt;&gt;&gt; square(2)
    4
    """
    return numberIn * numberIn</pre>
<p>So, you use &gt;&gt;&gt; to delineate code that is going to be tested. That&#8217;s the same &gt;&gt;&gt; you see when you&#8217;re working at a Python prompt. In this case, we&#8217;re calling our method and passing in 2. On the next line, put the expected result, which is 4. You can put as many of these tests as you like in the documentation block, separate them with a blank line. You can even put error checking here.</p>
<pre>def square(numberIn):
    """Returns the square of the number passed in</pre>
<pre>    &gt;&gt;&gt; square(2)
    4</pre>
<pre>    &gt;&gt;&gt; square('three')
    Traceback (most recent call last):
    ...
    TypeError: can't multiply sequence by non-int of type 'str'
    """
    return numberIn * numberIn</pre>
<p>I got that traceback by using my function at a command prompt.  I copied and pasted it into my doctest.  I deleted the variable stuff between the two important lines and replaced it with ellipses.</p>
<p>In order to run the doctest, you have to add the following to the bottom<br />
of your file:</p>
<pre>if '__main__' == __name__:
    import doctest
    doctest.register_optionflag('ELLIPSIS')
    doctest.testmod()</pre>
<p>Note that I&#8217;ve registered the ellipsis option flag. This allows you to use &#8230; as a wildcard so you can skip over some of the expected output. It keeps your code cleaner and lets you handle situations where expected output might be different &#8211; say &#8211; generating a random number.</p>
<p>Ok, now you can run the file. Let&#8217;s say we called it utility.py.</p>
<pre>$ python utility.py
$</pre>
<p>No output. That&#8217;s the default. In order to see the test results, you need to use the verbose flag.</p>
<pre>$ python utility.py -v</pre>
<pre>Trying:</pre>
<pre>    square(2)
Expecting:
    4
ok
Trying:
    square('three')
Expecting:
    Traceback (most recent call last):
    ...
    TypeError: can't multiply sequence by non-int of type 'str'
ok
1 items had no tests:
    __main__
1 items passed all tests:
   2 tests in __main__.square
2 tests in 2 items.
2 passed and 0 failed.</pre>
<pre>Test passed</pre>
<pre>$</pre>
<p>And there are our test results &#8211; everything passed.</p>
<p>Aside from the option to put doctests in your code, you can also create txt files for documentation and add doctests to them. This is what bigger projects tend to do, especially when they have multiple files of code to deal with.</p>
<p>Unit tests are another great way to test that is very helpful for scripting. Every time you get a new requirement, add in a unit test for any situation you can think of that would effect that new requirement. Test things going right, things going wrong, and any unexpected behavior or input you can think of. If you find an error that isn&#8217;t covered in your tests, create a unit test to cover it. A baseline of code like this ensures that any future changes won&#8217;t break existing code. If it does, it will make the error really easy to track down &#8211; you won&#8217;t have to try to remember all the past requirements.</p>
<h2>Easy for the next person to maintain</h2>
<p>Between keeping code in one place, not repeating yourself, and having robust testing, you&#8217;ve just made maintaining this code really, really easy for the next person that comes along. Even if they don&#8217;t know Python, a glance at your robust documentation and clear code will make it easy to make small changes. Running the tests will leave them confident that their changes won&#8217;t have a negative effect on other code.</p>
<p>We all want to be able to go on vacation and not get a call that someone broke your code. Clear code with lots of tests are the best way to ensure a relaxing break.  Python makes this quick and easy, so you can move on to something hard.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecowgirlcoder.com/2011/08/05/python-for-scripting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: thecowgirlcoder.com @ 2012-02-23 09:15:16 -->
