house9

random code and what not

Grow vegetables go to jail?

Oak Park resident Julie Bass now faces serious charges for setting up a vegetable garden in her front yard.

Help her out sign the petition here: http://www.thepetitionsite.com/1/oak-park-hates-veggies/


We are requesting that the City of Oak Park, MI cease its prosecution against its resident Julie Bass for the supposed crime of growing vegetables in her front yard. The bylaw they are pursuing criminal charges under is poorly written and does not explicitly state that you cannot grow vegetables. The prosecutor representing the city wants to take this case to trial, and the associated charge carries a maximum sentence of 93 days in jail. It would be a travesty for this mother of six to be sentenced to 93 days in jail for the simple act of growing tomatoes in her front yard.

Details about the case can be found at http://oakparkhatesveggies.wordpress.com/

rails 3.1 and ruby-1.9.2-p180 - rake aborted! stack level too deep

Ran into the following error when running rake with a rails 3.1 (rc4) app on ruby-1.9.2-p180 (RVM)

rake aborted! stack level too deep
Full error stack

$> rake --tasks

/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/version.rb:4: warning: already initialized constant MAJOR
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/version.rb:5: warning: already initialized constant MINOR
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/version.rb:6: warning: already initialized constant BUILD
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/version.rb:3: warning: already initialized constant NUMBERS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/version.rb:9: warning: already initialized constant VERSION
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake.rb:26: warning: already initialized constant RAKEVERSION
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/early_time.rb:17: warning: already initialized constant EARLY
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/alt_system.rb:32: warning: already initialized constant WINDOWS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:28: warning: already initialized constant DEFAULT_RAKEFILES
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task_arguments.rb:73: warning: already initialized constant EMPTY_TASK_ARGS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/invocation_chain.rb:49: warning: already initialized constant EMPTY
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/dsl_definition.rb:143: warning: already initialized constant Commands
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:44: warning: already initialized constant ARRAY_METHODS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:47: warning: already initialized constant MUST_DEFINE
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:51: warning: already initialized constant MUST_NOT_DEFINE
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:55: warning: already initialized constant SPECIAL_RETURN
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:61: warning: already initialized constant DELEGATING_METHODS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:364: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_list.rb:370: warning: already initialized constant DEFAULT_IGNORE_PROCS
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake.rb:64: warning: already initialized constant FileList
/Users/HOME_DIR/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake.rb:65: warning: already initialized constant RakeFileUtils
rake aborted!
stack level too deep

(See full trace by running task with --trace)


Steps to replicate, from the command line
  • rails new sample_app
  • cd sample_app
  • rake –tasks
The solution, prefix calls to rake with bundle exec
bundle exec rake –tasks
Resources

Comments

House 9
doesn't look like you have rails installed at all?
no Gemfile for bundler to check either?

I recommend you read up on bundler
http://gembundler.com/

also - you'll probably get better help over at stackoverflow - http://stackoverflow.com/
codeMonkey
almost but not quite. PLEASE HELP:

>gem install bundler
Successfully installed bundler-1.1.5
1 gem installed
Installing ri documentation for bundler-1.1.5…
Installing RDoc documentation for bundler-1.1.5…

>bundle exec rake –tasks
Could not locate Gemfile

>gem list

*** LOCAL GEMS ***

activesupport (3.2.8, 2.3.14)
bigdecimal (1.1.0)
bundler (1.1.5)
diff-lcs (1.1.3)
extlib (0.9.15)
highline (1.6.14, 1.6.13)
i18n (0.6.0)
io-console (0.3)
json (1.7.5, 1.5.4)
macaddr (1.6.1)
minitest (3.3.0, 2.5.1)
multi_json (1.3.6)
rake (0.9.2.2)
rdiscount (1.6.8)
rdoc (3.12, 3.9.4)
rdoc-data (3.12)
rhodes (3.3.4)
rubygems-update (1.8.24)
systemu (2.5.2)
templater (1.0.0)
uuid (2.3.5)
House 9
try

gem install bundler

codeMonkey
'bundle' is not recognized as an internal or external command,
operable program or batch file.

on windows.
junaidpv
Thanks. It helped me
ZequeZ
Also you can call alias rake='bundle exec rake', or add it to your .bash_profile file, so you don't have to call it each time ^^
ZequeZ
Thanks! That solved it ^^
Also, I'm using Ruby 1.9.2p290, Rails 3.1.0.rc6 and Rake 0.9.2

robocopy fix for exit code of 2

Sometimes you want to use robocopy from nant, a sql job or another build tool, robocopy will return 2 during a successful run, this gets interpreted as an error, a google search on the issue returned this article Fixing Robocopy for SQL Server Jobs.

Robocopy is now installed by default on Windows7 and Windows Server 2008
http://technet.microsoft.com/en-us/library/cc733145(WS.10).aspx

here is robocopy_fix.bat based on the code in the “Fixing Robocopy for SQL Server Jobs” article


rails 3.1 javascript execution

Looking at a few different ways to execute javascript in rails 3.1. By default all javascript is compiled into one file and embedded in anonymous functions which all execute on each page.

We often want to be selective in how our javascript executes, based on controller and actions. We look at 3 different approaches

  • use selectors based on form id
  • use selectors based on css classes on the body
  • namespaced javascript objects

if you know of any other approaches I would love to hear those as well

I recommend you click the HD link on the player and view it on Vimeo in full screen mode, this embed version is not so crisp.


Resources

Comments

Internet008
great.

I like third way.

rails 3.1 asset pipeline

a quick look at app, lib, vendor and gem assets for rails 3.1 rc1

It is a pretty rough screen cast, but hopefully has some useful information for you

I recommend you click the HD link on the player and view it on Vimeo in full screen mode, this embed version is not so crisp.


Resources:


UPDATE: see ”Unholy Rails: External Scripts, jQuery Plugins, and Page-Specific JavaScript” for a detailed look at using the asset pipeline with rails. 

AT&T site has some serious issues

I went to check on the price of DSL, I’ve been a long time Comcast customer and getting tired of the high cost. So I went to check it out on AT&T - all I can say is WTF?

Select ‘DSL without phone’, but then my choices are everything except what I am looking for?
I think they need to go back and do some more QA


Now I get to choose my phone service - WTF: I selected ‘without phone service’ for a reason

Simple.Data and MongoDB

Get really dynamic with Simple.Data and MongoDB

took me awhile to figure out the proper way to establish a connection with Simple.Data.MongoDB




Resources

You can install all of the dlls using Nuget, search for Simple.Data.MongoDB and install that package it will bring in the rest

Some of the errors I received on my journey

From Simple.Data
Message=No valid exports were found that match the constraint ‘((exportDefinition.ContractName == “Ado”) AndAlso (exportDefinition.Metadata.ContainsKey(“ExportTypeIdentity”) AndAlso “Simple.Data.Adapter”.Equals(exportDefinition.Metadata.get_Item(“ExportTypeIdentity”))))’, invalid exports may have been rejected.
And from mongo driver when my connection string was not in the correct format, I was using the wrong port
Message=No connection could be made because the target machine actively refused it 127.0.0.1:

Comments

House 9
honestly - I can't remember :(

it might have been use of var vs dynamic

// works
dynamic db = Database.Opener.OpenMongo(…

// errors ???
var db = Database.Opener.OpenMongo(…

I haven't done any c# in a few months and only spent a few days with simple.data at the time I posted this

I would contact the authors on github if this doesn't help
David
So what caused that 'No exports' exception and what fixed it? Having the same thing but cannot figure out what to do to resolve it.