September 13, 2008

BigDecimal MySQL quoting bug in ActiveRecord

Today I started cleaning up one of my models that logs latitudes and longitudes.  Previously I was storing the values as floats but I noticed I was unable to search for the data because the fields were being truncated when they went into mysql.  I then started playing with BigDecimal as a solution, as recommended by various blogs.

BigDecimal, specifically these column definitions for my migration

t.column :latitude, :decimal, :precision => 20, :scale => 15
t.column :longitude, :decimal, :precision => 20, :scale => 15

allowed my fields to make it into my database without truncation.  Unfortunately I was still unable to search for them using find_by_latitude style finders.  After peeking into the mysql_adapter in active record I came across the bug.  It seems that active record was putting the big decimal value into single quotes like a string. 

I removed them and vuala! A bug report has ben submitted to rails.  you can check out the gist below to patch it yourself before this gets added.

Bug Report:
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1041-mysql-adapter-quoting-bug-when-searching-with-bigdecimal

Gist with patch:
http://gist.github.com/10643

August 18, 2008

You've Been iPwned

After some mild trepidation I have finally pwned my iphone.  It couldn't be much easier (or can it?), and knowing that it is completely reversible why be scared!  Everyone seems to be getting in on the pwning

Now that I am a paying AT&T customer I have no need for the unlock.  I am much happier with my AT&T service, than I was with T-Mobile, but the lack of being able to use my phone's 3G for my laptop really pisses me off.  I'm already paying $30+ per month for data, and I could in theory just leave Pandora on all day, let me do what I want!

First thing thing to do of course... install Winterboard!
This is the first theme I tried, the background slowly fades between these two images:

Iphone1_3 Iphone2_2



Next to setup: live streaming video, intelliscreen and of course tethering.

If you are interested in pwning you can follow this guide... or if you know me give me a call, it doesn't take long at all.

August 15, 2008

Google Reader: How I Learned to Stop Scouring and Love the RSS

48pxfeediconsvgUp until a few weeks ago, RSS never really did it for me.  I tried using it within Thunderbird before but it never satisfied my itch.  Then came along google reader.  Google reader has such a slick interface and feature set that I couldn't be much more satisfied with my news reading.  I actually use RSS! I don't spend an incredible amount of time checking my favorite sites over and over.  On top of that, today I found the feeds for putting everything I need from Facebook into 3 feeds

My productivity since embrasing RSS has raise significantly, and my news reading has also gone up.  I quickly filter what I don't want to read from sites like digg and I stay up to the minute on what is going with my favorite ruby projects through my github feed.  I also get to keep track of my friends blogs with my friends blogs like Mr. Miner's Phish Thoughts and my business partner's You Me and My Api

If you haven't tried RSS before, I really recommend giving google reader a shot... finally after years of resistance I am a full fledged lover of Really Simple Syndication.

August 12, 2008

Modular Authentication - Update

After being informed that a modular branch of restful-authentication began in march I decided to rebuild with that as my fork modulr-authentication.  I have made some changes to restful-authentication and created the Open Id authenticator

There are still some issues to work out and tests need to be updated.  I am thinking about creating a set of  interactive rake tasks to use to setup the system instead of using generators.  This will help setup some defaults depending on how you plan to use the modules. 

Be sure to check back if you end up using any of these paths because I may change their names again.  Hopefully to modular_authentication once the bug is fixed

Projects:
Modulr-Authentication
Modular_open_id_authenticator

August 08, 2008

Modular(Youser) Authentication Plugin Development Begins

I decided it would be a good idea to get started on the modular authentication plugin I talked about earlier.  I have started a project fork from restful-authentication.  I tried to call the project "modular_authentication" but the word modular seems to cause issues at github (bug submitted), as of now it is called youser_authentication. 

Youser Authentication aims to be a modular authentication plugin that provides a common interface for any authentication method.  I am planning on releasing LocalUser(which is a standard database login/password user), OpenID, and Facebook for the initial launch.  Yousers, have a single identity record with multiple forms of identification. 

Goals of Youser Authentication

  • Allow developers to easily harness the power of different authentication methods
  • Provide users the ability to login/register to sites with the method they prefer
  • Build a foundation to allow access control by the methods of authentication provided
  • Make it easy for dvelopers to build their own authenticators without disrupting identity mangement

Here is the link to the github projects

Youser Authenciation (Modular Authentication)
Local User Authenticator

If you are interested in contributing please contact me via comments or email steve@sympact.net

Trey here in Brooklyn and Me... At Home

Trey Anastasio played(setlist and live blog available from hidden track) at the Music Hall in Williamsburg tonight, and I really wish I could be there.  I managed to keep my emotions down after I saw the announcement of the show, but as the day came on and the phone calls rolled in a surge of emotions came back that I hadn't felt in a long time.  "What do you mean you're not going to be there?", was one of the quotes from a friend, and it wasn't until that moment that I realized that this was for real and that it was really strange that I wasn't going to be there.

This really sparked the hardest part of being a Phish fan, and that is dealing with tickets.  I spent years waiting in line at outlets, then when everything moved digital I spent my time lining up as many computers as I could to try to get a shot at a low cost ticket.  I say low cost because no matter what I was going to the show, and the cost of me getting a ticket to a sold out show was always higher then lucking out on ticket master.  Even though sometimes a friend would have tickets or I'd luck out with a face (sometimes below) value ticket, it was always stressful and emotionally expensive.  It was always worth the stress to me because the end result was another show.  Never once did I fail at getting into a Phish show (or any other show I can remember), but today that kinda changed...

After my "I have to be there!" epiphany I set out to find my tickets, friends weren't really an option here, as the show was just too damn small, so I looked at craigslist.  I can't remember ever buying tickets off craigslist before, but I decided to give it a shot,  I found a post for "fair priced tickets" and felt like this might be a scam but they were hard tickets and I am good enough at spotting fakes that I knew the worst that could happen was a wasted subway trip.... I was wrong.  I got up to our meeting spot and he was nowhere to be found... he was stuck at work and kept me going for over an hour, until finally he sent woman to meet me because he was so tied up.  I asked to see the tickets and what did I find?  The worst set of fakes I had ever seen, shitty ink jet print job, not even perforated, come on!  I declined and decided to head out.  During this I saw two out of place people who I feel were also waiting for these tickets, I think this was one big scam, hitting up as many people who wouldn't open the envelope as he could, I hope no one fell for it.

I went home at this point, only losing an hour or two of my time, and a tiny bit of my pride.  All I could think about was how shady this deal was from the start and how Phish/Trey tickets had compromised my common sense again.  I of course had the option to try to go to the show and find a ticket, which would have worked for a price, but tonight I said fuck it.  I wasn't going to pay $200 bucks+ for a ticket this time, it just isn't right.  I can't be that irresponsible again....at least not yet!  It is amazing what this band can do to me and I want to be prepared. I am working on a solution to address the  supply and demand problem caused by the conflict between business and the "band-fan dynamic", but Phish will always be a beast, with ravenous and relentless fans... even when they aren't a band.

Hopefully, I'll be able to get my fix and continue to thrive in the adult world...time will tell.   

August 07, 2008

Wall-e!!!

Went to the movies last night and saw Wall-e.  It was awesome, I mean really does Pixar ever make a bad movie?  The plot line was awesome, and the robots were painfully cute.  I don't want to give away details, not like it could spoil anything too bad, but it really was nice going in with a fresh head. 

I highly recommend Wall-e

Oh and Tyra Banks was there, and the 2nd avenue theater kinda sucks.

August 06, 2008

Modular Authentication - Is it Time?

I came across this post today "How to use google authentication in your Rails app", and it really got me thinking about the modular authentication system we built at Sympact.  The system allows you to easily use multiple authentication systems on your site.  It is built on top of restful authentication and supports Local Users (database users via restful auth), Facebook and OpenID. It is really a cool system, and we used it for BokayMe, although it uses some old gems at this point and needs some cleanup and testing. 

It also optionally supports our Younety system, but that is a whole different story.

I'm going to try to get it up on git hub in the next few weeks.

Rails and IFrames - Issues with Internet Explorer sessions

Just a little test using trackbacks, here is a post I put up on the Sympact Blog about iframes and rails.

From the Sympact Blog

While using our new Share-It iframe for a project we came across a strange session issue with internet explorer that was tough to track down a solution to. 

Basically we were loading an iframe with some parameters that were saved in a session, this worked fine on all browsers except for internet explorer. 

Every request had a new session id, so the issue had to be with the cookies.  As it turns out using an iframe from a different domain name is considered "third-party" and IE blocks the cookies unless....

You set this ( P3P compact policy ) response header.

P3P: CP="CAO PSA OUR"

more details about the header and what it means can be found here.

you can easily do this in a controller using this call in a before filter with this line:

response.headers['P3P'] = 'CP="CAO PSA OUR"

I'm going to give it a shot

I'm not much of a writer, although there are those moments where I really have something to say and no outlet.  I'm continuously plagued by ideas, few of which make it out into the open.  I have a vision of running multiple blogs that break down each part of my personality, but instead of over complicating things, I'm going to start here.  So this will be a mix of programming, NYC living, Music Loving, and running a start-up.  Lets see how it goes.