<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Transcending Frontiers &#187; Sending Apple Push notifications in rails with Redis and apn_sender</title>
	<atom:link href="http://blog.thefrontiergroup.com.au/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thefrontiergroup.com.au</link>
	<description>Your peek inside the collective mind of The Frontier Group</description>
	<lastBuildDate>Tue, 03 Jan 2012 06:53:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Sending Apple Push notifications in rails with Redis and apn_sender</title>
		<link>http://blog.thefrontiergroup.com.au/2011/05/sending-apple-push-notifications-in-rails-with-redis-and-apn_sender/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/05/sending-apple-push-notifications-in-rails-with-redis-and-apn_sender/#comments</comments>
		<pubDate>Wed, 11 May 2011 05:39:58 +0000</pubDate>
		<dc:creator>Mario Visic</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Inside TFG]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1363</guid>
		<description><![CDATA[Sending iOS push notifications from a Rails application is very easy to do these days, thankfully there are many great Ruby gems that can be used to handle most of the magic for you. Recently I ran into the apn_sender gem which handles sending push notifications in a really neat way. Sending push notifications directly [...]]]></description>
			<content:encoded><![CDATA[<p>Sending iOS push notifications from a Rails application is very easy to do these days, thankfully there are many great Ruby gems that can be used to handle most of the magic for you. Recently I ran into the <a href="https://github.com/kdonovan/apn_sender">apn_sender</a> gem which handles sending push notifications in a really neat way.</p>
<p>Sending push notifications directly from a Rails application can be slow and we probably don&#8217;t want to have the user waiting until the notification is sent, instead apn_sender can be setup to run a worker which is constantly connected to the apple push notification service. When there are new notifications to send, the notifications are queued up and sent through the always open connection that is maintained by the worker.</p>
<p>apn_sender uses <a href="http://redis.io/">redis</a> as a message queue to keep track of the notifications waiting to be sent, you&#8217;ll need to install it before using the gem.</p>
<p>To add apn_sender in your Rails 3 application, just add the gem to your Gemfile. We&#8217;re going to need the daemons gem too so we&#8217;ll include that as well.</p>
<p class="gist-block" data-gist-id="965976" data-gist-file="Gemfile" id="gist-965976">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/965976">View it on Github!</a></p>
<p>Now we can create our daemon which we will be using for sending push notifications, this can be placed anywhere, I&#8217;ve put mine in script/apn_sender. Make sure to add execute permission to the file after creating so we can run it.</p>
<p class="gist-block" data-gist-id="965976" data-gist-file="apn_sender.rb" id="gist-965976">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/965976">View it on Github!</a></p>
<p>Before the daemon can start running we&#8217;ll need to put our iOS push certificate into the application. Instructions for generating the certificates are available at the <a href="http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ProvisioningDevelopment/ProvisioningDevelopment.html#//apple_ref/doc/uid/TP40008194-CH104-SW1">Apple Developer site</a>. The certificates need to be placed inside of /config/certs and should be named <i>apn_development.pem</i> or <i>apn_production.pem</i> for production.</p>
<p>Once the certificates are in their correct locations, we can start up the daemon. The daemon does not know about the Rails environment so we need to specify this when starting it up. The daemon supports <i>start</i>, <i>stop</i> and <i>restart</i> commands. There is a verbose flag available to output more information (which can be helpful when debugging).</p>
<p class="gist-block" data-gist-id="965976" data-gist-file="start_command.bash" id="gist-965976">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/965976">View it on Github!</a></p>
<p>Our application is now set up to send push notifications, this can now easily be performed by adding a new notification to the queue. The notify method on the APN class will take a push notification token and then our parameters, we can specify the alert message to show the user, whether or not we want sound as well as the number to display on the badge icon. Anything else we pass to notify will be sent as metadata in the push notification. Here&#8217;s an example of creating a notification.</p>
<p class="gist-block" data-gist-id="965976" data-gist-file="notify.rb" id="gist-965976">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/965976">View it on Github!</a></p>
<p>The worker should pick up the notification within a few seconds and send it off. The apn_sender has many other features that I haven&#8217;t covered, you can view the full documentation over at <a href="https://github.com/kdonovan/apn_sender">https://github.com/kdonovan/apn_sender</a>.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/05/sending-apple-push-notifications-in-rails-with-redis-and-apn_sender/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/05/sending-apple-push-notifications-in-rails-with-redis-and-apn_sender/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Advanced Javascript with Douglas Crockford</title>
		<link>http://blog.thefrontiergroup.com.au/2009/02/advanced-javascript-with-douglas-crockford/</link>
		<comments>http://blog.thefrontiergroup.com.au/2009/02/advanced-javascript-with-douglas-crockford/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 23:29:17 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Presentation]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://thefrontiergroup.com.au/blog/?p=330</guid>
		<description><![CDATA[I&#8217;ve been slowly making my way through Douglas Crockford&#8217;s talk on Advanced Javascript and even at only about 3/4 of the way through the first installment I&#8217;ve learned plenty! The presentation is in three parts and so far he&#8217;s covered a bunch of standard programming patterns and elements (singletons, private members, namespaces, constructors, etc&#8230;) implemented [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been slowly making my way through <a href="http://en.wikipedia.org/wiki/Douglas_Crockford">Douglas Crockford&#8217;s</a> talk on <a href="http://video.yahoo.com/watch/111585/1027823">Advanced Javascript</a> and even at only about 3/4 of the way through the first installment I&#8217;ve learned plenty!</p>
<p>The presentation is in three parts and so far he&#8217;s covered a bunch of standard programming patterns and elements (singletons, private members, namespaces, constructors, etc&#8230;) implemented using Javascript as well as a detailed account of how the language is implemented. Rather than having to work out by trial and error what variables and functions are available where, or how to implement private functions or a singleton, he&#8217;s given you the first principles so you can work it out for yourself and a bunch of useful examples.</p>
<p>I highly recommend watching it. I find the more languages I learn the better I get at doing things across the board. </p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2009/02/advanced-javascript-with-douglas-crockford/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2009/02/advanced-javascript-with-douglas-crockford/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Can You Make in 48 Hours?</title>
		<link>http://blog.thefrontiergroup.com.au/2008/10/what-can-you-make-in-48-hours/</link>
		<comments>http://blog.thefrontiergroup.com.au/2008/10/what-can-you-make-in-48-hours/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 09:30:52 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Websites or Tools]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rails Rumble]]></category>
		<category><![CDATA[Rapid Development]]></category>

		<guid isPermaLink="false">http://thefrontiergroup.com.au/blog/?p=89</guid>
		<description><![CDATA[A typical work day is about eight hours give or take. How much time you&#8217;re really working inside that eight hours varies from person to person and the quality of work and amount of work definitely varies hugely. The question is, given 48 continuous hours and an idea you wanted to work on what could [...]]]></description>
			<content:encoded><![CDATA[<p>A typical work day is about eight hours give or take. How much time you&#8217;re really working inside that eight hours varies from person to person and the quality of work and amount of work definitely varies hugely. The question is, given 48 continuous hours and an idea you wanted to work on what could you achieve?</p>
<p>Taking an application from inception to release inside 48 hours is a laughable proposition to most but this year that&#8217;s exactly what a number of people did using <a href="http://en.wikipedia.org/wiki/Ruby_on_Rails">Ruby on Rails</a>. It&#8217;s an annual event these days called <a href="http://www.railsrumble.com/">Rails Rumble</a> where teams get together for a weekend and plan, develop and deploy their ideas as applications. The main rules are that it&#8217;s developed in it&#8217;s entirety onsite, inside the 48 hour period and is done in Ruby on Rails. Teams are small with four being the upper limit allowed.</p>
<p>A list of applications by category was posted <a href="http://48hrlaunch.wordpress.com/2008/10/20/rails-rumble-2008-apps/">here</a> and to be honest there are some truly great ideas. The websites range from comical to serious in style and meet the needs of people, persons and businesses in a wide variety of areas.</p>
<p>Winners that I&#8217;ve checked out are :</p>
<p><a href="http://wantnom.com/">WantNom</a> &#8211; fun site aimed at making getting your friends together for dinner simpler.</p>
<p><a href="http://redminutes.com/">Redminutes</a> &#8211; a pretty basic site, but the idea is about making collaboration on small notes much simpler.</p>
<p><a href="http://couldya.r08.railsrumble.com/">Couldya</a> &#8211; basically using social networking to ask people to do things and track how the task is going. It&#8217;s an example of what I think is a reasonable idea that has a lot of implementation to go.</p>
<p><a href="http://hikedit.r08.railsrumble.com/">HikedIt</a> &#8211; a social networking site dedicated to people that hike and get around outside. It looks very polished and I have a friend who&#8217;s been talking about a site kind of like this for ages. Done in 48 hours.</p>
<p>That&#8217;s just four of the apparently 200+ applications that were developed to some extent, whether partially or completely finished.</p>
<p>I think the main thing to see here is that all of these applications were developed inside 48 hours by up to four people and to be honest the ones I&#8217;ve clicked around that interested me were all more than useable and solved a problem I wanted solved. Could you do this with other languages? Perhaps, but having used a few frameworks myself (ASP, ASP.NET, PHP, Rails) I don&#8217;t think any of them come close for rapid development like this.</p>
<p>It makes me excited that we have rolled out a major application recently using Ruby on Rails and that there are still parts of the industry that are fun right now.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2008/10/what-can-you-make-in-48-hours/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2008/10/what-can-you-make-in-48-hours/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

