Sunday, February 19, 2012

Deep Field Problems


A Deep Field Problem is one which at a glance appears trivial and solutions almost completely vacuous, yet upon longer observation reveals ancient embedded structures and an unbounded density of substance. 
Real world situations and phenomena are chock full of Deep Field Problems. Moving to the other end of the spectrum of scale, particle physics reveals boundaries of inspection below which we cannot go, yet even in the vacuum of space there is the zero point energy dance of virtual particles popping in and out of existence. The effect was used by Hawking to describe how black holes could evaporate. 
Human culture presents a Deep Field Problem in itself, as do the many societal domains layered upon it: economics, medicine, engineering, science, and governance to name a few. 
<colophon>
The background image was prepared from http://hubblesite.org/newscenter/archive/releases/1996/01 with The GIMP on a 1680x1050 resolution MacBook Pro, and placed into the background with a very nice CSS3 property (background-size: cover;).
GIMP preparations started with the high-resolution TIFF. The main image layer was duplicated, and a threshold of about 62% was applied to the foreground layer to mask out the fine galactic "noise". The foreground layer was then blurred slightly, and the mode changed to Soft Light. Finally, a rectangular area of the visible image was selected and pasted as a new image, scaled to fit my screen, and saved as a 68% quality JPEG.
</colophon>

Friday, February 17, 2012

A Call for IP Credit Unions


A message on a technology user group mailing list by a National Guardsman caught my eye one day. He wanted to promote the use of OpenSource within the government institution. The incorporation of OpenSource software was simply his way of saying "we can improve the institution by leveraging publicly available technology."

In my opinion, he was correct. But it is fascinating that our public institutions have placed themselves into the situation of depending upon closed source systems for mission critical services, and it is worse that the public doesn't get substantive benefit from offering protection to these closed systems. 

Original Intent

Both standards like POSIX and old laws like copyright seek a balance of power between wealth creators and wealth beneficiaries. The intent was to ensure that the creator could use his or her creations for profit while blocking others from doing so in an unauthorized manner, for a limited time. After some finite time period, the intellectual content of the work would enter into the public domain.

Undermining the Original Intent

The Court's Role in Undermining Public Standards

I wrote before how the courts undermined public efforts to require platform standards. In a nutshell, UNIX was standardized under the FIPS procurement requirements as a set of standards called POSIX. The Coast Guard required substantive POSIX compliance for RFP responses; the courts said no: constructive non-compliance was okey-dokey by them. And thus, Microsoft Windows NT became a viable purchase option, despite the fact that its compliance was a farse.  

NT no more satisfied the meaning of the law than would have the court of clerk by filing court records of decisions in Mattenänglisch. Yes, it does have the sound "english" in its name, but it is not even remotely among the languages used in culture. 

Legislative Undermining of the Public Interest

The Berne Convention entered into force in the United States on March 1, 1989. Under the convention, a copyright to a creative work is automatic and need not be registered or even declared. Recently, courts and the legislature acted to harmonize the treatment of formerly public-domain works in the US which had claims upon them of foreign copyrights.

This is all well and good, countries making treaties that simplify and straighten out differences in law. It would all be great, except that copyright has been extended to the point that the public no longer appears to have an interest in granting the protection.

The DMCA was also passed in 1998 to add punitive sanctions on technologies if they could be used to bypass copy protection schemes. It has been used to arrest researchers. The DMCA's criminalization of scientific discovery isn't at all in the public interest but a prosecutor will use the tools available. 

Technology's Role

In recent decades society has become ever increasingly dependent upon software to operate, coordinate, communicate, and manage throughout business and private life. Yet software itself is not only highly complicated, it is intractably interdependent and highly sensitive to the conditions under which it is deployed. Wealth in the form of software is still somewhat difficult to create (though it is easier now than ever before) but it even easier to destroy - and this is a key insight.

The public offers intellectual property protections for software wealth, in exchange for a future promise of release of that wealth into the public domain, but the public gets virtually no benefit by (a) extending protections indefinitely or (b) allowing the grant of such protection when no demonstration is made of the surety that the wealth will still be there, at least in as much as could be guaranteed at a technical level.

Modern professional software craftspeople practice test driven development, change management, and revision control.  Services like GitHub make some of these processes transparent for open source projects. But custom development projects and packaged deployments by closed-license vendors offer no such fiduciary-like accountability.  This places institutions and organizations at a distinctive disadvantage as vendors get sold, go belly-up, divest themselves of core competencies, or merely lose interest in the business. 

A Co-Operative as an Equation Balancer

There are numerous examples of co-operatives in modern society, ranging from:
...and the list goes on. The question is not "do we need co-operative organizations," but rather, how can we leverage their future to strike a more even balance between private and public interests?  Co-operatives give the community the power to sanction those who abuse the trust, but also help its members create more wealth.  That sounds like a vehicle that could be leveraged to mitigate some of the corrosive influences of over-reaching copyrights and monstrous patents.

A Software Credit Union/IP Credit Union

Credit unions (CU's) arose around the 1850's in Germany, spreading through Europe and then the Americas around the beginning of the previous century. Organized around co-operative principles, CU's traditionally served poor and middle class populations, allowing them to pool resources and build wealth as a community. The movement was instrumental in providing microfinance, in a manner reminiscent of the resurgence in crowdsourcing today.

I chose the Credit Union as a model for two reasons. First, even if you don't include wetware, software is certainly one of, if not THE chief representation of wealth in our society. Try to run a phone without software, or a car, or a television, or a debit card, or a CAT scan machine... the stuff is, like, freaking everywhere. Software is the stuff of real wealth, the asset that literally makes everything go.

Second, while other forms of co-operatives may have application to this arena, Credit Unions best capture the concepts of investment and maintenance of assets with accountability and fiduciary responsibility. Software is an asset, and those who pay money or put out effort to maintain the software are making investments. Those that utilize software assets gain from their access to it. By combining the valuation of the software with a Github style accountability, such an institution could conceivably provide a means of implementing limited exclusivity and limited timeframes on licensing, while ensuring that the public's ongoing interest in protected IP is itself protected.

Finally, public institutions and small organizations with limited capital must finds ways to mitigate the concern that Open Source projects may not provide demonstrable support capacity. While it often seems that the promise of support by commercial software organizations is an illusion, and that they often over-price and under-deliver in this respect, companies such as RedHat would have no business model were it not for this one issue. My thinking leans toward proposing Software CU's as a means to organize and ensure support by constructively using the income of the CU to serve the needs of a broader community of businesses and individuals. Public institutions in particular, could require a levels of support that the CU could provide, and by investing their software projects with the CU the institution would be ensuring that it would not face a long-term imbalance of power due to one vendor's proprietary de facto ownership of the IP.

This is a work in progress. As I write, numerous other examples and overlapping concerns pop in and out like virtual particles, and the field of view suddenly seems as crowded as a deep field snapshot of a seemingly empty region of space. It can be overwhelming. Rather than continue to blather on, I proposed this as a discussion topic at the 2012 NCSU FOSS Fair

Rails 3.2.1 with MongoDB quick checklist

I'm just writing this to remind myself of what I did to set up a baseline for Checkie, a checklist helper. Assumption: you have git installed, and you're a little familiar with RVM.


Install a gcc or configure RVM to use clang, and install Ruby 1.9.3

The OSX compiler set in XCode 4.2 changed out gcc for an LLVM based compiler. The corresponding compiler is called 'clang'. You may encounter issues installing Ruby 1.9.3 with RVM until fixes are made permanent; I figured out what to do in the meantime on StackExchange (please look it up there since YMMV).

I usually use an application-specific gemset. Assuming that 1.9.3 is current:

rvm gemset create checkie

I stick this sort of configuration into a local .rvmrc file in the working tree
echo "rvm use ruby-1.9.3-p0@checkie" > .rvmrc

The RVM install should have set up your .bash_profile or .bash_login so it will automatically read the .rvmrc when you cd to the directory. If not read up on it at the RVM home page.

Install mongodb

brew install mongo

Then follow instructions:

    mkdir -p ~/Library/LaunchAgents
    cp /usr/local/Cellar/mongodb/2.0.2-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist

Check out some references and tutorials

A few I looked through.
  • http://railsapps.github.com/installing-rails.html
  • https://github.com/RailsApps/rails3-mongoid-devise/wiki/Tutorial
  • http://railsapps.github.com/rails-heroku-tutorial.html

Fixup the Gemfile

I add a :production and :development group, things like the debugger and chose the server (thin, unicorn, whatnot...).  I also use Compass, Sass, HTML5 Boilerplate, Compass-Less, Fancy Buttons, Devise, Cancan, and a few other gems. Bundle, and check in to git and move on.

Initialize gems that need to be initialized

compass init rails .

vi app/views/layouts/application.html.haml   (add compass/sass stuff; round it out later)
%head
  = stylesheet_link_tag 'screen.css', :media => 'screen, projection'
  = stylesheet_link_tag 'print.css', :media => 'print'
  /[if IE]
    = stylesheet_link_tag 'ie.css', :media => 'screen, projection'


vi config/application.rb (add block to opened Application class):
    config.generators do |g|
      g.template_engine :haml
      g.test_framework  :rspec
      g.orm             :mongoid
    end  

vi config/compass.rb  (add fancy-buttons)
  require "fancy-buttons"

vi app/assets/stylesheets/application.css.scss
@import "fancy-buttons";

rails generate mongoid:config
rails generate barista:install
rails generate rspec:install

vi spec/spec_helper.rb   (add rspec config with cucumber, comment out activerecord stuff)
  config.mock_with :rspec

  require 'database_cleaner'

  config.before(:suite) do
    DatabaseCleaner.strategy = :truncation
    DatabaseCleaner.orm = "mongoid"
  end

  config.before(:each) do
    DatabaseCleaner.clean
  end

rails generate cucumber:install --capybara --rspec --skip-database  

cat <<EOT > features/support/database_cleaner.rb
require 'database_cleaner'
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = "mongoid"
Before { DatabaseCleaner.clean }
EOT

rails generate devise:install

vi config/environments/development.rb:
   config.action_mailer.default_url_options = { :host => 'localhost:3000' }

vi config/routes.rb.
       root :to => "home#index"

vi app/views/layouts/application.html.haml
%body
  %article
    %header
      %p.notice=notice
      %p.alert=alert

rails generate mongoid:devise User
vi routes.rb:
devise_for :users
 
rails generate cancan:ability

But wait...
rails g jquery:install --ui
 deprecated  You are using Rails 3.1 with the asset pipeline enabled, so this generator is not needed.
              The necessary files are already in your asset pipeline.
              Just add `//= require jquery` and `//= require jquery_ujs` to your app/assets/javascripts/application.js
              If you upgraded your app from Rails 3.0 and still have jquery.js, rails.js, or jquery_ujs.js in your javascripts, be sure to remove them.
              If you do not want the asset pipeline enabled, you may turn it off in application.rb and re-run this generator.

(no need to edit the application.js -- the lines are already there)

(copy a bunch of view templates from another haml app for boilerplate)

rails g controller home index
rails g controller vip index

vi app/controllers/vip_controller.rb:
  before_filter :authenticate_user!

There's a lot more to do...

CSS Stuff from the Function Pink Meetup

Object Oriented CSS
- good for themes
- typically feature based names (non-semantic): "circle", "rounded", "green"
- bad for finding stuff again (not DRY for the selectors)

CSS Reset
  Eric Myers'
  Necolas' Normalize.css
    has much better defaults
    decreases clutter in cascade

Use deployment concatenation to deliver single stylesheets
  - sass as a preprocessor
  - no imports (buggy in older browsers, still have multiple requests)

SMACSS
  Kind of like OOCSS, but with four (logical) components: base, layout, module, states

  Uses name mangling/conventional prefixes on class selectors
   - eg layout-stuff to indicate a layout rule
   - Cautions on the use of "id" attributes, only for things JS touches, or are linked-to
      - typically containers

   Layout typically contains... layout rules
     - and media queries are a logical to place here

  Modules typically use class selectors, not id's; representing the "skinning" of the site
    - try to use semantic class names
    - try to keep style selectors' span of matching as short as possible, at most (parent child), to avoid side-effects
     buttons, navigation menus, balloons

  States
    - use conventional naming "is-adjective" : .is-hidden, .is-open, .is-active, etc

Preprocessors
  SASS (and Compass)
    - can watch files (directories)
    - allows rule injection with @includes and @mixin :
     @mixin ie6 { .lt-ie7 & { @content } }
      @include ie7 { .btn { float: left; } }

  Less
    - Like SASS, but implemented in Javascript rather than Ruby
    - can translate on the fly in the browser

  Stylus (via Node.js)

Cross browser rules (IE handling)
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  // force IE standards mode
  <!--[if lt IE 7]> <body class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->

  <!--[if IE 7]> <body class="lt-ie9 lt-ie8"> <![endif]-->
  <!--[if IE 8]> <body class="lt-ie9"> <![endif]-->
  <!--[if gt IE 8]><!-- --> <body> <!--<![endif]-->--> // avoid quirks mode

  Target these with sandboxed selector hacks "*" idea. 


Avoiding Side Effects
  Over specifying markup fragment addressing
     - addressing by id
     - addressing structural relations of the markup
  Keep the selectors flat
    not chained or deeper than two levels
    if you do chain selectors make them close together




Wednesday, February 15, 2012

DNS Cache Issues

It could be something in my router, or something to do with the way large scale cloud services are routing for load sharing.   Whatever it is, sites like plus.google.com keep going off-line because the certificate doesn't match "myshoppify.com", which seems to be another Google property.

So I set up a launchd job to flush the DNS cache every four hours. The following was saved at /Library/LaunchAgents/com.agilemarkup.fixDNSCachingIssues.plist, and loaded with launchctl load ...

Got to get me a new router...


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>KeepAlive</key>
  <true/>
  <key>Label</key>
  <string>com.agilemarkup.fixDNSCachingIssues</string>

  <key>ProgramArguments</key>
  <array>
    <string>/usr/bin/dscacheutil</string>
    <string>-flushcache</string>
  </array>
  
  <key>RunAtLoad</key>
  <true/>

  <key>StartInterval</key>
  <integer>14400</integer>
  
  <key>StandardErrorPath</key>
  <string>/var/log/dnscacheutil.err.log</string>

  <key>StandardOutPath</key>
  <string>/var/log/dnscacheutil.out.log</string>
  
  <key>WorkingDirectory</key>
  <string>/tmp</string>
</dict>
</plist>

Wednesday, February 8, 2012

Install Git under Windows


Install Git 


Windows installer here.

Under Windows, use the Bash Shell or GUI app.
You can also fetch TortoiseGIT to work with the Windows gui environment.

Menu -> Git -> Git Bash

You will see:
Welcome to Git (version 1.7.8-preview20111206)

Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
$


Set up a proper workspace 


Please translate the username (whome) and pathnames as appropriate.

$ pwd
/c/Documents and Settings/whome

$ mkdir workspace
$ cd workspace

$ git config --global user.name "Who Me"
$ git config --global user.email "whome@some.domain.com"

$ git clone  some.repo.url/reponame.git

Cloning into 'reponame'...
done.

At this point, you'll have a working local git repo that can be pulled from the remote repo, and pushed (assuming the repo url allows write access).

More cheat sheets for git can be found here:
http://help.github.com/git-cheat-sheets/