<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
    <channel>
        <title>muse</title>
        <link>http://miphol.com/muse/</link>
        <description>sun rays gone astray</description>
        <language>en</language>
        <copyright>Copyright 2010</copyright>
        <lastBuildDate>Fri, 21 May 2010 14:13:40 -0500</lastBuildDate>
        <generator>http://www.sixapart.com/movabletype/</generator>
        <docs>http://www.rssboard.org/rss-specification</docs>
        
        <item>
            <title>Protected Directory and Downloads in Drupal</title>
            <description><![CDATA[<p>This is a solution to mix public downloads and protected folders.</p>

<p>For this, you will need <span class="caps">CCK, </span>specifically <span class="caps">CCK</span> FileField and Content Permission. Also mod_rewrite should be enabld.</p>

<p>First, add a new file field to a content type, and configure its path to the directory that will be protected. For example, if /files/protected is the directory that will contain protected files, then you can either set that as the path or a folder within it.</p>

<p>If you have already set /files as your file system path, then there should be a .htaccess file created by drupal. You should copy that into each of the protected folders. If you don't, you may get 404 errors.</p>

<p>Open the .htaccess file in your root drupal directory, add the following line to the end of mod_rewrite rules:</p>

<pre><code>RewriteRule ^files\/(protected\/.*)$ index.php?q=system/files/$1 [L,QSA]</code></pre>

<p>Replace <code>protected</code> with your top-level protected folder name. If you have other custom rewrite rules you should be more careful about where you put the above line. Putting it at the end works for me.</p>

<p>Lastly, on your 403 page, you can examine if user is requesting a file in a protected directory using <code>request_uri()</code> and <code>strpos()</code>.</p>]]></description>
            <link>http://miphol.com/muse/2010/05/protected-directory-downloads.html</link>
            <guid>http://miphol.com/muse/2010/05/protected-directory-downloads.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Web Development</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">drupal</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">web development</category>
            
            <pubDate>Fri, 21 May 2010 14:13:40 -0500</pubDate>
        </item>
        
        <item>
            <title>Customize Ubercart Product Page</title>
            <description><![CDATA[<p>Here's a little snippet of code to customize ubercart product page template so that the contents are grouped into tabs.</p>

<p>You need <a href="http://drupal.org/project/tabs">Tabs</a> and <a href="http://drupal.org/project/cck_fieldgroup_tabs"><span class="caps">CCK</span> Fieldgroups Tabs</a>.</p>

<p>Go to yoursite/admin/content/node-type/product/fields and add some cck groups and fields, then display them properly (tabs for full node).</p>

<p>Create node-product.tpl.php. Paste the following php code in (enclose it with php tags):</p>

<pre><code>$form = array();
$form['ptabs'] = array(
'#tabset_name' =&gt; 'ptabs',
'#type' =&gt; 'tabset',
);
$i = 0;

// shows a summary of the product
$summary;
$summary .= $node-&gt;content['weight']['#value'];
$summary .= $node-&gt;content['dimensions']['#value'];
$summary .= $node-&gt;content['body']['#value'];
$form['ptabs'][$i] = array(
'#type' =&gt; 'tabpage',
'#title' =&gt; t('Summary'),
'#content' =&gt; $summary,
);
$i++;

// add other tabs if applicable
if (!empty($node-&gt;content['fieldgroup_tabs'])) {
	foreach ($node-&gt;content['fieldgroup_tabs'] as $key =&gt; $value) {
		if (is_array($value)) {
			if ($value['#type'] == 'tabpage') {
				$form['ptabs'][$i] = array(
				'#type' =&gt; 'tabpage',
				'#title' =&gt; $value['group']['#title'],
				'#content' =&gt; $value['group']['#children'],
				);
				$i++;
			}
		}
	}
}</code></pre>

<p>The page should always have a tab called Summary, and other tabs that you added for the content type if they are not empty (cck fieldgroup tabs module validates this). If you don't wish to have the Summary tab, simply delete that part of code.</p>

<p>Feel free to share the code.</p>]]></description>
            <link>http://miphol.com/muse/2009/12/customize-ubercart-product-pag.html</link>
            <guid>http://miphol.com/muse/2009/12/customize-ubercart-product-pag.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Web Development</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">drupal</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">web development</category>
            
            <pubDate>Mon, 21 Dec 2009 22:09:11 -0500</pubDate>
        </item>
        
        <item>
            <title>Configure Postfix to work with Spamassassin and Dovecot for Delivery</title>
            <description><![CDATA[<p>For more info on Dovecot: http://wiki.dovecot.org/LDA</p>

<p>Add the following at the bottom of master.cf</p>

<pre><code># spamassassin then dovecot LDA
dovecot    unix  -       n       n       -       -       pipe
    flags=DRhu user=vmail:mail argv=/usr/bin/spamc -u randomuser -e /usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}</code></pre>

<p>Basically, postfix pipe the mail into spamc, and since you don't want to run it as root you use another user (-u). -e redirects the output from spamc for dovecot to deliver. And postfix tells dovecot who the sender is, and who the recipient is.</p>

<p>Add the following to main.cf</p>

<pre><code>mailbox_command = /path/to/dovecot/deliver
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1</code></pre>

<p>Now just restart postfix and you are done. Depending on how you setup the virtual domain database, it works for multiple domains.</p>]]></description>
            <link>http://miphol.com/muse/2009/12/configure-postfix-to-work-with.html</link>
            <guid>http://miphol.com/muse/2009/12/configure-postfix-to-work-with.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Linux</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Web Development</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">linux</category>
            
            <pubDate>Tue, 01 Dec 2009 18:57:36 -0500</pubDate>
        </item>
        
        <item>
            <title>How to start a new Activity</title>
            <description><![CDATA[<p>Android has a weird way of constructing <span class="caps">UI.</span> At least I haven't got used to it.</p>

<p>First of all, AndroidManifest.xml must have activities listed:</p>

<pre><code><!-- First Activity screen -->
&lt;activity android:name=&quot;.FirstActivity&quot; android:label=&quot;@string/app_name&quot;&gt;
    &lt;intent-filter&gt;
        &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
        &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
    &lt;/intent-filter&gt;
&lt;/activity&gt;

<!-- Second Activity screen -->
&lt;activity android:name=&quot;.SecondActivity&quot; android:label=&quot;Second Activity&quot;&gt;
    &lt;intent-filter&gt;
        &lt;action android:name=&quot;com.example.app.activities.SECOND&quot; /&gt;
        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
    &lt;/intent-filter&gt;
&lt;/activity&gt;</code></pre>

<p>There are several ways to set the components (action, type, category) of <a href="http://developer.android.com/reference/android/content/Intent.html">Intent</a>, below are the 2 easiest ways.</p>

<pre><code>Intent i = new Intent();
i.setAction(“com.example.app.activities.SECOND”);</code></pre>

<p>Or this:</p>

<pre><code>i.setClass(getApplicationContext(), SecondView.class);</code></pre>

<p>Create a bundle to pass data to the new activity:</p>

<pre><code>Bundle bundle = new Bundle();
bundle.putString(&quot;TEXT&quot;, &quot;Lorem ipsum&quot;);
i.putExtras(bundle);</code></pre>

<p>To start the activity:</p>

<pre><code>startActivity(i);</code></pre>

<p>To get the data from the bundle that’s passed to our new activity:</p>

<pre><code>Bundle bundle = getIntent().getExtras();
String prompt = bundle.getString(&quot;TEXT&quot;);</code></pre>]]></description>
            <link>http://miphol.com/muse/2009/08/how-to-start-a-new-activity.html</link>
            <guid>http://miphol.com/muse/2009/08/how-to-start-a-new-activity.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Android</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">android</category>
            
            <pubDate>Fri, 28 Aug 2009 21:29:18 -0500</pubDate>
        </item>
        
        <item>
            <title>Starting Android Development</title>
            <description><![CDATA[<p>I decided earlier this week that it&#8217;s time to see how developing on Android feels like, and installed Eclipse and the ADT plugin. Setting up the development environment was pretty fast; took about 5 minutes.</p>

<p>Here is a screenshot of the Android Emulator running my HelloWorld app. <a href="http://www.miphol.com/muse/assets_c/2009/08/android-emulator-281.html" onclick="window.open('http://www.miphol.com/muse/assets_c/2009/08/android-emulator-281.html','popup','width=900,height=752,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.miphol.com/muse/assets_c/2009/08/android-emulator-thumb-300x250-281.jpg" width="300" height="250" alt="android-emulator.jpg"/></a></p>

<p>The emulator takes a while to boot (the first time I ran it I thought it froze so I force quitted it). I&#8217;m running Leopard on my macbook pro and I every time I start the emulator I get this waring: &#8220;Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.&#8221; It doesn&#8217;t affect the emulator in anyway so there is nothing to worry about; just ignore it. This issue might be addressed in future versions.</p>

<p>Here&#8217;s some links:</p>

<ul>
<li><a href="http://www.androidcompetencycenter.com/category/android-basics/">Android Competency Center</a></li>
<li><a href="http://www.vogella.de/articles/Android/article.html">Creating a Simple Android Application with Eclipse</a></li>
</ul>
]]></description>
            <link>http://miphol.com/muse/2009/08/starting-android-development.html</link>
            <guid>http://miphol.com/muse/2009/08/starting-android-development.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Android</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">android</category>
            
            <pubDate>Wed, 26 Aug 2009 15:24:36 -0500</pubDate>
        </item>
        
        <item>
            <title>Updates to this blog</title>
            <description><![CDATA[<p>I apologize for the encoding and mysteriously disappeared images, everything should be working now.</p>

<p>In the meanwhile I will be updating the format of some old posts.</p>]]></description>
            <link>http://miphol.com/muse/2009/08/updates-to-this-blog.html</link>
            <guid>http://miphol.com/muse/2009/08/updates-to-this-blog.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">muse</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">miphol studio</category>
            
            <pubDate>Thu, 13 Aug 2009 14:21:27 -0500</pubDate>
        </item>
        
        <item>
            <title>Send form confirmation email using webform additional processing</title>
            <description><![CDATA[<p>Webform is a great module, but it doesn't send confirmation email, so here is a quick fix if you are running on Drupal 6.x.</p>

<p>To get the submitted value of a form component, you can use <code>$form_values['submitted_tree']['component_key']</code> where <code>component_key</code> should be replaced by your component key. If the component is in a fieldset, access it by <code>$form_values['submitted_tree']['fieldset_key']['component_key']</code> where <code>fieldset_key</code> should be replaced by your fieldset key.</p>

<p>To send the email I chose to use <code>drupal_mail()</code> function, of course there are other ways.</p>

<p>Here is an example:</p>

<pre><code>$from = &quot;example@example.com&quot;;
$to = $form_values['submitted_tree']['email'];
$user = $form_values['submitted_tree'['name'];
$body = &quot;Hello &quot; . $user . &quot;,\nThis is a message.&quot;;
drupal_mail('webform_extra', 'confirmation_key', $to, language_default(), array('body' =&gt; $body), $from, TRUE);
function webform_extra_mail($key, &amp;$message, $params) {
$message['subject'] = &quot;Confirmation email&quot;;
$message['body'] = $params['body'];
}</code></pre>]]></description>
            <link>http://miphol.com/muse/2009/08/send-form-confirmation-email-u.html</link>
            <guid>http://miphol.com/muse/2009/08/send-form-confirmation-email-u.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Web Development</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">drupal</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">web development</category>
            
            <pubDate>Tue, 04 Aug 2009 15:35:42 -0500</pubDate>
        </item>
        
        <item>
            <title>UIBarButtonItem possibleTitles property</title>
            <description><![CDATA[<p>The possibleTitles property of <span class="caps">UIB</span>arButtonItem is pretty useful if you need to change the title and also animate the changes. I was trying to animate both the back button and the title of the right barbutton at the same time, but the back button wouldn't disappear properly (i.e. not animated) until I set the possibleTitles of the right barbutton.</p>

<p>First create the button. Do this in viewDidLoad.</p>

<pre><code>self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@&quot;Edit&quot; style:UIBarButtonItemStyleBordered target:self action:@selector(toggleEditing)] autorelease];
self.navigationItem.rightBarButtonItem.possibleTitles = [NSSet setWithObjects:@&quot;Edit&quot;, @&quot;Done&quot;, nil];</code></pre>

<p>To change the title just set the title property. Very easy. Both changes will be animated.</p>

<pre><code>- (void)toggleEditing {
	if (!self.editing) {
		self.navigationItem.rightBarButtonItem.title = @&quot;Done&quot;;
		[self.navigationItem setHidesBackButton:YES animated:YES];
	} else {
		self.navigationItem.rightBarButtonItem.title = @&quot;Edit&quot;;
		[self.navigationItem setHidesBackButton:NO animated:YES];
	}
}</code></pre>

<p>This works in OS 3.0.</p>]]></description>
            <link>http://miphol.com/muse/2009/07/uibarbuttonitem-possibletitles.html</link>
            <guid>http://miphol.com/muse/2009/07/uibarbuttonitem-possibletitles.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">iPhone Dev</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">iphone</category>
            
            <pubDate>Fri, 10 Jul 2009 21:57:50 -0500</pubDate>
        </item>
        
        <item>
            <title>2G iPhone updating to iPhone OS 3.0</title>
            <description><![CDATA[<p>It's confirmed that if you have a 2G iPhone that is unlocked with <a href="http://wikee.iphwn.org/sgold_bootrom:bootneuter">BootNeuter</a> (running firmware 2.2.1), you can safely update to OS 3.0 using iTunes (yes just press that <strong>Update</strong> button).</p>

<p>For detailed and step-by-step instructions see <a href="http://iphonehelp.in/2009/06/16/firmware-30-unlocked-and-running-on-iphone-2g/">here</a></p>]]></description>
            <link>http://miphol.com/muse/2009/06/iphone-2g-updating-to-30.html</link>
            <guid>http://miphol.com/muse/2009/06/iphone-2g-updating-to-30.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Apple</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Hacking</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">iPhone Dev</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">hacking</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">iphone</category>
            
            <pubDate>Fri, 19 Jun 2009 00:52:28 -0500</pubDate>
        </item>
        
        <item>
            <title>Setting up a lightweight mail server</title>
            <description><![CDATA[<p>This document is based on the following documents:</p>

<ul>
<li><a href="http://wiki.dovecot.org/HowTo/DovecotLDAPostfixAdminMySQL">http://wiki.dovecot.org/HowTo/DovecotLDAPostfixAdminMySQL</a></li>
</ul>

<p>This document describes the process of setting up a mail server on Fedora 10. The mail server uses dovecot for authentication and postfix for mail delivery. Postfix Admin is used to manage virtual domains and virtual users. Roundcube Mail is used for user to access their email accounts online. Of course everything depends on apache server and mysql.</p>

<p>Software packages used (dependencies not listed here): httpd, mysql, mysql-server, php, php-mysql, postfix, dovecot</p>

<p>Notable dependencies: php-imap, dovecot-mysql</p>

<p>Roundcube Mail have a lot dependencies, such as php-xml, php-xmlrpc and etc.</p>

<p><strong>Configure Apache Server</strong></p>

<pre><code># nano /etc/httpd/conf/httpd.conf</code></pre>

<p>In order to reduce the memory usage and make our server more efficient, change the following:</p>

<pre><code>Timeout 20
KeepAlive On
MaxKeepAliveRequests 200
KeepAliveTimeout 4
&lt;IfModule prefork.c&gt;
StartServers	   1
MinSpareServers    1
MaxSpareServers    5
ServerLimit	  50
MaxClients  	  50
MaxRequestsPerChild  2000
&lt;/IfModule&gt;</code></pre>

<p>We don't want indexing at all:</p>

<pre><code>&lt;Directory /&gt;
    Options -Indexes
    AllowOverride None
&lt;/Directory&gt;</code></pre>

<p>Now we are ready to start the server:</p>

<pre><code># service httpd start</code></pre>

<p><strong>Configure MySQL</strong></p>

<p>After installing mysql, we must change the root password first:</p>

<pre><code># mysqladmin -u root password  'yourpassword'</code></pre>

<p>Now we manage mysql databases using root login:</p>

<pre><code># mysqladmin -u root -p</code></pre>

<p>If we are running tight on memory we should use small config file for mysql. And we would want to skip innodb and bdb too.</p>

<pre><code># cp /usr/share/mysql/my-small.cnf /etc/my.cnf</code></pre>

<p>Now we are ready to start mysql server:</p>

<pre><code># service mysqld start</code></pre>

<p><strong>Configure Postfix Admin</strong></p>

<p>The reason why we setup postfix admin first is because postfix gets the list of virutal users from mysql database, which can be easily edited by postfix admin. Remember that postfix admin uses innoDB (edit <code>/etc/my.cnf</code> accordingly)</p>

<p>Move into the directory you want to put postfix admin at.</p>

<pre><code># cd /var/www/html/</code></pre>

<p>Get the latest release from <span class="caps">SVN</span>:</p>

<pre><code># svn co https://postfixadmin.svn.sourceforge.net/svnroot/postfixadmin/trunk postfixadmin </code></pre>

<p>Create a new user for postfix admin and grant access to mysql:</p>

<pre><code>mysql&gt; CREATE USER 'postfix'@'localhost' IDENTIFIED BY 'password';
mysql&gt; GRANT ALL PRIVILEGES ON postfix.* to 'postfix'@'localhost';</code></pre>

<p>Edit config.inc.php.</p>

<pre><code># nano config.inc.php</code></pre>

<p>Edit the following:</p>

<pre><code>$CONF['configured'] = true;
$CONF['database_type'] = 'mysql';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = 'password';
$CONF['database_name'] = 'postfix';
$CONF['database_prefix'] = '';</code></pre>

<p>And other things you may want to replace with your own.</p>

<p>Now we're ready to setup postfix admin. Go to <code>http://localhost/postfixadmin/setup.php</code></p>

<p>Follow the instructions on that page. Fairly straight forward.</p>

<p><strong>Configure Directories And Users</strong></p>

<p>At this point we should think about where and how we are going to store mails and manage user accounts. Obviously in this case we will be using mysql, but there are other options too. Now let's create a user that will be used for all virtual users to login and store their mails.</p>

<pre><code># mkdir -p /home/vmail
# useradd -r -u 5000 -g mail -d /var/vmail -s /sbin/nologin -c &quot;Virtual mailbox&quot; vmail
# chown vmail.mail /home/vmail</code></pre>

<p><strong>Configure Dovecot</strong></p>

<p>Now edit dovecot config file at <code>/etc/dovecot.conf</code>. I prefer nano.</p>

<p><span class="caps">SSL </span>setup:</p>

<pre><code>protocols = imap pop3 imaps pop3s
listen = *
ssl_listen = 
ssl_disable = no
ssl_cert_file = /etc/pki/dovecot/certs/dovecot.pem
ssl_key_file = /etc/pki/dovecot/private/dovecot.pem</code></pre>

<p>Set the local user dovecot will use.</p>

<pre><code>mail_location = maildir:/home/vmail/%u
first_valid_uid = 5000
last_valid_uid = 5000
first_valid_gid = 12
last_valid_gid = 12</code></pre>

<p>Settings for protocols.</p>

<pre><code>protocol imap {
  mail_plugins = quota imap_quota trash expire
  imap_client_workarounds = outlook-idle delay-newmail
}
protocol pop3 {  
  pop3_uidl_format = %08Xu%08Xv
  mail_plugins = quota expire
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}</code></pre>

<p>Authentication settings so that dovecot and postfix can work together:</p>

<pre><code>auth_executable = /usr/libexec/dovecot/dovecot-auth
auth_worker_max_count = 30
auth default {
  mechanisms = plain login
  passdb sql {
    args = /etc/dovecot/sql.conf
  }
  userdb sql {
    args = /etc/dovecot/sql.conf
  }
  user = nobody
  count = 1
  socket listen {
    master {
      path = /var/run/dovecot/auth-master
       mode = 0600
       user = vmail
    }
    client {
      path = /var/spool/postfix/private/auth
      mode = 0660
      user = postfix
      group = mail
    }
  }
}</code></pre>

<p>Settings for plugins:</p>

<pre><code>plugin {
  quota = maildir:User quota
  quota_rule = *:storage=1048576
  quota_rule2 = Trash:storage=102400
  trash = /etc/dovecot/trash.conf
}</code></pre>

<p>Now create the files used in dovecot.conf. First create sql.conf, it's used to read username and password information from the postfix admin database. Basically the file just contains 2 <span class="caps">SQL </span>query for dovecot to execute.</p>

<p>Remember to change the database, username and password according to your setup.</p>

<pre><code>driver = mysql
connect = host=localhost dbname=postfix user=dovecot password=password
default_pass_scheme = md5-crypt

user_query = SELECT '/home/vmail/%u' as home, 'maildir:/home/vmail/%u' as mail, 5000 AS uid, 12 AS gid, concat('*:storage=', quota, 'M') AS quota_rule FROM mailbox WHERE username = '%u' AND active = '1'

password_query = SELECT username as user, password, '/home/vmail/%u' as userdb_home, 'maildir:/home/vmail/%u' as userdb_mail, 5000 as userdb_uid, 12 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'</code></pre>

<p>Create trash.conf.</p>

<pre><code>1 Spam
2 Trash</code></pre>

<p>There are lots of tutorials on generating <span class="caps">SSL </span>certificates, so I'm not going to repeat the whole process here. You can run the command below and set postfix to use the same ones:</p>

<pre><code># openssl req -new -x509 -nodes -out /etc/pki/dovecot/certs/dovecot.pem -keyout /etc/pki/dovecot/private/dovecot.pem -days 3650</code></pre>

<p>Creating your own CA (for postfix):</p>

<pre><code># openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650</code></pre>

<p><strong>Configure Postfix</strong></p>

<p>Ok, here is my postfix setup:</p>

<pre><code>broken_sasl_auth_clients = yes
home_mailbox = Maildir/
invalid_hostname_reject_code = 554
mail_owner = postfix
multi_recipient_bounce_reject_code = 554
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
myhostname = mail.example.com
mynetworks = 127.0.0.0/8
non_fqdn_reject_code = 554
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.5.6/README_FILES
relay_domains_reject_code = 554
sendmail_path = /usr/sbin/sendmail.postfix
smtp_tls_note_starttls_offer = yes
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
smtp_use_tls = yes
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, check_helo_access hash:/etc/postfix/helo_access, permit
smtpd_recipient_restrictions = reject_invalid_hostname,            reject_unknown_recipient_domain, reject_unauth_pipelining, permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_rbl_client cbl.abuseat.org, reject_rbl_client rabl.nuclearelephant.com, reject_rbl_client bl.spamcop.net, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_local_domain = 
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
unknown_address_reject_code = 554
unknown_client_reject_code = 554
unknown_hostname_reject_code = 554
unknown_local_recipient_reject_code = 554
unknown_relay_recipient_reject_code = 554
unknown_virtual_alias_reject_code = 554
unknown_virtual_mailbox_reject_code = 554
unverified_recipient_reject_code = 554
unverified_sender_reject_code = 554
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:12
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 51200000
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000</code></pre>

<p>Now let's create the sql query files for postfix.</p>

<p>Create mysql_virtual_alias_maps.cf</p>

<pre><code>user = postfix
password = password
hosts = localhost
dbname = postfix
table = alias
select_field = goto
where_field = address</code></pre>

<p>Create mysql_virtual_domains_maps.cf</p>

<pre><code>user = postfix
password = password
hosts = localhost
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and backupmx = '0' and active = '1'</code></pre>

<p>mysql_virtual_mailbox_maps.cf</p>

<pre><code>user = postfix
password = password
hosts = localhost
dbname = postfix
table = mailbox
select_field = maildir
where_field = username</code></pre>

<p>To enable smtpds for outgoing mail server, you need to edit <code>/etc/postfix/master.cf</code>. Just uncomment the following lines:</p>

<pre><code>smtps     inet  n       -       n       -       -       smtpd
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING</code></pre>

<p>Then add the following at the end of the file for dovecot to deliver mails into users' inboxes:</p>

<pre><code># Dovecot LDA
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:mail argv=/usr/libexec/dovecot/deliver -d ${recipient}</code></pre>

<p><strong>Configure RoundCube Mail</strong></p>

<p>First, install all the dependencies that roundcube mail need.</p>

<p>To begin the setup, just browse to <code>http://localhost/roundcubemail/</code> and follow the instructions there. However, there are certain things need to be edited manually after the 2 configuration files are generated. Since we're using Maildir style inbox, we want to let RoundCube Mail know that.</p>

<pre><code>$rcmail_config['imap_root'] = 'INBOX';
$rcmail_config['imap_delimiter'] = '.';</code></pre>

<p>And set this too so that RoundCube Mail creates all the necessary folders for us:</p>

<pre><code>$rcmail_config['create_default_folders'] = TRUE;</code></pre>

<p><strong>Install Postfix Admin Patch for RoundCube Mail</strong></p>

<p>Download the patch <a href="http://nejc.skoberne.net/projects/rcpfa/">here</a></p>

<p><span class="caps">RCPFA </span>patches roundcube mail so that it can modify the database that Postfix Admin uses. Extract rcpfa to the root directory of roundcube mail. Then move into the rcpfa directory.</p>

<pre><code># chmod +x INSTALL.TXT
# ./INSTALL.TXT</code></pre>

<p>Then edit the config files of roundcube mail to change database login info.</p>

<p>That's it.</p>]]></description>
            <link>http://miphol.com/muse/2009/06/setting-up-a-lightweight-mail.html</link>
            <guid>http://miphol.com/muse/2009/06/setting-up-a-lightweight-mail.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Linux</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Web Development</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">fedora</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">linux</category>
            
            <pubDate>Thu, 11 Jun 2009 19:38:32 -0500</pubDate>
        </item>
        
        <item>
            <title>Subclassing UITextView</title>
            <description><![CDATA[<p><span class="caps">MPT</span>extView is a subclass of <span class="caps">UIT</span>extView with just one little extra function: pass in a criteria to determine if the delegate method (handleTouchEvent) should be called or not. Feel free to use it in whatever way you want.</p>

<p>Don't forget to set the delegate. Read the header file for more information.</p>

<p>Download <a href="http://www.miphol.com/muse/2009/05/09/MPTextView.zip"><span class="caps">MPT</span>extView.zip</a></p>]]></description>
            <link>http://miphol.com/muse/2009/05/subclassing-uitextview.html</link>
            <guid>http://miphol.com/muse/2009/05/subclassing-uitextview.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">iPhone Dev</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">iphone sdk</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">objective-c</category>
            
            <pubDate>Sat, 09 May 2009 22:56:41 -0500</pubDate>
        </item>
        
        <item>
            <title>Email/SMS template app</title>
            <description><![CDATA[<p>Currently I am working on an iphone app that lets user create templates, and when it's time to send an email or <span class="caps">SMS, </span>the user can select a template, fill out some fields (or check some check boxes), and send it.</p>

<p>The template accepts text variables and expressions. Expressions are infix expression with the option of parenthesis, which are calculated upon sending the actual email or <span class="caps">SMS.</span></p>

<p>The app is still in an alpha status, so there are many features that I cannot disclose just yet.</p>

<p>The template would look like this:</p>

<pre><code>Happy New Year, {@name}!</code></pre>

<pre><code>{{{#Number Of Products}*{#Product Price}*(1+{#Sales Tax})+{#Shipping Fee}}}</code></pre>]]></description>
            <link>http://miphol.com/muse/2009/04/emailsms-template-app.html</link>
            <guid>http://miphol.com/muse/2009/04/emailsms-template-app.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">iPhone Dev</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">iphone apps</category>
            
            <pubDate>Tue, 21 Apr 2009 18:01:59 -0500</pubDate>
        </item>
        
        <item>
            <title>Clear Crash Logs of iPhone</title>
            <description><![CDATA[<p>This afternoon I noticed, for the first time, that I have 757 crash logs on the iPhone I use for development, great. Here is a very simple way to delete all of them in 2 steps:</p>

<ul>
<li>Disconnect the iPhone from your computer. Quit XCode, too. </li>
<li>The path to crash logs for iPhone (and iPod Touch) is: <code>/Users/user/Library/Logs/CrashReporter/MobileDevice</code>. To clear all crash logs, simply deleted everything inside that folder.</li>
</ul>]]></description>
            <link>http://miphol.com/muse/2009/03/clear-crash-logs-of-iphone.html</link>
            <guid>http://miphol.com/muse/2009/03/clear-crash-logs-of-iphone.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">iPhone Dev</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">iphone</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">xcode</category>
            
            <pubDate>Sun, 22 Mar 2009 17:03:44 -0500</pubDate>
        </item>
        
        <item>
            <title>Flash-Me Screenshots</title>
            <description><![CDATA[<p>Latest project from Miphol Studio—here are some quick screenshots of Flash-Me, an iPhone flash card app that syncs with <a href="http://cramberry.net">Cramberry</a>. Currently the app offers 3 study modes, supports tagging decks, and more...</p>

<p><img src="http://miphol.com/muse/2009/03/18/Flash-Me-demo1.png" alt="" /></p>

<p><img src="http://miphol.com/muse/2009/03/18/Flash-Me-demo2.png" alt="" /></p>

<p><img src="http://miphol.com/muse/2009/03/18/Flash-Me-demo3.png" alt="" /></p>]]></description>
            <link>http://miphol.com/muse/2009/03/flash-me-screenshots.html</link>
            <guid>http://miphol.com/muse/2009/03/flash-me-screenshots.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Miphol Studio</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">iPhone Dev</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">iphone apps</category>
            
            <pubDate>Wed, 18 Mar 2009 08:45:01 -0500</pubDate>
        </item>
        
        <item>
            <title>iPhone Color Profile</title>
            <description><![CDATA[<p>For a quick and easy way to preview what the colors would look like on iPhone in Photoshop, set the color profile to Apple <span class="caps">RGB.</span></p>

<p><img src="http://miphol.com/muse/2009/03/10/AppleRGBProfile.png" alt="" /></p>]]></description>
            <link>http://miphol.com/muse/2009/03/color-profile-on-iphone.html</link>
            <guid>http://miphol.com/muse/2009/03/color-profile-on-iphone.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Design</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">iPhone Dev</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">iphone</category>
            
            <pubDate>Tue, 10 Mar 2009 18:49:03 -0500</pubDate>
        </item>
        
    </channel>
</rss>
