<?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>Blog &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/blog/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Computer Algorithms: Multiplication</title>
		<link>/2013/01/14/computer-algorithms-multiplication/</link>
		<comments>/2013/01/14/computer-algorithms-multiplication/#comments</comments>
		<pubDate>Mon, 14 Jan 2013 14:40:54 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[Addition]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[computer algorithms]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Multiplication]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">/?p=3531</guid>
		<description><![CDATA[Introduction Perhaps right after the addition at school we’ve learned how to multiply two numbers. This algorithm isn’t as easy as addition, but besides that we’re so familiar with it and that we even don’t recognize it as an “algorithm”. We just know it by heart. However, as I already said, multiplication is a bit &#8230; <a href="/2013/01/14/computer-algorithms-multiplication/" class="more-link">Continue reading <span class="screen-reader-text">Computer Algorithms: Multiplication</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2012/11/26/computer-algorithms-strassens-matrix-multiplication/" rel="bookmark" title="Computer Algorithms: Strassen&#8217;s Matrix Multiplication">Computer Algorithms: Strassen&#8217;s Matrix Multiplication </a></li>
<li><a href="/2012/05/15/computer-algorithms-karatsuba-fast-multiplication/" rel="bookmark" title="Computer Algorithms: Karatsuba Fast Multiplication">Computer Algorithms: Karatsuba Fast Multiplication </a></li>
<li><a href="/2011/12/26/computer-algorithms-binary-search/" rel="bookmark" title="Computer Algorithms: Binary Search">Computer Algorithms: Binary Search </a></li>
<li><a href="/2013/01/07/computer-algorithms-adding-large-integers/" rel="bookmark" title="Computer Algorithms: Adding Large Integers">Computer Algorithms: Adding Large Integers </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Perhaps right after the <a title="Computer Algorithms: Adding Large Integers" href="/2013/01/07/computer-algorithms-adding-large-integers/">addition </a>at school we’ve learned how to multiply two numbers. This algorithm isn’t as easy as addition, but besides that we’re so familiar with it and that we even don’t recognize it as an “algorithm”. We just know it by heart.</p>
<p>However, as I already said, multiplication is a bit more difficult than addition. This algorithm is interesting because for several reasons. First of all, let’s compare multiplication in binary and decimal.</p>
<p>So, let’s see how to multiply two numbers.</p>
<h2>Overview</h2>
<p>Multiplying and adding is practically the same thing, so where’s the difference?</p>
<p>It’s clear that a product of two numbers (each with N digits) can be represented as N sums, as we can see on the next picture.</p>
<figure id="attachment_3540" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2013/01/1.-Multiplication-Addition.png"><img class="size-full wp-image-3540" alt="Multiplication &amp; Addition" src="/wp-content/uploads/2013/01/1.-Multiplication-Addition.png" width="620" height="399" srcset="/wp-content/uploads/2013/01/1.-Multiplication-Addition.png 620w, /wp-content/uploads/2013/01/1.-Multiplication-Addition-300x193.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">&nbsp;</figcaption></figure>
<p>Now, for larger integers each time we shift left the next intermediate sum.</p>
<p><figure id="attachment_3539" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2013/01/2.-Multiplication.png"><img class="size-full wp-image-3539" alt="Multiplication" src="/wp-content/uploads/2013/01/2.-Multiplication.png" width="620" height="399" srcset="/wp-content/uploads/2013/01/2.-Multiplication.png 620w, /wp-content/uploads/2013/01/2.-Multiplication-300x193.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">&nbsp;</figcaption></figure><span id="more-3531"></span></p>
<p>That is absolutely logical since we can represent the numbers as a sum of decimals divisible by 10 without a remainder.</p>
<figure id="attachment_3538" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2013/01/3.-Multiplication-Part-2.png"><img class="size-full wp-image-3538" alt="Multiplication " src="/wp-content/uploads/2013/01/3.-Multiplication-Part-2.png" width="620" height="399" srcset="/wp-content/uploads/2013/01/3.-Multiplication-Part-2.png 620w, /wp-content/uploads/2013/01/3.-Multiplication-Part-2-300x193.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">&nbsp;</figcaption></figure>
<h2>Binary Multiplication</h2>
<p>Sometimes binary is easier to work with than decimal and multiplication is just the case. As shown on the picture below binary multiplication is much easier compared to decimal.</p>
<figure id="attachment_3537" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2013/01/4.-Binary-Multiplication.png"><img class="size-full wp-image-3537" alt="Binary " src="/wp-content/uploads/2013/01/4.-Binary-Multiplication.png" width="620" height="399" srcset="/wp-content/uploads/2013/01/4.-Binary-Multiplication.png 620w, /wp-content/uploads/2013/01/4.-Binary-Multiplication-300x193.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">&nbsp;</figcaption></figure>
<p>That’s because we multiply only by 1 and 0, so the intermediate sum can be either the first number or 0.</p>
<p>In the oder hand, shifting left in binary equals multiplication by 2.</p>
<figure id="attachment_3536" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2013/01/5.-Binary-Shift-Left.png"><img class="size-full wp-image-3536" alt="Binary " src="/wp-content/uploads/2013/01/5.-Binary-Shift-Left.png" width="620" height="399" srcset="/wp-content/uploads/2013/01/5.-Binary-Shift-Left.png 620w, /wp-content/uploads/2013/01/5.-Binary-Shift-Left-300x193.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">&nbsp;</figcaption></figure>
<p>Why? Well, simply because the base is 2. It’s practically the same with decimals where shifting left equals multiplying by 10.</p>
<figure id="attachment_3535" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2013/01/6.-Decimal-Shift-Left.png"><img class="size-full wp-image-3535" alt="Decimal " src="/wp-content/uploads/2013/01/6.-Decimal-Shift-Left.png" width="620" height="399" srcset="/wp-content/uploads/2013/01/6.-Decimal-Shift-Left.png 620w, /wp-content/uploads/2013/01/6.-Decimal-Shift-Left-300x193.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">&nbsp;</figcaption></figure>
<p>The same applies of course for any base, i.e. hex F equals decimal 15 (since the first number is 0) and FF equals 255 (which is 16&#215;16 &#8211; 1).</p>
<h2>Can we do better?</h2>
<p>Unlike <a title="Computer Algorithms: Adding Large Integers" href="/2013/01/07/computer-algorithms-adding-large-integers/">addition</a>, here the answer is &#8211; yes, and we already know how to multiply faster (either decimal or binary numbers) using the <a title="Computer Algorithms: Karatsuba Fast Multiplication" href="/2012/05/15/computer-algorithms-karatsuba-fast-multiplication/">Karatsuba’s fast multiplication algorithm</a>.</p>
<h1>It’s Important Because …</h1>
<p>I&#8217;ve to admit that both addition and multiplication algorithms are fairly to understand, but we must remember that they are giving us the ground level for more complex cryptographic algorithms.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2012/11/26/computer-algorithms-strassens-matrix-multiplication/" rel="bookmark" title="Computer Algorithms: Strassen&#8217;s Matrix Multiplication">Computer Algorithms: Strassen&#8217;s Matrix Multiplication </a></li>
<li><a href="/2012/05/15/computer-algorithms-karatsuba-fast-multiplication/" rel="bookmark" title="Computer Algorithms: Karatsuba Fast Multiplication">Computer Algorithms: Karatsuba Fast Multiplication </a></li>
<li><a href="/2011/12/26/computer-algorithms-binary-search/" rel="bookmark" title="Computer Algorithms: Binary Search">Computer Algorithms: Binary Search </a></li>
<li><a href="/2013/01/07/computer-algorithms-adding-large-integers/" rel="bookmark" title="Computer Algorithms: Adding Large Integers">Computer Algorithms: Adding Large Integers </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2013/01/14/computer-algorithms-multiplication/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MVC in Practice: Designing Models</title>
		<link>/2010/07/12/mvc-in-practice-designing-models/</link>
		<comments>/2010/07/12/mvc-in-practice-designing-models/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 18:19:39 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linguistics]]></category>
		<category><![CDATA[Noun]]></category>
		<category><![CDATA[Social information processing]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Technology/Internet]]></category>

		<guid isPermaLink="false">/?p=1786</guid>
		<description><![CDATA[Existing Examples There are lots of examples online teaching you what is MVC, why it is good and how to develop an application using this pattern. However most of them use a predefined structure with already constructed database and only the connection between a database table and a model is described. Actually what happens before &#8230; <a href="/2010/07/12/mvc-in-practice-designing-models/" class="more-link">Continue reading <span class="screen-reader-text">MVC in Practice: Designing Models</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/08/09/models-in-zend-framework-initialize-all-methods-with-init/" rel="bookmark" title="Models in Zend Framework &#8211; Initialize All Methods with init()">Models in Zend Framework &#8211; Initialize All Methods with init() </a></li>
<li><a href="/2010/09/29/construct-a-sorted-php-linked-list/" rel="bookmark" title="Construct a Sorted PHP Linked List">Construct a Sorted PHP Linked List </a></li>
<li><a href="/2010/06/04/one-form-multiple-db-records/" rel="bookmark" title="One Form &#8211; Multiple DB Records">One Form &#8211; Multiple DB Records </a></li>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Existing Examples</h2>
<p><a href="/wp-content/uploads/2010/07/sketch.jpg"><img class="aligncenter size-full wp-image-1798" title="sketch" src="/wp-content/uploads/2010/07/sketch.jpg" alt="Sketch" width="430" height="332" srcset="/wp-content/uploads/2010/07/sketch.jpg 430w, /wp-content/uploads/2010/07/sketch-300x231.jpg 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<p>There are lots of examples online teaching you what is MVC, why it is good and how to develop an application using this pattern. However most of them use a predefined structure with already constructed database and only the connection between a database table and a model is described. Actually what happens before all this. The client tells you something he&#8217;d like to have in his application.</p>
<p>Just imagine the following situation. You&#8217;ve a client who tells you that he wants a blog. The blog has to have posts and users, and every user must write posts and every post must have comments. Also he wants a set of categories where each post will be attached to one ore more categories. And finally a blogroll &#8211; one ore more links to another blogs.</p>
<p>This is pretty general and does not pretend to be a full featured example. However the strategy to make a primary structure of the future models is to pickup the nouns in this paragraph. It is really simple:</p>
<blockquote><p><span style="color: #999999;">The blog has to have <span style="color: #000000;"><strong>posts</strong></span> and <span style="color: #000000;"><strong>users</strong></span>, and every user must write posts  and every post must have <span style="color: #000000;"><strong>comments</strong></span>. Also he wants a set of <span style="color: #000000;"><strong>categories</strong></span> where each post will be attached to one or more categories. And finally  a blogroll &#8211; one ore more <span style="color: #000000;"><strong>links</strong></span> to another blogs.</span></p></blockquote>
<p>So far you can see there are five prototypes of database tables: post, user, comment, category and link.</p>
<p>It&#8217;s important to note that not every noun is ready to be a database table. In some cases, when the client is really smart, he can give you a more detailed description. Than there are nouns describing the other nouns, of course, they are supposed to be columns to those tables.</p>
<blockquote><p><span style="color: #999999;">Every <strong><span style="color: #000000;">post</span></strong> must have <strong><span style="color: #800000;">title</span></strong> and <strong><span style="color: #800000;">description</span></strong> &#8230;</span></p></blockquote>
<p>This is what we can do for now. From a raw text you can design your database and models in the MVC architecture.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/08/09/models-in-zend-framework-initialize-all-methods-with-init/" rel="bookmark" title="Models in Zend Framework &#8211; Initialize All Methods with init()">Models in Zend Framework &#8211; Initialize All Methods with init() </a></li>
<li><a href="/2010/09/29/construct-a-sorted-php-linked-list/" rel="bookmark" title="Construct a Sorted PHP Linked List">Construct a Sorted PHP Linked List </a></li>
<li><a href="/2010/06/04/one-form-multiple-db-records/" rel="bookmark" title="One Form &#8211; Multiple DB Records">One Form &#8211; Multiple DB Records </a></li>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/07/12/mvc-in-practice-designing-models/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
