<?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>Vacheslav Starikov&#039;s</title>
	<atom:link href="http://starikovs.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://starikovs.com</link>
	<description>BLOG</description>
	<lastBuildDate>Wed, 21 Dec 2011 19:37:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Cron timezone problem</title>
		<link>http://starikovs.com/2011/12/21/cron-timezone-problem/</link>
		<comments>http://starikovs.com/2011/12/21/cron-timezone-problem/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 19:37:58 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=577</guid>
		<description><![CDATA[I&#8217;ve just tried to understand what&#8217;s the problem with my crontab. I set it to a proper time but nothing happens. As i guessed the problem is in timezone. I use Debian linux so here I&#8217;ll provide steps how I&#8217;ve fixed it: Configure time zone with dpkg-reconfigure dpkg-reconfigure tzdata Link localtime to a corresponding zoneinfo [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just tried to understand what&#8217;s the problem with my crontab. I set it to a proper time but nothing happens. As i guessed the problem is in timezone.</p>
<p>I use Debian linux so here I&#8217;ll provide steps how I&#8217;ve fixed it:</p>
<h5>Configure time zone with dpkg-reconfigure</h5>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    dpkg-reconfigure tzdata</pre></div></div>

<h5>Link localtime to a corresponding zoneinfo file</h5>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-sf</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>zoneinfo<span style="color: #000000; font-weight: bold;">/</span>Europe<span style="color: #000000; font-weight: bold;">/</span>Kiev <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>localtime</pre></div></div>

<p>In your case select your time zone.</p>
<h5>Restart cron daemon</h5>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>cron restart</pre></div></div>

<p>In my case this was the fix for the problem. I edited my contab and cron started to work like a Swiss watch <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/12/21/cron-timezone-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New line to paragraph in PHP</title>
		<link>http://starikovs.com/2011/11/10/php-new-line-to-paragraph/</link>
		<comments>http://starikovs.com/2011/11/10/php-new-line-to-paragraph/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 06:43:42 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=569</guid>
		<description><![CDATA[Here&#8217;s an example of how to convert new line (LF &#8211; line feed, &#8216;\n&#8217;) or carriage return (CR, &#8216;\r&#8217;) followed by new line (CR+LF, &#8216;\r\n&#8217;) to &#60;br&#62; or &#60;p&#62;. In case of double or more breaks we&#8217;ll get a paragraph but in case of one break we&#8217;ll have &#60;br&#62;. $text = 'Lorem ipsum\r\n\r\ndolor sit\r\namet.'; // [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an example of how to convert new line (LF &#8211; line feed, &#8216;\n&#8217;) or carriage return (CR, &#8216;\r&#8217;) followed by new line (CR+LF, &#8216;\r\n&#8217;) to &lt;br&gt; or &lt;p&gt;. In case of double or more breaks we&#8217;ll get a paragraph but in case of one break we&#8217;ll have &lt;br&gt;.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Lorem ipsum\r\n\r\ndolor sit\r\namet.'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// double or more nl to &lt;p&gt;</span>
<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(\r?\n){2,}/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/p&gt;&lt;p&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// nl to &lt;br&gt;</span>
<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(\r?\n)+/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;p&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$text</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/p&gt;'</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>output: </strong><span>&lt;p&gt;Lorem ipsum&lt;/p&gt;&lt;p&gt;dolor sit&lt;br /&gt;amet.&lt;/p&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/11/10/php-new-line-to-paragraph/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One side shadow in CSS3</title>
		<link>http://starikovs.com/2011/11/09/css3-one-side-shadow/</link>
		<comments>http://starikovs.com/2011/11/09/css3-one-side-shadow/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 14:22:40 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[css3]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=552</guid>
		<description><![CDATA[As You may suppose, there isn&#8217;t a standard way to set the box shadow for only one side of the box or leave one side of the element without a shadow. But You can reach it by using simple CSS tricks. Here You can analyze two examples. In the first example, we will set box-shadow [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://starikovs.com/wp-content/uploads/2011/11/one-side-shadow-css3.png" alt="" title="one-side-shadow-css3" width="121" height="235" class="alignleft size-full wp-image-553" style="margin-bottom: 0" /></p>
<p>As You may suppose, there isn&#8217;t a standard way to set the box shadow for only one side of the box or leave one side of the element without a shadow. But You can reach it by using simple CSS tricks. Here You can analyze two examples. </p>
<p>In the first example, we will set box-shadow for only one side of the box.</p>
<p>In the second sample, only one side of the element will be without a shadow.</p>
<p>I hope everybody will understand this CSS so I won&#8217;t provide any other description. More code, less water)</p>
<p>Let&#8217;s start:</p>
<h3>One side shadow</h3>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">div <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">7px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #3333ff;">:before </span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">' '</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">transparent</span><span style="color: #00AA00;">;</span> 
  box-shadow<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">5px</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<style type="text/css">
#test1 {
margin: 30px;
height: 100px;
width: 100px;
position: relative;
overflow: hidden;
padding: 0 7px 0 0;
}
#test1:before {
position: absolute; 
content: ' '; 
top: 0px; 
right: 7px; 
bottom: 0;
left: 0; 
background-color: transparent; 
box-shadow: 0 0 5px black;
border: 1px solid red;
}
</style>
<div id="test1"></div>
<h3>One side without shadow</h3>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">div <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span> <span style="color: #933;">7px</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">7px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
div<span style="color: #3333ff;">:before </span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">' '</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-7px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">transparent</span><span style="color: #00AA00;">;</span> 
  box-shadow<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">5px</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<style type="text/css">
#test2 {
margin: 30px;
height: 100px;
width: 100px;
position:relative;
overflow: hidden;
padding: 7px 7px 0 7px;
}
#test2:before {
position: absolute; 
content: ' '; 
top: 7px; 
right: 7px; 
bottom: -7px;
left: 7px; 
background-color: transparent; 
box-shadow: 0 0 5px black;
border: 1px solid red;
}
</style>
<div id="test2"></div>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/11/09/css3-one-side-shadow/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Zend and &#8220;configure db-adapter&#8221; command problem</title>
		<link>http://starikovs.com/2011/08/11/zf-configure-db-adapter-problem/</link>
		<comments>http://starikovs.com/2011/08/11/zf-configure-db-adapter-problem/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 10:07:25 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=531</guid>
		<description><![CDATA[I use Win7 and Netbeans to work with Zend. When I tryed to configure db adapter for MySQL I got an error. Run command: configure db-adapter "adapter=PDO_MYSQL&#038;host=localhost&#038; username=root&#038;dbname=test&#038;password=555" Error: 'host' is not recognized as an internal or external command, operable program or batch file. 'password' is not recognized as an internal or external command, operable [...]]]></description>
			<content:encoded><![CDATA[<p>I use Win7 and Netbeans to work with Zend. When I tryed to configure db adapter for MySQL I got an error.</p>
<p><strong>Run command:</strong></p>
<pre>
configure db-adapter
    "adapter=PDO_MYSQL&#038;host=localhost&#038;
    username=root&#038;dbname=test&#038;password=555"
</pre>
<p><strong>Error:</strong></p>
<pre>
'host' is not recognized as an internal or external command,
operable program or batch file.
'password' is not recognized as an internal or external command,
operable program or batch file.
'database' is not recognized as an internal or external command,
operable program or batch file.
</pre>
<p><strong>Solution:</strong></p>
<p>I&#8217;ve just read lots of forums until I found a <a href="http://forums.netbeans.org/post-75072.html">solution</a>. When I escaped quotation marks the command begin to run properly:</p>
<pre>
configure db-adapter
    \"adapter=PDO_MYSQL&#038;host=localhost&#038;
    username=root&#038;dbname=test&#038;password=555\"
</pre>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/08/11/zf-configure-db-adapter-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to return a value form Event in C#</title>
		<link>http://starikovs.com/2011/07/15/how-to-return-a-value-form-event-in-c/</link>
		<comments>http://starikovs.com/2011/07/15/how-to-return-a-value-form-event-in-c/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 11:00:51 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=523</guid>
		<description><![CDATA[public delegate bool MyEventHandler&#40;object sender /* additional params */&#41;; public event MyEventHandler MyEvent; &#160; public void MyMethod&#40;&#41; &#123; if &#40;MyEvent != null &#38;&#38; MyEvent&#40;this&#41;&#41; &#123; /* TODO: do something */ &#125; &#125; &#160; public void MyBind&#40;&#41; &#123; MyEvent += new MyHandler&#40;this&#41;; &#125; &#160; private bool MyHandler&#40;object sender&#41; &#123; return true; &#125;]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">delegate</span> <span style="color: #6666cc; font-weight: bold;">bool</span> MyEventHandler<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender <span style="color: #008080; font-style: italic;">/* additional params */</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">event</span> MyEventHandler MyEvent<span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> MyMethod<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>MyEvent <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;&amp;</span> MyEvent<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #008080; font-style: italic;">/* TODO: do something */</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> MyBind<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    MyEvent <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> MyHandler<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">bool</span> MyHandler<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/07/15/how-to-return-a-value-form-event-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Absolute elements ignore z-index in IE6 and IE7</title>
		<link>http://starikovs.com/2011/04/13/absolute-elements-ignore-z-index-in-ie6-and-ie7/</link>
		<comments>http://starikovs.com/2011/04/13/absolute-elements-ignore-z-index-in-ie6-and-ie7/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 08:19:04 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[ie7]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=509</guid>
		<description><![CDATA[In this article I will show an example of how to fix the IE 6-7 bug when absolute elements ignore z-index CSS property. In the screenshot above you can see the problem. In the sample below you can see how these styles work in your browser: 1 2 HTML: &#60;div id=&#34;column1&#34;&#62;1&#60;div id=&#34;absoluteDiv&#34;&#62;&#60;/div&#62;&#60;/div&#62; &#60;div id=&#34;column2&#34;&#62;2&#60;/div&#62; CSS: [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://starikovs.com/wp-content/uploads/2011/04/absolute_element_ignores_zindex.png" alt="" title="absolute_element_ignores_zindex" width="493" height="74" class="alignnone size-full wp-image-510" /></p>
<p>In this article I will show an example of how to fix the IE 6-7 bug when absolute elements ignore <code>z-index</code> CSS property. In the screenshot above you can see the problem.  In the sample below you can see how these styles work in your browser: </p>
<div style="display: block; position: relative; float: left; width: 100px; margin: 5px; padding: 5px; border: 1px solid red;">1
<div style="display: block; position: absolute; top: 5px; left: 20px; width: 200px; height: 30px; background-color: yellow; border: 1px solid orange; z-index: 10000;"></div>
</div>
<div style="display: block; position: relative; float: left; width: 100px; margin: 5px; padding: 5px; border: 1px solid red;">2</div>
<div style="clear: both; float: none;"></div>
<p><strong>HTML</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;column1&quot;</span>&gt;</span>1<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;absoluteDiv&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;column2&quot;</span>&gt;</span>2<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p><strong>CSS</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#column1</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#column2</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#absoluteDiv</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> orange<span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">10000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>To fix the bug you need to add <code>z-index</code> property to all the parents of your absolute element until you reach the siblings that overlap your absolute element. So, here&#8217;s a workaround:</p>
<p><strong>FIX</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#column1</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">10000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/04/13/absolute-elements-ignore-z-index-in-ie6-and-ie7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting cellspacing and cellpadding in CSS</title>
		<link>http://starikovs.com/2011/04/01/cellspacing-and-cellpadding-in-css/</link>
		<comments>http://starikovs.com/2011/04/01/cellspacing-and-cellpadding-in-css/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 10:07:12 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=489</guid>
		<description><![CDATA[In this article you can find an example of how to set the cellspacing and cellpadding values with help of CSS styles. First let&#8217;s declare a table with cellspacing and cellpadding attributes and see how it looks: &#60;table cellpadding=&#34;3&#34; cellspacing=&#34;3&#34; border=&#34;1&#34;&#62; &#60;tr&#62; &#60;td&#62;1&#60;/td&#62; &#60;td&#62;2&#60;/td&#62; &#60;/tr&#62; &#60;tr&#62; &#60;td&#62;3&#60;/td&#62; &#60;td&#62;4&#60;/td&#62; &#60;/tr&#62; &#60;/table&#62; In your browser this table [...]]]></description>
			<content:encoded><![CDATA[<p>In this article you can find an example of how to set the cellspacing and cellpadding values with help of CSS styles.</p>
<p>First let&#8217;s declare a table with cellspacing and cellpadding attributes and see how it looks:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">table</span> <span style="color: #000066;">cellpadding</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #000066;">cellspacing</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #000066;">border</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;1&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>1<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>2<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>3<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>4<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">table</span>&gt;</span></pre></div></div>

<p>In your browser this table has the following presentation:</p>
<table cellpadding="3" cellspacing="3" border="1" style="border-collapse: separate;">
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
</table>
<p>Now, let&#8217;s override the values of cellspacing and cellpadding attributes with help of CSS style:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">table <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">border-collapse</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">separate</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border-spacing</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
table td<span style="color: #00AA00;">,</span> table th <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>If we apply these styles to our table the cellspacing and cellpadding values of the table will be changed:</p>
<table cellpadding="3" cellspacing="3" border="1" style="border-collapse: separate; border-spacing: 10px;">
<tr>
<td style="padding: 10px;">1</td>
<td style="padding: 10px;">2</td>
</tr>
<tr>
<td style="padding: 10px;">3</td>
<td style="padding: 10px;">4</td>
</tr>
</table>
<p>These styles work in all the mordern browsers. If you want these attributes get working in <strong>IE 6</strong> and <strong>IE 7</strong> you still should use HTML attributes. By the way, cellpadding and cellspacing HTML attributes ARE NOT deprecated so you can fearlessly use them.</p>
<h3>What if cellspacing is zero?</h3>
<p>If you need to set cellspacing to zero with help of CSS you should use these styles:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">table <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">border-collapse</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">collapse</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
table td<span style="color: #00AA00;">,</span> table th <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>So, applying these styles to the table above we will get:</p>
<table cellpadding="3" cellspacing="3" border="1" style="border-collapse: collapse;">
<tr>
<td style="padding: 10px;">1</td>
<td style="padding: 10px;">2</td>
</tr>
<tr>
<td style="padding: 10px;">3</td>
<td style="padding: 10px;">4</td>
</tr>
</table>
<p>These styles work OK in <strong>IE6+</strong>.</p>
<h3>Browsers</h3>
<p>I&#8217;ve just tested this example in different browsers:</p>
<table>
<tr>
<th>FireFox 4</th>
<td>OK</td>
</tr>
<tr>
<th>Google Chrome</th>
<td>OK</td>
</tr>
<tr>
<th>Safari 5</th>
<td>OK</td>
</tr>
<tr>
<th>Opera 11</th>
<td>OK</td>
</tr>
<tr>
<th>Internet Explorer 8</th>
<td>OK</td>
</tr>
<tr>
<th>Internet Explorer 7</th>
<td>INCOMPLETELY</td>
</tr>
<tr>
<th>Internet Explorer 6</th>
<td>INCOMPLETELY</td>
</tr>
</table>
<h3>Need help on CSS properties? Check these links <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </h3>
<p><a href="http://www.w3schools.com/Css/pr_tab_border-collapse.asp">border-collapse</a></p>
<p><a href="http://www.w3schools.com/css/pr_tab_border-spacing.asp">border-spacing</a></p>
<p><a href="http://www.w3schools.com/css/css_padding.asp">padding</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/04/01/cellspacing-and-cellpadding-in-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing a dimensional array in JavaScript</title>
		<link>http://starikovs.com/2011/03/31/access-dimensional-array-javascript/</link>
		<comments>http://starikovs.com/2011/03/31/access-dimensional-array-javascript/#comments</comments>
		<pubDate>Thu, 31 Mar 2011 06:26:48 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=478</guid>
		<description><![CDATA[Let&#8217;s declare a two dimensional array and try to access the element. Here is the first example: var array = &#91;&#91;1, 2, 3&#93;,&#91;4, 5, 6&#93;&#93;; alert&#40;array&#91;1&#93;&#91;1&#93;&#41;; // Output: 5 Here is the same sample but with another sytnax: var array = new Array&#40;2&#41;; array&#91;0&#93; = new Array&#40;3&#41;; array&#91;0&#93;&#91;0&#93; = 1; array&#91;0&#93;&#91;1&#93; = 2; array&#91;0&#93;&#91;2&#93; = [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s declare a two dimensional array and try to access the element. Here is the first example:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> array <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">6</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// Output: 5</span></pre></div></div>

<p>Here is the same sample but with another sytnax:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> array <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>
array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">3</span><span style="color: #339933;">;</span>
array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">4</span><span style="color: #339933;">;</span>
array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">;</span>
array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">6</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// Output: 5</span></pre></div></div>

<p>Again, another syntax of this example to access a javascript array:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> array <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">6</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// Output: 5</span></pre></div></div>

<p>Some developers make the following error when accessing a JavaScript array and wait that the <strong>5</strong> will be returned:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> array <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">6</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// Output: [4, 5, 6]</span></pre></div></div>

<p>JavaScript interpretes <strong>1,1</strong> as a comma separated expression and this expression returnes <strong>1</strong>. Each part of the comma separated expression is executed left to right. The final value of the comma separated expression is the value of the last comma part.  So, when you try to evaluate the following script in the sample below you will get the last array item because the value of the comma separated expression <strong>0,1,2</strong> will be <strong>2</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> array <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>array<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// Output: 3</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/03/31/access-dimensional-array-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache redirect examples using mod_alias</title>
		<link>http://starikovs.com/2011/03/12/apache-redirect-example-using-mod_alias/</link>
		<comments>http://starikovs.com/2011/03/12/apache-redirect-example-using-mod_alias/#comments</comments>
		<pubDate>Sat, 12 Mar 2011 20:36:31 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=469</guid>
		<description><![CDATA[Hi! here I will provide few samples of how to create redirect in Apache web server. You can test this examples locally in your localhost. First example In the first example let&#8217;s redirect to Google search when we trying to go to localhost. 1. Go to the root folder of your web server. In my [...]]]></description>
			<content:encoded><![CDATA[<p>Hi! here I will provide few samples of how to create redirect in Apache web server. You can test this examples locally in your localhost.</p>
<h3>First example</h3>
<p>In the first example let&#8217;s redirect to Google search when we trying to go to localhost.</p>
<p>1. Go to the root folder of your web server. In my case, it&#8217;s <code>C:\xampp\htdocs\.htaccess</code> and create <strong>.htaccess</strong> file if it doesn&#8217;t exist.</p>
<p>2. At the first line of <strong>.htaccess</strong> write:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">Redirect</span> / http://google.com</pre></div></div>

<p>4. Try to go to your localhost again. Apache will redirect you to Google search.</p>
<h3>Second example</h3>
<p>In this example le&#8217;ts redirect to Google search only when somebody trying to go to a web server folder &#8220;my&#8221;.</p>
<p>1. At the first line of <strong>.htaccess</strong> write:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">Redirect</span> /my/ http://google.com</pre></div></div>

<p>2. Now, when you go to your localhost you will get the right localhost page, but when you try to go to <code>http://localhost/my/</code> it redirects you to Google search.</p>
<h3>Third example</h3>
<p>1. Let&#8217;s redirect to a subfolder when querying a subfolder. For instance, when the user entering <code>http://localhost/my/</code> let&#8217;s redirect to <code>http://localhost/site/</code> or when the user querying <code>http://localhost/my/page.html</code> let&#8217;s redirect to <code>http://localhost/site/page.html</code></p>
<p>2. Edit your <strong>.htaccess</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">Redirect</span> /my/ /site/</pre></div></div>

<h3>mod_alias</h3>
<p>All these tricks are done with help of mod_alias so this module has to be turned on. You can read more abous this module at <a href="http://apache.org">Apache</a>:</p>
<ul>
<li><a href="http://httpd.apache.org/docs/1.3/mod/mod_alias.html">Module mod_alias</a></li>
<li><a href="http://httpd.apache.org/docs/1.3/mod/mod_alias.html#redirect">Redirect directive</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/03/12/apache-redirect-example-using-mod_alias/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Observer pattern example in C#</title>
		<link>http://starikovs.com/2011/03/11/observer-pattern-example-csharp/</link>
		<comments>http://starikovs.com/2011/03/11/observer-pattern-example-csharp/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 21:25:19 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[patterns]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=460</guid>
		<description><![CDATA[This article has a simple sample of using Observer pattern. The description of this pattern you can read in other resources or you can understand the basis of the pattern exploring this example. Also, you can download an example in C#. This pattern is also known as Dependents pattern or Publish-Subscribe pattern class Subject &#123; [...]]]></description>
			<content:encoded><![CDATA[<p>This article has a simple sample of using <strong>Observer</strong> pattern. The description of this pattern you can read in other resources or you can understand the basis of the pattern exploring this example. Also, you can <a href="http://starikovs.com/my-examples/ObserverPatternExampleCSharp.zip">download</a> an example in C#. This pattern is also known as <strong>Dependents</strong> pattern or <strong>Publish-Subscribe</strong> pattern</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">class</span> Subject
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> List<span style="color: #008000;">&lt;</span>Observer<span style="color: #008000;">&gt;</span> observers <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span>Observer<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> Attach<span style="color: #008000;">&#40;</span>Observer observer<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        observers<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>observer<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> Detach<span style="color: #008000;">&#40;</span>Observer observer<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        observers<span style="color: #008000;">.</span><span style="color: #0000FF;">Remove</span><span style="color: #008000;">&#40;</span>observer<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> Notify<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>var observer <span style="color: #0600FF; font-weight: bold;">in</span> observers<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            observer<span style="color: #008000;">.</span><span style="color: #0000FF;">Update</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">abstract <span style="color: #6666cc; font-weight: bold;">class</span> Observer
<span style="color: #008000;">&#123;</span>
    abstract <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> Update<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">class</span> ConcreteSubject <span style="color: #008000;">:</span> Subject
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">int</span> value<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> Value
    <span style="color: #008000;">&#123;</span>
        get
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> value<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        set
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">value</span> <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
            Notify<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">class</span> ConcreteObserver <span style="color: #008000;">:</span> Observer
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> ConcreteSubject subject<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> Update<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Subject value is {0}.&quot;</span>, subject<span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> ConcreteObserver<span style="color: #008000;">&#40;</span>ConcreteSubject subject<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        subject<span style="color: #008000;">.</span><span style="color: #0000FF;">Attach</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">subject</span> <span style="color: #008000;">=</span> subject<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    ~ConcreteObserver<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        subject<span style="color: #008000;">.</span><span style="color: #0000FF;">Detach</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">class</span> Program
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> args<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        var concreteSubject <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ConcreteSubject<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        var concreteObserver <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> ConcreteObserver<span style="color: #008000;">&#40;</span>concreteSubject<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        concreteSubject<span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">10</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>As an output you will have: <strong>Subject value is 10</strong>.</p>
<h3>Links</h3>
<p><a href="http://en.wikipedia.org/wiki/Observer_pattern">Observer pattern description in Wikipedia</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/03/11/observer-pattern-example-csharp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

