<?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>example &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/example/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>Beginning Algorithm Complexity and Estimation</title>
		<link>/2010/08/29/beginning-algorithm-complexity-and-estimation/</link>
		<comments>/2010/08/29/beginning-algorithm-complexity-and-estimation/#respond</comments>
		<pubDate>Sun, 29 Aug 2010 11:05:47 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[Analysis of algorithms]]></category>
		<category><![CDATA[Asymptotic analysis]]></category>
		<category><![CDATA[Big O notation]]></category>
		<category><![CDATA[C syntax]]></category>
		<category><![CDATA[complexity]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[Lenstra elliptic curve factorization]]></category>
		<category><![CDATA[Mathematical analysis]]></category>
		<category><![CDATA[Mathematical notation]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Negation]]></category>
		<category><![CDATA[programmer]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[Variable]]></category>

		<guid isPermaLink="false">/?p=1937</guid>
		<description><![CDATA[Which is the Fastest Program? When a programmer sees a chunk of code he tends to evaluate it in a rather intuitive manner and to qualify it as &#8220;elegant&#8221; or not. This is quite easy, because it&#8217;s subjective and nobody knows what exactly elegant means. However behind this there is a powerful mathematical approach of &#8230; <a href="/2010/08/29/beginning-algorithm-complexity-and-estimation/" class="more-link">Continue reading <span class="screen-reader-text">Beginning Algorithm Complexity and Estimation</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/09/03/friday-algorithms-input-data-and-complexity/" rel="bookmark" title="Friday Algorithms: Input Data and Complexity">Friday Algorithms: Input Data and Complexity </a></li>
<li><a href="/2010/10/03/using-php-array_diff-in-algorithm-development/" rel="bookmark" title="Using PHP&#8217;s array_diff in Algorithm Development">Using PHP&#8217;s array_diff in Algorithm Development </a></li>
<li><a href="/2011/11/04/how-to-check-if-a-date-is-more-or-less-than-a-month-ago-with-php/" rel="bookmark" title="How to Check if a Date is More or Less Than a Month Ago with PHP">How to Check if a Date is More or Less Than a Month Ago with PHP </a></li>
<li><a href="/2012/03/12/algorithm-cheatsheet-quicksort/" rel="bookmark" title="Algorithm cheatsheet: Quicksort">Algorithm cheatsheet: Quicksort </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Which is the Fastest Program?</h2>
<p><a href="/wp-content/uploads/2010/08/complexity.jpg"><img src="/wp-content/uploads/2010/08/complexity.jpg" alt="" title="circuit" width="430" height="213" class="aligncenter size-full wp-image-1949" srcset="/wp-content/uploads/2010/08/complexity.jpg 430w, /wp-content/uploads/2010/08/complexity-300x148.jpg 300w" sizes="(max-width: 430px) 100vw, 430px" /></a><br />
When a programmer sees a chunk of code he tends to evaluate it in a rather intuitive manner and to qualify it as &#8220;elegant&#8221; or not. This is quite easy, because it&#8217;s subjective and nobody knows what exactly elegant means. However behind this there is a powerful mathematical approach of measuring a program effectiveness.</p>
<p>It&#8217;s a pity that most of the developers still think of the big O notation as something from the university classes, but unusual in the practice and they barely use it their job. But before describing the big O notation, let me start from something really simple.</p>
<p>Let&#8217;s have the following example (note that all the examples are in PHP):</p>
<pre lang="php">
$n = 100;
$s = 0;

for ($i = 0; $i < $n; $i++) {
	for ($j = 0; $j < $n; $j++) {
		$s++;	
	}	
}
</pre>
<p>As you can see there are two assignments and two nested loops. This is really a widely used example from any algorithm book.</p>
<h2>Constants, Languages, Compilers</h2>
<p>First of all the time to assign a value to a variable, to compare two values and to increment a variable is constant. It depends on the computer resources, the compiler or the language, but it's constant on one machine if you compare two chunks of code. Now we can see that these operations take (add) constant time to the program, and we can assume this time is respectively a, b, c, d, e, f, g, h, i.</p>
<pre lang="php">
$n = 100; 	// a
$s = 0;		// b
$i = 0; 	// c
$i < $n; 	// d
$i++;		// e
$j = 0; 	// f
$j < $n;	// g
$j++;		// h
$s++;		// i
</pre>
<h2>What Matters?</h2>
<p>Actually the most important thing here is the value of n. By assigning greater values to n the more time will take the program to run. As we can see from the following table by multiplying the value of n by 10, the time became 100 times more.</p>
<pre lang="php">
n		time
10		0.00002
100		0.002
...		...
</pre>
<p>What happens in fact is that we can sum all these values.</p>
<pre lang="php">
a + b + c + n*d + n*e + n*(f + n*g + n*h + n*i)
</pre>
<p>and by substituting:</p>
<pre lang="php">
a + b + c = k
d + e + n = l
g + h + i = m
</pre>
<p>the result is:</p>
<pre lang="php">
m*n² + l*n + k
</pre>
<h2>Conclusion</h2>
<p>Here the most important thing is the degree of n, because it can change dramatically the program time consumption depending on the n value. Thus this chunk has a quadratic complexity or O(n²).</p>
<p>Of course there are constants, but in the practice they are not so important. Take a look at these two functions:</p>
<pre lang="php">
f = 2*n²
g = 200*n
</pre>
<p>OK, for n = 1 the first one will be faster, but as n increments the second function becomes to be faster and faster, thus after a given value of n the second function is really the fastest!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/09/03/friday-algorithms-input-data-and-complexity/" rel="bookmark" title="Friday Algorithms: Input Data and Complexity">Friday Algorithms: Input Data and Complexity </a></li>
<li><a href="/2010/10/03/using-php-array_diff-in-algorithm-development/" rel="bookmark" title="Using PHP&#8217;s array_diff in Algorithm Development">Using PHP&#8217;s array_diff in Algorithm Development </a></li>
<li><a href="/2011/11/04/how-to-check-if-a-date-is-more-or-less-than-a-month-ago-with-php/" rel="bookmark" title="How to Check if a Date is More or Less Than a Month Ago with PHP">How to Check if a Date is More or Less Than a Month Ago with PHP </a></li>
<li><a href="/2012/03/12/algorithm-cheatsheet-quicksort/" rel="bookmark" title="Algorithm cheatsheet: Quicksort">Algorithm cheatsheet: Quicksort </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/08/29/beginning-algorithm-complexity-and-estimation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Event driven programming with jQuery &#8211; (part 4). Simple event driven app.</title>
		<link>/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/</link>
		<comments>/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 07:47:58 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[event driven]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">/?p=764</guid>
		<description><![CDATA[The sample app In my last post from the event driven programming with jQuery series, I simply will post a sample application. In my previous post I showed up the use case for a tab panel, which can be done typically with no custom events, and almost every developer would do it that way, but &#8230; <a href="/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/" class="more-link">Continue reading <span class="screen-reader-text">Event driven programming with jQuery &#8211; (part 4). Simple event driven app.</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/10/22/event-driven-programming-with-jquery-part-3-what-is-a-module/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 3). What is a module?">Event driven programming with jQuery &#8211; (part 3). What is a module? </a></li>
<li><a href="/2009/10/20/event-driven-programming-with-jquery-part-1-what-is-event-driven/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 1). What is event driven?">Event driven programming with jQuery &#8211; (part 1). What is event driven? </a></li>
<li><a href="/2009/10/21/event-driven-programming-with-jquery-part-2-events-in-jquery/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 2). Events in jQuery.">Event driven programming with jQuery &#8211; (part 2). Events in jQuery. </a></li>
<li><a href="/2010/02/01/writing-a-jquery-plugin-part-2-sample-plugin/" rel="bookmark" title="Writing a jQuery plugin &#8211; (part 2). Sample plugin.">Writing a jQuery plugin &#8211; (part 2). Sample plugin. </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>The sample app</h2>
<p>In my last post from the event driven programming with jQuery series, I simply will post a sample application. In my previous post I showed up the use case for a tab panel, which can be done typically with no custom events, and almost every developer would do it that way, but however just for the purpose of this series I&#8217;ll separate the logic into two modules. One for the tabs and one for the content. Thus you can separate the application into two simple apps into two different pages, and they will continue to work correctly.</p>
<p>In fact most of the large JavaScript applications use that technique and I was inspired to write these posts from one <a title="Design and build scalable javascript applications" href="http://video.stoimen.com/2009/09/18/design-build-scalable-javascript-applications/" target="_blank">talk</a> of <a title="NZOnline - Nicholas Zakas" href="http://www.nczonline.net/" target="_blank">Nicholas Zakas</a>, a Yahoo! front end developer, where he uses YUI, of course. But anyway this technique can be done with everyone of the major JS libraries like jQuery.</p>
<p>You can see the <a title="Event Driven Programming with jQuery example" href="http://www.stoimen.com/event.driven.jquery/" target="_blank">demo</a> and the source here.</p>
<p>If there are any questions about it, don&#8217;t hesitate to post your questions and I&#8217;ll be glad to help.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/10/22/event-driven-programming-with-jquery-part-3-what-is-a-module/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 3). What is a module?">Event driven programming with jQuery &#8211; (part 3). What is a module? </a></li>
<li><a href="/2009/10/20/event-driven-programming-with-jquery-part-1-what-is-event-driven/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 1). What is event driven?">Event driven programming with jQuery &#8211; (part 1). What is event driven? </a></li>
<li><a href="/2009/10/21/event-driven-programming-with-jquery-part-2-events-in-jquery/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 2). Events in jQuery.">Event driven programming with jQuery &#8211; (part 2). Events in jQuery. </a></li>
<li><a href="/2010/02/01/writing-a-jquery-plugin-part-2-sample-plugin/" rel="bookmark" title="Writing a jQuery plugin &#8211; (part 2). Sample plugin.">Writing a jQuery plugin &#8211; (part 2). Sample plugin. </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>You should not insert an &#8220;a&#8221; tag in another &#8220;a&#8221; tag! &#8230;</title>
		<link>/2009/04/14/you-should-not-insert-an-tag-in-another-tag-ie-breaks/</link>
		<comments>/2009/04/14/you-should-not-insert-an-tag-in-another-tag-ie-breaks/#respond</comments>
		<pubDate>Tue, 14 Apr 2009 05:31:34 +0000</pubDate>
		<dc:creator><![CDATA[stoimen]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[a]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[issue]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">/?p=504</guid>
		<description><![CDATA[IE6 fails to display correctly nested <a> tags. Why and how to find a workaround?<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/06/08/a-tag-doesnt-apply-hover-on-ie6/" rel="bookmark" title="a tag doesn&#8217;t apply hover on IE6">a tag doesn&#8217;t apply hover on IE6 </a></li>
<li><a href="/2009/04/25/flex-3-hslider-thumb-gap-issue/" rel="bookmark" title="Flex 3 HSlider thumb gap issue">Flex 3 HSlider thumb gap issue </a></li>
<li><a href="/2011/03/29/scroll-an-iframe-content-to-a-predefined-position/" rel="bookmark" title="Scroll an IFRAME Content to a Predefined Position">Scroll an IFRAME Content to a Predefined Position </a></li>
<li><a href="/2009/04/08/flash-doesnt-load-in-div-with-display-none-style/" rel="bookmark" title="Flash doesn&#8217;t load in div with display:none style">Flash doesn&#8217;t load in div with display:none style </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>The Problem</h2>
<p>Well it may look strange to want to do that exaclty. Who wants to have a &lt;a&gt; tag in another. It really looks semanticaly incorrect, but however, every normal A grade browser&#8217;s displaing it correctly, except .. IE6.</p>
<h2>The Case</h2>
<p>The Microsoft team may be too much semanticaly involved in that problem, I should guess, but that&#8217;s really impossible.</p>
<h2>The Workaround</h2>
<p>The workaround is trivial. You just put the &lt;a&gt; tags one after another and adjust them with relative position and margin with negative values.</p>
<h2>&#8230; and The Example</h2>
<blockquote><p>&lt;a href=&#8221;#&#8221;&gt;link here&lt;/a&gt;</p>
<p>&lt;a href=&#8221;#&#8221; style=&#8221;margin:-10px 0 0; position : relative;&#8221;&gt;link there&lt;/a&gt;</p></blockquote>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/06/08/a-tag-doesnt-apply-hover-on-ie6/" rel="bookmark" title="a tag doesn&#8217;t apply hover on IE6">a tag doesn&#8217;t apply hover on IE6 </a></li>
<li><a href="/2009/04/25/flex-3-hslider-thumb-gap-issue/" rel="bookmark" title="Flex 3 HSlider thumb gap issue">Flex 3 HSlider thumb gap issue </a></li>
<li><a href="/2011/03/29/scroll-an-iframe-content-to-a-predefined-position/" rel="bookmark" title="Scroll an IFRAME Content to a Predefined Position">Scroll an IFRAME Content to a Predefined Position </a></li>
<li><a href="/2009/04/08/flash-doesnt-load-in-div-with-display-none-style/" rel="bookmark" title="Flash doesn&#8217;t load in div with display:none style">Flash doesn&#8217;t load in div with display:none style </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/04/14/you-should-not-insert-an-tag-in-another-tag-ie-breaks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
