House For Sale
So, I had a meeting last evening and didn't get home until about 9pm. When I rolled up to the house, I couldn't help but notice that there was a for sale by owner sign in my front yard. That was a surprise.
The market is pretty bad right now, so I don't really expect that much will come of this, but it is kind of exciting. Potentially homeless.
Rails 2.1
Biggest issue for me with the upgrading to Rails 2.1 from 2.0.2 seems to be the eager loading. Where I have used :include => :some_association in my find code and haven't put the full tablename.column syntax in my :conditions SQL, the table doesn't get loaded and errors occur, so I've been busy adding included table names to my conditions strings.
Rails 2.1 also seems to have different behavior when it comes to how dates are handled. If a partial date is input, I end up with some weird dates instead of seeing the multi-param error that I used to see. Not sure I'm liking that very much.
Apple TV
I have my first media center now. It comes in the form of an Apple TV. I have hacked it to allow uploading of movies that are not synced with my iTunes. This was necessary because my mac mini hard disk is full. So far I'm really liking it. I do wish that it had a larger hard drive. It is the 40gb model. It will be great to have all of the kids movies on there so they can watch them without destroying any more dvd discs. We really need to get an iMac with a good sized drive.
redirecting uploads to merb
I have a rails app for which I am using merb to handle the file uploading duties. I am using nginx as the webserver to proxy to the rails app. So here is the little bit of config from the nginx.conf that grabs the url that matches and sends it off to merb. This bit of code is in the location block.
if ($uri = /upload/acceptor) {
proxy_pass http://applicationserver:4010;
break;
}
New style web content
I really like what these guys are doing with the web. They can put links into small windows that pop open and give you extra information about things on the page, but you stay on the page and you get nice control over the linked content. Very nice way to have supplementary info linked on a page.
third ride
rode from military reserve up around shane's loop and back down. On the way down I had a pretty good spill. I can't sit very well.
First Ride
First Ride of the year was a green belt trip up around barber park from park center
Ruby Business Days in the Future
Going the other way now
1 2 # takes the number of days in the past you are looking for 3 # like 10 business days ago 4 start_date ||= Date.today 5 start_day_of_week = start_date.cwday #Date.today.cwday 6 ans = 0 7 # find the number of weeks 8 weeks = num / 5.0 9 #puts "yields #{weeks} weeks" 10 11 temp_num = num > 5 ? 5 : num 12 #puts "first temp num #{temp_num}" 13 14 begin 15 16 ans += days_to_adjust_f(start_day_of_week,temp_num) 17 #puts "ans in loop #{ans}" 18 19 weeks -= 1.0 20 #puts "weeks in loop #{weeks}" 21 22 temp_num = (weeks >= 1) ? 5 : num % 5 23 #puts "temp_num after loop #{temp_num}" 24 end while weeks > 0 25 26 #puts "#{start_date} - #{num} - #{ans}" 27 days_ago = start_date + num + ans 28 29 end 30 31 32 33 34 ansr = 0 35 case start_day_of_week 36 when 1 37 if 5 == num then ansr += 2 end 38 when 2 39 if (4..5).include?(num) then ansr += 2 end 40 when 3 41 if (3..5).include?(num) then ansr += 2 end 42 when 4 43 if (2..5).include?(num) then ansr += 2 end 44 when 5 45 if (1..5).include?(num) then ansr += 2 end 46 when 6 47 if (1..5).include?(num) then ansr += 1 end 48 when 7 49 #do nothing 50 end 51 return ansr 52 end
Ruby Business Days ago
My attempt at writing a solution to finding the number of business days ago from a specific date. I am using this in a Rails App.
1 2 # takes the number of days in the past you are looking for 3 # like 10 business days ago 4 start_date ||= Date.today 5 start_day_of_week = start_date.cwday #Date.today.cwday 6 ans = 0 7 # find the number of weeks 8 weeks = num / 5.0 9 #puts "yields #{weeks} weeks" 10 11 temp_num = num > 5 ? 5 : num 12 #puts "first temp num #{temp_num}" 13 14 begin 15 16 ans += days_to_adjust(start_day_of_week,temp_num) 17 #puts "ans in loop #{ans}" 18 19 weeks -= 1.0 20 #puts "weeks in loop #{weeks}" 21 22 temp_num = (weeks >= 1) ? 5 : num % 5 23 #puts "temp_num after loop #{temp_num}" 24 end while weeks > 0 25 26 #puts "#{start_date} - #{num} - #{ans}" 27 days_ago = start_date - num - ans 28 29 end 30 31 32 33 34 ansr = 0 35 case start_day_of_week 36 when 1 37 if (1..5).include?(num) then ansr += 2 end 38 when 2 39 if (2..5).include?(num) then ansr += 2 end 40 when 3 41 if (3..5).include?(num) then ansr += 2 end 42 when 4 43 if (4..5).include?(num) then ansr += 2 end 44 when 5 45 if 5 == num then ansr += 2 end 46 when 6 47 # no adj 48 when 7 49 if (1..5).include?(num) then ansr += 1 end 50 end 51 return ansr 52 end
Capistrano
I finally broke down and purchased the screencast for Capistrano from peepcode.com yesterday, and voila, today all of my internal apps have been redeployed using Capistrano. $9 well spent.
Broncodashboard updated for 2008 --mostly
I spent the day today updating Broncodashboard.com for the 2008 season. This entailed adding support for multiple seasons, redoing the widget and the feed that supplies info to the widget and adding logos and some details on the new schools on the schedule.
I still need to add all of the schedules for the opponents, so the full schedule link is still showing the 2007 season. All in all a good day.
bash cdpath magic
While perusing the bash man page today I found something pretty interesting. There is a variable that you can set in your .bash_profile file that is a search path for the cd command. That means that you can create a path with your most used cd locations and you can always get to those locations with a simple cd <foldername>. I added my work directory for web applications:
export CDPATH=.:~:/Users/jkay/Sites
Now a simple cd essence will get me to /Users/jkay/Sites/essence from anywhere.
Wisdom by Giles
"...this illustrates a fundamental rule. Never trust business users to analyze their problem space correctly, whether they irritate you or not. If you build a system to their inaccurate understanding of the data, they'll blame you. (Conversely, if your code exposes flaws in their business process, they'll tell you "we can live with the way you handled that.") Their job is to give you the data and tell you the results they want. Your job is to give them the results - and since interpreting the data happens after they give you the data and before you give them the results, that means figuring out the data is your concern."
-- Giles Bowkett
jRuby Rails mssql server
Database.yml for connecting to a MS Sql Server using jdbc
development: adapter: jdbc driver: com.microsoft.jdbc.sqlserver.SQLServerDriver url: jdbc:microsoft:sqlserver://someserver.domain.local:1433;databaseName=some_db;AutoCommit=false; username: someuser password: somepassword