DreamRight Wherefore Art Thou

I introduced DreamRight in my aptly named post Introducing DreamRight. Since then I’ve graduated from RPI, moved to Schenectady, adopted a dog and started work as a mobile developer at Transfinder. Excuses, I know.

Anyway, you’ll be absolutely devastated to hear the development on DreamRight has been temporarily suspended. My reasons are threefold (and will sound an awful lot like excuses).

  1. I had garnered all the knowledge I could regarding custom drawing routines and UIView Animations
  2. I moved onto another app that you’ll soon be hearing about
  3. I was busy!

That’s not to say I didn’t make any progress… I managed to get my custom dream log display working jusstttt right – check it out:

Introducing DreamRight

I’ve been interested in lucid dreaming and sleep science for quite a while… One of the best ways to improve lucid dreaming skills is to keep a dream diary. I’ve tried this in the past and simply cannot bring myself to wake up and immediately type out or write down my dream as it quickly starts to fade from memory. I’ve had more success using the voice recording app but I had no easy way to organize these snippets or do anything useful without exporting them. Additionally, it quickly became too much trouble for me even start/stop/save a clip when all I want to do is close my eyes again.

DreamRight is an idea I’ve been tossing around in my head for some time. I’m focusing my personal programming projects on UI/UX where my skills are most lacking and decided this project would be a great candidate. Here’s a standard use case for the app:

  • Enter sleeping mode
  • Have a dream
  • Tap anywhere on the phone to activate voice recording
  • Tap again to stop or wait for the configurable silence timeout
  • Rinse and repeat until morning
  • Tap and hold to leave sleep mode and save your dreams
  • Add notes, transcribe recording to text, share dreams, etc

In essence this is a pretty simple app. However, like most of my projects, I can think of countless ways to expand functionality. In my other large scale iOS project, Rise, I started with the utility and am leaving most of the design until later. With DreamRight I’ve decided to take the opposite approach – placing design first and only moving on to a feature when I’m absolutely satisfied with the design.

So far all I’ve done is create the intro screen along with a little helper I built to design the star animations. I’m working on the dream log view and then will move on to the actual sleep mode. If anyone with an iPhone is interested in testing I’d be happy to add you as a tester – all I need is an email address. Take a look!

 

Quiz App for Transfinder

I’m graduating soon and have been busy the past few weeks applying and interviewing for a handful of positions. One of these positions is with a fairly small company, Transfinder. Transfinder provides tools for school districts and parents to enhance safety and track a variety of factors for report generation. After a successful phone interview I was given a programming project for the next stage of the interview process. Transfinder gave me access to their API for three days and I was tasked with developing a program utilizing the API in some way.

The assignment was very open ended – there were no requirements on a programming language or specific functions. In the past year or so my personal projects have shifted mainly to iOS and Objective-C so an iPhone app was the clear choice. I developed an app that pulls data on students and schools from Transfinder’s API. The user is then presented with a simple quiz on students’ association with schools. This is a fairly simple description but the project also involved multithreading and custom draw routines. I’m very happy with the end result and it landed me a second, in-person interview. Check it out!

Campus Key for Foothill College

I took an iOS development class at Foothill College a little over a year ago and ended up developing a small app for them. It’s a system to generate “key request forms” – a form that faculty and staff have to fill out for each and every office/building they need access to. I learned some neat tricks making it and am pretty happy with how it turned out.

 

Introducing Rise

I’m an avid biker currently living on the slope of what could be considered a plateau. Downtown elevation is ~5-10 meters, I live at ~60 meters and the top of my campus is ~100-120 meters. Suffice to say, I’ve been doing some hill training. I’ve used MapMyRide to track my workouts in the past but I’d like a workout tracker centered around elevation. Now entering the ring: Rise.

Rise aspires to be a simple, straightforward application geared entirely around elevation data (leaving the possibility for almost endless expansion). So far, response has been mixed – many people don’t see a need for this app and it’s been brought to my attention that Strava provides similar elevation graphing options. However, I believe by focusing mainly on elevation that my app will be able to match my high standards of simplistic UX and beautiful UI. Also I want it so I’m doing it.

I’ve been developing Rise in my free time for a little over a month and I’m very pleased at the progress I’ve made. I’m still in the experimental stages and have put no thought or time into UI or UX. I’m confident I’ll be able to get the elevation graph to display just the way I want it but I need some guidance/assistance in coming up with a “workflow” for the app. I haven’t reached the point where I’m ready to dedicate my own focus toward UX design and it would be wonderful to find someone interested in working on this with me.

Here are the features I’ve got working:

  • Local GPS lat/long/elevation logging
  • Google elevation API queries using lat/long from the GPS
  • Data upload functionality for data to aid with a best-fit algorithm for the elevation chart
  • Local viewing of uploaded data in CSV or TXT with the ability to export the data
  • Graph support – about halfway to where I’d like it to be but fully functional in its current state
    • Zoom and pan within proper bounds
    • Logic implemented for gradients under slopes of varying strength
    • Dynamic axes that update automatically upon pan or zoom

Here’s what I’ve got on the docket before an initial release:

  • Theming support
  • Ability to select slopes of the plot in order to view additional data like min/max/average speed
  • More chart data animations
  • Chart export options
  • Data unification algorithm
  • UI + UX

Well, that about does it for this introductory post… here are a few links for you guys and a look at the current graph:

Rise on Github
Uploaded Data


Rise App

Remotely Control iPhone via SSH and VNC

This is an issue I spent far too much time time on. I stumbled upon a great new game, Threes, and had become consumed with the internal workings – how the game chooses what card to produce, where to place it, etc. In order to get some real data to work with I needed to complete a multitude of games, all while keeping track of which cards were produced and where. This is the type of menial task I have no patience for and I quickly began to seek a method to do this automatically.

I had a jailbroken phone – something you will need to do have if you are interested in any of the methods I am about to describe. This method is 99.9% effective and, if something goes wrong, you can completely fix it by restoring through iTunes. Unlocking your phone is dangerous – it has the possibility of leading to a “bricked” iPhone. Jailbreaking is not unlocking. If you’re interested in jailbreaking check out evasi0n – the latest version of their tool is working on iOS 7.0.6.

With that out of the way, here’s what you’ll need and why:

  • OpenSSH: SSH is ubiquitous method of remotely accessing another system through the command line. This is how we’ll interact with the iPhone and send it the commands we want.
  • SimulateTouch: This package allows you to (you guessed it) send touch events to your iPhone using command line tools.
  • Optional Veency: This is a VNC server that runs on the iPhone. VNC is another tool that allows you to remotely access devices. However, unlike SSH, it allows you to see the screen of the remote device and send things like touch and keyboard events. But I thought we were using SimulateTouch to send touch events? Yes, that’s right. Though Veency can be used this way as well I’ve found it to be far less reliable than the SimulateTouch library. Sometimes the commands I send are just lost in the ether.
  • Optional Activator: This allows you to set up a handful (read: a ton) of custom gestures and actions that can do anything from launch applications to disable WiFi to restart your iPhone. It also, conveniently, has a command line interface which can be used to activate any of its abilities via SSH – no gestures needed.

That’s it for the software! Everything I just listed can be downloaded, for free, through Cydia. Cydia is installed automatically when you jailbreak and is the de facto way of installing 3rd party software.

So, now that we have all these tools – how do we use them?! I’m a big python buff so all of my examples are going to be in python. You can use any language you like, but you’ll have to interpret the mysterious code I provide you.

Before I start with examples, here’s the biggest pitfall of our setup:

We don’t have a way to view the current screen in applications that run at 30 FPS or more. Veency simply can’t keep up and provides a distorted display. I’ll explain how I’ve been getting around this in my examples below.

Connecting via SSH:

I’m using Spur as my SSH interface. You can use whatever you want. We use the username ‘root’ because we want full access to the iPhone filesystem. The default SSH_PASSWORD is ‘alpine’ (and has been forever) – I recommend you change this as it is somewhat of a security issue.

Connecting via VNC:

Here I’m using the vncDoTool. Again, use what you want. You can set up the VNC_PASSWORD in the Veency settings.

Sending Touch Events:

The SimulateTouch library makes this dead simple. My example above shows how to make a swipe in any direction. You provide the X,Y coordinates of the start position and the end position. The last two commands are the duration of the swipe and the orientation of the device (1 = portrait).

Taking a ScreenShot:

My first example instructs Activator to take a screenshot. My second example uses VNC to hold down the power button, press the home button, and release the power button – all in quick succession. As you probably know, this is the built in way to take screenshots in iOS. These screenshots will be stored in your camera roll.

Accessing the ScreenShot:

This is a little more complicated. What we’re doing is listing the files in our screenshot directory by their creation time (yours may not be 108APPLE but it will be in the same DCIM directory). We grab the first of these files and assume (correctly) that it’s the screenshot we just took. We then open this file with SSH – this effectively stores the image in memory. Then we use python to open a file for writing – this is where we’ll store the screenshot. We use shutil to copy the screenshot from memory to the file location we opened. Finally, we close out both of our file streams.

In the second to last command I delete the screenshot file. Unfortunately, Apple has made their screenshot system ridiculously complicated. If you navigate to your Camera Roll you’ll find your image is still there. Click on it and a blank screen will be loaded. We’ve deleted the image file it’s trying to load but haven’t gotten rid of the image reference or the associated thumbnail that was created. I haven’t found a way around this.

The final command stores our image into the program memory so I can use it elsewhere without having to read the file from disk each time.

Well, this concludes this fairly verbose tutorial. If you have any questions I’ll do my best to answer them in the comments. I’ll leave you with close to 1000 lines of Python code for you to peruse. This is the code I came up with for automating the gameplay of the addictive and beautiful new game Threes.

 

The Inception Button on Cydia

I received an email earlier today asking if I could get the Inception Button onto Cydia seeing as Apple has the preposterous idea that such an application provides “limited functionality” (rather than limitless functionality). I figured, why not, I’d give it a go.

After some time on IRC channels with the creator of Theos and several other helpful and knowledgeable folks I’ve managed to bring the barebones version of the Inception Button to Cydia! I’d like to thank Allen of Planet-iPhones for hosting the application. Anyone who is jailbroken should be able to install the Inception Button via the default community sources.





The Inception Button for iPhone/iPod Touch

UPDATE 4: I’ve release the Inception Button to Cydia – Enjoy!

UPDATE 3: I’ve changed my focus to Android. I’m not leaving this behind, though – I’m sure I’ll get fed up with programming Java for Android at some point and switch back to some smooth Objective-C and Cocoa Touch.

UPDATE 2: Per Cameron’s request (sorta) I’m gonna try to get this sucker into the App Store. Stand by.

UPDATE: Bad news – the app was denied due to its limited functionality. I also am planning to move on to my next project (a game hopefully running on OpenGL) rather than adding “functionality” to this Inception Button. If anyone really cares I’ll do so but I do not plan on it. Sorry people.

I have recently started to learn the basics of Objective-C and Cocoa Touch in order to create iPhone/iPod Touch applications. Earlier today I submitted “The Inception Button” to the App Store. This simple application emulates the flash application found here: http://inception.davepedu.com/. I plan to upgrade this application to add retina display support, possibly game center support, and any requested features.

I will update this post and likely post again when the application is live in the App Store. Feel free to leave suggestions on the iTunes Store comments area or on my site here. I’ve also included screenshots of the application running on my iPhone 4 along with the build in xCode. Oh and the application is 100% free and ad-free… I’m not sure what I’ll do as I add more and more but there will always be a free version.

The sound clip used for the app is available for download below as well.

Download Inception Sound (Version 1.0)
Downloaded 4427 time(s)