<?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>swape.net</title>
	<atom:link href="http://www.swape.net/w/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.swape.net/w</link>
	<description>alireza balouch</description>
	<lastBuildDate>Wed, 21 Jul 2010 19:00:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>My PHP Code-Standards Part 2</title>
		<link>http://www.swape.net/w/2010/03/my-php-code-standards-part-2/</link>
		<comments>http://www.swape.net/w/2010/03/my-php-code-standards-part-2/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 21:34:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.swape.net/w/?p=85</guid>
		<description><![CDATA[Classses Class name and and file name should have the same name. Let us say you have a class called "myFirstClass" then your file should be myFirstClass.class.php Remember to have some kind of comment on top of the file to describe important information about the class like author, version nr or created date. &#160; class [...]]]></description>
			<content:encoded><![CDATA[<p><b>Classses</b></p>
<p>Class name and and file name should have the same name.</p>
<p>Let us say you have a class called "myFirstClass" then your file should be myFirstClass.class.php </p>
<p>Remember to have some kind of comment on top of the file to describe important information about the class like author, version nr or created date.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> myFirstClass<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">private</span> <span class="re0">$intNumber</span> = <span class="nu0">3</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">private</span> <span class="re0">$strName</span> = <span class="st0">''</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> <span class="kw2">function</span> getNumber<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;<span class="kw1">return</span> <span class="re0">$this</span>-&gt;<span class="me1">intNumber</span> ;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span> </div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
</ol>
</div>
<p>Never access the internal variables directly. Use a public function to get or set the value.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> someClass<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">private</span> <span class="re0">$intValue1</span> = <span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">private</span> <span class="re0">$intValue2</span> = <span class="nu0">0</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">public</span> <span class="kw2">function</span> getValue1<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$this</span>-&gt;<span class="me1">intValue1</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp;<span class="kw2">public</span> <span class="kw2">function</span> getValue2<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$this</span>-&gt;<span class="me1">intValue2</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
</ol>
</div>
<p>Use default values instead of passing the same value every time.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> someClass<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">private</span> <span class="re0">$intValue1</span> = <span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">private</span> <span class="re0">$intValue2</span> = <span class="nu0">0</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">public</span> <span class="kw2">function</span> <a href="http://www.php.net/getdate"><span class="kw3">getDate</span></a><span class="br0">&#40;</span><span class="re0">$strFormat</span> = <span class="st0">'Y-m-d'</span> <span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <a href="http://www.php.net/date"><span class="kw3">date</span></a><span class="br0">&#40;</span><span class="re0">$strFormat</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>Never echo out within a function. It is better to return a value.<br />
This way you can choose what to do with returned value.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$objSome</span> = <span class="kw2">new</span> someClass<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$strReturn</span> = <span class="st0">'Date: &lt;b&gt;'</span> . <span class="re0">$objSome</span>-&gt;<span class="me1">getDate</span><span class="br0">&#40;</span><span class="br0">&#41;</span> . <span class="st0">'&lt;/b&gt;&lt;br/&gt;'</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$strReturn</span> .= <span class="st0">'Week: &lt;b&gt;'</span> . <span class="re0">$objSome</span>-&gt;<span class="me1">getDate</span><span class="br0">&#40;</span><span class="st0">'W'</span><span class="br0">&#41;</span> . <span class="st0">'&lt;/b&gt;'</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="re0">$strReturn</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> someClass<span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp;<span class="kw2">public</span> <span class="kw2">function</span> <a href="http://www.php.net/getdate"><span class="kw3">getDate</span></a><span class="br0">&#40;</span><span class="re0">$strFormat</span> = <span class="st0">'Y-m-d'</span> <span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <a href="http://www.php.net/date"><span class="kw3">date</span></a><span class="br0">&#40;</span><span class="re0">$strFormat</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2010/03/my-php-code-standards-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My PHP Code-Standards Part 1</title>
		<link>http://www.swape.net/w/2009/11/my-php-code-standards-part-1/</link>
		<comments>http://www.swape.net/w/2009/11/my-php-code-standards-part-1/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 20:35:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Standard]]></category>

		<guid isPermaLink="false">http://www.swape.net/w/?p=5</guid>
		<description><![CDATA[Here is a tutorial on how to write a nice and clean PHP code. Let us start with variables. I use prefix for variables with camel notation. This makes it easy to see and check the right variable for its type. $strName = 'ali' ; $intCounter = 1; $arrData = array&#40;'a'=&#62;'ali' , 'i'=&#62;'is' , 'p'=&#62;'perfect'&#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a tutorial on how to write a nice and clean PHP code.</p>
<p>Let us start with variables.</p>
<p>I use prefix for variables with camel notation. This makes it easy to see and check the right variable for its type.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$strName</span> = <span class="st0">'ali'</span> ;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$intCounter</span> = <span class="nu0">1</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$arrData</span> = <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">'a'</span>=&gt;<span class="st0">'ali'</span> , <span class="st0">'i'</span>=&gt;<span class="st0">'is'</span> , <span class="st0">'p'</span>=&gt;<span class="st0">'perfect'</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$blnTrigger</span> = <span class="kw2">true</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$objMailSender</span> = <span class="kw2">new</span> mailSenderClass<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>I use single quote for my data.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$strMyNameIs</span> = <span class="st0">'Alireza'</span>;</div>
</li>
</ol>
</div>
<p>And I use double quotes for SQL or strings that I need to have a single quote inside.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$strSQL</span> = <span class="st0">&quot;SELECT * FROM person WHERE name LIKE 'ali' &quot;</span>;</div>
</li>
</ol>
</div>
<p>I never use variable inside a double quote string. I break up the quote.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$strCode</span> = <span class="st0">&quot;some $bad code &quot;</span>;<span class="co1">// WRONG AND UGLY</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$strNiceCode</span> = <span class="st0">'Very '</span> . <span class="re0">$strData</span> . <span class="st0">' is pasted here'</span> ;<span class="co1">// NICE CODE</span></div>
</li>
</ol>
</div>
<p>Never ever use short variables like $a or $temp or other lazy short names.<br />
Use variable names that are understandable and describe what it contains.<br />
And using a camelNotation makes it easy to read.<br />
Never start with underscore or other kind of separator for names.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$strReturn</span> = <span class="st0">'Nice code'</span>;</div>
</li>
</ol>
</div>
<p>Only use underscore for constants where you can not use tha camel notation.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">'FOO_BAR'</span>,<span class="st0">'It works!'</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>And do not start with underscore. There are some other system variables and functions that starts with underscore like <em>_get()</em> or <em>$_SESSION</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2009/11/my-php-code-standards-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Swape Gallery Light</title>
		<link>http://www.swape.net/w/2009/08/swape-gallery-light/</link>
		<comments>http://www.swape.net/w/2009/08/swape-gallery-light/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 19:40:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[SGL is a php5 script to list pictures. This script finds all the pictures in a directory under ./test_pic/ and makes menus based on directories. All you have to do is putt your pictures in ./test_pic/ directory. Or edit $strPathToFiles = './test_pic'; in sgl4.class.php file. You can organize your pictures by category, by putting it [...]]]></description>
			<content:encoded><![CDATA[<p>SGL is a php5 script to list pictures.<br />
This script finds all the pictures in a directory under <strong>./test_pic/</strong> and makes menus based on directories.</p>
<p>All you have to do is putt your pictures in <strong>./test_pic/</strong><strong></strong> directory. Or edit <strong>$strPathToFiles = './test_pic';</strong> in <strong>sgl4.class.php</strong> file.</p>
<p>You can organize your pictures by category, by putting it under sub-directories.</p>
<p>The thumbs/ directory must be writable (CHMOD 755) to generate thumbnails automatically first time you visit the site. It will help loading your images faster.</p>
<p><strong>HOW TO INSTALL</strong></p>
<p>All you have to do is unzip the file.<br />
Unpack the <strong>sgl4.php</strong> and configure the paths.</p>
<p>Putt your pictures under <strong>./</strong><strong>test_pic</strong><strong>/</strong> directory.<br />
And don't forget to <em>chmod 755</em> thumbs directory.</p>
<p><strong>SYSTEM REQUIRED.</strong></p>
<p>Server with PHP5.</p>
<p>Download: <a href="http://www.swape.net/w/wp-content/uploads/2009/08/sgl4.zip">sgl4</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2009/08/swape-gallery-light/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>swape09 theme</title>
		<link>http://www.swape.net/w/2009/04/swape09-theme/</link>
		<comments>http://www.swape.net/w/2009/04/swape09-theme/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 18:36:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[themes]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://swape.net/w/?p=33</guid>
		<description><![CDATA[Here is my "swape09" wordpress theme. Free to download. 850px width and centered. jQuery Ready, simple and easy. Right side menu.]]></description>
			<content:encoded><![CDATA[<p><img class="size-thumbnail wp-image-34 " title="screenshot" src="http://swape.net/w/wp-content/uploads/2009/04/screenshot-150x150.jpg" alt="screenshot" width="150" height="150" align="right" /></p>
<p>Here is my "swape09" wordpress theme.</p>
<p>Free to <a href="http://swape.net/w/wp-content/uploads/2009/04/swape09.zip">download</a>.</p>
<p>850px width and centered. jQuery Ready, simple and easy. Right side menu.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2009/04/swape09-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rsync</title>
		<link>http://www.swape.net/w/2009/03/rsync/</link>
		<comments>http://www.swape.net/w/2009/03/rsync/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 21:09:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://swape.net/w/?p=27</guid>
		<description><![CDATA[I sync my picture folders and my music and documents to my backup server via rsync. I use ssh on my server. Rsync is fast way of syncing my files. Here is the commend line rsync -vrutzp --exclude=.DS_Store -e &#34;ssh -p 22&#34; /Users/swape/Sites me@myserver.com:/home/mysite I use: (--exclude=.DS_Store) to exclude the mac files (-e "ssh -p [...]]]></description>
			<content:encoded><![CDATA[<p>I sync my picture folders and my music and documents to my backup server via rsync.<br />
I use ssh on my server. Rsync is fast way of syncing my files.</p>
<p>Here is the commend line</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> rsync -vrutzp --<span class="re2">exclude=</span>.DS_Store -e <span class="st0">&quot;ssh -p 22&quot;</span> /Users/swape/Sites me@myserver.com:/home/mysite</div>
</li>
</ol>
</div>
<p>I use:</p>
<ul>
<li><strong>(--exclude=.DS_Store)</strong> to exclude the mac files</li>
<li><strong>(-e "ssh -p 22") </strong>to use SSH port 22</li>
<li><strong>(/Users/swape/Sites)</strong> my local directory</li>
<li><strong>(me@myserver.com:/home/mysite)</strong> my server</li>
<li><strong>(-v)</strong> verbose mode to see the output</li>
<li><strong>(-r)</strong> recursive into directories</li>
<li><strong>(-u)</strong> using update mode</li>
<li><strong>(-t) </strong>preserve modification times</li>
<li><strong>(-z) </strong>compress file data during the transfer</li>
<li><strong>(-p)</strong> preserve permissions</li>
</ul>
<p>After writing this to my console I enter the password for my server and its done!</p>
<p>This is the fastest way of updating my site from my local disk.<br />
The good thing about this that I use <strong>-u</strong> so it does not upload the files that have not been changed on my local disk. You can also drop the <strong>-v</strong> and make an Automator app but then you have to make the public key for your ssh connection so you don't have to enter the password each time you running the app.</p>
<p>Here is a link to manual on how to make public key <a href="http://sial.org/howto/openssh/publickey-auth/" target="_blank">http://sial.org/howto/openssh/publickey-auth/</a></p>
<p>And this is the rsync manual <a href="http://samba.anu.edu.au/ftp/rsync/rsync.html" target="_blank">http://samba.anu.edu.au/ftp/rsync/rsync.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2009/03/rsync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Horizontal menu</title>
		<link>http://www.swape.net/w/2008/05/horizontal-menu/</link>
		<comments>http://www.swape.net/w/2008/05/horizontal-menu/#comments</comments>
		<pubDate>Mon, 12 May 2008 20:04:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://swape.net/w/?p=24</guid>
		<description><![CDATA[Here is an old trick to make horizontal menu with CSS. First you have to make a list with UL and LI tags. &#160; &#60;ul class=&#34;menu&#34;&#62; &#160; &#160; &#60;li&#62;&#60;a href=&#34;http://swape.net&#34;&#62;My homepage&#60;/a&#62;&#60;/li&#62; &#160; &#160; &#60;li&#62;&#60;a href=&#34;http://linux.org&#34;&#62;Linux.org&#60;/a&#62;&#60;/li&#62; &#160; &#160; &#60;li&#62;&#60;a href=&#34;http://google.com&#34;&#62;Link to google&#60;/a&#62;&#60;/li&#62; &#60;/ul&#62; &#160; My homepage Linux.org Link to google Ok here is a list. Now we [...]]]></description>
			<content:encoded><![CDATA[<p>Here is an old trick to make horizontal menu with CSS.</p>
<p>First you have to make a list with <strong>UL</strong> and <strong>LI</strong> tags.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><a href="http://december.com/html/4/element/ul.html"><span class="kw2">&lt;ul</span></a> <span class="kw3">class</span>=<span class="st0">&quot;menu&quot;</span><span class="kw2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/li.html"><span class="kw2">&lt;li&gt;</span></a></span><span class="sc2"><a href="http://december.com/html/4/element/a.html"><span class="kw2">&lt;a</span></a> <span class="kw3">href</span>=<span class="st0">&quot;http://swape.net&quot;</span><span class="kw2">&gt;</span></span>My homepage<span class="sc2"><span class="kw2">&lt;/a&gt;</span></span><span class="sc2"><span class="kw2">&lt;/li&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/li.html"><span class="kw2">&lt;li&gt;</span></a></span><span class="sc2"><a href="http://december.com/html/4/element/a.html"><span class="kw2">&lt;a</span></a> <span class="kw3">href</span>=<span class="st0">&quot;http://linux.org&quot;</span><span class="kw2">&gt;</span></span>Linux.org<span class="sc2"><span class="kw2">&lt;/a&gt;</span></span><span class="sc2"><span class="kw2">&lt;/li&gt;</span></span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/li.html"><span class="kw2">&lt;li&gt;</span></a></span><span class="sc2"><a href="http://december.com/html/4/element/a.html"><span class="kw2">&lt;a</span></a> <span class="kw3">href</span>=<span class="st0">&quot;http://google.com&quot;</span><span class="kw2">&gt;</span></span>Link to google<span class="sc2"><span class="kw2">&lt;/a&gt;</span></span><span class="sc2"><span class="kw2">&lt;/li&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><span class="kw2">&lt;/ul&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<ul>
<li><a href="http://swape.net">My homepage</a></li>
<li><a href="http://linux.org">Linux.org</a></li>
<li><a href="http://google.com">Link to google</a></li>
</ul>
<p>Ok here is a list. Now we must make the list items to be horizontal and not vertical. So we must use CSS to set the<strong> float</strong> to be <strong>left</strong> and make the<strong> list-style: none;</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re1">.menu</span> li<span class="br0">&#123;</span> <span class="kw1">float</span>: <span class="kw1">left</span>; <span class="kw1">list-style</span>: <span class="kw2">none</span>; <span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Then we must make them look like a buttons. So we add some borders and padding and margins. Then the whole CSS code look like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re1">.menu</span> li<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">float</span>: <span class="kw1">left</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">list-style</span>: <span class="kw2">none</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">font</span>: <span class="re3">10px</span> Verdana, Arial, Helvetica, <span class="kw2">sans-serif</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">.menu</span> li a <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">display<span class="re2">:block</span>;</div>
</li>
<li class="li1">
<div class="de1">padding<span class="re2">:<span class="re3">3px</span></span>;</div>
</li>
<li class="li1">
<div class="de1">margin<span class="re2">:<span class="re3">1px</span></span>;</div>
</li>
<li class="li2">
<div class="de2">border<span class="re2">:<span class="re3">1px</span></span> <span class="kw2">solid</span> <span class="re0">#ccc</span>;</div>
</li>
<li class="li1">
<div class="de1">text-decoration<span class="re2">:none</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">color</span>:<span class="re0">#<span class="nu0">332</span></span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-color</span>: <span class="re0">#EEE</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="re1">.menu</span> li a<span class="re2">:hover</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">color</span>:<span class="re0">#EEE</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-color</span>: <span class="re0">#<span class="nu0">331</span></span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>You can download the example file here: <a href="http://swape.net/w/wp-content/uploads/2008/05/test.zip">Horizontal CSS menu</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2008/05/horizontal-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VolumeSize</title>
		<link>http://www.swape.net/w/2008/04/volumesize/</link>
		<comments>http://www.swape.net/w/2008/04/volumesize/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 08:51:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://swape.net/w/?p=22</guid>
		<description><![CDATA[VolumeSize is a free small mac app that shows size of all your disks that are attached to your mac. (including the internal hard drives) Works on PPCs and Intel Macs. Download: VolumeSize-app]]></description>
			<content:encoded><![CDATA[<p><img class="alignright alignnone size-medium wp-image-23" style="float: right;" title="VolumeSize" src="http://swape.net/w/wp-content/uploads/2008/04/picture-1-300x245.png" alt="" width="300" height="245" /><br />
VolumeSize is a free small mac app that shows size of all your disks that are attached to your mac. (including the internal hard drives)</p>
<p>Works on PPCs and Intel Macs.</p>
<p>Download: <a href="http://www.swape.net/w/wp-content/uploads/2008/04/VolumeSize-app.zip">VolumeSize-app</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2008/04/volumesize/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SwapeStarter</title>
		<link>http://www.swape.net/w/2008/04/swapestarter/</link>
		<comments>http://www.swape.net/w/2008/04/swapestarter/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 08:49:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://swape.net/w/?p=20</guid>
		<description><![CDATA[This free windows program is very useful to make a startup menu from an autorun CD/DVD under windows env. Or just a menu to run a command or program. You can list 6 different programs to start from. All the text, heading image and titles are configurable from an ini file. Download: my_starter]]></description>
			<content:encoded><![CDATA[<p><img class="alignright alignnone size-full wp-image-21" style="float: right;" title="sstarter" src="http://swape.net/w/wp-content/uploads/2008/04/sstarter.png" alt="" width="306" height="268" /></p>
<p>This free windows program is very useful to make a startup menu from an autorun CD/DVD under windows env. Or just a menu to run a command or program.</p>
<p>You can list 6 different programs to start from.</p>
<p>All the text, heading image and titles are configurable from an ini file.</p>
<p>Download: <a href='http://www.swape.net/w/wp-content/uploads/2008/04/my_starter.zip'>my_starter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2008/04/swapestarter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PassKeeper</title>
		<link>http://www.swape.net/w/2008/04/passkeeper/</link>
		<comments>http://www.swape.net/w/2008/04/passkeeper/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 08:47:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://swape.net/w/?p=18</guid>
		<description><![CDATA[Sometimes it is hard to remember many passwords. PassKeeper is password manager program to stores all your password. You can export passwords to xml file. PassKeeper dose also generate random passwords so you can have a strong and random made passwords that is hard to crack. Download: passKeeper]]></description>
			<content:encoded><![CDATA[<p>Sometimes it is hard to remember many passwords.</p>
<p>PassKeeper is password manager program to stores all your password.</p>
<p>You can export passwords to xml file.</p>
<p>PassKeeper dose also generate random passwords so you can have a strong and random made passwords that is hard to crack.</p>
<p>Download: <a href="http://www.swape.net/w/wp-content/uploads/2008/04/passKeeper.zip">passKeeper</a></p>
<p><img class="alignnone size-full wp-image-19" title="passkeeper" src="http://swape.net/w/wp-content/uploads/2008/04/passkeeper.png" alt="" width="461" height="365" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2008/04/passkeeper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Key Code Make</title>
		<link>http://www.swape.net/w/2008/04/key-code-make/</link>
		<comments>http://www.swape.net/w/2008/04/key-code-make/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 08:44:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://swape.net/w/?p=16</guid>
		<description><![CDATA[Key Code Maker is free windows program for making lots of 8 digit passwords. Very useful for administrators who makes hundreds of passwords at a time. And you can save the password-list on a file. Download: KCM_10]]></description>
			<content:encoded><![CDATA[<p><img class="alignright alignnone size-medium wp-image-17" style="float: right;" title="kcm" src="http://swape.net/w/wp-content/uploads/2008/04/kcm-177x300.png" alt="" width="177" height="300" /><br />
<em>Key Code Maker</em> is free windows program for making lots of 8 digit passwords.</p>
<p>Very useful for administrators who makes hundreds of passwords at a time.<br />
And you can save the password-list on a file.</p>
<p>Download: <a href="http://www.swape.net/w/wp-content/uploads/2008/04/KCM_10.zip">KCM_10</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2008/04/key-code-make/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FileDate Mover v1.0</title>
		<link>http://www.swape.net/w/2008/04/filedate-mover-v10/</link>
		<comments>http://www.swape.net/w/2008/04/filedate-mover-v10/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 08:41:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://swape.net/w/?p=15</guid>
		<description><![CDATA[FileDate Mover is a program that moves files from one directory to directory tree based on file date. If you have a file that have a date 2006.12.24 then it makes directory called 2006/12/filename.ext. This program runs through a directory and moves all the files to date-based-directory-tree. You can edit the i18n.ini file to change [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright alignnone size-medium wp-image-14" style="float: right;" title="datemove1" src="http://swape.net/w/wp-content/uploads/2008/04/datemove1-300x128.png" alt="" width="300" height="128" /></p>
<p>FileDate Mover is a program that moves files from one directory to directory tree based on file date.<br />
If you have a file that have a date 2006.12.24 then it makes directory called 2006/12/filename.ext.<br />
This program runs through a directory and moves all the files to date-based-directory-tree.<br />
You can edit the i18n.ini file to change the settings.</p>
<p><em>rprog = datemove.exe -d</em></p>
<p>If you remove -d, then it moves the files from this month too. But if you use -d, it will ignore files that where made this month.</p>
<p>In the zip file you find these files:</p>
<ul>
<li> <em>i18n.ini</em> settings file.</li>
<li> <em>datemove.ex</em>e CMD based version of this program. Run datemove in cmd for usage options.</li>
<li> <em>datemoveX.exe</em> Gui-based version of this program.</li>
<li> <em>src\</em> Directory containing the sourcefile in php.</li>
</ul>
<p>Download: <a href="http://www.swape.net/w/wp-content/uploads/2008/04/datemove.zip">datemove</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2008/04/filedate-mover-v10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Directory/File-chooser tool</title>
		<link>http://www.swape.net/w/2008/04/directoryfile-chooser-tool/</link>
		<comments>http://www.swape.net/w/2008/04/directoryfile-chooser-tool/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 08:34:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://swape.net/w/?p=13</guid>
		<description><![CDATA[This is an open and free program. Here is a small GUI for those old DOS command. With this program you can run programs with given file or directory input and output. Here is how the ini file looks like: &#91;gui&#93; lprog=Title of the window goes here lin= INPUT: lout= OUTPUT: lrun= RUN lexit= CLOSE [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-14" title="datemove1" src="http://swape.net/w/wp-content/uploads/2008/04/datemove1.png" alt="" width="315" height="135" /><br />
This is an open and free program.</p>
<p>Here is a small GUI for those old DOS command. With this program you can run programs with given file or directory input and output.</p>
<p>Here is how the ini file looks like:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0"><span class="br0">&#91;</span>gui<span class="br0">&#93;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">lprog</span>=<span class="re2">Title of the window goes here</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">lin</span>=<span class="re2"> INPUT:</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">lout</span>=<span class="re2"> OUTPUT:</span></div>
</li>
<li class="li2">
<div class="de2"><span class="re1">lrun</span>=<span class="re2"> RUN</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">lexit</span>=<span class="re2"> CLOSE</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">lcof</span>=<span class="re2"> Choose a output file / directory</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">lcif</span>=<span class="re2"> Choose a input file / directory</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">lrunbox</span>= <span class="st0">&quot;Done!&quot;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="re1">lfot</span>=<span class="re2"> Out File</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">lfit</span>=<span class="re2"> Inn file</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0"><span class="br0">&#91;</span>run<span class="br0">&#93;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">rprog </span>=<span class="re2"> notepad.exe</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">rodir </span>=<span class="re2"> <span class="nu0">0</span></span></div>
</li>
<li class="li2">
<div class="de2"><span class="re1">ridir </span>=<span class="re2"> <span class="nu0">0</span></span></div>
</li>
</ol>
</div>
<p>rprog ::: you can choose the program to run.<br />
rodir ::: 0=File 1=Directory<br />
ridir ::: 0=File 1=Directory (If given file or directory dose not exist, it will be created.)</p>
<p>So now you can make your own windows based GUI from those good old DOS commands.</p>
<p>Download: <a href="http://www.swape.net/w/wp-content/uploads/2008/04/fdc1.zip">fdc1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2008/04/directoryfile-chooser-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checkbox value</title>
		<link>http://www.swape.net/w/2008/04/checkbox-value/</link>
		<comments>http://www.swape.net/w/2008/04/checkbox-value/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 12:06:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[When you post a form with checkbox it dose not return any value when the checkbox is not ticked. This is something that should have been fixed a long time ago. But for now here is the solution: &#60;form action=&#34;?&#34; method=&#34;post&#34;&#62; &#60;input name=&#34;myCheckbox&#34; type=&#34;hidden&#34; value=&#34;0&#34; /&#62; &#60;input name=&#34;myCheckbox&#34; type=&#34;checkbox&#34; /&#62; &#60;/form&#62; You put an hidden [...]]]></description>
			<content:encoded><![CDATA[<p>When you post a form with checkbox it dose not return any value when the checkbox is not ticked.<br />
This is something that should have been fixed a long time ago.<br />
But for now here is the solution:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="sc2"><a href="http://december.com/html/4/element/form.html"><span class="kw2">&lt;form</span></a> <span class="kw3">action</span>=<span class="st0">&quot;?&quot;</span> <span class="kw3">method</span>=<span class="st0">&quot;post&quot;</span><span class="kw2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><a href="http://december.com/html/4/element/input.html"><span class="kw2">&lt;input</span></a> <span class="kw3">name</span>=<span class="st0">&quot;myCheckbox&quot;</span> <span class="kw3">type</span>=<span class="st0">&quot;hidden&quot;</span> <span class="kw3">value</span>=<span class="st0">&quot;0&quot;</span> /<span class="kw2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><a href="http://december.com/html/4/element/input.html"><span class="kw2">&lt;input</span></a> <span class="kw3">name</span>=<span class="st0">&quot;myCheckbox&quot;</span> <span class="kw3">type</span>=<span class="st0">&quot;checkbox&quot;</span> /<span class="kw2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><span class="kw2">&lt;/form&gt;</span></span></div>
</li>
</ol>
</div>
<p>You put an hidden input before checkbox input with the same name.<br />
Since the last checkbox overwrite the value when it is checked, the hidden input do not return "0" but when the checkbox is not checked, the hidden input with the same name returns a "0".</p>
<p>So when the checkbox is checked it returns "on" and when it is not checked it returns "0"</p>
<p>And to make it easier to click on the ckeckbox use "label" tag around the name.</p>
<p>Before:</p>
<div>
<input name="myCheckbox" type="checkbox" /> My Checkbox</div>
<p>After:</p>
<div><label><br />
<input name="myCheckbox" type="checkbox" />My Checkbox</label></div>
<p>This way you can click on the checkbox label and make it checked.<br />
The correct way to write an checkbox checked from the start is like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="sc2"><a href="http://december.com/html/4/element/label.html"><span class="kw2">&lt;label&gt;</span></a></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><a href="http://december.com/html/4/element/input.html"><span class="kw2">&lt;input</span></a> <span class="kw3">checked</span>=<span class="st0">&quot;checked&quot;</span> <span class="kw3">name</span>=<span class="st0">&quot;myCheckbox&quot;</span> <span class="kw3">type</span>=<span class="st0">&quot;checkbox&quot;</span> /<span class="kw2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">My Checkbox</div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><span class="kw2">&lt;/label&gt;</span></span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2008/04/checkbox-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>favicon2png</title>
		<link>http://www.swape.net/w/2008/02/favicon2png/</link>
		<comments>http://www.swape.net/w/2008/02/favicon2png/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 20:22:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[png]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Here is a script to download the favicon.ico files from a website and save it as a png file. You must have imagemagick installed on your server to convert the ico file to png. &#160; &#60;!--- html code ----&#62; &#60;form action=&#34;?&#34; method=&#34;post&#34;&#62; &#160; &#60;input id=&#34;site&#34; name=&#34;site&#34; type=&#34;text&#34; value=&#34;&#60;?php echo $_POST['site']; ?/&#62;&#34; /&#62; &#160; &#60;input type=&#34;submit&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a script to download the favicon.ico files from a website and save it as a png file.</p>
<p>You must have imagemagick installed on your server to convert the ico file to png.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&lt;!--- html code ----&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;form action=<span class="st0">&quot;?&quot;</span> method=<span class="st0">&quot;post&quot;</span>&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &lt;input id=<span class="st0">&quot;site&quot;</span> name=<span class="st0">&quot;site&quot;</span> type=<span class="st0">&quot;text&quot;</span></div>
</li>
<li class="li2">
<div class="de2">value=<span class="st0">&quot;&lt;?php echo $_POST['site']; ?/&gt;&quot;</span> /&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &lt;input type=<span class="st0">&quot;submit&quot;</span> /&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;/form&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&lt; ?php</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">//--- favicon2png by Alireza Balouch @ swape.net 2008</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">'site'</span><span class="br0">&#93;</span> != <span class="st0">''</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//finding the hostname</span></div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$host</span> = <a href="http://www.php.net/parse_url"><span class="kw3">parse_url</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">'site'</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$host</span> = <span class="re0">$host</span><span class="br0">&#91;</span><span class="st0">'host'</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$host</span> = <a href="http://www.php.net/explode"><span class="kw3">explode</span></a><span class="br0">&#40;</span><span class="st0">'.'</span> , <span class="re0">$host</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$host</span> = <span class="re0">$host</span><span class="br0">&#91;</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">&#40;</span><span class="re0">$host</span><span class="br0">&#41;</span> <span class="nu0">-2</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$filename</span> = <span class="st0">'img/'</span> . <span class="re0">$host</span> . <span class="st0">'.png'</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>!<a href="http://www.php.net/is_file"><span class="kw3">is_file</span></a><span class="br0">&#40;</span><span class="re0">$filename</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// getting the favicon</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$handle</span> = <a href="http://www.php.net/fopen"><span class="kw3">fopen</span></a><span class="br0">&#40;</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">'site'</span><span class="br0">&#93;</span> . <span class="st0">'/favicon.ico'</span>, <span class="st0">&quot;rb&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$contents</span> = stream_get_contents<span class="br0">&#40;</span><span class="re0">$handle</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><a href="http://www.php.net/fclose"><span class="kw3">fclose</span></a><span class="br0">&#40;</span><span class="re0">$handle</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">file_put_contents<span class="br0">&#40;</span><span class="st0">'fav.ico'</span> , <span class="re0">$contents</span> <span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// converting to png</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$StrExec</span> = <span class="st0">'/usr/local/bin/convert fav.ico -resize 24x24<span class="es0">\></span> '</span> . <span class="re0">$filename</span> ;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$ret</span> = <a href="http://www.php.net/exec"><span class="kw3">exec</span></a><span class="br0">&#40;</span><span class="re0">$StrExec</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">'&lt;img src=&quot;'</span> . <span class="re0">$filename</span> . <span class="st0">'&quot; /&gt;'</span> . <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">'site'</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">?&gt;</span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2008/02/favicon2png/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Semi-transparent png fix in IE6 with CSS</title>
		<link>http://www.swape.net/w/2007/02/semi-transparent-png-fix-in-ie-with-css/</link>
		<comments>http://www.swape.net/w/2007/02/semi-transparent-png-fix-in-ie-with-css/#comments</comments>
		<pubDate>Tue, 06 Feb 2007 20:30:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[png]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This example shows how you can show semi-transparent png images in IE and don't mess up the code in other browsers. It uses only CSS and no JavaScript.I use the attribute style to make a style for other browsers then IE. And I'm using the filter style that works only for IE in the normal [...]]]></description>
			<content:encoded><![CDATA[<p>This example shows how you can show semi-transparent png images in IE and don't mess up the code in other browsers. It uses only CSS and no JavaScript.I use the attribute style to make a style for other browsers then IE. And I'm using the <strong>filter</strong> style that works only for IE in the normal section.But first you have to make a semi transparent png image.<br />
Then make an div layer and set a class name "mydiv"</p>
<p>And here is the CSS code:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re1">.mydiv</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-repeat</span>: <span class="kw2">repeat</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">position</span>: <span class="kw2">relative</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">display</span>: <span class="kw2">block</span>;</div>
</li>
<li class="li2">
<div class="de2">width<span class="re2">:<span class="re3">250px</span></span>;</div>
</li>
<li class="li1">
<div class="de1">height<span class="re2">:<span class="re3">200px</span></span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">text-align</span>: <span class="kw2">center</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/* Mozilla Firefox and other non IE based browsers ignores the filter style*/</span></div>
</li>
<li class="li1">
<div class="de1">filter<span class="re2">:progid</span><span class="re2">:DXImageTransform</span><span class="re1">.Microsoft</span><span class="re1">.AlphaImageLoader</span><span class="br0">&#40;</span> enabled=true, sizingMethod=scale src=<span class="st0">&quot;back_g.png&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span>   </div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/* IE ignores this part IE can not read styles with [attribute]*/</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">.mydiv</span><span class="br0">&#91;</span>class<span class="br0">&#93;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-image</span>: <span class="kw2">url</span><span class="br0">&#40;</span><span class="re4">back_g<span class="re1">.png</span></span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">body<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-image</span>: <span class="kw2">url</span><span class="br0">&#40;</span><span class="re4">BG<span class="re1">.png</span></span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-repeat</span>: <span class="kw2">repeat</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Since IE can not show semi-transparent png images, we have to use the filter style that only works in ie. But if we use this code we have to make sure that other browsers can show the png file as well. So we use the styles with attributes. And since IE can not read this part, we can put everything that IE dose not need to read there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2007/02/semi-transparent-png-fix-in-ie-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
