named_scope :open, lambda{|at_time| {:include => [:operation_hours],
:conditions => ["
# // FIRST OPEN TIMES DURNING THE PRESENT DAY
( operation_hours.open_time <= :compare_time
and operation_hours.close_time >= :compare_time
and operation_hours.open_day_id = :day_id
and operation_hours.close_day_id = :day_id
)
OR
# // OPEN PREVIOUS DAY AND EXTEND INTO THE EARLY MORNING
(
operation_hours.open_day_id = :day_id -1
and operation_hours.close_time >= :compare_time
and operation_hours.close_day_id = :day_id
)
# // FINALLY OPEN TILL LATE TOMORROW
OR
( operation_hours.open_day_id = :day_id
and operation_hours.open_time <= :compare_time
and operation_hours.close_day_id = :day_id +1
)
", {:day_id => OperationHour.parse(at_time)[0].to_i,
:compare_time => OperationHour.parse(at_time)[1]} ] }}
Thursday, August 5, 2010
Hours of operation aint that fun!
I geeked out for a while and worked on hours of operation named scope called 'open'.... This was a beeoych but in the end I kicked it's ass!
Monday, August 2, 2010
fulll circle geo/gis
So I have been geeking out with the Geo location stuff for about six months. So far I have played with mysql's geom//multi/poly/point and postgres multi poly/point...as well as lat/lng searching using geokit,
My inclination was to use Mysql as it is drop dead simple to set this stuff up...but it doesnt seem to work very well with GeoRuby or PostGIS. I think I read somewhere that Mysql can work with postgis but I couldn't get ita working.
So I tried Posgresql/PostGIS and I really liked it. Postgres as a database is pretty kick-ass and coming from a mostly mysql background I was pleasently suprised at the simplicity. Ok there are some subtle differences...
Then I started getting into using Sphinx with geo and ran into some wierd problems... It seems like a good idea but... I couldn't get it to work right. I even posted my problems on the group and didnt get a response (so far)...
I started having problems with postgres's ordering thru associations...wierd things started happening where it just wasnt sorting correctly....so to makw a long story short.. I just switched back to mysql as I am using geokit (lat/lng) for everything anyway... Lets see were this gets me!
My inclination was to use Mysql as it is drop dead simple to set this stuff up...but it doesnt seem to work very well with GeoRuby or PostGIS. I think I read somewhere that Mysql can work with postgis but I couldn't get ita working.
So I tried Posgresql/PostGIS and I really liked it. Postgres as a database is pretty kick-ass and coming from a mostly mysql background I was pleasently suprised at the simplicity. Ok there are some subtle differences...
Then I started getting into using Sphinx with geo and ran into some wierd problems... It seems like a good idea but... I couldn't get it to work right. I even posted my problems on the group and didnt get a response (so far)...
I started having problems with postgres's ordering thru associations...wierd things started happening where it just wasnt sorting correctly....so to makw a long story short.. I just switched back to mysql as I am using geokit (lat/lng) for everything anyway... Lets see were this gets me!
Tuesday, March 23, 2010
Gunz For Hire
Rails has created a whole new set of guns and amo... I can literally change everything in a completely messed up system in a matter of hours!!
Thursday, March 18, 2010
Way Cool new tech!
So I was asked yesterday why I don't program in Python. The truth is I don't know much about Python and was not really interested back my days of Perl (96'-2002). It just seemed that Perl was much better in my opinion. But as CGI/Perl ran it course there were all kinds of new problems starting with convention. This is probably why so many people say that Perl is 'ugly' and crude. On the contrary, we were writing some beautiful OO Perl (or at least we though so at the time).
I am guessing that the natural migration progression from Perl would be to PHP. PHP seemed to be a more mature language for web programming. But it too lacked a framework (at least at the time I was programming it back in 2003). So we made a lot of crappy PHP programs [a few that are still in production at Oakley today].
Enter Ruby/Rails (for me in 2006). Man, what a refreshing feeling. It has really made programming fun again and the MVC Rails framework basically rules and just keeps getting better (look at Rails 3!).
So what's on the horizon? I think more javascript/html frameworks. I was looking at http://cappuccino.org/ this morning. This is really cool. Mustache (http://github.com/foca/mustache) looks interesting too. So many cool things going on right now and no better way to mesh them together than with Ruby/Rails!
I am guessing that the natural migration progression from Perl would be to PHP. PHP seemed to be a more mature language for web programming. But it too lacked a framework (at least at the time I was programming it back in 2003). So we made a lot of crappy PHP programs [a few that are still in production at Oakley today].
Enter Ruby/Rails (for me in 2006). Man, what a refreshing feeling. It has really made programming fun again and the MVC Rails framework basically rules and just keeps getting better (look at Rails 3!).
So what's on the horizon? I think more javascript/html frameworks. I was looking at http://cappuccino.org/ this morning. This is really cool. Mustache (http://github.com/foca/mustache) looks interesting too. So many cool things going on right now and no better way to mesh them together than with Ruby/Rails!
Subscribe to:
Posts (Atom)