December 1, 2012

Check for Unit-Tests in Objective-C

I’ve been adding some Unit Tests to an iOS App lately, which had both Test Host and Bundle Loader set for the Unit-Testing target. Now executing the unit tests caused the iOS App to launch, and the launch itself interfered with my unit-tests (e.g. real network calls which interfere with your mocked network calls). I needed a way to stop the launch if we are running in a unit testing scenario. Read more

November 28, 2012

zero-downtime deployments with unicorn and supervisord

In this post I’ll discuss zero-downtime deployments using unicorn and supervisord. There’s a lot more to zero-downtime deployments then just keeping your website available. Listen to Ruby Rogues Ep. 71 or search google for a broader discussion of the problems involved. When running a web application in production you should strive for 100% reachability. Down-times are normally perceived as errors in your application; and rightfully so. If you deploy often your users might stop using your app because of 502er they encounter. Read more

November 23, 2012

Setup HAProxy with Nginx on OS X

This is a follow up for one of my earlier post about Replacing Pow. I’ve been working a lot with Faye and PrivatePub lately, which cause me to stumble across some problems with the setup of mine. Primarily, moving from development to production environment. The main problem is that WebSocket support will come to Nginx as of 1.3.x. - which is many months away. A common solution is to use HAProxy in front of Nginx. Read more

July 28, 2012

Don't write your own ORM-abstraction - Flexirails revised

Three years ago I started writing a Rails plugin that could create customizable table views which reload via Ajax. The plugin was eventually used for the ICS Festivalmanager which is used to help organize the Wacken Open Air Festival since 2010. Having re-written the plugin from ground up I want to share some bad design decisions I made while writing the first version of Flexirails. 1. Don’t couple your plugin to a persistence layer Flexirails was supposed to represent parts of our domain objects, in a customizable way. Read more

July 14, 2012

Capistrano is dead - use Mina

Up until lately I was happy using Capistrano for my deployments. But then I noticed the following: Capistrano was utilizing 70 % of a physical CPU core when deploying on the go. I’m on a dual core system so this impacts my Mac Book Pros overall performance, battery life and it kept me waiting for a long long time. My iPhone was at edge speed so I figured Capistrano spent most of the time waiting for network I\O - busy waiting that is. Read more

July 7, 2012

Do it yourself calendar helper for Ruby

I needed the possibility to display any given month of a year, along with some additional informations in Rails. I wanted to place the additional informations within the calendar in a way that no available plugin allowed me to, so I rolled my own. In this blog post I want to share my approach to build a simple calendar helper for Ruby. The following code does not use any functionality provided by Rails, so you can use it anywhere you want. Read more

June 20, 2012

A usecase for git commit hooks

I’ve been working a lot with XCode lately, developing an iPad app for a customer at weluse. Sometimes I just dropped assets from my dropbox into XCode, which lead to XCode adding the files using my absolute file directory path, rather than the path relative to the project. Now this wasn’t a problem until our customer started building the project which obviously failed. The solution which worked great for me was a git pre-commit hook to ensure that no files have been checked in containing absolute paths, in this case: any file which path starts with $HOME. Read more

April 13, 2012

SocketRocket and PrivatePub

At work we’re using Ryan Bates excellent Private Pub gem to push updates from background workers to web clients. Our client wanted an iOS App as well and since I recently read about SocketRocket I was wondering if I could keep the current infrastructure and push data to the iOS App as well. The web app consists of a Ruby on Rails 3.2 frontend which utilizes Resque for long running background jobs. Read more

March 10, 2012

Replacing pow.cx

EDIT There is an updated version available which does not setup nginx as a system service. Instead HAProxy is used to allow a proper WebSocket setup. If you like to follow along just setup named properly. Pow is a nice Rack server. You can’t work with it while offline but that didn’t bother me much. Then it started randomly crashing on me & using 99% of my CPU. That’s when I started testing alternative setups to get rid of pow. Read more

March 2, 2012

Migrating Monolith Rails 2.x Apps to Rails 3.x

This is a follow up on my post made on 30th October 2011, Migrating Monolith Rails 2.x Apps. I’m going to walk through the basic steps necessary to make rubycas work with existing Devise authentication data, more specific Devise v1.0.11. To enable rubycas-server to work with your existing user data we are going to create a custom authenticator: # encoding: UTF-8 require 'casserver/authenticators/sql' require 'devise/encryptors/base' require 'devise/encryptors/sha1' class CustomAuthenticator < CASServer::Authenticators::SQL # snip from devise lib def secure_compare(a, b) return false unless a. Read more

© Raphael Randschau 2010 - 2022 | Impressum