I want to extract following string
"clang version 10.0.0 (https://github.com/llvm/llvm-project.git aa71c977ba9828496270f53edd66665c8244f679)"
from
!llvm.ident = !{!6}
!6 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git aa71c977ba9828496270f53edd66665c8244f679)"}
I tried
NamedMDNode *NM2 = M.getNamedMetadata("llvm.ident");
NM2->dump()
but not sure how to get the information in string format.
Related
I'm trying to read a pdf file into structured pdfminer elements, I'm using this code but it won't go through as 'get_pages', doc.set_parser(parser) and doc.initialize('') aren't recognizable (I've imported all possible elements from pdfminer library and I'm using python 3.8 -Spyder).
fp = open(r"C:\Users\My files\Python\myfile.pdf", 'rb')
parser = PDFParser(fp)
doc = PDFDocument(parser)
doc.set_parser(parser) # Not compatible with current version of PDFMiner
doc.initialize('') # Not compatible with current version of PDFMiner
parser.set_document(doc)
rsrcmgr = PDFResourceManager()
laparams = LAParams()
device = PDFPageAggregator(rsrcmgr, laparams=laparams)
interpreter = PDFPageInterpreter(rsrcmgr, device)
# Process each page contained in the document.
for page in doc.get_pages(): #'PDFDocument' object has no attribute 'get_pages'
interpreter.process_page(page)
layout = device.get_result()
for lt_obj in layout:
if isinstance(lt_obj, LTTextBox) or isinstance(lt_obj, LTTextLine):
print(lt_obj.get_text())
fp.close()
Compiling with Emscripten seems really easy with typical configure, make and make install workflows.
I would like to compile Autotrace (which uses this workflow), but it requires GLib.
In the Emscripten doc, it is mentioned that in such case GLib must be compiled with Emscripten. However GLib uses meson and ninja as compile tools.
Is it possible to compile GLib with Emscripten? (and will it be enough to get Autotrace working in a browser?)
Meson supports cross-compiling, so you can treat Emscripten as a cross compiler by writing a 'cross file':
emscripten.txt
[binaries]
c = '/opt/emsdk-portable/emscripten/1.38.8/emcc'
cpp = '/opt/emsdk-portable/emscripten/1.38.8/em++'
ar = '/opt/emsdk-portable/emscripten/1.38.8/emar'
#exe_wrapper = 'node'
[properties]
root = '/opt/emsdk-portable/emscripten/1.38.8/system'
c_args = ['-s', 'WASM=1', '-O2']
c_link_args = ['-s', 'WASM=1','-O2']
cpp_args = ['-s', 'WASM=1','-O2']
cpp_link_args = ['-s', 'WASM=1','-O2']
shared_lib_suffix = 'js'
static_lib_suffix = 'js'
shared_module_suffix = 'js'
exe_suffix = 'js'
[host_machine]
system = 'emscripten'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'
(This was taken from https://github.com/prozum/meson-samples/blob/master/emscripten.txt)
Replace the paths with the paths to your Emscripten tools. Then invoke meson with meson --cross-file=emscripten.txt.
I write dependencies of Cargo.toml :
[dependencies ]
opencv = {version = "0.26", default-features = false, features = ["opencv-41"]}
Above one line can pass compilation.
I want to seperate lines for dependencies.
This page
https://github.com/BurntSushi/toml-test/blob/master/tests/valid/multiline-string.toml
said solution.
I refer this solution to write my dependencies:
[dependencies ]
opencv = """\{version = "0.26", \
default-features = false, \
features = ["opencv-41"] \
}"""
But compiler throw error:
$ cargo build [±master ●]
error: failed to parse manifest at /home/curlywei/WorkSpace/rust/testcargo/Cargo.toml
Caused by:
failed to parse the version requirement { version = "0.26", default-features = false, features = ["opencv-41"] } for dependency opencv
Caused by:
the given version requirement is invalid
How do I do?
Your link contains examples of multiline strings, not tables. In TOML, inline tables may not contain newlines.
Instead, the TOML spec suggests using a regular table:
No newlines are allowed between the curly braces unless they are valid within a value. Even so, it is strongly discouraged to break an inline table onto multiples lines. If you find yourself gripped with this desire, it means you should be using standard tables.
[dependencies.opencv]
version = "0.26"
default-features = false
features = ["opencv-41"]
I have an issue while I am creating the HMAC in LUA 5.1 version and same code is working in node.js
Node.js Code :
crypto.createHmac(
CONSTANTS.HMAC_ALORITHM_SHA,
Buffer.from(
secretAccessKey,
CONSTANTS.BASE64_ENCODING
)
).update(
Buffer.from(
stringToSign,
CONSTANTS.UTF8
)
).digest(
CONSTANTS.BASE64_ENCODING
);
I wanted to write in the same code LUa 5.1.
local sha2 = require("sha2")
local your_hmac_as_hex_string = sha2.hmac(
sha2.sha1, -- SHA-1
"secretAccessKey as binary string",
"stringToSign"
)
local your_hmac_as_binary_string = sha2.hex2bin(your_hmac_as_hex_string)
The library is here
UPDATE:
If your key is stored as base64, you need to convert it from base64 to binary:
local binary_key = sha2.base642bin(base64_key)
-- invoke sha2.hmac() here
And if you want to convert the result to base64:
local your_hmac_as_base64 = sha2.bin2base64(your_hmac_as_binary_string)
I have some code in Delphi that has Assert statements all over it. I know that there is a compiler directive {$C-}, but there are too many units to add it to. Is there a way to have it done by the compiler command line or somewhere in the dpr file?
You can use $C- from the command line as well, or configure it in 'Project->Options->Compiler' from the IDE (which configures it in the .dproj file).
There's a list of command line switches and options available by typing dcc32 from the command line. It can be redirected to a text file using command redirection (as in dcc32 > dccCommands.txt), which produces the following output with XE5's version of dcc32:
Embarcadero Delphi for Win32 compiler version 26.0
Copyright (c) 1983,2013 Embarcadero Technologies, Inc.
Syntax: dcc32 [options] filename [options]
-A<unit>=<alias> = Set unit alias
-B = Build all units
-CC = Console target
-CG = GUI target
-D<syms> = Define conditionals
-E<path> = EXE/DLL output directory
-F<offset> = Find error
-GD = Detailed map file
-GP = Map file with publics
-GS = Map file with segments
-H = Output hint messages
-I<paths> = Include directories
-J = Generate .obj file
-JPHNE = Generate C++ .obj file, .hpp file, in namespace, export all
-JL = Generate package .lib, .bpi, and all .hpp files for C++
-K<addr> = Set image base addr
-LE<path> = package .bpl output directory
-LN<path> = package .dcp output directory
-LU<package> = Use package
-M = Make modified units
-NU<path> = unit .dcu output directory
-NH<path> = unit .hpp output directory
-NO<path> = unit .obj output directory
-NB<path> = unit .bpi output directory
-NX<path> = unit .xml output directory
-NS<namespaces> = Namespace search path
-O<paths> = Object directories
-P = look for 8.3 file names also
-Q = Quiet compile
-R<paths> = Resource directories
-TX<ext> = Output name extension
-U<paths> = Unit directories
-V = Debug information in EXE
-VR = Generate remote debug (RSM)
-VT = Debug information in TDS
-VN = TDS symbols in namespace
-W[+|-|^][warn_id] = Output warning messages
-Z = Output 'never build' DCPs
-$<dir> = Compiler directive
--help = Show this help screen
--version = Show name and version
--codepage:<cp> = specify source file encoding
--default-namespace:<namespace> = set namespace
--depends = output unit dependency information
--doc = output XML documentation
--drc = output resource string .drc file
--no-config = do not load default dcc32.cfg file
--description:<string> = set executable description
--inline:{on|off|auto} = function inlining control
--legacy-ifend = allow legacy $IFEND directive
--zero-based-strings[+|-] = strings are indexed starting at 0
--peflags:<flags> = set extra PE Header flags field
--peoptflags:<flags> = set extra PE Header optional flags field
--peosversion:<major>.<minor> = set OS Version fields in PE Header (default: 5.0)
--pesubsysversion:<major>.<minor> = set Subsystem Version fields in PE Header (default: 5.0)
--peuserversion:<major>.<minor> = set User Version fields in PE Header (default: 0.0)
Compiler switches: -$<letter><state> (defaults are shown below)
A8 Aligned record fields
B- Full boolean Evaluation
C+ Evaluate assertions at runtime
D+ Debug information
G+ Use imported data references
H+ Use long strings by default
I+ I/O checking
J- Writeable structured consts
L+ Local debug symbols
M- Runtime type info
O+ Optimization
P+ Open string params
Q- Integer overflow checking
R- Range checking
T- Typed # operator
U- Pentium(tm)-safe divide
V+ Strict var-strings
W- Generate stack frames
X+ Extended syntax
Y+ Symbol reference info
Z1 Minimum size of enum types
Stack size: -$M<minStackSize[,maxStackSize]> (default 16384,1048576)