Tags / programming

My experience learning iOS

Wednesday, October 9, 2013

Twice while living in Kansas I attempted to learn Objective-C and Cocoa. Getting past the first few chapters was pretty mind numbing. It didn’t really have anything to do with the difficulty curve. I already knew other languages—Python, Javascript—and didn’t really have a reason to learn something else. The third time I tried was early 2012 when I started reading iOS Programming. This time I needed a project or I’d fail yet again.

Continue reading →

Ghetto Facebook Registration with Django

Monday, October 8, 2012

I’m going to quickly walk you through how to build a server-side Facebook registration flow with Django. This is really basic and doesn’t rely on special libraries aside from httplib2 and urlib which are pretty standard. First you need to create an app. I set my App Domain to localhost and Site URL to http://localhost:8000 for development purposes. You’ll probably need to do the same if you’re using Django’s built in development server.

Continue reading →

Setting up Apple Push Notifications

Saturday, September 15, 2012

While trying to figure this out I came across a great article by Matthijs Hollemans. I suggest following it if you’re interested in an in-depth tutorial. What follows is a more concise version of that article and instead of using PHP I’m using a variant of Jacky Tsoi’s Python script. This is pretty tedious and there are a lot of steps you have to get right in order for this to work properly so hang in there.

Continue reading →

Sending Multipart Forms with Objective-C

Wednesday, September 12, 2012

It took me a few evenings to figure this out so I’m writing a quick explanation based on what I’ve found to work. My use-case is pretty simple, I want to POST some data to a form on a server from an iOS app I’m building. I’ll be using NSURLRequest to build the request object and NSURLConnection to make the actual connection to the server. The first thing we need to understand is how Multipart Form requests should be structured.

Continue reading →

Getting Started with MQTT

Sunday, July 22, 2012

I wanted to play around with MQTT this evening so I put together a little tutorial on how to get started using Ubuntu and Mosquitto. Installing Mosquitto Enter the following into your terminal. Remember to replace YOUR_UBUNTU_VERSION_HERE with the version of ubuntu you’re using, I was using Maverick Meerkat at the time so I replaced it with just maverick. First add the following two lines to /etc/apt/sources.list deb http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu YOUR_UBUNTU_VERSION_HERE main deb-src http://ppa.

Continue reading →

Save RAM with mobile middleware

Wednesday, October 7, 2009

A while back I wrote an article on how to set up a mobile site with Django ../going-mobile. Currently I have a Slicehost account which includes 256MB of RAM. My resources are tight and I really dislike having another set of unnecessary Apache processes for a mobile site that, aside from different templates, is using the same code base. The solution is quite simple, write a middleware. The following code checks the incoming request for ’m' or ‘mobile’ in the domain name.

Continue reading →

Working with Python and RabbitMQ

Wednesday, May 20, 2009

I recently installed RabbitMQ to handle some message queuing needs at Readernaut and thought I’d share how everything came together. If you’d like to learn more about RabbitMQ please read this. To use RabbitMQ with python you need py-amqplib because Rabbit uses the AMQP standard. To make amqplib a little easier to use I needed a simple script that did three things: Easy way to connect to RabbitMQ. Easy way to pull stuff out of the queue.

Continue reading →

Capturing content in Django templates

Saturday, February 28, 2009

As a template designer there are times when you have structural code surrounding a block which is waiting on content from a child template. It may look something like: <div class="content_title"> {% block content_title %}{% endblock %} </div> Sometimes this block is never filled so ideally I want the DIV element in this case gone. This isn’t easy because there’s no way to know whether content is headed towards the block so one solution that I’ve used is:

Continue reading →

Message Queuing imports

Friday, September 5, 2008

Last week I ran into some problems dealing with large book imports on Readernaut. I tested the system for around 50-100 books but had no idea people would upload lists of 900+ books. This begged the question, how do you handle importing very large sets of data before the browser times out? Brief example User uploads a list of 1000 ISBNs to be imported into their library. Each book, if not already in the system, needs to be imported via another service like Amazon.

Continue reading →

Creating a basic API with Django

Monday, August 11, 2008

Creating a simple public API for your site is a lot easier than you may think with Django. You’re basically just creating another view and serving it as XML or JSON instead of HTML. What’s public? Decide what you want to be public. The best answer is the stuff you’re already displaying in your HTML templates. Then you need to create an entry in your url conf. url(r'^api/v1/(?P<username>[-\w]+)/notes/?$', 'readernaut.api.views.user_notes'), Create the view In the case for Readernaut I wanted to provide an XML feed for users notes.

Continue reading →

Ah-ha Event Delegation

Monday, May 5, 2008

Wrapping my head around things like OOP took months. It’s not because I’m an idiot (I don’t think) - it’s just because I needed all the explanations to marinate before having an ah-ha! moment. I had an ah-ha today, with regards to Event Delegation. I’ve never seemed to completely understand events, yet I use them all the time. They’re an essential aspect of Actionscript and Javascript and there are two basic ways of capturing events, Event Handling and Event Delegation.

Continue reading →