Parse e-mail for UPS tracking numbers

Published / by Kevin / Leave a Comment

This AppleScript will parse the selected e-mail in Mail.app for UPS tracking numbers and will open the tracking page of the UPS website in your default browser.

This only looks at a single e-mail, but could be made to repeat through multiple selections.

tell application "Mail"
  set _messages to selection as list
  set input to content of item 1 of _messages
  try
    open location my parse_nums(input)
  on error
    display dialog "No UPS tracking info found."
  end try
end tell

on parse_nums(input)
  set input_new to ""
  set output to ""
  set input to every word of input
  repeat with i in input
    try
      if first character of i is "1" and second character of i is "Z" then --Every UPS # I've seen starts with '1Z'
        set input_new to input_new & i & "%0D%0A" as string -- 
URL encoded carriage return line feed needed for multiple entries.
      end if
    end try
  end repeat
-- Now to remove the last set of new line characters.
  repeat with c in characters 1 through ((count of characters of input_new) - 6) of input_new
    set output to output & c
  end repeat
  set the_URL to "https://wwwapps.ups.com/WebTracking/track?track.x=Track&trackNums=" & output
  return the_URL
end parse_nums

OS X Server 5 Shenanigans

Published / by Kevin / Leave a Comment

OS X Server 5 for OS X 10.10. and 10.11, while a significant improvement to Lion Server for OS X 10.7, still behaves oddly when mixing SSL and non-SSL requests. Whereas before it wanted every request redirected to the SSL pipe, now it will let you do either. It won’t, however, let you do both.

WordPress will try to do both. Why? I dunno. It should work, and did on plain Apache 2, but OS X Server 5 puts up a proxy to the WAN and serves from a different port. This is not presented upfront to the Server.app user, but is most likely in the docs. RTFM much? Ha-ha! No.

The affect this had on my WordPress install is instead of logging in being presented with a page that merely stated,

You don’t have permission to view this page.

Or some such equally helpful information. A little web searching turned up the answer. To overcome this the following can be added to wp-includes/http.php

/* Adding this BS for OS X Server 5 being a dick... */
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
  $_SERVER['HTTPS']='on';
}

I saw a post on wordpress.net that said to put this into config.php, but that did not work for me. Neither did the mod_rewrite mumbo-jumbo in that thread and apparently it didn’t for the OP, either.

I admit being ignorant to what HTTP_X_FORWARDED_PROTO is, but it appears to be a HTTP header from an Apache mod Apple is running. Unique to them or something well known? I dunno. I don’t pretend to try to keep up with this stuff any longer. That’s why I went to WordPress; So I wouldn’t have to.

New wheels

Published / by Kevin / 2 Comments on New wheels

2011 Masi Speciale

This is the coolest bike I found after starting to search for one in earnest. Picked it up at Arizona Bicycle Experts. There are some custom / by hand frame builders that put together some fantastic stuff, but those are *way* outta my price range. Got it under MSRP since it is an older model, but I’ll still be paying for it for a while. These things is expensive. I actually went in to look at aluminum Masi’s, but this one fit and I’m glad it did.

Before jumping in the water I got my road bike toes wet on an aluminum Schwinn Empire from Wal-Mart. Not a bad bike on the cheap. Not a great one, either, since the components are all pressed steel not machined aluminum. Took quite a bit of tweaking to get it rideable. Although you could easily get your monies worth out of it, it never felt… I dunno, permanent I suppose. The Masi does. Could be that having years of experience with a quality steel frame helped me develop a bias.

Now to get my fat ass out there more often. The main reason for starting on this was to lose some weight and get in better shape. Hopefully even commute to work this summer. Used to love the road bike I had as a young teenager, so I’m looking forward to it.

MTB conversion

Published / by Kevin / 1 Comment on MTB conversion

In my quest for a better street bike I can either spend a few hundred on a used better model bike or a new low end model bike. Or I can convert my aging, better model MTB, a 19″ 1992 Trek 930 hardtail.

Tires were 1.95 knobbed, now 1.5 road tires. Makes for a noticeably stiffer ride. Though it actually seems harder to pedal. Since I’m as out of shape as I’ve ever been I cannot rely on this assessment.

Chainrings (110BCD) can be replaced with some slightly larger ones. Outer chainring is already 48t, but I can fit a 54t on it. They really do need to be replaced as it is, so why not go a little more road worthy? Sugino makes a set that will increase the outer and granny gear, letting me keep my crank and derailer.

Handlebar (upright) will likely not be replaced with a drop bar since I would need to replace the stem as it’s a one-piece high rise, but an aerobar might help.

In the end I’m still torn because I’d be making a workable tank of an MTB into a Frankenstein road bike that never will be one. At this point, I think stopping at tires is enough.

iTunes Content Rating strings

Published / by Kevin / Leave a Comment

Re: http://sourceforge.net/projects/atomicparsley/forums/forum/514419/topic/1687885?message=4206988

United States (01)

    Not Rated    mpaa||0|

    G            mpaa|G|100|

    PG           mpaa|PG|200|

    PG-13        mpaa|PG-13|300|

    R            mpaa|R|400|

    NC-17        mpaa|NC-17|500|

    Unrated      mpaa|UNRATED|900|

    Not Rated    us-tv||0|

    TV-Y         us-tv|TV-Y|100|

    TV-Y7        us-tv|TV-Y7|200|

    TV-G         us-tv|TV-G|300|

    TV-PG        us-tv|TV-PG|400|

    TV-14        us-tv|TV-14|500|

    TV-MA        us-tv|TV-MA|600|

    Unrated      us-tv|UNRATED|900|

These alone (added using a hex editor) are not enough by themselves to get iTunes to see the rating. Not sure at all what is missing.