The Problem With E-mail Apps

A few weeks ago I ran across an article on The Verge titled “The best Gmail app for the iPhone is now made by Microsoft”. The article talks a lot about the new Microsoft Outlook app (a rebranding of the recently purchased Acompli app), but there was one quote that really stuck out to me:

…nobody wants to just give me an email client for my phone: everyone’s gunning to reinvent the entire experience and revolutionize the speed and efficiency of my communications.

That quote really summarizes my frustration with all these new e-mail apps. I don’t need someone to “reinvent” my e-mail experience. I don’t want to turn my e-mail into a to-do list. I just need someone to make an e-mail app that does e-mail well.

I did end up trying the new Outlook app for iPhone and still found it to be lacking in one major area: it seems to only be able to add one label per message, much like standard folders. The whole point of Gmail having labels instead of folders is so that messages can have multiple labels and thus can be found in multiple locations. Oh well, the search for a good e-mail app continues.

An Event Apart Orlando: Special Edition 2014

My notes from An Event Apart Orlando: Special Edition 2014 at Disney’s Contemporary Resort in Walt Disney World.

Continue reading An Event Apart Orlando: Special Edition 2014

Messages History Location

At some point Apple decided to remove the option in the Messages app to choose the location to save chat history. Ever since that change, I always seem to forget where my chat history is saved. Here is where chat history is now stored:

~/Library/Containers/com.apple.iChat/Data/Library/Messages/Archive

Update

The location of the Messages history has moved in Yosemite. Here is the new location:

~/Library/Messages

That directory contains the Messages chat history, as well as all attachments.

Testing Mobile Sites Locally with xip.io and MAMP

Update: I wrote these instructions using MAMP PRO 2, and I just noticed that it looks like version 3 has some kind of xip.io support built in.


Testing mobile websites locally can be done by simply resizing the browser window on your computer, but sometimes you just want to test the experience on an actual mobile device. One of the easiest ways I’ve found to do this is to use xip.io, a service created by 37signals. What is xip.io?

xip.io is a magic domain name that provides wildcard DNS for any IP address.

This allows you to have a real domain to use for each of your local virtual hosts. If you use MAMP PRO for local development, this service makes it super easy to test each of your sites on mobile. To do this, check out the instructions below.

Note: I think this will only work with MAMP PRO, because you need access to the virtual hosts feature. Also, your computer and mobile device(s) will need to be on the same local network.

Instructions

  1. Set up your project in MAMP just like normal.
  2. Get your local IP address. In OS X, you can do this by opening “System Preferences” and selecting “Network”. Under the “Status” on your connected network device, it will show your IP address. Be aware that if your router uses DHCP to assign IP addresses, the address may change after rebooting or reconnecting your computer.
  3. Now go to the “Hosts” tab, and select the virtual host that you would like to test. There is an “Aliases” box under general settings. Add a new xip.io alias using your local IP address. For example, if you have a project called “mysite” and your IP address is 10.0.0.1, you would enter something like this:
     mysite.10.0.0.1.xip.io
    
  4. Now open the address you set as your alias in a browser on your mobile device.

That’s all there is to it. Now you can test your full site locally from any other device on your local network. I’ve also found this method helpful for sharing my current progress with co-workers in my office. This is a really great solution for testing on multiple devices without having to push code up to a server.

Accessing Drupal Site Name and Menus in Templates

When I am creating a custom Drupal site, I like to hard code a few things into the templates, such as the site name and menus. This prevents the client from doing something like accidentally moving the menu blocks into a different region, and it also gives me more control over the HTML markup.

In Drupal 7, there are two ways that I have found to access this system data within the templates. I am going to walk through an example of each method in which I will add the following elements to my page.tpl.php template file:

  • My site name
  • The main menu
  • A custom menu named “Secondary menu” (which has a machine name of “menu-secondary-menu”)

Method 1

The first method involves setting up some variables in the template.php file and then accessing those variables in the page.tpl.php file.

In the template.php file:

function newhopeks_preprocess_page(&$variables) {
    $variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Default Site Name'));
    $variables['main_menu'] = menu_main_menu();
    $variables['secondary_menu'] = menu_navigation_links('menu-secondary-menu');
}

In the page.tpl.php file:

<h1><?php print $site_name; ?></h1>
<?php
    print theme('links__system_main_menu', array('links' => $main_menu));
    print theme('links__menu_secondary_menu', array('links' => $secondary_menu));
?>

Method 2

The second method bypasses the template.php file and accesses the data directly.

In the page.tpl.php file:

<h1><?php print filter_xss_admin(variable_get('site_name', 'Default Site Name')); ?></h1>
<?php
    print theme('links__system_main_menu', array('links' => menu_main_menu()));
    print theme('links__menu_secondary_menu', array('links' => menu_navigation_links('menu-secondary-menu')));
?>

Related Resources

Mysqldump on DreamHost

Here’s another DreamHost tip, this time for using mysqldump to export a MySQL database. You could always use phpMyAdmin to export a database, but there are times when the mysqldump command is either easier, better, or in my case when I had an extremely large database, the only option.

DreamHost has a mysqldump page in their wiki that explains how to set up a mysqldump script as a cron job, but I wanted to run this as a standalone command. Here is what I came up with:

mysqldump -c -h [domain] --user [user] --password=[password] [database] > [filename]

Note: Any of the values needed for this command can probably be found on the “MySQL Databases” section under the “Goodies” menu item in the DreamHost control panel.

  • [domain] is the hostname associated with the database you are wanting to export.
  • [user] is a user with access to the database.
  • [password] is the password for the user.
  • [database] is the name of the database.
  • [filename] is the name of the file you would like to save from the export, ending in .sql. You can put a file path in here as well. If you don’t supply a path, it will just save the file in your current directory.

Here is an example usage of the command:

mysqldump -c -h mysql.mydomain.com --user myuser --password=mypassword mydatabase > mydatabase.sql

PHP Settings on DreamHost

Recently, I needed to make some modifications to the PHP.ini settings on a shared DreamHost server. Specifically, I needed to increase the file upload size limit (the default was only 7 MB) and increase the PHP memory limit a bit. This turned out to be much easier than I expected.

Changing the PHP.ini settings on a shared server works by creating a phprc file for each version of PHP you want to alter. Any settings in the phprc file will override the ones in the PHP.ini file. Any settings not specified in the phprc file will default to the server PHP.ini file.

The following steps have been pulled out of the PHP.ini page in the DreamHost wiki. Read this page if you’re curious about any limitations that this method might have.

  1. Determine which PHP version your website uses. The easiest way to do this is to login to your DreamHost panel, navigate to the “Manage Domains” section, and click edit next to the domain. On the edit page, you will be able to see the PHP version that has been selected for that domain.
  2. Open a terminal and SSH into your DreamHost server.
  3. Create a new directory in your user home directory that will store a phprc file with custom PHP.ini settings. For PHP 5.3 run this command:
    mkdir -p ~/.php/5.3
    

    or for PHP 5.4, run this command:

    mkdir -p ~/.php/5.4
    
  4. Inside your newly created directory, add a phprc file by running this command:
    touch phprc
    
  5. Edit the phprc file to add your custom settings. At this point, I find it easier to just SFTP into the server and edit the file. Just make sure you have your “view hidden files and folders” option turned on.
  6. Add your custom settings. For an example, here are the settings I added to increase file upload and memory limits:
    upload_max_filesize = 64M
    post_max_size = 64M
    max_execution_time = 500
    max_input_time = 500
    
    memory_limit = 128M
    
  7. Force PHP to reload. To do this, run the following command for PHP 5.3:
    killall php53.cgi
    

    or run this command for PHP 5.4:

    killall php54.cgi
    

That’s it! Your custom PHP.ini settings should now be in effect.

EditorConfig

I just used EditorConfig for the first time on a project, and it seems like something that will be very useful, especially for team development. What is EditorConfig? Here’s the description from the website:

EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs.

EditorConfig allows you to specify the type and size of tabs used on a project, as well as things like character set and line endings. In a supported editor1, the rules specified in the .editorconfig file will execute when saving the file, making sure the formatting of the file is consistent. It even allows you to configure file extensions separately for languages that have specific requirements that may differ from your default settings.

Using EditorConfig eliminates the need to modify your editor preferences when switching between projects. For example, I’ve always preferred hard tabs, but everyone on my team at work uses soft tabs. You can just add the .editorconfig to a git repository, and everyone who works on the project can be using consistent formatting.

Here is my current .editorconfig file:

# EditorConfig (http://editorconfig.org)

# Set this as the root EditorConfig file
root = true

# Default settings for all files
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

  1. My editor of choice has been Coda for the past couple years, but it does not yet have EditorConfig support. I’ve been trying out a few other editors, including TextMate and the new GitHub Atom editor. You can find a list of supported editors on the EditorConfig website. 

iTunes MiniPlayer in Full Screen Mode

When using iTunes, I often like to have the app running in full screen mode so that it doesn’t clutter my desktop. When I do this, I also like to have the MiniPlayer open so that I can easily change songs without switching back to the main iTunes window.

Just switching to the MiniPlayer will hide the main window, but I would like to have open at the same time. I found some instructions on how to do this, but I am noting the steps below as I’ve had trouble accessing that page in the past.

  1. Exit out of full screen mode.
  2. Set iTunes to show on all desktops by right clicking (or control + click) on the iTunes icon in the dock and selecting “All Desktops” under the Options menu.
  3. Open the MiniPlayer from the Window menu at the top of the screen.
  4. Enter full screen mode by clicking the full screen button at the top right of the main iTunes window (also found under the View menu).