Dangerous Ideas

Posted by spooneybarger Wed, 04 Jan 2006 05:26:00 GMT

The Edge community have written 117 original essays (a document of 72,500 words) in response to the 2006 Edge Question — “What is your dangerous idea?”. I’ve just started working my way through these but there is some real good, thought provoking stuff here, you should check it out. Below Haim Harari’s “Democracy may be on its way out”...

Democracy may be on its way out. Future historians may determine that Democracy will have been a one-century episode. It will disappear. This is a sad, truly dangerous, but very realistic idea (or, rather, prediction).

Falling boundaries between countries, cross border commerce, merging economies, instant global flow of information and numerous other features of our modern society, all lead to multinational structures. If you extrapolate this irreversible trend, you get the entire planet becoming one political unit. But in this unit, anti-democracy forces are now a clear majority. This majority increases by the day, due to demographic patterns. All democratic nations have slow, vanishing or negative population growth, while all anti-democratic and uneducated societies multiply fast. Within democratic countries, most well-educated families remain small while the least educated families are growing fast. This means that, both at the individual level and at the national level, the more people you represent, the less economic power you have. In a knowledge based economy, in which the number of working hands is less important, this situation is much more non-democratic than in the industrial age. As long as upward mobility of individuals and nations could neutralize this phenomenon, democracy was tenable. But when we apply this analysis to the entire planet, as it evolves now, we see that democracy may be doomed.

To these we must add the regrettable fact that authoritarian multinational corporations, by and large, are better managed than democratic nation states. Religious preaching, TV sound bites, cross boundary TV incitement and the freedom of spreading rumors and lies through the internet encourage brainwashing and lack of rational thinking. Proportionately, more young women are growing into societies which discriminate against them than into more egalitarian societies, increasing the worldwide percentage of women treated as second class citizens. Educational systems in most advanced countries are in a deep crisis while modern education in many developing countries is almost non-existent. A small well-educated technological elite is becoming the main owner of intellectual property, which is, by far, the most valuable economic asset, while the rest of the world drifts towards fanaticism of one kind or another. Add all of the above and the unavoidable conclusion is that Democracy, our least bad system of government, is on its way out.

Can we invent a better new system? Perhaps. But this cannot happen if we are not allowed to utter the sentence: “There may be a political system which is better than Democracy”. Today’s political correctness does not allow one to say such things. The result of this prohibition will be an inevitable return to some kind of totalitarian rule, different from that of the emperors, the colonialists or the landlords of the past, but not more just. On the other hand, open and honest thinking about this issue may lead either to a gigantic worldwide revolution in educating the poor masses, thus saving democracy, or to a careful search for a just (repeat, just) and better system.

I cannot resist a cheap parting shot: When, in the past two years, Edge asked for brilliant ideas you believe in but cannot prove, or for proposing new exciting laws, most answers related to science and technology. When the question is now about dangerous ideas, almost all answers touch on issues of politics and society and not on the “hard sciences”. Perhaps science is not so dangerous, after all.

Posted in , , , , , , , , , , , ,  | no comments

DateHelper fixes

Posted by spooneybarger Thu, 04 Aug 2005 06:11:00 GMT

The following was submitted as ticket #1260 which will be incorporated into Rails sometime post version 1.0.

During the interim period of time, I have a number of people have need to functionality that the fix provides and I am thus putting it up here to speed things along.

For full info on the patch:

http://dev.rubyonrails.com/ticket/1260

To download the ‘library-ized’ version:

http://www.theredheadedstepchild.net/p/downloads/date_helper.rb

Posted in  | 1 comment

A Basic Per Controller Menu For Rails

Posted by spooneybarger Thu, 04 Aug 2005 05:28:00 GMT

What follows is a basic per-controller menu for use with Ruby on Rails. The code was last used with Rails 0.12 but should work with later versions.

This was my first attempt at doing meta-programming with Ruby so I'm sure improvements can be made ( and they are more than welcome. )

But enough with all that, on to the code..

In your controller you have something like:


require_dependency 'controller_menu'

class LinksController < ApplicationController
  include ControllerMenu

  has_menu :menu => 'shared/submenu',
           :items => [
                       { :text => 'All Links', :action => 'list' },
                       { :text => 'Add Link', :action => 'new' },
                       { :text => 'Categories', :controller => 'link_categories', :action => 'list' }
                     ]
end

The template 'shared/submenu' used to format the menu would be something like:


<p>
<% if item.selected? %>
<b><%= item.render %></b>
<% else %>
<%= item.render %>
<% end %>
</p>

Note that menu template is a partial and thus in the filesystem would be app/views/shared/_submenu.rhtml.

To actually render the submenu insert the following in the appropriate place in your layout:


  <%= render_controller_menu %>

The actual 'library' should be installed in your rails lib directory and is available inlined here or at http://www.theredheadedstepchild.net/p/downloads/controller_menu.rb


 module ControllerMenu
  def self.append_features( base )
    super
    base.extend( ClassMethods )
  end

  module ClassMethods
    def has_menu( options = {} )
      menu, items = options[ :menu ], options[ :items ]
      module_eval(%Q{
        def self.controller_menu
          unless @controller_menu
            @controller_menu = Controller::Menu.new( "#{menu}", #{items.inspect} )
          end
          @controller_menu
        end
      })
    end
  end
 end

 module ApplicationHelper
  def render_controller_menu
    begin
      menu = controller.class.controller_menu
      menu.view = self
      menu.render
    rescue
      ""
    end
  end
 end

 module Controller
  class Menu
    attr_accessor :template, :items, :view

    def initialize( template, item_list )
      @items = []
      @template = template
      item_list.each { |i| @items << MenuItem.new( self, i ) }
    end

    def render
      out = []
      @items.each { |i| out << @view.render_partial( @template, nil, 'item' => i ) }
      out.join( "\n" )
    end
  end

  class MenuItem
   def initialize( menu, options = {} )
      @menu = menu
      @text = options[ :text ]
      @options = options if options.delete( :text )
    end

    def render
       @menu.view.link_to( @text, @options )
    end

    def selected?
      @options[ :action ] == current_action() if ( ! @options[ :controller ] || @options[ :controller ] == current_controller() )
    end

    private
      def current_action
        @menu.view.controller.action_name
      end

      def current_controller
        @menu.view.controller.controller_name
      end
  end
 end

Posted in  | no comments