<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Jared Kipe Software Blog</title>
		<link>http://www.jaredkipe.com/blog/</link>
		<atom:link href="http://www.jaredkipe.com/blog/" rel="self" type="application/rss+xml" />
		<description></description>

		
		<item>
			<title>Your First C Program</title>
			<link>http://www.jaredkipe.com/blog/programming/programming-in-c/your-first-c-program/</link>
			<description>&lt;p&gt;Practically, all modern languages descend from C, and thus use most of C's principles and basic structures.  C is a perfect place to start learning about basic programming.  C can be a launching platform for both more advanced C (like embedded operating systems), or, more likely, object oriented languages like C++ and Objective-C.&lt;/p&gt;
&lt;p&gt;I'm not going to lie, this code isn't going to be exciting. But let's dissect the standard &quot;Hello World&quot; program in C.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;objectivec&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
int main(int argc, const char *argv[]) {
	printf(&quot;Hello World!&quot;);
	return 0;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Functions&lt;/h2&gt;
&lt;p&gt;There is a very popular metaphor that a function is like a toaster.  A toaster is any device where you put in bread, push a button or lever, and at a pre-determined time, &quot;toast&quot; comes out. Functions work similarly.  Sometimes you design, or make the function yourself, sometimes the function already exists (like the toaster) and you simply use it.  Either way, the function needs to follow very specific rules on how you can use or &quot;&lt;em&gt;call&lt;/em&gt;&quot; a function, what the various parameters or &quot;&lt;em&gt;arguments&lt;/em&gt;&quot; of the function are and what the function gives back when it is done.&lt;/p&gt;
&lt;p&gt;Lets concern ourself with a toaster that takes a single piece of bread.  In C, this function (or toaster) would be prototyped like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;objectivec&quot;&gt;
toast toaster(bread slice, int time);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first word is &lt;strong&gt;toast&lt;/strong&gt;, this is the &quot;return type&quot; or what is given back to the user or &quot;caller&quot; when the function is done. &lt;strong&gt;toaster&lt;/strong&gt; is the name of the function.  &quot;&lt;strong&gt;bread slice&lt;/strong&gt;&quot; is the type of the first argument (bread) and slice is the local variable name for that argument.  &quot;&lt;strong&gt;int time&lt;/strong&gt;&quot; is the type of the second argument (integer) and time is the local variable name for the second argument.&lt;/p&gt;
&lt;p&gt;You don't really need to know the mechanism by which toaster makes the bread into toast, or how the time affects it.  In fact you don't even need to include the word &quot;slice&quot; and &quot;time&quot; in the prototype, but their names are usually hints to the caller on what the arguments actually are.&lt;/p&gt;
&lt;p&gt;The program itself is effectively a function named &lt;strong&gt;main()&lt;/strong&gt;. Every program needs a main() function, which is the function that is run when the program itself executes.  It needs to be named main, and for right now you shouldn't really concern yourself with the arguments or return type of main.&lt;/p&gt;
&lt;h2&gt;The C Preprocessor&lt;/h2&gt;
&lt;p&gt;The C preprocessor gets run on your files before compilation, and usually results in a fancy &quot;search and replace&quot; getting called on your document.  There are a handful of preprocessor directives, and I will go over them each time I use them.  All of these directives begin with the # symbol, usually near the start of a document and needs to be on its own line. Preprocessor directives do not end with a semicolon, as they are not actual C instructions and always get stripped out of the file before compilation.  The preprocessor also strips out comments, anything after a double forward slash (//) or between the multiline comment block (/* blah blah */).&lt;/p&gt;
&lt;div class=&quot;programmingBlock newCPreprocessor&quot;&gt;
&lt;h3 class=&quot;blockTitle&quot;&gt;New C Preprocessor directives:&lt;/h3&gt;
&lt;h4 class=&quot;title&quot;&gt;#include&lt;/h4&gt;
&lt;p class=&quot;purpose&quot;&gt;#include effectively takes a single argument that is the name of a file, or path with file name, that is to be included in-line in the document right where the #include was.  These are almost always header files (xxxx.h) that include things like function prototypes and struct declarations that are used in the current file (xxxx.c).  Without the prototype of a function, the compiler may not be able to infer the correct information about the function when you call it in your own source code.&lt;/p&gt;
&lt;p class=&quot;purpose&quot;&gt;#include's can have the file name surrounded by less than/greater than symbols, this indicates it is a system header that you did not write and the preprocessor will look in special include folders to find it.  If the file name is surrounded with double quotes the preprocessor will look in the same folder as the current file, use this when including your own header files in your source.&lt;/p&gt;
&lt;h4 class=&quot;example&quot;&gt;Examples:&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;objectivec&quot;&gt;// system header stdio.h
#include &amp;lt;stdio.h&amp;gt;
// personal header, probably in the same directory as the current file
#include &quot;myFile.h&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div class=&quot;programmingBlock newCFunctions&quot;&gt;
&lt;h3 class=&quot;blockTitle&quot;&gt;New C Functions:&lt;/h3&gt;
&lt;h4 class=&quot;title&quot;&gt;&lt;a href=&quot;http://www.cplusplus.com/reference/clibrary/cstdio/printf/&quot; target=&quot;_blank&quot;&gt;int printf(const char *format, ...);&lt;/a&gt;&lt;/h4&gt;
&lt;h5 class=&quot;declared&quot;&gt;&lt;a href=&quot;http://www.cplusplus.com/reference/clibrary/cstdio/&quot; target=&quot;_blank&quot;&gt;declared in &lt;span&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/h5&gt;
&lt;p class=&quot;purpose&quot;&gt;printf() is used to print to standard out (usually the console), format is a constant string that can include 0 or many special format arguments.  The ... indicates that it can take a variable number of arguments, there will be 0 or many arguments to match the special format arguments in the format string. The integer return value is the number of special format arguments printf() matched.&lt;/p&gt;
&lt;p class=&quot;purpose&quot;&gt;The most common way of using printf() is to output an integer or double you have performed a calculation on.  There are a number of format specifiers to achieve a wide array of output, click the function prototype to learn more.&lt;/p&gt;
&lt;h4 class=&quot;example&quot;&gt;Examples:&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;objectivec&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
int i = 5 + 4;
printf(&quot;5 + 4 = %d&quot;, i);
/* %d is a signed integer, outputs...
5 + 4 = 9
*/
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
			<pubDate>Sat, 10 Dec 2011 14:19:49 -0800</pubDate>
			
			
			<guid>http://www.jaredkipe.com/blog/programming/programming-in-c/your-first-c-program/</guid>
		</item>
		
		<item>
			<title>Understanding Binary: Negative Numbers</title>
			<link>http://www.jaredkipe.com/blog/programming/general/understanding-binary-negative-numbers/</link>
			<description>&lt;p&gt;Building on the previous article on &lt;a href=&quot;http://www.jaredkipe.com/blog/programming/general/method-of-complements/&quot;&gt;Method of Complements&lt;/a&gt;, lets take a look at the difference between signed and unsigned integer types.&lt;/p&gt;
&lt;p&gt;In the article on &lt;a href=&quot;http://www.jaredkipe.com/blog/programming/general/primitive-data-types/&quot;&gt;Primitive Data Types&lt;/a&gt; I mentioned that integers come in signed and unsigned flavors.  Lets say we are working on 8-bit char's, the unsigned version will use all 8 bits for counting from 0 to 255, while the signed version will use 7 bits to count from 0 to 127, and the last bit to basically toggle that range to negative.  (in actuality its from -128 to 127 as we will see soon)&lt;/p&gt;
&lt;p&gt;Instead of simply toggling the last bit to make a positive number negative, computers use 2's complement.&lt;/p&gt;
&lt;h2&gt;1's Complement&lt;/h2&gt;
&lt;p&gt;Before we move on to 2's Compelement, we should learn 1's Complement.  This is equivilant to learning 9's Complement before learning 10's Complement from the earlier post.&lt;/p&gt;
&lt;p&gt;1's Complement is effectively the opposite of whatever the current bit holds, repeated for every bit.&lt;/p&gt;
&lt;p&gt;In C (and similar languages) there is a handy operator to take any primitive type and compute the 1's complement.  That is the Bitwise NOT operator: &lt;strong&gt;~&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;~1101b = 0010b&lt;br/&gt; ~0111b = 1000b&lt;/p&gt;
&lt;p&gt;Very easy stuff.&lt;/p&gt;
&lt;h2&gt;2's Complement&lt;/h2&gt;
&lt;p&gt;The rule for getting 2's Complement from 1's Complement, is the same for getting 10's Complement from 9's Complement in base 10 numbers.  That is, 2's Complement is 1's Complement plus one.  The same tricks apply as well, namely that all all rightmost 0's can stay 0, and simply add 1 to the first rightmost non-zero bit.  (in practice the first rightmost 1 just stays 1 and you flip all the bits left of it)&lt;/p&gt;
&lt;p&gt;In C (and similar languages) there is a handy operator to turn an integer type into the 2's complement (and is the subject of the article).  That is the Unary Minus operator: &lt;strong&gt;-&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;-1101b = 0011b&lt;br/&gt; -0111b = 1001b&lt;br/&gt; -1100b = 0100b&lt;/p&gt;
&lt;p&gt;Subtraction Using 2's Complement&lt;/p&gt;
&lt;p&gt;Lets do a quick binary subtraction problem using 8-bit signed integers, 100-37 in decimal.&lt;/p&gt;
&lt;p&gt;  0110 0100b&lt;br/&gt;&lt;span style=&quot;text-decoration: underline;&quot;&gt;-0010 0101&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;2's complement makes it:&lt;/p&gt;
&lt;p&gt;  0110 0100b&lt;br/&gt;&lt;span style=&quot;text-decoration: underline;&quot;&gt;+1101 1011b&lt;/span&gt;&lt;br/&gt;   0011 1111&lt;/p&gt;
&lt;p&gt;Our final answer, 63 in base 10.&lt;/p&gt;
&lt;p&gt;Now if you've been following along you may be wondering, why isn't the answer 0001 0011 1111b ?? Well in the Method of Complements, you need to do two things to get the correct answer.&lt;/p&gt;
&lt;p&gt;1:  Pad extra 0's in the higher order bits that may not be there (like 100-37 becomes 100-037) before you do the complementing.&lt;/p&gt;
&lt;p&gt;2:  Throw away the extra digit that is higher order than either of the starting numbers.&lt;/p&gt;
&lt;p&gt;The beauty of working in fixed bit integer numbers, like in a computer, is that both of these rules are automatically followed.  Every number has exactly 8-bits, so you don't need to pad.  And the 'extra' 9'th bit doesn't fit in the memory space, and thus just dissapears.&lt;/p&gt;
&lt;h2&gt;Beyond Subtraction&lt;/h2&gt;
&lt;p&gt;Storing negative numbers in their Complement versions has another advantage.  Namely that addition and subtraction can become agnostic as to the sign of the operands.  If you can add numbers, then adding a negative number is the exact same procedure.  And subtraction is to just find the complement of the second number and then use what you have for addition.  And by agnostic as to the sign, I mean that you don't need to worry about special cases like when you subtract using a negative number.&lt;/p&gt;
&lt;p&gt;4 - (-3) = 4 + (-(-3) =  7&lt;/p&gt;
&lt;p&gt;4 = 0100b&lt;br/&gt; 3 = 0011b&lt;br/&gt; -3 = 1101b&lt;br/&gt; --3 = 0011b&lt;br/&gt; 0100b + 0011b = 0111b (which is 7 by the way)&lt;/p&gt;</description>
			<pubDate>Tue, 01 Nov 2011 19:27:15 -0700</pubDate>
			
			
			<guid>http://www.jaredkipe.com/blog/programming/general/understanding-binary-negative-numbers/</guid>
		</item>
		
		<item>
			<title>Method of Complements</title>
			<link>http://www.jaredkipe.com/blog/programming/general/method-of-complements/</link>
			<description>&lt;h2&gt;or subtraction using addition&lt;/h2&gt;
&lt;p&gt;Most people would agree that subtraction is more difficult, time consuming, and error prone than addition.&lt;/p&gt;
&lt;p&gt;There is a way to complete a long subtraction problem using addition and the complement of the subtrahend (the number being subtracted).&lt;/p&gt;
&lt;h2&gt;9's Complement&lt;/h2&gt;
&lt;p&gt;9's complement is simply the number you would need to add to digit x to make that digit 9.  For numbers using more than 1 digit, you apply the complement to each digit.&lt;/p&gt;
&lt;p&gt;8722 =&amp;gt; 1277&lt;br/&gt; 9215 =&amp;gt; 0784&lt;/p&gt;
&lt;h2&gt;Subtraction using 9's Complement&lt;/h2&gt;
&lt;p&gt;As you might have guessed, subtraction involves the addition of this 9's complement.&lt;/p&gt;
&lt;p&gt;  9111&lt;br/&gt;&lt;span style=&quot;text-decoration: underline;&quot;&gt;- 8722&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;  9111&lt;br/&gt;&lt;span style=&quot;text-decoration: underline;&quot;&gt;+1277&lt;/span&gt;&lt;br/&gt; 10388&lt;/p&gt;
&lt;p&gt;This can't be right, this is in fact bigger than the original numbers. Well there are two more simple rules to apply this algorithm correctly. Drop the left most digit completely, and add 1 to the answer.&lt;/p&gt;
&lt;p&gt;0389 is in fact the correct answer. (I left the preceding 0 in place just to remind you what the left most digit was.)&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&lt;em&gt;This problem is a best case scenario as we replaced a subtraction problem that would have 3 'borrows' with an addition problem with 0 'carries'.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;10's Complement&lt;/h2&gt;
&lt;p&gt;That business about adding the 1 at the end can, and should, be rolled into the complement itself, and leads to some simplification of the rules for finding the complement.  You can leave all the rightmost zeroes zero, and just add 1 to the rightmost non-zero digit after finding the 9's complement.&lt;/p&gt;
&lt;p&gt;259000 =(via 9's)&amp;gt; 741999&lt;/p&gt;
&lt;p&gt;See if you add 1 to that, all the 9's become 0's again.&lt;/p&gt;
&lt;p&gt;259000 =(via 10's)&amp;gt; 742000&lt;/p&gt;
&lt;h3&gt;What about the &quot;drop the leftmost 1 (digit)&quot; part?&lt;/h3&gt;
&lt;p&gt;That part is central to the Method of Complements, and is part of what makes it so great when using fixed number of digits to do calculations (remember the bit lengths of the integer numbers in the &lt;a href=&quot;http://www.jaredkipe.com/blog/programming/general/primitive-data-types/&quot;&gt;Primitive Data Types&lt;/a&gt;?) The &lt;em&gt;minuend&lt;/em&gt; and &lt;em&gt;subtrahend&lt;/em&gt; need to have the same number of digits, thus any difference needs to be padded with extra 0's before finding the complement.&lt;/p&gt;
&lt;p&gt;920-70 =&amp;gt; 920-070 =&amp;gt; 920+930 = 850&lt;/p&gt;
&lt;p&gt;Here we did fixed-3-digit addition/subtraction where the extra thousands place digit &lt;strong&gt;overflows&lt;/strong&gt; or dissapears.&lt;/p&gt;
&lt;p&gt;In my next entry I will expand on this, specifically for digital computers.&lt;/p&gt;</description>
			<pubDate>Tue, 25 Oct 2011 10:22:31 -0700</pubDate>
			
			
			<guid>http://www.jaredkipe.com/blog/programming/general/method-of-complements/</guid>
		</item>
		
		<item>
			<title>Steve Jobs: Innovator, Visionary, Inspiration.</title>
			<link>http://www.jaredkipe.com/blog/news/steve-jobs-innovator-visionary-inspiration/</link>
			<description>&lt;p&gt;Today marks the passing of one of, if not the, most important visionaries of the computer age.&lt;/p&gt;
&lt;p&gt;Those first colored series iMacs turned Apple around from certain death. The iPod created a new word, and a new industry. Mac OSX revolutionized the way we interact with our computers, and how they interact with the world. The iPhone might as well be magic, it certainly is to me.&lt;/p&gt;
&lt;p&gt;There is not a single segment of the digital world that has not felt the touch of this innovator.  And he has been a constant source of inspiration personally.&lt;/p&gt;
&lt;p&gt;Steve Jobs, you will be missed.&lt;/p&gt;</description>
			<pubDate>Wed, 05 Oct 2011 22:29:10 -0700</pubDate>
			
			
			<guid>http://www.jaredkipe.com/blog/news/steve-jobs-innovator-visionary-inspiration/</guid>
		</item>
		
		<item>
			<title>New VPS (massive outage)</title>
			<link>http://www.jaredkipe.com/blog/news/new-vps/</link>
			<description>&lt;p&gt;Just got everything setup after my oh 60 hours or so of downtime. Why the downtime? ...&lt;/p&gt;
&lt;p&gt;Oh, just ClubUptime.com going out of business with no warning, and a very poor explanation.&lt;/p&gt;
&lt;p&gt;Somehow I managed to luck out and have taken a SQL dump from my sites &lt;strong&gt;LITTERALLY&lt;/strong&gt; the day before the servers got disconnected.  There were a few not so lucky customers.  You can find more over on &lt;a href=&quot;http://www.facebook.com/clubuptime&quot;&gt;ClubUptime's facebook wall&lt;/a&gt;... presumably for a limited time only!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Looks like they got some backups up for not so fortunate customers.  Good luck everyone!&lt;/p&gt;</description>
			<pubDate>Sat, 30 Jul 2011 20:36:58 -0700</pubDate>
			
			
			<guid>http://www.jaredkipe.com/blog/news/new-vps/</guid>
		</item>
		
		<item>
			<title>Maximum Width Text</title>
			<link>http://www.jaredkipe.com/blog/website-development/maximum-width-text/</link>
			<description>&lt;p&gt;Ever come across an element where you wished that an automatically wrapping element, like an h1, would automatically change its font-size property to accommodate a certain width?  I've got some CSS and Javascript for you.&lt;/p&gt;
&lt;h2&gt;Why?&lt;/h2&gt;
&lt;p&gt;Sometimes you have elements on your website that really should have fixed widths, maybe they need to fill a side bar, and you have problems with text that you either can't control or don't want to control too carefully. Maybe it displays content entered by a home user, maybe it was working great until you got a title that was just &lt;strong&gt;slightly&lt;/strong&gt; longer than another title and suddenly you wrapped to a new line.&lt;/p&gt;
&lt;h3&gt;Finished Examples:&lt;/h3&gt;
&lt;div class=&quot;block&quot;&gt;
&lt;div class=&quot;blockTop&quot;&gt;
&lt;h3 class=&quot;blockh3&quot;&gt;Short Title&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;Lorem paragraph&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;block&quot;&gt;
&lt;div class=&quot;blockTop&quot;&gt;
&lt;h3 class=&quot;blockh3&quot;&gt;Long Title without any Javascript&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;Lorem paragraph&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;block&quot;&gt;
&lt;div class=&quot;blockTop&quot;&gt;
&lt;h3 id=&quot;FixedWidthText&quot; class=&quot;blockh3&quot;&gt;Long Title with our new Javascript&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;Lorem paragraph&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;How?&lt;/h2&gt;
&lt;p&gt;Here is the HTML for the second and third examples. The structure is the only real important parts. The &lt;em&gt;id=&quot;FixedWidthText&quot;&lt;/em&gt;, is only important for the Javascript, and only for this specific example. (where we don't want all the blocks to have fixed widths)&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;div class=&quot;block&quot;&amp;gt;
	&amp;lt;div class=&quot;blockTop&quot;&amp;gt;
		&amp;lt;h3 class=&quot;blockh3&quot;&amp;gt;Long Title without any Javascript&amp;lt;/h3&amp;gt;
	&amp;lt;/div&amp;gt;
	&amp;lt;p&amp;gt;Lorem paragraph&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
 
&amp;lt;div class=&quot;block&quot;&amp;gt;
	&amp;lt;div class=&quot;blockTop&quot;&amp;gt;
		&amp;lt;h3 id=&quot;FixedWidthText&quot; class=&quot;blockh3&quot;&amp;gt;Long Title with our new Javascript&amp;lt;/h3&amp;gt;
	&amp;lt;p&amp;gt;Lorem paragraph&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;CSS&lt;/h3&gt;
&lt;p&gt;Firstly we need some CSS to define the size of the block. (as well as style them to show off the individual boxes better) The class &lt;em&gt;&quot;.blockTop&quot;&lt;/em&gt;  is important for visualizing the part around the h3 that we will be changing the size of implicitly.  &lt;em&gt;&quot;.blockTop&quot;&lt;/em&gt; could be an image or maybe have rounded corners.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;
.block {
	width: 300px;
	background: #eee;
	border: 1px solid #aaa;
	margin-bottom: 20px;
}

.blockTop {
	width: 100%;
	background: #7ab1d8;
}

.block h3.blockh3{
	display: inline-block;
	color: #666;
	font-size: 25px;
	padding-left: 5px;
	line-height: 35px;
	margin: 0;
	*display: inline;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h4&gt;Important parts of this CSS:&lt;/h4&gt;
&lt;p&gt;To be able to fix the width of an element, you need to be able to measure the width of it.  This is a problem for the normally block displayed H's (H1, H2 ...) as they have a tendency to be as wide as their surrounding parent element (in this case 300px).&lt;/p&gt;
&lt;p&gt;To solve this we change it to display as an &lt;strong&gt;inline-block&lt;/strong&gt;.  Display inline is not good enough, because then the width is only as wide as where the line break is, thus inline would look exactly like the non shrunken example.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;padding-left&lt;/strong&gt; is only to indent it a little from the left side so that the text isn't right up against the border (like the paragraphs under them), and we didn't use a padding-right because we will be fixing the width anyway so there is no reason to make sure it doesn't touch the right border.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;line-height&lt;/strong&gt; is somewhat important because I want the text to be centered vertically in the blue part (the containing .blockTop).  (note that the shrunken blue block is the same size and the first example's despite the much larger font)&lt;/p&gt;
&lt;h3&gt;Javascript&lt;/h3&gt;
&lt;p&gt;Without any Javascript example block 2 and 3 would look effectively identical.  The key to shrink them is to basically use Javascript to measure the width of the block and if it is beyond a certain width, shrink the &lt;strong&gt;&quot;font-size&quot;&lt;/strong&gt; incrementally until it fits.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;jQuery.noConflict();
jQuery(window).load(function() {
	jQuery('#FixedWidthText').textMaxWidth(290, 10);
});

// assumes maxWidth in px, and font-size in px
jQuery.fn.textMaxWidth = function(maxWidth, minFontSize) {
	this.each(function(){
		var width = jQuery(this).width();
		var fontSize = minFontSize + 1;
	
		while (width &amp;gt; maxWidth &amp;amp;&amp;amp; fontSize &amp;gt; minFontSize) {
			fontSize = parseInt(jQuery(this).css('font-size'));
			fontSize -= 1;
			jQuery(this).css('font-size', fontSize + 'px');
			width = jQuery(this).width();
		}
	});
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I'm obviously using the jQuery library to achieve the desired results. I'm also extending jQuery to add the &lt;strong&gt;textMaxWidth()&lt;/strong&gt; method in such a way that it doesn't matter if we called it on jQuery('#FixedWidthText') or jQuery('.blockh3'), the latter would be what we would use if this wasn't a very specific example.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;minFontSize&lt;/strong&gt; is optional, but a pretty good idea.  Without it, if you tried to shrink an element that, for some reason, doesn't change its width while the font-size shrinks, you don't end up with an infinite loop.&lt;/p&gt;
&lt;p&gt;The most important argument is &lt;strong&gt;maxWidth&lt;/strong&gt;.  This should be smaller than the physical maximum width, in our case 300px, because when the text wraps around to the new line it will effectively be the width of the containing element minus any paddings or margins you assigned.  In our case 300px - 5px padding-left - 5px imaginary padding-right = 290px.&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Compatibility?&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;I've tested this to work as intended in &lt;span style=&quot;text-decoration: underline;&quot;&gt;IE8+, Safari, Firefox, Opera, and Chrome&lt;/span&gt;.  &lt;span style=&quot;text-decoration: underline;&quot;&gt;IE6&amp;amp;7&lt;/span&gt; don't suppor&lt;strong&gt;t display: inline-block&lt;/strong&gt; properly and fail gracefully to the multiple line &lt;strong&gt;display: inline&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;Download the Source Code:&lt;/h3&gt;
&lt;p&gt;&lt;a title=&quot;Max Width Text CSS&quot; href=&quot;http://www.jaredkipe.com/assets/BlogExamples/WebDevelopment/max-width-text.css&quot; target=&quot;_blank&quot;&gt;Max Width Text CSS&lt;/a&gt;&lt;br/&gt;&lt;a title=&quot;Max Width Text Javascript&quot; href=&quot;http://www.jaredkipe.com/assets/BlogExamples/WebDevelopment/max-width-text.js&quot; target=&quot;_blank&quot;&gt;Max Width Text Javascript&lt;/a&gt;&lt;/p&gt;</description>
			<pubDate>Sat, 16 Jul 2011 10:51:32 -0700</pubDate>
			
			
			<guid>http://www.jaredkipe.com/blog/website-development/maximum-width-text/</guid>
		</item>
		
		<item>
			<title>Primitive Data Types</title>
			<link>http://www.jaredkipe.com/blog/programming/general/primitive-data-types/</link>
			<description>&lt;p&gt;The Primitive Data Types are data types that are used in every day in programming and usually correspond to the most basic building blocks of all the other Objects or data types you will be programming with down the road.&lt;/p&gt;
&lt;p&gt;The primitive data types come in a few flavors, and usually have a couple of sizes for each as well.  The sizes of the types depend on the language used, the specific compiler, and thus the computer architecture you are programming in (i386, x86_64 ...)&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Integer Types&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;Integer types are basically just counting numbers.  If you want to keep track of how many cows you have, the integer type is the one you will probably want to use.&lt;/p&gt;
&lt;p&gt;In strongly typed languages like C or Java, you define these numbers with the data type name in front of the variable name, e.g. &quot;int x = 5;&quot;&lt;/p&gt;
&lt;p&gt;In both strongly typed languages and weakly typed languages (like PHP and Javascript) you can force one type into the integer type by what we call &quot;casting&quot;, e.g. &quot;$x = (int)$_GET['x'];&quot;&lt;/p&gt;
&lt;table border=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;name:&lt;/td&gt;
&lt;td&gt;size:&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;char&lt;/td&gt;
&lt;td&gt;8-bit&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;short&lt;/td&gt;
&lt;td&gt;16-bit&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;int&lt;/td&gt;
&lt;td&gt;32-bit&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;long long&lt;/td&gt;
&lt;td&gt;64-bit&lt;/td&gt;
&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;They also come in &quot;signed&quot; and &quot;unsigned&quot; flavors.  Signed versions can keep track of negative numbers but do so by dedicating their last (highest order) bit to keep track of the sign.  Unsigned types use all of the bits for counting, thus they can count higher.&lt;/p&gt;
&lt;p&gt;Languages like C# and Java actually have other names for these differently sized integer types.  &lt;a href=&quot;http://en.wikipedia.org/wiki/Integer_(computer_science)&quot;&gt;You can checkout the giant table of integer types over on wikipedia&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Floating Point Types&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;Floating point types are for real numbers like 1.2 or 3.14, that is numbers that are not whole numbers.&lt;/p&gt;
&lt;p&gt;Floating point types are basically like always representing numbers in scientific notation say 1.22311 x 10^3.  They break some of their bits up to represent the exponent and the significant digits, and a single bit for the sign.&lt;/p&gt;
&lt;p&gt;Floating point numbers do NOT accurately represent all numbers, and this causes confusion and frustration when you try to use them where perfect base 10 accuracy is needed. (like banking)  This failure is the equivilant to say 1/3 represented as a base 10 decimal number.  The more accurately you want to define 1/3 as a base 10 decimal you need more and more digits 0.3333333...  1/10 (0.1) is for example not representable perfectly as a floating point number.&lt;/p&gt;
&lt;p&gt;Another problem with Floating Point types is that the bigger/longer the number gets, the less accurate it gets.  Rather, floating point numbers have a fixed number of significant digits, once you use those up, the remaining ones will be inaccurate.&lt;/p&gt;
&lt;p&gt;There are really only two major size flavors for floating point types.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;float&lt;/strong&gt; 16-bits (on 32-bit processors) 32-bits (on 64-bit processors)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;double&lt;/strong&gt; 32-bits (on 32-bit processors) 64-bits (on 64-bit processors)&lt;/p&gt;
&lt;p&gt;I personally always use doubles if I care about the accuracy even a little bit.  Here is a more detailed analysis on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Floating_point_type&quot;&gt;internals of floating point types&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Char&lt;/h2&gt;
&lt;p&gt;You may have though wondered what was up with the name for the smallest integer data type.  Well it is certainly an integer type mathematically and structurally, but it has another important usage in several languages.&lt;/p&gt;
&lt;p&gt;Char is used to store a single alpha-numeric character (and quite a few non alpha-numeric characters like ?!%$#_)&lt;/p&gt;
&lt;p&gt;Basically characters like 'A' or 'p' have integer equivalents, 65 and 112, as defined by various character encoding schemes.  E.g. ASCII, and utf-8.&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Enum&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Enum stands for enumerated type, and is essentially a way for you to define keywords to specific integer values.  Examples would be days in a week, or suits of playing cards.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Enum's come up in C and its descendants such as C++ and Java, as well as databases such as MySQL.&lt;/p&gt;
&lt;p&gt;enum suit { HEART, DIAMOND, SPADE, CLUB };&lt;/p&gt;</description>
			<pubDate>Wed, 29 Jun 2011 09:02:13 -0700</pubDate>
			
			
			<guid>http://www.jaredkipe.com/blog/programming/general/primitive-data-types/</guid>
		</item>
		
		<item>
			<title>Understanding Binary: Hexadecimal</title>
			<link>http://www.jaredkipe.com/blog/programming/general/understanding-binary-hexadecimal/</link>
			<description>&lt;p&gt;Topically, hexadecimal is extremely useful for programmers to understand, and makes binary in general quite a bit easier to work with and represent both in code and out.&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;The Hexadecimal System (base 16)&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;Binary numbers range from 0 to 1, decimal numbers range from 0-9, and hexadecimal numbers range from 0-15.  To keep it relatively easy to read, and more succinct than writing 10, 11, 12... out the numbers over 9 are remapped to the characters A, B, C...&lt;/p&gt;
&lt;p&gt;This allows a single &quot;digit&quot; to be represented by a single &quot;character&quot; in writing.&lt;/p&gt;
&lt;table border=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;base 10&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;base 16&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;base 10&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;base 16&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;9&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;A&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;B&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;C&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;D&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;6&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;E&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;7&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;F&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;It is customary to write hexadecimal numbers as 0x(hexadecimal), e.g. 0xF9, or 0x23A2.&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Justification for Hexadecimal&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Now that you know what a hexadecimal number is, and how to recognize them... Why would we bother with a completely new numbering scheme?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Remember how ugly it became working with relatively large binary numbers, say over 100 (7 binary digits)?  Remember when I said it was customary to keep long binary numbers clumped up into 4 digit chunks??&lt;/p&gt;
&lt;p&gt;That is because every 4 digit binary number corresponds perfectly with one of these new fangled hexadecimal numbers.&lt;/p&gt;
&lt;table border=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;base 2&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;base 16&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;base 2&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;base 16&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;0000&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;0001&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1001&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;9&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;0010&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1010&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;A&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;0011&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1011&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;B&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;0100&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1100&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;C&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;0101&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1101&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;D&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;0110&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;6&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1110&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;E&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;0111&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;7&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1111&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;F&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;This is great because we can take &lt;em&gt;LONGGG&lt;/em&gt; strings of binary and quickly convert them into a much easier to read, write, and say form.&lt;/p&gt;
&lt;h4&gt;Convert 1010 1101 0011 1001b into hexadecimal&lt;/h4&gt;
&lt;p&gt;This is actually very easy, we first lookup 1010b from our chart:  0xA&lt;/p&gt;
&lt;p&gt;1101b = 0xD&lt;/p&gt;
&lt;p&gt;0011b = 0x3&lt;/p&gt;
&lt;p&gt;1001b = 0x9&lt;/p&gt;
&lt;p&gt;Put them all together and you get the answer:  &lt;strong&gt;0xAD39&lt;/strong&gt;&lt;/p&gt;
&lt;h4&gt;Convert 0x2F into binary&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;0010 1111b&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Easy enough, right?&lt;/p&gt;
&lt;h2&gt;&quot;I though computers only understood binary?&quot;&lt;/h2&gt;
&lt;p&gt;That is true.  But humans and computers are much &lt;span style=&quot;text-decoration: line-through;&quot;&gt;better&lt;/span&gt; faster at converting hexadecimal numbers into their binary equivalents.  For this reason hexadecimal is a convenient way of entering constant numbers in code.&lt;/p&gt;</description>
			<pubDate>Tue, 28 Jun 2011 18:48:52 -0700</pubDate>
			
			
			<guid>http://www.jaredkipe.com/blog/programming/general/understanding-binary-hexadecimal/</guid>
		</item>
		
		<item>
			<title>Understanding Binary: Math</title>
			<link>http://www.jaredkipe.com/blog/programming/general/understanding-binary-math/</link>
			<description>&lt;p&gt;Though not as important as understanding binary in general, looking at some simple math in binary will allow you to conceptualize some of the operations that you will be working with on a regular basis.&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Addition&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;In base 10, addition is trivial until you need to awkwardly overflow to the next digit, that is to &quot;carry&quot;.  For example, if you add 1 to 9, you need to add a digit, and &quot;carry&quot; a 1 into the next digit.&lt;/p&gt;
&lt;p&gt;The same thing happens in binary, but unfortunately, it happens a lot more frequently.  Since a digit is only 1 or 0, there is a roughly 50% probability that you will need to &quot;carry&quot; to the next digit.  Worse yet, you will often find yourself needing to carry more than one time... Example, in base 10, adding 1 to 99, you add 1 to 9, carry one into the next digit and end up adding 1 to 9 again, carrying again to come out to 100.&lt;/p&gt;
&lt;p&gt;You can always add in stages, so if you need to add 121 to 99, you can break it up into 121+9, and then whatever that is you add it to 90.  When you think about doing it on pencil and paper you typically break it into stages based on digits.&lt;/p&gt;
&lt;p&gt;121+9 = 130&lt;/p&gt;
&lt;p&gt;130+90 = 220&lt;/p&gt;
&lt;h4&gt;Add 1001b to 11b&lt;/h4&gt;
&lt;p&gt;1001b + 1b = 1010b&lt;/p&gt;
&lt;p&gt;1010b + 10b = &lt;strong&gt;1100b&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Subtraction&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Just like addition, but you need to &quot;borrow&quot; if you don't have enough in the first number to subtract.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Honestly, subtraction is trickier to do and I'm trying to keep this pretty brief and general so I'm going to skip over the real details here.  But if you'd like to learn more about it, here are some &lt;a href=&quot;http://sandbox.mc.edu/~bennet/cs110/pm/sub.html&quot; target=&quot;_blank&quot;&gt;binary subtraction examples&lt;/a&gt;.  &lt;em&gt;(Note that when you borrow 1b from the higher digit you end up with 10b in the lower digit i.e. 2)&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Multiplication&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;Do you like adding binary numbers?  Want to do it as many times as you have digits in the smallest of the two products?&lt;/p&gt;
&lt;h4&gt;Multiply 1001b by 101b&lt;/h4&gt;
&lt;p&gt;1001&lt;br/&gt;x101&lt;/p&gt;
&lt;hr/&gt;&lt;p&gt;00&lt;strong&gt;1001&lt;/strong&gt;&lt;br/&gt;0&lt;strong&gt;0000&lt;/strong&gt;0&lt;br/&gt;&lt;strong&gt;1001&lt;/strong&gt;00&lt;/p&gt;
&lt;hr/&gt;&lt;p&gt;&lt;strong&gt;101101b&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;That probably needs some explanation.  Basically, just like base 10 multiplication, you break the whole multiplication operation up into 3 simple multiplication processes and 3 additions.  Every time you multiply a number by 0, it is 0, and by 1 is the original number.  The multiplications are truly trivial.  If its a 1 in the digit in question you copy down the top number and shift it over as many digits as you have already multiplied. &lt;em&gt;(I added bolding around the actual number we wrote down, and padded all the numbers with zeroes to keep everything lined up.)&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;Special Case: multiplying by 2 (10b)&lt;/h3&gt;
&lt;p&gt;In base 10, the easiest number (besides 1 or 0) to multiply by is by 10.  Multiplying by 10 is something most people can do in their heads without even thinking about it.  And if you were looking at the number on a computer you'd probably just copy, paste, and add a 0 to the end. &lt;/p&gt;
&lt;p&gt;Multiplying by 2 in base 2 is exactly the same thing.  You just &quot;shift&quot; the number to the left one digit and add a 0.&lt;/p&gt;
&lt;h4&gt;Multiply 1110 1101 0101b by 10b&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;0001 1101 1010 1010b&lt;/strong&gt; &lt;em&gt;(that was so easy it took me longer to &quot;rebalance&quot; the 4 digit spaces, than to even consider the answer)&lt;/em&gt;&lt;/p&gt;
&lt;h3 style=&quot;padding-left: 30px;&quot;&gt;Whats with the groups of four binary digits?&lt;/h3&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;Well, just like in decimal numbers we often put a comma (or period) after every 3 digits, you often see groups of 4 binary numbers grouped.  We will be going over this notation and the reasons when we go over hexadecimal numbers.&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Division&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Division gets messy and is similar in this way to subtraction, if you want to learn the nitty gritty, here is an &lt;a href=&quot;http://courses.cs.vt.edu/~cs1104/BuildingBlocks/divide.030.html&quot; target=&quot;_blank&quot;&gt;example algorithm on binary division&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;Special Case: dividing by 2 (10b)&lt;/h3&gt;
&lt;p&gt;As you may have guesses, this is the opposite of that neat multiply by 2 trick we just went over.  With 1 simple exception...&lt;/p&gt;
&lt;p&gt;Right &quot;shifting&quot; the number is only perfect if the number is &lt;strong&gt;even&lt;/strong&gt;, that is to say that it &lt;strong&gt;doesn't end in 1&lt;/strong&gt;.  This is just like if a number ends in any number but 0 and you divide it by ten there will be some decimal fraction remaining.&lt;/p&gt;
&lt;h4&gt;Divide 0001 1110 1000b by 10b&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;1111 0100b&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;hr/&gt;&lt;hr/&gt;&lt;p&gt;Don't get discouraged if a lot of this is going over your head.  I'd doubt any of it is required to be a great programmer.  If anything, as you go on, certain aspects of programming will probably jog your memory about this post.&lt;/p&gt;</description>
			<pubDate>Mon, 27 Jun 2011 21:38:29 -0700</pubDate>
			
			
			<guid>http://www.jaredkipe.com/blog/programming/general/understanding-binary-math/</guid>
		</item>
		
		<item>
			<title>Ready For Sale (Again)</title>
			<link>http://www.jaredkipe.com/blog/news/ready-for-sale-again/</link>
			<description>&lt;p&gt;After a couple week delay all of &lt;a href=&quot;http://www.jaredkipe.com/apps/&quot;&gt;my apps&lt;/a&gt; are back up on the iTunes App Store.  Thats right, not &lt;strong&gt;just&lt;/strong&gt; &lt;a href=&quot;http://itunes.apple.com/app/statistical-free/id382983675?mt=8&quot;&gt;Statistical Free&lt;/a&gt;.  As it turns out when they say &quot;Bank Pending&quot;, they mean, &quot;go into contracts and view/submit them all again.&quot;&lt;/p&gt;</description>
			<pubDate>Fri, 24 Jun 2011 16:02:22 -0700</pubDate>
			
			
			<guid>http://www.jaredkipe.com/blog/news/ready-for-sale-again/</guid>
		</item>
		
		<item>
			<title>Understanding Binary: Counting</title>
			<link>http://www.jaredkipe.com/blog/programming/general/understanding-binary-counting/</link>
			<description>&lt;p&gt;I personally believe that a basic, if not strong, understanding of the binary (or base 2) counting is crucial to understanding how computers work. And, thus, to being a good programmer.&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Counting in base 10&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;Before going into binary we should take a moment to think about something that should be completely natural.  I'm speaking of how you count and do some simple math in base 10 or decimal counting.&lt;/p&gt;
&lt;p&gt;Numbers in base 10 are simply the numerals 0-9.  If you have a single digit you can only count to 9, thats 1 less than you can actually count on your fingers (assuming you don't have any extras)!&lt;/p&gt;
&lt;p&gt;If you want to count beyond 9 you need to have more digits.  Every digit you add on the left, you can count roughly 10 times as high as you could before. (e.g. 99 vs 9, 999 vs 99)&lt;/p&gt;
&lt;h4&gt;How high could you count using your fingers and your toes? (assuming the dexterity)&lt;/h4&gt;
&lt;p&gt;Well the answer isn't 20, but if you've been paying attention... &lt;strong&gt;99&lt;/strong&gt; shouldn't surprise you.  Here is how...&lt;/p&gt;
&lt;p&gt;You start off counting normally on your hands up to 9, then your hands go back to 0, and you stick up a single toe. &lt;em&gt;(I don't think I can physically do this, but you get the idea) &lt;/em&gt;You repeat this process putting up the second toe when you go from 19-20, and just keep going until 99.&lt;/p&gt;
&lt;p&gt;You might be wondering, &quot;hey I've got a finger and a toe that I'm not counting with, shouldn't I be able to count higher than 99?&quot;  Why yes, if you want to use base 11, you could count to 120 (11^2 - 1)but thats beyond the scope of this discussion and not natural to most people at all.&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Counting in base 2&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;Base 2 only has the numerals 0 and 1.  With a single digit you can only count to 1, thats it.  To count higher you need to add another digit.  But that only lets you count to 3, which isn't much better.  How far can we count with 4 digits of binary?&lt;/p&gt;
&lt;table border=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Decimal&lt;/td&gt;
&lt;td&gt;Binary&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;01&lt;/td&gt;
&lt;td&gt;0001&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;02&lt;/td&gt;
&lt;td&gt;0010&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;03&lt;/td&gt;
&lt;td&gt;0011&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;04&lt;/td&gt;
&lt;td&gt;0100&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;05&lt;/td&gt;
&lt;td&gt;0101&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;06&lt;/td&gt;
&lt;td&gt;0110&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;07&lt;/td&gt;
&lt;td&gt;0111&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;08&lt;/td&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;09&lt;/td&gt;
&lt;td&gt;1001&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;1010&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;1011&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;1100&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;1101&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;1110&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;1111&lt;/td&gt;
&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;em&gt;(for now I'm going to put &lt;strong&gt;b&lt;/strong&gt; behind every number that is explicitly binary.)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Phew I bet you didn't read the whole thing so I'm not sure why I bothered typing it all out.  The pattern is pretty obvious.  Just like when you get to, say, 100 in decimal and start counting up the lower 99 again.  When you get to say 1000&lt;strong&gt;b&lt;/strong&gt; you get to count up the lower three digits in exactly the same way.&lt;/p&gt;
&lt;h4&gt;How high can you count on your fingers and toes using binary?&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;1048575&lt;/strong&gt;  Surprised? (1048575 = 1111 1111 1111 1111 1111&lt;strong&gt;b&lt;/strong&gt; a 20 'bit' number)&lt;/p&gt;
&lt;p&gt;If we used 4 fingers, the above chart gets us to 15&lt;/p&gt;
&lt;p&gt;5 fingers?  31&lt;/p&gt;
&lt;p&gt;10 fingers? 1023&lt;/p&gt;
&lt;p&gt;You can see just how fast this is growing.  The relationship is (base^numOfDigits -1)&lt;/p&gt;
&lt;p&gt;2^5 = 32, 32-1 = 31&lt;/p&gt;
&lt;p&gt;2^10 = 1024, 1024-1 = 1023&lt;/p&gt;
&lt;p&gt;2^20 - 1 = &lt;strong&gt;1048575&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I couldn't make it, though I've never tried.  Counting on a single hand from 0 to 15 or 31 is not too much of a challenge and I encourage you to try it.&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Why don't we learn to count on our fingers in binary then?&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;The fact is that binary counting on fingers is more efficient because we can represent a single digit &lt;strong&gt;LITERALLY&lt;/strong&gt; with a single digit (finger).  Working with written binary numbers is more cumbersome, to count over 100 takes 6 binary digits!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Additionally, we are not digital processors.  We can generally handle more data than a simple YES/NO or 1/0. Binary numbers are very verbose when compared to our 0-9 counting system, which makes binary more error prone, and more time consuming to work with.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;Continue on with &lt;a href=&quot;http://www.jaredkipe.com/blog/programming/general/understanding-binary-math/&quot;&gt;Understanding Binary: Math&lt;/a&gt;...&lt;/span&gt;&lt;/p&gt;</description>
			<pubDate>Wed, 22 Jun 2011 21:11:23 -0700</pubDate>
			
			
			<guid>http://www.jaredkipe.com/blog/programming/general/understanding-binary-counting/</guid>
		</item>
		

	</channel>
</rss>
