Monday, December 14, 2009

installing curb on ubuntu 8.1

i switched over from Net::HTTP to the curb gem (curl bindings for ruby) so i could take advantage of the performance gains (TBD) and that it keeps connections open by default.

on my local os x machine, i just ran:

sudo gem install curb

and everything worked fine. however, when deploying to our dev ubuntu box, it was not as smooth a process. when running gem install, i got the following error.

Building native extensions. This could take a while...
ERROR: Error installing curb:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb install curb
"-fno-strict-aliasing -g -g -O2 -fPIC $(cflags)"
checking for curl-config... no
checking for main() in -lcurl... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.8
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib
--without-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:19: Can't find libcurl or curl/curl.h (RuntimeError)

Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
options to extconf.


Gem files will remain installed in /var/lib/gems/1.8/gems/curb-0.6.0.0 for inspection.
Results logged to /var/lib/gems/1.8/gems/curb-0.6.0.0/ext/gem_make.out

after some googling, i determined that i probably needed the libcurl4-openssl-dev package, so i ran the following:

sudo apt-get install libcurl4-openssl-dev

that resulted in:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libidn11-dev libldap-2.4-2 libldap2-dev pkg-config
Suggested packages:
libcurl3-dbg
The following NEW packages will be installed:
libcurl4-openssl-dev libidn11-dev libldap2-dev pkg-config
The following packages will be upgraded:
libldap-2.4-2
1 upgraded, 4 newly installed, 0 to remove and 25 not upgraded.
Need to get 1115kB/2678kB of archives.
After this operation, 7115kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Err http://archive.ubuntu.com intrepid-updates/main libldap-2.4-2 2.4.11-0ubuntu6.1
404 Not Found [IP: 91.189.88.30 80]
Err http://archive.ubuntu.com intrepid-updates/main libldap2-dev 2.4.11-0ubuntu6.1
404 Not Found [IP: 91.189.88.30 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/o/openldap/libldap-2.4-2_2.4.11-0ubuntu6.1_amd64.deb 404 Not Found [IP: 91.189.88.30 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/o/openldap/libldap2-dev_2.4.11-0ubuntu6.1_amd64.deb 404 Not Found [IP: 91.189.88.30 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

as it turned out, my sources were out of date and when apt-get went looking for the libldap2 packages it needed, they were not there. so i ran:

sudo apt-get update

it updated my sources and i was able to install the libcurl4-openssl-dev package and succesfully install the curb gem. maybe that will help somebody out there.

Monday, September 28, 2009

restful_authentication and rails 1.2.2

according to the github page, the restful_authentication plugin only works for 1.2.6+ -- even the backwards compatible classic version. i've got a 1.2.2 app that i want to plug it into. here's how i rammed it through.

- 'ln -s new.html.erb new.rhtml'

created a symlink for sessions view new.rhtml that points to new.html.erb. i think it used the html.erb extension because i have 2.3.4 installed on my machine too. so when i ran script/generate, it used rails 2.3.4 even tho this particular app uses 1.2.2.

- # restful authentication routes
map.resources :sessions, :only => [:new, :destroy, :create]
map.signup '/signup', :controller => 'users', :action => 'new'
map.login '/login', :controller => 'sessions', :action => 'new'
map.logout '/logout', :controller => 'sessions', :action => 'destroy'

added these to my routes file. the last three lines you are told to add when you run the script/generate. the last one is needed because there is a reference to a named restful route in the sessions/new view. plus it's good restful form anyways.

- had to hack out some stuff from the lib/authenticated_system.rb file thats created by the generator (since calls are made to authenticate_with_http_basic wasn't added until rails 2.0) this will surely cause the unit tests to break and makes the system a bit less robust. for my purposes, that's just fine.

in current_user, replaced: @current_user ||= (login_from_session || login_from_basic_auth || login_from_cookie) unless @current_user == false

with: @current_user ||= (login_from_session) unless @current_user == false

and in the access_denied method, commented out:
#format.any do
# request_http_basic_authentication 'Web Password'
#end

that's it. everything seems to be working now.

-h

Friday, June 19, 2009

sad about nadal

let's be clear. i don't like how nadal plays. all brute force, all the time. i'm a federer fan and like most diehard tennis fans dream of playing the way federer plays. to borrow from soccer, federer is brazil, nadal is germany -- only a lot better.

that said, i'm downtrodden over nadal not playing. first, i think it's only fitting that fed win his 15th major and break the all-time record by beating the player who has dominated him over the last couple years. and what better way for fed to break the record but winning a dramatic final like last year's?

but there's non-federer related reasons as well. nadal's the second-best player i've ever seen -- and it's not close. that includes sampras, agassi, mcenroe, connors, becker, edberg, and wilander. i know nadal doesn't have the career accomplishments to back it up, but that's not what i'm saying. his absence is a huge hole.

this one's not so positive tho. i'm disappointed in him. i didn't see the exhibitions that he played against hewitt and wawrinka but everything i read said he looked noticeably diminished. i don't doubt that. but tho he lost both matches, he was competitive and the fact that he even took these exhibitions indicated it was a close decision whether or not to play in wimbledon. if that's the case, he should have skipped the exhibitions, taken the extra five or so days to rest and try to defend his title. unless it was possible that he was going to do lasting damage to his knees by playing, i'm a little disappointed in rafa.

still, i hope he's back soon.

Friday, June 12, 2009

game 4 takeaways

first, for full disclosure, i put $50 on the magic to win the title at the beginning of the playoffs. in general, i'm a reasonable fan, one that can usually see when things should go fairly in the direction of the team other than the one i'm rooting for. that said, i've had more trouble than usual in doing so while pulling for the magic in this playoffs.

- how many times are the magic going to get burned on last second shots? of orlando's 10 losses in the playoffs so far, 5 have involved either a game-tying or game-winning shot as time ran down. and in at least one of their wins, they've had a team tie the game at the end of regulation only to win it in OT. granted, they've hit a few game-tying and winning shots too.

- hollinger wrote about this in his per diem, but why wasn't courtney lee in the game to defend what was to be the game-tying three by derek fisher. i'd say the same thing for the 91-91 possessions in OT.

- was that an offensive foul on kobe when he elbowed jameer nelson in the face as nelson came down for the double team? of course, fisher, then left wide open, hit a critical three to give the lakers the huge edge in OT. i'm really asking, because i don't know what rule applies here.

- there were a couple egregious botched calls in OT. the one where pau gasol got whistled for a foul while battling for a rebound with dwight howard (howard would eventually hit one of two free throws to tie the game at 91) probably should have been a no-call, but if a foul occurred either way, it should have been howard. also, trevor ariza coming from out-of-bounds to grab an offensive rebound (prior to fisher's OT three).

- i love the NBA and think this has been the best playoffs in recent memory. but there are some serious rule changes the league should implement (the ridiculous age-limit for one, but i'm talking about game rules here). i've mentioned that there should be halftime and post-game reviews for flops already. but please, let's do something ridiculous about the intentional fouls that take place on fast breaks and under the basket. what value does it bring to the game when you allow the defender to grab with both arms the person going up for a dunk? does anyone really want to see the free throws instead of the dunk? for that matter, why are we rewarding the defensive team for a breakdown, rather than the offensive team for executing well? in a league that fears extending the game (their argument against replay) like the bubonic plague, why do they allow these unnecessary fouls to happen?

yes, i am referring to kobe wrapping up howard on the final play of regulation. but can you disagree with the principle?

- keeping on the rules thread, it is not a foul when a little guy runs into a big guy setting a screen and gets knocked to the ground. this happens all the time. it doesn't matter if the screener is set or not, it's like there is an exception to the rules of a legal pick when the screened player gets hit too hard.

- tony battie played 12 mins yesterday, marcin gortat played 4. playing gortat and howard doesn't work perfectly on offense, as they don't get the spacing they need to run. i get that. but the only thing gortat brings to the table that battie doesn't is delusional confidence in his 18-ft jumper -- which makes me cringe every time he launches it.

in a similar vein, hedo needs to play more than 40 minutes in an OT game. you look at all the rest of the top players, and they're in the 45+ range.

- finally, a few scouting reports. jj reddick seems to be an underrated athlete and defender. his effort level is high, he's fundamentally sound, and doesn't go for ball-fakes very often. he did an impressive job in his short stints covering kobe. on the other hand, he does not appear to be as good a shooter as he's given credit for...

pau gasol is actually quite strong holding position in the post and a really good defender. howard is often unable to back him down, all of which makes his flopping -- when it gets called -- all the more ridiculous.

Sunday, June 07, 2009

stan van gundy's coaching

i'm on the record as saying that svg is a great coach, better in fact than his more famous brother jeff -- who's also a very good coach. coaches are nearly impossible to evaluate with certainty. but looking at svg's design of out-of-bounds plays is pretty impressive.

case and points, from game 2:

- courtney lee's alley-oop on the last play of regulation that netted him an open layup.

- getting rashard lewis free from a good defender in lamar odom for an open three, down by six with 24 seconds in ot, and everyone in the world knowing that was the shot they were looking to get.

nba needs after the game replay

flopping is ridiculous. anderson varejao's fashioned an effective nba career with that being his core skill. pau gasol's not as bad, but he's close. (his embellishment of howard's semi-legit push in the back was physcial comedy).

all that could be easily reduced if they would just review the games at halftime and post-game, then penalize the offending flopper. in the playoffs, i think technical fouls would be an appropriate remedy.

courtney lee's height

he's listed at 6'5 but he looks tiny out there. when walking back to the huddle next to jj reddick -- who's listed at 6'4 -- he looked shorter by a couple inches.

mark jackson said.

with kobe going up for the game winning shot and hedo turkoglu on the cover, kobe crossed over and got around him. dwight howard came over to help tho giving turkoglu a chance to recover and get the block on kobe from behind. mark jackson extoling turkoglu's effort commented rhetorically:

"how many players give up on the play and say dwight howard bail me out"?

uh, well it's the last play of game two of the finals and you've been put on kobe bryant. yea, i'd say the answer to that is zero.

Saturday, June 06, 2009

slap. chop. good.

just saw the commercial for the slap chop. i'd heard it referenced before, but never actually seen the infomercial. i'm sure it sucks, but man does it look awesome. the spokesman -- who looks disturbingly similar to benicio del toro's character from the usual suspects -- does a terrific job of selling it and its myriad uses. salad add-ons, chopped vegetables, pizza toppings, you name it.

but how disturbing is it when the guy utters the line 'you'll love my nuts'. he's talking about chopping peanuts, walnuts, and the like. riiiiiiiiiight.

chad dawson gains a fan

chad dawson is a good fighter. the undefeated light heavyweight title holder has fast hands, is a sharp, accurate puncher, and possesses tremendous reflexes. his fights don't turn into wars. but they don't resemble pillow fights either.

well except his bout against glen johnson, where he eked out a 12-round decision. so as boxing fans, we should feel good that dawson has given johnson the rematch. given that he subjected us to a rematch with antonio tarver, he owes us.

but what really makes me happy is that dawson told the IBF to stick their title belt up their ass in the process. apparently, the ibf matchmakers think the appropriate mandatory challenger for dawson is tavoris cloud. they're about the only ones. the ring doesn't have him in their top 10 light heavyweights. dan rafael doesn't either. cloud owns a pretty-looking record, 19-0 with 18 kos, but virtually every adjective starting with the letters 'u' and 'n' apply to him. unknown, unproven, untested, unremarkable, etc.

instead, he let the ibf strip him of the belt and made the match with johnson (ranked #3 by ring and dan rafael) -- for more money incidentally.

now if only more fighters would start doing the same.

Monday, May 04, 2009

3G is an at&t myth

wired is conducting about satisfaction with 3g network coverage. here's how i feel about at&t's 3g "coverage":

except for the twenty or so minutes i spend reading the nyt on my daily commute, i have the 3g network turned off about 90% of the time. doing so reduces my dropped call rate by about 90% at my house, where reception is spotty. mind you, the coverage still stinks at my house, but at least i can talk on the phone without it sounding like an endless verizon commercial.

i'll call it the 90/90 rule. reduce 3g connectivity time by 90%, reduce dropped calls by 90%.

Saturday, May 02, 2009

may 19, california special election

the endorsements of the publications i read seem to be all over the place, so that really gave no hint as to how i might lean. the text of the initiatives themselves is cryptic -- as always -- but i found the league of women voters guide to be clear and concise.

Friday, May 01, 2009

we all google for errors

so hopefully this one will save a ruby/rails newbie some time. i upgraded to rails 2.3.2 and started seeing a weird error when trying to start the console:

...../rubygems/requirerment.rb:150:in 'parse':ArgumentError:Illformed requirement ["~> 1.1.pre"]
...../rubygems/requirerment.rb:150:in 'parse':ArgumentError:Illformed requirement ["~> 1.1.pre"]
...../vendor/rails/railties/lib/console_with_helpers.rb:5:NameError: uninitialized constant ApplicationController

at first, i thought it was because i hadn't renamed application.rb to application_controller.rb (which is what rails 2.3.x looks for). but what it really was is that i hadn't updated rubygems from 1.3.1 to 1.3.2.

to fix, all i needed to do was run:

gem update --system

Friday, March 27, 2009

if only you could eat technology too

update: well after a couple days passed, i tried my extra special technique again, only to curious see a picture of the location with a bus passing by -- again. then of course, it dawned on me that street view was not being updated in anything close to real time. so, no epiphany after all.

if i were a good boy who saved his pennies, i'd bring my lunch to work. i'm not.

which means my daily routine at about 2 p.m. is to wonder what to have for lunch. one of my favorites is a hot dog cart called, da beef. i don't eat the dogs, but get a delicious italian beef sandwich, which is a thinly sliced steak sandwich drenched in au jus and topped with spicy peppers. that's good.

the problem is that these cart people don't show up consistently. and since they're a cart, they don't have a phone (they need to make use of modern telephony, i.e. a cell phone). which means, i walk -- fortunately, it's only three blocks -- only to find them not there. then i'm upset.

but today, i decided to use my brain instead of my feet and that's where google maps, street view comes in handy. punch in the address and voila, i see the location where the cart is supposed to be, but today is not. no fruitless walking for me today.

now my next epiphany needs to be what i can eat. and there it is. today's the day to try 'good pizza'.

Thursday, March 26, 2009

about RailsPlayground

to say i'm a novice systems administrator is giving me too much credit. outside of knowing how to list the contents of and change directories, i really don't have any idea of what i'm doing. okay, that slightly understates my skills, but not actually by that much. but when you're trying to get a startup going sometimes -- often times, really -- you end up taking on things that you suck at (like RoR programming, but that's another matter).

i love the idea of open source software and want to give back, but i really don't know how i can contribute in a meaningful way. but you have to start somewhere, so instead of hacking out something, i'll detail my experience getting a rails app up and running on RailsPlayground.

but first, i want to give a quick review of their service after one week.

- the setup of my VPS with an image including Rails, Passenger, mySQL, SVN, and Centos 5.2 from registration to completion was less than 30 minutes. that is excellent. the whole process is apparently quite streamlined from their end.

- the response time on tickets has been excellent. none of the issues that arose were particularly tricky but they were all resolved within an hour. they also have a live chat for quick questions. response is not quite instantaneous -- the techs seem to be monitoring chat, while doing other work as well -- but it's quite convenient when you have a small question that doesn't necessitate the opening of a trouble ticket.

- their pricing is competitive with the other providers out there. it falls on the lower side, but they're certainly not the only option at this price point.

- now, the bad. their documentation is quite poor. it's not only sparse, but it's often either outdated (which i assume is the reason why it's incorrect in spots) . on the other hand, lxadmin and hyperVM -- their two server administration tools -- are pretty easy to use and seem to be relatively robust in their feature set.

- the various components of the system aren't tightly integrated. as i mentioned, there are two separate admin tools. in addition, the SVN repository needs to be setup separately at a site called sourcerepo.com. that seems odd and inefficient.

overall so far, i'm happy with RP. their service in helping a very new linux admin has been well worth dealing with the outdated documentation and somewhat odd set of components. i suspect the documentation thing will get fixed soon enough, and that would give me the chance to give them a non-qualified endorsement.