Tuesday, February 23, 2010

Could Apple Transition to Using iPhone Apps as Safari Plugins?

I've been knee deep in trying to keep an old style NPAPI (Netscape) plugin working under Snow Leopard, and believe me it is not easy. And one of the reasons it is not easy is that Apple has used the 64-bit transition to lock down what an NPAPI plugin can do and when it can do it. No longer are we allowed to do things like bring up our own windows, draw whenever we feel like it, create our own timers, track our own mice and generally do things the easy way; we have to live in the browser and follow the browser's rules.
I refer you to the Web Plugin Programming Topics Guide
Beginning in Mac OS X v10.6, on 64-bit-capable computers, Netscape-style plug-ins execute in an out-of-process fashion. This means that each Netscape-style plug-in gets its own process separate from the application process. This design applies to all Netscape-style plug-ins. It does not apply to WebKit plug-ins, nor at present to WebKit-based applications when running in 32-bit mode.)


It goes on to enumerate a large number of new restrictions on how plugins are supposed to operate in their new out of process home. At this point, it becomes pretty hard to justify using a NPAPI style plugin for any but the simplest plugin for Safari; it is just too strangling. So the mind turns to WebKit plugins which are basically Cocoa NSViews with a few limitations and added message handlers. As the quote above says they are not (at present) limited in such a way as Netscape plugins; in this way Apple is nudging people to use WebKit plugins if for no other reason that they allow you to do things that the NPAPI plugin do not.

And here we come to the idea for this posting, it seems as though Apple is interested in locking down and rationalizing Safari plugins. It is also reasonable that at sometime in the future, they will allow plugins for Safari on the iPad. It is also almost a given that those plugins will not be NPAPI style plugins, but will instead be UIView or UIViewController derivatives. And at that point, the question becomes, wouldn't the UIView style plugin with its simpler and more modern object design make a cleaner foundation for plugins for Safari on the Mac? Apple already has an iPhone simulator on the Mac. Of course, there would have to be some extension allowing mouse hovering events.

    Advantages
  • Code sharing between Mac and iPad
  • Plugins are closer in scope to iPhone Apps then full blown Mac apps.
  • At this point most Objective-C programmers are iPhone developers so developer pool would be larger
  • Expand iPhone apps to the Mac
  • iPhone Apps are used to being sandboxed

Anyway, just a thought.

Thursday, February 18, 2010

Inexpensive Ion HTPC

As I want to improve my free MythTV remote, and I needed to "eat my own dog food", I decided to build a HTPC box for the TV room to run the MythTV frontend. I'd been interested for a while in a small, low power PC based around the Nvidia Ion chipset. A little research indicated the board to get was the Zotac IONITX-A-U as it:
  • Came in a compact, mini-ITX form.
  • Has the 64-bit capable dual core Atom 330N processor
  • Has multiple output ports including VGA, HDMI for video and SPDIF coax and TOSLink optical for audio, amongst others.
  • Gigabit Ethernet
  • External power supply to keep the heat out of the case.

The most important feature was quiet, with the related property of energy efficiency. There are many cheap PCs out there, but few can play 1080i MPEG2 videos while draining 31 Watts.



I put in 2GB of RAM which allowed me to configure the BIOS to set aside half a gig for video memory. I removed the included wireless card, as I have Gigabit ethernet in my TV cabinet, and there's no reason to waste whatever minimal energy would be used by the card. Threw in a 60 GB laptop drive I had from a few MacBooks ago, and put it in a small case. The hardest part of installing MythBuntu 9.1 64-bit, was scrounging up an external optical drive. So, all in all a very easy thing to put together.

It works fairly well. I've put my children's DVD collection on a network share and use MythVideo to watch that and recorded TV shows. Since this was my first real standalone MythTV frontend, I had to rejigger my video setup such that both the backend and frontend used both the same relative paths to videos and movie posters (both Linux boxes have paths of the form /mnt/MyNAS/MyVideos and /mnt/MyNAS/MyPosters). Once this was all setup, it's extremely convenient having a kid's movie a few touches away. I had read complaints about the fan needing to be run at a lower speed, but I really can't hear it from the couch.

    Energy usage measured via Kill-A-Watt
  • Idle Running MythTV Frontend: 25W
  • Playing DVD Image: 26W
  • Playing 720p MPEG2 (recording of 24 on Fox): 28W
  • Playing 1080i MPEG2 (Big Bang Theory on CBS): 31W
I have got to figure out how to get the box to put itself to sleep when I'm not using it.

My old LCD TV is impossible to get the VGA just right (no surprise that) so I have a two inch black bar on the right of the display, but I'll be moving to use the DVI port as soon as Monoprice gets me an HDMI switch.

It's interesting as a Mac guy seeing this little DIY assembly. On the one hand, it's pretty inexpensive and I wouldn't want to waste a Mac on single purpose computing. On the other hand, it's pretty darn cheap. Here's a photo comparing a older generation Mac Mini with my system.


The Mini is definitely a superior computer in terms of build quality. The M350 case is nice enough, but it is still ill fitting sheet metal, and the ports still wiggle and flex when you try to push a connector in. In comparison, the Mini is just rock solid, and smaller while still having a faster processor and an optical drive. And it's a darn sight more attractive. On the other hand, the Zotac has a ton of extra ports, including a variety of internal SATA and USB connectors. Different needs.

Cost:
  • Motherboard: $185
  • RAM: $45
  • Case (with Shipping): $50
  • Hard Drive: Free
  • --------------
  • Total: $280

Monday, February 01, 2010

A Cell Phone Game for Children

I was playing hide and seek with my 2 and 3 year olds, and came up with this variation.

Requirements
2 Cell phones, one of which with a speaker phone mode.
Instructions
1) Call the phone with the speaker phone mode, answer and put it in speaker mode.
2)Have someone hide the phone in another room.
3)Let the child try and find it by yelling into his phone.
 
Google+