$(document).bind("mobileinit", function () { $.mobile.ajaxEnabled = false; $.mobile.linkBindingEnabled = false; $.mobile.hashListeningEnabled = false; $.mobile.pushStateEnabled = false; });The trick to getting this to work is loading this bit of code before you load jQuery Mobile. More information at http://jquerymobile.com/demos/1.2.0/docs/api/globalconfig.html.
Wednesday, February 20, 2013
Disabling hashListening in jQuery Mobile 1.2
Just a quick note. Spending a little time today integrating Backbone.js with jQuery Mobile. Both frameworks have routing solutions which do not work together. However, there is some simple configuration that you can use to turn off the jQuery Mobile routing in favor of Backbone.js routing:
Friday, February 08, 2013
Disappearing USB ports on Mac Pro (Early 2009)
Just a quick note before bed. Recently I've been having issues with my Mac Pro not recognizing my HiFiMan headphone amp through a USB connection. I thought it might be the amp, but I tried it on my MacBook Pro and it recognized it immediately. Tonight, I noticed that my iPod would not connect iTunes on my Mac Pro. Searching around, I found an easy solution:
Voila! I have my USB ports back and my system is recognizing both the HiFiMan amp and my iPod.
- Shut down your computer.
- Unplug the computer from power and wait about 15 seconds or so.
- Plug the computer power cord back into a power outlet.
- Restart your computer.
Voila! I have my USB ports back and my system is recognizing both the HiFiMan amp and my iPod.
Thursday, February 07, 2013
Effective use of the Rails has_and_belongs_to_many association
Just a note to myself and others using the Rails has_and_belongs_to_many association:
-
The naming of the association table is by alphabetical convention. For example, a many-to-many relationship between Assemblies and Parts models would result in an association table named assemblies_parts. The migration will look like:
class CreateAssembliesPartsAssociationTable < ActiveRecord::Migration def self.up create_table :assemblies_parts, :id => false do |t| t.integer :assembly_id, :null => false t.integer :part_id, :null => false end add_foreign_key(:assemblies_parts, :assemblies) add_foreign_key(:assemblies_parts, :parts) end def self.down drop_table :assemblies_parts end end
Note that I am using the foreigner gem to implement foreign keys in my migrations. - Use this association type when you want a direct many-to-many mapping of models without any intervening association model.
-
The model mapping looks like the following:
class Assembly < ActiveRecord::Base has_and_belongs_to_many :parts end
andclass Part < ActiveRecord::Base has_and_belongs_to_many :assemblies end
Subscribe to:
Posts (Atom)