Getting error when using function tcpdf - tcpdf

i created following code but i get error "TCPDF ERROR: Error in 1D barcode string", what is wrong with this code?
$pdf->write1DBarcode(cooode($balance), 'C128C', '', '', '', 18, 0.4, $style, 'N');
code works fine when i add it in example here
$pdf->Cell(35,0,cooode($balance),0,0,'L',0); # eräpäivä

The most likely reason why you are getting this error is that the value being passed as the first parameter, ie. the result of cooode($balance) is not in a valid format according to the rules for the C128C encoding.

Related

Brakeman error parse error on value ')' as a result of updated syntax

I have recently installed brakeman and ran the gem on my system. One error it is picking up is in relation to what I believe is a parenthesis.
The line of code it is picking an error up on is:
%p=link_to("Click here", url_for(only_path: false, host: ConfigSetting.get("FORGET_PASSWORD_HOST_PREFIX","localhost"), account_new_passwd_reset_path(key: #guid)))
I have recently updated syntax which required an extra parenthesis after the 'account_new_passwd_path'. I believe this is the issue but I cannot understand why.
The outdated code I had was:
%p=link_to("Click here", url_for(:only_path=>false, :host=>ConfigSetting.get("FORGET_PASSWORD_HOST_PREFIX","localhost"), :controller=>:account, :action=>:new_passwd_reset, :key=>#guid))
As you can see in terms of the routing it is the biggest change around the key #guid area.
Any ideas?
The error I am receiving is 'Error: app/views/passwd_reset_mailer/password_reset.haml:3 :: parse error on value ")" (tRPAREN) Could not parse app/views/passwd_reset_mailer/password_reset.haml'
The problem is the order of arguments. Keyword arguments need to be at the end of the argument list. But then there is another issue that using a url helper together with url_for doesn't really makes sense.
Just change:
%p=link_to(
"Click here",
url_for(
only_path: false,
host: ConfigSetting.get("FORGET_PASSWORD_HOST_PREFIX","localhost"),
account_new_passwd_reset_path(key: #guid)
)
)
to
%p=link_to(
"Click here",
account_new_passwd_reset_url(
host: ConfigSetting.get("FORGET_PASSWORD_HOST_PREFIX","localhost"),
key: #guid
)
)
Please note the _url instead of the _path suffix, which test Rails to build a full URL including the hostname.

How to get more information for an error generated in libcontainer/rootfs_linux.go?

Code used from github: https://github.com/opencontainers/runc/blob/master/libcontainer/rootfs_linux.go#L59
This is the if block to debug for our interest....
if err := mountToRootfs(m, config.Rootfs, config.MountLabel, hasCgroupns); err != nil {
return newSystemErrorWithCausef(err, "mounting %q to rootfs at %q", m.Source, m.Destination)
}
Here in the if condition, there is an error generated thru newSystemErrorWithCausef function and which internally uses generic_error.go, fmt.Sprintf to format the error string.
In our integration, only once it hit this if block. And in the process of getting more details, I wanted to troubleshoot and understand why this happened.
As of now tried using fmt.Printf(........) in line 55 and also just before if block of line 59.
And also tried putting above statement in very first line of prepareRootfs function. And then tried newSystemErrorWithCause(err, "some other message") in the first line of prepareRootfs function. Overall I dont see any information generated with my messages.
Please provide any information to understand more of this issue. Please note I am not looking for why this error might have been caused. I am looking for how to get more information from that function of prepareRootfs.

How to fix an 'Invalid tag name' in WSDL request using Zeep?

When trying to access a WSDL service, I get the following error:
ValueError: Invalid tag name 'Foo\\Bar\\Baz\\Etc\\V3Port'
The port which is provided through the WSDL-link actually has single backslashes: 'Foo\Bar\Baz\Etc\V3Port'
The ValueError gets raised when zeep calls the apihelpers.pxi method in the lxml library.
Any idea how I can fix this?
(BTW: the script worked fine when I used it 2 months ago. The WSDL-link hasn't changed)
I have found a solution
Before, it was sufficient to do:
from zeep import Client
Now, apparently, I need to explicitly add:
from lxml import etree
Everything works as before now.
Zeep does not like like "/" in values also. It gives invalid tag name error any time it finds any character in value that it does not like. For all such errors, you need to modify as_qname function in utils.py located in root folder of zeep library.
In my case, it was complaining for "/" in value, which is a valid value. I had to add below line to as_qname function.
value = value.replace("/", "-")
Below are first few lines of as_qname after modification
def as_qname(value: str, nsmap, target_namespace=None) -> etree.QName:
"""Convert the given value to a QName"""
value = value.strip() # some xsd's contain leading/trailing spaces
value = value.replace("/", "-") # Added by me.
if ":" in value:
prefix, local = value.split(":")

Error when converting form Python 2. to Python 3

can you help me to convert this to python 3.5 ? I tried but it don't work. I did the following steps:
I change the package md5 to hashlib
I change all the id = md5.new("%s"%str(clf.get_params())).hexdigest() to id = hashlib.md5(("%s"%str(clf.get_params())).encode('utf-8') ).hexdigest()
but I still have somme problems when I put a directory to these parameters
save_preds="",
save_params=""
save_test_only=""
clf_name="XX"
I have the folowing error when I put something in thise parameters:
TypeError: a bytes-like object is required, not 'str'
Please see the code here:
blend_proba.py
Thanks,
cdk
Replacing
clf_name="XX"
by
clf_name=b"XX"
would convert the strings into objects of type bytes. Whether those changes will be enough, I honestly have no idea.

Double closure fails in GSP

In a GSP file I write something like this:
${tgs.singleGameSheets.find{it.matchnumber==1}.awayPlayer.fullname()}
But I receive the following error:
org.codehaus.groovy.control.MultipleCompilationErrorsException:
startup failed:
C__STS_Projekte_TischtennisManager_grails_app_views_league__showGameSheet_gsp:
49:expecting '}', found ')' # line 49, column 134.
heets.find{it.matchnumber==1 })
The problem seems to be the double closure as I've found a bug report here.
Unfortunately the solution from the bugreport with the %= and % at the beginning and the end of the tag is not working for me.
Are there any other workarounds or solutions for this double closure problem?
I'm using Grails 1.3.7.
You may have to split this up in to two lines.
Try assigning the find results to a separate var first
<% def r = tgs.singleGameSheets.find{it.matchnumber==1} %>
${r*.awayPlayer.fullname()}
I would recommend firstly to do this sort of data processing in the controller and hand data that is as well prepared as possible down to the view.
If you are unable to do that, I would recommend trying to use parenthesis:
${tgs.singleGameSheets.find{it.matchnumber==1}.awayPlayer.fullname()}
becomes
${(tgs.singleGameSheets.find{it.matchnumber==1}.awayPlayer.fullname())}
That has worked for me on past occasions where I had to do ${(someCollection.findAll { someClause })}

Resources