Issues Synching Amazon Kindle Notes and Highlights to iPhone

The Issue

I don’t mind reading Amazon Kindle books on my iPhone, but sometimes a bigger screen is nice. Thankfully Amazon has Kindle apps for PC, Mac, iOS, Android, etc. The issue I’m having is that my notes and highlights don’t usually sync correctly from Kindle for Mac to Kindle for iOS.

I tried manually synching, but that just seems to push the furthest read page rather than notes and bookmarks. I tried all the combinations you can imagine in terms of the order in which I open the app on the two devices. No success.

The Fix

What I ended up having to do is archive the item on my iPhone and then re-download it to get the correct set of notes and highlights. My guess is that it’s a bug in the iOS app.

Anyone else having this issue and figured out a different work-around?

Share

Caching With Zend Framework Using Zend_Cache

Cheeks Blowing

Today I taught myself how to use Zend_Cache and implemented it within 20 minutes. It’s super easy and very effective. Take a look at the code sample below and you’ll be up and running in no time.

 

Step 1: Setup the Cache
{code type=php}
$frontendOptions = array(
‘lifetime’ => 180, // Cache for 3 minutes
‘automatic_serialization’ => true
);

$backendOptions = array(‘cache_dir’ => dirname(__FILE__) . ‘/cache/’);

$cache = Zend_Cache::factory(
‘Core’,
‘File’,
$frontendOptions,
$backendOptions);
{/code}

Step 2: Use the Cache
{code type=php}
$data = null;
if(!$data = $cache->load(‘data’))
{
$service = new Service(API_KEY);
$result = $service->generateReport();
$data = $service->getReport();
$cache->save($data, ‘data’);
}
else
{
print(“Cache Hit!”);
}
{/code}

The page load time went from about 9 seconds to 0.5 seconds! 18x faster and it only took a few lines of code. Awesome.

My main motivation for caching the data ($data in the code example) was actually to reduce the load on the web service which provides the data. We have a good relationship with the company providing the service but there’s a good chance they would become annoyed if we hammered their system to get the exact same data over and over. The load time improvement was a good side effect, though!

For more information on Zend_Cache which comes with the Zend Framework, check out the reference guide and API documentation.

Share

How to backup your website

Hard Drive in Flames

Everyone knows (or should by now) that cheap web hosts (Bluehost, Dreamhost, MediaTemple, etc.) don’t backup your data for you. So you’d better do it yourself. If you’re on any respectable host, you should have ssh access to the box.

Connect to your box via ssh and run the following commands to create a backup of your site.


cd ~
mkdir Backup
nohup zip -r Backup/YYYY-MM-DD-HHMM.zip www/ > backup_log.txt &

(Replace YYYY with the 4-digit year, MM with the 2-digit month, HH with the 24-hour format of the hour, and MM with the 2-digit minute)

cd ~ navigates to your home folder

mkdir Backup creates the backup directory in which the backups will be stored

nohup is short for no hangup and allows processes started by users at the terminal to continue running even after the user logs out

zip is a program which combines many files into one and compresses them to make the end result even more portable

-r tells zip to burrow into all subdirectories in order to grab all of the files

Backup/YYYY-MM-DD-HHMM.zip is the path to the backup file

www/ is the directory to backup (it may be html, htdocs, httpdocs, etc. on your box)

> backup_log.txt redirects all output from zip to the backup_log.txt file so you can review the file later

& tells linux to run the zip program in the background so that you can logout or perform other tasks without killing the process

Now all you need to do is download that zipped file. Use your favorite SFTP client to login to your box and snag it. I recommend FileZilla Client for all platforms. If you’re looking for an FTP server, FileZilla Server is perfect.

Share

How do you watch your television shows?

Old TV Set

Midway through Heroes: Season 3 I realized how quickly video streaming technology has evolved in the last few years. Think about the multitude of ways you can now get your fix.

EDIT:
Loren brought to my attention another category which I left off entirely, which is software/hardware combos for consuming the aforementioned services:

Just 15 years ago that list was a lot smaller: TV, video rental stores, VCR.

What’s your favorite viewing service?

Share