2011-09-28, Wed

Facebook Send Button Pop-Up turns transparent

While trying to add a Facebook Send button to my site via AddThis, I noticed that the pop-up from the Facebook Send button turns transparent when the mouse cursor hovers over it.

This is caused by a css rule that is making the a tag transparent. To fix it, add style="opacity:1;" to the a tag like this:

   <a class="addthis_button_facebook_send" style="opacity:1;"></a>

Original solution: AddThis forum thread

Isaac Su

tags: addthis facebook html opacity send

Comment [6]

---

2011-09-27, Tue

Ruby on Rails ActionDispatch::Cookies::CookieOverflow error

I recently encountered this error when trying to persist some form data using the session variable in Rails 3.

Turns out, the data I was trying to store exceeded 4k limit of the HTTP Cookie Specification, hence the CookieOverflow Error.

The easiest way around it is to change your Session storage option from CookieStore to something like ActiveRecordStore. By making this change, Rails will store the session data in a row in the database and set the unique id for the row in the cookie.

Here is how you can swap your Session storage to ActiveRecordStore in 3 easy steps.

1. Generate a migration that creates the session table

   rake db:sessions:create

2. Run the migration

   rake db:migrate

3. Modify config/initializers/session_store.rb from

   (App)::Application.config.session_store :cookie_store, :key => 'xxx'

to

   (App)::Application.config.session_store :active_record_store

Once you’ve done the three steps, restart your application. Rails will now use the sessions table to store session data, and you won’t have the 4kb limit.

Isaac Su

tags: activerecordstore cookie cookieoverflow cookiestore rails rake ruby session session_store

Comment [5]

---

2011-09-20, Tue

FirePHP not working after upgrading to Firefox 6

Some of you may have found that FirePHP doesn’t work after upgrading to Firefox 6.

It appears that in Firefox 6.0.2 + Firebug 1.8.2, FirePHP 0.6.2 (Firebug extension) isn’t appending “FirePHP/0.6” to the browser’s User Agent request headers. This is the case wven when the “Modify User Agent headers” option is turned on.

The missing “FirePHP/0.6” in the User Agent string causes the FirePHP server library to NOT respond with the appropriate X-Wf-* headers.

The quick solution for now is to install and run FirePHP/Firebug in a portable version of Firefox 5. It worked for me.

I’ve also posted this issue to the FirePHP bug tracker: Issue 177

Update

The other way around it is to start with a fresh Firefox profile using the Firefox Profile Manager

Isaac Su

tags: firebug firefox firefox-6 firephp headers problem

Comment

---

2011-08-01, Mon

How to hide phone number when making a call

Here’s how you can selectively withhold your phone number when making a call from a mobile. This causes your number to show up as “Private Number” or “Number Withheld” on the recipient’s handset.

To hide your number, just add the prefix #31# to the number you are dialing. For example, to call the number 0400777666 without revealing your own number, dial

     #31#0400777666

I’ve tested this on Vodafone and Optus in Australia, but it should work for other networks and countries as well.

If you’re dialing from a landline, try adding the prefix 1831 to the number you’re dialing

     18310400777666
Isaac Su

tags: caller hidden hide id number prefix private withheld

Comment [1]

---

2011-07-28, Thu

Adding custom options to Rail's select_tag

Three reasons why you’d want to do something like this:

  1. You want to hand code the of options for the select_tag
  2. You want to add a prompt to the top of the select_tag
  3. You want to manually append options to either the front or the end of the options generated by something like options_from_collection_for_select

The documentation says all you need to do is:

   <%= select_tag "gender", 
    "<option value=''>Gender</option>
     <option value='1'>Male</option>
     <option value='2'>Female</option>" 
   %>

but it would produce a blank drop-down select field with no options.

Thing is, Rails automatically escapes the string you provide in the second parameter for the select_tag method call, so the HTML tags get garbled up into HTML entities.

What you need to do is this:

   <%= select_tag "gender", 
     raw("<option value=''>Gender</option>
          <option value='1'>Male</option>
          <option value='2'>Female</option>") 
   %>

The raw method ensures that all the HTML tags stay intact and make their way to the browser.

Original solution found here

Isaac Su

tags: formtaghelper html options rails raw ruby select_tag

Comment

---

« Older Newer »