Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all 5049 articles
Browse latest View live

Codeigniter 3 - Make URLs case insensitive

$
0
0

With CI3 released controllers must now be Ucword-style (for whatever reason). No problem changing these, but upgrading any site now leads to 404s wherever it's applicable (which is pretty much everywhere). Is there a way to make it so the old URLs still work (in addition)? Ie I have a controller 'Admin.php" the index() fn of which used to be called

   http://example.com/admin

now it must be called

       http://example.com/Admin

Is there a way to have both work (on CentOS). Maybe via Apache rewrite and/or config?


Anyway to set a default only when there is parse error for @value

$
0
0

In Spring, you could use @Value("${num:123}") private int number; to inject the value number.

Clearly the default will work when there is no num field in the configuration file.

However, when there is a malformatted one. Spring will throw the error like:

09:54:28.392 [main] WARN org.springframework.context.annotation.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'valuesApp': Unsatisfied dependency expressed through field 'number'; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "string"

I know you could make the value injected type as String, then manually convert it to Integer type (can catch error etc.). However, is there any more elegant way of handling case like this? Such that Spring will use the default value in case of configuration file's one is malformatted.

Is Magento 2's ScopeConfig lazyloaded?

$
0
0

When i need to retrieve config values, i usually inject Magento\Framework\App\Config\ScopeConfigInterface to use.

But i have a concern about the core_config_data table getting too big and at one point, loading the whole table will decrease performance?

I believe the config object will construct from the whole table when it is loaded, is this correct? If it is so, has there been any concerns about performance when the table gets too big or if a few of the records have huge values?

I can access my flutter from home but cannot access from another path on Catalina OS

$
0
0

I can access my flutter from home but cannot access from another path on catalina OS

here my screen shoot

enter image description here

and here the code

macbookpro@Cong-Fandi ~ % pwd /Users/macbookpro macbookpro@Cong-Fandi ~ % flutter --version Flutter 1.9.1+hotfix.6 • channel stable • https://github.com/flutter/flutter.git Framework • revision 68587a0916 (7 weeks ago) • 2019-09-13 19:46:58 -0700 Engine • revision b863200c37 Tools • Dart 2.5.0 macbookpro@Cong-Fandi ~ % macbookpro@Cong-Fandi ~ % cd Desktop macbookpro@Cong-Fandi Desktop % pwd /Users/macbookpro/Desktop macbookpro@Cong-Fandi Desktop % flutter --version zsh: command not found: flutter macbookpro@Cong-Fandi Desktop %

JSP Servlet commands not working when I use 3rd party hosting (but works fine locally)

$
0
0

I am trying to host my JSP website using JavaPipe but I am running into a lot of problems. I finally got it to load the basic page but when I try to load a page using a command with the servlet, it crashes the page. (I get a bad gateway message)

If someone has experience in hosting and using JSPs, I am willing to pay if they can successfully walk me through and fix my problems. Thanks

Python configuration library, best practices [closed]

$
0
0

at the moment I am using configparser (python3) for setting/getting application parameters. In order to ensure that values will always be of the certain type I have created a dictionary like:

default_vals = OrderedDict( {
        # section|option : [default value,  Def. val. eval, type]
        'Defaults|RUN': ['True', '', 'bool'],
        'Defaults|SQL_LOG': ["os.path.join(os.path.expanduser('~'), 'path_to_dir', 'sql.log')", 'E', 'str'],

... }

Default value is the value if there is no section/otption in the config file, Def.val.eval = 'E' means return eval(default_value), type means type of variable.

So, the first key/value means:

  • In section Defaults, get option RUN.
  • If it doesn't exist, set it to True.
  • It should be of bool type

Second key/value means:

  • In section Defaults, get option SQL_LOG.
  • If it doesn't exist (E)val first element of an array
  • and return it as a string.

Eval is useful if I have need a list in the config. In that case I would put "[1, 2, 3]" as default value, than turn on eval with 'E' and return type "list". So I have used eval as kind of serialization of list (or dict) objects.

I have created a *.py file that reads cfg file, sets default values for any option in dictionary I explained above, so in main program I can use something like:

SQL_LOG = config.get('Defaults', 'SQL_LOG')

It works, but I think that this approach is to complicated.

Basically, what I have looking for is possibility to have:

  1. configuration in external file
  2. serialization of list/dict objects
  3. serialization of dates in given format
  4. expanding functions in run time as os.path.expanduser('~')
  5. way of changing configurations like development, test, production...
  6. ensuring that option values are of certain type

I have found some libraries like profig, dynaconf, easysettings ... that look promising, but I wander how you are managing your configurations and which library you are using.

If you know for a library that can handle all requirements that I have mentioned above, please share.

Regards.

Webpack config issue

$
0
0

Hi i'm a super newbie about webpack but i spent something like 4 hours researching to fix my problem so I decided to post my issue here. That's what my prompt diplay when i launch "webpack" command.

WARNING in ./~/ajv/lib/async.js 96:20 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ajv/lib/async.js 119:15 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ajv/lib/compile/index.js 13:21 Critical dependency: the request of a dependency is an expression

ERROR in .//pdf3json/pdfparser.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\pdf3json' @ .//pdf3json/pdfparser.js 5:9-22 @ ./~/pdf2text/index.js @ ./main.js

ERROR in .//download-file/index.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\download-file' @ .//download-file/index.js 1:9-22 @ ./~/download-pdf/index.js @ ./main.js

ERROR in .//request/lib/har.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\request\lib' @ .//request/lib/har.js 3:9-22 @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//pdf3json/lib/pdf.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\pdf3json\lib' @ .//pdf3json/lib/pdf.js 3:9-22 @ .//pdf3json/pdfparser.js @ .//pdf2text/index.js @ ./main.js

ERROR in .//forever-agent/index.js Module not found: Error: Can't resolve 'net' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\forever-agent' @ .//forever-agent/index.js 6:10-24 @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//forever-agent/index.js Module not found: Error: Can't resolve 'tls' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\forever-agent' @ .//forever-agent/index.js 7:10-24 @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//pdf3json/package.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\pdf3json\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. | { | "_args": [ | [ | { @ .//pdf3json/lib/pdf.js 11:13-39 @ .//pdf3json/pdfparser.js @ .//pdf2text/index.js @ ./main.js

ERROR in .//tough-cookie/lib/cookie.js Module not found: Error: Can't resolve 'net' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\tough-cookie\lib' @ .//tough-cookie/lib/cookie.js 32:10-24 @ .//request/lib/cookies.js @ .//request/index.js @ ./main.js

ERROR in .//tough-cookie/package.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\tough-cookie\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. | { | "_args": [ | [ | { @ .//tough-cookie/lib/cookie.js 38:14-40 @ .//request/lib/cookies.js @ .//request/index.js @ ./main.js

ERROR in .//mkdirp/index.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\mkdirp' @ .//mkdirp/index.js 2:9-22 @ .//download-file/index.js @ .//download-pdf/index.js @ ./main.js

ERROR in .//pdf3json/lib/ptixmlinject.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\pdf3json\lib' @ .//pdf3json/lib/ptixmlinject.js 5:5-18 @ .//pdf3json/lib/pdf.js @ .//pdf3json/pdfparser.js @ ./~/pdf2text/index.js @ ./main.js

ERROR in .//tunnel-agent/index.js Module not found: Error: Can't resolve 'net' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\tunnel-agent' @ .//tunnel-agent/index.js 3:10-24 @ .//request/lib/tunnel.js @ .//request/request.js @ ./~/request/index.js @ ./main.js

ERROR in .//tunnel-agent/index.js Module not found: Error: Can't resolve 'tls' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\tunnel-agent' @ .//tunnel-agent/index.js 4:10-24 @ .//request/lib/tunnel.js @ .//request/request.js @ ./~/request/index.js @ ./main.js

ERROR in (webpack)//browserify-sign/browser/algorithms.json Module parse failed: C:\Users\stagista11\AppData\Roaming\npm\node_modules\webpack\node_modules\browserify-sign\browser\algorithms.json Unexpected token (2:27) You may need an appropriate loader to handle this file type. | { | "sha224WithRSAEncryption": { | "sign": "rsa", | "hash": "sha224", @ (webpack)//browserify-sign/algos.js 1:17-53 @ (webpack)//crypto-browserify/index.js @ .//request/lib/helpers.js @ ./~/request/index.js @ ./main.js

ERROR in .//mime-db/db.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\mime-db\db.json Unexpected token (2:40) You may need an appropriate loader to handle this file type. | { | "application/1d-interleaved-parityfec": { | "source": "iana" | }, @ .//mime-db/index.js 11:17-37 @ .//mime-types/index.js @ .//request/request.js @ ./~/request/index.js @ ./main.js

ERROR in (webpack)//diffie-hellman/lib/primes.json Module parse failed: C:\Users\stagista11\AppData\Roaming\npm\node_modules\webpack\node_modules\diffie-hellman\lib\primes.json Unexpected token (2:11) You may need an appropriate loader to handle this file type. | { | "modp1": { | "gen": "02", | "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff" @ (webpack)//diffie-hellman/browser.js 2:13-41 @ (webpack)//crypto-browserify/index.js @ .//request/lib/helpers.js @ ./~/request/index.js @ ./main.js

ERROR in (webpack)//browserify-sign/browser/curves.json Module parse failed: C:\Users\stagista11\AppData\Roaming\npm\node_modules\webpack\node_modules\browserify-sign\browser\curves.json Unexpected token (2:16) You may need an appropriate loader to handle this file type. | { | "1.3.132.0.10": "secp256k1", | "1.3.132.0.33": "p224", | "1.2.840.10045.3.1.1": "p192", @ (webpack)//browserify-sign/browser/sign.js 7:13-37 @ (webpack)//browserify-sign/browser/index.js @ (webpack)//crypto-browserify/index.js @ .//request/lib/helpers.js @ .//request/index.js @ ./main.js

ERROR in (webpack)//elliptic/package.json Module parse failed: C:\Users\stagista11\AppData\Roaming\npm\node_modules\webpack\node_modules\elliptic\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. | { | "_args": [ | [ | { @ (webpack)//elliptic/lib/elliptic.js 5:19-45 @ (webpack)//create-ecdh/browser.js @ (webpack)//crypto-browserify/index.js @ .//request/lib/helpers.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/afterRequest.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\afterRequest.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "afterRequest.json#", | "type": "object", | "optional": true, @ .//har-schema/lib/index.js 4:16-46 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/beforeRequest.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\beforeRequest.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "beforeRequest.json#", | "type": "object", | "optional": true, @ .//har-schema/lib/index.js 5:17-48 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/browser.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\browser.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "browser.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 6:11-36 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/cache.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\cache.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "cache.json#", | "properties": { | "beforeRequest": { @ .//har-schema/lib/index.js 7:9-32 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/cookie.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\cookie.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "cookie.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 9:10-34 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/creator.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\creator.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "creator.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 10:11-36 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/content.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\content.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "content.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 8:11-36 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/entry.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\entry.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "entry.json#", | "type": "object", | "optional": true, @ .//har-schema/lib/index.js 11:9-32 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/har.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\har.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "har.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 12:7-28 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/header.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\header.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "header.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 13:10-34 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/log.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\log.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "log.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 14:7-28 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/page.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\page.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "page.json#", | "type": "object", | "optional": true, @ .//har-schema/lib/index.js 15:8-30 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/pageTimings.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\pageTimings.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "pageTimings.json#", | "type": "object", | "properties": { @ .//har-schema/lib/index.js 16:15-44 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/postData.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\postData.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "postData.json#", | "type": "object", | "optional": true, @ .//har-schema/lib/index.js 17:12-38 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/query.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\query.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "query.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 18:9-32 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/request.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\request.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "request.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 19:11-36 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/response.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\response.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "response.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 20:12-38 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/timings.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\timings.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "timings.json#", | "required": [ | "send", @ .//har-schema/lib/index.js 21:11-36 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//ajv/lib/refs/json-schema-draft-04.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\ajv\lib\refs\json-schema-draft-04.json Unexpected token (2:8) You may need an appropriate loader to handle this file type. | { | "id": "htp://json-schema.org/draft-04/schema#", | "$schema": "htp://json-schema.org/draft-04/schema#", | "description": "Core schema meta-schema", @ .//ajv/lib/ajv.js 385:23-66 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//ajv/lib/refs/json-schema-v5.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\ajv\lib\refs\json-schema-v5.json Unexpected token (2:8) You may need an appropriate loader to handle this file type. | { | "id": "htps://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#", | "$schema": "htp://json-schema.org/draft-04/schema#", | "description": "Core schema meta-schema (v5 proposals)", @ .//ajv/lib/v5.js 20:21-58 @ .//ajv/lib/ajv.js @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ ./~/request/index.js @ ./main.js

ERROR in (webpack)//parse-asn1/aesid.json Module parse failed: C:\Users\stagista11\AppData\Roaming\npm\node_modules\webpack\node_modules\parse-asn1\aesid.json Unexpected token (1:25) You may need an appropriate loader to handle this file type. | {"2.16.840.1.101.3.4.1.1": "aes-128-ecb", | "2.16.840.1.101.3.4.1.2": "aes-128-cbc", | "2.16.840.1.101.3.4.1.3": "aes-128-ofb", @ (webpack)//parse-asn1/index.js 2:12-35 @ (webpack)//public-encrypt/privateDecrypt.js @ (webpack)//public-encrypt/browser.js @ (webpack)//crypto-browserify/index.js @ .//request/lib/helpers.js @ ./~/request/index.js @ ./main.js

That's my "webpack.config.js".

module.exports = { entry: './main.js', output: { filename: './bundle.js' } };

I know that's a lot of things to read : ( but i really appreciate everything.

I modified config file into this.

module.exports = { entry: './main.js', output: { filename: './bundle.js' }, target: 'node' };

Prompt display this.

WARNING in ./~/ajv/lib/async.js 96:20 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ajv/lib/async.js 119:15 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ajv/lib/compile/index.js 13:21 Critical dependency: the request of a dependency is an expression

ERROR in ./~/pdf3json/package.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\pdf3json\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. | { | "_args": [ | [ | { @ ./~/pdf3json/lib/pdf.js 11:13-39 @ ./~/pdf3json/pdfparser.js @ ./~/pdf2text/index.js @ ./main.js

ERROR in ./~/tough-cookie/package.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\tough-cookie\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. | { | "_args": [ | [ | { @ ./~/tough-cookie/lib/cookie.js 38:14-40 @ ./~/request/lib/cookies.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/hawk/package.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\hawk\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. | { | "_args": [ | [ | { @ ./~/hawk/lib/utils.js 14:11-37 @ ./~/hawk/lib/index.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/mime-db/db.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\mime-db\db.json Unexpected token (2:40) You may need an appropriate loader to handle this file type. | { | "application/1d-interleaved-parityfec": { |
"source": "iana" | }, @ ./~/mime-db/index.js 11:17-37 @ ./~/mime-types/index.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/afterRequest.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\afterRequest.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "afterRequest.json#", | "type": "object", | "optional": true, @ ./~/har-schema/lib/index.js 4:16-46 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/beforeRequest.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\beforeRequest.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "beforeRequest.json#", | "type": "object", | "optional": true, @ ./~/har-schema/lib/index.js 5:17-48 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/browser.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\browser.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "browser.json#", | "type": "object", | "required": [ @ ./~/har-schema/lib/index.js 6:11-36 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/cache.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\cache.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "cache.json#", | "properties": { |
"beforeRequest": { @ ./~/har-schema/lib/index.js 7:9-32 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/content.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\content.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "content.json#", | "type": "object", | "required": [ @ ./~/har-schema/lib/index.js 8:11-36 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/cookie.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\cookie.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "cookie.json#", | "type": "object", | "required": [ @ ./~/har-schema/lib/index.js 9:10-34 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/creator.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\creator.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "creator.json#", | "type": "object", | "required": [ @ ./~/har-schema/lib/index.js 10:11-36 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/entry.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\entry.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "entry.json#", | "type": "object", |
"optional": true, @ ./~/har-schema/lib/index.js 11:9-32 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/har.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\har.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "har.json#", | "type": "object", |
"required": [ @ ./~/har-schema/lib/index.js 12:7-28 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/header.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\header.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "header.json#", | "type": "object", | "required": [ @ ./~/har-schema/lib/index.js 13:10-34 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/log.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\log.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "log.json#", | "type": "object", |
"required": [ @ ./~/har-schema/lib/index.js 14:7-28 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/page.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\page.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "page.json#", | "type": "object", |
"optional": true, @ ./~/har-schema/lib/index.js 15:8-30 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/pageTimings.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\pageTimings.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "pageTimings.json#", | "type": "object", | "properties": { @ ./~/har-schema/lib/index.js 16:15-44 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/postData.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\postData.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "postData.json#", | "type": "object", | "optional": true, @ ./~/har-schema/lib/index.js 17:12-38 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/request.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\request.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "request.json#", | "type": "object", | "required": [ @ ./~/har-schema/lib/index.js 19:11-36 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/query.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\query.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "query.json#", | "type": "object", |
"required": [ @ ./~/har-schema/lib/index.js 18:9-32 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

Webpack fonts looking in the wrong directory at build

$
0
0

I have a webpack project where during development everything works just fine but when I build my application the website looks in the wrong folder for my font files. I have a .scss file where in the top I have specified a $font_path = './assets/fonts/'; and the file lives in the src/scss/utils folder. When I have built my application the app looks for the files in ..../dist/static/css/static/fonts/filename.hash.ttf etc. and the actual files resides in the ..../dist/static/fonts folder.

Here is my webpack.common.js file (which is my base application setup):

'use strict';

const helpers = require('./helpers');
const path = require('path');
const webpack = require('webpack')

const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
    entry: {
        polyfill: '@babel/polyfill',
        main: path.resolve(__dirname, '../src/main.js'),
        vendor: path.resolve(__dirname, '../src/vendor.js')
    },
    module: {
        rules: [{
                test: /\.vue$/,
                loader: 'vue-loader',
                include: [helpers.root('src')]
            },
            {
                test: /\.html$/,
                use: [
                    'html-loader'
                ]
            },
            {
                test: /\.(jpe?g|gif|png)$/,
                use: {
                    loader: 'file-loader',
                    options: {
                        name: '[name].[hash].[ext]',
                        outputPath: 'static/img'
                    }
                }
            },
            {
                test: /\.(ttf|eot|woff2?|otf)$/,
                use: {
                    loader: 'url-loader',
                    options: {
                        name: 'static/fonts/[name].[hash].[ext]',
                        limit: 10000
                    }
                }
            },
            {
                test: /\.ico$/,
                use: {
                    loader: 'file-loader',
                    options: {
                        name: '[name].[hash].[ext]',
                        outputPath: 'static/img/icons'
                    }
                }
            },
            {
                test: /\.svg$/,
                use: [{
                        loader: 'svg-sprite-loader',
                        options: {
                            spriteFilename: 'sprites.svg',
                            runtimeCompat: true
                        }
                    },
                    {
                        loader: 'svgo-loader',
                        options: {
                            removeTitle: true,
                            removeUselessStrokeAndFill: true
                        }
                    }
                ]
            }
        ]
    },
    plugins: [
        new VueLoaderPlugin(),
    ]
};

And here is my webpack.prod.js file config for build:

const common = require('./webpack.common');
const merge = require('webpack-merge');
const helpers = require('./helpers');
const webpack = require('webpack');

const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin');

process.env.NODE_ENV = "production";

let dateStamp = new Date().toISOString().slice(0,10).replace(/-/g,"");

module.exports = merge(common, {
    mode: "production",
    resolve: {
        extensions: [ '.js', '.vue' ],
        alias: {
            'vue$': 'vue/dist/vue.runtime.min.js',
            '@': helpers.root('src')
        }
    },
    output: {
        filename: `[name].${dateStamp}.[contentHash].bundle.js`,
        path: helpers.root('dist')
    },
    optimization: {
        runtimeChunk: 'single',
        minimizer: [
            new OptimizeCssAssetsPlugin(), // CSS Minimization
            new TerserPlugin() // JS Minimization (UglifyJS replacement)
        ],
        splitChunks: {
            chunks: "all",
            maxInitialRequests: Infinity,
            minSize: 0
        }
    },
    plugins: [
        new webpack.EnvironmentPlugin({NODE_ENV: 'production'}),
        new MiniCssExtractPlugin({
            filename: `static/css/[name].${dateStamp}.[contentHash].css`
        }),
        new CleanWebpackPlugin(),
        new HtmlWebpackPlugin({
            template: "./index.html",
            inject: true,
            minify: {
                removeAttributeQuotes: true,
                collapseWhitespace: true,
                removeComments: true
            }
        })
    ],
    module: {
        rules: [
            {
                test: /\.(scss|sass)$/,
                use: [
                    MiniCssExtractPlugin.loader, 
                    "css-loader", 
                    "sass-loader"
                ]
            },
            {
                test: /\.css$/,
                use: [
                    'style-loader',
                    'css-loader'
                ]
            }
        ]
    }
});

Hope you can spot my error.

EDIT Adding ./src/scss/utils/fonts.scss since I have a knawing feeling that this is where something messes up.

$font_path: './assets/fonts/';

/* Comfortaa */

@font-face {
    font-family: "Comfortaa";
    font-weight: 300;
    font-style: normal;
    src: url($font_path + 'Comfortaa/Comfortaa_Thin.ttf') format("truetype")
}

@font-face {
    font-family: "Comfortaa";
    font-weight: 400;
    font-style: normal;
    src: url($font_path + 'Comfortaa/Comfortaa_Regular.woff') format("woff"),
        url($font_path + 'Comfortaa/Comfortaa_Regular.woff2') format("woff2"),
        url($font_path + 'Comfortaa/Comfortaa_Regular.ttf') format("truetype"),
        url($font_path + 'Comfortaa/Comfortaa_Regular.eot') format("embedded-opentype"),
        // url($font_path + 'Comfortaa/Comfortaa_Regular.svg') format("svg")
}

@font-face {
    font-family: "Comfortaa";
    font-weight: 700;
    font-style: normal;
    src: url($font_path + 'Comfortaa/Comfortaa_Bold.ttf') format("truetype")
}

/* ROBOTO */

@font-face {
    font-family: "Roboto";
    font-weight: 100;
    font-style: normal;
    src: url($font_path + 'Roboto/Roboto-Thin.woff') format("woff"),
        url($font_path + 'Roboto/Roboto-Thin.woff2') format("woff2"),
        url($font_path + 'Roboto/Roboto-Thin.ttf') format("truetype"),
        url($font_path + 'Roboto/Roboto-Thin-webfont.eot') format("embedded-opentype"),
        // url($font_path + 'Roboto/Roboto-Thin-webfont.svg') format("svg");
}

@font-face {
    font-family: "Roboto";
    font-weight: 300;
    font-style: normal;
    src: url($font_path + 'Roboto/Roboto-Light.woff') format("woff"),
        url($font_path + 'Roboto/Roboto-Light.woff2') format("woff2"),
        url($font_path + 'Roboto/Roboto-Light.ttf') format("truetype"),
        url($font_path + 'Roboto/Roboto-Light-webfont.eot') format("embedded-opentype"),
        // url($font_path + 'Roboto/Roboto-Light-webfont.svg') format("svg");
}

@font-face {
    font-family: "Roboto";
    font-weight: 400;
    font-style: normal;
    src: url($font_path + 'Roboto/Roboto-Regular.woff') format("woff"),
        url($font_path + 'Roboto/Roboto-Regular.woff2') format("woff2"),
        url($font_path + 'Roboto/Roboto-Regular.ttf') format("truetype"),
        url($font_path + 'Roboto/Roboto-Regular-webfont.eot') format("embedded-opentype"),
        // url($font_path + 'Roboto/Roboto-Regular-webfont.svg') format("svg");
}

@font-face {
    font-family: "Roboto";
    font-weight: 500;
    font-style: normal;
    src: url($font_path + 'Roboto/Roboto-Medium.woff') format("woff"),
        url($font_path + 'Roboto/Roboto-Medium.woff2') format("woff2"),
        url($font_path + 'Roboto/Roboto-Medium.ttf') format("truetype"),
        url($font_path + 'Roboto/Roboto-Medium-webfont.eot') format("embedded-opentype"),
        // url($font_path + 'Roboto/Roboto-Medium-webfont.svg') format("svg");
}

@font-face {
    font-family: "Roboto";
    font-weight: 700;
    font-style: normal;
    src: url($font_path + 'Roboto/Roboto-Bold.woff') format("woff"),
        url($font_path + 'Roboto/Roboto-Bold.woff2') format("woff2"),
        url($font_path + 'Roboto/Roboto-Bold.ttf') format("truetype"),
        url($font_path + 'Roboto/Roboto-Bold-webfont.eot') format("embedded-opentype"),
        // url($font_path + 'Roboto/Roboto-Bold-webfont.svg') format("svg");
}

/* SOURCE SANS PRO */

@font-face {
    font-family: "Source Sans Pro";
    font-weight: 100;
    font-style: normal;
    src: url($font_path + 'SourceSans/SourceSansPro-ExtraLight.otf.woff') format("woff"),
        url($font_path + 'SourceSans/SourceSansPro-ExtraLight.otf.woff2') format("woff2"),
        url($font_path + 'SourceSans/SourceSansPro-ExtraLight.ttf') format("truetype"),
        url($font_path + 'SourceSans/SourceSansPro-ExtraLight.eot') format("embedded-opentype"),
        url($font_path + 'SourceSans/SourceSansPro-ExtraLight.otf') format("otf");
}

@font-face {
    font-family: "Source Sans Pro";
    font-weight: 300;
    font-style: normal;
    src: url($font_path + 'SourceSans/SourceSansPro-Light.otf.woff') format("woff"),
        url($font_path + 'SourceSans/SourceSansPro-Light.otf.woff2') format("woff2"),
        url($font_path + 'SourceSans/SourceSansPro-Light.ttf') format("truetype"),
        url($font_path + 'SourceSans/SourceSansPro-Light.eot') format("embedded-opentype"),
        url($font_path + 'SourceSans/SourceSansPro-Light.otf') format("otf");
}

@font-face {
    font-family: "Source Sans Pro";
    font-weight: 400;
    font-style: normal;
    src: url($font_path + 'SourceSans/SourceSansPro-Regular.otf.woff') format("woff"),
        url($font_path + 'SourceSans/SourceSansPro-Regular.otf.woff2') format("woff2"),
        url($font_path + 'SourceSans/SourceSansPro-Regular.ttf') format("truetype"),
        url($font_path + 'SourceSans/SourceSansPro-Regular.eot') format("embedded-opentype"),
        url($font_path + 'SourceSans/SourceSansPro-Regular.otf') format("otf");
}

@font-face {
    font-family: "Source Sans Pro";
    font-weight: 500;
    font-style: normal;
    src: url($font_path + 'SourceSans/SourceSansPro-Semibold.otf.woff') format("woff"),
        url($font_path + 'SourceSans/SourceSansPro-Semibold.otf.woff2') format("woff2"),
        url($font_path + 'SourceSans/SourceSansPro-Semibold.ttf') format("truetype"),
        url($font_path + 'SourceSans/SourceSansPro-Semibold.eot') format("embedded-opentype"),
        url($font_path + 'SourceSans/SourceSansPro-Semibold.otf') format("otf");
}

@font-face {
    font-family: "Source Sans Pro";
    font-weight: 700;
    font-style: normal;
    src: url($font_path + 'SourceSans/SourceSansPro-Bold.otf.woff') format("woff"),
        url($font_path + 'SourceSans/SourceSansPro-Bold.otf.woff2') format("woff2"),
        url($font_path + 'SourceSans/SourceSansPro-Bold.ttf') format("truetype"),
        url($font_path + 'SourceSans/SourceSansPro-Bold.eot') format("embedded-opentype"),
        url($font_path + 'SourceSans/SourceSansPro-Bold.otf') format("otf");
}

Is there any tool to perform automated variable substitutions on Config xml files for multiple servers?

$
0
0

Assume we have N number of environments and we set environment variables on a per-host basis, depending on what environment that hosts in. Thus, is there any tool to replace value of environment variables in an automated way?

Error trying to install Charles Proxy 4.5.1 - "The bundled java installation is broken. Please uninstall and reinstall Charles"

$
0
0

I had problems when i try install Charles Proxy 4.5.1.

has displayed the following error:

"The bundled java installation is broken. Please uninstall and reinstall Charles"

I already uninstalled and installed Charles, uninstalled and installed Java and Java SE Kit and the bug persists

Nginx: use a directory as root /

$
0
0

As the title tells I would like to use a directory as my root on my Nginx server. I have a directory tree something like this:

/www
folder A
Folder B
Folder C

And I would like to configure Nginx so that the root / should be i folder A (example.com/ would be in the folder A). But if a user types example.com/FolderB/ that user should jump up one directory and get to the folder B. And the same for folder C.

I've tried to use locations, alias and root to change where the user is but I don't get it to work proper.

Jpeg to webp redirect

$
0
0

I had an old file /images/car/car_1.jpg on my site.

I have changed my folders structure and this file now stored here /images/oldcars/car-image/car_1.jpg .

This file now also can have a webp clone available here /images/oldcars/car-image/car_1.webp.

The question is - How can I properly do a redirect rule for this old file to check if there is a webp clone first? And if there is, return that.

And if not - do a simple redirect to new jpg.

ASP.NET and C#: where do you store the rest client url?

$
0
0

I have my rest client url hard-coded in my code-behind, but upon peer-reviewing my code, I was asked to move that url to the config file so that it can be changed for each environment.

Visual Studio 2019 now complains because my rest client url has an invalid = sign as token in the url itself, and it expects ; as token instead.

Has anyone ever come across this, and is it correct to move the rest client to the config file? In theory that should not change.

Can't share the full url, but the part that is highlighted as error is this: version=2.0&details=true.

How to use options for both command line and hierarchical config file with Boost Program_Options

$
0
0

Imagine I have a program that takes the following command-line option:

$ prog1 --foo 1

I also have a configuration file that is in this hierarchical format, with the foo parameter within the prog1 scope:

[prog1]
foo = 42

My understanding of Boost::program_options is that the command-line option is defined similar to:

description.add_options()
    ("foo", "Set foo value");

However I want the value in the config file to be a default value (as an outcome of calling store() twice, first with the command-line description, then the config file description), able to be overriden by the command-line option, but I believe the config file option has to be declared as:

description.add_options()
    ("prog1.foo", "Set foo value");

Note the use of prog1.foo here, especially the prog1. prefix.

So my question is, if you use hierarchical config-file options, how do you associate these with command line options? I.e. how do I make --foo and prog1.foo represent the same configuration value in the Storage object?

How to pass dynamic image url in nuxt project

$
0
0

I want to pass image url to child component but image is not showing.

I tried v-attr, :attr, :src properties.

pages/index.vue

<ThumbNail img-url="assets/img/igsim_intro.png"/>

components/Thumbnail.vue

<!-- Failed to resolve directive: attr -->
<img v-attr="imgUrl" /> 

<!-- 404 Not found: http://localhost:3000/assets/img/pds_main.png -->
<img :src="imgUrl" />

<img :attr="{src: imgUrl}" /> 
<script>
export default {
  name: "ThumbNail",
  props: {
    imgUrl: {
      type: String,
      default: ''
    }
  }
}
</script>

I expect Thumbnail.vue show images as passed url.


Python3 showing unhashable type: 'ConfigParser', while using ConfigParser the code works fine in python2

$
0
0

I am using ConfigParser to read a config file, the code goes here.


def read_config(config_file_name):
    """Read a configuration .ini file, return SafeConfigParser object."""
    parser = ConfigParser()
    parser.optionxform = str
    parser.read(config_file_name)
    fpath = Path(config_file_name)
    if fpath.stat().st_size == 0:
        raise Exception('Framework - config file not present.')
    return parser 

Function to get the config values config is the parser return from read_config function

def build_api_params(config):
    """Build the api url."""
    api_url = config.get('service', 'api_url')
    api_version = config.get('service', 'api_version')

    full_api_url = api_url + api_version

    return full_api_url

But giving an error :

TypeError: unhashable type: 'ConfigParser'

Config file snapshot:

[service]
api_url = https://api/url/
api_version = api_version

I have tried using different options, but still having same error, Thanks in advance for any leads.

I tried using read_file in place of read in config parser, suspecting config read issue. Earlier function was returning tuple i changed to str From python 2 to 3 I have changed SafeConfigParser to ConfigParser. Checked and verified the type of return value of the function build_api_params ie not list which usually the hashable error is associated

Copy comment:

Traceback (most recent call last):
File \"path/fille.py", line 167, full_api_url = build_api_params(config)
TypeError: unhashable type: 'ConfigParser'

How to fix 'attempted adding second root element to document' parse error in logstash?

$
0
0

I've got the following xml from an api:

<Journey id=1 fpTime="12:33"></Journey>
<Journey id=2 fpTime="14:33"></Journey>

I want to parse each "Journey" separately and send it to elasticsearch. This is my logstash config:

input {
  http_poller {
    urls => {

      test2 => {
        method => get
         url => "https://reiseauskunft.bahn.de/bin/stboard.exe/dn?rt=1&input=Stuttgart%20Hauptbahnhof&boardType=dep&L=vs_java3&productsFilter=111110111&start=yes&maxJourneys=20"

     }

    }
     codec => multiline
        {
            pattern => "<Journey"
            negate => true
            what => "previous"
            charset => "ISO-8859-1"
            auto_flush_interval => 1
        }

    request_timeout => 20
    schedule => { cron => "* * * * * UTC"}
    metadata_target => "http_poller_metadata"
  }
}

    filter {
     xml {
        remove_namespaces => true
        source => "message"
        force_array => false
        target => "msg"
        xpath => ["/Journey/@fpTime", "jTime"]
      }
    }

When I run logstash I get the following xmlParse error:

:exception=>#<REXML::ParseException: #<RuntimeError: attempted adding second root element to document>Line: 1 Position: 6218

How to restart prometheus?

$
0
0

I have set-up prometheus in my Ubuntu machine and it is running at localhost:9090 now. But, when I run the following command, I get a failed status.

systemctl status prometheus

Output:

● prometheus.service - Prometheus
Loaded: loaded (/lib/systemd/system/prometheus.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2019-11-06 14:58:36 +0530; 8s ago
Main PID: 7046 (code=exited, status=1/FAILURE)

නෙවැ 06 14:58:36 ayesh systemd[1]: prometheus.service: Service hold-off time over, scheduling restart
නෙවැ 06 14:58:36 ayesh systemd[1]: prometheus.service: Scheduled restart job, restart counter is at 5
නෙවැ 06 14:58:36 ayesh systemd[1]: Stopped Prometheus.
නෙවැ 06 14:58:36 ayesh systemd[1]: prometheus.service: Start request repeated too quickly.
නෙවැ 06 14:58:36 ayesh systemd[1]: prometheus.service: Failed with result 'exit-code'.
නෙවැ 06 14:58:36 ayesh systemd[1]: Failed to start Prometheus.

I tried to restart prometheus using;

killall -HUP prometheus
sudo systemctl daemon-reload
sudo systemctl restart prometheus

and using;

curl -X POST http://localhost:9090/-/reload

but they did not work for me. I have checked for syntax errors of prometheus.yml using 'promtool' and it passed successfully.

Is there any other way to fix this problem?

Dynamically return config value (node.js)

$
0
0

I'm building a content middleware which gather contents from our external publishers. The publishers will share their contents either in rss or json and the key/value field would be different from each other. To make thing easier, I created a config file where I can pre-defined the key/value and the feed type. The problem is, how can I dynamically return this config value based on publishers name.

Example: To get Publisher #1 feed type, I just can use config.articles.rojak_daily.url_feed

my config file /config/index.js

module.exports = {
    batch:100,
    mysql: {
        database: process.env.database,
        host: process.env.host,
        username: process.env.username,
        password: process.env.password
    },
    articles:{
        rojak_daily:{ // Publisher 1
            url: 'xxx',
            url_feed: 'rss',
            id: null,
            Name: 'title',
            Description: 'description',
            Link: 'link',
            DatePublishFrom: 'pubDate',
            LandscapeImage: 's3image',
            SiteName: 'Rojak Daily',
            SiteLogo: null
        },
        rojak_weekly:{ // publisher 2
            url: 'xxx',
            url_feed: 'json',
            id: null,
            Name: 'Name',
            Description: 'Desc',
            Link: 'link',
            DatePublishFrom: 'pubDate',
            LandscapeImage: 's3image',
            SiteName: 'Rojak Weekly',
            SiteLogo: null
        }
    }
}

my main application script

const config = require('@config'); // export from config file

class Main {
    constructor(){
      this.publishers = ['rojak_daily','rojak_weekly'];
    }

    // Main process
    async startExport(){
        try{
            for(let publisher of this.publishers){
                const feedType =  await this.getFeedType(publisher)
                const result = (feedType == 'rss')? await this.rss.start(publisher): await this.json.start(publisher)
                return result
            }
        }catch(err){
            console.log("Error occured: ", err)
        }


    }

    // Get feed type from config
    async getFeedType(publisher){
      return await config.articles.rojak_daily.url_feed; 
      // this only return publisher 1 url feed.
      // my concern is to dynamically passing variable 
      // into this config file (example: config.articles.<publisher>.url_feed)
    }

}

module.exports = Main

change in configuration/setting without restarting Tomcat

$
0
0

Ideally what I want to be able to do is load in a fresh copy of the config every 5 mins so that if it is updated in the DB, it gets fetched and updated in the application without a restart.

I tried to add autodeploy = true inside host, server.xml and reload = true inside context.xml.But none of this worked.

Is there any other solution for this. Iam using eclipse IDE and my sever is Tomcat.

Viewing all 5049 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>