Note to world: The how-to install ruby-oci8 on OS X Lion described here, also works for ruby 1.9.3:
rvm install 1.9.3 -n i386 --with-arch=i386
gem install ruby-oci8
# doesn't blow up
Thursday, June 28, 2012
Saturday, June 16, 2012
Simplified dynamic fixture extraction for ActiveRecord
I jumped on the Ruby test driven development (TDD) bandwagon a while ago...mostly...
For a while though, I've struggled to do Ruby TDD for projects involving complex data from external systems because Rails fixtures are such a pain in the ass to manage and object factories don't work because the data is too complex. The apps we build lately all seem to require the gnarly real world production data for test cases. All of the existing solutions out there didn't quite get at what I was looking for. For these reasons, I decided to buck up and make a fixture extraction gem for ActiveRecord.
Introducing Iron Fixture Extractor, a simplified dynamic fixture extraction solution for ActiveRecord.
Tuesday, May 29, 2012
Easing the pain of Shibboleth integration with Shibboleth's Lil Helper
Let's face it, you're looking at this blog post because you've been roped into migrating some crusty enterprise authentication system to the new thing higher education seems to be switching to--Shibboleth. If you've kept up in the space of open standard authentication systems like OpenID, OAuth, or OAuth2, you might be thinking, "How hard can it be, its just another auth standard?".
Unfortunately, Shibboleth is a ugly beast of an auth standard [seemingly] designed to stab you in the face with XML violence. Its vocabulary is confusing, its configuration is wacky, and there are a million esoteric errors that provide little value in troubleshooting--in summary, it's harder than it looks. That's why I wrote Shibboleth's Lil Helper (slh), a tool that automates the generation of Apache/IIS Shibboleth Native Service Provider configuration and metadata files.
Over the last year, our organization (Academic Support Resources) has used this tool to migrate 20 sites, 6 Apache and IIS servers, across 4 languages and have helped at least 5 departments within the University of Minnesota get setup using SLH and migrating their own infrastructure. So far, SLH seems to solve more problems than it creates, and most folks that have used it have been pretty stoked.
Last week I had got three more phone calls asking for help with Shibboleth and SLH--I decided I ought do something to decrease the amount of time I spend walking people through the process. The following is my attempt at making my actual self obsolete through a digital representation of myself, :).
Unfortunately, Shibboleth is a ugly beast of an auth standard [seemingly] designed to stab you in the face with XML violence. Its vocabulary is confusing, its configuration is wacky, and there are a million esoteric errors that provide little value in troubleshooting--in summary, it's harder than it looks. That's why I wrote Shibboleth's Lil Helper (slh), a tool that automates the generation of Apache/IIS Shibboleth Native Service Provider configuration and metadata files.
Over the last year, our organization (Academic Support Resources) has used this tool to migrate 20 sites, 6 Apache and IIS servers, across 4 languages and have helped at least 5 departments within the University of Minnesota get setup using SLH and migrating their own infrastructure. So far, SLH seems to solve more problems than it creates, and most folks that have used it have been pretty stoked.
Last week I had got three more phone calls asking for help with Shibboleth and SLH--I decided I ought do something to decrease the amount of time I spend walking people through the process. The following is my attempt at making my actual self obsolete through a digital representation of myself, :).
Using Shibboleth's Lil Helper for Shibboleth Native SP integration with Apache or IIS
- Skim the Documentation and follow the install instructions on your development machine
- Skim the Presentation to understand end-to-end process of integrating Shibboleth with Apache or IIS with Shibboleth's Lil Helper
- Watch and hack along with these screencasts
All of these screencasts tackle different aspects of integrating an Linux-Apache server with the Shibboleth Native SP and the IdP server. Though there are some minor differences between integration with IIS and Apache, this content should still be useful for illustrating the key steps in the process. Apologies in advance for the scrappy nature of these screen casts; there are certainly not as refined as I'd like, the resolution is shabby, etc.
- 01-Intro and Shibboleth Native SP before and after enabling on web-server (6m)
- 02-Rubygem installed config.rb initialized git repo created (3m)
- 03-Configuring the SP server with shibboleth2 xml and shib_apach conf (13m)
- 04-verify and generate your metadata (5m)
- 05-integrating with target language (5m)
Wednesday, March 21, 2012
ActiveRecord Inheritance without STI (Single Table Inheritance)
Update: The Rails community rocks! Less than 24 hours after I wrote this post and posted this issue to github, I had a solution from markmcspadden and a commit into docrails to help others understand how to get around this problem. The short answer:
self.abstract_class = true
I am writing this blog post in frustration to inform folks googling for how to do ActiveRecord without STI to give up now--it doesn't work and probably never will.
Common sense would suggest that you could bypass the single table inheritance mechanism with something like:
class SuperClass < ActiveRecord::Baseendclass Child < SuperClassself.table_name = 'the_table_i_really_want'end
However, this doesn't work. An invocation like `Child.first` results in SQL like:
SELECT super_classes.* FROM super_classes LIMIT 1
and an error like:
ActiveRecord::StatementInvalid: Could not find table 'super_classes'
I.e. it doesn't honor the fact that self.table_name was overridden in the child.
I've tried many other variations of this to make this work, with no luck.
Thought STI is awesome, its REALLY frustrating when you want to use inheritance without it.
I know, I know, "you should use mixins instead" is the common reply. However, this seems strange that I can't use inheritance without STI--inheritance is one of the fundamental programming constructs of an object oriented language, please, don't take it away from me and give me STI instead. Please, give me both!
For example, it would be amazing if I could do something like:
class SuperClass < ActiveRecord::Baseself.hell_with_single_table_inheritance = trueend
And have:
Child.create
work as expected.
Maybe there is a way to do this, and I don't know about it--if so, please comment here and let me know and share with the Rails community!
Tuesday, June 7, 2011
Enterprise as F@!#
Occasionally I come across software who's approach can only be described as "Enterprise as F@!#". My latest experience falling into this category is Shibboleth, the uber-lith of federated authentication schemes. The protocol is like technical turducken: auth payload -> encrypt + sign -> wrap in XML, base64 encode, and bake into some HTML.
My task is to come up with sensible Shibboleth implementation strategies for Ruby on Rails, PHP, and .NET across 20 vhosts on 6 servers (both IIS and Apache) (my solution to this is on Github). To clarify the enterprise as f@!# attitude (EAF), let's illustrate what a conversation with embodiment of this attitude would look like:
Programmer: How do I setup a server to comply with the protocol?
EAF: Create a pile of XML and email it to me.
Programmer: What should I include in the XML?
EAF: Figure it out, if its wrong, I won't reply to you. Ever. Don't forget to encrypt some stuff.
Programmer: Where should I go for help?
EAF: Why would you need help? Follow the instructions.
Programmer: Where are the instructions?
EAF: The internet.
Programmer: Thanks.
EAF: (no comment)
Tuesday, September 28, 2010
PHP 5.3.3 + Ubuntu 8 + Drupal 6
Problem:
Upgrade to the newest PHP (5.3.3) on Ubuntu 8.04. Make sure the instance of Drupal 6.6 works. Drupal 6.6 does not play so nice with PHP 5.3.3.
What not to do?
Don't compile from source unless you know what you're doing. I spent the better part of a day pursuing this, and in the end, I just kept on having to recompile to include this library or that. (curl, mysqli, zlib, etc). Furthermore, when I finally was "ready", none of the config changes from the existing setup were used...I gave up at that point, and went the pre-packaged route.
What to do?
From these pages, I managed to snag the pre-compiled packages for Ubuntu, and make everything go, without too much difficulties
http://www.dotdeb.org/2010/07/25/php-5-3-3-packages-are-available/
http://www.dotdeb.org/2010/07/11/dotdeb-packages-are-now-signed/
This boiled down to basically the following.
---
Add the 5.3.3 packages to dpkg sources
vim /etc/apt/sources.list
deb http://php53.dotdeb.org stable all
deb-src http://php53.dotdeb.org stable all
---
Add the gpg keys for this repo
gpg --keyserver keys.gnupg.net --recv-key 89DF5277
gpg -a --export 89DF5277 | sudo apt-key add -
---
apt-get update
get a local copy of all of these packages
---
Make a copy of our stuff
cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini.9-28
cp /etc/php5/conf.d/imagick.ini /etc/php5/conf.d/imagick.ini.9-28
cp /etc/php5/conf.d/memcache.ini /etc/php5/conf.d/memcache.ini.9-28
---
apt-get install php5
Replace everything when it asks, we'll manually diff and peep the situation...
How to make drupal 6 work with PHP 5.3.3
It all began at http://drupal.org/node/360605...and from there, I utilized the following patches on my drupal instance. I had to rollback a few times with git, so make sure you have a rollback strategy in the event that this doesn't work for you.
curl -O http://drupal.org/files/issues/php53_remove_deprecated.patch
patch -p0 < php53_remove_deprecated.patch
To get rid of ereg deprecation warnings
for php5.3.3 upgrade
From this
http://drup.org/drupal-and-php-53
I was lead to
http://drupal.org/node/360605#comment-2273386
And applied the solution with
curl -O http://drupal.org/files/issues/drupal.php53_compat_10-D6.patch
patch -p0 < drupal.php53_compat_10-D6.patch
One hunk was not applied via the patch for me, open closer inspection, it didn't matter. (includes/common.inc.rej ... basically this didn't apply if ($errno & (E_ALL ^ E_DEPRECATED)) {...)
Upgrade to the newest PHP (5.3.3) on Ubuntu 8.04. Make sure the instance of Drupal 6.6 works. Drupal 6.6 does not play so nice with PHP 5.3.3.
What not to do?
Don't compile from source unless you know what you're doing. I spent the better part of a day pursuing this, and in the end, I just kept on having to recompile to include this library or that. (curl, mysqli, zlib, etc). Furthermore, when I finally was "ready", none of the config changes from the existing setup were used...I gave up at that point, and went the pre-packaged route.
What to do?
From these pages, I managed to snag the pre-compiled packages for Ubuntu, and make everything go, without too much difficulties
http://www.dotdeb.org/2010/07/25/php-5-3-3-packages-are-available/
http://www.dotdeb.org/2010/07/11/dotdeb-packages-are-now-signed/
This boiled down to basically the following.
---
Add the 5.3.3 packages to dpkg sources
vim /etc/apt/sources.list
deb http://php53.dotdeb.org stable all
deb-src http://php53.dotdeb.org stable all
---
Add the gpg keys for this repo
gpg --keyserver keys.gnupg.net --recv-key 89DF5277
gpg -a --export 89DF5277 | sudo apt-key add -
---
apt-get update
get a local copy of all of these packages
---
Make a copy of our stuff
cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini.9-28
cp /etc/php5/conf.d/imagick.ini /etc/php5/conf.d/imagick.ini.9-28
cp /etc/php5/conf.d/memcache.ini /etc/php5/conf.d/memcache.ini.9-28
---
apt-get install php5
Replace everything when it asks, we'll manually diff and peep the situation...
How to make drupal 6 work with PHP 5.3.3
It all began at http://drupal.org/node/360605...and from there, I utilized the following patches on my drupal instance. I had to rollback a few times with git, so make sure you have a rollback strategy in the event that this doesn't work for you.
curl -O http://drupal.org/files/issues/php53_remove_deprecated.patch
patch -p0 < php53_remove_deprecated.patch
To get rid of ereg deprecation warnings
for php5.3.3 upgrade
From this
http://drup.org/drupal-and-php-53
I was lead to
http://drupal.org/node/360605#comment-2273386
And applied the solution with
curl -O http://drupal.org/files/issues/drupal.php53_compat_10-D6.patch
patch -p0 < drupal.php53_compat_10-D6.patch
One hunk was not applied via the patch for me, open closer inspection, it didn't matter. (includes/common.inc.rej ... basically this didn't apply if ($errno & (E_ALL ^ E_DEPRECATED)) {...)
Monday, June 7, 2010
Loopoff
The new nerding flavor of my world is "Loopoff":
Loopoff is a Rails + audio HTML tag + git based audio loop management and archival system
It was written so I could spend less time managing audio files and more time making loops with my Boss RC-50 and RC-20 loop stations.
The app is very unstable at this point, I hope to release something stable-ish/useful for others by the end of the summer.
The git back-end instead of SQL is rocking my world, it stretches the brain in good ways.
Solid.
Subscribe to:
Posts (Atom)