Sunday, November 20, 2011

Meta: old comments published, sorry.

I just realized I had not moderated comments in six million years.

So I did, and published the non-spammy ones. In case there is some kind of notification system and you get an e-mail that your comment from 1932 has been published on this blog: my apologies for the tardiness.

UITapGestureRecognizer and “unrecognized selector sent to instance” errors.

This is just a very quick note for search engine posterity, in case anybody has the same frustrating problem I had today.

I am implementing some gestures for an iOS art app (as in a work of media art, the "medium" of which is an iPhone/iPad application). I was following the "Event Handling Guide for iOS" from Apple.

After much Googling and some very informative stops at StackOverflow, I had got basically nowhere. Everything seemed right, my code conformed tightly to the tutorial and to everyone else’s, and everybody else who found a solution had obviously solved a very different core problem than I was facing. What could be wrong?!

It turns out the problem was as simple as:

-(void) handleTap
{
    NSLog(@"*** GOT A TAP ***");
}
    

Now, in real life you would almost never use a method as dumb and simple as that, but when setting up your classes for initial hacking and debugging you just might. According to the tutorial, it should work:

The action methods for handling gestures—and the selector for identifying them—are expected to conform to one of two signatures:
- (void)handleGesture
- (void)handleGesture:(UIGestureRecognizer *)sender

Silly programmer, tricks are for kids! The standard-issue selector looks for only the second signature, and if it doesn’t find it you get the error whenever you tap: unrecognized selector sent to instance! boo!

The solution, then, is to declare and implement the method with the argument. That works fine.

-(void) handleTap: (UIGestureRecognizer *)sender
{
    NSLog(@"*** GOT A TAP ***");
}
    

To be fair, Apple has an enormous amount of documentation available online, and it’s not so shocking that a tutorial is out of date. For us iOS newbies it’s frustrating, but I don’t think anybody else is doing a better job of this at the moment.

Friday, October 14, 2011

Rough Draft Epitaph

So many important people have died this year, I thought it best to have at least a rough draft of an epitaph on record in case I need one. I feel fine, but you never know. Ergo:

HERE LIES THE FROST
man under ground.
His hair was long,
his belly round.
He lived quite long
for the risks he took,
but never did manage
to write that book.

Friday, August 05, 2011

Perl ExtUtils::MakeMaker test overrides (for Makefile.PL).

Nerd post follows; non-nerds, move along.

This took me a while to figure out, and in the end I had to dig around in the source code to figure out just what was going on, so here’s a quick note for posterity since I’m sure somebody else will have exactly this problem at some point. Caveat lector: I’m probably making a bunch of mistakes here. And thanks to brian d foy for showing us how to use test_via_harness.

Basically what it boils down to is this: you are going to have either a bunch of test files in a t directory, or a single test.pl file in the main directory. Or possibly both.

The thing you need to override is different in each case. You might just want to do both in case you change your mind later about the test setup.

Let’s say, for instance, that my special little requirement is that I can get at some shared libraries in the /opt/special/lib directory. The examples below should be understood as code inside your Makefile.PL file. And yes, they are almost identical in this case.

For test.pl override test_via_script.

sub MY::test_via_script {

    my ( $self, $perl, $script ) = @_;

    # Here is some special sauce for the environment:
    my $env_setup = 'LD_LIBRARY_PATH=/opt/special/lib';

    # Here are some Makefile variables that are handled by `make`:
    my $harness_args =
      '"$(TEST_VERBOSE)", "$(INST_LIB)", "$(INST_ARCHLIB)"';

    # Here's the command that will create the target:
    my $command =
      sprintf "\t%s %s -MExtUtils::Command::MM -e 'test_harness(%s)' %s",
      $env_setup,
      $perl,
      $harness_args,
      $script;

    return $command;

}

For t/*.t override test_via_harness.

sub MY::test_via_harness {

    my ( $self, $perl, $tests ) = @_;

    # Here is some special sauce for the environment:
    my $env_setup = 'LD_LIBRARY_PATH=/opt/special/lib';

    # Here are some Makefile variables that are handled by `make`:
    my $harness_args =
      '"$(TEST_VERBOSE)", "$(INST_LIB)", "$(INST_ARCHLIB)"';

    # Here's the command that will create the target:
    my $command =
      sprintf "\t%s %s -MExtUtils::Command::MM -e 'test_harness(%s)' %s",
      $env_setup,
      $perl,
      $harness_args,
      $tests;

    return $command;

}

Etc. & So On

I think it’s a much better practice to keep your test files in t/ anyway, and to always run with the test harness. In fact I usually skip the explicit test harness altogether and run everything with the appropriate prove command (the one that belongs to the Perl I’m using).

However, if you’re dealing with legacy code or not interested in doing real Perl stuff or otherwise just need to “get on with it” then you might well need a test.pl – and remember, test_via_script for that guy!

Here are the obvious links you should follow if you want to know more about this:

And finally, for anyone nerdier than I who is reading this: I know about package MY and I agree it’s probably the better solution, but I think it’s (even more) confusing for novices; and I assume at least some people trying to do this aren’t even Perl programmers.

Monday, May 02, 2011

Seen Today

  1. A 200HUF cappuccino.
  2. Szamoca vs. Eper.
  3. A mini-skirt! 'Tis the season!
  4. Bright sunlight through green glass socialist balconies.
  5. Prolis, pornósmellü, rövidlábú daughter of the café proprietress.
  6. A one-legged man walking a husky.
  7. Public-service street art sampling both Star Wars and Red Robot.
  8. A giant pink Hello Kitty poster at the optometrist's.
  9. Written on the Bortársaság delivery van, the optimistic take on modern Hungary: “MINDEN RENDBEN A BOR FINOM.”

Thursday, April 21, 2011

Buying Art (for cheap) is Fun

I recently attended a silent auction, the modest proceeds of which went to the IFRC. The things being auctioned were artworks, mostly on paper. I got three, about which more in a future post after I photograph them. But I will at least give a sort of preview: Two by Ryuta Suzuki and one by Kati Verebics.

It’s a safe bet that I got all three well under market value. I almost got into a little bidding war with someone, but he mysteriously declined to bid on the things I wanted, perhaps intimidated by my hovering around waiting to double down. And I had passer’s remorse about not having bid on something, until I found out the winning bid belonged to a very nice guy.

I don’t often buy art. Very rarely in fact. And not because it’s expensive; while it can be very costly there’s always something you can afford, however minor. The thing is, if you’re collecting art you have to put it somewhere, and you feel sort of bad if that somewhere isn’t a wall.

I suppose you know you’re actually collecting art when you no longer feel bad about not displaying it. I could imagine getting to that point, or if you like falling into that trap, but not soon. I’ve got a sweet little apartment with more windows than walls, and a lot of geographic instability in the mix, and I’m not yet ready to invest in another flat file. Not quite yet.

It’s probably not an easy thing putting together a charity auction. This one had some local artists I’d heard of (including a few I know personally); and some I hadn’t heard of; and some strangers from far afield, whose contributions were sometimes relevant and sometimes not. The quality was very uneven, but in Budapest the quality of a museum show can be just as uneven (I’m lookin’ at you, MüPa!).

Some good things about the auction: admirable transparency about the finances; no hidden reserves; good art on the cheap for a good cause.

Some less-good things: no alcohol (what were they thinking?); a rather, shall we say, distant house staff; no real PR about the artists or works (remember, most people at a charity auction know nothing about art); and, sadly, not enough people wanting to spend money.

As one of the modestly solvent people in the room, I definitely would have spent more on the works I bought if there had been enemy bids. I wouldn’t have gone to the moon, but I definitely would have gone to double what I spent. In one case I almost felt like bidding against myself but part of the adrenalin kick of an auction, even a noncompetitive one, is the tension between wanting what you want, and wanting to get it at the lowest price going.

I know these things are easier said than done, but it seems to me that there are some obvious steps to help raise more money at a charity auction. So I shall play Lucy for a moment and offer...

Cheap Advice for Silent Charity Auctions

  1. Work your connections and get every well-off person you know to attend.
  2. “Well-off” means “able to place the lowest available minimum bid without pain.”
  3. Have plentiful, non-shitty free booze. Get it sponsored of course.
  4. Have a friendly, attractive staff serving the plentiful free booze.
  5. Flatter people unnecessarily.
  6. Make it easy to bid competitively and anonymously.
  7. Have professional promotional materials on hand about your cause, your beneficiary, and every artist.
  8. Include take-home materials, e.g. a high-production-value flyer.
  9. If you don’t know how to do that yourself, get somebody who does know to do it for free for the good cause.
  10. Apply the rule above to every aspect of the auction. You’re already a hero for organizing it in the first place.

In short, it was fun, I totally scored, and I think I’ll try this sort of thing again. But first I have to find a good framer.

A Parting Thought On the Arts and the Web

Why is it that artists and cultural institutions, much like restaurants, generally have not heard the news that Flash-only websites are broken and reflect badly on their owners?

In the case of individual artists, I’m inclined to think of it as similar to the restaurant problem. Creative people get talked into some gimmicky animation and don’t know any better, so up it goes. But when a well-funded Palace of the Arts hires some clueless two-bit company to rain misery on its potential ticket buyers, then I have no choice but to smell a rat.

An example of the first: Mr. Suzuki’s portfolio. Of the second: MuPa.hu, a study in inaccessibility.

Sunday, February 20, 2011

Notes on Apple’s Subscription Billing

Update: Read Tim O’Reilly’s take.

Tech publisher Tim O’Reilly has just posted a very thoughtful case against the 30% number in Apple’s subscription model. He thinks it should be more like 5%.

The post and the comment thread are very informative, and I highly recommend reading them if any of this interests you. Here it is on Google Buzz, incidentally proving that Google Buzz has a few actual users. Who knew?

One minor point on which I disagree with O’Reilly, but in which we’re both just wildly speculating: I don’t think Apple is arrogantly trying to price the competition off its platform (e.g. Netflix vs. iTunes). Rather, I think they have considered those businesses and, perhaps just as arrogantly, assumed they should be smart enough to make a profit while still coughing up 30%. I sort of imagine Tim Cook saying, “Well I could do it in a weekend, so why shouldn’t Reed Hastings?

Apple, which still has nothing like a viable competitor to its ragingly popular iPad tablet device and happens to also make most of the profit in the smartphone world, recently announced new rules for in-app content purchasing, particularly for magazine and newspaper subscriptions.

In a nutshell, they are:

  1. For anything bought inside the app, Apple gets a 30% cut.
  2. You can’t sell anything outside the app that you don’t also sell inside the app.
  3. You can’t charge more for in-app purchases than for their out-of-app equivalents.
  4. Collection of subscriber data is limited, optional (opt-in), and revokable (by the user).
  5. Subscriptions may be cancelled at any time, inside the app.

I’ve been following the reaction online for a while now. As you might expect, publishers and various other middlemen, as well as a typical assortment of irrational Apple-bashers, are raising a stink. Or at least trying to; with Rupert Murdoch on board, it’s hard to argue there isn’t money to be made by publishers.

I see the arguments against Apple’s new policy falling into three main categories, which I will briefly address below. My gut feeling is that this new model will work in most instances, and in a few instances will fail so utterly that exceptions will soon be made.

“Apple Will Destroy Publishing”

This argument usually has little to do with the 30%, which after all isn’t that much compared to traditional printing and distribution costs. Instead, the big fear is that publishers have built a business on selling subscriber data – usually to people who turn around and try to sell crap back to the subscribers. Ever wonder where all those catalogs come from?

If Apple limits what data you can collect, and requires it be easy to opt out, what becomes of this revenue stream?

Well, in fact a good part of it will probably go away. I expect people will still happily provide enough personal data that you can reasonably prove the value of your “demographic” to the advertisers.

But according to what logic, exactly, should a business be allowed to harvest as much of my personal data as their little database elves know how to, without my consent and directly against my better interest? I understand that this helps keep subscription prices low, but then making sandwiches out of your customers’ own flesh would keep sandwich prices low. How is that good?

So Apple is in effect forcing the publishers to be honest if they want to be on Apple’s platform. We’ll see how it goes, but I mostly expect that they’ll grumble but give in, exactly as far as they absolutely must and no further.

There is also some minor echo on the Innernets suggesting that easy subscription cancellation is an unfair burden for publishers, to which the only reasonable response is a much simpler blow me.

“Apple Will Destroy Kindle”

Here the argument is very much about the 30% cut. Content resellers tend to have fairly low margins, thanks in no small part to Amazon. I would expect that a large portion of a la carte content sales, particularly books and essays, simply can not survive a 30% reduction in sales.

This would effectively force someone like Amazon to raise prices, but how will the market react to that?

On the one hand, the market probably wouldn’t much care. Books in Europe cost a lot more than books in the US, and people don’t read less as a result. Steep discounts are not a requirement to secure readership, at least not if your content is any good.

However, with the same-price stipulation for in-app and out-of-app purchases, Apple is sending a very clear message: if you want to sell content on our platform, the content had better be of sufficiently high quality to be priced above a 30% cut in revenue.

Or it had better be sufficiently dirt-cheap that all the money’s in the resale. This is probably not what Apple has in mind, and it’s already a problem in the iBookStore as well as the App Store.

I expect some retailers, and especially Amazon, will feel their backs are to the wall, and will try to find a way out. That might well be regulatory: changing the contract terms on your direct competitor, effectively denying them shelf space in your store, may not go over well at all in the EU, especially regarding cultural goods.

But I think it’s more likely that some folks will try to give you an upside to purchasing outside the app, and Apple will generally not approve those apps except in the cases where they sorta-kinda have to. For example, what does Apple do if Amazon lets you buy content in-app that is tied to that app (i.e. to your various iDevices), but lets you "buy once read anywhere" if you purchase outside the app?

A lot of publishers also bundle digital and dead-tree editions. In Germany, publishers charge a lot for subscriptions but usually offer gifts (a toaster, a Zune, whatever) for new subscribers. (Jetzt Prämie sichern! they shout at the consumption sheep.) Does that mean physical items purchased through the app also have to give Apple a 30% cut? Or that you can’t run a different promotion in each store? What about eBay? Does Apple get 30% of your auction price, or 30% of eBay’s premium?

Here I think Apple has once again failed to address the inevitable grey areas that exist or will soon exist in the app ecosystem. I expect that a combination of regulatory challenges, untenable implications of rules (e.g. the eBay case), and market nuances will force Apple to revise the rules, and possibly the percentage, several times over the next year.

If I had to guess at an outcome, I would guess they’ll allow you to sweeten the deal however you like as long as the part that goes on your iDevice costs the same in-app or out. And I think they will clarify that they don’t expect a cut of anything that doesn’t go on the device; and maybe even clarify that you can sell Kindle for iPad for $20 while giving away Kindle for Android free, if that’s your best solution. And finally that yes, you can sell your newspaper for half price on Android as long as the Android subscription doesn’t give you iPad download rights (at which point I think most smart product managers would give up the 30% instead of taking on the engineering challenge).

“Apple Will Destroy My As-Yet-Unproven Business Model”

This argument is really fascinating, and is being applied not only to fly-by-night startups trying to fill some app market niche that was miraculously still empty an hour ago (e.g. subscription aggregators). The interesting ones here are the purveyors of digital media.

The gist is that streaming media services are built on such impossibly thin margins that it’s completely absurd to give up 30%. The only way to survive that and not go bust is to raise prices, and that’s like raising taxes, and so on.

The problem with this argument is that most streaming media services are built on such impossibly thin margins that they are not, by themselves, viable businesses. That doesn’t mean the 30% cut isn’t onerous, but when the people who created the work in the first place are getting as small a cut as they are from the streaming services, I don’t have a lot of sympathy for the middlemen.

I expect this will be a tempest in a teapot at most. The additional charge won’t invalidate anybody’s fake valid business model, nor will it put any real business in the red. Some startups may go belly-up as a result, but isn’t that why they call it venture capital?