iOS Text Entry

Feb 07, 2012

In iOS, there are two provided text input controls. UITextField provides a simple text field. It’s great for entering things like usernames and search queries. UITextView is for longer form text, like a document body. Both of these controls support a global style for the text they display.

Because Genesis is a source code editor, I need to have a text input control that supports multiple styles. This can be done in one of two ways:

  1. Use UIWebView and a Javascript syntax highlighting library (like SyntaxHighlighter or google-code-prettify).

  2. Implement a custom text input view. Draw text using Core Text, and take user input using UITextInput and related protocols.

I initially tried the first approach. I explored having a hidden, invisible div that would take editing focus, and have the syntax highlighting view at exactly the same location. Matching up scrolling seemed pretty hacky. I next tried using contenteditable on the div containing the highlighted code. When I started looking into key events to trigger re-highlighting the text, it became apparent that this was not an elegant solution.

I decided to pursue the second route. Native is better, and I can provide a more customized experience with regards to the caret and text selection. This also gives me an excellent opportunity to learn Core Text.

I have an early iteration of this custom text editing view, which I’m calling GNTextView, in the customTextView branch of the Genesis Github repository. It supports text input, most cursor movement operations, and displays NSAttributedString. It’s early, but solid progress towards a great source code editing experience.

Spring 2012 Research - Genesis

Feb 03, 2012

Since my sophomore year here at RPI, I’ve been working with RCOS. It’s an undergraduate research group, committed to writing cool open source software. It’s one of the most unique opportunities I’ve seen at any university, and I feel fortunate to be able to participate.

This semester, being my last at RPI, I wanted to focus on a project with large implications. I’ve been toying with an idea in my head for a long time, and now is the perfect opportunity to turn it into reality. I’m working with a fellow senior, Jeff Hui, and we’re both really excited about this project.

So, what’s the big idea? What’s the cool “last-hurrah” RCOS project?

It’s called Genesis, and it’s one simple thing:

Wouldn’t it be great to write software on your iOS device?

I know, a pretty daunting task. Several products currently exist. For example, the really interesting Codea (formerly known as Codify) allows you to write LUA scripts on your iPad, and run them on the device. Also, ssh apps like Prompt from the cool guys at Panic (hi Cabel!) allow you to remotely write software on another machine, if you’re happy with emacs, vim or nano (or echo and > if you’re super hard-core).

I see these apps on opposite sides of a continuum. Codea is beautiful, and takes advantage of a touch input device to aid in writing software (for example, giving the user a color wheel for RGB values), but you’re stuck in LUA. Prompt allows you to write in any language you choose, and work on all your software projects using a terminal editor. This is really versatile, but due to the nature of an SSH client, is not optimized for software development. Also, because it’s emulating a teletype, enhancing the interaction possibilities with touch is not really possible.

It would be great to have an app that’s the best of both worlds, in the middle of that continuum. Work on any software you choose, and do so in a way that’s designed for touch. A beautiful gesture-based experience.

I’m really excited just considering all the possibilities a touch interface can bring to development. After talking in January about some new source code visualization techniques with a friend of mine, I’m itching to get started.

Writing software isn’t nearly as useful if you can’t test it, and that’s where I think we have an innovative solution. Instead of needing to have your whole stack on-device (frameworks and compilers and debuggers), why not let your computer handle that stuff? Genesis has a cloud component. You run a piece of server software on your main development machine, and connect it to our cloud service. The device can use your development machine to build, run, test, debug, commit and push your changes, and there’s no need to run native code on your phone or tablet.

Genesis is open source, under the BSD license. The repository is on Github.

So, that’s Genesis. Jeff and I are really excited to work on it.

A New Site

Jan 30, 2012

I’ve been working the last several months with a talented web designer and developer, Alex Burrell, on a new version of peterhajas.com. I’m really excited to deploy that today.

The new peterhajas.com is powered by Hyde, a static website system written in Python. The webserver (currently run by the cool guys over at prgmr) is just serving HTML, so there aren’t any database queries to create scaling issues. Static has always been well respected, and allows lots of big sites to meet demand. I’m excited for the opportunities a totally static system brings.

For example, source control. The full source content for this site, from CSS to images to Hyde template files, is accessible on GitHub. Feel free to take a look.

I recommend that you play with the really cool new Projects page.

I think this medium will let me write with less overhead. I’m excited to engage with all of you regarding the things I express here.

You’ll notice that there are no comments. The old blog had comments that were victim to spamming, and this was too much to keep up with. On every post you’ll instead see a link to tweet your thoughts to me. This allows us to continue the conversation more effectively.

I look forward to sharing my thoughts, projects and ideas.

MobileNotifier Beta 5, Ecstatic Eggo

May 29, 2011

After all the press surrounding my last post, I had to do something. Instead of confirm or deny anything, I decided to do something. Something big.

I’m presenting the final release of MobileNotifier that I’ll have a part in before my absence. MobileNotifier beta5, Ecstatic Eggo. This release is big in more ways than one. It’s the most revolutionary release since the project’s inception.

Here’s a video I made of the release. I’m the guy in the middle:

What’s new?

  • MobileReply. Reply to text messages while within other applications! It works like magic!

    Here’s a picture:

    MobileNotifier Beta5 MobileReply

  • Full message text! Read everything in the alert, not just the first few words.

  • Redesigned minimalist alert display!

  • A brand new AlertDashboard, inspired by our amazing lockscreen view!

    Here’s a picture:

    MobileNotifier Beta5 AlertDashboard

  • Dismiss alerts right from the popup! Hate going into the dashboard to remove alerts you’ve just archived? Simply hit the “X” in the popup to dismiss them for good!

  • Recall the most recent alert easily with an Activator action. Then use MobileReply to reply to it!

  • Thanks to work by Marc Easen, MobileNotifier now supports calendar invitation alerts!

  • Way way faster.

What’s been fixed?

  • Lockscreen no longer displays if you have it set to “off”

  • Various small bugfixes.

  • Did I mention way way faster?

You’ll need to reconfigure your Activator actions for MobileNotifier. MobileReply, for you developers, is something you can use in your software too! It’s self-contained. Check out MNSMSSender in the MobileNotifier source.

Grab the release at the repo - phajas.xen.prgmr.com/repo - and enjoy yourself!

The MobileNotifier Team, Kyle Adams, Tim Novinger and myself, along with external help from Marc Easen, have been working on lots of great new features, and we’re truly happy to show them to the world. Along with Kyle, I tested over 100 builds of this release before shipping it.

All of us are also on Twitter! @peterhajas, @kyleadamsdotorg, @timnovinger and @marceasen. Say hi if you’d like!

I really hope you all enjoy this release, I know I’m ecstatic about it!

Like I said in my last post, I’m taking a break, but I’ll be back. I think we’ll see some great things.

Taking a Break

May 27, 2011

I’m taking a break from MobileNotifier and Widge for a while. I have other opportunities and priorities currently. I won’t be able to do much (if any) work on the projects, and I won’t have time to respond to many Tweets or emails. The project is in capable hands, with Kyle Adams, Tim Novinger and others (like Marc Easen) keeping things going. This is definitely not goodbye.

I can’t say why, but it’s worth it. Trust me. If you look around hard enough, you’ll probably figure it out.

I hope you guys understand, and I look forward to bringing you more awesome, great, free open source software in the future. Stay tuned for some amazing things!

If you absolutely must get in touch with me, send me an email. Until then, stay hungry and stay foolish.