Friday, November 07, 2014

How to Insert Superscripts and Subscripts in Pages for iPhone

I'm trying to find customers for my Chemistry Keyboard extension for iOS 8, so I've been doing things like searching for questions people have asked on the web, the answer of which would be "Buy Chemistry Keyboard", and the title of this post would be one of the more common questions with that answer. I've tried it out on both my iPhone and iPad, and my keyboard will indeed insert superscripts and subscripts into Pages for iPhone and iPad.

So get it and you'll soon be quickly generating strings like:
2•Fe²⁺+2•H₂O→2Fe³⁺+H₂+2•OH⁻ 

Friday, October 31, 2014

Chemistry Keyboard - an iOS Keyboard Extension for Chemists


To learn a computer language, you have to write something in that language, just reading the book doesn't help much. So when Swift was introduced at WWDC, I had to assign myself a project to learn the language. As Apple also announced keyboard extensions, and I've long been kicking around the idea of a keyboard specifically made for Chemists—my degree field is Analytical Science, a branch of Chemistry—it seemed like a small enough project to get done in my limited free time.




Not that it was always smooth trekking. I could most certainly have written it faster in Objective-C, the Swift tools took a while to settle down; for a while I was killing the background syntax checking process every few minutes. But,  in many ways, Swift makes life easier; I'm particularly enamored with Swift enumerations, which turned out to be a powerful way to model my keyboard, and make my code extensible to writing different keyboards with just a few changes.

As for writing a Chemistry keyboard, I imagined what it would be like to write inorganic formulae such as:
2•Fe²⁺+2•H₂O→2Fe³⁺+H₂+2•OH⁻
So the first thing was figuring out what characters would be needed. Subscripts and superscripts of the numbers, +, -, (, ), and some arrows. And since I wouldn't want the user to waste time switching between keyboards, the common elements. Since Carbon is so common, along with Oxygen and Hydrogen, they'd get their own keys, but the other elements would have to be packed together in related groups or in one big grid.

So the Halogens, the common ones, would share a key:
Just tap the key and slide right to choose one, or don't slide and get Chlorine.

And as for superscripts and subscripts,
This is a tap and either a drag down for a subscript, or a drag up for a superscript. Very fast. You'll notice that the characters themselves are on a long tab, so as to not be hidden by the tapping finger. The appearance of the keyboard mimics the standard iOS keyboard, supports both regular and dark appearances, and even makes use of the 51 separate keyboard localizations for the word 'space' and the various name for the return key. Everything from 3 different flavors of Portuguese to Cherokee. 

One thing about gestures is that to select a character there does not have to be a one-to-one correspondence between movement and location. You don't have to drag your finger all the way across the screen to get to the last character in a flyout. The fact is that dragging is more accurate than tapping, given the right amount of feedback a drag can be half as long as the distance your selection covers. The user will quickly figure it out. 

Unlike many keyboard extensions, it doesn't need a network connection and switching out is a simple tap, not some complicated unlocking. I'm sure that it will take some more refining, but it actually came out pretty well.








Saturday, October 25, 2014

Why I Bought a 2012 Mac Mini over the new 2014 Mac Mini

Apple announced a new Mac Mini last week. I had been waiting for the news as my current situation leads me to program at my desk 95% of the time, making a desktop viable, and yet I don't feel I can justify a Mac Pro or the new Retina iMac. And as for a non-Retina iMac, I already have a beautiful Thunderbolt display, so there would be redundancy. So, I quickly bought the best Mac Mini available for my needs, the 2012 i7 quad core. Best Buy still had plenty of stock, but I doubt that will last, and the next day there was refurbished stock at the Apple refurbished store which was quickly gone (and presumably is mostly now on eBay) so I'm sorry I didn't wait.

As to why the 2012 is better for me than the 2014.

First of all, I'm coming from using an Early 2011 MacBook Pro 13.

Geekbench as measured by me on my own MacBook Pro i5 dual core @2.3Ghz

  • 64-bit Single-Core 2222
  • 64-bit Multi-Core 4819
In retrospect, being someone who makes a living coding, I probably should have gotten the i7 version of this computer. 

Look at the Mac Mini 2012 i7 quad core @2.3Ghz, again measured by me
  • 64-bit Single-Core 3110
  • 64-bit Multi-Core 11998
Primate Labs estimates the Mac Mini 2014 build to order i7 dual core @3.0Ghz
Pretty obviously, the 2012 quad core beats the pants off the 2014 dual core at multi-core and is almost identical at single core. And this is with a 2014 custom build to order that costs $1199 (with a 1TB Fusion Drive and 8 GB of RAM) versus a stock 2012 that costs $749 (with a 500GB spinning platter and 4 GB of RAM). 

I want to recreate the other specs of my MacBook, so I will move my 480GB SSD and 1TB hybrid drive over (I have a 2nd hard drive in the MacBook's optical bay). And I want to upgrade to 16GB. With the 2014, I can't do that. I can't put 2 2½ inch drives in the new mini. I guess I could order a 512GB SSD with the 2014 and void the warranty by installing my 2½ inch 2nd drive, I think. But this would bump the price up to $1499. 

Then there's the matter of the RAM. I have to buy it from Apple with the 2014. Bump the price to $1699.

To summarize.
With 2012 (and 2 drives I already own)
  • Stock i7 quad core $749
  • 16GB of RAM $136
  • OWC 2nd Drive Kit $29
  • 480 GB SSD (already own)
  • 1TB hybrid (already own)
  • Total $914
  • End product: Faster, 1 Thunderbolt port, 480GB SSD, 1TB hybrid, Intel Graphics 4000
If you don't already own the drives, this will be more expensive. 

With 2014 (and 1 drive I already own, which I can apparently install while voiding the warranty).
  • Build to order i7 dual core $1699
  • 1TB hybrid (already own)
  • End Product: Slower, 2 Thunderbolt ports, Intel Iris Graphics, 512GB SSD, 1TB Hybrid
The one thing that I wish I could get is 4K display support. The new Mini has Intel Iris graphics which are not only considerably faster depending on how you use them, but are also capable of driving 3840×2160@30Hz and  4096×2160@24Hz. The 2012 maxes out at 2560×1600@60Hz. As an Amazon Vine member, I get sent monitors for evaluation occasionally, and it'd be nice to be able to accept a 4K display. Regardless, no Mac Apple currently ships is future proof against the inevitable Retina Thunderbolt Display that will ship after Apple/Thunderbolt starts supporting DisplayPort 1.3, so the 2014 Mac Mini will not be driving 5K Retina displays. 

I don't care about the loss of the FireWire port.  I don't care about the improved WiFi as this will be hooked up via Ethernet. Another Thunderbolt port would be nice for driving either 2 largish monitors or getting maximum data throughput, but Thunderbolt is daisy chain able. And presumably, the PCIe SSD in the new Mini will be faster than the SATA III SSD I'll be using. 

Given what I'll be using it for: computationally intensive, non-graphically or throughput intensive Xcode development, the 2012 model was far and away the better value, and I'm almost saddened that Apple couldn't put together the kind of hot rod that a user like myself would find compelling.

[Update: I spent a couple hours this morning migrating my old hard drives into the new Mac Mini, and it is now my primary computer. Some quick performance tests versus my old MacBook Pro 13:


  • Case 1: A moderately sized Objective-C iOS Project from scratch (cleaned and caches deleted)
    • MacBook Pro i5 dual core  @2.3Ghz 44s
    • Mac Mini 2012 i7 quad core @2.3Ghz 27s
  • Case 2: A moderately sized Swift iOS project from scratch (cleaned and caches deleted)
    • MacBook Pro i5 dual core at @2.2Ghz 47s
    • Mac Mini 2012 i7 quad core @2.3Ghz 22s
So, my compiling/linking performance is on the order of twice as fast using the same hard drives, but different CPUs/RAM/SATA connectors. So, I'm pretty happy I went with the quad core. Sorry I don't have any measurements against the 2014 Mini.

Oh, and here is a screenshot of the Activity Monitor applications 'CPU Usage' window when compiling an app, so the ability of the quad core CPU to have 8 concurrent threads is really getting a workout by Xcode 6.

]


Wednesday, September 03, 2014

On .Net Rocks Talking about the Swift Language

Last week, I recorded an episode of .Net Rocks about what it's like learning Apple's new Swift language. I think it went well enough, although I wish I could go 10 seconds without saying "you know", and I did go into the weeds giving my impressions of what motivates Apple.

An hour is just not long enough for the topic, and we only just did a very impressionistic coverage of the language.

Regardless, I thought it went fairly well, and worth the time to listen to.


Saturday, August 30, 2014

My Thunderbolt Display Started Flickering and Going Blank...

I had a strange experience over the week involving my local, Nashua, NH, Apple Store. It all started when my Apple Thunderbolt Display started flashing black rectangles and then going blank. As it did this with both my MacBook Pro and the family MacBook Air, I figured it was something wrong with the display. So, I booked a Genius Bar appointment.

I boxed up the display and took it to the mall. Sitting it on the Genius Bar, we weren't able to recreate the problem immediately with the Store's Air, so they took it into the back for observation. The next day calling to tell me that the panel had failed which would be an $833 repair, as this would be on a display that I could probably find for $900 if I searched online, and I would end up with a used Thunderbolt Display, I told them to scrap it and set about rearranging my home monitor situation. I have a Viewsonic monitor with an even nicer panel than the Thunderbolt that I could repurpose as my primary monitor, although I was not happy about losing the Thunderbolt's docking capability. 

And here comes the strange part. A couple days later, the Apple Store calls back to tell me that since they had the parts anyway, they had decided to try switching out the motherboard instead of the panel, and the resulting display was no longer showing the failure even after 6 hours of testing. So I could have my monitor back for $185. I jumped at that. I had been missing it. 

At the store, the Genius who took me my display told me the odd story that the original diagnosis of a bad panel was just the worst case scenario, and they hadn't been sure at the time. Which is definitely not what they had told me when I'd told them to scrap it. I had thought the symptoms I was seeing were pretty strange for a bad panel, and I'd argued at the time with the woman on the phone that it might be a bad power supply, and at the time she was adamant that it was the panel. So I had accepted the Store's diagnosis. 

So, I have my monitor back. Time will tell if the repair worked. I'm glad the Apple Store repair people didn't scrap it, and had taken the time to try something even after I had given up hope, but I have to wonder why they gave me such a bum diagnosis in the first place.

 [Update: well I've had it on my desk for a few hours and it's starting to go directly to a blank screen every few minutes, which is different than what I had been experiencing before where it was mainly large black rectangles followed by sometimes going blank . Plugging and unplugging brings it back. So maybe it wasn't the motherboard, or maybe this motherboard is going bad too. Hooking up a spare Thunderbolt cable to the Thunderbolt port on the display allows me to drive the monitor 'backwards', and I have not seen any blanking in a couple hours, so my current diagnosis is that the integrated cable is bad.]

[Update: After several days of driving the monitor 'backwards', I have seen zero problems. So I'll be heading back to the Apple Store to ask them to replace the Thunderbolt cable and give them a suggestion about testing before telling someone their $900 monitor is scrap worthy.]

Thursday, July 17, 2014

Some Old TV Show is Always the Most Recent on My Apple TV

In January, I purchased a copy of the 'Culture Shock' episode of 90 Day FiancĂ©.  And ever since it's been shown as the most recent episode whenever I select the TV Shows section on my Apple TV. Finally got sick of seeing it enough that I investigated, and it turns out that somebody mistyped 01/19/14 as 01/19/24 which means that unless somebody edits it, it'll be the most recent for the next 9½ years.

I contacted iTunes support and they got back to me wanting my order number for some reason when they could have just searched for the problem. Oh well, I hope they fix it.

[Update: after 5 e-mail exchanges, being asked to re-download the show (which made no sense) and 2 consultations with a manager, iTunes tech support let the producers of the show know about the error, and now my Apple TV is showing the appropriate image for the most recent TV show.]

Friday, June 06, 2014

Something in /var/folders is Preventing My Mac from Booting

A couple months ago, my MacBook Pro stopped booting reliably. It would just sit at the Apple screen and spin, sometimes all night. I could use the repair partition to re-install OS Mavericks and get back to work after a couple hours of downloading, installing, but it would get back to this bad behavior the next time I needed to reboot, which thankfully is not often. And safe mode booting didn't help same symptoms, so the problem wasn't in a cache known to safe mode.

I read on the support forums talk about the /var/folders directory which is used by the OS for some sort of caching. So this morning, when my son left my MacBook without its charger and drained it to the point of needing to reboot, I got another hang, and instead of two hours of reinstalling, I booted into the recovery partition, launched the Terminal app, cd into my normal boot partition, found the boot partition's /var/folders and deleted it.

And I then rebooted normally. So something in that folder is hanging up the boot process, I just don't know what.
 
Google+