How do you resolve 'Font was not found' error in visualWorks 8.1? - pdf

I have been using the report4pdf(bob nemec) package to generate reports as PDFs. Everything goes well except when I am trying to have some nice cell padding on the right.Thought an update would fix that.
So I connected to the public repository and updated the following:
Report4PDF 1.4.0.1
(comments said this was made to match with PDF Development 1.4.3.0 and Font Development 1.3.3.2. So updated those too).
However when I update and run the code it says,' Font not Found'.
Sure enough, when I run the debugger and 'inspect' on the self loadedFonts part from the debugger:
^self loadedFonts at: aSymbolOrFilenameString ifAbsent: [
FontNotFound raiseSignal: aSymbolOrFilenameString , ' was not found']
where: A symbolOrFilenameString= #'Helvetica-Bold'
As I opened the dictionary object, the font was there. Its just that the key didn't match. I am guessing the update changed all the keys except this one.
Anyway I hope you guys can help me out.
Thanks in Advance!
UPDATE 1:
Hi Bob! So I ran the ifNil block on the loadedFonts. But I hit a new error. It says: OrderedCollection(Collection)>>notFoundError.
So its trying to get something from
Graphic.Fonts.OpenType.CmapSubtable class>>classFor::`
The code being:
classFor: formatInteger
^self allSubclasses detect: [:sc | sc subclasses isEmpty and: [ sc formatNumber = formatInteger]]
=======
where formatInteger is 4.

Font class>>loadedFonts changed in the latest 'Fonts Basics' package, and Report4PDF was changed to use the new names. However, the LoadedFonts class variable in Graphics.Fonts.Font is initialized on the first reference. To get the new list, after loading the latest code, you need to run the ifNil: [] block in Font class>>loadedFonts.
In my image, with the latest code loaded, #'Helvetica-Bold' is defined in LoadedFonts.

Related

Issues pulling change log using python

I am trying to query and pull changelog details using python.
The below code returns the list of issues in the project.
issued = jira.search_issues('project= proj_a', maxResults=5)
for issue in issued:
print(issue)
I am trying to pass values obtained in the issue above
issues = jira.issue(issue,expand='changelog')
changelog = issues.changelog
projects = jira.project(project)
I get the below error on trying the above:
JIRAError: JiraError HTTP 404 url: https://abc.atlassian.net/rest/api/2/issue/issue?expand=changelog
text: Issue does not exist or you do not have permission to see it.
Could anyone advise as to where am I going wrong or what permissions do I need.
Please note, if I pass a specific issue_id in the above code it works just fine but I am trying to pass a list of issue_id
You can already receive all the changelog data in the search_issues() method so you don't have to get the changelog by iterating over each issue and making another API call for each issue. Check out the code below for examples on how to work with the changelog.
issues = jira.search_issues('project= proj_a', maxResults=5, expand='changelog')
for issue in issues:
print(f"Changes from issue: {issue.key} {issue.fields.summary}")
print(f"Number of Changelog entries found: {issue.changelog.total}") # number of changelog entries (careful, each entry can have multiple field changes)
for history in issue.changelog.histories:
print(f"Author: {history.author}") # person who did the change
print(f"Timestamp: {history.created}") # when did the change happen?
print("\nListing all items that changed:")
for item in history.items:
print(f"Field name: {item.field}") # field to which the change happened
print(f"Changed to: {item.toString}") # new value, item.to might be better in some cases depending on your needs.
print(f"Changed from: {item.fromString}") # old value, item.from might be better in some cases depending on your needs.
print()
print()
Just to explain what you did wrong before when iterating over each issue: you have to use the issue.key, not the issue-resource itself. When you simply pass the issue, it won't be handled correctly as a parameter in jira.issue(). Instead, pass issue.key:
for issue in issues:
print(issue.key)
myIssue = jira.issue(issue.key, expand='changelog')

Save an image present in PDF on local File System

This is my first experience of using PDFBox jar files. Also, I have recently started working on TestComplete. In short, all these things are new for me and I have been stuck on one issue for last few hours. I will try to explain as much as I can. Would really appreciate any help!
Objective:
To save an image present in a PDF file on the file system
Issue:
When this line gets executed objImage.write2file_2(strSavePath);, I get the error Object doesn't support this property or method.
I am taking some help from here
Code:
function fn_PDFImage()
{
var objPdfFile, strPdfFilePath, strSavePath, objPages, objPage, objImages, objImage, imgbuffer;
strPdfFilePath = "C:\\Users\\aabb\\Desktop\\name.pdf";
strSavePath = "C:\\Users\\aabb\\Desktop\\abc";
objPdfFile = JavaClasses.org_apache_pdfbox_pdmodel.PDDocument.load_3(strPdfFilePath);
objPages = objPdfFile.getDocumentCatalog().getAllPages();
//getting a page with index=1
objPage = objPages.get(1)
objImages = objPage.getResources().getXObjects().values().toArray();
Log.Message(objImages.length); //This is returning 14. i.e, 14 images
//getting an image with index=1
objImage = objImages.items(1);
Log.Message(typeof objImage); //returns "Object" which means it is not null
//saving the image
objImage.write2file_2(strSavePath); //<---GETTING AN ERROR HERE
}
ERROR:
If you are bothered about the method namewrite2file_2, please read this excerpt from the link which I have shared:
In Java, the constructor of a class has the name of this class.
TestComplete changes the constructor names to newInstance(). If a
class has overloaded constructors, TestComplete names them like
newInstance, newInstace_2, newInstance_3 and so on.
Additional Info:
I have imported Jar file(pdfbox-app-1.8.13.jar) and their classes in testcomplete. I am not sure if I need to import some other jar file or its class here:
XObjects are not always image XObjects. And write2file is in the class PDXObjectImage so you need to check your object type first.
Re the second question asked in the comment: the form XObject isn't something you can save. XObject forms are content streams with resources etc, similar to pages. However what you can do is to explore these too whether the resources have images. See how this is done in the ExtractImages source code of PDFBox 1.8.
However there are other places where there can be images (e.g. patterns, soft masks, inline images); this is only available in PDFBox 2.*, see the ExtractImages source code there. (Note that the class names are different).

Why I get the error: "Attempted to unrender a fragment that was not rendered" when migrating from ractive.js 0.3.9 to 0.5.5

I have a long, complex and a little dirty set of templates that works OK in 0.3.9 but not in 0.5.5 where I get the error: "Attempted to unrender a fragment that was not rendered".
My template is very complex but I could reproduce a slice that works in 0.3.9 but not in 0.5.5.
This is how it works OK in 0.3.9: http://jsfiddle.net/Katio/ujx2e/
This template in 0.5.5 shows the mentioned error: http://jsfiddle.net/Katio/W3Lus/
Attempted to unrender a fragment that was not rendered
Edit 1:
Thaylon has opened an issue in Ractive project on Github:
https://github.com/ractivejs/ractive/issues/1003
I must admit I'm not sure what the root of the problem is.
Yet, change the beginning of line 33 in your template from:
{{^.responsable}}<span class="redOutline" data-validationmess="Solicitud ({{num+1}}) '{{../../nombreSubdata.values[0]}}', sección '{{nombre.values[0]}}', responsable no asignado.">(responsable no asignado)</span>{{/.responsable}}
to:
{{^responsable}}<span class="redOutline" data-validationmess="Solicitud ({{num+1}}) '{{../../nombreSubdata.values[0]}}', sección '{{nombre.values[0]}}', responsable no asignado.">(responsable no asignado)</span>{{/responsable}}
and it will render.
http://jsfiddle.net/W3Lus/2/
Edit
A pretty minimal example that exhibits the error is: http://jsfiddle.net/W3Lus/9/
Removing any part, even the static <option>, it will render.
Doesnt look like you're doing anything wrong, seems to be a bug.
Edit
I assume binding the select value to {{.responsable}}, when it does not resolve to anything, causes this, as long as there is any option in the select that actually would be bound to the non-existing value.
Edit
Minimal examples with different buggy results:
http://jsfiddle.net/W3Lus/13/
http://jsfiddle.net/W3Lus/12/
One wont render at all, the other wont render a part that it should.

Elm Graphics.Input

I'm trying to run the Elm input examples from this page. Specifically, the Text Field example, and I'm getting an error saying that the Graphics.Input module is missing.
I've got this in a file called Main.elm:
import Graphics.Input as Input
main = let (field, state) = Input.field "Type here!"
in lift2 display field state
display field state =
field `above` asText state
If I run elm-server and navigate to localhost:8000, I get the error
Your browser may not be supported. Are you using a modern browser?
Runtime Error in Main module:
Error: Module 'Graphics.Input' is missing. Compile with --make flag or load missing module in a separate JavaScript file.
The problem may stem from an improper usage of:
Input.field, above
Compiling the project with elm --make Main.elm gives me
elm: Graphics/Input.elm: openFile: does not exist (No such file or directory)
Is there something extra I need to do to install the Graphic.Input?
Additional Notes:
I'm running this on a Debian machine, and installed it using cabal install elm fairly recently (Jun 15 2013). The current version is labeled Elm-0.7.1.1.
If I hop into the chromium JS prompt and poke around, it turns out there's no Elm.Graphics.Input module, but there is an Elm.Input. There isn't a function called field, there's a similar looking one called textField, but it isn't trivially interchangeable.
Running this:
import Input
main = let (field, state) = textField "Type here!"
in lift2 display field state
display field state =
field `above` asText state
gives me the error
Your browser may not be supported. Are you using a modern browser?
Runtime Error in Main module:
TypeError: a is undefined
The problem may stem from an improper usage of:
above
The Graphics.Input package is new in version 0.8. So, since you're running version 0.7, that explains your problem.
0.8 was released somewhat recently, but it's definitely been out longer than June 15th, so you probably just forgot to cabal update before installing it. Running cabal update now and then updating elm to 0.8 should fix your issue.

extra-paths not added to python path with zc.recipe.testrunner

I am trying to run tests by adding a version of tornado downloaded from github.com in the sys.path.
[tests]
recipe = zc.recipe.testrunner
extra-paths = ${buildout:directory}/parts/tornado/
defaults = ['--auto-color', '--auto-progress', '-v']
But when I run bin/tests I get the following error :
ImportError: No module named tornado
Am I not understanding how to use extra-paths ?
Martin
Have you tried looking into generated bin/tests script if it contains your path? It will tell definitely if your buildout.cfg is correct or not. Maybe problem is elsewhere. Because it seem that your code is ok.
If you happen to regularly include various branches from git/mercurial or elsewhere to buildout, you might be interested in mr.developer. mr.developer can download and add package to develop =. You wont need to set extra-path in every section.