Scott Swezey The more I learn, the less I know.

24Mar/100

Kickstarting mongrel with 503 errors.

So, I'm a total sucker for punishment, and thus I run a very small rails (mongrel) app on my website (shared host). Every once in a while, the mongrel app dies for some reason (server was rebooted, power loss, etc), and the PID file isn't removed. So I tried an experiment. I told apache to use a PHP file for 503 errors (Service Unavailable -- or what my users see when apache tries to rewrite to a mongrel that isn't there). Then I wrote setup the PHP file to try and start rails, and email me if it fails. Read below for all of the PHP code and shell files used.

23Mar/100

Today on Twitter: Make Swiss Design Inspired Business Cards in 30 Minutes.

I just saw this great write up on making some sweet looking business cards. I'm actually considering trying it out since I was just told it would be about $80 to print new cards for us at The Clip Lady.

Check out the article: http://designinstruct.com/print-design/make-swiss-design-inspired-business-cards-in-30-minutes/

20Mar/100

Getting more of your EyeTV Guide

Last year I purchased an EyeTV tuner for my mac. The price wasn't bad, and the software was really the best when it comes to OSX. It also included a 1 year subscription to the TV Guide service for use in the EyeTV app. All in all, I've been pretty happy with things... but I'm not looking forward to buying a new 1yr subscription, so I've been looking for solutions to how I can get around that. Unfortunately, I got no where on that. It seems no one really wants to share details on setting up a scraper and how to use that with EyeTV, nor are there any other compatible services I found.

Now, interestingly, an update to the EyeTV software came out recently and I just installed that. After installing it asked me to register, so I did... with a new email. Then I decided for consistency to update the TV guide subscription to use the same email address. And voila, a new 1 year subscription... without paying.

Update: This doesn't seem to work anymore. A recent update must have fixed the issue.

Tagged as: No Comments
19Mar/101

Increasing the PHP CLI Memory Limit

I recently ran into an issue where a client's cron job refused to run because of fatal errors and running out of memory. The default php.ini allowed up to 128M, but the CLI just wouldn't accept that.

It turns out that there is an easy solution:

3Mar/100

HP H470 Ink Service Module Issues

So for anyone that finds their H470 OfficeJet printer to have a full ink service module, but has issues resetting the printer after buying a new one, here is what you need to do:

  1. Buy a new Ink Service Module from HP Business. The part number is CB026-67043. Call 800-888-9909 for small business or try 888-999-4747 for home.
  2. Install the new module per the instructions installed with the printer (essentially, flip it on its side, push the release latch on the bottom of the printer and wiggle it out)
  3. After installing, hold down the resume and cancel buttons for 8 seconds.
  4. print a test page (hold power and then press resume 4 times and then release the power button) and verify the ink service module status is 0.

On a side note, don't bother calling HP... They told me the printer was out of warranty and couldn't help me, even though the instructions on how to reset the internal counter weren't included with the new part I just bought. Also, doing a normal factory reset does not reset the ink service modules counter.

Overall: -5 to HP Service

10Jan/100

Random SQL query in Ruby on Rails

SQL doesn't seem to have a good standard on the name for a random function. In my app, I wanted to select a record that had not been updated recently. So I went with a ORDER BY 'last_cache DESC, RAND()'

This would be perfect if I was using MySQL... But I use SQLite for development on my local machine. SQLite wants the function to be called RANDOM(). To make matters worse, Rails doesn't seem to have a database agnostic way to go about this.

So for the short term, I went with a little hack to get things working everywhere. In my config/development.rb I defined SQL_RANDOM_FUNCTION = 'RANDOM()' and I also defined it in my config/production.rb file as 'RAND()'. Then in any query I need the random function, I just concat SQL_RANDOM_FUNCTION to the string and it all works.

It isn't really ideal, but it isn't like my DB will randomly change to PGSQL overnight, without me knowing.

Tagged as: No Comments