dfbills.com blog

Putting AddressBook Smart Groups on the iPhone

iPhone really needs a search mechanism.  I’ve used mine since launch day and one thing I really do miss from my BlackBerry is simple contact search. 

My iPhone has over 3000 contacts and scrolling by letter takes too long.  A simple solution was to create some new groups in the Mac “Address Book.”  That was great, but why not use “Smart Groups?” 

I setup several Smart Groups and got ready to sync.  That’s when I found out that the iPhone cannot sync Smart Groups.  What a pain!

My solution was to write an AppleScript to copy from the Smart Group “Smart Restaurants” to a “Dumb Group” called “Restaurants” which can be synched to iPhone.

Here’s my script:  (saved to /Library/Scripts/)


—“Copy from Smart to Dumb.scpt”
— Description: Dumps Address Book Smart Groups to Dumb Groups
— by: David F. Bills 09.29.07

tell application “Address Book”
if not (group “Restaurants” exists) then
  make new group with properties {name:"Restaurants"}—Create our ‘hard’ Group if missing
end if
save addressbook
set smart_Rest to id of every person in group “Smart Restaurants”—This is the name of the Smart Group
set hard_Rest to id of every person in group “Restaurants”—This is the name of the ‘hard’ Group
repeat with sr in smart_Rest
  if hard_Rest does not contain (contents of sr) then add (every person whose id = sr) to group “Restaurants”
end repeat
save addressbook
end tell

Seems to be faster to run this from the shell script than in Script Editor and it makes sense to use osascript since I’m calling via Cron at 3am nightly.

0     3     *    *    *    osascript /Library/Scripts/Copy from Smart to Dumb.scpt

Now, I just need to do my daily sync first thing in the morning and I’m up to date.  Thanks to Craig Smith and Niel for their assistance.

comment on this | posted in: Mac Tips Troubleshooting

Blocking Chinese spammers

One of the sites I work on, Songwriter101, has been experiencing problems in the forums- Chinese drive-by spammers.  The forum moderators had been deleting posts for weeks by users called shoesnew, Hu, ch, shoeman and the like.  They were all posting about the same topic- deals on sneakers, athletic wear, etc.

My team was pulling out their hair.  “Of all things… why shoes?? Do these spammers think that songwriters have a thing for purchasing new shoes? I could understand if they were spamming guitar strings or something, but shoes???”

I asked if there were any good deals.. and then knew I had to deliver a solution.  After playing the cat and mouse game for some time with suspending the userids and banning the IPs, it was time for something more drastic.

A quick Google search pulled up a great site with complete IP blocks in several formats.  A bit of htaccess tweakery with the CIDR files and now, we’re Chinese spam-free! 

(I’m quite proud of the “error message.”)

From the moderators: “And… today is the first day all week of spam-free moderating. Thank you!!  ...enjoy the absence of sneaker ads.”

comment on this | posted in: Tips Troubleshooting Webdev

Set a custom css signature on your iPhone (updated 4x)

Last week I spent a stupid amount of time figuring out how to set a custom css signature on my iPhone after being ridiculed by a friend for my semi-default “Sent from my iPhone.” tagline.  In the spirit of sharing, I’ve written it up to spread the word.

First, you must have access to the filesystem on your phone.  If you’re on a Mac, I recommend Installer.app Beta.  It couldn’t be easier.  If you’re on Windows, check out Gizmodo’s guide.

Once installed, launch it on the iPhone and install two packages: BSD Subsystem and OpenSSH.  Get your iPhone’s IP address from Settings: Wi-Fi: Your Network: & Tap the arrow.

Now you can SSH into the phone.

ssh root@youripaddress

The password is “dottie”.  Once logged in, change your password using “passwd”.

Now, you can use SFTP with a FTP client like Transmit. Or even use a FUSE filesystem like MacFUSE with sshfs to mount it on your desktop.

At any rate, once you’ve decided how to access the filesystem, you need to copy this file to your Mac:

Firmware 1.0 - 1.1.3
/private/var/root/Library/Preferences/com.apple.mobilemail.plist

Firmware 1.1.4
/private/var/mobile/Library/Preferences/com.apple.mobilemail.plist

On my machine, I just hit command-J in Transmit and it opens in Apple’s Property List Editor (PLE).  This application is installed as part of Apple’s Developer Tools package.  The package comes with every Mac, but is not installed by default.  If you don’t have it, you can grab it from Apple’s developer site.

The reason I recommend PLE is that the plist file is a binary and not plaintext.  Erica Sadun has written an iPhone commandline tool called plist2text.  This is included in her EricaUtilies package in availble in Installer.app.  plist2text is supposed to be able to dump the binary file to a txt directly on the phone avoiding the need for PLE, but in my testing it corrupted the binary.

Once com.apple.mobilemail.plist opens in PLE, click the Root disclosure triangle and observe the SignatureKey value.  If this value is not present, go into iPhone’s Settings: Mail: Signature and change it to anything other than the default.  This should create the key value.

Now onto the design-

For the actual design, you will use html.  Being a CSS convert, I recommend using some tasteful, lightweight css code.  The signature itself is just html with CSS defined inline.  I created a valid xhtml page and used the body portion for mine.  Just take out the html, head and body tag sets.

Mine is simple, clean and designed for the small screen:

David F. Bills
http://dfbills.com
sent from my mobile

Here’s the code:

<div style="font: 10px 'Lucida Grande',Verdana, Arial, Sans-Serif;
line-height: 18px;
color: #525252;
margin: 6px 0;
padding: 6px;
border-top: 1px #999999 solid;
border-bottom: 1px #999999 solid;
background: #fff">
<div style="padding: 2px 0 2px 70px; background: url('http://dfbills.com/images/avatars/iphone.jpg">
<strong>David F. Bills</strong>
<br />
<a href="http://dfbills.com">http://dfbills.com</a>
<br />
sent from my mobile
</div>
</div>

Since it has become commonplace for email clients to deny http downloads in the body of emails, I’ve decided to go ahead and encode my jpeg image directly into base64 using DataURLMaker.  This is entirely optional and does not display when using clients other than the Apple ones.  For a more compatible signature, check out this post.

Replacing the image reference with the base64 code and compacting the linebreaks gives me:

<div style="font: 10px 'Lucida Grande', Verdana, Arial, Sans-Serif; line-height: 18px; color: #525252 ; margin: 6px 0; padding: 6px; border-top: 1px #999999 solid; border-bottom: 1px #999999 solid; background: #fff"><div style="padding: 2px 0 2px 70px; background: url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAASwAA/+4ADkFkb2JlAGTAAAAAAf/b AIQAAwICAgICAwICAwUDAwMFBQQDAwQFBgUFBQUFBggGBwcHBwYICAkKCgoJCAwMDAwMDA4ODg4O EBAQEBAQEBAQEAEDBAQGBgYMCAgMEg4MDhIUEBAQEBQREBAQEBARERAQEBAQEBEQEBAQEBAQEBAQ EBAQEBAQEBAQEBAQEBAQEBAQ/8AAEQgAOQA5AwERAAIRAQMRAf/EAJkAAAMAAgMBAAAAAAAAAAAA AAcICQUGAAMEAgEAAQUBAQAAAAAAAAAAAAAAAQIDBAUGAAcQAAEDAgQEBAIGBwkAAAAAAAECAwQR BQASBgchMRMIUWEUCUEicZGxQhU1gcEyUpIzFmJy0lNzs1S1dhEAAgIBBAECBAcBAAAAAAAAAAEC AxEhMRI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DS7DWXTV1vUqVpZxL6ptrnobyrKiUlkk/LzHEccSPHXHWKI 0+xbYuM3lFQsjf72ANiG+4r2ebiXTWjG5ehIqrhbFdXqNthxfpknNId6yqroCrO51DRA4oIQMhWD gZ9pGge4LbLXMcytIy7hpC6Ly3QMOx3fTKUKCU2hLmYlPJQAqpPnTELs9fyLTcs+l23TLX7WOhrz b+LrKOzL9BcI10hmsSexb5iHBQ8OPSp9eK+vr3Re30Lm3udaa+7X5P8Agxhum+FvtAtabL+K/Olt LzkCSwoI5dRaQKEgfAc8POib9PoNx78I7S/R/wACadwHbR3GblblzNS2zRc6VDU0y01IUWG65Kk0 QtwEfVidRW4wwyj7dqssytQYzOznubLaoqdvJSUFQUXVOxCslNRwPW4DjiSQxxfbz7MNytA6jnbg 7ooTbm1RX4ln0yXEvKU5JypXIf6ZKW0pCKDjU/UMccUO/om0/wCY9/Ej/BgYDk9upfyKZ/c/WME5bgzH8w4KEs7VYIDqOOCfJ54BxwYJwQdE/lTn+sf9tGEijYMcA//Z') no-repeat 0 1px ;"><strong>David F. Bills</strong><br/><a href="http://dfbills.com">http://dfbills.com</a><br/>sent from my mobile</div></div>

Now, my signature is complete, self-contained and ready to load into MobileMail.

Switch over the PLE and paste the your code into the SignatureKey string field, save and reboot the iPhone.  When it comes back up, create a new mail message on the iPhone.  You should now be able to see the results of your handiwork.

Signature

Update: A few people have asked for the iPhone photo frame file used in my sig.  I’ve posted the PSD for download.

(43) comments | posted in: iPhone Tips

New Safari Trick

When you reload a Web page in Safari 3 (by clicking the Reload icon or by pressing Command-R in Mac OS X or Ctrl-R in Safari Beta 3.x for Windows), cache files are bypassed. You don’t need to hold Shift or any other modifier keys. What a breath of fresh air!

comment on this | posted in: Mac Tips

More control of CrashPlan

I’ve been using the excellent CrashPlan software from Code42 pretty ever since I saw it demoed at MacWorld.  CrashPlan allows you to do nearly effortless secure, offsite backup. 

Each release of the software brings more control to the operation of the backup engine, but I wanted more control.  I wanted to completely turn it off while I was at home so that it wouldn’t be using any of my precious bandwidth.

After a bit of investigation, I found that the java engine was controlled with SystemStarter.  By issuing certain the following commands, I was able to start and stop the engine at will.


sudo SystemStarter start “CrashPlanService”

sudo SystemStarter stop “CrashPlanService”

Using this knowledge, I put together my final system crontab:

30 7 * * * root SystemStarter stop “CrashPlanService”
30 9 * * 1,2,3,4,5 root SystemStarter start “CrashPlanService”
0 18 * * 1,2,3,4,5 root SystemStarter stop “CrashPlanService”
30 23 * * * root SystemStarter start “CrashPlanService”

comment on this | posted in: Mac Tips Troubleshooting Unix

Super Mario Brothers NES Emulation

It seems that there are no current NES emulators on MacOSX that can play the NES verison of Super Mario Brothers.  I just spent nearly 3 hours trying to get it to work.  I finally resorted to some very old versions of RockNES in order to play.  ugh..

comment on this | posted in: Mac Tips Troubleshooting

Split Routing in MacOSX

At long last I’ve managed to configure dual network interfaces on my mac.  With the help of split-routing and Alberth Matos, I’ve managed to get two interfaces working simulataneously.

Interface 1: Airport Extreme (my fast internet connection)
Interface 2: Gigabit Ethernet (for lan connections)

The order of the interfaces is set in the Network Preferences as above.

Each interface is configured as it would be to access its respective network.  DNS for the local network is entered in both configs and the following command is used to configure the routing table:

sudo route add 10.0.0.0/8 10.2.204.20

Where 10.0.0.0 is the local netmask and 10.2.204.20 is the local router address.

The route tables need to be updated upon network location change or reboot.  I’m now investigating the best way to handle this.

comment on this | posted in: Mac Tips Unix

Fink Works in Tiger

I just reinstalled Fink 0.7.1 and found that it does indeed work in Tiger.  Release notes state that not all packages are updated, but most do work.  I’m recompiling now.

comment on this | posted in: Mac News Tips

Network Diagnostics, Interuptions and More!

I haven’t found Tiger’s Network Diagnostics application too useful yet. 

image

Very thoughtful of Apple to have added such a feature, but woah!  A “Server connections interrupted” dialog? 

image

The OS is actually asking me what I want to do instead of hanging indefinitely.

What’s going on here?  We’ve had ten major systems and we’ve never seen this before. 

It’s almost as cool as killing the AppleTalk stack under Macsbug in the classic MacOS.. but, I suppose I’m losing people here..

Mac-kind are used to the process of losing network connections and having the computer hanging.  If you we’re lucky, you might get a dialog- but this.. wow.

comment on this | posted in: Mac Tips

Reinstall Stuffit Expander in Tiger

Save yourself some grief and reinstall stuffit expander after your tiger install.  It will be either broken or missing when you’re done with installation.

comment on this | posted in: Mac Tips
« First  <  8 9 10 11 >