tips

tmux.conf file not working?

If you updated your .tmux.conf file and find that it is not working, perhaps you have existing tmux session running. You need to exit all tmux sessions so that a new tmux server will start and (re)read the updated .tmux.conf file.

If you do not want to stop all tmux sessions, you can also issue the source-file command either from within tmux or use tmux at the command line.

 

# see what other tmuxes are running
ps -ef | grep tmux

# if control-b is your tmux prefix key, type:
c-b : source-file ~/.tmux.conf

# or at the command line:
tmux source-file ~/.tmux.conf

 

 

Squarespace has a URL formatting problem

I really like Squarespace. Their support of many of my favorite podcast (penaddict, ATP) helps. I have started to recommend and use Squarespace for many of my nonprofit websites (Fiske School PTO). Recently I started to convert some of my other blogs (loftykids.org) over. Immediately I run into a big problem. When Squarespace import (or create) a blog, it requires the blog entries to live under a suffix within the site's URL scheme. For example, the default suffix is "blog". This means all the blog entries will be of the form:

http://mydomain.com/blog/2013/01/fancy-title-1
http://mydomain.com/blog/2013/02/fancy-title-2
... etc ...
http://mydomain.com/blog/2013/02/fancy-title-n

There is no way to not have the /blog/ or /anything/ suffix, for example the following URL is not possible:

http://mydomain.com/2013/01/fancy-title-1

Currently most blog based website removes the suffix and use some sort of date notation only in the URL. The site of Matt Mullenweg, founding developer of Wordpress, is a good example. Squarespace however cannot serves blog pages using this convention.

URL Mapping

Squarespace does have a URL mapping settings, where you can map one URL to another. However the mapping is a literal mapping. It does not support wildcard. i.e. you have to manually enter each page name. So you have to create a long list of URLs and issue permanent redirects for them one by one using this setting option. This is the only solution.

Customer Service

Squarespace always have great customer support. They respond to email or chat inquiries very quickly. This time is no different. I have to give kudos to the customer service reps that handle my inquiry regarding this bug. Stephanie D took my issue and spent a lot of time trying to get a definitive answer to whether this can be avoided with their tech team.

 

Amazon shuts down Special Occasion Reminder, adding birthday to address app in OSX

I received an email from Amazon at 3 am EST this morning telling me that they are shutting down the Special Occasion Reminder service. They are converting these reminders to their (new?) Friends & Family Gifting service. I understand that they are trying to encourage people to buy things from Amazon for these birthdays as gifts, but do they have to externally rename the service? If you have been a long time Amazon customer like myself, some of the very old reminder setup did not have a marker to say that the reminder is for a birthday. Those older reminders will not be converted. What to do? I can add those reminders back to the new service, or I can add the birthdays to my address book database on my Mac. I updated my address book on the Mac. This is how:

Adding Birthday field to the Address book app on the Mac

  1. Go to the Preferences menu
  2. Click on the Templates button
  3. Click Add Field and select Birthday
  4. Voila ! Each contact in the address book now has a birthday field

 

Aperture stopped importing photo from Photostream

Did you find that suddenly Aperture stopped automatically import photos from your photostream? This is a bug in Aperture, as of version 3.3.1 I found. If you have more than 1000 photos in the Photostream imported into Aperture, Aperture will stopped importing any new photos. One more time: Aperture misunderstood the 1000 photo limits that Apple is suppose to have for Photostream. The correct way for this to work is that Apple will discard older photos and keep the most recent 1000 photos in the stream. But Aperture instead stopped importing after 1000.

Solution:

  1. Go to the photostream meta project on the side menu/explorer
  2. (Assuming you have already imported the older photostream pictures) select the older photos and delete them "from photostream" using either command-delete or right mouse click then select "delete from photostream".
  3. Then newer photos will automatically start being imported again.

Photo Stream "Album":

See Count at bottom:

How to Adjust IKEA SAVERN Shower Curtain Rod

I do not buy spring loaded shower curtain rod too often so I often forget how to install and adjust one. After the move I bought a IKEA Savern show curtain rod and for a few minutes cannot figure out how to adjust the length. Then it came back to me. You just PULL. There is a lot of built in resistance inside the rods to keep them attached. You just have to pull really hard to extend the rod until it is just a little longer than what you need. Another tip: If you ended up pulling the two rods apart, make sure you insert the smaller rod back into the larger rod spring side last. The spring at the end of the smaller rod is supplying the tensions.

Moving Tips 2012

123-2321_IMG
123-2321_IMG

I moved so many times that I wrote up some moving tips on the web in 1996. You can read the old version there. This is an update version, ready for our next moving to the suburbs: According to some studies, moving is the second most stressful thing in life. Here are some tips for moving:

  1. Throw out all the stuff that you don't need months before you even found the new house. Most of our time is actually spent on this part. It is hard, but do it. (Optional) Watch any of the hoarders TV shows for inspiration.
  2. Buy more boxes then you think you need. You can always freecycle them afterwards. U-Haul has an "unused box return deal", but I have never managed to figure out how it actually works.
  3. Buy large clear plastic boxes for packing heavier items or for items that you want to keep dry. You can end up using these for putting items in storage as well. We buy the large ones from Costco.
  4. Pack to unpack. If you are to take away one tip, this is it. Come up with a numbering system for each room and area in the new house. Pack items so that each complete box contains items that are destine for one room. Label that box with the number. Your movers will love you, and you just cut unpacking time in half. I put blue or white masking tape on the boxes, and write "(1) Kitchen", or "(6) Bedroom" etc on them.
  5. Label and/or map all your computer and audio/video cables so that you can quickly plug everything back together.
  6. Plan furniture placement before the move. Asking the movers to rearrange furniture over and over waste time and money. I (being a amateur architect of sort) create a site plan of the new home and lay it out on floor planning software before the move.
  7. Give the movers clear instruction, and let them do their work. Do not have unnecessary family members around to give contradicting directions.
  8. Make sure the showers are working great in the new house before the move. Bring a personal care kit with you. It is nothing more annoying then not being able to at least relax and clean up while unpacking.

Upgrading iThoughtsHD to use Dropbox Cloud Sync

iThoughsHD is one of my favorite iPad application. I tell people: when I need to create a mindMap, I will use iThoughtsHD on the iPad rather than to use any desktop applications even when I am sitting at my desk with my MacbookPro. I was really happy when iThoughtsHD v3.0 adds full Dropbox syncing support. Before I used to have to manually save each map to my dropbox folder. When 3.0 is released, there seems to be some bugs and I waited for the next release, 3.1 to upgrade. In short, the new syncing works. But for users like myself, who has already saved a few maps to dropbox, the upgrade setup is not as easy as it sounds. Making it worst is that the instructions on the iThoughtsHD website is confusing. So here are my version of the upgrade instructions:

Instructions to Upgrade to Dropbox

Important: This instructions is for iThoughtsHD users who is already using Dropbox, on a per map basis, to save/backup some maps. The instructions are in several parts:

* Disclaimer: Please read these instructions and try to understand what is going on before attempting to change your maps. You should back up all your maps once before attempting this * Backup instruction (via archive) here.

Part 1: Follow instructions from iThoughtsHD to Creating a Cloud folder (your maps are already in the cloud)

Original instructions on their page, but here are more detailed version:

  1. Click on the "Forward/Action" icon forth on the left
  2. Select ‘New Cloud folder’
  3. Select an existing storage provider  (DropBox if you already are backing up to DropBox)
  4. Select the formats you wish to sync (ideally select ITMZ as one of the formats as this gives you a good backup option), optionally click PDF as well so you will have a printable copy
  5. Browse to the folder in the cloud where your maps reside and choose ‘Use this Folder’
  6. Select ‘Create’. This will enumerate all the maps and folders and download them.

Note: At this point you would have created a "(Dropbox)ithoughts" folder that is automatically syncing (which is good). However, it would have downloaded any maps that are already backed up to that folder. i.e. you have duplicate maps but pointing to a single file on dropbox.

Part 2: Cleanup the duplicate but do not delete them (This is the part that is missing)

We need to first delete all duplicate map references that you had backed up before. Now they exists in two folders on your iPad. Follow these instructions to remove the references that are not in the synced folder, for each of these already backed-up maps. Make sure you are deleting the right maps. These maps should already have a "cloud" icon on the right because they were backed up to the cloud.

  1. click on the map button on the top left (looks like a book)
  2. click [edit] on the top right inside the pop-up list of maps -- this will bring you to the map edit view, where next to each map you will see a delete icon on the left, and a more [>] icon on the right.
  3. click on the delete icon on the left.
  4. When it ask you to "delete cloud copy", click cancel (IMPORTANT)
  5. This will remove the extra copy referenced outside of your now synced folder.

Part 3: Move the rest of the maps that were not backed up before into the synced dropbox folder

Do this for each remaining map:

  1. click on the map button on the top left (looks like a book)
  2. click [edit] on the top right inside the pop-up list of maps -- this will bring you to the map edit view, where next to each map you will see a delete icon on the left, and a more [>] icon on the right.
  3. click on the more icon [>], you will see a folder (probably Maps) showing on the bottom, with it's own more [>] icon
  4. click on the more [>] icon, this will let you change the storage (now syncing) location of this map
  5. change the map folder location to the (Dropbox)... folder that was selected earlier, where you are storing and syncing all your maps.

At this point all your maps are in the (dropbox)ithoughts folder. Remember to create any new maps in that folder (or sub folder underneath) going forward.

mysql installation on ubuntu failed

We often use wordpress as the CMS for our application's public site. That means we have to install mysql on our rackspace servers. Today the installation process failed several times, with this error message in syslog.

Error:

[shell]

ERROR: 1064  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE user ADD column Show_view_priv enum\('N','Y') CHARACTER SET utf8 NOT ' at line 1

[/shell]

I first try to uninstall and reinstall sqlserver but it will not uninstall cleanly. Finally I have to both use apt-get and manually remove some directories to get back to a clean install:

[shell] apt-get purge mysql-server apt-get purge mysql-common rm -rf /var/log/mysql rm -rf /var/log/mysql.* rm -rf /var/lib/mysql rm -rf /etc/mysql # and then: apt-get install mysql-server --fix-missing --fix-broken [/shell]

Then I get a clean (re)install of mysql and it started up.

How to Change Colors for ls command in xterm

I like to us a dark background on my ssh terminal. On WebFaction, their terminal environment is setup to output colors on commands like "ls". That is great except the default directory names ended up in blue, which is impossible to read on a black background.

There is a easy way to fix this:

  1. copy the system default color settings from /etc/DIR_COLORS into your home directory and name it .dir_colors
  2. edit your copy of .dir_colors file to change the colors.
  3. For example, I change it to white:

[code]

cp /etc/DIR_COLORS ~/.dir_colors

# than change this line from DIR 01;34    to: DIR 01;37       # directory

[/code]

Original Screen:

Modifier keys not working in Lion for External Keyboard

Lion Tip of the Day:

As a emacs user, I always change the caps lock key on my Mac keyboards to "Control". This is in fact a nice built in feature since Leopard. However today I docked my new MacBook Pro for the first time and the Caps Lock key on my external aluminum keyboard (USB) does not send the new modifier key.

Turned out this is a feature. In Lion, you can select different modifier key actions for different keyboards. There is a new dropdown at the top. Select external keyboard and update the modifier key.

How to clean up your gmail account

I glanced down at the bottom on my gmail account. My mailbox is 30% full, almost 3G. While I have a very long way to go before the account become 100% full, the organized part of me just want to clean things up!

If you want to delete very old emails in GMail, use this search filter:

is:unread before:2011/01/01

This will return all mail that is unread and older than Jan 1st of 2011. I actually add in additional filter, as I organize most of my emails by label. So since I follow a large email list call "python", I can select and delete all the emails from that list by adding label:python to my search criteria. Noting that I created a automatic filter to label all emails from that mailing list with the label "python".

How to use the new iOS4.3 HomeSharing on your iPhone

With the new iOS4.3 firmware, HomeSharing finally work nicely across all device. This is particularly important if you have an second generation AppleTV in your home network. Will all the new sharing feature you can do two really cool things:

  1. You can finally show any video or pictures from your iPhone on your AppleTV, especially photos and video from your camera roll on the phone. Isn't this the normal use case? You took some pictures of the kids, and when you are at Grandma's house, you can now beam the pictures onto their LCD TV seamlessly. (You did buy the grandparents an AppleTV, didn't you?)
  2. You can, via HomeSharing, listen to any music on your home iTunes library on your iPhone/iPad. Typically in a house hold, you will have most of the shared music and video sitting on an iMac. Now you can listen to any music from there remotely.

How to enable HomeSharing on your phone? There are actually TWO different settings. Go to "Settings / iPod" and enter your Apple ID for sharing. Then you can stream music from any iTunes library on your home network to the iPhone/iPad.

Secondly you can also enable Home Sharing on the Remote app. (you did download that didn't you?) Enter your Apple ID there, then it will automatically find any iTunes library on your network without you having to manually link the remote app to the library.

Tip: The remote app now also can control the AppleTV user interface!

Django Tip: No leading slash for upload_to for FileField and ImageField

This is a common mistake. When defining a FileField or an ImageField, you need to specifywhere the files are stored. This is done by specifying a relative path in the upload_to argument. Django will then store your files in a subdirectory as named, under the MEDIA_ROOT directory. But, don't put a leading slash in the relative path. Otherwise it will try to store the file at the system root directory.

MEDIA_ROOT = '/home/myname/files/ upload_to='pictures' file: abc.jpg results in: /home/myname/files/pictures/abc.jpg

But

MEDIA_ROOT = '/home/myname/files/ upload_to='/pictures' file: abc.jpg results in: /pictures/abc.jpg

Also a side tip: You can add strftime style arguments to the upload_to argument, storing the files in dated sub directory. e.g.

MEDIA_ROOT = '/home/myname/files/ upload_to='/pictures/%Y/%b/%d' file: abc.jpg results in: /pictures/2008/May/09/abc.jpg

Django Tip: Outputting list of items separated by commas, but only if it has more than one item

How many times do you need to do this? You have a list of things to output. The list can be empty, has one element, or more. You want to separate each items with a separator for readability. What do you do? 1. The simple but not reader friendly way:

toppings = [ 'cheese','tomatos','pineapple' ] or toppings = ['cheese']

{% for t in toppings %} {{ t }} , {% endfor %}

that will output: cheese, tomatos, pineapple, or

cheese,

Note the ugly trailing comma.

2. This is the smart way using the template variables available in loops:

{% for t in toppings %} {% if not forloop.first %}, {% endif %} {{ t }} {% endfor %}

that will output: cheese, tomatos, pineapple or

cheese No more trailing commas, thanks to the built in forloop variables.