Archives For OS X

a tale told by an idiot

August 14, 2016

Windows10Version14393.67I have been wrestling recently with a series of self-imposed requirements that sprang from two personal needs; the first being the development of “sane” native tools and libraries for manipulating Raspberry Pi 3 built-in peripherals (GPIO being at the top of my list), and the second being a way to find a common language and framework that would work across multiple operating systems, those operating systems being Arch Linux ARM, Mac OS X, and Windows 10. And a web framework would be really nice to have because I’m really getting tired of having to use ssh all the time.

So I did a bit of research and decided to focus on Python, specifically version 3.5 and later. That version of Python is available across all those platforms, and appears to work equally well across them. That means that trivial and not-so-trivial Python applications that aren’t platform specific work equally well across all three. That means I can do a good deal of work on either my Samsung running Windows 10 or my MBP, which includes debugging. I would then transfer the code over to the RPi3 and do final integration there.

The problem I ran into was the choice of a Python web framework. For reasons I won’t go into here I decided to install and learn how to use Django. I’ve successfully followed the getting started tutorials on both the MBP and the Samsung. On the MBP I’ve used Homebrew ¬†to install a number of up-to-date software tools, specifically Python 3.5, while on Windows I downloaded and installed Python 3.5 from the Python site. The only comments I have to make about installing Python on Windows 10 are these:

  • Install Python at the root of the C: drive (i.e. C:\Python3.5, for example). This makes the path to Python a lot shorter than where the default is, somewhere in your private user area.
  • Assuming you installed Python in C:\Python3.5 (for example) you should also add the Python Scripts folder to the path, i.e. C:\Python3.5\Scripts. This will put pip and django-admin in the path and make the instructions for using both the same as under Linux and Mac OS X. I don’t know why the tutorial instructions didn’t point this out.

As I said, running the Django utilities works just fine on Mac OS X and Windows 10. Getting Django installed on Arch Linux ARM doesn’t work, either as a pacman package or via pip. There is no package for ARM Arch, and even though the pip install seems to work, trying to create a default site with django-admin on Arch ARM fails, with django-admin complaining there is no django.core. This makes the second major framework failure I’ve run into under Arch ARM, the first being the failure of Express under Node.js. The Express failure was particularly annoying, as it worked about a year ago when I was investigating Express and Node.js on the Raspberry Pi 2. If anything, these failures have proven that the Raspberry Pi 3, at least under Arch Linux ARM, is not the full first-class client that regular installations are.

I suppose I could be a hero (to someone) if I could find and fix the problems I’ve run into on the Raspberry Pi 3, but I don’t feel particularly heroic. I’e gone down multiple paths now with trying to build a full stack of software with a web front end on the RPi 3, and it’s not gone well. One reason for doing the same types of activities on a “regular” computer is to see if the tutorials are repeatable, and they are. It’s trying to move over to the RPi 3 with Arch Linux where it breaks down.

Perhaps it’s time to realize that if I want a better development experience that I need to spend more money and buy a more commercial system than the Raspberry.

As for where the title came from, here it is:

Life’s but a walking shadow, a poor player
That struts and frets his hour upon the stage
And then is heard no more: it is a tale
Told by an idiot, full of sound and fury,
Signifying nothing.
Macbeth, Act 5, Scene 5

The quote about life could just as easily apply to software development.

Vivaldi 1.0 on OS X El Capitan 10.11.4

I am always on the lookout for the “perfect” browser, or very close to it. Last night I installed Vivaldi 1.0 on my MBP and I’ve been living in it every since. Before Vivaldi I lived in Google Chrome. But after these last 12 hours or so, I’m about ready to cut the cord to Chrome. The biggest feature worth mentioning is is Vivaldi’s very decent memory footprint compared to Chrome. Vivaldi, in particular, will not chew up swap space if Vivaldi is open on my desktop, with lots of open tabs, and I close the lid and put the MBP to sleep.

I still have a lot to learn about this browser, and I doubt I’ll remove Chrome from my MBP, but for now I can say I like it quite a bit. I’ve been a big fan of Vivaldi every since I started running the engineering releases on my Win 8, and later Win 10, notebook. Vivaldi is a now a very comfortable browser for me to use.

You’re viewing CentOS 7 running in VirtualBox 5.0.16, with a micro SDHC card mounted and in turn viewing the Arch Linux ARM ext4 native Linux filesystem I created for my RP3. When I originally created the RP3 micro SDHC card I used my Ubuntu 15.10 notebook as the workbench. But I’ve been wanting to do similar work using my MBP as the primary tool bench, with an eye towards retiring the native Ubuntu notebook with the MBP due to the Ubuntu notebook’s age, rather than attempting to replace the Ubuntu notebook as I’ve written I originally wanted to do. The biggest hurdle to using the MBP was just reading the native ext4 file system on the MBP, as Max OS X has no native provisions to read Linux file systems. This post is about getting to that point. As time goes along I’ll be doing more than just reading the microSDHC, but reading (and then writing) is the foundational requirement, else this is all a waste of time and resources.

Before I go much farther let me properly attribute this from another post, “Mount SD card in VirtualBox from Mac OS X Host,” written by Brady Holt on 21 July 2014. Please note this was done nearly two years ago. This is an update to his post using contemporary software and with my observations.

Software and hardware I’ll be using:

  • OS X El Capitan, version 10.11.3 running on a MacBook Pro (Retina, 15-inch, Mid 2015)
  • VirtualBox 5.0.16 with Oracle_VM_VirtualBox_Extension_Pack-5.0.16
  • CentOS 7 with all updates as of the date of this post with VBoxGuestAdditions_5.0.16 running as a VM

I’m going to create a Linux VM with VirtualBox and use that to mount and at least read the micro SDHC card with the Arch Linux ARM ext4 file system. I had originally looked for a Mac OS X utility to do this, but eventually gave up as the utilities that claimed they could do that had allegedly stopped working with the release of El Capitan because of System Integrity Protection, or rootless, mode. Far be it from me to disable in El Capitan what is supposed to add additional security to OS X. I’m somewhat surprised that I could get this to work, but I suppose that if, at some point in the future, Apple releases a Mac OS X update that breaks what I’ve built here that I’ll be back to using a separate Linux machine.

The first step is to install VirtualBox and then to install CentOS 7 within a VirtualBox VM. I won’t cover that here, as there are plenty of existing how-tos for that. Just make sure that the Virtual Box Extension Pack is installed and that you’ve downloaded and installed the VBoxGuesAdditions and have built it within the VM. That gets everything prepared both on the OS X host side as well as within the VM.

The next step is to get the overall system prepared to mount the RP3 micro SDHC card within the CentOS 7 VM.

  1. Plug in the microSDHC card into the MBP using the microSDHC adapter. I’m using a Samsung 32GB Evo Plus device. Note that it’s named “NO NAME” on the desktop. This is the MSDOS 100MB boot partition on the microSDHC card.
  2. Go to Launchpad and search for diskutil. Launch diskutil. Select “NO NAME.”

  1. Click the Info button at the top right. Note the device associated with “NO NAME.” It’s the third line down from the top, called “BSD device node.” In my case it’s disk2s1. The device associated with this partition is /dev/disk2. We’ll use this later.

  1. At the top of the utility click the ‘Unmount’ button with your mouse. The button text will then change to ‘Mount.’ Please note you don’t want to eject the device, just unmount.

  1. Now we need to create a VirtualBox VMDK file to point to this device. That’s how we’ll get it to mount inside the Linux VM. Open a terminal and type sudo VBoxManage internalcommands createrawvmdk -filename sd-card.vmdk -rawdisk /dev/disk2 at the prompt. The file will be created where ever you run it, so my advice is to change directory to a location where you want this (or preface the file name with a full path) to create the file. Just remember where you left it.
  2. Change permissions on the microSDHC device and the VMDK file to 777. At the prompt type chmod 777 sd-card.vmdk /dev/disk2. This opens up permissions for the file and card to be used later by the VM
  3. Add sd-card.vmdk to the VM’s storage devices. In VirtualBox, under the CentOS VM, select the Storage dialog, and in the Storage Tree under Controller: SATA click the add device button. You will be prompted to either create a new device or add an existing device. Choose to add existing and add sd-card.vmdk.
  4. Check diskutil one more time and make sure that the microSDHC card is still unmounted. OS X has automount and can silently remount the drive. If it does then you will fail to start the Linux VM.
  5. Once the VM is started bring up Nautilus and note two new ejectable entries for the card, a 103MB entry and a 32GB entry. Click on the 32GB volume. You’ll be prompted by Nautilus to enter root’s password for that VM to view that volume. Once that’s done Nautilus opens into the 32GB volume. You can drag and drop files into and out of the midroSDHC’s 32GB volume. I do this to add content as well as pull log files while developing.

One caveat. If you shut down the VM and then want to bring it back up, you’ll need to unmount the microSDHC card like before and execute chmod 777 /dev/disk# again, or the VM will fail to start due to lack of permissions on the raw device.

all in with apple – part 1

November 26, 2015

Taken with an iPhone 6s Plus

For the past year (since November 2014) I’ve been¬†surreptitiously moving from a reliance on Windows, Linux and Android based devices to devices using Mac OS X and iOS. It started with the purchase of an iPad Air 2 in November 2014, the one to the left with the picture of Lucy on the lock screen, and continued until this November and the purchase of the 15″ Retina Macbook Pro on the right. My Olympus E-M10 is in the mix for a sense of scale. And because I like that little camera.

My shift started with my growing dissatisfaction with Android, especially how Samsung was handling Android on my Galaxy S4. Especially with regards to security updates. I have two other Android devices, a pair of 2013 Nexus 7 tablets. I’ve watched those tablets upgrade over the air from version 4.4.2 to 5 and recently to Android 6. It took a long time from Google’s announcement to OTA upgrade, far longer than Apple takes with iOS after an Apple announcement. And Samsung? It did eventually upgrade to 5, then 5.0.1, and finally 5.0.2. Complete with Samsung’s skin and apps. A mess which I was willing to put up with when I first purchased the S4, but after two years of constant exposure, it finally wore me down.

I didn’t realize at first just how dissatisfied I was becoming with Android. And yet, in hindsight, it was inevitable. That dissatisfaction was first expressed with the purchase of the iPad Air 2. At the time I was trying to decide between the iPad and a Samsung Galaxy S2 10″ tablet. The Samsung was about $150 cheaper, but was only available in 64GB maximum internal storage. After two days of vacillating I purchased the iPad with the idea of learning how to do sophisticated image post-processing while on travel. I’d purchased the Olympus E-M10 in September of that year because of a key feature, WiFi interconnectivity with any mobile device running Olympus’ OI.Share app. You could get that app for both Android and iOS. When I got the E-M10 I naturally installed the Android version on my Galaxy S4. And I was very impressed.

The problem was I only had 16GB on the S4, even though I had a 64GB micro SD card installed in the phone. OI.Share couldn’t be coerced into storing the E-M10’s images in the micro SD card, and as a consequence the limited internal 16GB began to fill. After a time I moved some of the images up to Google Drive, and some of them to Flickr, and the majority of them off to my Windows PC. It was awkward but doable, but it added additional steps to my workflow of using camera and phone together for photographic work. And I am not a fan of automatic upload to Google Drive or any other location in the “cloud.”

So in November I purchased the iPad with 128 GB of storage, a Logitech Bluetooth keyboard and cover, installed a few apps, and took the whole combination to Japan for Yama Sakura 67 in December 2014. I’d also taken my Samsung 17″ running Windows 8.1, but I’d left my primary photo storage drive, a 1.5 TB WD My Passport Ultra. I didn’t want it lost or broken. With the external drive at home I didn’t want to use Lightroom. I decided to work everything on the iPad.

The iPad worked pretty well for the most part. I discovered a lot about using the iPad for creative work, and learned to “trust” JPEGs again. That’s because there are no RAW converters for Olympus RAW files on iOS (nor on Android for that matter). In spite of some quirks, the combination was good enough that I depended on it again in April of this year on another Japan business trip, and I’m going to use it once more this December in Japan. The iPad Air 2 and the E-M10 make a portable, potent combination. With WiFi connectivity I can push my finished work up to Flickr, Instagram, and WordPress (especially blogging). And with the purchase of an iPhone 6s Plus, I can use either iDevice to pull images off the E-M10 and use pretty much the same post processing workflow. I still need the iPad with its keyboard for writing.

I was happy enough that by March I purchased a refurbished late 2012 Mac Mini Server model. That allowed me to begin to tie backups from my iPad and my wife’s mid-2012 MBP together. And it was from the Mac Mini that I grew comfortable with OS X. And that helped to ease the decision to purchase an iPhone 6s Plus to replace my Galaxy S4 in early November. That, and Apple’s Upgrade Program. With the Upgrade Program, combined with Apple’s software upgrade policy across their iOS devices, I can now maintain an up-to-date iDevice, the phone. Every year now I’ll get a new ‘S’ device. Right now my opinion of the iPhone with Apple’s custom ARM chips is that anything else is a waste of money. The iPhone is that good.

All of which led me to the purchase of the MBP. I purchased that for the express purpose of replacing, over time, my Samsung 17″ Chronos 7 notebook running Windows 10 as well as my much older Samsung running Ubuntu 15.04. The MBP is combining what I consider the best attributes of both.

The desktop should remind Ubuntu users of Ubuntu’s Unity desktop, with the dock to the left. I chose this combination because I learned, on my Mac Mini Server, that I could have the equivalent of Windows and Linux under one environment. The key Windows feature I want and need is Office. The pieces of Office I need are Word, Excel and PowerPoint. And they work pretty much across either Windows or OS X. There is no office for Linux and there may never be. Trying to work with complex Office documents with LibreOffice, the best of the free office suites on Linux, is a recipe for slow madness. I know, I tried.

And if I need a “pure” Linux? I’ve discovered I can get that by running one or more Linux distributions on OS X via VirtualBox.

Languages such as Oracle’s latest Java, Google’s Go, Python, and Rust are dead simple to drop into the OS X environment. The biggest and the best, Swift, is available through Xcode. And I can share, via a common folder on the OS X file system, files between the Linux VM and native tools on OS X.

Time permitting I’ll do a more detailed comparison between the individual Apple devices and everybody else. But for now I have to say I’m pretty well satisfied. It’s certainly not perfect, but it’s better than most else I’ve been dealing with over the past two-plus years. In spite of what the current critics may say, Apple’s hardware and software is more than good enough, and in many cases, better than the current state of the competition for my use. Your milage, as they always say, will vary.

For me, however, I’m all in with Apple.

Being an old codger, I believe in the power of proper documentation. The better it is, the more powerful it can be, especially when newcomers to a given technology need excellent beginner’s steps to start properly using not just the technology but the tools of that technology. When I went to check the official “Creating an Android Project” on the Google site in case I’d missed something during its release (and as surely as the sun rises every day, I know I’ll miss something key when a new or updated tool is released), I was very annoyed to find that the documentation, especially the screen captures of Android Studio, where of the beta release. How did I know that? Because the little android still adorns the New Project dialog on the Google documentation.

Furthermore, the only visual aids given on that page are the New Project dialog. And so I’ve decided to go through every step in starting a new Android project with Android Studio, complete with commentary. If nothing else you can use this as a visual check list to make sure that your first (or second) project is being started reasonably properly.

Before You Start

Before we get started, make sure you follow these directions: “adding java and java-supported development tools to os x yosemite.” This covers how to install Java, Android Studio, and IntelliJ. The first two are of concern only if you want to just develop Android on Yosemite.

Starting a Project

After installing Android Studio, open up Launchpad or Applications in Finder and launch Android Studio. Click “Start a new Android Studio project.” This opens the “Create New Project” dialog.
Screen Shot 2015-02-01 at 9.28.49 AMI’ve called my project Simple1. My so-called company domain is beebe.guru (because I actually have a domain through Google called beebe.guru). The project location can be anywhere. One comment to make about this dialog; when it opened no the Yosemite desktop it was pretty spread out. I had to re-adjust it quite a bit to make it small like the screen shot. As the button says click “Next.”

Screen Shot 2015-02-01 at 12.18.24 PMFor my uses I chose my minimum SDK to be for Android 5.0. Click “Next.”

Screen Shot 2015-02-01 at 12.21.16 PMIt’s time to add an activity. The Blank Activity is the first one in the list and the one I’ve chosen. It’s also the one that is given in Google’s older Android Studio example, so we’ll go with that. Click “Next.”

Screen Shot 2015-02-01 at 12.52.55 PMThese are all default options, so we’ll go with them. Click “Next.”

Screen Shot 2015-02-01 at 12.54.55 PMA dialog with a barber-pole busy stripe pops up next. You’ll see all sorts of activity printed above the moving busy stripe. You’re looking at the last activity before the dialog is programmatically removed.

Screen Shot 2015-02-01 at 12.55.34 PMIf this is the first time you’ve created an account, you’ll get a complete IDE with some extra dialogs over the top. The one dead center gives a tip every time you start the open IDE if the “New Tips on Startup” checkbox is checked. The green dialog in the upper right corner is asking you to share execution statistics with Google. I personally chose no.

Screen Shot 2015-02-01 at 12.56.41 PMThe default device is the Nexus 4, and not the Nexus 5, oddly enough.

Screen Shot 2015-02-01 at 12.57.03 PMI’m not writing for a handset, but for my Nexus 7 2013 tablet. If you want to change to another device, click the dropdown menu as shown above (and don’t ask me what it’s named, because I have no idea), and select it. In this case I’ve picked the Nexus 7. I know this is the 2013 version because of the resolution and because the Nexus 7 2012 is marked explicitly as such.

Screen Shot 2015-02-01 at 12.57.34 PMHere’s what the final IDE setup looks like with my project and my device. I’ve essentially created an Android “Hello World” application (as you can see in the screen emulation). In the next part of this sequence I’ll show how to attach an Android device (my Nexus 7) and side load this very simple application into the device. All this under Yosemite and the Mac Mini late 2012.

For those who’re curious, all of this operates identically on both Windows 8.1 and Ubuntu 14.10 Linux.

If you’re very curious, you can check the file system locations called out in the original Google documentation. I won’t duplicate them here.