<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>Tildemark blogs</title>
        <link>http://www.tildemark.com/</link>
        <description>Blogging on uniquely random things. </description>
        <language>en</language>
        <copyright>Copyright 2009</copyright>
        <lastBuildDate>Sun, 25 Jan 2009 19:14:25 +0800</lastBuildDate>
        <generator>http://www.sixapart.com/movabletype/</generator>
        <docs>http://www.rssboard.org/rss-specification</docs>
        
        <item>
            <title>Sending mail via Mercury on localhost using codeigniter and XAMPP</title>
            <description><![CDATA[<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.tildemark.com/images/mercury-logo.jpg"><img alt="mercury-logo.jpg" src="http://www.tildemark.com/assets_c/2009/01/mercury-logo-thumb-200x252-150.jpg" width="200" height="252" class="mt-image-left" style="float: left; margin: 0 20px 20px 0;" /></a></span>This is my first time to use Mercury on XAMPP, I never had a mail project before so I guess I'm gonna blog it for future reference. Obviously, we will be using SMTP to send mails and POP3 to receive them. Since we do not have sendmail installed in Windows XP.<div><br /></div><div>Using Mercury bundled witn XAMPP is so straight forward. I am assuming you have already installed XAMPP and Mercury Mail Transport is already running. I also assume you already know how to setup a mail client (eg Outlook, Outlook Express, ThunderBird, EudoraMail are few of them). Setting up a mail client is not covered here. </div><div><br /></div><div><br /></div><div><br /></div><div><br /></div><div>Requirements:</div><div><ul style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 20px; background-repeat: repeat-y; list-style-type: disc; list-style-position: outside; list-style-image: initial; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">XAMPP - Our webserver</li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Codeigniter - PHP Framework</li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Mail Client - Receive mails</li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">Text Editor - TextMate is a very good editor but I use notepad</li></ul></div><div><br /></div><div><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.tildemark.com/images/xampp-control-panel.jpg"><img alt="xampp-control-panel.jpg" src="http://www.tildemark.com/assets_c/2009/01/xampp-control-panel-thumb-200x159-152.jpg" width="200" height="159" class="mt-image-left" style="float: left; margin: 0 20px 20px 0;" /></a></span></div><div>Now, all we need to do is Add Users for testing: </div><div>1. Open XAMPP Control Panel and Click on Start on the Mercury Section</div><div>2. Click on the Admin Button to Add Users</div><div>3. On the Mercury Menu, go to Configuration -> Manage Local Users</div><div>4. To Add an account Click on ADD </div><div>5. Add your desired test Accounts by filling in the Username, Name and Password field</div><div>6. Then click OK, then click Close</div><div><br /></div><div><br /></div><div>Before testing, you might want to configure codeigniter's config to store your sender accounts. To do that: </div><div>1. Navigate to your codeigniter application->config folder </div><div>2. You may create you own config file or add them in the email.php config</div><div>3. if email.php does not exist you may create one. </div><div>4. You can use the basic config for sending smtp/pop3 below:</div><div><br /></div><pre style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; "><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'localhost';
</code></pre><div><br /></div><div>5. You may add your test account so you don't have to manually type them whenever you send.Take note, I used localhost.com as my host name. Mail clients may not permit you to add an account with just localhost so adding .com, .net, .org will do the trick.</div><div><br /></div><pre style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; "><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'localhost';
$config['email_address'] = 'sender@localhost.com';
$config['email_name'] = 'Localhost test';
</code></pre><div><br /></div><div>6. Remember not to close your &lt;?php tag </div><div>7. If you want to, you can also configure codeigniter to autoload the email config by adding it at the autoload.php file</div><div><br /></div><div>We can now start sending mail with code igniter:</div><div>1. At the application->controllers create a controller class: </div><pre style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; "><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1em; font-weight: normal; ">&lt;?php
class Test_Mail extends Controller {
function Test_Mail()
{
parent::Controller();
}	
function index()
{
// get config data
$from = $this->config->item('email_address', 'email');
$from_name = $this->config->item('email_name', 'email');
$to = 'tildemark@localhost.com'; 
$to_name = "To Name";
// we load the email library and send a mail
$this->load->library('email');
$this->email->from($from, $from_name);
$this->email->to($to, $to_name);
$this->email->subject('Email subject');
$this->email->message('Testing the email class.');
$this->email->send();
//to debug we can use print_debugger()
echo $this->email->print_debugger();
}
}
</code></pre><div>2. On your browser, type in http://localhost/codeigniter/test_mail</div><div>3. Check you mail client for new mails. </div><div>4. Thats it! We have successfully sent a mail using Mercury on XAMPP on in your local computer.</div><div><br /></div><div><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.tildemark.com/images/test-mail-success.jpg"><img alt="test-mail-success.jpg" src="http://www.tildemark.com/assets_c/2009/01/test-mail-success-thumb-200x208-151.jpg" width="200" height="208" class="mt-image-none" style="" /></a></span></div><div><br /></div><div>Please the <a href="http://codeigniter.com/user_guide/" style="text-decoration: underline; ">codeigniter manual</a> for more resource about its email class. </div><div><br /></div><div><br /></div>]]></description>
            <link>http://www.tildemark.com/programming/php/sending-mail-via-mercury-on-localhost-using-codeigniter-and-xampp.html</link>
            <guid>http://www.tildemark.com/programming/php/sending-mail-via-mercury-on-localhost-using-codeigniter-and-xampp.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Programming</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">apache</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">codeigniter</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">email</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">mercury</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">php</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">xampp</category>
            
            <pubDate>Sun, 25 Jan 2009 19:14:25 +0800</pubDate>
        </item>
        
        <item>
            <title>Mass rename files using wscript</title>
            <description><![CDATA[<p>Obviously, its seldom to see people using batch files nowadays. Most people dont even know what it is. On, contrary i still use them on my daily tasks to automate things, its like having Perl on a Linux box. but things are changing now, i guess using batch files isn't the trend anymore these days. The same with Linux OS, Windows also comes in handy with some tools used to automate tasks and using batchfiles is one of them. Since we're using Windows XP now, its also wise to&nbsp;do things in GUI mode in contrary with the old style DOS mode edit.</p>
<p>While downloading some pictures from a camera,&nbsp;I found them hard to manually rename its filename to a more meaningful title and not some random "DSC001323.JPG". After rename 10 or 15 files, i got bored, thinking this would take me forerver to rename them all for they are more than a thousand in total. If you can still recall that neat application called <a href="http://www.irfanview.com/">Irfan View</a>, my life would have been alot easier. </p>
<p>Well anyway, lets change things we normally do and instead of using batch files we use vb script. A zipped version of the 
<span class="mt-enclosure mt-enclosure-file" style="DISPLAY: inline"><a href="http://www.tildemark.com/downloads/MassRename.zip">mass renaming script</a></span>&nbsp;is also available for download. </p><code>
<p>''''''''''''''''''''''''''''''''''''''''''<br />' Mass Rename Script by tildemark<br />' <a href="http://www.tildemark.com/">http://www.tildemark.com</a><br />' <br />' <br />' Usage: <br />'&nbsp;&nbsp; Place this script on a list of files you wish to rename.<br />'&nbsp;&nbsp; Run this script by double clicking on the filename.<br />'<br />'<br />' For bugs send it to <a href="mailto:tildemark@gmail.com">tildemark@gmail.com</a><br />'<br />''''''''''''''''''''''''''''''''''''''''''</p>
<p>Dim fso, Path, Folder, Counter, Prefix, File, Extension</p>
<p>set fso = CreateObject("Scripting.FileSystemObject")</p>
<p>Path = InputBox("Input the location of the files to be renamed. ('.' means current folder)", "Mass Rename Script", ".")</p>
<p>Prefix = InputBox("Input the filename prefix", "Mass Rename Script")<br />If Prefix = "\" Then WScript.Quit</p>
<p>Extension = InputBox("Input the file extension to be renamed", "Mass Rename Script")<br />If Extension = "\" Then WScript.Quit</p>
<p>Counter = InputBox("Input the starting offset", "Mass Rename Script")</p>
<p>Set Folder = fso.GetFolder(Path)</p>
<p>For Each File In folder.Files</p>
<p>&nbsp; If Not ((File.Attributes And 8) = 8) Then<br />&nbsp;&nbsp;&nbsp; If fso.GetExtensionName(File.Path) = Extension Then&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; File.Name = Prefix &amp; CStr(Counter) &amp; "." &amp; Extension<br />&nbsp;&nbsp;&nbsp; End If<br />&nbsp; End If<br />&nbsp; Counter = Counter + 1<br />Next</p>
<p>MsgBox("Done")</p></code>]]></description>
            <link>http://www.tildemark.com/programming/mass-rename-files-using-wscript.html</link>
            <guid>http://www.tildemark.com/programming/mass-rename-files-using-wscript.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">At Work</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Programming</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Tips</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">scripts</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">tips</category>
            
            <pubDate>Sat, 15 Mar 2008 08:22:09 +0800</pubDate>
        </item>
        
        <item>
            <title>DevjaVu: new developer tool</title>
            <description><![CDATA[<p><span class="mt-enclosure mt-enclosure-image"><img alt="devjavu_banner.png" src="http://www.tildemark.com/images/devjavu_banner.png" width="231" height="73" class="mt-image-right" style="float: right; margin: 0 0 20px 20px;"/></span><br />
<a href="http://www.devjavu.com/">DevjaVu</a> a neat and simple app for trac and subversion hosting. Great to use when starting out a project or simply by managing an ongoing project. Its issue tracking system makes collaboration a lot easier and more organized. DevjaVu includes some basic project management features like milestones, built in wiki and an administration page used to manage every aspect of the project thru a web interface. </p>

<p><br />
 If you are familiar with <a href="https://sourceforge.net/">source forge</a>, you should also try this one out. Its ticket system is beautifully implemented which makes project management even easier. Best of all you can subscribe for free. Just use the invite code <strong>johnny5</strong> when creating DevjaVu projects. </p>]]></description>
            <link>http://www.tildemark.com/programming/devjavu-new-developer-tool.html</link>
            <guid>http://www.tildemark.com/programming/devjavu-new-developer-tool.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Programming</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Software</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">repository</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">subversion</category>
            
            <pubDate>Fri, 01 Feb 2008 13:55:04 +0800</pubDate>
        </item>
        
        <item>
            <title>HTML Error Codes</title>
            <description><![CDATA[<p>Actually, they are better called response codes. Below is a list of the HTML error codes and its short description</p>

<p>Informational<br />
100="Continue"<br />
101="Switching Protocols"</p>

<p>Successful Client Requests<br />
200 	OK<br />
201 	Created<br />
202 	Accepted<br />
203 	Non-Authorative Information<br />
204 	No Content<br />
205 	Reset Content<br />
206 	Partial Content</p>

<p>Client Request Redirected<br />
300 	Multiple Choices<br />
301 	Moved Permanently<br />
302 	Moved Temporarily<br />
303 	See Other<br />
304 	Not Modified<br />
305 	Use Proxy</p>

<p>Client Request Errors<br />
400 	Bad Request<br />
401 	Authorization Required<br />
402 	Payment Required (not used yet)<br />
403 	Forbidden<br />
404 	Not Found<br />
405 	Method Not Allowed<br />
406 	Not Acceptable (encoding)<br />
407 	Proxy Authentication Required 	 <br />
408 	Request Timed Out<br />
409 	Conflicting Request<br />
410 	Gone<br />
411 	Content Length Required<br />
412 	Precondition Failed<br />
413 	Request Entity Too Long<br />
414 	Request URI Too Long<br />
415 	Unsupported Media Type</p>

<p>Server Errors<br />
500 	Internal Server Error<br />
501 	Not Implemented<br />
502 	Bad Gateway 	 <br />
503 	Service Unavailable 	 <br />
504 	Gateway Timeout 	 <br />
505 	HTTP Version Not Supported</p>]]></description>
            <link>http://www.tildemark.com/programming/html-error-code.html</link>
            <guid>http://www.tildemark.com/programming/html-error-code.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Internet</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Programming</category>
            
            
            <pubDate>Fri, 08 Dec 2006 11:58:14 +0800</pubDate>
        </item>
        
    </channel>
</rss>






