Wednesday, December 9, 2009
imeem acquired by myspace - bummer
Thursday, November 12, 2009
Heroku - HTTP 502 Error
This might be helpful to someone?
I was receiving 'App Failed To Respond (HTTP 502) Bad Gateway' errors when deploying my application on Heroku. Reading the error codes page did not help me solve the problem, it took awhile but I was finally able to track it down.
The error was being generated in the browser but checking the rails logs, the requests were returning HTTP 200 success codes, so the problem was being generated at the web server level on the Heroku stack.
Turns out the problem was caused by setting response.header for no browser caching. I was using code similar to this post. Everything worked fine after I removed this line
- response.headers["Expires"] = 0
Heroku - sending email with Gmail
I have been working on deploying a Rails application to Heroku. A couple of gotchas I ran into when following this post "Sending email with Gmail"
- Don't use a dollar sign ($) in your password
- this can work locally if you put single quotes around the value, but on the heroku server it saved the entire string but at runtime would truncate it at the dollar sign
- for example using the password 'left-side$right-side'
- heroku config:add GMAIL_SMTP_PASSWORD=left-side$right-side
- heroku config returns > GMAIL_SMTP_PASSWORD=left-side$right-side
- heroku console
- type ENV['GMAIL_SMTP_PASSWORD'] returns > left-side
Heroku is running Ruby 1.8.6, locally I am running Ruby 1.8.7, I made a small hack to the plugin to avoid errors in development mode
./vendor/plugins/gmail_smtp/init.rb
changed the first line to
require 'smtp_tls' if RUBY_VERSION < "1.8.7"
tls is already handled in 1.8.7 and this code must have been creating some type of conflict
Sunday, October 25, 2009
imeem on 64-bit ubuntu
Getting flash to work correctly on 64-bit Ubuntu can be challenging. By following various blog and forum posts I was able to get it to work, but never the flash player for imeem. Every now and again I would try to re-install flash and see if it would work for imeem but until last night I was never successful.
It turns out that imeem will only work with the 32-bit flash player. After so much work to get the 64-bit player working in Firefox 3.0 and 3.5 I did not want to remove it so I downloaded Opera and installed the 32-bit player under its plugin directory and imeem works great!
- Download and install Opera
- verify that you cannot play music in imeem
- Close Opera
- download the 32-bit flash player in '.tar.gz' format
- extract the libflashplayer.so file from the archive
- then you will need to put this in the directory /usr/lib/opera/plugins/
- you won't have permissions to write to that directory unless you are in sudo mode
- open a terminal and type 'sudo nautilus'
- copy the file into the directory (you could do this from the terminal window also probably 'sudo mv libflashplayer.so /usr/lib/opera/plugins/libflashplayer.so'
- Open Opera
- check the plugins - type opera:plugins in the address bar
- you should see Shockwave Flash and it should be pointing to the libflashplayer.so file under opera plugins, by default my opera installation was pointing to /usr/lib/mozilla/plugins/ for the flash plugin, my guess is opera looks for plugins in its own directory and if not found then looks in mozilla directory
- you should now be able to play music with imeem!
I am running Ubuntu 9.04 Jaunty Jackalope by the way. Here are some links that might work to get the 64-bit player working for Firefox
- http://art.ubuntuforums.org/showthread.php?t=1297385
- http://www.ubuntugeek.com/how-to-install-adobe-flash-player-10-in-ubuntu-804-hardy-heron.html
- http://art.ubuntuforums.org/showthread.php?t=1292438
- http://www.cyberciti.biz/tips/install-flash-10-ubuntu-linux-64bit.html
- this last one is probably the best bet, check the comments there
Saturday, October 24, 2009
Factory Girl makes rails testing so much easier
Factory Girl makes rails testing so much easier. I watched a Railscasts on Factory Girl recently but had been putting off trying it out until last week. Glad I gave it a try - now I can say good-bye to fixtures and just write my tests!
Factory Girl is developed by thoughbot; they have some great open source projects, check out Shoulda to make your rails testing even easier.
Saturday, October 17, 2009
convert mkv files to dvd with ubuntu
Turns out there is a great program for this - my guess is it works well with other formats such as avi, mpeg, etc...
DeVeDe, if you are running 9.04 (jaunty) or higher it is in the repositories
System -> Administration -> Synaptic Package Manager
enter 'devede' in the search and then install
Friday, September 25, 2009
Attribute "target" exists, but can not be used for this element.
Attribute "target" exists, but can not be used for this element.
Resources
Wednesday, September 2, 2009
Procedure sp_droplogin, Line 93 Login is aliased or mapped to a user in one or more database(s)
Msg 15175, Level 16, State 1, Procedure sp_droplogin, Line 93
Login 'qa' is aliased or mapped to a user in one or more database(s). Drop the user or alias before dropping the login.
sp_helpuser 'qa'
Sunday, August 23, 2009
scrolling screen shot on ubuntu
I've been using ubuntu for the last 6 months, really like it! But also really missing SnagIt :(
so far I have come across these screen shot tools
but none that I came across would do scrolling screen shots; currently I only needed scrolling screen shots of web pages and I just came across a great tool for that - a firefox add-on called Abduction, it is really easy to use.
For full page screen shots (including all scrollable regions) or for cropped sections of a page. Just right click on the page and select 'Save Page as Image', if you are over an 'element' it will auto select that as the cropped area, you can then adjust the crop and save, if you want the entire page the easiest seems to be right clicking where there are no elements below the mouse and then adjust the fully selected page as needed
The saved png can then be opened in Shutter for applying arrows, boxes, etc...
Friday, August 21, 2009
Ajax error handling with ruby on rails and jquery
This sample is just a slight modification of this post 'Handling AJAX errors and displaying friendly error messages to users'. Basically I wanted to maintain the existing rails error handling for non-ajax pages and then have good handling for errors in both development and production mode; i.e. get errors in the browser when in development mode and show a nice message when in production mode.
Modify /app/controllers/application.rb; add the rescue_from macro and the handler_exception method
Then add a global javascript method for presenting the errors; most likely in application.js
Then a sample usage, jquery making an ajax post to a rails controller action
in development mode the error message is returned in an easier to read view in the firebug console and an alert message is presented that has a truncated version of the error
in production mode just a friendly error message.
Resources
- Handling AJAX errors and displaying friendly error messages to users
- Rails source code rescue.rb
- Rails views source on your install lib/action_controller/templates/rescues
- jquery ajax
Tuesday, August 4, 2009
Get list of MSSQL jobs that are currently running
Saturday, July 18, 2009
replace keyboard on Sony Vaio laptop PCG-K23 (PCG-9RLF)
http://www.laptoprepair101.com/laptop/2007/08/30/removing-replacing-laptop-keyboard/
- You don't need to loosen any screws on the bottom - I thought this would be needed and ended up wasting a bit of time going in the wrong direction.
- At the top of the keyboard is a plate that you need to pry up, there are 4 slots you can stick a flat screw driver under (you can't see them unless you press the keys down), this plate is also part of the screen hinge and the power cord that goes to the screen is attached so be CAREFUL!
- Then there are 3 screws that hold the keyboard in place, loosen those
- The keyboard will hinge up from the bottom
- Then you need to disconnect the cable that goes to the motherboard
- I ended up pulling this out without much effort
- but then it was really hard to get the new one back in
- turns out the slot has an open / closed 'mode', using a small screw driver I was able to get it to open up
- Then just put everything back, turned out to be relatively easy in the end, I am definitely not an expert when it comes to computer hardware but so far this has been a success!
Saturday, June 27, 2009
Frontair Congress, Barcelona Spain
Sant Boi de Llobregat, Barcelona 08830
Spain
We ended up staying here our last night because it was 'close' to the airport and included a free shuttle to the airport. But since we were traveling by train and bus it was not so easy to get here the night before. If I was going to do it again I would stay somewhere closer to a metro stop near 'downtown'; there are trains running direct to the airport all the time.
They did have an indoor pool.
View Larger Map
Husa Imperial Tarraco, Tarragona Spain
Tarragona, TA 43003
Spain
Great hotel. if you stay here I recommend spending extra for a room with a sea view!
View Larger Map
Hotel Costabella (Sercotel), Girona Spain
Girona, GI 17007
Spain
View Larger Map
The hotel is right across the street from the hospital - north of the old town. They have a great pool.
Medplaya Aparthotel Esmeraldas, Tossa de Mar Spain
Costa Brava
Tossa de Mar, Girona 17320
Spain
Great town! and this was a perfect place to stay, very inexpensive, functional not fancy
View Larger Map
The hotel is not near the beach but the walk is very enjoyable, probably 10 minutes or so.
Hotel Front Maritim, Barcelona Spain
Barcelona 08019
Spain
View Larger Map
This was a really nice hotel. It is a bit far from the 'downtown' areas but really close to a really nice beach!
It is 4 blocks from the 'Selva de Mar' metro stop. If you are coming from the airport take a metro to 'Passeig de Gracia' and then get on the line to 'La Pau', the Selva stop is 4th to the last stop.
There is also a stop near the hotel on the red tourist bus route; a nice day out to grab the bus and see the sights of town and then get dropped off right out side the hotel.
There is an awesome place to eat two blocks from the hotel Els Peixaters de la Mediterrania. They have great tapas and we ate dinner there one night - one of the best I have ever had!
The beach was crowded on a very warm Sunday - there were not too many people on the weekdays.
Saturday, May 30, 2009
Secure your Gmail
In gmail click the settings link in the upper right hand corner
Then scroll to the bottom and select 'Always use https' in the Browser connection section
This came up while I was watching a great screen cast 'Security - What rails will and won't do for you', it was from 'Scotland On Rails Presentations', there are 27 different presentations and all downloadable
Saturday, May 9, 2009
PGError: ERROR: duplicate key value violates unique constraint "tablename_pkey"
Using Postgresql I ran into the following error when trying to create a new record through my rails application
- PGError: ERROR: duplicate key value violates unique constraint "tablename_pkey"
Found this link which had the needed fix;
Dealing with 'duplicate key violates unique constraint' on the primary key
apparently with Postgresql after bulk loading records where the auto incrementing id is specified you then need to update the sequence value
Sunday, May 3, 2009
bash scirpt to launch rails development environment
- launches script/server in a terminal window
- launches a new terminal and cd to the trunk
- launches firefox at http://localhost:3000 with a specific firefox profile
- and launches Komodo Edit - go ahead and pick the editor of your choice
I saved this in a file ~/scripts/launch_YOUR_PROJECT.sh
to execute this open a terminal and type ~$ bash ./scripts/launch_YOUR_PROJECT.sh
or create a symlink in your home directory
then execute using ~$ bash launch_YOUR_PROJECT
NOTE: in theory you should not need to even specify bash at the command prompt, when I did not I received the following error "bash: launch_YOUR_PROJECT: command not found"
running 'which bash' returns '/bin/bash' which is specified in the shell script?, something to look into later.
Saturday, April 25, 2009
Strange behavior with Rails find_or_initialize_by_id and Postgresql
Thursday, April 23, 2009
PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xa7 (ActiveRecord::StatementInvalid)
PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xa7 (ActiveRecord::StatementInvalid)Found a work-around, check it out here
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xa7 (ActiveRecord::StatementInvalid)
PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xa7 (ActiveRecord::StatementInvalid)
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
The above error was being generated when I was trying to save model objects that had their string and text attributes assigned from data that had been scrapped using http with scRUBYt. After searching on Google the only 'work-around' I found was to use base64 encode and decode when reading and writing to these model attributes / database columns
Given the following migration
Our model before and then after applying the work-around
Resources
Sunday, April 12, 2009
rails collection_select to prompt or include_blank?
collection_select(:product,
:category_id,
Category.all,
:id,
:title,
{:prompt => true}
)
collection_select(:product,
:category_id,
Category.all,
:id,
:title,
{:include_blank => 'Please Select'}
)
Saturday, April 11, 2009
accesskey attribute on the select tag is not valid?
Thursday, April 9, 2009
IE8 multiple cookies for the same site
As a web application developer I spend a lot of time logging into sites as different users and prefer to be able to toggle back and forth between multiple instances of a browser maintaining the separate sessions in each instance. With IE 7 this was not an issue as long as IE was launched from the toolbar. In IE 8 sessions are shared by default, once again a Google search delivers the goods!
This post explains the -no-merge switch
as easy as Start -> Run ->
iexplore.exe -nomerge
FireFox has a similar issue, but the only work around I know of with FireFox is to create separate profiles, see this post - FireFox and multiple cookies for the same site
'file version' is not in the normal 'major.minor.build.revision' format
After a quick Google search it turns out that each segment in a .net assembly cannot be larger then 65534. We use the TFS changeset for the revision segment but this will no longer work for us as we are now beyond changeset 65534 - doh! As a work around we are now using only the last 4 digits of the changeset, so instead of 2.7.1.65559 we are using the version 2.7.1.5559
this required a small change to the Nant build script
this version constraint is documented here
UPDATE: NAnt build with TFS changeset as revision number
apparently there is a limitation on the size of the number used in each segment of a .net assembly version so this is a slight update to the c# code that gets the latest changeset from TFS - changes start at "if(latestChangsetId > 65534)"
see also AssemblyVersion - BuildNo Limitation
Thursday, March 26, 2009
Get Filenames and Database names from MSSQL
Monday, March 2, 2009
jqueryUI effect error with Google Chrome and Safari
Using a slightly modified version of the demo. I tweak the background image before applying the highlight effect
$("#highlight").click(function() {
$(this).css("background", "url(some_image.png) no-repeat");
$(this).effect("highlight");
});
$(this).css("background-image", "url(some_image.png)");
$(this).css("background-repeat", "no-repeat");
$(this).effect("highlight");
Monday, February 16, 2009
use jquery to disable a button when clicked
NOTE: the above code snippets are untested - cut, pasted and modified from real code that was tested (and worked!)
CSS position:relative + position:absolute
Wednesday, January 21, 2009
2009 Grasshopper Adventure Series
- 2009-02-28 Old Caz
- 2009-03-07 Chileno Valley
- 2009-04-11 Lake Sonoma
- 2009-05-09 King Ridge
Saturday, January 17, 2009
Best binoculars for birding
Friday, January 16, 2009
words to live by
Wednesday, January 7, 2009
Coding Cheat Sheets
- jquery 1.2 (posted 2007-12-23)
- jquery 1.2 (posted 2008-01-11)
- jquery 1.3 (posted 2009-03-10)
- subversion (posted 2008-08-07)
- mysql (posted 2007-04-??)
- To be continued...
'Testing is Overrated' on InfoQ
http://www.infoq.com/presentations/francl-testing-overrated
just over 22 minutes and worth the watch; I had to take a screen capture of one of the slides about doing code reviews, just too funny