display Processing .pde file in Ruby? - html

I am fairly new to Ruby as well as Processing, but I have a page built in Ruby and would like to know how to display my Processing .PDE files on that Page. I have read online that you need Processing.js
i have copied the code for processing.js from [processingjs.org][1] and put it in a file called processing.js in app/assets/javascripts
I have saved a .pde file called butters.pde in app/assets/images/data.
Am I calling the script correctly in the header and the file correctly in the body? I'm not seeing anything when I try to view the page.
<head>
<title>Hello</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="assets/javascripts/processing.js"></script>
</head>
and
<body>
<canvas data-processing-sources="/assets/images/data/butters.pde"></canvas>
</body>
The Terminal reads:
Started GET "/assets/images/data/butters.pde" for 127.0.0.1 at 2014-09-23 14:55:18 -0400
ActionController::RoutingError (No route matches [GET] "/assets/images/data/butters.pde"):
actionpack (4.1.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
The browser console reads:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/assest/javascripts/processing.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/assets/images/data/butters.pde
Uncaught Processing.js: Unable to load pjs sketch files: /assets/images/data/butters.pde ==> Invalid XHR status 404

Related

How to resolve Struts 2 Json Interceptor invalid json exception

Hi i upgraded my struts project from 2.3.20 to 2.5.2 and when i am trying to run, it is throwing me exception in JsonInterceptor. I am unable to figure out why it throwing this exception after upgrading struts to 2.5.2. I have also change my struts.xml file according to it. But still it is showing me same error. Can anyone help me what i am missing.
Error Trace:
struts.xml
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<package name="default" extends="json-default,struts-default">
<interceptors>
<interceptor name="json" class="org.apache.struts2.json.JSONInterceptor"/>
<interceptor name="sessionInterceptor" class="com.comviva.mconnectui.custom.interceptors.SampleInterceptor"/>
<interceptor-stack name="customInterceptor">
<interceptor-ref name="sessionInterceptor" />
<interceptor-ref name="json" />
</interceptor-stack>
</interceptors>
</package>
</struts>

When Connecting WSO2 apim in docker to mysql in local machine getting error while using useSSL=true in url

When Connecting WSO2 apim in docker to mysql in local machine getting error while using ssl=true in url .
Datasource connection code in apim:
<datasource>
<name>WSO2_CARBON_DB</name>
<description>The datasource used for registry and user manager</description>
<jndiConfig>
<name>jdbc/WSO2CarbonDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://host.docker.internal:3306/carbon_db?serverTimezone=UTC&useSSL=true</url>
<username>userame</username>
<password>password</password>
<driverClassName>com.mysql.cj.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<defaultAutoCommit>true</defaultAutoCommit>
</configuration>
</definition>
</datasource>
It works fine when useSSL=false. useSSL= true gives the following connection failure error:
wso2am_1 | [2019-05-06 07:37:25,095] ERROR - TransactionManager Failed to start new registry transaction.
wso2am_1 | com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
Mysql server is 8.0 and ssl variables are as:
Please try with requireSSL=true.

Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded. (Ubuntu Server)

I am deploying my ruby on rails application to DigitalOcean Ubuntu server. But I got this Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded. error.
Here is the full error:
Here is my Gemfile.lock:
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.3)
actionpack (= 4.2.3)
actionview (= 4.2.3)
activejob (= 4.2.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.3)
actionview (= 4.2.3)
activesupport (= 4.2.3)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.3)
activesupport (= 4.2.3)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.3)
activesupport (= 4.2.3)
globalid (>= 0.3.0)
activemodel (4.2.3)
activesupport (= 4.2.3)
builder (~> 3.1)
activerecord (4.2.3)
activemodel (= 4.2.3)
activesupport (= 4.2.3)
arel (~> 6.0)
activesupport (4.2.3)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.3)
autoprefixer-rails (6.0.3)
execjs
json
bcrypt (3.1.10)
better_errors (2.1.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
rack (>= 0.9.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-sass (3.3.4.1)
autoprefixer-rails (>= 5.0.0.1)
sass (>= 3.2.19)
builder (3.2.2)
byebug (6.0.2)
capistrano (3.4.0)
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
capistrano-bundler (1.1.4)
capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-rails (1.1.3)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
sshkit (~> 1.2)
capistrano3-puma (1.2.1)
capistrano (~> 3.0)
puma (>= 2.6)
choice (0.2.0)
coderay (1.1.0)
coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
colorize (0.7.7)
daemons (1.2.3)
debug_inspector (0.0.2)
devise (3.5.2)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
erubis (2.7.0)
eventmachine (1.0.8)
execjs (2.6.0)
font-awesome-rails (4.4.0.0)
railties (>= 3.2, < 5.0)
globalid (0.3.6)
activesupport (>= 4.1.0)
haml (4.0.7)
tilt
i18n (0.7.0)
jbuilder (2.3.2)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jquery-rails (4.0.5)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.5)
railties (>= 3.2.16)
json (1.8.3)
kaminari (0.16.3)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mime-types (2.6.2)
mini_portile (0.6.2)
minitest (5.8.1)
multi_json (1.11.2)
mysql2 (0.3.20)
nested_form (0.3.2)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (3.0.1)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
orm_adapter (0.5.0)
puma (2.14.0)
rack (1.6.4)
rack-pjax (0.8.0)
nokogiri (~> 1.5)
rack (~> 1.1)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.3)
actionmailer (= 4.2.3)
actionpack (= 4.2.3)
actionview (= 4.2.3)
activejob (= 4.2.3)
activemodel (= 4.2.3)
activerecord (= 4.2.3)
activesupport (= 4.2.3)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.3)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-erd (1.4.3)
activerecord (>= 3.2)
activesupport (>= 3.2)
choice (~> 0.2.0)
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.0.2)
loofah (~> 2.0)
rails_12factor (0.0.2)
rails_serve_static_assets
rails_stdout_logging
rails_admin (0.6.8)
builder (~> 3.1)
coffee-rails (~> 4.0)
font-awesome-rails (>= 3.0, < 5)
haml (~> 4.0)
jquery-rails (>= 3.0, < 5)
jquery-ui-rails (~> 5.0)
kaminari (~> 0.14)
nested_form (~> 0.3)
rack-pjax (~> 0.7)
rails (~> 4.0)
remotipart (~> 1.0)
safe_yaml (~> 1.0)
sass-rails (>= 4.0, < 6)
rails_serve_static_assets (0.0.4)
rails_stdout_logging (0.0.4)
railties (4.2.3)
actionpack (= 4.2.3)
activesupport (= 4.2.3)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rdoc (4.2.0)
json (~> 1.4)
remotipart (1.2.1)
responders (2.1.0)
railties (>= 4.2.0, < 5)
ruby-graphviz (1.2.2)
safe_yaml (1.0.4)
sass (3.4.18)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
sprockets (3.3.5)
rack (> 1, < 3)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sshkit (1.7.1)
colorize (>= 0.7.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
thin (1.6.4)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (~> 1.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.1)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
tzinfo-data (1.2015.7)
tzinfo (>= 1.0.0)
uglifier (2.7.2)
execjs (>= 0.3.0)
json (>= 1.8.0)
warden (1.2.3)
rack (>= 1.0)
web-console (2.2.1)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
PLATFORMS
x86-mingw32
DEPENDENCIES
better_errors
bootstrap-sass (~> 3.3.4.1)
byebug
capistrano
capistrano-bundler
capistrano-rails
capistrano-rvm
capistrano3-puma
coffee-rails (~> 4.1.0)
devise
execjs
jbuilder (~> 2.0)
jquery-rails
jquery-ui-rails
mysql2 (~> 0.3.18)
puma
rails (= 4.2.3)
rails-erd
rails_12factor (= 0.0.2)
rails_admin (~> 0.6.8)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
therubyracer
thin
turbolinks
tzinfo-data
uglifier (>= 1.3.0)
web-console (~> 2.0)
I have already specified gem 'mysql2', '~> 0.3.18' in my Gemfile on so I don't know what other solution that I could use to fix this.
Please help. Thanks! :)
I finally solved it.
Actually, after added gem 'mysql2', '~> 0.3.18' , I need to push it to my repository on Github first before deploying it to the server.

Rails Mysql adaptor tries to query an abstract model class which does not have a backing table

I have a model class "Abtest" that inherits from an abstract base class "ModBase" which does not have a backing table. When Abtest.new is called, I got the following error even though in ModBase class I have "self.abstract_class = true". What did I do wrong?
class ModBase < ActiveRecord::Base
self.abstract_class = true
class Abtest < ModBase
ActiveRecord::StatementInvalid (Mysql::Error: Table 'mydb.mod_bases' doesn't exist: SHOW FIELDS FROM `mod_bases`):
activerecord (3.1.0) lib/active_record/connection_adapters/mysql_adapter.rb:435:in `query'
activerecord (3.1.0) lib/active_record/connection_adapters/mysql_adapter.rb:435:in `execute'
activerecord (3.1.0) lib/active_record/connection_adapters/abstract_adapter.rb:244:in `log'
activesupport (3.1.0) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activerecord (3.1.0) lib/active_record/connection_adapters/abstract_adapter.rb:239:in `log'
activerecord (3.1.0) lib/active_record/connection_adapters/mysql_adapter.rb:435:in `execute'
activerecord (3.1.0) lib/active_record/connection_adapters/mysql_adapter.rb:636:in `columns'
activerecord (3.1.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `initialize'
activerecord (3.1.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:185:in `with_connection'
activerecord (3.1.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:92:in `initialize'
activerecord (3.1.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:112:in `call'
activerecord (3.1.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:112:in `default'
activerecord (3.1.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:112:in `[]'
activerecord (3.1.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:112:in `initialize'
activerecord (3.1.0) lib/active_record/base.rb:717:in `call'
activerecord (3.1.0) lib/active_record/base.rb:717:in `default'
activerecord (3.1.0) lib/active_record/base.rb:717:in `[]'
activerecord (3.1.0) lib/active_record/base.rb:717:in `column_defaults'
activerecord (3.1.0) lib/active_record/persistence.rb:327:in `attributes_from_column_definition'
activerecord (3.1.0) lib/active_record/locking/optimistic.rb:69:in `attributes_from_column_definition'
activerecord (3.1.0) lib/active_record/base.rb:1544:in `initialize'
app/models/abtest.rb:89:in `new'
It's a Rails bug in 3.1.0.
https://github.com/rails/rails/issues/558
I have upgraded to 3.1.11 and the error never happened again.
You haven't run your migrations. Which is what this error is all about. ActiveRecord will need a table for ModBase regardless of STI. All STI does is set the "type" column.
Since it sounds like you're trying to do a table less setup... What you might be looking for is probably found in ActiveModel. Essentially you get a lot of the AR goodness without the database requirement.
Railscast on ActiveModel

Rails 3.2 using JRuby on Solaris

Has anyone managed to get Rails 3.2 working on Solaris-10 with JRuby?
We appear to be caught in a nasty dependency vortex. Rails 3.2 requires JRuby 1.6.6 or later, according to: Using JRuby with Rails 3.2
But JRuby 1.6.5 is the last version that can successfully install gems on Solaris: http://jira.codehaus.org/browse/JRUBY-6494
Is it possible that there is a patch out there or something we haven't thought of?
We have a Rails 3.2.2 app working on Solaris. We're using JRuby 1.6.5.1 and the latest warbler, but we had to downgrade jruby-rack to 1.1.5 I believe.
What doesn't work is asset compilation, because we haven't found a working javascript runtime. Node.js doesn't support Solaris Sparc, and therubyracer had compilation issues we didn't spend too much time trying to resolve. So we currently precompile assets on local development workstations (Windows). We're not really using the asset pipeline (and I'm not convinced it was a good idea to make it the Rails default), so we may disable it so that we can run a CI build on Solaris.
Here's the gemfile.lock:
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.2)
actionpack (= 3.2.2)
mail (~> 2.4.0)
actionpack (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.1)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
activemodel (3.2.2)
activesupport (= 3.2.2)
builder (~> 3.0.0)
activerecord (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activerecord-jdbc-adapter (1.2.2)
activerecord-jdbcsqlite3-adapter (1.2.2)
activerecord-jdbc-adapter (~> 1.2.2)
jdbc-sqlite3 (~> 3.7.2)
activerecord-oracle_enhanced-adapter (1.4.1)
activeresource (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
activesupport (3.2.2)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
bouncy-castle-java (1.5.0146.1)
builder (3.0.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.2.0)
erubis (2.7.0)
execjs (1.3.0)
multi_json (~> 1.0)
hike (1.2.1)
i18n (0.6.0)
jdbc-sqlite3 (3.7.2)
journey (1.0.3)
jquery-rails (2.0.1)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
jruby-openssl (0.7.6.1)
bouncy-castle-java (>= 1.5.0146.1)
json (1.6.5)
json (1.6.5-java)
mail (2.4.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
multi_json (1.1.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.2)
actionmailer (= 3.2.2)
actionpack (= 3.2.2)
activerecord (= 3.2.2)
activeresource (= 3.2.2)
activesupport (= 3.2.2)
bundler (~> 1.0)
railties (= 3.2.2)
railties (3.2.2)
actionpack (= 3.2.2)
activesupport (= 3.2.2)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
sass (3.1.15)
sass-rails (3.2.4)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
therubyrhino (1.73.1)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.32)
uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
I'm hopeful that the JRuby team will spend some time making JRuby 1.7 work on Solaris. Otherwise we'll have to accelerate our migration to linux...