I am using Phantomjs to generate pdf from web page.
Using following command to generate pdf:
`phantomjs rasterize.js http://www.myurl.com?q=123&&selected_opts%5B%5D=fs&selected_opts%5B%5D=disc form1.pdf`
where, selected_opts is array type
It is giving me error - form1.pdf: not found or selected_opts%5B%5D=fs: not found
If I remove querystring from url then it generate pdf, any idea how to run phantomjs having url with querystring.
You need to protect all & chars with a backslash :
phantomjs rasterize.js http://www.myurl.com?q=123\&s=foo form1.pdf
Ampersand is annoying in console so you need to protect it like above. In a ruby script you need to protect backslash that protect & :
`phantomjs rasterize.js http://www.myurl.com?q=123\\&s=foo form1.pdf`
example :
`phantomjs rasterize.js https://www.google.fr/search?q=rasterize.js+special+char\\&oq=rasterize.js google1.pdf`
Related
I was trying to read a .txt file using lua in command prompt, I'm using 'Lua For Windows' but in the way I tried it's not working, it don't give me any error, it don't return anything, not even 'nil'.
I tried this:
file = io.open("C:\Users\user\Desktop\a.txt", "r") --(and my user's name)
io.input(file)
print(io.read())
io.close(file)
The backslash is an escape character in Lua quoted strings.
Try "C:\\Users\\user\\Desktop\\a.txt".
Or avoid the issue using long strings: [[C:\Users\user\Desktop\a.txt]].
I'm having issues sending output containing Unicode box-drawing characters to a text file.
The string ┌───top───┐ prints to the terminal fine using the print command. It also renders properly if I open and write directly to a file in my code.
However, if I pipe the terminal output into a text file using
<run command> > out.txt, I get the result
ΓöîΓöÇΓöÇΓöÇtopΓöÇΓöÇΓöÇΓöÉ
Everything else prints fine, but why doesn't it handle certain Unicode characters?
Is there a quick fix for this?
I have generated an owl file using this generator http://swat.cse.lehigh.edu/projects/lubm/
I want to transform the file in N-triples and have done it before using
$ riot -out N-TRIPLE ~/lubm20/*.owl > lubm20.nt
for some reason now I get an empty file (lubm20.nt)
and when I use
$ rdfcat -out N-TRIPLE ~/lubm20/*.owl > lubm20.nt
I get this error
Exception in thread "main" org.apache.jena.riot.RiotException: <file:///root/lubm20/classes\University0_0.owl> Code: 4/UNWISE_CHARACTER in PATH: The character matches no grammar rules of URIs/IRIs. These characters are permitted in RDF URI References, XML system identifiers, and XML Schema anyURIs.
at org.apache.jena.riot.s5ystem.IRIResolver.exceptions(IRIResolver.java:371)
at org.apache.jena.riot.system.IRIResolver.resolve(IRIResolver.java:328)
at org.apache.jena.riot.system.IRIResolver$IRIResolverSync.resolve(IRIResolver.java:489)
at org.apache.jena.riot.system.IRIResolver.resolveIRI(IRIResolver.java:254)
at org.apache.jena.riot.system.IRIResolver.resolveString(IRIResolver.java:233)
at org.apache.jena.riot.SysRIOT.chooseBaseIRI(SysRIOT.java:109)
at org.apache.jena.riot.adapters.AdapterFileManager.readModelWorker(AdapterFileManager.java:286)
at org.apache.jena.util.FileManager.readModel(FileManager.java:341)
at jena.rdfcat.readInput(rdfcat.java:328)
at jena.rdfcat$ReadAction.run(rdfcat.java:473)
at jena.rdfcat.go(rdfcat.java:231)
at jena.rdfcat.main(rdfcat.java:206)
The generator would generate a well known semantic web benchmark dataset so how can it have
UNWISE_CHARACTER s?
edit:
for the question asked
I used this line to generate the *.owl files
java edu.lehigh.swat.bench.uba.Generator -onto http://swat.cse.lehigh.edu/onto/univ-bench.owl univ 20
then moved the *.owl files to lubm20 folder
I used rdf2rdf instead of jena
java -jar rdf2rdf-1.0.1-2.3.1.jar /lubmData/lubm100/*.owl lubm100.nt
worked like a charm
enter link description here
In my console (XP), the following line echo "áéíóú" in a utf-8 encoded file prints this:
├í├®├¡├│├║
Im not sure if this is something i have to handle in nim.
I am not sure if it works on Windows XP, but if you have Windows 8.1 your Nim code should be fine provided that in your console you change code page to UTF-8 with the following command:
chcp 65001
You need Lucida Console font too.
Keep in mind that in the Output window of Aporia editor you don't need to change anything in order to see the correct characters.
I have created an update script in hook_update_N where I have to create relative urls from absolute url.
For eg :
relative url = /files/test1.jpg
absolute url should be http://localhost.mysite/files/test1.jpg
I know these possible solutions,
file_create_url()
url()
$_SERVER['host'], $_SERVER['server_name']
But none of them is working in the update script.
Possible Reason : Script isn't executed from browser. So there isn't request from which you can resolve server name etc.
The above solutions work fine if I run the script from browser instead of terminal.
Is there any other way we can create absolute urls in hook_update_N so that it works when I run the script from terminal?
Try to use global $base_url and add to it your relative url
global $base_url;
$full_url = $base_url . $relative_url