Showing posts with label iOS. Show all posts
Showing posts with label iOS. Show all posts

Sunday, October 8, 2017

SSL Secure Communications in XTension

My day job remains, happily, the Home Automation software XTension. We’ve managed to avoid creating a “cloud” for ourselves and yet have to weather lots of questions about data security. Especially for the Web Interfaces that we have customized for mobile clients or desktop clients. The truth is, if you’re willing to write a few numbers on a card in your wallet you can verify the serial number of the certificate from a public computer, and if you’re connecting from your own laptop or phone then your keychain will do that for you and it’s trivially simple to know if someone is performing a man-in-the-middle type attack despite the horrible brimstone and everybody is going to die warnings from your browser. Secure Communications in XTension

Friday, September 22, 2017

cMediaFile a Xojo class for serving video or audio files to Safari on MacOS and iOS

My day job is as a developer for XTension a Mac based home automation system.

Some years ago something changed in Safari and it stopped playing the video clips that XTension saves off in response to motion or other perimeter violations. I could never get it to work on iOS either. This was remarkably frustrating to have to tell people that to view the video archives in the Web Interface they had to use a different browser. It continued to work just fine in Chrome and Firefox. I thought at first that it had to do with using a self signed certificate but it turns out that Safari absolutely requires you to support the Range header and to properly reply. The other browsers were happy with my response of the entirety of the file even though they also initially ask for a smaller range of bytes. Safari was not happy with that and flatly refused to load the files at all unless I supported their range request.

The Web Remote and Mobile Web Remote in XTension are developed with Xojo and the built in webFile class does not support range requests. Since figuring this out I’ve been able to implement a replacement class that does support them. Should any other Xojo developers need to serve up video or audio files to Safari or Mobile Safari they are free (as in beer) to use the cMediaFile class and even to improve it and make new submissions at the github repository.

Download the class and example project: https://github.com/PlanetaryGear/mediaFile

Here’s an example of XTension’s Video Archive page now working again in Safari!


Tuesday, June 4, 2013

iPhone restore problems

I replaced the battery in my iPhone 4 the other day. It seemed to work fine till it ran all the down yesterday. Upon plugging the phone back in it got itself stuck in an infinite loop of rebooting.

I placed the phone into restore mode and plugged it into the computer, but it wouldn't get past the extracting and preparing software phase with a "2001" error. Which Apple says is something to do with USB. Much trying with new cables and restarting resulted in nothing.

After switching back to the old battery though I was able to restore the phone (and I wonder if I had though to do that initially if I could have kept the things that hadn't been backed up that day, alas) but I still wasn't able to reload it from the last backup because it refused to show up in iTunes.

Finally i noticed that it was showing up as an empty iPhone in Aperture which was running in the background. After quitting that and restarting iTunes I was able to make it show up and am running the restore now.

A tower of unrelated problems is so much fun to tease out.

So... Bad batteries can cause the phone to refuse to connect properly even when connected to power. And Aperture (and probably iPhoto) running at the same time can keep an iPhone from showing up in iTunes if it's been just recently restored.

Putting that information out there for any others that might find themselves in a similar situation.

Update:
I've heard back from ifixit.com from where I got the original battery, and I'll give them a plug for the best support ever, just shipping me a replacement and no hassle. I've used these guys many times in the past for parts and tools and never had an issue and the one time I did they really came through. I know you can find the batteries a little cheaper if you're willing to order direct from china or go on ebay, but their wonderful takeapart videos and their wonderful support are more than worth the extra few bucks. Support a company that will support you back!

Saturday, April 14, 2012

how NOT to update the paths to files in your iTunes library

learn from my mistakes...

I have many kids movies and tv shows in my iTunes library for playing on the apple tv and the iPads for the kids to watch on car trips and such. Years ago I moved it to a portable external drive. I recently outgrew that drive and purchased a new, shiny 1.5TB firewire 2 drive. I copied all the original ones over and then was faced with the problem of how to get iTunes to realize that all the moves had moved. I only ever stored movies on the external drive, all my music and other things I keep internal to the macbook.

You can do this easily enough by just turning on and off the checkbox in the preferences for when to copy items into the itunes folder. Turn it off when dragging in a movie and back on for everything else. For purchased movies you have to move them in the finder and then delete and re-add them from iTunes, which is more steps but I dont purchase movies that often so it’s hardly a handicap.

But then you can’t just copy they whole iTunes library from one device to another, you need to be able to move parts of it around and there doesn’t seem to be a way to batch change the paths.

When I undertook the exercise I thought that I would just delete them all from the database and then drag them back in from the external drive and re-organize them. This is what I SHOULD have done. Instead I went searching around the internet and found other people in similar situations that had edited the iTunes.xml file that stores the information. I opened this up in BBEdit and was able to see all the old paths and easily do a replace to put in the path to the new drive.

However, iTunes doesn’t normally read that XML file, it normally uses a binary database file in the same folder that ends with “.its” and so you have to delete that to force it to rebuild it with the new path information. I did this and restarted iTunes (after making backups of course, which come to think of it I should have just immediately put back)

iTunes chewed on that for quite some time and then it all came up and the movies played from the new drive fine. I didn’t immediately notice all the other things that had gotten broken.

iTunes no longer knew about any of my iOS apps, it wanted to downloaded purchased items from my phone and proceded to do so for ALL the apps I had ever purchased. It has also lost all my podcast subscriptions which I will be rebuilding next.

So when searching for info on how to move portions of your iTunes folder, think twice before deleting the its file and making it rebuild it from the XML as it appears that not all the information is actually stored in the xml file.

Not a disaster as things go, nothing was actually lost, just making more work for myself by trying to reduce the work for myself ;) Which is pretty par for the course on a normal day!

MORE INFO as of 4/16: Got tired of trying to get everything back and restored backups of my iTunes library. Spent quite a bit of time investigating applescript methods of updating some of the location paths before I discovered that iTunes actually has built in ability to fix this itself. After locating one of the moved files it asks you if you’d like to use that new location to try to find others. Never noticed that before ;) And it did find all the other moved files on the new disk. So we’re all back to normal now and while I’ll never get those hours wasted back I have a much deeper understanding of iTunes applescript dictionary now which I’m sure will come in handy someday.
.code { background:#f5f8fa; background-repeat:no-repeat; border: solid #5C7B90; border-width: 1px 1px 1px 20px; color: #000000; font: 13px 'Courier New', Courier, monospace; line-height: 16px; margin: 10px 0 10px 10px; max-height: 200px; min-height: 16px; overflow: auto; padding: 28px 10px 10px; width: 90%; } .code:hover { background-repeat:no-repeat; }