<?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>web &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/web/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>Wanted &#8211; onfocus/onblur. Why They Don&#8217;t Work Always!</title>
		<link>/2011/02/09/wanted-onfocusonblur-why-they-dont-work-always/</link>
		<comments>/2011/02/09/wanted-onfocusonblur-why-they-dont-work-always/#respond</comments>
		<pubDate>Wed, 09 Feb 2011 14:11:48 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[DOM events]]></category>
		<category><![CDATA[Focus]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[Markup languages]]></category>
		<category><![CDATA[Tag soup]]></category>
		<category><![CDATA[Technical communication]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">/?p=2160</guid>
		<description><![CDATA[On Focus Perhaps you think of onfocus and onblur events as a default behavior existing in any web page. This is not quite true! Onfocurs and onblur are well known in web developing (js) and are fired, of course, when the user tries to point something or leaves some element. Onfocurs is fired when the &#8230; <a href="/2011/02/09/wanted-onfocusonblur-why-they-dont-work-always/" class="more-link">Continue reading <span class="screen-reader-text">Wanted &#8211; onfocus/onblur. Why They Don&#8217;t Work Always!</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/04/20/how-to-sanitize-user-input-in-php/" rel="bookmark" title="How to Sanitize User Input in PHP?">How to Sanitize User Input in PHP? </a></li>
<li><a href="/2009/12/30/jquery-live-vs-bind-performance/" rel="bookmark" title="jQuery live() vs bind() performance">jQuery live() vs bind() performance </a></li>
<li><a href="/2010/09/24/2xjquery-select-a-selector/" rel="bookmark" title="2xjQuery: Select a Selector">2xjQuery: Select a Selector </a></li>
<li><a href="/2010/01/20/google-closure-compiler-doesnt-work/" rel="bookmark" title="Google Closure Compiler doesn&#8217;t work?!">Google Closure Compiler doesn&#8217;t work?! </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>On Focus</h2>
<p><a href="/wp-content/uploads/2011/02/onfocus.jpg"><img class="alignleft size-full wp-image-2177" title="onfocus" src="/wp-content/uploads/2011/02/onfocus.jpg" alt="onfocus" width="450" height="253" srcset="/wp-content/uploads/2011/02/onfocus.jpg 450w, /wp-content/uploads/2011/02/onfocus-300x168.jpg 300w" sizes="(max-width: 450px) 100vw, 450px" /></a></p>
<p>Perhaps you think of onfocus and onblur events as a default behavior existing in any web page. This is not quite true! Onfocurs and onblur are well known in web developing (js) and are fired, of course, when the user tries to point something or leaves some element. Onfocurs is fired when the user either goes to an element with the Tab button on with the mouse. When the element is on focus, evidently, the onfocus event is fired. Actually you can see which element is on focus, like an anchor or input, when the element is outlined by the browser by default. In the same scenario, when some element has been on focus and than the user switches to another element, the onblur event is fired. Thus you may guess that this element is no longer on focus.<span id="more-2160"></span></p>
<p>This in general are the onfocus/onblur events. The interesting part is that by default are known as built-in events in every page, but that is wrong.</p>
<h2>Where Are My Events?</h2>
<p>A typical use case is to take the code from some web page, where you&#8217;re sure this works perfectly, you can focus and blur element with no obstacle, but once you paste it inside your markup everything&#8217;s going wrong. Imagine you&#8217;ve the following markup (a typical search box text):</p>
<pre lang="html4strict">
<input type="text" onblur="if(this.value=='') this.value = 'Search in This Site';" onfocus="if(this.value=='Search in This Site') this.value = '';" />
</pre>
<p>This works perfectly until you paste it to your site. And than nothing works correctly. Why? Where&#8217;s the problem?</p>
<h2>Make Them Work</h2>
<p>Actually the problem isn&#8217;t hiding somewhere in the markup above. It&#8217;s in the HTML definition. There are lots of web pages using strict HTML definition, that looks like this:</p>
<pre lang="html4strict">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	...
</head>
<body>
	...
</pre>
<p>while you&#8217;ve to use the pure HTML definition to make onfocus/onblur work.</p>
<p>You&#8217;ve to switch to:</p>
<pre lang="html4strict">
<html>
<head>
	...
</head>
<body>
	...
</pre>
<p>Than you can continue using these useful events!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/04/20/how-to-sanitize-user-input-in-php/" rel="bookmark" title="How to Sanitize User Input in PHP?">How to Sanitize User Input in PHP? </a></li>
<li><a href="/2009/12/30/jquery-live-vs-bind-performance/" rel="bookmark" title="jQuery live() vs bind() performance">jQuery live() vs bind() performance </a></li>
<li><a href="/2010/09/24/2xjquery-select-a-selector/" rel="bookmark" title="2xjQuery: Select a Selector">2xjQuery: Select a Selector </a></li>
<li><a href="/2010/01/20/google-closure-compiler-doesnt-work/" rel="bookmark" title="Google Closure Compiler doesn&#8217;t work?!">Google Closure Compiler doesn&#8217;t work?! </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2011/02/09/wanted-onfocusonblur-why-they-dont-work-always/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
