Sunday, December 7, 2008

Reply

srowen wrote:
It doesn't solve the problem of writing contacts though. If you farm that out to a separate app, then it has to able to accept contact information from another app, to write. That other app didn't ask for write permission though. This is a sort of problem with per-app permissions but the ability for apps to cooperate via Intents.
An application that receives an Intent and blindly writes a contact is absolutely a bad idea. The solution to this would be not to use Intents to send the data back.

Specifically, you'd need to use android.os.Binder, probably but not necessarily by using AIDL to generate the (synchronous, IPC) interface. (It actually seems like it'd be easier to implement the interface directly, but since there is a standard mechanism...) I think, but am not certain, that this means the ZXing-library-app would need to extend Android.os.Service.

My original reply had a sketch of a secure request-reply protocol using Intents and the fact that
IBinder/Binder objects [can] be used as a unique identity (to serve as a token or for other purposes) that can be managed across processes[,]
but as it turns out this is probably not a good idea, for at least two reasons:
  • Both scanning and displaying are inherently synchronous operations, and a calling application is going to sit around twiddling its thumbs in any case; one might as well use synchronous IPC.
  • Unexpected failure of the scan/display app will result in the calling application twiddling its thumbs forever.
(Of course, it's probably safe enough to use Intents for display alone: one wouldn't be expecting any data back, so failure is uninteresting, no? Admittedly I haven't thought that one through.)
I think the idea of separating the apps is interesting. You're asking users to separately download another app, or else forgo this functionality. That's a cost. But it does have the benefit you suggest.
Hmm. I suspect (but can only conjecture) that this cost would be mitigated slightly if you were to package "Barcode Scanner" as a library, like Radar, instead of as an app in and of itself. Then just say 'this application requires the Barcode Scanner library, listed under Software Libraries' -- which, I note, everyone else is already going to have to say. Like that one Barcode Battlers game (or whatever it's called) already does.

This would also help users who have more than one ZXing-using application: only one copy of the library would be taking up valuable disk space. It might also encourage application writers by making them aware of the existence of a barcode scanner library qua library: at present there are only two software libraries at all, so there would be significantly fewer faces in the crowd against whom to stand out.

Saturday, December 6, 2008

Incarnadine

Mac tugs nervously at his collar and at his gloves. Elizabeth's father terrifies him. It's not just that Mr. Wallace is a tall and imposing man, with piercing eyes and a handlebar mustache that looks like he could beat a man to death with it.

"So," he says. "I am ... given to understand that my daughter is fond of you." He smiles.

And a smile that looks like it could kill a man on its own, Mac adds mentally. Mr. Wallace has something of a reputation as a man not to be crossed. I must be crazy. He looks at Elizabeth.

Elizabeth looks beautiful, of course. She also glares at her father. "Tată. You promised."

Mr. Wallace appears unmoved. (Mac tugs at his gloves again. He will need to change them soon.) "I give you to understand that she must be back before midnight."

Mac nods, wordlessly. He is afraid of what his voice might sound like if he spoke, and afraid of saying something that will get him killed and mounted on a pole as a warning to others. Possibly not in that order. Elizabeth takes his arm, and somehow he escorts her out to his car.

"I think you impressed him," she says, as they drive away, "with the stoic act and all." Mac only smiles wanly. After a moment, Elizabeth giggles. "You're just lucky I like the strong, silent type."

Mac glances over at Elizabeth, startled — and then laughs. The tension is broken. "So I shouldn't tell you all about my stamp collection," he says. "Good to know."

Elizabeth smiles at him. It reminds him, briefly, of Mr. Wallace's smile; but it looks better on Elizabeth, he thinks. She opens the glove compartment, pulling out a fresh pair of gloves.



This started out as a nanofic about how difficult social situations must be if your hands constantly drip red with blood. Especially hard to explain to prospective employers or dates: the employers might not be able to say anything due to anti-discrimination laws, but who would put up with —

Then Elizabeth leapt into my head as the answer to that question before the question was fully formed. If you still can't figure out who and what she is, your spoiler-hint is "Wallachia".

Edited 2008-12-12: changed the hint to something with a less, er, NSFW first hit on Google.

Friday, December 5, 2008

De rebus fluitantibus pernotatisque

(Disclaimer: Until, oh, this week, I hadn't done any web design since pre-CSS. Please don't take me for someone who knows what they're doing.)

So interesting fact: A float: left block interacts very poorly with <li> bullets.

Direct Implementation

  • Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  • Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  • Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
This isn't an artifact of a particular browser's implementation; this is (almost) a direct result of the CSS specifications. Items have padding-left or margin-left applied to them to indent them, and their bullets sit in this space; however, floated boxes sit atop other blocks' margins and padding. (Theoretically, I think, a browser could implement list-item prefixes as some form of non-margin non-padding spacing, but even if it's theoretically possible, no one does it, so it won't help much.)

You could attempt to tweak the margins, if you know the width of the floated box...

Cheating Implementation: Explicit Padding

  • Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  • Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  • Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
... but then the indentation doesn't reset when you pass up the floated block.

As it happens, it's quite possible to remove the bullets using list-style: none, and equally possible to insert new bullets manually using the :before selector. This also sort-of replicates the behavior of list items:

Cheating Implementation: No Padding

  • • Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  • • Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  • • Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
Of course, list-indentation having been totally removed, it still doesn't look right. So is there a way to have properly indented, bulleted, and flowed list-items to the right of a float: left block?

I suspect a combination of :not, :first-line, and :before could do it, if that were supported. And allowed by CSS 3 at all.

Thursday, December 4, 2008

Numeracy

Her: Can I help you?
Me: I'd like a fifth of a pound of the smoked Gruyère.
Her: [blankly] The smoked... the ham?
Me: [points] No, the Gruyère. The cheese.
Her: Oh. Half a pound?
Me: No, a fifth of a pound.
Her: A ... a fift'?
Me: A fifth. Zero point two.
Her: [confused, goes and checks with another deli worker]
Other worker: [distracted by her own task] Like he said. A fifth. Zero point two. [unintelligible] dos.*
Her: [quietly] What, one slice?

[I go and check the weight of a nearby bar of cheddar while she looks for an already-opened block of Gruyère. The cheddar says NET WT 8 OZ; I heft it lightly. That's a third of a pound, I think, so a fifth should be more than half of this. 4.8 ounces. Well over a slice. I set the cheddar down, and wait. Eventually she returns, her quest unsuccessful; she unwraps a new block of Gruyère and begins slicing.]

Her: [eventually, puts one slice on the scale] Like that?
Scale: 0.02
Me: No, zero point two. Ten times that.
Her: ... zero point twenty?
Me: Yes. Zero point two. [gestures at scale] That's zero point zero two.
Her: [muttering unintelligibly, adds cheese]
Scale: 0.09 ... 0.17 ... 0.23 ... 0.21
Her: Is —
Me: Yes, that's close enough.

I swear I'm going to ask for π-tenths of a pound next time. Or maybe just eleven thirty-fifths.

*Almost certainly "cero punto dos", of course. One can't credibly blame the language barrier here.

Wednesday, December 3, 2008

Nutrition

So I've decided I should have my own breakfast cereal.

It will be like Alpha-Bits, except it will use numbers and punctuation and various glyphs drawn from the more interesting codepages of Unicode 4.0, as well as at least a several Tengwar characters and possibly one or two of these.

Additionally, it will have rain-flavored marshmallow umbrellas and apple-flavored marshmallow dodecahedra.

Included in every five-and-a-halfth (fifth-and-a-half?) box will be a secret decoder ring, lovingly hand-carved from plastic dinosaur bones, which maps characters used in the Voynich manuscript to characters used in the Codex Seraphinianus. Included in every box not containing a decoder ring is a coupon for one free universe, redeemable only after the heat-death of the current one.

The back of the box will have a widely varying selection of puzzles on it, changing frequently: notably, boxes produced on Sunday will have the New York Times Sunday crossword. (We may occasionally license a cryptic from the London Times as well.) There may be the occasional cryptogram, but they'll be proper Vigenère ciphers. Sudoku will be notable in its absence. Occasionally we will also offer cash rewards for finding the solutions to impossible puzzles (e.g. the bridges of Königsberg).

On the bottom of the box shall be printed the phrase "not licensed for resale in Uqbar."

Edited 2008-12-14: corrected spelling of "Vigenère".

Tuesday, December 2, 2008

Nouns

Nouns are divided into four genders or nominal classes, typically called masculine, feminine, edible, and neuter (abbreviated m., f., e., and n. respectively). Note that abstract nouns almost invariably fall into the "edible" gender.

Nouns have three cases: nominative, genitive, and accusative. Unlike verbs, they are not usually marked for number; while some few nouns have plural counterparts, they are typically properly analyzed as distinct lexemes: for example, the etymologically unrelated tsi (eye, f.) and kjaš (pair of eyes, n.).

Conjugation of dox (dog, m.)
Nominative:edox
Genitive:kadox
Accusative:jidox
Conjugation of tsi (eye, f.)
Nominative:itsi
Genitive:hatsi
Accusative:hetsi
Conjugation of cinog (apple, e.)
Nominative:jacinog
Genitive:hacinog
Accusative:acinog
Conjugation of vook (eating-utensil), n.
Nominative:vook
Genitive:xavook
Accusative:vook


Note that in casual speech, the masculine nominative prefix e-, like the third-person-singular verb prefix, is typically elided.

Some texts distinguish a fourth case, the comitative case, which is identically the zero-form for all genders. This case did exist as a separate case with actual case markers until a few hundred years ago, but is now typically seen as an elision of the case markers from the latter words of a conjunction.
e-TevliKjaxaŋa-sere.
NOM-Tevli∅-Kjaxa3pl-to be present
Tevliand Kjasaare here.


(Male and female speakers formerly used different case markers for masculine and feminine nouns; however, this is no longer considered correct usage.)




(Suggestions as to how to lay out the tables above are welcome; I'll try a few things.)

Monday, December 1, 2008

Verb conjugation

Verbs are typically conjugated by taking the dictionary stem and prefixing one of the following:
i-I ~ke-we ~
pa-you ~kje-y'all ~
e-he/she/it ~ŋa-they ~

The "infinitive" form is formed similarly, by prefixing the a-: the scare quotes are present because it also sees use as a finite verb in certain impersonal situations, often where English would use the indefinite third person ("It is raining" or "It is hoped").

In casual conversation, both the third-person prefix e- and the "infinitive" prefix a- are often elided. In some western dialects, ŋa- becomes a syllabic ŋ-.

Verb tenses do not exist as such, and are always formed periphrastically, with auxiliary verbs (almost invariably taking the "infinitive"): thus e.g. kes arahi We will see, formed from the irregular verb is will and the verb rahi see.

Conjugation of is is formally as follows:
is, 's
I shallkeswe shall
paisyou willkjesy'all will
is, 's
he/she/it willŋaisthey will

The truncation of first- and third-person is to 's is, again, only present in casual speech: thus 's rahi I'll see (informal).

As an exception, when referring to members of one's in-group (one's family, when speaking to a coworker; one's coworker, when speaking to a business client), one typically uses the first-person verb forms, not the third-person. Dually, when referring to someone you believe to be in the addressee's in-group, use the second-person verb form, even if that person is not present.

Thus the following possible (and perfectly sensible) telephone conversation:
Kjaxa:Xalo?Hello?
Peter:Xalo, za pasere 'Tevli?Hello. Are you there, Tevli?
Kjaxa:Ve, iɬanta ka vo isere.No, I'm afraid I'm not.
Peter:Irahi. Iɬanta.I see. Sorry.


Or, alternately, the following telephone conversation, with added subtext:
Kjaxa:Xalo?Hello?
Peter:Xalo, za pasere 'Tevli?Hello. Are you there, Tevli?
Kjaxa:Ve, iɬanta ka vo esere.No. I'm afraid he's not.
Peter:... irahi. Iɬanta.I see. I'm sorry.