If condition possible in yaml file?

As a supplement to Vaibhav’s response: although yml does not inherently support if statements, some applications that use yml files for instructions may be able to parse if statements included in the yml. GitLab is one notable example. In GitLab’s CI/CD, the .gitlab-ci.yml file can be configured to include if statements such as: job: script: … Read more

How does `nullable=False` work in SQLAlchemy

The doc you reference explains the issue: This parameter is only used when issuing CREATE TABLE statements. If you originally created your database without nullable=False (or created it in some other way, separate from SQLAlchemy, without NOT NULL on that column), then your database column doesn’t have that constraint information. This information lives in reference … Read more

How can I allow Mixed contents (http with https) using content-security-policy meta tag?

You can’t. CSP is there to restrict content on your website, not to loosen browser restrictions. Secure https sites given users certain guarantees and it’s not really fair to then allow http content to be loaded over it (hence the mixed content warnings) and really not fair if you could hide these warnings without your … Read more

Merge two objects but only existing properties

Assuming you only want enumerable properties, this is easily done with Object.keys and in (or hasOwnProperty): Object.keys(obj2).forEach(function(key) { if (key in obj1) { // or obj1.hasOwnProperty(key) obj1[key] = obj2[key]; } }); Example: var obj1 = { “name”: “”, “age”: “” }; var obj2 = { “name”: “Leo”, “age”: “14”, “company”: “aero”, “shift”: “night” }; Object.keys(obj2).forEach(function(key) … Read more

How to conditionally inject service into component?

You can use the Injector import { Injector } from ‘@angular/core’ … constructor(private injector: Injector){ if(true) { this.oneService = <OneService>this.injector.get(OneService); } else { this.twoService = <TwoService>this.injector.get(TwoService); } } As @MeirionHughes mentioned this is called the service locator pattern: The technique is an example of the service locator pattern. Avoid this technique unless you genuinely need … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)