Turn off iMessage link previews in iOS 10+

There is currently no way to turn off link previews in iOS 10.  This “feature” is a half-baked attempt to add slack-like features, where GIFs, YouTube links, pictures, etc show up in-line in your iMessage conversation thread. I really wish Apple would have added a way to turn this off because it slows down the interface on my older iPhone 6, and also presents a security/privacy risk. If I don’t accept the privacy policy of a website, I used to have the choice to not click on the link go to that website.  Further, by going to that site, I reveal all sorts of information including my IP (and possibly even my location). With iOS 10, the messages app does this automatically, whether you wanted to load an image (on cell data) or not.

There is a way that you can turn off this “feature” when you’re sending links to people: Don’t put the link as the first thing in the message… I use the “.” character to disable this on links that I send.   You can (and should) also send a feedback report to Apple asking them to add in a user setting to disable the “feature.”

I did:

 

ios-turn-off-link-preview

Debugging MongoDB’s 2dsphere geoIndex

When I first learned about MongoDB’s geospatial capabilities similar to PostGIS, I was beyond excited because it meant I would not have to write helper functions to find data along geohash borders.  Currently my data is indexed by geohash, which has great ordering properties, but is a little unwieldy for the “find me x near y”-type queries.

Unfortunately, it seems as though the 2dsphere index doesn’t cover geoWithin queries.  As my collection of geoJSON documents grew from GBs to TBs,  I noticed my tools taking extraordinary amounts of time to perform find queries, which caused me to investigate what was happening under the hood.

First, I double-checked that my geospatial index was present:

mongos> db.my_collection.getIndexes()
[
	{
		"v" : 1,
		"key" : {
			"_id" : 1
		},
		"name" : "_id_",
		"ns" : "telemetry.********"
	},
	{
		"v" : 1,
		"key" : {
			"value.avg_location" : "2dsphere"
		},
		"name" : "geoindex",
		"ns" : "telemetry.*******",
		"2dsphereIndexVersion" : 2
	}
]

So, the index was clearly there.  I also verified that its size was appropriate — it was around 50mb, which seemed fine for this amount of test data.

Next, I ran .explain() on a query to see if it was hitting the index:

Continue reading Debugging MongoDB’s 2dsphere geoIndex

Swift 1.2 and Facebook’s New Login SDK

I’ve had the pleasure of working with Apple’s new Swift over the last few months, and recently ran into some problems integrating Facebook’s API with an iOS 8 app I’m building.

The problem I was having is that, immediately after login, I couldn’t seem to get the user’s access token.

FBSDKAccessToken.currentAccessToken()

was always returning nil, even with the user logged in.

You need to get this token so that you can send it to your Rails app (or whatever you’re using on the back end) and perform Facebook authentication on behalf of your user up there.

Continue reading Swift 1.2 and Facebook’s New Login SDK

Project: Automated Lawn Room

I recently finished creating a 3D-printed, Raspberry-Pi-powered, Twilio-backed lock for one of the oldest rooms in Charlottesville.   The goal? To allow my friends anytime access to my space on the Lawn while simultaneously staying secure.

I was originally going to grant access to all of my Facebook friends  (the Raspberry Pi would use Facebook’s API to check who my friends were), but thought that it might be less chaotic to design my own registration system, so that I can easily control when individual users are permitted to enter my room.

Challenges:

  1. Not destroying a UNESCO World Heritage Site
  2. Designing/Printing a container and transmission to adapt a servo motor to the existing door lock.
  3. No existing “Instructables” for this project (or pieces of it therein)
  4. Learning how to make the Arduino talk to the Raspberry Pi
  5. Getting through the University’s draconian firewall to Twilio. (ended up using a few servers as mirrors to get there)
  6. Allowing manual override for maintenance workers who occasionally let themselves in.

Here’s a video I submitted to the Engineering Student Council as part of a contest.  (The second half shows how it works)

Update:  Some new features!

I’ve been working on a few new features to make my room more intelligent.  One of the features will save electricity by turning lights on only when there are people in the room, and turning them off automatically when the visitors leave.  Another new feature  sends me a text with a picture of the visitor who entered the room.  Finally, I’ve created a lockdown mode so that I can go on vacation without worrying about what will happen to my room when I’m out of town for a weekend.

Calling a method I wrote to control the lights in my room via DMX protocol by way of the raspberry pi.
Calling a method I wrote to control the lights in my room via DMX protocol by way of the Raspberry Pi.