<?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>Sava&#039;s Place &#187; Tutorials</title>
	<atom:link href="http://savasplace.com/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://savasplace.com</link>
	<description>Free PHP scripts, CSS templates, Making Money Online and Miscellaneous Ramblings</description>
	<lastBuildDate>Tue, 16 Apr 2013 09:04:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Schedule System Shutdown In Ubuntu With GShutdown</title>
		<link>http://savasplace.com/2009/12/schedule-system-shutdown-in-ubuntu-with-gshutdown/</link>
		<comments>http://savasplace.com/2009/12/schedule-system-shutdown-in-ubuntu-with-gshutdown/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 07:04:33 +0000</pubDate>
		<dc:creator>Sava</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[GShutdown]]></category>
		<category><![CDATA[schedule shutdown]]></category>
		<category><![CDATA[shutdown]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[ubuntu scheduled shutdown]]></category>

		<guid isPermaLink="false">http://savasplace.com/?p=5219</guid>
		<description><![CDATA[GShutdown is a tool for Ubuntu which performs and schedules system shutdown, logout and restart. To install it open up a terminal and run the following command: sudo apt-get install gshutdown After installation you can find GShutdown under Applications -> Accessories. And here it is: As you can see it&#8217;s really simple to use. Just [...]]]></description>
				<content:encoded><![CDATA[<p>GShutdown is a tool for Ubuntu which performs and schedules system shutdown, logout and restart. To install it open up a terminal and run the following command:</p>
<p><code>sudo apt-get install gshutdown</code></p>
<p>After installation you can find <strong>GShutdown</strong> under <em>Applications -> Accessories</em>.</p>
<p>And here it is: </p>
<p><img src="http://savasplace.com/wp-content/uploads/2009/12/GShutdown.png" alt="GShutdown" title="GShutdown" width="278" height="462" class="alignnone size-full wp-image-5220" /></p>
<p>As you can see it&#8217;s really simple to use. Just enter the time you want and choose <strong>Shutdown</strong>, <strong>Reboot</strong> or <strong>End current session</strong>.</p>
<p>The application is really great if you&#8217;re that kind of person that likes watching a movie or listening to music before they go to sleep. And just in case you&#8217;re not asleep GShutdown can also notify you before it takes action and shutdowns your computer.</p>
<p><img src="http://savasplace.com/wp-content/uploads/2009/12/GShutdown-Preferences.png" alt="GShutdown Preferences" title="GShutdown Preferences" width="365" height="440" class="alignnone size-full wp-image-5221" /></p>
<p>I guess it&#8217;s a really useful application. Have you tried it yet ? Are you going to try it ? </p>
]]></content:encoded>
			<wfw:commentRss>http://savasplace.com/2009/12/schedule-system-shutdown-in-ubuntu-with-gshutdown/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Download Youtube Videos From Terminal On Ubuntu</title>
		<link>http://savasplace.com/2009/12/how-to-download-youtube-videos-from-terminal-on-ubuntu/</link>
		<comments>http://savasplace.com/2009/12/how-to-download-youtube-videos-from-terminal-on-ubuntu/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 09:41:41 +0000</pubDate>
		<dc:creator>Sava</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[download youtube videos]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[youtube]]></category>
		<category><![CDATA[youtube-dl]]></category>

		<guid isPermaLink="false">http://savasplace.com/?p=5076</guid>
		<description><![CDATA[This is the easiest way to download youtube videos to your personal computer if you&#8217;re using Ubuntu. All you have to do is to install YouTube-Dl. It downloads YouTube videos from the command line and works on Linux, and Mac OS. To install YouTube-Dl open a terminal and run the following command: sudo apt-get install [...]]]></description>
				<content:encoded><![CDATA[<p>This is the easiest way to download youtube videos to your personal computer if you&#8217;re using <a href="http://www.ubuntu.com" target="_blank">Ubuntu</a>. All you have to do is to install YouTube-Dl. It downloads <a href="http://www.youtube.com" target="_blank">YouTube</a> videos from the command line and works on Linux, and Mac OS.</p>
<p>To install YouTube-Dl open a terminal and run the following command:</p>
<p><code>sudo apt-get install youtube-dl</code></p>
<p>To download a video:</p>
<p><code>youtube-dl -o filename.flv http://www.youtube.com/watch?v=NiGDZ52BZ5c</code></p>
<p><img src="http://savasplace.com/wp-content/uploads/2009/12/youtube-dl.png" alt="youtube-dl" title="youtube-dl" width="553" height="429" class="alignnone size-full wp-image-5077" /></p>
<p>Do you know an easier way ?</p>
]]></content:encoded>
			<wfw:commentRss>http://savasplace.com/2009/12/how-to-download-youtube-videos-from-terminal-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Batch Image Manipulation For Your Blog</title>
		<link>http://savasplace.com/2009/10/ubuntu-batch-image-manipulation-for-your-blog/</link>
		<comments>http://savasplace.com/2009/10/ubuntu-batch-image-manipulation-for-your-blog/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 06:55:41 +0000</pubDate>
		<dc:creator>Sava</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[gprename]]></category>
		<category><![CDATA[nautilus-image-converter]]></category>

		<guid isPermaLink="false">http://savasplace.com/?p=4366</guid>
		<description><![CDATA[If you&#8217;re an Ubuntu user and you have your own blog then you might find this really interesting and useful. Everybody likes posting images to their blog, right ? But what if you have a bunch of photos and you need to rename (for search engines) and resize (to fit your blog layout) them ? [...]]]></description>
				<content:encoded><![CDATA[<p><img src="http://savasplace.com/wp-content/uploads/2009/10/ubuntu-logo.png" alt="Ubuntu Logo" title="Ubuntu Logo" class="alignleft" /> If you&#8217;re an Ubuntu user and you have your own blog then you might find this really interesting and useful. Everybody likes posting images to their blog, right ? But what if you have a bunch of photos and you need to rename (for search engines) and resize (to fit your blog layout) them ? Sure you can rename the photos one by one and open each of them with gIMP to resize.</p>
<p>How about doing this for 50 photos ? It would surely take you more than 10 minutes.</p>
<p>Here&#8217;s the easy and fast way to do it. To rename multiple photos/files at once you can use GPRename. You can easily install it from the terminal with the following command:</p>
<p><code>sudo apt-get install gprename</code></p>
<p>GPRename is really easy to use so I will get on to the batch image resize. This can be done really easy with <strong>nautilus-image-converter</strong>. To install it open up a terminal and run this command:</p>
<p><code>sudo apt-get install nautilus-image-converter</code></p>
<p>Note: for changes to take effect in your Nautilus menu you have to logoff or reboot. After that just select multiple photos and right click. You&#8217;ll get this:</p>
<p><img src="http://savasplace.com/wp-content/uploads/2009/10/nautilus-image-converter.png" alt="Nautilus Image Converter" title="Nautilus Image Converter" /></p>
<p>If you want to keep the image scale then you have to resize by using the <strong>Scale</strong> option:</p>
<p><img src="http://savasplace.com/wp-content/uploads/2009/10/nautilus-image-converter-options.png" alt="Nautilus Image Converter Options" title="Nautilus Image Converter Options" /></p>
<p>And that&#8217;s it. Now you can easily handle a bunch of photos in minimum time on Ubuntu. All you have to do after is to upload them and write a new post.</p>
]]></content:encoded>
			<wfw:commentRss>http://savasplace.com/2009/10/ubuntu-batch-image-manipulation-for-your-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chromium on Ubuntu</title>
		<link>http://savasplace.com/2009/08/chromium-on-ubuntu/</link>
		<comments>http://savasplace.com/2009/08/chromium-on-ubuntu/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 20:15:05 +0000</pubDate>
		<dc:creator>Sava</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[chromium]]></category>

		<guid isPermaLink="false">http://savasplace.com/?p=3933</guid>
		<description><![CDATA[Everybody likes Google Chrome, right ? Well, now you can have Chromium on Ubuntu as well. But first, let&#8217;s clarify something: Chromium is an open source browser project. Google Chrome is a browser from Google, based on the Chromium project. Right now Google&#8217;s browser is only available on Windows. I know I installed Windows on [...]]]></description>
				<content:encoded><![CDATA[<p><img src="http://savasplace.com/wp-content/uploads/2009/08/chromium-browser.png" alt="Chromium Browser" title="Chromium Browser" class="alignleft " /> Everybody likes Google Chrome, right ? Well, now you can have Chromium on Ubuntu as well.</p>
<p>But first, let&#8217;s clarify something: <a href="http://code.google.com/chromium/">Chromium</a> is an open source browser project. <a href="http://www.google.com/chrome">Google Chrome</a> is a browser from <a href="http://www.google.com">Google</a>, based on the Chromium project. Right now Google&#8217;s browser is only available on Windows.</p>
<p>I know I installed Windows on my home PC just to try out Google Chrome and I loved it. It&#8217;s speed is amazing (in my opinion it&#8217;s faster than Firefox and Opera). Now we can use Chromium on Ubuntu as well.<br />
Enough with the chit-chat. Time for some installing.</p>
<p>First you need to add the repositories. Open a terminal and copy paste the commands below:</p>
<p>Open <strong>/etc/apt/sources.list</strong> for editing<br />
<code><br />
sudo gedit /etc/apt/sources.list<br />
</code></p>
<p>and add these 2 lines at the bottom of it:</p>
<p><code><br />
deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu intrepid main<br />
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu intrepid main<br />
</code></p>
<p>Save the file and close it. Now open a terminal again and add the repository key to your apt keyring:</p>
<p><code><br />
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4E5E17B5<br />
</code></p>
<p>Now you&#8217;re ready to install Chromium. Just 2 more commands:</p>
<p><code><br />
sudo apt-get update<br />
sudo apt-get install chromium-browser<br />
</code></p>
<p>After everything is complete just go ahead and open <strong>Applications -> Internet -> Chromium Browser</strong>. If you see something like this:</p>
<p><img src="http://savasplace.com/wp-content/uploads/2009/08/chromium-about.png" alt="About Chromium" title="About Chromium" /></p>
<p>you did everything correctly and you&#8217;re ready to enjoy Chromium&#8217;s speed.</p>
<p>Here&#8217;s Sava&#8217;s Place loaded rapidly on Chromium:</p>
<p><a href="http://savasplace.com/wp-content/uploads/2009/08/savasplacecom-on-chromium.png" title="Savasplace on Chromium" target="_blank"><img src="http://savasplace.com/wp-content/uploads/2009/08/savasplacecom-on-chromium-550x324.png" alt="Savasplace on Chromium" title="Savasplace on Chromium" /></a></p>
<p>I&#8217;m not sure but I think that it&#8217;s the best browser even if it&#8217;s still in development.</p>
<p><strong>Note:</strong> if you want to enable plugins ( flash player etc. ) use<br />
<code><br />
chromium-browser --enable-plugins<br />
</code><br />
in a terminal.</p>
]]></content:encoded>
			<wfw:commentRss>http://savasplace.com/2009/08/chromium-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple CSS Style Session Flash&#8217;es in CakePHP</title>
		<link>http://savasplace.com/2009/08/multiple-css-style-session-flashes-in-cakephp/</link>
		<comments>http://savasplace.com/2009/08/multiple-css-style-session-flashes-in-cakephp/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 08:34:08 +0000</pubDate>
		<dc:creator>Sava</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[session]]></category>
		<category><![CDATA[session flash]]></category>

		<guid isPermaLink="false">http://savasplace.com/?p=3904</guid>
		<description><![CDATA[We all know that CakePHP has the Session component that allows us to login and logout users and to show them messages that appear only once: &#60;?php $this->Session->setFlash('Random message that appears only once'); ?&#62; We can style this message the way we want but what about having these kind of messages that are style differently [...]]]></description>
				<content:encoded><![CDATA[<p><img src="http://savasplace.com/wp-content/uploads/2009/05/cakephp-150x150.png" alt="CakePHP" title="CakePHP" class="alignleft" />We all know that CakePHP has the Session component that allows us to login and logout users and to show them messages that appear only once:</p>
<p><code>&lt;?php $this->Session->setFlash('Random message that appears only once'); ?&gt;</code></p>
<p>We can style this message the way we want but what about having these kind of messages that are style differently depending on what kind of messages we show (error, success, warning or general messages ).</p>
<p>The easy way to do it is to create our own helper.  So let&#8217;s go to <strong>app/views/helpers</strong> folder and create the helper.  Create a new file and rename it to <strong>flash.php</strong> and put the following code in it:</p>
<p><code><br />
&lt;?php<br />
class FlashHelper extends Helper {</p>
<p>	var $helpers = array('Session');</p>
<p>	function show() {<br />
		$messages = $this-&gt;Session-&gt;read('messages');<br />
		$html = '&lt;ul class="system_messages"&gt;';<br />
		if($messages) {<br />
		foreach ($messages as $type =&gt; $msgs) {<br />
			foreach ($msgs as $msg) {<br />
				if (!empty($msg)) {<br />
					$html .= "&lt;li class='$type'&gt;&lt;span class='ico'&gt;&lt;/span&gt;&lt;strong class='system_title'&gt;$msg&lt;/strong&gt;&lt;/li&gt;";<br />
				}<br />
			}<br />
		}<br />
		$html .= "&lt;/ul&gt;";<br />
		$this-&gt;Session-&gt;del('messages');<br />
		return $this-&gt;output( $html );<br />
		}<br />
	}<br />
}<br />
?&gt;<br />
</code></p>
<p>As you can see the show() function read the messages stored in the session. Each read message is written back inside a <strong>&lt;li&gt;</strong> tag that has a different class <strong>$type</strong>.</p>
<p>Now go ahead and edit your <strong>app_controller.php</strong> file located in the <strong>app</strong> folder.<br />
If you already have the helpers array written in it then add the <strong>Flash</strong> helper to the array. If not then put this code in the file:</p>
<p><code><br />
var $helpers = array('Flash');<br />
</code></p>
<p>Now add the function below to the <strong>app_controller.php</strong> as well:</p>
<p><code><br />
	function flash( $message, $class = 'status' ) {<br />
		$old = $this->Session->read('messages');<br />
		$old[$class][] = $message;<br />
		$this->Session->write('messages', $old );<br />
	}<br />
</code></p>
<p>Create different css styles for the types of message you want to display (error, success, warning or general messages).</p>
<p>Now to add a flash message you have to use the <strong>flash helper</strong> instead of the session flash component.<br />
So &#8230; instead of:</p>
<p><code><br />
$this->Session->setFlash('A cool message that is a warning!');<br />
</code></p>
<p>you will use :</p>
<p><code><br />
$this->flash('A cool message that is a warning!', 'warning');<br />
</code></p>
<h3>My Example</h3>
<p>I created the following CSS styles: white, red, green, blue, yellow.</p>
<p>Now all I have to do is this:</p>
<p><code><br />
		$this->flash('This is a simple notification message', 'white');<br />
		$this->flash('This is an error message', 'red');<br />
		$this->flash('This is a successful message', 'green');<br />
		$this->flash('This is a blue message <img src='http://savasplace.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ', 'blue');<br />
		$this->flash('This is a warning message', 'yellow');<br />
</code></p>
<p>inside a function and here&#8217;s the result:</p>
<p><img src="http://savasplace.com/wp-content/uploads/2009/08/cakephp-example-of-different-css-styled-session-flash-messages.jpg" alt="CakePHP example of different css styled session flash messages" title="CakePHP example of different css styled session flash messages" width="400" height="280" class="alignnone size-full wp-image-3909" /></p>
<p>Hope you find this useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://savasplace.com/2009/08/multiple-css-style-session-flashes-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Multilingual Website with CakePHP</title>
		<link>http://savasplace.com/2009/08/multilingual-website-with-cakephp/</link>
		<comments>http://savasplace.com/2009/08/multilingual-website-with-cakephp/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 07:53:40 +0000</pubDate>
		<dc:creator>Sava</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[multi language website with cakephp]]></category>
		<category><![CDATA[Multilingual]]></category>

		<guid isPermaLink="false">http://savasplace.com/?p=2606</guid>
		<description><![CDATA[We all know that developing a website in CakePHP is very easy and also fast. Here&#8217;s how to create a multilingual website fast. First open app/config/bootstrap.php and set the languages you want available for your website: Configure::write('Config.languages', array( 'ro' => array( 'language' => 'Romanian', 'locale' => 'rum', 'localeFallback' => 'rum', 'charset' => 'utf-8' ), 'en' [...]]]></description>
				<content:encoded><![CDATA[<p>We all know that developing a website in CakePHP is very easy and also fast. Here&#8217;s how to create a multilingual website fast.</p>
<p>First open <strong>app/config/bootstrap.php</strong> and set the languages you want available for your website:</p>
<p><code><br />
Configure::write('Config.languages', array(<br />
	  	'ro' => array(<br />
		    'language' => 'Romanian',<br />
		    'locale' => 'rum',<br />
		    'localeFallback' => 'rum',<br />
		    'charset' => 'utf-8'<br />
		),<br />
		'en' => array(<br />
		    'language' => 'English',<br />
		    'locale' => 'eng',<br />
		    'localeFallback' => 'eng',<br />
		    'charset' => 'utf-8'<br />
		),<br />
	)<br />
);<br />
</code></p>
<p>I chose english and romanian for this example.</p>
<p>Now open your app controller (<strong>app/app_controller.php</strong> &#8211; create one if you don&#8217;t have it) and put this function in it:</p>
<p><code><br />
	function setLanguage() {<br />
		if(!isset($this->params['lang'])) $this->params['lang'] = 'ro';<br />
		$lang = $this->params['lang'];<br />
		App::import('Core', 'i18n');<br />
		$I18n =&#038; I18n::getInstance();<br />
		$I18n->l10n->get($lang);<br />
		foreach (Configure::read('Config.languages') as $lang => $locale) {<br />
			if($lang == $this->params['lang'])<br />
				$this->params['locale'] = $locale['locale'];<br />
		}<br />
	}<br />
</code></p>
<p>All you have to modify in this function is the first line (that sets the default language). Change the default language to your chosen one. </p>
<p>It&#8217;s now time to create a route depending on the language. Open <strong>app/config/routes.php</strong> and add this route to it:</p>
<p><code><br />
Router::connect('/:lang/:controller/:action/*', array('lang' => 'ro'), array('lang' => 'ro|en'));<br />
</code></p>
<p>Of course that this can change depending on the languages you are using and their number. You&#8217;re a smart boy so you&#8217;ll figure it out.</p>
<p>Now all you have left is to create the language files. Go to <strong>app/locale</strong> and create 2 folders: <strong>rum</strong> and <strong>en</strong>. In each of these folders create another folder called <strong>LC_MESSAGES</strong>. In the LC_MESSAGES folders you will now store the language files. Language files can be divided so it&#8217;s easier for you to store the translations ( <strong>.po</strong> files ).</p>
<p>For example, you can create a <strong>login.po</strong>, <strong>register.po</strong>, <strong>account.po</strong> and <strong>default.po</strong>.</p>
<p>In the language files you have to set the message id and message string.</p>
<p><em><strong>English</strong></em><br />
<code><br />
msgid "hello"<br />
msgstr "Hello"<br />
</code></p>
<p><em><strong>Romanian</strong></em><br />
<code><br />
msgid "hello"<br />
msgstr "Buna ziua"<br />
</code></p>
<p>And now to echo these strings on your website you have to remember the string id and the name of the language file (.po) it is stored in. Example:</p>
<p><code><br />
&lt;?<br />
__d('default', 'hello', true);<br />
?&gt;<br />
</code></p>
<p>This will take the string with the id &#8220;hello&#8221; from the <strong>default.po</strong> file and echo it. And true means that it will echo the string.<br />
Good luck</p>
]]></content:encoded>
			<wfw:commentRss>http://savasplace.com/2009/08/multilingual-website-with-cakephp/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Add Custom Icons to DVDs or Flash Drives</title>
		<link>http://savasplace.com/2009/06/add-custom-icons-to-dvds-or-flash-drives/</link>
		<comments>http://savasplace.com/2009/06/add-custom-icons-to-dvds-or-flash-drives/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 05:35:39 +0000</pubDate>
		<dc:creator>Sava</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[custom icon]]></category>
		<category><![CDATA[dvd]]></category>
		<category><![CDATA[flash drive]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://savasplace.com/?p=3407</guid>
		<description><![CDATA[You might have noticed that when you insert a software CD or a game cd the cd drive icon shows the game or software logo as icon. Ever wanted to do something like that? Well, here’s a short and easy tutorial to do so: First of all find an icon. I suggest [ Icon Finder [...]]]></description>
				<content:encoded><![CDATA[<p>You might have noticed that when you insert a software CD or a game cd the cd drive icon shows the game or software logo as icon. Ever wanted to do something like that? Well, here’s a short and easy tutorial to do so:</p>
<p>First of all find an icon. I suggest [ <a href="http://www.iconfinder.net/" target="_blank" rel="nofollow">Icon Finder</a> ]. Once you found the icon you want copy it to the root of your USB flash drive.</p>
<p>Now create autorun.inf on your USB flash drive (also in the root folder) and put this code in it:</p>
<p><code><br />
[autorun]<br />
ICON=name-of-icon.ico<br />
</code></p>
<p>Here&#8217;s my USB flash drive:</p>
<p><img src="http://savasplace.com/wp-content/uploads/2009/06/patriot.jpg" alt="Patriot" title="Patriot" /></p>
<p>To add the custom icon to your new burned cd&#8217;s make sure you save the icon and autorun.inf on your computer and add them to the files waiting to be burned.</p>
]]></content:encoded>
			<wfw:commentRss>http://savasplace.com/2009/06/add-custom-icons-to-dvds-or-flash-drives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To: Set Multiple Homepages In Firefox</title>
		<link>http://savasplace.com/2009/06/how-to-set-multiple-homepages-in-firefox/</link>
		<comments>http://savasplace.com/2009/06/how-to-set-multiple-homepages-in-firefox/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 06:20:03 +0000</pubDate>
		<dc:creator>Sava</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[homepages]]></category>

		<guid isPermaLink="false">http://savasplace.com/?p=2930</guid>
		<description><![CDATA[Here an interesting trick to set multiple homepages in Firefox. Suppose you want to set Sava&#8217;s Place, PantherKut and BabyDoll as your homepages then all you have to do is: Go to Tools -> Options -> Main In the When Firefox Starts drop down menu choose Show my home page In Home Page give your [...]]]></description>
				<content:encoded><![CDATA[<p>Here an interesting trick to set multiple homepages in Firefox. Suppose you want to set Sava&#8217;s Place, PantherKut and BabyDoll as your homepages then all you have to do is:</p>
<ul>
<li>Go to <strong>Tools</strong> -> <strong>Options</strong> -> <strong>Main</strong></li>
<li>In the <strong>When Firefox Starts</strong> drop down menu choose <strong>Show my home page</strong></li>
<li>In <strong>Home Page</strong> give your homepages separated by a <strong>|</strong> (pipe symbol). Example: <em>http://savasplace.com|http://www.pantherkut.com|http://www.babydoll.ws</em></li>
</ul>
<p>Here&#8217;s a screenshot:</p>
<p><img src="http://savasplace.com/wp-content/uploads/2009/06/firefox-options.jpg" alt="Firefox Options" title="Firefox Options" /></p>
<p>Of course you gotta click on <strong>OK</strong> to save the changes. And that&#8217;s it. The next time you start Firefox you will have your multiple homepages opened.</p>
]]></content:encoded>
			<wfw:commentRss>http://savasplace.com/2009/06/how-to-set-multiple-homepages-in-firefox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Multiple Databases in CakePHP</title>
		<link>http://savasplace.com/2009/05/multiple-databases-in-cakephp/</link>
		<comments>http://savasplace.com/2009/05/multiple-databases-in-cakephp/#comments</comments>
		<pubDate>Mon, 04 May 2009 16:59:39 +0000</pubDate>
		<dc:creator>Sava</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[multiple databases]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://savasplace.com/?p=2543</guid>
		<description><![CDATA[There comes a time in life when you need to use multiple databases for a website you have to build . I came across this &#8220;problem&#8221; when I was working on a portal website and I had to make sure that users can login with the same details on any website that company owned. So [...]]]></description>
				<content:encoded><![CDATA[<p><img src="http://savasplace.com/wp-content/uploads/2009/05/cakephp.png" alt="CakePHP" title="CakePHP" width="180" height="180" class="alignleft" />There comes a time in life when you need to use multiple databases for a website you have to build <img src='http://savasplace.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .<br />
I came across this &#8220;problem&#8221; when I was working on a portal website and I had to make sure that users can login with the same details on any website that company owned.</p>
<p>So I had to create a common database in which to store the users. Since all the websites were built in CakePHP I had to find a way to make it connect to other databases besides the default one.</p>
<p>If you are familiar with CakePHP you know that the database details are kept in <strong>app/config/database.php</strong>. </p>
<p>The default database array is:</p>
<p><code><br />
	var $default = array(<br />
		'driver' => 'mysql',<br />
		'persistent' => false,<br />
		'host' => 'localhost',<br />
		'login' => 'mysqlusername',<br />
		'password' => 'mysqlpassword',<br />
		'database' => 'mysqldatabase',<br />
		'prefix' => ''<br />
	);<br />
</code></p>
<p>Since you&#8217;re here now add another database array:</p>
<p><code><br />
	var $database2 = array(<br />
		'driver' => 'mysql',<br />
		'persistent' => false,<br />
		'host' => 'localhost',<br />
		'login' => 'mysqlusername2',<br />
		'password' => 'mysqlpassword2',<br />
		'database' => 'mysqldatabase2',<br />
		'prefix' => ''<br />
	);<br />
</code></p>
<p>Now open up a model you are using. Let&#8217;s say we are using the model <strong>User</strong> ( <em>located in app/models/user.php</em> ). Open the file and add this function to it:</p>
<p><code><br />
	function changeDataSource($newSource) {<br />
		parent::setDataSource($newSource);<br />
		parent::__construct();<br />
	}<br />
</code></p>
<p>Now in the <strong>Users controller</strong> ( <em>located in app/controllers/users_controller.php</em> ) add this function:</p>
<p><code><br />
	function changeDbSource($database = 'default') {<br />
		$db = ConnectionManager::getInstance();<br />
		$connected = $db->getDataSource($database);<br />
		if($connected->isConnected()) {<br />
			return true;<br />
		} else {<br />
			return false;<br />
		}<br />
	}<br />
</code></p>
<p>Here&#8217;s an example on how to switch between the databases:</p>
<p><code><br />
function loginUser() {<br />
// The search is made in the default database<br />
$this->User->find('all', array('conditions' => array('User.username' => $username)));</p>
<p>// Let's do something in the second database <strong>database2</strong></p>
<p>$this->User->changeDataSource('database2');<br />
if($this->changeDbSource('database2')) {<br />
     // Do something in database 2<br />
}<br />
}<br />
</code></p>
<p>It&#8217;s really easy once you get the hang of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://savasplace.com/2009/05/multiple-databases-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Display the time passed in any format you want</title>
		<link>http://savasplace.com/2008/11/display-the-time-passed-in-any-format-you-want/</link>
		<comments>http://savasplace.com/2008/11/display-the-time-passed-in-any-format-you-want/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 06:00:36 +0000</pubDate>
		<dc:creator>Sava</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[If you use digg you probably noticed that they displayed the time passed since a comment has been posted in the following way: To obtain a rezult in this format we will use the function strtotime. This function counts the seconds that have passed since the 1st of January 1970. In order to obtain the [...]]]></description>
				<content:encoded><![CDATA[<p>If you use digg you probably noticed that they displayed the time passed since a comment has been posted in the following way:</p>
<p><img width="333" height="64" src="http://savasplace.com/content/files/Image/blog_posts/2008/11/digg.jpg" alt="Digg Comment" /></p>
<p>To obtain a rezult in this format we will use the function strtotime. This function counts the seconds that have passed since the 1st of January 1970.<br />
In order to obtain the number of seconds exactly since a comment has been posted we need to save the date for each comment in the following format: date(&#8216;Y-m-d H:i:s&#8217;) . This will return 2008-11-12 14:39:53.</p>
<p>So when you create the date field in the MySQL table choose as type datetime.</p>
<p>Let&#8217;s start off with inserting a comment in the database.</p>
<blockquote><p>INSERT INTO `comments` (`name` , `comment_text`, `date`) VALUES (&#8216;Sava Stefan&#8217;, &#8216;This is a test comment&#8217;, NOW( ));</p></blockquote>
<p>NOW() will insert the current date and time at the exact moment the query is executed. Eg: 2008-11-12 14:39:53.</p>
<p>It&#8217;s now time to show the time passed since a comment has been posted.</p>
<p>Now let&#8217;s create a function called countTime.</p>
<blockquote><p>function countTime($comment_date) { $now = date(&#8216;Y-m-d H:i:s&#8217;); $number_of_seconds = (strtotime($now) &#8211; strtotime($comment_date)); }</p></blockquote>
<p>Until now I managed to get the number of seconds passed since the comment has been posted ($comment_date). We go on further and obtain the number of hours and minutes with simple mathematics:</p>
<blockquote><p>$number_of_minutes = $number_of_seconds / (60); $number_of_hours = $number_of_minutes / (60); $number_of_hours_to_display = intval($number_of_hours); $number_of_minutes_to_display = intval($number_of_minutes &#8211; ($number_of_hours_to_display * 60));</p></blockquote>
<p>As you can see the number of minutes passed is equal to the number of seconds obtained earlier (that first diference &#8211; $number_of_seconds ) split to 60. The number of hours will also be equal to the number of minutes split to 60 as well. <br />
I used intval to obtain the integer value so we don&#8217;t display anything like: 1,523 hours  Let&#8217;s not forget to get the integer for the number of seconds as well:</p>
<blockquote><p>$number_of_seconds_to_display= intval($number_of_seconds &#8211; ($number_of_minutes_to_display * 60 * 60) &#8211; ($number_of_minutes_to_display * 60));</p></blockquote>
<p>In case you don&#8217;t get this last line try looking at the clock and notice how many seconds an hour and a minute have.  Let&#8217;s customize the output of the function:</p>
<blockquote><p>echo &#8216;This comment was posted &#8216;.$number_of_hours_to_display.&#8217; hours, &#8216;.$number_of_minutes_to_display.&#8217; minutes and &#8216;.$number_of_seconds_to_display.&#8217; seconds ago.&#8217;;</p></blockquote>
<h3>The complete function:</h3>
<blockquote><p>function countTime($comment_date) {<br />
$now = date(&#8216;Y-m-d H:i:s&#8217;);<br />
$number_of_seconds = (strtotime($now) &#8211; strtotime($comment_date));<br />
$number_of_minutes = $number_of_seconds / (60);<br />
$number_of_hours = $number_of_minutes / (60);<br />
$number_of_hours_to_display = intval($number_of_hours);<br />
$number_of_minutes_to_display = intval($number_of_minutes &#8211; ($number_of_hours_to_display * 60));<br />
$number_of_seconds_to_display= intval($number_of_seconds &#8211; ($number_of_minutes_to_display * 60 * 60) &#8211; ($number_of_minutes_to_display * 60));<br />
echo &#8216;This comment was posted &#8216;.$number_of_hours_to_display.&#8217; hours, &#8216;.$number_of_minutes_to_display.&#8217; minutes and &#8216;.$number_of_seconds_to_display.&#8217; seconds ago.&#8217;;<br />
}</p></blockquote>
<p>Integrating the function is simple as hell. If you obtained your comments as an array let&#8217;s say that $comment['date'] is the date value of a comment from your database.</p>
<blockquote><p> Name: $comment['name'];<br />
Comment: $comment['comment_text'];<br />
countTime($comment['date']);
</p></blockquote>
<p>It will display the following considering the database insert from above:</p>
<blockquote><p> Name: Sava Stefan<br />
Comment: This is a test comment<br />
This comment was posted 3 hours, 24 minutes and 13 seconds ago.
</p></blockquote>
<p>Of course you can calculate the time left until a certain thing should happen:</p>
<blockquote><p>$number_of_seconds_until = (strtotime($data_in_future) &#8211; strtotime($now));</p></blockquote>
<p>Get going &#8230; you time machine <img src='http://savasplace.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://savasplace.com/2008/11/display-the-time-passed-in-any-format-you-want/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
