For No One

RSS

Posts tagged with "tech"

➩ App Store Trials

Amy Worrall:

I’m going to add my voice to those calling for trials of App Store apps. Here’s how I could see it working: Developers can choose whether to allow a trial of 1, 7 or 30 days, or to disallow trials…

I think her plan makes sense, but I have one question/suggestion about this part:

Once a trial is used up, you can’t get a trial of that app again on the same Apple ID.

What about after the app gets an update? Say you try out Photoshop, but it’s missing one feature you desperately crave (automatic LOLcat-style captions, naturally). You want to hold out until they add that feature. Years pass, and they add it, so you want to check their implementation (does the font they chose do your wit justice?). If you can’t try it out again, after a certain amount of time, or after a certain number of updates, that makes trials a lot less useful.

(via Daring Fireball)

Feb 4

➩ S3stat - Analytics for S3

As mentioned in my post announcing my switch to Amazon S3, I’ve been using S3stat to give me feedback on how many of you guys are downloading Tumblr+. I’ve enjoyed using the service, and it was very painless to set up. As I use S3 for more things (I plan on hosting a new web site there soon), it’ll be good to have analytics on which pages are getting visited, and how much data is going to which particular resources.

One thing it pointed out to me is that most of my traffic at present is coming from crawlers spamming my bucket trying to find API calls in a nonexistant /soap directory. Now that I know that’s a potential problem (bandwidth being sucked up uselessly), I will be looking into potential solutions to that problem.

Also, they are generous enough to offer a “Cheap Bastard Plan”, for which this post is essentially payment1. If any of my online endeavors eventually begin to bring in revenue, I will switch to one of the paid tiers, but for now, I greatly appreciate the free option.


  1. Consider this full disclosure, though they had no input on what I posted here, and everything I’ve said is how I honestly feel, and I would have probably written a similar post at some point in the future, besides. 

littlebigdetails:

YouTube - To celebrate 1 billion views, a tiny dancing Psy was added to the video page for Gangnam Style.

Makes sense to commemorate such a record being set.

littlebigdetails:

YouTube - To celebrate 1 billion views, a tiny dancing Psy was added to the video page for Gangnam Style.

Makes sense to commemorate such a record being set.

Jan 2

Hi, I am trying to use your HandBrakeCLI code with Automator, but I am getting the following error: "Variable re_compile is not defined". I am using Mountain Lion. Cheers!.

Anonymous

Thanks for pointing that out! I neglected to mention that you need to install the Satimage.osax AppleScript extension. the re_compile you’re seeing is because I use regular expressions to handle the command line output of HandBrake. I’ve updated the post to include information about installing Satimage.

littlebigdetails:

iTunes - When adding a free item to a Wish List, an alert reminds you that you can download it right away.

I love the copy of this message, as well, subtly suggesting a reason you may want to download it immediately.

littlebigdetails:

iTunes - When adding a free item to a Wish List, an alert reminds you that you can download it right away.

I love the copy of this message, as well, subtly suggesting a reason you may want to download it immediately.

Dec 5

Using HandBrake on a list of files

I download a lot of videos on the web, and most of the time, they don’t come wrapped up as an iTunes-friendly m4v file. Even when they do, they may not necessarily be encoded in a way that plays nicely with all of my iOS devices (AppleTV, iPhone, iPad, etc.). So, for a long time, my download process has gone like this before loading into iTunes:

  1. Download
  2. Transcode
  3. Tag

The tools I use for the first and third steps have not changed for a long time, but there has been a lot of movement in the Mac video transcoding space. What do I mean by transcoding? I take video that arrives in a particular format (let’s say Ogg Theora) and convert it into a format my devices accept (typically some flavor of MPEG-4 my Apple devices).

VisualHub

For years, I used an awesome tool named VisualHub, and it did everything I wanted. I dragged in a list of files, told it which device I wanted to play them on, and let it rip. It even made use of OS X’s Xgrid infrastructure to encode multiple files simultaneously, distributed among my Mac Pro’s 8 cores, as well as any other networked machines I cared to use. But VisualHub died (so to speak).

It was reborn as an open source project named (poorly, in my opinion) FilmRedux. I tried using it, and found it lacking in various regards. Another project forked the code base and went in its own direction, calling itself VideoMonkey. I used it for a while, dealing with its superficial bugs and slow rate of development, simply because I couldn’t find another tool that would (usually) work the way I desired.

HandBrake

Of course, this all applies to lists of files. If I had a single file to transcode, I used HandBrake as soon as it began accepting arbitrary files for input (it originated as a tool for ripping DVDs, for which it still excels). I love HandBrake, and would use it for all my transcoding needs, if only I could use it for a list of files. The interface has been written with ripping DVDs in mind, however, and so you can only select one file at a time. So I set out to fix that, with my tool of choice: automation!

The Solution

I wanted a way to give HandBrake a list of files, and have it transcode all of them to a particular folder, using a particular settings preset. I realized this seems to be an idea ready-made for an OS X Service, and luckily, Automator (bundled with the OS) allows you to easily make Services. But, HandBrake doesn’t support AppleScript and doesn’t export any Automator Actions, so I needed to figure out another way to automate it. Luckily, HandBrake provides a CLI (command line interface) executable for the Mac.

First, you need to install the Satimage AppleScript extension. Follow the link, download the Satimage___.pkg installer, and run it. If you’re on Mountain Lion (with default Gatekeeper settings), you will need to right-click the file and click Open1, since it hasn’t been signed by the developer, but other than that, it works 100% in Mountain Lion. The installer is very basic, only copying the Satimage.osax extension into your /Library/ScriptingAdditions/ folder.

To create your own service, follow these steps:

  1. Launch Automator.app

    Automator

  2. Click File > New (Cmd+N)

  3. Select Service

    Service

  4. Click the Choose button

  5. Set the following two dropdowns at the top of the service’s definition: Service receives selected files or folders in Finder

    Settings

  6. Drag in the Action named Run AppleScript (you can search to find it quickly)

    Action

  7. Copy and paste the script below as the script’s text

  8. Click the Compile button to make sure the AppleScript pasted is valid

    Hammertime

  9. Click File > Save (Cmd+S), and enter a name (I chose “Encode With HandBrake”), which will show up in the Services menu

on run {input, parameters}
    set handbrakeCli to "/Applications/HandBrakeCLI"
    set defaultPreset to 7
    
    -- Make sure HandBrakeCLI is installed
    set handbrakeInstalled to false
    tell application "Finder" to if exists handbrakeCli as POSIX file then set handbrakeInstalled to true
    if not handbrakeInstalled then
        display alert "Install HandBrake CLI" message "Please install HandBrakeCLI into the /Applications directory

The HandBrake CLI can be downloaded at http://handbrake.fr/downloads2.php" as critical
        return
    end if
    
    set the destination to POSIX path of (choose folder with prompt "Select the conversion destination")
    
    set the presetList to do shell script handbrakeCli & " -z"
    
    set eachPreset to every paragraph of presetList
    
    set groupEx to re_compile "<[ ]*(.+)"
    set presetEx to re_compile "[ ]*\\+[ ]*([^:]*):"
    
    set displayNames to {}
    set presetNames to {}
    
    set group to ""
    
    repeat with preset in eachPreset
        if length of preset > 0 then
            if preset starts with "<" then
                -- Pull out the group's name
                set group to find text groupEx in preset using "\\1" with regexp and string result
            else if preset contains "+" then
                set presetName to find text presetEx in preset using "\\1" with regexp and string result
                copy presetName to end of presetNames
                copy group & " > " & presetName to end of displayNames
            end if
        end if
    end repeat
    
    set chosenDisplayPreset to choose from list displayNames with title "HandBrake preset" with prompt "Choose a HandBrake preset" default items {item defaultPreset of displayNames}
    
    if chosenDisplayPreset = false then
        return
    end if
    
    set chosenDisplayPreset to chosenDisplayPreset as text
    
    set presetIndex to 1
    repeat with i from 1 to (count of items in displayNames)
        if item i of displayNames is equal to chosenDisplayPreset then
            set presetIndex to i
            exit repeat
        end if
    end repeat
    
    set chosenPreset to item presetIndex of presetNames
    
    repeat with inputFile in input
        -- Get original file's name
        
        set thePath to POSIX path of inputFile
        set prevTIDs to AppleScript's text item delimiters
        set AppleScript's text item delimiters to "/"
        -- Get the file name
        set inputFileName to (item -1 of (every text item of thePath)) as text
        
        -- Get the file name without an extension
        set AppleScript's text item delimiters to "."
        set inputFileNoExtension to items 1 through -2 of (every text item of inputFileName)
        set AppleScript's text item delimiters to prevTIDs
        
        -- Put back together if file name included periods
        set outputFileName to ""
        repeat with fileNamePart in inputFileNoExtension
            set outputFileName to outputFileName & fileNamePart & "."
        end repeat
        
        -- Put on the preferred extension
        set outputFileName to outputFileName & "m4v"
        
        set handbrakeCommand to "nice " & handbrakeCli & " -i " & quoted form of (POSIX path of inputFile) & " -o " & quoted form of (destination & outputFileName) & " --preset='" & chosenPreset & "'"
        --return handbrakeCommand
        do shell script handbrakeCommand
    end repeat
    return input
end run

To use the service:

  1. Select the files you wish to convert in Finder
  2. Right click (or Control-click) on the selection
  3. Click Services > Encode With HandBrake (or whatever you named your Service in Step 10 above)
  4. The Service will prompt you for an output folder for the conversion. Select the folder you want your converted files to land in
  5. The Service will also prompt you for a HandBrake preset to encode with2. Select the one you wish to use. Unfortunately, the CLI doesn’t support custom presets defined in the GUI app
  6. A spinning gear icon will show up on the Menu Bar at the top of your screen until the job finishes

This script has worked solidly for me for a long time, and I hope you enjoy it. As always, you can let me know if you have any problems or feature requests.

Update

I’ve gotten feedback that the re_compile command is not working for some (all?) of you. D’oh! I forgot to mention you need to install the Satimage.osax AppleScript extension. I’ve had it for a while and forgot that this script uses Regular Expressions. I’ve updated the post to include those instructions.


  1. This is described on the Gatekeeper support page, under the “How to open an app from a unidentified developer and exempt it from Gatekeeper” heading 

  2. I have it defaulting to the Apple > AppleTV 2 preset, which you can change in the following line of AppleScript: set defaultPreset to 7 

Barcodes in Passbook

On the latest episode of The Talk Show, The iPhone 5 Episode, John Gruber and MG Siegler discussed barcodes on an iPhone screen not scanning properly, and speculated that Passbook (a new feature of iOS 6) might require a special type of scanner. They’re partially right, as explained in the wwdc videos about Passbook1.

Passbook authors can choose between three styles of barcode:

  • PDF417
  • Aztec
  • QR

Those three styles all have something in common: they’re 2D barcodes, as contrasted from the old-school 1D barcodes, as seen in most stores.2 The presenter in the WWDC videos explains their choice to only support 2D barcode formats.

Scanners for 1D barcodes typically use lasers to read them, and those do not work (at least not well) with iPhone screens, as I’ve experienced in the past with scanned-in rewards cards. The 2D formats can only be read by optical scanners (taking photos of the target), which work fine with iPhone screens. Passbook cranks up the brightness on the phone’s screen all the way when it’s displaying a barcode to make a successful scan even more likely.

Not all barcode scanners will properly read an iPhone’s screen, but Apple chose barcode formats for Passbook which require scanners that will work.


  1. The links require an Apple Developer account, but not a paid one. The free accounts have access to the WWDC session videos. I think (and hope) these are no longer under NDA, since iOS 6 has been publicly released. 

  2. The Wikipedia barcode article gives examples of many popular 1D and 2D barcode formats 

➩ How reckless

Katie Marsal, on AppleInsider, regarding the recent break-in at the under-renovation Jobs residence:

…the suspect also managed to swipe the late Apple co-founder’s car keys and wallet — which contained just $1…

You mean that Jobs carried his entire year’s salary – in cash – in his wallet? How many of you would do that?

➩ The Brads - Begin Your Journey

Awesome comic. Any developer who’s ever started at a new company (and played at least one modern-era Zelda game) should relate.

➩ Nilay Patel on Patents

Nilay obviously knows a whole lot more about patents than I do, and I thoroughly enjoyed reading his take on the whole situation (especially regarding software patents, which, he points out, are not currently given any special status under our laws). I liked this specific example of the triumph of a software patent:

We also can’t simply forbid entities that don’t “make anything” from asserting patent rights. Not only would that that veer into uncomfortably unconstitutional territory, it would also prevent institutions like universities and research firms from gaining any value from their patents. That PageRank patent is actually owned by Stanford, which funded Larry Page’s grad student research; when he and Sergey Brin left to start Google, they signed an exclusive license to the patent in exchange for 1.8 million shares of stock that Stanford later sold for $336 million. That’s a major success story — we want more of those.

I learned a whole lot reading his article, and agree with almost every idea he posed. He approaches the issue from more or less the same angle I did, but backs it up with a lot more background and knowledge of the system.