I am having issues with ImageMagick. I downloaded ImageMagick through Homebrew and for some reason the captcha appears blacked out.
This is what I am getting:
Here is the ImageMagick version I am using:
Hamels-MacBook-Air:gitreports HD$ magick -version
Version: ImageMagick 7.0.5-4 Q16 x86_64 2017-03-25 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
Also this is what I am receiving in the console:
Started GET "/issue/hd719/Bloc-Jams" for ::1 at 2017-04-25 21:02:29 -0400
Processing by RepositoriesController#repository as HTML
Parameters: {"username"=>"hd719", "repositoryname"=>"Bloc-Jams"}
User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."username" = ? LIMIT 1 [["username", "hd719"]]
Repository Load (0.3ms) SELECT "repositories".* FROM "repositories" INNER JOIN "repositories_users" ON "repositories"."id" = "repositories_users"."repository_id" WHERE "repositories_
users"."user_id" = ? AND "repositories"."name" = ? ORDER BY name ASC LIMIT 1 [["user_id", 1], ["name", "Bloc-Jams"]]
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."username" = ? LIMIT 1 [["username", "hd719"]]
CACHE (0.1ms) SELECT "repositories".* FROM "repositories" INNER JOIN "repositories_users" ON "repositories"."id" = "repositories_users"."repository_id" WHERE "repositories_users"."us
er_id" = ? AND "repositories"."name" = ? ORDER BY name ASC LIMIT 1 [["user_id", 1], ["name", "Bloc-Jams"]]
SimpleCaptcha::SimpleCaptchaData Load (0.2ms) SELECT "simple_captcha_data".* FROM "simple_captcha_data" WHERE "simple_captcha_data"."key" = ? ORDER BY "simple_captcha_data"."id" ASC
LIMIT 1 [["key", "438f5570aeba7ef4658ee2505ced9112e7221fa6"]]
(0.7ms) begin transaction
SQL (1.1ms) UPDATE "simple_captcha_data" SET "value" = ?, "updated_at" = ? WHERE "simple_captcha_data"."id" = ? [["value", "SJZSRC"], ["updated_at", "2017-04-26 01:02:29.640800"], ["
id", 1]]
(1.1ms) commit transaction
Rendered simple_captcha/_simple_captcha.erb (0.8ms)
Rendered repositories/repository.html.erb within layouts/application (42.4ms)
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
Completed 200 OK in 319ms (Views: 258.7ms | ActiveRecord: 4.9ms)
Started GET "/simple_captcha?code=438f5570aeba7ef4658ee2505ced9112e7221fa6&time=1493168549" for ::1 at 2017-04-25 21:02:30 -0400
SimpleCaptcha::SimpleCaptchaData Load (0.2ms) SELECT "simple_captcha_data".* FROM "simple_captcha_data" WHERE "simple_captcha_data"."key" = ? ORDER BY "simple_captcha_data"."id" ASC
LIMIT 1 [["key", "438f5570aeba7ef4658ee2505ced9112e7221fa6"]]
CACHE (0.0ms) SELECT "simple_captcha_data".* FROM "simple_captcha_data" WHERE "simple_captcha_data"."key" = ? ORDER BY "simple_captcha_data"."id" ASC LIMIT 1 [["key", "438f5570aeba
7ef4658ee2505ced9112e7221fa6"]]
I can also provide any other information that is requested.
-Thank you!
As I said in my comments the code posted by #emcconville worked for me on a windows PC.
It failed when using magick and as I suspected magick ( V7 ) needs the operators in a different order as it is stricter than V6. So this worked again for me on my PC:
magick -size 100x28 -background white -gravity Center -fill darkblue -pointsize 22 label:12345 -wave 2x92 -implode 0.2 "E:\Pictures\temp.jpg"
I would guess SimpleCapture is not V7 compatible; have you a V6 version you could try?
I am using a V7 version but it also has a legacy V6 version built in but might not work on a mac?
Related
I have built a webshop in Ruby on Rails using Solidus.
When I try to checkout in the PayPal sandbox with credit card or SEPA with a German address, it complains that the shop does not deliver there.
It works fine when I use PayPal payment with an account, also to a German address in Berlin...
This is the error in the ruby console:
Started GET "/solidus_paypal_commerce_platform/shipping_rates?order_id=R977809399&order_token=[FILTERED]&address%5Bcity%5D=Berlin&address%5Bstate%5D=&address%5Bcountry_code%5D=DE&address%5Bpostal_code%5D=10117" for 127.0.0.1 at 2022-09-29 20:29:49 +0200
Processing by SolidusPaypalCommercePlatform::ShippingRatesController#simulate_shipping_rates as */*
Parameters: {"order_id"=>"R977809399", "order_token"=>"[FILTERED]", "address"=>{"city"=>"Berlin", "state"=>"", "country_code"=>"DE", "postal_code"=>"10117"}}
Spree::User Load (0.1ms) SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."spree_api_key" = ? LIMIT ? [["spree_api_key", "undefined"], ["LIMIT", 1]]
Spree::Order Load (0.1ms) SELECT "spree_orders".* FROM "spree_orders" WHERE "spree_orders"."number" = ? LIMIT ? [["number", "R977809399"], ["LIMIT", 1]]
Spree::User Load (0.1ms) SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."id" = ? LIMIT ? [["id", 3], ["LIMIT", 1]]
CACHE Spree::Order Load (0.0ms) SELECT "spree_orders".* FROM "spree_orders" WHERE "spree_orders"."number" = ? LIMIT ? [["number", "R977809399"], ["LIMIT", 1]]
CACHE Spree::User Load (0.0ms) SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."id" = ? LIMIT ? [["id", 3], ["LIMIT", 1]]
TRANSACTION (0.0ms) begin transaction
Spree::Country Load (0.1ms) SELECT "spree_countries".* FROM "spree_countries" WHERE "spree_countries"."iso" = ? LIMIT ? [["iso", "DE"], ["LIMIT", 1]]
Spree::State Load (0.1ms) SELECT "spree_states".* FROM "spree_states" WHERE "spree_states"."country_id" = ? AND "spree_states"."abbr" = ? ORDER BY "spree_states"."name" ASC LIMIT ? [["country_id", 57], ["abbr", ""], ["LIMIT", 1]]
Spree::State Load (0.1ms) SELECT "spree_states".* FROM "spree_states" WHERE "spree_states"."country_id" = ? AND "spree_states"."name" = ? ORDER BY "spree_states"."name" ASC LIMIT ? [["country_id", 57], ["name", ""], ["LIMIT", 1]]
Spree::Store Load (0.0ms) SELECT "spree_stores".* FROM "spree_stores" WHERE "spree_stores"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
Spree::Order Exists? (0.1ms) SELECT 1 AS one FROM "spree_orders" WHERE "spree_orders"."number" = ? AND "spree_orders"."id" != ? LIMIT ? [["number", "R977809399"], ["id", 10], ["LIMIT", 1]]
Spree::Adjustment Load (0.0ms) SELECT "spree_adjustments".* FROM "spree_adjustments" WHERE "spree_adjustments"."order_id" = ? AND "spree_adjustments"."source_type" = ? [["order_id", 10], ["source_type", "Spree::PromotionAction"]]
Spree::LineItem Load (0.0ms) SELECT "spree_line_items".* FROM "spree_line_items" WHERE "spree_line_items"."order_id" = ? ORDER BY "spree_line_items"."created_at" ASC, "spree_line_items"."id" ASC [["order_id", 10]]
Spree::Product Load (0.0ms) SELECT "spree_products".* FROM "spree_products" INNER JOIN "spree_variants" ON "spree_products"."id" = "spree_variants"."product_id" WHERE "spree_variants"."id" = ? LIMIT ? [["id", 45], ["LIMIT", 1]]
TRANSACTION (0.0ms) rollback transaction
Completed 422 Unprocessable Entity in 35ms (Views: 0.2ms | ActiveRecord: 0.8ms | Allocations: 31326)
Would be grateful for any pointers where to adjust that,
as I cannot make head or tail of it.
I don't know why Solidus is erroring internally, but I can tell you that if the rendered PayPal button has an onShippingChange callback yet that callback does not respond with success or times out (due to some error, generally), the PayPal checkout will give that message since you're indicating the address needs to be checked during payment approval yet are not responding that it's OK when queried.
Another possible flow design -- likely not used/offered by Solidus -- is to not specify onShippingChange and to check the address after approval (but before final order capture) and provide a mechanism to patch it when it's not a valid address you'll accept.
I'm working on an app that I didn't develop, so there are many things about the architecture that are not clear, yet. My goal is just to get it up and going at this point. I'm helping an organization upgrade a Rails built on 4.2 to run on 6.0.2. I've gone to Railsdiff and other places to learn to change.
After updating and replacing gems, and making other Rails 6 changes, I was able to get the application to boot. The problem that I'm running into is a 500 Internal Server Error and it refers to ActiveRecord. The log shows that the app is arriving at the correct controller/action. It shows where I dumped a couple of records to make sure it was following the app path. It fails when it tries to render the layout and views. Examining the page shows that nothing is rendered. No HTML elements or meta data about the page is visible.
Here is a dump from my development.log file. Everything looks good until the end. If you have experienced this in the past and have suggestions, I would appreciate any suggestions.
Zeitwerk#rails.main: constant CoursesController loaded from file /home/devuser/webapps/dev/mydevdir/academy/app/controllers/courses_controller.rb
Zeitwerk#rails.main: constant CorporationsController loaded from file /home/devuser/webapps/dev/mydevdir/academy/app/controllers/corporations_controller.rb
Processing by CorporationsController#show as HTML
Zeitwerk#rails.main: constant Corporation loaded from file /home/devuser/webapps/dev/mydevdir/academy/app/models/corporation.rb
Corporation Load (1.5ms) SELECT "corporations".* FROM "corporations" WHERE "corporations"."subdomain" = $1 LIMIT $2 [["subdomain", "devdomain"], ["LIMIT", 1]]
Zeitwerk#rails.main: constant DeviseController loaded from file /usr/local/rvm/gems/ruby-2.5.1#academy/gems/devise-4.7.1/app/controllers/devise_controller.rb
Zeitwerk#rails.main: constant ImageUploader loaded from file /home/devuser/webapps/dev/mydevdir/academy/app/uploaders/image_uploader.rb
Zeitwerk#rails.main: constant Announcement loaded from file /home/devuser/webapps/dev/mydevdir/academy/app/models/announcement.rb
Corporation Load (1.7ms) SELECT "corporations".* FROM "corporations" WHERE "corporations"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
Zeitwerk#rails.main: constant PaperTrail::Version loaded from file /usr/local/rvm/gems/ruby-2.5.1#academy/gems/paper_trail-10.3.1/lib/paper_trail/frameworks/active_record/models/paper_trail/version.rb
Zeitwerk#rails.main: constant VideoUploader loaded from file /home/devuser/webapps/dev/mydevdir/academy/app/uploaders/video_uploader.rb
Zeitwerk#rails.main: constant Course loaded from file /home/devuser/webapps/dev/mydevdir/academy/app/models/course.rb
Course Load (2.5ms) SELECT "courses".* FROM "courses" WHERE "courses"."deleted_at" IS NULL AND "courses"."corporation_id" = $1 ORDER BY lower(TITLE) ASC [["corporation_id", 1]]
CourseSchedule Load (1.5ms) SELECT "course_schedules".* FROM "course_schedules" INNER JOIN "courses" ON "courses"."id" = "course_schedules"."course_id" WHERE "course_schedules"."deleted_at" IS NULL AND "courses"."corporation_id" = $1 AND 1=0 [["corporation_id", 1]]
Zeitwerk#rails.main: constant BackgroundUploader loaded from file /home/devuser/webapps/dev/mydevdir/academy/app/uploaders/background_uploader.rb
Zeitwerk#rails.main: constant Instsplash loaded from file /home/devuser/webapps/dev/mydevdir/academy/app/models/instsplash.rb
Instsplash Load (1.2ms) SELECT "instsplashes".* FROM "instsplashes" WHERE "instsplashes"."corporation_id" = $1 AND "instsplashes"."landing" = $2 ORDER BY "instsplashes"."id" ASC LIMIT $3 [["corporation_id", 1], ["landing", true], ["LIMIT", 1]]
Redirected to http://dev-account-on-ec.compute.amazonaws.com:3005/instsplashes/1
Completed 302 Found in 305ms (ActiveRecord: 50.0ms | Allocations: 139299)
Started GET "/instsplashes/1" for location at 2020-03-23 16:27:19 +0000
Zeitwerk#rails.main: constant InstsplashesController loaded from file /home/devuser/webapps/dev/mydevdir/academy/app/controllers/instsplashes_controller.rb
Processing by InstsplashesController#show as HTML
Parameters: {"id"=>"1"}
Corporation Load (1.2ms) SELECT "corporations".* FROM "corporations" WHERE "corporations"."subdomain" = $1 LIMIT $2 [["subdomain", "devdomain"], ["LIMIT", 1]]
Instsplash Load (1.2ms) SELECT "instsplashes".* FROM "instsplashes" WHERE "instsplashes"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
Corporation Load (1.2ms) SELECT "corporations".* FROM "corporations" WHERE "corporations"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
Course Load (1.3ms) SELECT "courses".* FROM "courses" WHERE "courses"."deleted_at" IS NULL AND "courses"."corporation_id" = $1 ORDER BY "courses"."title" ASC LIMIT $2 [["corporation_id", 1], ["LIMIT", 1]]
####COPORATION FOUND IN INSTSPLASHES SHOW {"id"=>1, "approved"=>nil, "request_id"=>nil, "created_at"=>Fri, 20 Mar 2020 14:06:00 UTC +00:00, "updated_at"=>Mon, 23 Mar 2020 16:24:27 UTC +00:00, "name"=>"Dev Account", "stripe_id"=>nil, "facebook"=>nil, "twitter"=>nil, "linkedin"=>nil, "google"=>nil, "support_email"=>nil, "pinterest"=>nil, "you_tube"=>nil, "instagram"=>nil, "tumblr"=>nil, "support_url"=>nil, "phone"=>nil, "badges_on"=>false, "preset_badges_on"=>true, "course_expiration"=>nil, "rev_share"=>100, "no_tax"=>nil, "discussion_on"=>nil, "rating_displayed"=>nil, "feedback_displayed"=>nil, "training_cycle_start"=>nil, "training_cycle_end"=>nil, "website"=>nil, "use_training_cycle"=>nil, "show_blog"=>nil, "allows_sign_up"=>nil, "about"=>nil, "course_approval"=>nil, "enrollment_approval"=>nil, "show_generic_troubleshoots"=>true, "po_requires_approval"=>true, "hide_cart"=>true, "saml_metadata"=>nil, "numanagesettings"=>{}, "saml_privatekey"=>nil, "saml_certificate"=>nil, "payment_gateway"=>nil, "payment_key"=>nil, "payment_secret"=>nil, "service_code"=>nil, "local_ref_pay"=>nil, "allow_instructor_ratings"=>nil, "qr_code"=>nil, "selected_home"=>"corporation", "saml_privatekey_kms_enc"=>nil, "saml_certificate_kms_enc"=>nil, "saml_metadata_kms_enc"=>nil, "course_per_cycle"=>1, "live_classroom_on"=>false, "validate_instructor_sme"=>nil, "show_course_enrollments"=>true, "show_course_modules"=>true, "twilio_service_on"=>false, "twillio_from_number"=>nil, "twillio_account_sid"=>nil, "twillio_auth_token"=>nil, "volunteer_toggle"=>false, "need_organization"=>false}
----INSTSPLASH FOUND IN INSTSPLASHES SHOW {"id"=>1, "corporation_id"=>1, "heading"=>"Page Heading", "name"=>"Page Name", "organizations_on"=>true, "show_courses"=>true, "text_color"=>"#ffffff", "button_color"=>"#543939", "background_color"=>"#ebebeb", "overlay_color"=>"#522b2b", "overlay_opacity"=>"0.45", "landing"=>true, "background_images"=>nil, "heading_size"=>20}
Rendering instsplashes/show.html.erb within layouts/splashpage
Rendered instsplashes/show.html.erb within layouts/splashpage (Duration: 84.5ms | Allocations: 78655)
Completed 500 Internal Server Error in 104ms (ActiveRecord: 4.9ms | Allocations: 83856)
I discovered my problem. It is in the asset pipeline. For some reason it is not finding the assets. I discovered this by commenting out the stylesheet_link_tag's, javascript_link_tag's, and image_tag's. The app started working. Also, there were several UI gems that I had to require in the application.rb file. I'm going to close this out since I know where the problem lies.
dp1 has three possible states true, false, and null. I would like to save dp1 as null. This is correctly done according to the logs, but it is saved as true while there is no default value in my db.
Started PATCH "/equipments/2" for 127.0.0.1 at 2018-08-01 11:49:23 +0200
Processing by EquipmentsController#update as JS
Parameters: {"utf8"=>"✓", "equipment"=>{"title"=>"TV ", "dp1"=>"nil"}, "commit"=>"Save", "id"=>"2"}
Equipment Load (0.1ms) SELECT "equipment".* FROM "equipment" WHERE "equipment"."id" = ? LIMIT ? [["id", 2], ["LIMIT", 1]]
↳ app/controllers/equipments_controller.rb:124
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 3], ["LIMIT", 1]]
↳ /Users/Mesnet/.rvm/gems/ruby-2.5.1/gems/orm_adapter-0.5.0/lib/orm_adapter/adapters/active_record.rb:17
(0.0ms) begin transaction
↳ app/controllers/equipments_controller.rb:81
Equipment Update (0.4ms) UPDATE "equipment" SET "dp1" = ?, "updated_at" = ? WHERE "equipment"."id" = ? [["dp1", 1], ["updated_at", "2018-08-01 09:49:23.413563"], ["id", 2]]
↳ app/controllers/equipments_controller.rb:81
(0.7ms) commit transaction
↳ app/controllers/equipments_controller.rb:81
Rendering equipments/js/create.js.erb
Rendered equipments/js/create.js.erb (0.4ms)
Completed 200 OK in 31ms (Views: 26.0ms | ActiveRecord: 1.5ms)
How can I force my value to be saved as null if the form is null?
Only empty strings or nil value are coerced to nil. Please check the boolean type documentation for active record.
You will have to check for 'nil' string and convert it to empty string or nil value at controller level. Something like this:
def update
.....
data = params.require(: equipment).permit(:title, :dp1).to_h
data[:dp1] = '' if data[:dp1] == 'nil'
.....
end
I am using Spree 3.0.0, Spree Print Invoice gem and I have set it up in my gemfile using the branch: '3-0-stable'.
I have installed it with the command
bundle && exec rails g spree_print_invoice:install
I have a simple config/initializers/print_invoice.rb
Spree::PrintInvoice::Config.set(page_layout: :portrait,page_size: 'A4')
Spree::PrintInvoice::Config.set(print_buttons: 'invoice')
Spree::PrintInvoice::Config.set(store_pdf: true) # Default: tmp/order_prints
I have now in my admin configuration a Print Invoice Settings section as well as a print invoice button with each orders.
Here is the log when creating invoice:
Started GET "/admin/orders/R123456789.pdf?template=invoice" for ::1 at 2015-07-22 17:10:00 -0500
Processing by Spree::Admin::OrdersController#show as PDF
Parameters: {"template"=>"invoice", "id"=>"R123456789"}
Spree::Preference Load (0.3ms) SELECT "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = $1 LIMIT 1 [["key", "spree/backend_configuration/locale"]]
Spree::User Load (0.5ms) SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."id" = $1 ORDER BY "spree_users"."id" ASC LIMIT 1 [["id", 6]]
(0.4ms) SELECT COUNT(*) FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" = $1 AND "spree_roles"."name" = $2 [["user_id", 6], ["name", "admin"]]
Spree::Order Load (0.6ms) SELECT "spree_orders".* FROM "spree_orders" WHERE "spree_orders"."number" = $1 ORDER BY "spree_orders"."id" ASC LIMIT 1 [["number", "R123456789"]]
Spree::Adjustment Load (0.5ms) SELECT "spree_adjustments".* FROM "spree_adjustments" WHERE "spree_adjustments"."adjustable_type" = 'Spree::Order' AND "spree_adjustments"."adjustable_id" IN (1) ORDER BY spree_adjustments.created_at ASC
Rendered text template (0.0ms)
Sent data (2.7ms)
Completed 200 OK in 18ms (Views: 2.5ms | ActiveRecord: 2.3ms)
The invoices are created into tmp/order_prints but they all are completely blanks. The pdf viewer of my browser is blocked on loading.
Anything I need to do in order to make it work?
I have a table subscription with a column status. In my subscriptions controller I have a method accept_player that is supposed to update the subscription.status to "confirmed!"
def accept_player
#subscription = Subscription.find(params[:subscription_id_accept_player])
#subscription.status = "confirmed!"
#subscription.save
authorize #subscription
redirect_to tournament_subscriptions_path(#subscription.tournament)
end
unfortunately every time I try to trigger that method, a rollback seem to take place:
Started POST "/accept_player/39" for ::1 at 2015-07-08 22:01:21 +0100
ActiveRecord::SchemaMigration Load (12.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
/Users/davidgeismar/code/davidgeismar/tennis-match/app/controllers/subscriptions_controller.rb:141: warning: duplicated key at line 155 ignored: "CardType"
Processing by SubscriptionsController#accept_player as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"aas8OPHBpvPwNbbmx/SVipsRM+eKo63nuVilMroxKcU9HRVonjSqEuH7aLY91gFi9PHMUsUqRqk7qhnv2m4L/A==", "subscription_id_accept_player"=>"39", "commit"=>"Confirmer ce Joueur", "subscription_id"=>"39"}
User Load (13.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 2]]
Subscription Load (11.6ms) SELECT "subscriptions".* FROM "subscriptions" WHERE "subscriptions"."id" = $1 LIMIT 1 [["id", 39]]
(5.7ms) BEGIN
Subscription Exists (0.8ms) SELECT 1 AS one FROM "subscriptions" WHERE ("subscriptions"."user_id" = 20 AND "subscriptions"."id" != 39 AND "subscriptions"."tournament_id" = 9) LIMIT 1
(12.6ms) ROLLBACK
Tournament Load (2.4ms) SELECT "tournaments".* FROM "tournaments" WHERE "tournaments"."id" = $1 LIMIT 1 [["id", 9]]
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 2]]
Redirected to http://localhost:3000/tournaments/9/subscriptions
Completed 302 Found in 246ms (ActiveRecord: 79.7ms)
Any ideas about what might be going wrong here ?
This code:
authorize #subscription
is probably causing the rollback. If you're in dev mode, just comment it out, reload!, and try to manually add a record and see if that's the cause.