Ruby gem origami sign signature failed - ruby-on-rails

I'm trying to make the PDF file with signature with origami gem, follow this example https://github.com/gdelugre/origami/blob/master/examples/signature/signature.rb
Now i just run this signature.rb and got error
[error] Breaking on: ">>\nendobj\n..." at offset 0x1f6f3
[error] Last exception: [Origami::InvalidObjectError] Failed to parse object (no:43,gen:0) -> [ArgumentError] wrong number of arguments (given 1, expected 0; required keyword: year)
I have no idea to move forward :'<
I also found the sign method of gem at https://github.com/gdelugre/origami/blob/master/lib/origami/signature.rb, and have take a look, I can't find any specific things to do :'<
Might this example is outdate?

The error message is known see https://github.com/gdelugre/origami/issues/80
A fix should be available https://github.com/gdelugre/origami/pull/74/commits
But has not been added so use newer file from the fork https://github.com/pocke/origami/tree/fix-ruby-2.7-kwargs-warnings
Specifically you need this updated file and may need to follow any other suggestions from above.
https://github.com/pocke/origami/raw/fix-ruby-2.7-kwargs-warnings/lib/origami/filters/predictors.rb
However it always worth looking for a fork with many more recent improvements such as
https://github.com/joelsondrew/origami

Related

CableReady (Rails) Basic case giving mystifying error message

cable_ready 4.5.0
rails 6.1.4.1
ruby 3.0.2p107
This is a simple example from the basic tutorial (https://www.youtube.com/watch?v=F5hA79vKE_E) I suspect the error I am getting is because either cable_ready or rails evolved a little and created a tiny incompatibility.
I get this error in the JS console:
It is triggered when in my controller I ask cable ready to:
cable_ready["timeline"].console_log(message: "***** cable ready post created")
Which leads to my timeline_channel to:
received(data) {
console.log("******** Received data:", data.operations)
if (data.cableReady) CableReady.perform(data.operations)
}
My interpretation is perform causes this line in cable_ready.js line 13:
operations.forEach(function (operation) {
if (!!operation.batch) batches[operation.batch] = batches[operation.batch] ? ++batches[operation.batch] : 1;
});
Is finding something in the received data that it doesn't like.
That's where my trail ends. Can someone see what I am doing wrong, or tell me what other code you'd like me to include?
Solution: downgrade the version of the cable_ready javascript library.
I previously (maybe a year ago) did this tutorial using CableReady 4.5, Ruby 2.6.5 and Rails 6.0.4 and it worked like a charm back then as well as today.
But today, I tried this tutorial again on a duplicate project--same versions of CR, Ruby, and Rails and now I get java console errors similar to yours.
TypeError: undefined is not a function (near '...operations.forEach...')
perform -- cable_ready.js:13
received -- progress_bar_channel.js:8
I looked at the output of yarn list and saw that cable_ready was version 5.0.0-pre8 on the bad project and it was 5.0.0-pre1 on the good project. The downgrade could be accomplished with yarn add cable_ready#^5.0.0-pre1 in the bad project folder and now both projects work.
FYI for other newbies like me trying to understand how CableReady works: This tutorial gives another example of CableReady, and was also fixed the same way.

xlwings(0.7.0) importing UDF error

Hello,
My problem is that when i try to import an UDF in Ecxel 2013 I receive the error message can be seen on the picture. I have installed xlwings and it works except the UDF importing. Note that i used "xlwings quickstart myproject" so there is no problem with the file names and i also used the sample function so that should be fine as well
Thank you in advance for your help!
I currently don't understand why you get that error, but I should be able to tell you how you can work around it for now:
Open the file udfs.py in the xlwings package and remove the last argument on line 36, i.e. remove , ArgumentDescriptions=argdocs.
The intended functionality of that line (showing function argument description) is currently broken anyway (see here) so hopefully this will be resolved in a future version.

Problems with using clj-oauth

I'm developing Twitter sign in for my platform. I want to use for this purpose clj-oauth library (https://github.com/mattrepl/clj-oauth). I added [clj-oauth "1.5.2"] to my project.clj and created seperate file oauth.clj for testing purposes with only this code:
(ns greenius.service.oauth
(:require
['oauth.client :as 'oauth]))
When I try compile oauth.clj I get error:
ClassCastException clojure.lang.PersistentList cannot be cast to clojure.lang.Named clojure.core/name (core.clj:1518)
I have an impression that I follow the guide in every bit. What could be the cause of that error?
Remove the ' because you are using the require from inside the ns macro, so the names have to be symbols.
Example from the ns documentation:
(ns foo.bar
(:refer-clojure :exclude [ancestors printf])
(:require (clojure.contrib sql combinatorics))
(:use (my.lib this that))
(:import (java.util Date Timer Random)
(java.sql Connection Statement)))
I managed to fix the problem.
First I followed th esuggestion given by #Razvanescu and changed ['oauth.client :as 'oauth] into [oauth.client :as oauth].
After that I was getting new error:
FileNotFoundException Could not locate oauth/client__init.class or oauth/client.clj on classpath: clojure.lang.RT.load (RT.java:443).
When I reran my IDE it changed into CompilerException java.lang.ClassNotFoundException: org.apache.http.conn.ssl.SSLContexts, compiling:(clj_http/conn_mgr.clj:1:1)
Googling that error led me to this: https://github.com/cemerick/friend/issues/128.
I was using friend 0.2.0 and clj-oauth uses clj-http so it applied to my problem. After I upgraded to [com.cemerick/friend "0.2.2-SNAPSHOT"] and reran my IDE the problem was gone and it works now.
Sad thing is that I realized just now that twitter grants info only about username, which in my case is practically useless for sign up...

HDF5 example not working

I tried building the first example here and got errors. Right on the first line there's a missing include statement, but I managed to figure out it should be
#include "hdf5.h"
But even after fixing that I got more errors:
$ h5cc ./example1.c
./example1.c: In function ‘main’:
./example1.c:66:4: error: too few arguments to function ‘H5Dcreate2’
In file included from /usr/include/hdf5.h:27:0,
from ./example1.c:6:
/usr/include/H5Dpublic.h:104:14: note: declared here
Any idea how to solve it?
The example code was written for release 1.6 of hdf5, and as such will simply not compile on a 1.8 release without modification.
If you want to get the code to work on 1.8, you need to enable 1.6 compatibility, which means passing in the flag:
-DH5_USE_16_API
to the h5cc command line like:
h5cc -DH5_USE_16_API ./example1.c
and it should compile correctly; otherwise you will have to rewrite the code to make use of the 1.8 API.

XML parsing in Ruby

I am using a REXML Ruby parser to parse an XML file. But on a 64 bit AIX box with 64 bit Ruby, I am getting the following error:
REXML::ParseException: #<REXML::ParseException: #<RegexpError: Stack overflow in
regexp matcher:
/^<((?>(?:[\w:][\-\w\d.]*:)?[\w:][\-\w\d.]*))\s*((?>\s+(?:[\w:][\-\w\d.]*:)?[\w:][\-\w\d.]*\s*=\s*(["']).*?\3)*)\s*(\/)?>/mu>
The call for the same is something like this:
REXML::Document.new(File.open(actual_file_name, "r"))
Does anyone have an idea regarding how to solve this issue?
I've had several issues for REXML, it doesn't seem to be the most mature library. Usually I use Nokogiri for Ruby XML parsing stuff, it should be faster and more stable than REXML. After installing it with sudo gem install nokogiri, you can use something like this to get a DOM instance:
doc = Nokogiri.XML(File.open(actual_file_name, 'rb'))
# => #<Nokogiri::XML::Document:0xf1de34 name="document" [...] >
The documentation on the official webpage is also much better than that of REXML, IMHO.
I almost immediately found the answer.
The first thing I did was to search in the ruby source code for the error being thrown.
I found that regex.h was responsible for this.
In regex.h, the code flow is something like this:
/* Maximum number of duplicates an interval can allow. */
#ifndef RE_DUP_MAX
#define RE_DUP_MAX ((1 << 15) - 1)
#endif
Now the problem here is RE_DUP_MAX. On AIX box, the same constant has been defined somewhere in /usr/include.
I searched for it and found in
/usr/include/NLregexp.h
/usr/include/sys/limits.h
/usr/include/unistd.h
I am not sure which of the three is being used(most probably NLregexp.h).
In these headers, the value of RE_DUP_MAX has been set to 255! So there is a cap placed on the number of repetitions of a regex!
In short, the reason is the compilation taking the system defined value than that we define in regex.h!
This also answers my question which i had asked recently:
Regex limit in ruby 64 bit aix compilation
I was not able to answer it immediately as i need to have min of 100 reputation :D :D
Cheers!

Resources