Firefox 2 gets Emacs Keybindings 2 comments

Posted by robon October 30, 2006

I just upgraded to Firefox 2 and here’s what I think: The first thing that bugged me was the icon re-design. It wasn’t until a coworker pointed out that the new icons take up less vertical space that they started to grow on me. Another nice new feature is the close button on individual tabs (like those in Safari).

My favorite feature are the Emacs Keybindings. Finally! I’ve been waiting for these to be built-in for a while now. A few versions ago, I would add them myself via an XML configuration file, but then things changed and the fix required cracking open a .jar, which I never got around to. Anyway, now I don’t need to. These keybindings speed things up by letting you jump around in the location bar or text input fields just a you do on the command line (in Emacs mode). Here’s a summary of these keybindings:

Ctrl+A Go to beginning of line
Ctrl+E Go to end of line
Ctrl+F Go right one character
Ctrl+B Go left one character
Ctrl+K Delete to end of line
Ctrl+U Delete entire line (different from readline, in which Ctrl+U deletes to the beginning of the line)
Ctrl+W Delete word, left
Ctrl+H Delete character, left (backspace)
Ctrl+D Delete character, right

I want to point out that I believe that to make the most of these keybindings (and any action that involves the Control key) you should try remapping your CapLock key to act as a Left Control key. I’ve done this for years and it’s the most comfortable way to type any command that includes the Control key. I use it all the time for Emacs keybindings (in Bash, and now Firefox) but most of all, in Vim.

For most Vim users, their hands are in safely on home-row with the exception of the thousands of times a day that their left hand has to reach over an slap the escape key. A few years ago, I found a way around this. Instead of hitting Escape to switch to command mode in Vim, I type Ctrl+C, which does the same thing. Using this, along with having my CapsLock key remapped to a Left Control key, I am able to stay on home-row much more then people who have to contort their hands to reach these commonly used, yet awkwardly placed keys. Give it a try, and see what you think.

By the way, remapping your CapsLock key in Linux or OS X is trivial. If want to do this in Windows, you need to hack your registry. To do so, follow these <a href=”http://orsinidesigns.com/old/ctl2caps/”>instructions.


Rails Cookbook TOC 7 comments

Posted by robon October 27, 2006

I have essentially finished the Rails Cookbook. It’s in O’Reilly’s production pipeline and should be in-print by Christmas. Here’s the final table of contents:

ch01_Getting_Started/

  1. Introduction.xml
  2. Finding_Documentation.xml
  3. Fix_Ruby_and_Install_Rails_on_OS_X_Tiger.xml
  4. Getting_your_Rails_Project_into_Subversion.xml
  5. Installing_MySQL.xml
  6. Installing_PostgreSQL.xml
  7. Installing_Rails.xml
  8. Joining_the_Rails_Community.xml
  9. Running_Rails_in_OSX_with_Locomotive.xml
  10. Running_Rails_in_Windows_with_Instant_Rails.xml
  11. Updating_Rails_with_RubyGems.xml

ch02_Rails_Development/

  1. Introduction.xml
  2. Creating_a_Rails_Project.xml
  3. Creating_Full_Featured_CRUD_Applications_with_Streamlined.xml
  4. Cross_Platform_Development_with_RadRails.xml
  5. Develop_Rails_in_OS_X_with_TextMate.xml
  6. Enhance_Windows_Development_with_Cygwin.xml
  7. Generating_Rdoc_for_your_Rails_Application.xml
  8. Installing_and_Running_Edge_Rails.xml
  9. Jump_start_Development_with_Scaffolding.xml
  10. Setting_Up_Password-less_Authentication_with_SSH.xml
  11. Speed_Up_Rails_Development_with_Mongrel.xml
  12. Understanding_Pluralization_Patterns_in_Rails.xml

ch03_Active_Record/

  1. Introduction.xml
  2. Accessing_your_Data_via_Active_Record.xml
  3. Add_Sort_Capabilities_to_a_Model_with_acts_as_list.xml
  4. Automating_Record_Time_stamping.xml
  5. Avoiding_Race_Conditions_with_Optimistic_Locking.xml
  6. Create_a_Directory_of_Nested_Topics_with_acts_as_tree.xml
  7. Developing_your_Database_with_Migrations.xml
  8. Enforce_Data_Integrity_with_Active_Record_Validations.xml
  9. Executing_Custom_Queries_with_find_by_sql.xml
  10. Factoring_out_Common_Relationships_with_Polymorphic_Associations.xml
  11. Handling_Tables_with_Legacy_Naming_Conventions.xml
  12. Inspecting_Model_Relationships_from_the_Rails_Console.xml
  13. Iterating_Over_an_Active_Record_Result_Set.xml
  14. Mixing_Join_Models_and_Polymorphism_for_Flexible_Data_Modeling.xml
  15. Model_a_Threaded_Forum_with_acts_as_nested_set.xml
  16. Modeling_a_Database_with_Active_Record.xml
  17. Perform_a_Task_Whenever_a_Model_Object_is_Created.xml
  18. Programmatically_Define_Database_Schema.xml
  19. Protecting_Against_Race_Conditions_with_Transactions.xml
  20. Retrieving_Data_Efficiently_with_Eager_Loading.xml
  21. Retrieving_Records_with_Find.xml
  22. Setting_up_a_Relational_Database_for_Use_with_Rails.xml
  23. Updating_an_Active_Record_Object.xml

ch04_Action_Controller/

  1. Introduction.xml
  2. Accessing_Form_Data_from_a_Controller.xml
  3. Changing_an_Applications_Default_Page.xml
  4. Clarify_Your_Code_with_Named_Routes.xml
  5. Configuring_Customized_Routing_Behavior.xml
  6. Displaying_Alert_Messages_with_Flash.xml
  7. Extending_the_Life_of_a_Flash_Message.xml
  8. Following_Actions_with_Redirects.xml
  9. Generating_URLs_Dynamically.xml
  10. Inspecting_Requests_with_Filters.xml
  11. Logging_with_Filters.xml
  12. Rendering_Actions.xml
  13. Restricting_Access_to_Controller_Methods.xml
  14. Sending_Files_or_Data_Streams_to_the_Browser.xml
  15. Storing_Session_Information_in_a_Database.xml
  16. Tracking_Information_with_Sessions.xml
  17. Using_Filters_for_Authentication.xml

ch05_Action_View/

  1. Introduction.xml
  2. Avoid_Potentially_Harmful_Code_in_Views_with_Liquid_Templates.xml
  3. Creating_a_Sticky_Select_List.xml
  4. Creating_a_Web_Form_with_Form_Helpers.xml
  5. Customize_the_Behavior_of_Standard_Helpers.xml
  6. Defining_a_Default_Application_Layout.xml
  7. Displaying_Large_Data-sets_with_Pagination.xml
  8. Editing_many-to-many_Relationships_with_Multi-Select_Lists.xml
  9. Factoring_out_Common_Display_Code_with_Layouts.xml
  10. Formatting_Dates_Times_and_Currencies.xml
  11. Generating_RSS_Feeds_from_Active_Record_Data.xml
  12. Globalize_your_Rails_Application.xml
  13. Output_XML_with_Builder_Templates.xml
  14. Personalize_User_Profiles_with_Gravatars.xml
  15. Processing_Dynamically_Created_Input_Fields.xml
  16. Reusing_Page_Elements_with_Partials.xml
  17. Simplifying_Templates_with_View_Helpers.xml

ch06_RESTful_Development/

  1. Introduction.xml
  2. Consuming_Complex_Rest_Resources.xml
  3. Creating_Nested_Resources.xml
  4. Develop_your_Rails_Applications_RESTfully.xml
  5. Modeling_Relationships_RESTfully_with_Join_Models.xml
  6. Moving_Beyond_CRUD_with_Restful_Resources.xml
  7. Supporting_Alternative_Data_Formats_by_Mime_Type.xml

ch07_Rails_Application_Testing/

  1. Introduction.xml
  2. Analyzing_Code_Coverage_with_rcov.xml
  3. Centralize_the_Creation_of_Objects_Common_to_Test_Cases.xml
  4. Creating_Many-to-Many_Association_Fixtures.xml
  5. Examining_the_Contents_of_Cookie.xml
  6. Importing_Test_Data_with_CSV_Fixtures.xml
  7. Improve_Feedback_by_Running_Tests_Continuously.xml
  8. Including_Dynamic_Data_in_Fixtures_with_ERb.xml
  9. Initializing_a_Test_Database.xml
  10. Interactively_Testing_Controllers_from_the_Rails_Console.xml
  11. Interpreting_the_Output_of_Test-Unit.xml
  12. Loading_Test_Data_with_YAML_Fixtures.xml
  13. Modifying_the_Default_Behaviour_of_a_Class_for_Testing_Using_Mocks.xml
  14. Monitoring_Test_Coverage_with_rake_stats.xml
  15. Running_Tests_with_Rake.xml
  16. Speeding_up_Tests_with_Transactional_Fixtures.xml
  17. Testing_Across_Controllers_with_Integration_Tests.xml
  18. Testing_a_Model_with_Unit_Tests.xml
  19. Testing_Controllers_with_Functional_Tests.xml
  20. Testing_Custom_and_Named_Routes.xml
  21. Testing_File_Uploads.xml
  22. Testing_HTTP_Requests_with_Response-Related_Assertions.xml
  23. Unit_Testing_Model_Validations.xml
  24. Verifying_DOM_Structure_with_Tag-Related_Assertions.xml
  25. Writing_Custom_Assertions.xml

ch08_JavaScript_and_AJAX/

  1. Introduction.xml
  2. Adding_DOM_Elements_to_a_Page.xml
  3. Autocompleting_a_Text_Field.xml
  4. Creating_a_Custom_Report_with_Drag_and_Drop.xml
  5. Creating_an_Ajax_Progress_Indicator.xml
  6. Dynamically_Add_Items_to_a_Select_List.xml
  7. Editing_Fields_in_Place.xml
  8. Enhancing_the_User_Interface_with_Visual_Effects.xml
  9. Implementing_a_Live_Search.xml
  10. Inserting_JavaScript_Into_Templates.xml
  11. Letting_a_User_Re-order_a_List.xml
  12. Monitor_the_Content_Length_of_a_Textarea.xml
  13. Search_for_and_Hightlight_Text_Dynamically.xml
  14. Updating_Page_Elements_with_RJS_Templates.xml

ch09_Action_Mailer/

  1. Introduction.xml
  2. Attaching_Files_to_Email_Messages.xml
  3. Configuring_Rails_to_Send_Email.xml
  4. Creating_a_Custom_Mailer_Class_with_the_mailer_Generator.xml
  5. Formatting_Email_Messages_Using_Templates.xml
  6. Receiving_Email_with_ActionMailer.xml
  7. Sending_Email_From_a_Rails_Application.xml

ch10_Debugging_Rails_Applications/

  1. Introduction.xml
  2. Debugging_HTTP_Communication_with_Firefox_Extensions.xml
  3. Debugging_Your_Application_in_Real_Time_with_the_Breakpointer.xml
  4. Debug_your_Code_Interactively_with_ruby-debug.xml
  5. Debug_your_JavaScript_in_Real_Time_with_the_JavaScript_Shell.xml
  6. Displaying_Object_Contents_with_Exceptions.xml
  7. Emailing_Application_Exceptions.xml
  8. Exploring_and_Debugging_from_the_Console.xml
  9. Filtering_Development_Logs_in_Real-Time.xml
  10. Fixing_Bugs_at_the_Source_with_Ruby_-cw.xml
  11. Logging_with_the_Built-in_Rails_Logger_Class.xml
  12. Outputting_Environment_Information_in_Views.xml
  13. Writing_Debugging_Information_to_a_File.xml

ch11_Security/

  1. Introduction.xml
  2. Guarding_Against_Cross_Site_Scripting_Attacks.xml
  3. Hardening_your_Systems_with_Strong_Passwords.xml
  4. Protecting_Queries_from_SQL_Injection.xml
  5. Restricting_Access_to_Public_Methods_or_Actions.xml
  6. Securing_Your_Server_by_Closing_Unnecessary_Ports.xml

ch12_Performance/

  1. Introduction.xml
  2. Before_Filtering_Cached_Pages_with_Action_Caching.xml
  3. Benchmark_Portions_of_Your_Application_Code.xml
  4. Expiring_Cached_Pages.xml
  5. Improve_Performance_by_Caching_Static_Pages.xml
  6. Increasing_Performance_by_Caching_Post-Processed_Content.xml
  7. Measuring_Web_Server_Performance_with_httperf.xml
  8. Mix_Static_and_Dynamic_Content_with_Fragment_Caching.xml
  9. Speed_up_Data_Access_Times_with_Memcached.xml

ch13_Hosting_and_Deployment/

  1. Introduction.xml
  2. Cleaning_up_Residual_Session_Records.xml
  3. Configuring_Pound_with_SSL_Support.xml
  4. Customize_Pounds_Logging_with_Cronolog.xml
  5. Deploying_Rails_with_Capistrano.xml
  6. Deploying_Rails_with_Pound_in_Front_of_Mongrel_Lighttpd_and_Apache.xml
  7. Deploying_to_Multiple_Environments_with_Capistrano.xml
  8. Deploying_with_Capistrano_and_mongrel_cluster.xml
  9. Deploying_with_Capistrano_without_a_SCM.xml
  10. Disabling_your_Website_During_Maintenance.xml
  11. Hosting_Rails_Using_Apache_1_3_and_mod_fastcgi.xml
  12. Hosting_Rails_with_Apache_2-2_mod_proxy_balancer_and_Mongrel.xml
  13. Managing_Multiple_Mongrel_Processes_with_mongrel_cluster.xml
  14. Simple_Load_Balancing_with_Pen.xml
  15. Writing_Custom_Capistrano_Tasks.xml

ch14_Extending_Rails_with_Plugins/

  1. Introduction.xml
  2. Adding_More_Elaborate_Authentication_using_the_Login_Engine.xml
  3. Adding_View_Helpers_to_Rails_as_Plugins.xml
  4. Building_Authentication_with_acts_as_authenticated.xml
  5. Disable_Records_Instead_of_Deleting_them_with_acts_as_paranoid.xml
  6. Extending_Active_Record_with_an_acts_as_Plugin.xml
  7. Finding_Third_Party_Plugins.xml
  8. Installing_and_Removing_Plugins.xml
  9. Manipulate_Record_Versions_with_acts_as_versioned.xml
  10. Simplify_Folksonomy_with_acts_as_taggable.xml
  11. Uploading_Files_with_acts_as_attachment.xml
  12. Uploading_Files_with_the_file_column_Plugin.xml

ch15_Graphics/

  1. Introduction.xml
  2. Creating_Resized_Thumbnails_with_RMagick.xml
  3. Creating_Small_Informative_Graphs_with_Sparklines.xml
  4. Generating_PDF_Documents.xml
  5. Installing_RMagick_for_Image_Processing.xml
  6. Serving_Images_Directly_from_a_Database.xml
  7. Uploading_Images_into_a_Database.xml
  8. Visually_Display_Data_with_Gruff.xml