Trim whitespace (trailing newline) at the end of included Twig template

I’m trying to include a Twig template inside another, but there is undesirable whitespace which is caused by the trailing newline in the included template.

My use case is that the include takes place mid-sentence, just before a comma, and I don’t want any whitespace before the comma.

Base template:

Né le {{ include("date.html.twig", {date: date}) }}, décédé le…

Included template:

<time datetime="...">
  {{- date.format() -}}
</time>

Desired result :

Né le 6 mai 1977, décédé le…

Actual result :

Né le 6 mai 1977 , décédé le…

I can confirm the trailing newline is the cause of the issue, but removing it is not a viable solution to me since most tools are configured to add it if it’s missing.

Is there any way to trim this trailing newline?

How to get content from pages generated by views included in search results

I have a view that assembles all of our job postings. It creates a page whose url is /jobs.

Our search backend is Database Search.

A search of “jobs” returns no results.

Is there a way to get content from view-generated pages included in search results? I’m open to dropping crumbs into the custom view header or footer, or planting invisible blocks that appear only on the view page or any other similar tricks you’ve discovered.

GeekStorage Anniversary Sale – 40% discount! Oversale, LiteSpeed, WHMCS, SpamExperts included

————————————————– ————————————

IT'S OUR ANNIVERSARY!

Coupon: 10ANNRS – For a LIMITED TIME Only new customers can get one recurring 40% discount on one of our reseller hosting plans!

Coupon rules:

  • Only applies to new customers.
  • This voucher cannot be used with other special offers.
  • Affiliate recommendations are not eligible for this voucher.

————————————————– ————————————

Offer your customers top-up website hosting with our powerful reseller hosting platform.

Our reseller web hosting service, which uses our performance memory and our premium network, is a clear choice for your database-driven website. You are also assured of 24/7 access to our experienced geeks.

Data center location:

Our reseller hosting servers are located in the Steadfast Networks data center in Chicago, IL.

Included in all reseller hosting accounts:

* * cPanel / WHM Control Panel (Web Host Manager)

* Softaculous Script Auto-Installer (hundreds of one-click installation scripts!)
* * LiteSpeed ​​web server, PHP (5.4, 5.5 and 5.6, 7.0, 7.1), Perl, CGI, MySQL, Ruby on Rails + GEMS
* SNI supported
* CloudFlare activated
* * SpamExperts Enterprise SPAM filtering (Each reseller plan contains a bundle of domains. Additional domains can be purchased if necessary.)
* * Daily remote backups

* * RAID 10 arrays with high redundancy

* Free IPv6 addresses
* Developer friendly atmosphere
* E-commerce ready!
* * RVSkins included

* * FREE website builder (RVSiteBuilder & Site.Pro Website Builder)
* * FREE website migrations (We'll migrate up to 30 of your websites for free!)
* * Click here for a complete list of functions

We take care of our resellers:

* Includes ClientExec or WHMCS billing software license for 250 customers (or $ 5 / month discount if you don't want the license)
* Reduced additional purchases
* Discounted domain purchases
* Discounted SSL certificates
* Private reseller portal
* Free Comodo PositiveSSL certificate

Lightning-fast server hardware, premium bandwidth:

We SAVE NO EXPENSES for our geeks! Our latest reseller servers are designed to work with enterprise components, including RAID 10 SSDs for all storage.

US Test IP: 162.249.125.1

==============================================
Reseller hosting plans

==============================================

Economy reseller
30 GB storage (100% pure SSD storage)
1 TB bandwidth

2 dedicated IPs
cPanel® / WHM system control
Ability to sell

Create up to 30 cPanel® accounts
30 SpamExperts® domains (Enterprise Spam Filtering)

Site.Pro website builder
Daily remote backup
Immediate activation
Free Comodo SSL certificate
Click here for a complete list of functions

Monthly: $ 29.95 / month, Now only $ 17.97 / month. with 40% discount! Use coupon: 10ANNRS

Ready to order? Visit:
https://www.geekstorage.com/reseller-hosting

Prime reseller
40 GB storage (100% pure SSD storage)
1.5 TB bandwidth

2 dedicated IPs
cPanel® / WHM system control
Ability to sell

Create up to 40 cPanel® accounts
40 SpamExperts® domains (Enterprise Spam Filtering)

Site.Pro website builder
Daily remote backup
Immediate activation
Free Comodo SSL certificate
Click here for a complete list of functions

Monthly: $ 39.95 / month, Now only $ 23.97 / month. with 40% discount! Use coupon: 10ANNRS

Ready to order? Visit:
https://www.geekstorage.com/reseller-hosting

Ultimate reseller
50 GB storage (100% pure SSD storage)
2 TB bandwidth

2 dedicated IPs
cPanel® / WHM system control
Ability to sell

Create up to 50 cPanel® accounts
50 SpamExperts® domains (Enterprise Spam Filtering)

Site.Pro website builder
Daily remote backup
Immediate activation
Free Comodo SSL certificate
Click here for a complete list of functions

Monthly: $ 49.95 / month, Now only $ 29.97 / month. with 40% discount! Use coupon: 10ANNRS

Ready to order? Visit:
https://www.geekstorage.com/reseller-hosting

Thousands of webmasters trust that they can provide powerful web hosting with great support, which we love to do!

Here are just a few comments from our users about our service:

No contracts – monthly billing possible, can be canceled at any time!
Immediate setup!
Free website migration!

Take advantage of our 30-day money-back guarantee, 100% satisfaction guarantee and 99.9% availability guarantee and start searching today!

Ready to order? Visit:
https://www.geekstorage.com/

Do You Have Questions?

Send an email to sales@geekstorage.com or send me a PM on these forums.

How to use PHP and Javascript to check if a date range is included in another date range

I need help figuring out how I can use Javascript to check if a date range is included in another date range.

I have the results of a mySQL query:

$result1 = "2020-01-15,2020-01-20,2020-01-22,2020-01-27,2020-01-29,2020-02-03,2020-02-05,2020-02-10,2020-02-12,2020-02-17,2020-02-19,2020-02-24,2020-02-26,2020-03-02,2020-03-04,2020-03-09,2020-03-11,2020-03-16,2020-03-18,2020-03-23,2020-03-25,2020-03-30,2020-04-01,2020-04-06,2020-04-08,2020-04-13,2020-04-15";
$result2 = "2020-04-02,2020-04-07,2020-04-08,2020-04-09,2020-04-14,2020-04-15,2020-04-16";
$result3 = etc etc etc...

The part of the code that does the verification:

var nwdatas = ("2020-04-01,2020-04-02");    //--- Resultado recebido antes dessa parte do código
var dias = ();  //--- Como testar todos os results?

function funcResult(value) { 
    return value === nwdatas; 
}
var resultado = dias.some(funcD);

if (resultado == false) {
    alert(não);
} else {
    console.log(dias);
}

How should I compare $ result1, $ result2, $ result3, etc.? So far, the code always gives false, but how can it be? The date 2020-04-02 in nwdatas is included in $ result2!

Thank you so much!

java – Can the composition in the compositor be included in the strategy pattern?

I have a number of different animals in my zoo, such as turtles, birds, etc. Since they all have a common trait, such as swimming, flying, etc., I thought a strategy pattern was appropriate to model them. The thing is that I want to call a method in the composition from the compositor. See this MWE:

Animal.java (abstract class, composition)

public abstract class Animal {
    Movement movement;
    int metersSwam = 0;

    void swimMeters(int meters){
        metersSwam += meters;
    }

    void swim() {
        movement.swim();
    }

    void fly() {
        movement.fly();
    }
}

Turtle.java (extends animal)

public class Turtle extends Animal {
    public Turtle() {
        movement = new TurtleMovement(this);
    }
}

Movement.java (interface, compositor)

public interface Movement {
    void swim();
    void fly();
}

TurtleMovement.java (here is the problem where I call a method from Turtle)

public class TurtleMovement implements Movement {
    Animal turtle;

    public TurtleMovement(Animal turtle) {
        this.turtle = turtle;
    }

    @Override
    public void swim() {
        turtle.swimMeters(10); //<--- here
        System.out.println("I can swim, just swam 10 meters");
    }

    @Override
    public void fly() {
        System.out.println("I can't fly");
    }
}

main.java

public class Zoo {

    public static void main(String() args){
        Animal animal = new Turtle();
        animal.fly();
        animal.swim();
    }
}

So my question is basically, can I call the Turtle method in TurtleMovement? If not, is there a way to get around this, or maybe the strategy pattern isn't ideal for my situation?

Best Practices – Note: When should measures be included in the Power BI report, unlike the table model?

I am fairly new to tabular models. My current project involves adding many new DAX figures to an existing table model. There are approximately 20 fact tables, 30 dimension tables and 70 key figures.

Some of the requirements for Power BI reports require numbers that can be provided using an existing measure and then a selection of filters. For example, there is already a key figure called LetterCount = SUM (Letters.LetterQuantity). However, the reporting obligation is to display the number of sales letters in a table and to display the number of sales letters in the next line in the next line. The obvious solution is to add LetterType to the rows in the table visualization.

However, the report must also include other measures in the same table. Under the two lines of letters, for example, OpenAccounts and ClosedAccounts must appear in the next two lines. Dragging the LetterType filter into the table visualization does not work.

You cannot apply another filter to another row in a table or matrix visualization.

One way to solve this is to create one DAX measure for LetterCountSales and another for LetterCountAdvertising and insert the appropriate filter into the DAX.

My question is: Should these key figures be included in the table model or in the Power BI report?
My concern about including them in the table model is that it is not really needed. If the Power BI report developer does not want to create two separate visual elements for the two separate measures, he can create any specific measures in the report. If all variations of existing key figures are to be included in the table model, we get five or ten times as many in the table model. If the developer wants a different action for another report, is it expected that someone will insert it into the spreadsheet model and provide it? It doesn't sound like a very generic solution to me.

I think it makes sense that the tabular model creates the basic metrics for each aggregable value, and it should be up to the report developers to create in their Powewr BI reports any additional metrics they need when they're not ready, create a specific visual representation using the relevant filters.

I like hearing from people who think that this non-basic measure should "live" and why.

High performance OpenVZ SSD VPS hosting + 1 IPv4 included + Root / SSH access.

thumbs up

Hostpoco.com offers SSD VPS hosting plans that are perfect for anyone who wants full root access to their server. Our managed plans allow you to get the control you need while getting a little extra support so you can get there much faster. This makes it perfect for website owners who are not too familiar with the web hosting server side.

We provide premium Intel Xeon servers with full SSD / HDD storage in premium data centers connected to redundant Tier 1 Internet providers. Our fast servers offer super-fast technical support around the clock. All of our VPS hosting offerings include full root access, dedicated IP, free RDNS and free new installations. Simply register and be online within an hour with our instant and free setup.

VPS hosting features:
~ VPS type OpenVZ
~ Premium bandwidth
~ Free setup
~ 99% availability guarantee
~ 24/7 live support
~ Root / SSH access

VPS plan:
* VPS start: $ 14.99 / month
* VPS Pro: $ 24.99 / month
* VPS Premium: $ 44.99 / month
* VPS Elite: $ 84.99 / month

For more details: https://hostpoco.com/cheap-us-vps-hosting.php

Thanks a lot.