text:
Q: Groovy + Spring - DI with no boilerplate (constructor) code I have created spring-boot project which bases on Groovy instead of Java.
Now I have following @RestController:
@RestController
class HelloRest {

    private final HelloService helloService

    @GetMapping("hello")
    String hello(@RequestParam("name") String name) {
        helloService.createHelloMessage(name)
    }
}

Question is how to inject
@Service
class HelloService {...}

in most simple way avoiding boilerplate (in this case the constructor) code?
In Java I would use: @lombok.RequiredArgsConstructor and in fact it works also if I use it in my groovy project.
On the other hand for example the @Immutable annotation from groovy.transform doesn't work as it creates in fact more than single constructor. Whereas Spring expects single constructor to be able automatically @Autowired the dependencies.
As far I see 2 solutions:

*

*Generate the constructor

*Use lombok with its annotations

Is there any solution build into Groovy which could be used here instead?

A: At this moment there is no Groovy mechanism that does same thing as @lombok.RequiredArgsConstructor. The main problem in your case is that Groovy always generates no-args default constructor for all currently known features like @Immutable annotation. The closest (but not accurate) way is to use @TupleConstructor like:
@RestController
@TupleConstructor(includes = ['helloService'], includeFields = true, includeProperties = false, force = true)
class HelloRest {

    private final HelloService helloService

    @GetMapping("hello")
    String hello(@RequestParam("name") String name) {
        return helloService.createHelloMessage(name)
    }
}

This Groovy code will produce bytecode similar to this Java code:
@RestController
@TupleConstructor(
    includeFields = true,
    force = true,
    includeProperties = false,
    includes = {"helloService"}
)
public class HelloRest implements GroovyObject {
    private final HelloService helloService;

    public HelloRest(HelloService helloService) {
        CallSite[] var2 = $getCallSiteArray();
        MetaClass var3 = this.$getStaticMetaClass();
        this.metaClass = var3;
        this.helloService = (HelloService)ScriptBytecodeAdapter.castToType(helloService, HelloService.class);
    }

    public HelloRest() {
        CallSite[] var1 = $getCallSiteArray();
        this((HelloService)null);
    }

    @GetMapping({"hello"})
    public String hello(@RequestParam("name") String name) {
        CallSite[] var2 = $getCallSiteArray();
        return (String)ShortTypeHandling.castToString(var2[0].call(this.helloService, name));
    }
}

It is almost what you need, except this default constructor that was generated as well.
Things are getting even more complicated when using @Immutable annotation, because this version would generate 3 constructors:

*

*public HelloRest(HelloService helloService)

*public HelloRest()

*public HelloRest(HashMap args)
Of course in this case you would have to remove private final in front of HelloService field definition, because this AST transformation works only with fields that are not yet final.
In this case two options you have found (creating construct manually or using Lombok) are probably the best solutions to your problem.
Alternative solution
There is also one "dirty" solution that allows you to write less amount of code, but promotes injection by reflection. Consider following code:
@RestController
class HelloRest {

    @Autowired
    private final HelloService helloService

    @GetMapping("hello")
    String hello(@RequestParam("name") String name) {
        return helloService.createHelloMessage(name)
    }
}

It will generate bytecode similar to following Java code:
@RestController
public class HelloRest implements GroovyObject {
    @Autowired
    private final HelloService helloService;

    public HelloRest() {
        CallSite[] var1 = $getCallSiteArray();
        MetaClass var2 = this.$getStaticMetaClass();
        this.metaClass = var2;
    }

    @GetMapping({"hello"})
    public String hello(@RequestParam("name") String name) {
        CallSite[] var2 = $getCallSiteArray();
        return (String)ShortTypeHandling.castToString(var2[0].call(this.helloService, name));
    }
}

Even though there is only single default constructor that does not even touch our helloService field, Spring bean will get injected by reflection. I share this option only to show all alternatives, although your initial instinct to use constructor injection is the best possible way to use dependency injection in practice.

A: You can use @Cannonical or @Immutable on the class. That way the constructor will be created for you


text:
Q: 500.19 Internal Server Error - RequestFilteringModule config error I'm working on a site built on the Telligent Community platform. It comes with a zip of the site that I need to setup and build from. I've setup the site and have been working on it, except the default web.config has one thing that breaks the site, unless I comment it out. The line is <requestFiltering allowDoubleEscaping="true" /> in the following section:
<system.webServer>
  <validation validateIntegratedModeConfiguration="false" />
  <security>
    <requestFiltering allowDoubleEscaping="true" />
  </security>
  ... continues ...

If I comment out the line, my site works. If not, I get this error:
Config Error
This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

One thing I read was to go to applicationHost.config file located in windows\system32\inetsrv\config and change the following values in <sectionGroup name="system.webServer"> to "Allow":

I've made the above changes and done an iisreset and I still get the same error. Does anyone have any ideas that will allow this line in my config to work?

A: You'd actually want to check applicationHost.config (and possibly machine.config) and verify this is set:

redpajama_set_name: RedPajamaStackExchange


text:
Q: Call PHP Static Method using variable I have various PHP classes ('Numerical', 'Alphabetical' etc.) under sub-namespace ('MyNamespace'). I am trying to call this various classes under sub-namespace using php variable like
    class ClassName {
        public static function foo ($MethodName) {

            //$MethodName has value "Numerical"
            //Normal Way of calling 'Numerical'
            MyNamespace\Numerical::MyFunction();

            //What I want to do
            $variable = 'MyNamespace\$MethodName';
                //OR
            $variable = "MyNamespace\$MethodName";

            $variable::MyFunction();    //Option-1 - This does not work
            {$variable}::MyFunction();  //Option-2 - This does not work
        }
    }

A: As of PHP 7 you can use the following syntax:
$variable = "MyNamespace\\".$MethodName."::MyFunction";
$variable();

Check 3v4l.org to see the difference between PHP >= 7.0 and PHP < 7.0
If you are not using PHP with a version of 7.0 or higher you cannot use this syntax. You can check the documentation on variable functions for more information.

A: You should use ' or " in code (about differences read http://php.net/manual/en/language.types.string.php#language.types.string.syntax.single).
Check this out:
https://3v4l.org/cAk7W
<?php

namespace MyNamespace {
    class Numerical {
        public static function MyFunction() {
            echo 'Called ', __FUNCTION__, '!', PHP_EOL;
        }
    }
}

namespace AnotherNamespace {
    class ClassName {
        public static function foo($MethodName) {
            /**
             * Two backslashes because of \$ escapes to $ character and \\ escapes to «backslash» itself
             * @see http://php.net/manual/en/language.types.string.php
             * @see http://php.net/manual/en/language.variables.variable.php
             * @see http://php.net/manual/en/functions.variable-functions.php
             */
            $variable = "\\MyNamespace\\${MethodName}"; // Option one works.
            $variable::MyFunction();
        }

        public static function bar($className) {
            ('\MyNamespace\\' . $className)::MyFunction(); // Option two works in php version >= 7.1
        }
    }

    ClassName::foo('Numerical');
    ClassName::bar('Numerical');
}

Output for php 7.1.0 - 7.2.4:
Called MyFunction!
Called MyFunction!


text:
Q: Javascript iife functions I was following a beginners course of JavaScript and I've come across this code. But I don't understand why sum needs to be an IIFE function. Could you please help me understand how this code works exactly?

const sum = function() {
  return function sum(x, y, z) {
    const args = [x, y, z];
    return args.reduce((a, b) => a + b, 0);
  };
}();
console.log(sum(1, 2, 3))

A: In this case the variable args takes the arguments
const sum = function() {
  return function sum(x,y,z) {
     const args = [1,2,3];
     return args.reduce((a,b) => a+b, 0);};
}();
 console.log(sum(1,2,3))

The reduce() method executes a reducer function for each value of an array.
In this case you are taking first two elements of arrays, finding the sum of these two and the reduce method goes one by one to other elements.
Other example to explain you better
const numbers = [175, 50, 25];

function myFunc(total, num) {
   return total - num;
} // returns 100 (175 - 50 - 25)

A: In that function looks like is just to show you how to work the IIFE(the parentheses at the end of the function) that parenthesis is to auto-execute the function, the use is if you want to execute a function when this load you can add the "()" at the end or "+" at the beginning of the clause "function" like this "+function" to see more in details check the following link:
Immediately-Invoked Function Expression (IIFE)

A: There is no current reason the function is inside another executed function.
These are equivalent except that one gets returned immediately by a function. If I had to guess, the next instruction may talk about scoping or currying?, who knows.

const sum = function() {
  return function sum(x, y, z) {
    const args = [x, y, z];
    return args.reduce((a, b) => a + b, 0);
  };
}();
console.log(sum(1, 2, 3))

const sum = function(x, y, z) {
    const args = [x, y, z];
    return args.reduce((a, b) => a + b, 0);
  };
console.log(sum(1, 2, 3))


text:
Q: JmDNS TXT Field with multiple parameters I am using JmDNS to simulate an Bonjour Service / AirPlay.
ServiceInfo info = ServiceInfo.create(
            "test@AppleTV._airplay._tcp.local",
            "test@AppleTV", 46667, "deviceid=00:11:7F:54:DF:0B features=0x2a7f model=AndroidTV2,1 srcvers=130.14");

JmmDNS dns = JmmDNS.Factory.getInstance();
try {
    ((JmmDNSImpl) dns).inetAddressAdded(new NetworkTopologyEventImpl(
                JmDNS.create(InetAddress.getByName("localhost")),
                InetAddress.getByName("localhost")));
    dns.registerService(info);
    Thread.sleep(1000); // If this isn't done the Announcement sometimes
                            // doesn't go out on the local interface
} catch (Exception e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}

The iPhone doesn't see my device, so I checked the mDNS logs on my MBPR. Result
(1) Working service
_airplay._tcp                                   PTR     ITV@139._airplay._tcp
ITV@139._airplay._tcp                           SRV     0 0 46667 localhost.local. ; Replace with unicast FQDN of target host
ITV@139._airplay._tcp                           TXT     "deviceid=00:11:7F:54:DF:0B" "features=0x2a7f" "model=AndroidTV2,1" "srcvers=130.14"

(2) my non working service
_airplay._tcp                                   PTR     test@AppleTV._airplay._tcp
test@AppleTV._airplay._tcp                      SRV     0 0 46667 android-3e71c0c088c7a603.local. ; Replace with unicast FQDN of target host
test@AppleTV._airplay._tcp                      TXT     "eviceid=00:11:7F:54:DF:0B features=0x2a7f model=AndroidTV2,1 srcvers=130.14"

As you can see the fist char is being cut off. If I add \" before each kv-pair it gives a really weird result. So how can I get the same result as if in (1)?
Thanks!

A: Got it:
Map<String, String> map = new HashMap<String, String>();
    map.put("deviceid", "00:11:7F:54:DF:0B");
    map.put("features", "0x2a7f");
    map.put("model", "AndroidTV2,1");
    map.put("srcvers", "130.14");
    ServiceInfo info = ServiceInfo.create(
            "tt@AppleTV._airplay._tcp.local",
            "tt@AppleTV", 46667,1,1,false, map);


text:
Q: Spring repository sends HQL to database server I have a simple spring data repository which extends CrudRepository
Also I configured
<context:component-scan base-package="by.acme.vt.*"/>

and
 <bean id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="eqDataSource"/>
        <property name="jpaVendorAdapter" ref="jpaVendorAdapter"/>
        <!-- Set JPA properties -->
        <property name="jpaProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
                <prop key="javax.persistence.schema-generation.database.action">none</prop>
            </props>
        </property>
        <!-- Set base package of your entities -->
        <property name="packagesToScan">
            <array>
                <value>by.acme.vt.asdint</value>
                <value>by.acme.vt.asd.domain</value>
                <value>by.acme.vt.asd.repository</value>
            </array>
        </property>
    </bean>

and
<jpa:repositories base-package="by.acme.vt.*" entity-manager-factory-ref="entityManagerFactory"/>

So
by.acme.vt.asdint

belongs to the project which I am working on but packages
 <value>by.acme.vt.asd.domain</value>
 <value>by.acme.vt.asd.repository</value>

belongs to the included jar file
If I create the same repo in the project, it works fine but for repositories which were included in jar, even when I run a simple code like
myrepo.findById(id)

It sends a pure HQL to the server, so it does not transform it to SQL at all.
I see response from mssql like.
table MyUser does not exist on server.

But it supposed to use my_user table but not MyUser


text:
Q: JQuery data selector not updating with .data Basically if I have a div loaded onto a page with a data-test attribute and change the value of it with jquery's .data('test') I can no longer select the element with $('div[data-test="newValue"]')

var howMany = $('.t[data-test="test"]').length;
$('.result').html('start there are ' + howMany + ' divs with data "test"

');
setTimeout(function() {
  $('#one, #three').data('test', 'changed');
}, 500);
setTimeout(function() {
  var test = $('.t[data-test="test"]').length,
    changed = $('.t[data-test="changed"]').length;
  $('.result').append('there are ' + test + ' divs still with data "test"

there are ' + changed + ' divs still with data "changed"

');
}, 1000);
setTimeout(function() {
  $('.t').each(function() {
    $('.result').append('div #' + $(this).attr('id') + ' has the test data of: ' + $(this).data('test') + '

');
  });
}, 1500);

1

2

3

4

A: jQuery .data() is initially populated with values from the data- attributes, but setting it only stores the associated new value in memory. It doesn't change the attribute in the DOM. To change the attribute, you have to use:
$('#one, #three').attr('data-test', 'changed');

The docs are at http://api.jquery.com/jQuery.data/

A: That's because i think that .data() use a special cache object inside jQuery to store data (in fact you can evens store object or complex tipes of data), if you check all the attributes are unchanged. If you want to change the attribute, use attr()


text:
Q: Reshaping data frame based on several conditions I would like to identify activities performed on the same place and with the same person for id during time t. The variable wher denotes time steps and records where the activities take place at time t. The with parameter records the with who the activity was performed at time t. I would like to know the common activities that were performed at the same place and with the same person during time t based on gender. Uncommon activities and activities performed at different place with different person I replaced with 0.
Input
id     DMSex       t1  t2  t3  t4  wher1 wher2 wher3 wher4 wit1 wit2 wit3 wit4
12       M         12  12  12  12  1        1   1     4     8     9    4    0
12       F         10  13  12  12  3        1   1     5     6     5    4    1

Output:
id  t1  t2  t3  t4
12   0   0  12  0

Sample data for 18 time steps:
structure(list(serial = c(11011202, 11011202), DMSex = c(1, 2
), act1_1 = c(110, 110), act1_2 = c(110, 110), act1_3 = c(110,
110), act1_4 = c(110, 110), act1_5 = c(110, 110), act1_6 = c(110,
110), act1_7 = c(110, 110), act1_8 = c(110, 110), act1_9 = c(110,
110), act1_10 = c(110, 110), act1_11 = c(110, 110), act1_12 = c(8219,
110), act1_13 = c(310, 110), act1_14 = c(3210, 110), act1_15 = c(3110,
110), act1_16 = c(7241, 110), act1_17 = c(210, 110), act1_18 = c(3819,
110), wher_1 = c(11, 11), wher_2 = c(11, 11), wher_3 = c(11,
11), wher_4 = c(11, 11), wher_5 = c(11, 11), wher_6 = c(11, 11
), wher_7 = c(11, 11), wher_8 = c(11, 11), wher_9 = c(11, 11),
    wher_10 = c(11, 11), wher_11 = c(11, 11), wher_12 = c(11,
    11), wher_13 = c(11, 11), wher_14 = c(11, 11), wher_15 = c(11,
    11), wher_16 = c(11, 11), wher_17 = c(11, 11), wher_18 = c(11,
    11), wit4_1 = c(0, 0), wit4_2 = c(0, 0), wit4_3 = c(0, 0),
    wit4_4 = c(0, 0), wit4_5 = c(0, 0), wit4_6 = c(0, 0), wit4_7 = c(0,
    0), wit4_8 = c(0, 0), wit4_9 = c(0, 0), wit4_10 = c(0, 0),
    wit4_11 = c(0, 0), wit4_12 = c(0, 0), wit4_13 = c(0, 0),
    wit4_14 = c(0, 0), wit4_15 = c(0, 0), wit4_16 = c(0, 0),
    wit4_17 = c(0, 0), wit4_18 = c(0, 0)), row.names = 1:2, class = "data.frame")

where act1_ is t; wit4 is wit and wher_ is wher

A: One solution combining dplyr and purrr could be:
map(.x = as.character(1:4),
    ~ df %>%
     select(id, ends_with(.x)) %>%
     group_by(id) %>%
     mutate_at(vars(matches("^wher|^wit")), ~ all(. == first(.))) %>%
     ungroup() %>%
     mutate(cond = rowSums(select(.,  matches("^wher|^wit"))) == 2) %>%
     group_by(id) %>%
     mutate_at(vars(starts_with("t")), ~ all(. == first(.)) * cond * .) %>%
     ungroup() %>%
     select(starts_with("t"))) %>%
 bind_cols(df %>%
            select(id)) %>%
 group_by(id) %>%
 summarise_all(first)

     id    t1    t2    t3    t4
  <int> <int> <int> <int> <int>
1    12     0     0    12     0

First, it creates a character vector from 1 to 4 as there are four pairs of variables (from t1, wher1, wit1 to t4, wher4, wit4). The mapping function is applied to these elements. Second, from the df, it individually selects the pairs of variables and checks whether wher and wit are the same across all rows per ID, creating a logical condition. Third, it checks whether the t variable is the same across all rows per ID and compares it with the logical condition from step 2. If TRUE, the original value is returned, if not, then 0. Finally, it combines the data and keeps one row per ID.
A solution for the updated question, with the addition of stringr:
map(.x = str_extract(names(df)[grepl("^act", names(df))], "_.*+$"),
    ~ df %>%
     select(serial, ends_with(.x)) %>%
     group_by(serial) %>%
     mutate_at(vars(matches("^wher|^wit")), ~ all(. == first(.))) %>%
     ungroup() %>%
     mutate(cond = rowSums(select(.,  matches("^wher|^wit"))) == 2) %>%
     group_by(serial) %>%
     mutate_at(vars(starts_with("act")), ~ all(. == first(.)) * cond * .) %>%
     ungroup() %>%
     select(starts_with("act"))) %>%
 bind_cols(df %>%
            select(serial)) %>%
 group_by(serial) %>%
 summarise_all(first)

  serial act1_1 act1_2 act1_3 act1_4 act1_5 act1_6 act1_7 act1_8 act1_9 act1_10 act1_11 act1_12
   <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>   <dbl>   <dbl>   <dbl>
1 1.10e7    110    110    110    110    110    110    110    110    110     110     110       0
# … with 6 more variables: act1_13 <dbl>, act1_14 <dbl>, act1_15 <dbl>, act1_16 <dbl>,
#   act1_17 <dbl>, act1_18 <dbl>


text:
Q: Custom HTMLElement not bubbling click event I am dabbling with customerElements:
customElements.define('state-button',
                    class extends HTMLElement {
                        constructor(...args) {
                            super(...args);
                            this.state = 0;
                            let o=this;
                            this.t = {
                                0:"<button class='btn btn-info'>"+(o.innerHTML)+"</button>",
                                1:"<button class='btn btn-warning'>Are you sure???</button>",
                                2:"<button class='btn btn-danger'>Last chance....</button>"
                            };
                            this.addEventListener("click", this.handleClick,{capture:false});
                        }
                        connectedCallback() {
                            this.setAttribute("data-toggle", "modal");
                            this.setAttribute("data-target", "#confirmModal");
                            this.setAttribute("data-jc_id", this.getAttribute("data-id"));
                            this.render();
                        }
                        render() {
                            console.debug("state", this.state);
                            this.innerHTML=this.t[this.state];
                        }
                        handleClick(event) {
                            this.state = (this.state+1) % 3;
                            this.render();
                        }
                        setState(state) {
                            this.state = state;
                            this.render();
                        }
                    }
                );

This is just me testing how it works. The button is supposed to change state AND open modal Bootstrap4 window. But the modal never gets triggered.
If I add super.click(); inside handleClick() it will change state twice (as the event is triggered again).
If I do not addEventListener the Bootstrap 4 modal window triggers just fine. So it appears my event is stopping other events.
return true; at the end of handleClick has no effect.
What am I missing?

A: I found a way around it to the same effect. But I am sure it is not the correct way of doing it.
When I add the eventlistener  this.addEventListener("click", this.handleClick,{once:true}); it will be removed once triggered. This will cause the bootstrap 4 modal window to trigger as well.
Then at the end of handleClick I just add the click event as above again.
As I said - it is a workaround.
I am still interested in why my event stops other click events....


text:
Q: Why does using a binding an attribute directive seem to call a function assigned to that binding so many times? I have the following button rendered in a modal:
<button class="ui blue compact tiny labeled icon button" [test-case-view-modal]="getSelectedTestCase()"
(save)="updateTestCaseExecuteStatus($event)" (close)="onCloseTestCaseModal()"  (click)="isShowOverlay = true"
[is-execute-test-run]="true" [disabled]="selectedTestCases.length == 0">

  Run
</button>

The component is used like so:
<work-item-modal-testcase [model]="model" [hidden]="subMenu != 'testcase'"></work-item-modal-testcase>

The actual component:
@Component({
  selector: 'work-item-modal-testcase',
  directives: [TestCaseViewModalDirective],
  template: `

      <button class="ui blue compact tiny labeled icon button" [test-case-view-modal]="getSelectedTestCase()"
        (save)="updateTestCaseExecuteStatus($event)" (close)="onCloseTestCaseModal()" (click)="isShowOverlay = true"
        [is-execute-test-run]="true" [disabled]="selectedTestCases.length == 0">

        Run
      </button>
      <button class="ui blue compact tiny labeled icon button" [test-case-view-modal]="sampleTestCase"
        (save)="createTestCase($event)" (close)="onCloseTestCaseModal()" (click)="isShowOverlay = true">

        Test Case
      </button>
      <button class="ui blue compact tiny right labeled icon button">

        Actions
      </button>

                <input type="checkbox">

            Test Case
            Status
            Execute status
            Configuration
            Hrs
            Component
            Assigned
            Start
            End

<input type="checkbox" (change)="toggleTestCaseSelected($event, tc.id)">

            {{ tc.name }}
            {{ tc.status.name }}

               {{ tc.executeStatus }}

            {{ tc.effort }}
              {{ cmp.name }}
              {{ assigner.name }}
            {{ tc.start }}
            {{ tc.end }}

  `
})
class WorkItemModelTestcaseComponent {
  @Input() model: WorkItem;
  // FIXME: workaround for Semantic UI multiple modal: show overlay for disabled lower layer modal.
  private isShowOverlay: boolean;
  private sampleTestCase: SampleTestCase;
  private selectedTestCases: string[] = [];

  constructor(private testCaseService: TestCaseService) {
    this.onCloseTestCaseModal();
  }

  createTestCase(testCase: TestCase) {
    this.model.testCases.push(this.testCaseService.create(testCase));
  }

  onCloseTestCaseModal() {
    this.isShowOverlay = false;
    this.sampleTestCase = new SampleTestCase();
  }

  // TODO: sample code for getting first selected TestCase, or first testCase if Nothing is selected
  getSelectedTestCase(): TestCase {
    console.log("getSelectedTestCase => model => ", this.model);
    let firstSelectedId = this.selectedTestCases[0];
    return firstSelectedId
      ? _.head(_.filter(this.model.testCases, (x) => { return x.id === firstSelectedId; }))
      : this.model.testCases.length > 0 ? this.model.testCases[0] : null;
  }
  toggleTestCaseSelected(event, testCaseId: string) {
    //console.log("toggleTestCaseSelected", testCaseId, event.target.checked, !event.target.checked, event);
    let indexTc = this.selectedTestCases.indexOf(testCaseId);
    if (-1 === indexTc) {
      if (event.target.checked) {
        this.selectedTestCases.push(testCaseId);
      };
    } else {
      if (!event.target.checked) {
        this.selectedTestCases.splice(indexTc, 1);
      };
    };
    console.log("this.selectedTestCases", this.selectedTestCases);
  }

  //-------------------------------------------------
  updateTestCaseExecuteStatus(data: TestCase) {
    console.log("updateTestCaseExecuteStatus");
    this.getSelectedTestCase().executeStatus = data.executeStatus;
  }
}

Basically, I use this button to open a new modal on the screen on click.  I've created a directive that listens to the hosts (click) and loads the new modal next to the location of the click:
@Directive({
  selector: '[test-case-view-modal]',
  inputs: [
    'testCase'
  ],
  providers: [
    TestCaseService
  ],
  host: {
    '(click)': 'onClick()'
  }
})
export class TestCaseViewModalDirective {
  @Input('test-case-view-modal') testCase: TestCase;
  @Output() save: EventEmitter<TestCase> = new EventEmitter<TestCase>();
  @Output() close: EventEmitter<any> = new EventEmitter<any>();
  @Output() start: EventEmitter<any> = new EventEmitter<any>();
  @Input('is-execute-test-run') isExecuteTestRun: boolean;

  constructor(private loader: DynamicComponentLoader, private appRef: ApplicationRef,
      private _testCaseService: TestCaseService) {
        console.log('TestCaseViewModalDirective :: () ');
      }

  onClick() {
    if (this.start) {
      this.start.next(true);
    };
    let appEleRef = this.appRef['_rootComponents'][0].location;
    let bindings = Injector.resolve([
      provide(TestCase, {
          useValue: this.testCase
      })
    ]);
    return this.loader.loadNextToLocation(TestCaseViewComponent, appEleRef, bindings).then(testCaseViewModalRef => {
      let testCaseModelComponent = <TestCaseViewComponent>testCaseViewModalRef.instance;
      testCaseModelComponent.isExecuteTestRun = this.isExecuteTestRun;
      testCaseModelComponent.closeEvent.subscribe(_ => {
      testCaseViewModalRef.dispose();
        this.close.emit(_);
      });
      testCaseModelComponent.saveEvent.subscribe(_ => {
        this.save.emit(_);
      });
      return testCaseViewModalRef;
    });
  }
}

The property binding for the directive calls this function:
  getSelectedTestCase(): TestCase {
    console.log("getSelectedTestCase => model => ", this.model);
    let firstSelectedId = this.selectedTestCases[0];
    return firstSelectedId
      ? _.head(_.filter(this.model.testCases, (x) => { return x.id === firstSelectedId; }))
      : this.model.testCases.length > 0 ? this.model.testCases[0] : null;
  }

When I load the first modal, the output I see from the log message inside the function shows the function gets called several times:
=> triggered change detection
work-items.ts:34 WorkItemModalDirective :: open()
work-items.ts:34 new work item =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 TestCaseViewModalDirective :: ()
work-items.ts:34 TestCaseViewModalDirective :: ()
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}
work-items.ts:34 getSelectedTestCase => model =>  WorkItem {id: "0e2f734e-1d08-481a-b12a-ebf75a07be0d", issueLink: "XX1211", summary: "Newly added work item", description: undefined, project: Object…}

My question that I cannot figure out is why this function gets called so many times upon rendering the button from the first modal (by showing the component)?  I've added logging to add ngOnChange which shows only one change is happening to the parent component (the first modal), and the directive is only loaded once.

A: As mentiond by @kemsky functions (and properties and getters) bound to in the view are evaluated every time change detection happens.
The Angular team discourages binding to functions. Instead store the result in a property and bind to that property.
There is also a common error with bound functions. If your function looks like
someFunc() {
  return ['a'];
}

Angular will throw

Expression has changed after it was checked.

because in devMode Angular runs one additional change detection cycle after each normal change detection cycle and expects the model not to change in between because this indicates that change detection itself causes the model to change which will make your application behave weirdly in production.
An alternative way to storing the value to a property is to set a different change detection strategy for your component
changeDetection: ChangeDetectionStrategy.OnPush

and then tell Angular when to run change detection on your component.
For more details see http://blog.thoughtram.io/angular/2016/02/22/angular-2-change-detection-explained.html

A:
Angular executes template expressions more often than we think. They can be called after every keypress or mouse move. Expressions should finish quickly or the user experience may drag, especially on slower devices. Consider caching values computed from other values when the computation is expensive.

link


text:
Q: I wrote a SQL Query but not Run,WHY? Current Table
EmployeeID  CompanyID   EmployeeCode    EmployeeName
    1001        C001         11919     ABC
    1002        C001         10974         PQR
    1003        C001         11890     XYZ
    1004        C001         11621     LMN

Query like this...
     DECLARE @Empid VARCHAR(MAX)
SELECT @Empid= COALESCE(@Empid +',','')+''''+EmployeeID+'''' FROM cmsEmployee WHERE employeeCode IN('11919','10974','11890','11621' )
print @Empid
SELECT * FROM cmsEmployee WHERE EmployeeID IN( @Empid)

This Not working,Why?

A: It is not working because you can't put a single string into the in clause and expect the engine to parse that.
You can only put in there multiple single values like you did when you used it in the first query.
where id in ('1','2')  -- works beause that are two SEPERATE values
where id in ('1,2')    -- works not because it is ONE string

A: If you write a direct query that consists of multiple sections, you should not forget to add GO to execute each section.
Select ...
GO
Print ...
GO
Select ...

A: If you are in SQL Server you likely need to use dynamic sql; that needs you to build your query up as a string then execute it when its complete
Change your empid declaration to
  DECLARE @Empid VARCHAR(MAX) = 'SELECT * FROM cmsEmployee WHERE EmployeeID IN( '

When you have selected it add a close bracket (you could build the string up in steps if you want to.)
select @empid = @empid + ')'

If you take your print statement it should run when you have it right; to run it in your code
exec sp_exectutesql @empID


text:
Q: Tikz arrows/node not displaying properly with Beamer Working on a presentation where I need to have explanations pointing to parts of an equation with an arrow.
Tried copy-pasting the following 2 examples:
https://texample.net/tikz/examples/beamer-arrows/
How to draw good arrows explaining parts of equation? (the solution provided by jonalv to his own question).
Here is how they are displaying in my slides individually:

It seems all the arrows are pointing/coming out of a single node instead of several. Can someone explain why that is?
Here is my settings file:
\documentclass[hyperref={unicode=true}]{beamer}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}

\usepackage{lmodern}
\usepackage{tempora} % this supports Cyrillic
\usepackage{newtxmath}
\usepackage{bm}
\usepackage{comment}

\usefonttheme{serif}
\usecolortheme{default}
\usefonttheme{professionalfonts}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
\usepackage{appendixnumberbeamer}

\usepackage [section]{placeins}
\usepackage{graphicx} % for pdf, bitmapped graphics files
\usepackage{epsfig} % for postscript graphics files
\usepackage{epstopdf}
\usepackage[caption=false]{subfig}
\usepackage{xcolor}
\usepackage{array}
\usepackage{amsmath}
\usepackage{amssymb}  % assumes amsmath package installed
\usepackage{amsfonts}  % assumes amsmath package installed
\usepackage{bm} % for bold math, improved
\usepackage{cancel}
\usepackage{mathrsfs}  % adds \mathscr for nice capital letters

\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\tikzmark}[1]{\tikz[baseline,remember picture] \coordinate (#1) {};}

\usepackage{tabularx}

\everymath{\displaystyle}

\usepackage{subfig}
\usepackage{cancel}
\usepackage{mathtools}
\newcommand{\sign}{\operatorname{sgn}}
\DeclarePairedDelimiter{\homd}{\lceil}{\rfloor}
\newcommand{\R}{\ensuremath{\mathbb{R}}}
\newcommand\Ccancel[2][black]{\renewcommand\CancelColor{\color{#1}}\cancel{#2}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\graphicspath{{Figs/}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\beamertemplatenavigationsymbolsempty
\usetheme{Boadilla}

\makeatletter
\defbeamertemplate*{footline}{my theme}{
    \leavevmode%
    \hbox{%
    \begin{beamercolorbox}[wd=.9\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
        \usebeamerfont{title in head/foot}Управление по выходу параметрическим неопределенным нелинейным объектом с нарушением условий согласования
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.1\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
        \usebeamerfont{date in head/foot}{}\hspace*{2em}
        \insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
    \end{beamercolorbox}}%
}
\makeatother

\setbeamertemplate{bibliography entry title}{}
\setbeamertemplate{bibliography entry location}{}
\setbeamertemplate{bibliography entry note}{}

\graphicspath{{Figs/}{../Figs/}}
\usepackage{subfiles}

% ------------------- PRESENTATION INFO ---------------------------
\title{ИТЕРАТИВНАЯ ПРОЦЕДУРА СИНТЕЗА АДАПТИВНОГО УПРАВЛЕНИЯ НА БАЗЕ ИНТЕГРАЛЬНОГО АЛГОРИТМА АДАПТАЦИИ}

\date{}
\author[Олег Суздалев, R3435]{\large{\textbf{Докладчик: Суздалев Олег Димитрий}\\
Научный руководитель: Герасимов Д.Н., к.т.н.\\}}

\institute{\large{\centering\\ Университет ИТМО \\ Факультет СУиР \vspace{1em} }}

Thank you in advance!

A:
I use only the second example you were talking about.  I
modified the command \tikzmark (mainly replacing \coordinate with \node which is more natural in the context) and cleaned the code slightly.
The whole code is pasted below.  The first part is your preamble that I didn't touch.  My modifications start after the line of percentages.
\documentclass[hyperref={unicode=true}]{beamer}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}

\usepackage{lmodern}
\usepackage{tempora} % this supports Cyrillic
\usepackage{newtxmath}
\usepackage{bm}
\usepackage{comment}

\usefonttheme{serif}
\usecolortheme{default}
\usefonttheme{professionalfonts}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
\usepackage{appendixnumberbeamer}

\usepackage [section]{placeins}
\usepackage{graphicx} % for pdf, bitmapped graphics files
\usepackage{epsfig} % for postscript graphics files
\usepackage{epstopdf}
\usepackage[caption=false]{subfig}
\usepackage{xcolor}
\usepackage{array}
\usepackage{amsmath}
\usepackage{amssymb}  % assumes amsmath package installed
\usepackage{amsfonts}  % assumes amsmath package installed
\usepackage{bm} % for bold math, improved
\usepackage{cancel}
\usepackage{mathrsfs}  % adds \mathscr for nice capital letters

\usepackage{tabularx}

\everymath{\displaystyle}

\usepackage{subfig}
\usepackage{cancel}
\usepackage{mathtools}
\newcommand{\sign}{\operatorname{sgn}}
\DeclarePairedDelimiter{\homd}{\lceil}{\rfloor}
\newcommand{\R}{\ensuremath{\mathbb{R}}}
\newcommand\Ccancel[2][black]{\renewcommand\CancelColor{\color{#1}}\cancel{#2}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\graphicspath{{Figs/}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\beamertemplatenavigationsymbolsempty
\usetheme{Boadilla}

\makeatletter
\defbeamertemplate*{footline}{my theme}{
    \leavevmode%
    \hbox{%
    \begin{beamercolorbox}[wd=.9\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
        \usebeamerfont{title in head/foot}Управление по выходу параметрическим неопределенным нелинейным объектом с нарушением условий согласования
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.1\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
        \usebeamerfont{date in head/foot}{}\hspace*{2em}
        \insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
    \end{beamercolorbox}}%
}
\makeatother

\setbeamertemplate{bibliography entry title}{}
\setbeamertemplate{bibliography entry location}{}
\setbeamertemplate{bibliography entry note}{}

\graphicspath{{Figs/}{../Figs/}}
\usepackage{subfiles}

% ------------------- PRESENTATION INFO ---------------------------
\title{ИТЕРАТИВНАЯ ПРОЦЕДУРА СИНТЕЗА АДАПТИВНОГО УПРАВЛЕНИЯ НА БАЗЕ ИНТЕГРАЛЬНОГО АЛГОРИТМА АДАПТАЦИИ}

\date{}
\author[Олег Суздалев, R3435]{\large{\textbf{Докладчик: Суздалев Олег Димитрий}\\
Научный руководитель: Герасимов Д.Н., к.т.н.\\}}

\institute{\large{\centering\\ Университет ИТМО \\ Факультет СУиР \vspace{1em} }}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\tikzmark}[1]{%
  \begin{tikzpicture}[baseline, remember picture]
    \node[inner sep=0pt, outer sep=.5ex] (#1) {};
  \end{tikzpicture}
}

\begin{document}

\begin{frame}{Tests}

  This is the example ``How to draw good arrows explaining parts of
  equation?'' you were pointing to in the question.

  \vfill

  \hspace{4em}
  $\tikzmark{V}V
  = \tikzmark{Vp}V_p
  + \tikzmark{Vt}V_t\,\frac{fu\tikzmark{fu}}{fu_t\tikzmark{fut}}$

  \begin{tikzpicture}[overlay, remember picture,
    every node/.style={scale=.7, inner sep=3pt},
    spear/.style={->, blue, shorten <=3pt, shorten >=3pt}]

    \node
    (Ve) [below of=V, node distance=10em, anchor=west]
    {\textsf{distribution volume}};
    \node (Vpe) [below of=Vp, node distance=7em, anchor=west]
    {\textsf{volume water in plasma}};
    \node (Vte) [below of=Vt, node distance=4em, anchor=west]
    {\textsf{volume water in tissue}};
    \node (fue) [above right of=fu, node distance=4em, anchor=west]
    {\textsf{fraction unbound drug in plasma}};
    \node (fute) [right of=fut, node distance=4em, anchor=west]
    {\textsf{Fraction unbound drug in tissue}};

    \draw
    (Ve) edge[spear, out=175, in=-115] (V)
    (Vpe) edge[spear, out=180, in=-110] (Vp)
    (Vte) edge[spear, out=180, in=-105] (Vt)
    (fue) edge[spear, out=182, in=40] (fu)
    (fute) edge[spear, out=180, in=-20] (fut);
  \end{tikzpicture}
\end{frame}

\end{document}


text:
Q: Changing cost matrix has no effect on weka results Thanks in advance for the help.
I am trying to train a binary classifier on a dataset containing about 10000 samples.  This dataset is imbalanced with a ratio between the two classes of about 1:9.  I would like to increase the cost of misclassification of the lower occurring class but no matter what method I use, nor what cost matrix I use, I get the same results (basically the output of a zeroR model).  I would expect to see at least some difference for different cost matrices when using logistic regression which has not been the case.  I am using weka 3-7-11.  I have noticed that only libLinear (not a stock classifier) gives predictions that are significantly different from zeroR.  I have not noticed this with libSVM.  This seems very weird to me.  What might be going on?

A: I was able to figure out what was going on.  @FilipMalczak was partially correct.  You cannot use the cost matrix tool under the "More Options" button; it doesn't work. Instead, you have to pick meta/CostSensitiveClassify as your classifier and then within the options for this (reached by clicking on the name of the classifier; not within the pulldown menu mind you) assign the cost matrix and actual classifier you want.


text: Q: intersection of a parabolic subgroup with a subgroup I'm interested in the following question: let $k$ be a field of characteristic zero (just for simplicity), $G$ a connected semi-simple $k$-group, $P\subsetneq G$ a parabolic $k$-subgroup, and $H\subsetneq G$ a connected $k$-subgroup. Assume that $H\nsubseteq P$, then does the intersection $H\cap P$ becomes a parabolic $k$-subgroup for $H$? One might even assume that $H$ is reductive.


text:
Q: Minify Arrays with chrome set My following code works. However is there anyway to condense/minify it?
chrome.storage.local.get({wsitemnumberget: [], wstitleget: [], wspecialpriceget: [], wspecialprevpriceget: [], wspecialdeldateget: []}, function (result) {
var wsitemnumberget = result.wsitemnumberget;
var wstitleget = result.wstitleget;
var wspecialpriceget = result.wspecialpriceget;
var wspecialprevpriceget = result.wspecialprevpriceget;
var wspecialdeldateget = result.wspecialdeldateget;

var witenumfetch = $('#wsitemnumber').text();
var wspecialtitlefetch = $('#title').val();
var wspecialprice = $('.mwsb-wsp').text();
var wspecialprevprice = $('.mwsb-prevprice').text();
var wspecialdeldate = $('.mwsb-deldate').text();

wsitemnumberget.push({WSItemNumber: witenumfetch});
wstitleget.push({WSTitle: wspecialtitlefetch});
wspecialpriceget.push({WSPrice: wspecialprice});
wspecialprevpriceget.push({WSPrevPrice: wspecialprevprice});
wspecialdeldateget.push({WSDELDate: wspecialdeldate});
chrome.storage.local.set({ wsitemnumberget: wsitemnumberget, wstitleget: wstitleget, wspecialpriceget: wspecialpriceget, wspecialprevpriceget: wspecialprevpriceget, wspecialdeldateget: wspecialdeldateget });`

Currently the above code puts all the sections into arrays with names using push.
However is there a way to keep my names with the data and minify the code and output using jquery?

A: Managed to minify this and it still works.
Possible to go even smaller than this?
chrome.storage.local.get({wsitemadded: []}, function (result) {
var wsitemadded = result.wsitemadded;

var witenumfetch = $('#wsitemnumber, .mwsb-wsp, .mwsb-prevprice, .mwsb-deldate').text();
var wspecialtitlefetch = $('#title').val();
var wspecialprice = $('.mwsb-wsp').text();
var wspecialprevprice = $('.mwsb-prevprice').text();
var wspecialdeldate = $('.mwsb-deldate').text();
var wspecialimg = $('#postad-img-0 div img').attr('src');

wsitemadded.push({WSItemNumber: witenumfetch, WSTitle: wspecialtitlefetch, WSImage: wspecialimg, WSPrice: wspecialprice, WSPrevPrice: wspecialprevprice, WSDELDate: wspecialdeldate});
chrome.storage.local.set({ wsitemadded: wsitemadded });
});`


text:
Q: Transaction settings while using Message-Driven-Channel-Adapter and DMLC I am using Message-Driven-Channel-Adapter with DMLC.
 Should i set both ?
    1) acknowledge="transacted" in Message-Driven-Channel-Adapter and
    2) sessionTransacted as true in DMLC

 Or is it enough to set acknowledge="transacted" in Message-Driven-Channel-Adapter alone.

When i set acknowledgement in Adapter alone , the performance looks good. But when exception is thrown from error handler, the message is not rolled back.
If I set acknowlegment in both, the performance looks poor but the message rolls back properly
Please advise.

A: If you are injecting a DMLC via the container attribute, you must set sessionTransacted on the DMLC.


text:
Q: A suggestion for Spivak's book I am starting to venture through the book "Calculus on Manifolds " by Michael Spivak . At the end of the first chapter , it mentions about a transformation matrix.  I haven't learned Linear Algebra ,so I was wondering if it would be fine to skip the understanding of this transformation matrix and continue to chapter 2.
Waiting for suggestions .

A: Ummm. Some things in mathematics build heavily on others. You need to know linear algebra before you can make any headway on differential geometry. Continue to chapter 2 and you are just going to find even more linear algebra throughout.
Linear algegra is key to much of multi-dimensional analysis and geometry. I strongly urge you to get a basic understanding of it before tackling those subjects.


text:
Q: jacocoTestReport task failed with error: malformed input off : 17, length : 1 I have a problem with task :jacocoTestReport. gradle clean build task for my Gradle Java project (Spring Boot) failed with error:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jacocoTestReport'.
> java.lang.IllegalArgumentException: malformed input off : 17, length : 1

I have chcp1251 archives files in my test resource and resource folders:

And I think it's cause of jacoco task failed, but I'm my not sure. Here is my build.gradle file:
plugins {
    id "java"
    id "idea"
    id "groovy"
    id "jacoco"

...

test {
    useJUnitPlatform()
    finalizedBy jacocoTestReport
}

jacocoTestReport {
    dependsOn test

    reports {
        html.enabled false
        xml.enabled true
    }
}

Can you help me with this problem, please? Maybe I cant set charset for jacoco?

A: jacoco doesn't support encoding not in UTF-8. I recreate my archive in test resource folder with new name without spaces and cyrillic symbols. And it's works fine.
Update (2023-02-26). Also I removed my chcp1251 files from build in build.gradle via:
sourceSets {
    main {
        resources {
            exclude '**/*.edt' // file extension of my `chcp1251` archives
        }
    }
}


text:
Q: symfony 2.5 many to one relation foreign key null i have two entities produit entity and avis with a many to one relation one product can have many avis but when i try to save a comment the field produit_id stay null. i have well configured the relation i think that i have a problem in the controller.
this is my controller add avis action:
public function addAction(Request $request){
    $em =$this->getDoctrine()->getManager();
    $produit=$em->getRepository('redeBundle:produit')->findAll();
    $avis = new avis();
    $avis->setCreatedAt(new \DateTime('now'));
    $form = $this->createForm(new avisType(), $avis);
    $form -> handleRequest($request);
    if($form->isSubmitted() && $form->isValid()){
       $avis->setProduit($produit);
        $em->persist($avis);
        $em->flush();
        return $this->redirect($this->generateUrl('produit_page'));
    }

    $formView=$form->createView();

    return $this->render('myBundle:avisAdd.html.twig',
     array('form'=>$formView));

}

this is my entity avis
class avis {

/**
 * @var produit
 *
 * @Assert\valid()
 *
 * @ORM\ManyToOne(targetEntity="redemaroc\redeBundle\Entity\produit",
cascade={"persist"})
 * @ORM\JoinColumn(nullable=false)
 *
 *
 */
private $produit;

 ...
 }

can someone help me resolve that ?!

A: It is solvable by using on of those solutions

*

*in the setProduit method of your Avis class, you add the following instruction: produit->addAvis($this);.

*Make sure that anytime you call $avis->setProduit($produit);, you must add $produit->addAvis($avis); before flush your data.

I am supposing that addAvis is the method used to add a given avis to your produit.


text:
Q: Locking a static field I'm maintaining an application that consumes a common library that
has a static instance of a class(ClassWrapper). This class is a basically a wrapper around the
Microsoft patterns and practices's CacheManager (v3.1 of the EL)
The library is hosted in a web application and also in a windows service app,
(both are inherently multi threaded)
There are a bunch of places in the app that invokes an Add method on
this wrapper which in turn calls the Add on the cache manager to add an item
to the cache manager.
As I understand, the CacheManager is not thread safe and the CacheWrapper does not
perform any locking to ensure thread safety in the call to Add.
I cannot modify the library code directly to add synhronization code and am
considering writing a helper method like so and modifying all call sites to use this
helper instead of calling the Add on the wrapper directly.
class CacheHelper
{
    private static object _syncLock = new object();

    public static void Add<T>(CacheWrapper wrapper, string key, T value, int expireInMins)
    {
        lock (_syncLock)
        {
            wrapper.Add(key, value, expireInMins);
        }
    }
}

Do you see any problems with this approach. I'm a bit weary since the CacheWrapper is static and hence inherently so is the _syncLock.
I feel a bit uneasy locking on static objects, but I don't have much of a choice since the
CacheWrapper is a static instance exposed all throughout the process space of the host
(web app  and the windows service).
Any advice or vote of confidence would be much appreciated.

A: I am not sure about CacheManager being not thread-safe. Check this MSDN article - it states clearly:

Every method call made through the
  CacheManager object is thread safe.

Now, coming to your implementation, I am not certain why you are passing the CacheWrapper instance to your methods. CacheWrapper being static instance you can refer it directly such as
class CacheHelper
{

    private static CacheWrapper GetWrapper()
    {
       return [Lib Namespace].[Class Name].[Field Name referring to CacheWrapper];
    }

    public static void Add<T>(string key, T value, int expireInMins)
    {
        var wrapper = GetWrapper();
        lock (wrapper)
        {
            wrapper.Add(key, value, expireInMins);
        }
    }

    ...

Again, GetWrapper is a factory method and implementation can change - it can use a static delegate to get CacheWrapper instance OR use dependency injection to get the reference to CacheWrapper.
Another advantage here is that if there are multiple instances for CacheWrapper then you would take lock only on one that you are using currently.


text:
Q: Show — autorange possible? Given the following simple code:
With[{msm = RandomReal[{58., 62.}, 27]},
Manipulate[
 meanval = Mean[msm];
 dif = msm - meanval;
 var = variance[dif];
 sigma = Sqrt[var];
 ulnsigma := meanval + n*sigma;
 llnsigma := meanval - n*sigma;
 Show[
  Plot[{meanval, ulnsigma, llnsigma}, {x, 0, Length[msm] + 1},
   PlotStyle -> {Red, {Pink, Dashed}, {Pink, Dashed}},
   PlotRange -> {Min[msm]*0.99, Max[msm]*1.01}],
  ListLinePlot[msm, PlotMarkers -> Automatic,
   PlotStyle -> {Thin, Dashed}]
  ],
 {{n, 1., "n-Sigma"}, {1, 3, 4, 5, 6}, ControlType -> PopupMenu},
 Initialization :> (
   variance[x_] := Total[x^2]/(Length[x] - 1))]
]

I have the problem, that Show scales the graph according to the first plot in the list, which is disturbing, because the other plots could eventually be out of range and not entirely visible... As you can see, I've also tried to "cheat" it with a PlotRange but I'm still not getting the wished results. I would have thought that Show should have an "autorange" option, so that it makes all the contained plots visible... or am I missing something?
Here an example, where you cannot see the dashed limit-lines for values of n other that 1...


text:
Q: Jekyll not displaying images from Github repository I just created a Jekyll blog using the minima theme and wanted to embed some images.
If I do the following I can embed an image from a Github page:
![Logo Jekyll](http://memofil.github.io/assets/images/categories/jekyll-logo.png)
However, if I try to embed an image from a Github repository I end up with a broken link and no image is shown:
![Screenshot](https://github.com/jekyll/minima/blob/master/screenshot.png)
Why is that the case?
I used the command sudo bundle exec jekyll serve to test the site.

A: It seems that you can only add an image from a Github repository if you use the raw link.
Doing this
![Screenshot](https://raw.githubusercontent.com/jekyll/minima/master/screenshot.png)

instead of this
![Screenshot](https://github.com/jekyll/minima/blob/master/screenshot.png)

solved my problem.


text:
Q: How to disable autoformat in LibreOffice 6 Calc? I am using LibreOffice Version: 6.1.5.2
I cannot find a way to remove autoformat from Calc.
I am trying to enter 00:10:00 as a value and it keeps converting it to 12:10:00 AM. This is a timecode and I need to build a lot of these.
I have looked online but all I found was a post from 2012 and that is not applicable. I also would really only like to ignore a column and not turn it off completely but for now I will take a full removal of autoformat. I'm sure it has the capability but I cannot find it at all.
I have tried to Clear Direct Formatting but then it converts my value to 0.00694444444444444... This is pretty frustrating so I am hear asking for help.
Thanks

A: Select an input area, right-click it and select "Text" format.
That will disable auto formatting.
I added 00:10:00 to LO Calc 5 and it didn't change though.
Probably they added some automation in the 6 version.


text:
Q: Take rows that share a value in one column and combine values from another column in pandas dataframe I have a pandas dataframe with multiple rows that can share an ID. Each row also has a value for the "label" column. What I would like is to combine all the labels that share the same ID.
For example, say this is what I have:
id | label
-----------
 1    a
 1    b
 2    a
 2    c
 2    d
 3    e

What I would like is something like this:
id | label_list
----------------
1      [a,b]
2      [a,c,d]
3      [e]

So the labels that shared the same ID were combined and made into a list. What would be the most efficient way to do this?

A: You need
df.groupby('id').label.apply(list).reset_index()

id       label
1       [a, b]
2    [a, c, d]
3          [e]

A: This solution is very similar to @Vaishali's solution, but it uses .agg() instead of .apply() method:
In [110]: df.groupby('id', as_index=False)['label'].agg(lambda x: x.tolist())
Out[110]:
   id      label
0   1     [a, b]
1   2  [a, c, d]
2   3        [e]


text:
Q: Database schema for users, games, historical relationships I'm trying to determine the best organization of my database.  I have a users table that has a column for each individual's current_game.  (Each user can only belong to one game at any given time.)  There is a games table where each particular game has a unique id.
I can perform all of my queries/operations just fine this way.  However, I want to maintain a record of each users prior games, so that they can access their historical data and statistics.
Since games only last for so long--weeks, say--and since not all users will always be actively engaged in a game, this is the schema I was considering:
users, users_inactive, games, games_old, game_events, game_events_old
My concerns are 2: First, is two users tables going to be problematic for logins and registrations?  Second, do I have to maintain a two column membership table with a row for every user-game relationship (so 8 users each having been in 5 past games means 40 rows in the membership table), or is there a simpler, more elegant way?

A: My suggestion would be introduce a boolean column to indicate whether the entity is active or not.
For example,  instead of "games" and "games_old" tables, I would use game_active (boolean column) in "games" table and eliminate the "games_old" table.  In the business logic, you will have to mark the new games as active and old games as inactive.
The same logic applies to other tables as well.
The constraints will  look like,
PRIMARY KEY (`user_id`, `game_id`),
INDEX `idx_user_id` (`user_id`),
INDEX `idx_game_id` (`game_id`),
CONSTRAINT `fk_users_user_game` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT `fk_games_user_game` FOREIGN KEY (`game_id`) REFERENCES `games` (`game_id`) ON UPDATE NO ACTION ON DELETE NO ACTION

A: I would remove the current_game column from the users table and add a new table that connects users with games together with a start and end timestamp. Something along the lines of:
CREATE TABLE user_games (
    user_id INT,
    game_id INT,
    start TIMESTAMP NOT NULL,
    end TIMESTAMP
);

For the current game, you would set end to NULL. When a user switches to a different game, update end and add a new row for the new game.
In order to query for the current game, just join the table on the condition that end is NULL. To query for historic games, just make sure the timestamp is between start and end.

A: Perhaps a GameHistory table
UserId | GameId

1      | 563

I imagine the start and end date would be stored in the Games table. You could still store the current games id in the user table or create a bit field in the GameHistory table which would be called current game.


text:
Q: Iframes containing phps files are automatically downloaded I really don't understand this, I created several tutorials that contain iframes with phps files(examples of code). On my localhost server they were displayed fine, now that I've uploaded it to my webhost it starts downloading the iframes sources when I open the tutorials.
What can be the cause of this??


text:
Q: Formatting cell based on adjacent cell value I would like a cell to be color filled or formatted based on the value in the adjacent cell. For example, if cell D1= #NA then I want the font in C1 to be filled in red.I would like to compare entire range in column C and D for this.  Is there any conditional formatting rules or VBA macro that can accomplish this?

A: Very simply select the range you want in column C and just make a conditional format using an equation and use
=$D1=""

and change the format text color to what ever you want.

A: To apply such a format to C3 based on the contents of D3:

*

*Select C3

*In Conditional Formatting click New Rule...

*Select "Use a
        formula to determine which cells to format"

*For the formula enter
            "=ISNA($D$3)"

*Click the Format button to set up the format that gets
                applied when the previous formula returns TRUE

Hope that helps

A: Conditional formatting would be easiest way to do this.
If under conditional formatting you select new rule and then "use a formula to determine which cells to format". A formula such as =$D$1="#na" and change the format to what you would like. If you click OK and make sure this applies to C1 and stop if true is selected.
This worked for me! If you would like to use vba then let me know.

A: Conditional Formatting can do this. Pick the "Use a formula to determine which cells to format", enter
=7=ERROR.TYPE(D1)
Set the red fill.  Now copy & apply to entire column.


text:
Q: (I assume trivial) floor function problem. Question. What is the floor of $$x=\frac{5(\sqrt{13}+2)}{9}.$$

My attempt. For brevity; I will denote $f(x)$ as the floor of $x$. Now, observe $3<\sqrt{13}<4$. Then, my naive approach has $$f\Big(\frac{5(\sqrt{13}+2)}{9}\Big)=f\Big(\frac{5\cdot 3+10}{9}\Big)=f\Big(\frac{25}{9}\Big)=2.$$ But having looked this value up in a calculator, it is rougly $3.1141...$ which gives the floor of $3$ of course.

So where have I gone wrong?

Reflection. Thank you to all that have helped me with this. I will be wary on improving my bound next time.

A: $$ 325 > 289  $$
$$  \sqrt{325} > \sqrt{289}  $$
$$  \sqrt{5^2 \cdot 13} > \sqrt{17^2}  $$
$$ 5 \sqrt {13} > 17  $$
$$ 5 \sqrt {13} + 10 > 27  $$
$$ 5 ( \sqrt {13} + 2) > 27  $$
$$ \frac{ 5 ( \sqrt {13} + 2)}{9} > 3  $$

A: You've gone wrong in assuming that you could just substitute the $3=\lfloor\sqrt{13}\rfloor$ when caluculating the floor of an expression containing $\sqrt{13}$. Just to show you how wrong that is $\lfloor 5\sqrt{13}\rfloor=\lfloor\sqrt{325}\rfloor\approx\lfloor 18.027756\rfloor=18$ while $5*\lfloor\sqrt{13}\rfloor=15$.


text:
Q: Equivalence properties for distribution in probability theory Let $Q_0$ and $Q_1$ be distributions on $\mathbb{R}$ with distribution function $G_0$ and $G_1$ respectively. I am trying to show that

*

*$G_0(y) \geq G_1(y), y \in \mathbb{R}$

*$G_0(y-) \geq G_1(y-), y \in \mathbb{R}$

*$\int h dQ_0 \leq \int h dQ_1 \: \: \: \text{for any non decreasing function} \: \: \: h: \mathbb{R} \to [0,\infty)$

these three are equivalent.
My idea was to use: $Z \geq 0$
$$\mathbb{E}(Z)=\int_{0}^{\infty}\mathbb{P}(Z \geq t)dt=\int_{0}^{\infty}\mathbb{P}(Z > t)dt$$
Any idea to proceed would be appreciated.

A: 1) implies 2) follows by taking limits. 2) implies 1) follows by noting that distribution functions are continuous except at countable many points, so we get $G_0(y) \geq G_1 (y)$ at all but countable many points; but distribution functions are also right-continuous at all points so we get 1). 3) implies 1)  follows by taking $h=I_{(y,\infty)}$. The tricky part is 1) implies 3). There are several approaches but I think the following is an elegant one. Consider $(0,1)$ as  a probability space by providing it with Borel sigma algebra and Lebesgue measure. Let $X(\omega)=\inf \{t:G_0(\omega) \geq t\}$. This is the so-called generalized inverse of $G_0$. One check easily that $X(\omega) \leq t$ if and only if $G_0(\omega) \geq t$ and this implies that $G_0$ is the distribution function of $X$. Similarly let $Y(\omega)=\inf \{t:G_1(\omega) \geq t\}$ so $G_1$ is the distribution function of $Y$. By 1) it follows that $X(\omega) \leq Y(\omega)$ for all $\omega$. Hence $h(X(\omega)) \leq h(Y(\omega))$ for all $\omega$. Taking expectation we get 3)..


text:
Q: Formula with features: unity at zero, zero at inf and control over the shape I would like to seek help in finding a formula for following shape and behavior with controllability over behavior.
with following features: y=f(x)

*

*y-> unity (or controllable constant) as x->0

*y->0 as x->inf

*Steep  fall after x=constant

*Control over the average slope of the steep. for example, slope at y=0.5. (lover  priority)

*Graph y=f(x) would be something like:

Thanks
SAM


text:
Q: Why cant I move JLabel Icon? Why cant I change the x and y coordinates of the icon? All I really need is to add the image to the screen. Do I even need to use a JLabel?
package bit;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class BIT extends JFrame
{
    JLabel CL;

    public BIT()
    {
        CL = new JLabel(new ImageIcon(this.getClass().getResource("final-image.jpg")));
        CL.setBounds(0,0,100,100);

        this.getContentPane().add(CL);

        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setBounds(5,5,1000,500);
        this.setResizable(false);
        this.setVisible(true);
    }
    public static void main(String[] args)
    {
        new BIT();
    }
}

A: Unset the layout of the JFrame before adding controls with setBounds
this.setLayout(null);

A: You cannot set the x & y coordinates of the JLabel as the JFrame is using its default BorderLayout layout manager which arranges its components according to layout implementation.
setBounds only works when using absolute positioning (or null layout) and this option should be avoided(!).
It appears you are trying to position the JLabel in the top left-hand corner of the frame (0, 0). To do this you could:

*

*Left-align the label

*Add the label in the PAGE_START position

This would be:
CL = new JLabel(new ImageIcon(...), JLabel.LEFT);
this.getContentPane().add(CL, BorderLayout.PAGE_START);


text:
Q: Is there a way to edit Parse database entries through the dashboard? Is it possible to edit a string in a class on the Parse dashboard? For example, I have the following code:
PFObject *announcement1 = [PFObject objectWithClassName:@"Announcement1"];
announcement1[@"Body"] = @"Changes to training progression";
[announcement1 saveInBackground];

Essentially what I am trying to do is treat Parse like a database. I create a PFObject, call the class "Announcement1" and display the string "Body" in a label.
I've already created the query to pull the "Body" string in the label:
PFQuery *announcement1Query = [PFQuery queryWithClassName:@"Announcement1"];
[announcement1Query getObjectInBackgroundWithId:@"GvuO1ZUYwR"];
NSString *announcement1BodyText = announcement1[@"Body"];
announcement1Label.text = announcement1BodyText;

Now my question is, would it be possible to then go into my Parse dashboard and edit the "Body" string so as to update the label live with new information each time? If not, what would be the best way to go about doing this?
Thanks, Mustafa

A: Yes. You can update data in parse using dashboard. Parse doesn't support realtime DB, so you need to query the object or refresh object again to see the real data.


text:
Q: Display .png image on a web page i want to display images in my page, But the problem i am facing is my web page displaying all .jpeg images but it is not displaying *.png images why is it??
$.getJSON("http://192.168.1.9:8983/solr/db/select/?wt=json&&start=0&rows=100&q="+q+"&json.wrf=?", function(result){
    var html="";
    // If no search results
    if(result.response.numFound==0)
    {
     html+= "
We're sorry, we found no results for "+document.getElementById("queryString").value;
    }
    else
    {
      html+= "
Total Results Found  "+ result.response.numFound+" for "+""+document.getElementById("queryString").value+" keyword";
        // Parse solr response and display it on web page
            $.each(result.response.docs, function(i,item){
             var src1=item.image;
             // Check if there is a image
                if(src1!= null && src1!= ""){

                      html+="

"+"";
                  }
            // If not insert a default image
                  else
                  {

                      src1="images/products/default.bmp";
                      html+="

"+"";
                  }
                  html += "
UID_PK: ="+ item.UID_PK;
                  html += "
Name: ="+ item.name;
                 // html += "
Description: ="+ item.description;
                 html+="
Price:="+item.price
            });
    }

            $("#result").html(html);

A: First try manually loading the images using the URL bar of your browser. If that works then there is a problem with your  tag or file path. Use Firebug or similar browser plugin to track it down.
If that doesn't work, and the file definitely exists, then it could be a MIME type issue with the server or file permissions. Check your server's error log for more information.
Hope that helps

A:

A: Check the file access permissions on your PNGs.


text:
Q: Laravel passport logs users out after deployment Everytime we use CD for production deployment of our Laravel application authenticated with Passport package, logged in user are being logged out.
We use passport for API auth purposes.
Any solution how we can stop users from being logged out?
Specs:

Laravel version: 7
Passport version: 9
Session driver: file & redis tested (although passport doesn't use it)


text:
Q: URLField appending to 'http://127.0.0.1:8000/' I have a ULRField that I'm trying to link using href but when I click it I am takn to something like http://127.0.0.1:8000/www.example.com rather than www.example.com
models.py
class Website(models.Model):
    website = models.URLField(max_length=100)

template.html
{{ dealer.website }}

A: Moving my comment to an answer:

Save the value with the https:// protocol.


text:
Q: How to wrap text not part of a tag in a tag? I'm trying to highlight (with <mark) a search string inside another string, but it shouldn't be part of a tag (i.e. te in  shouldn't match, but te in test should). I've been using code like this to replace the match with the second regex listed, but that only works nestted.
someElement.innerHTML.replace(regex, function(full, before, match, after) {
  return before + '' + match + '' + after;
});

Suggestions I have tried:

*

*<\/\w*>(\w*\s*)*(te)(\w*\s*)*<([a-z]*\s*\w*="\w*")*> (doesn't match at all?)

*(<.+?>[^<>]*?.*)(te)(.*[^<>]*?<.+?>) (only works on the nested tags)

*((<.+?>[^<>]*?)?.*)(te)(.*([^<>]*?<.+?>)?) (.replace gives undefined's)

Example:
String to wrap: te
Input text:
'This is a test string'
 — some test wrapped too

Expected output:
'This is a test string'
 — some test wrapped too

I've browsed a lot of "duplicates", but couldn't find an exact one, but if someone can lead me to a working example, that'd be lovely too, thanks!
An answer that's now deleted which worked the best for me is (te)(?![^<]*>) (by revo). This does however not work if the next char is >, but I'll see that as a unsolved edge case.

A: Regex:
(te)(?!\w*>)

It benefits from a negative lookahead to check if it is within an opening / closing tag or not. (?!\w*>) this will ignore any te that is followed by any word characters and > (which possibly denotes being within a tag name.)
Failing case:
When there is potentially a string like test> (unpaired) within input string even though it is not a tag it doesn't match.
Live demo


text:
Q: Mail is not sending forget password link using SendsPasswordResetEmails class in laravel here is my code..
reset password view is open but when i put mail id and click on sent it redirect login page but mail not received. please help... thanks in advance
reset.blade.php
@extends('layouts.app')

@section('content')

                    @if (session('status'))

                            {{ session('status') }}

                    @endif
                    <form role="form" method="POST" action="{{ url('/password/reset') }}">
                        {{ csrf_field() }}

                        <input type="hidden" name="token" value="{{ $token }}">

@lang('forms.reset_password')

has('email') ? ' has-error' : '' }}">
                            @lang('forms.email')
                            <input id="email" type="email" class="form-control" name="email" value="{{ $email or old('email') }}" required autofocus>
                            @if ($errors->has('email'))

                                        {{ $errors->first('email') }}

                            @endif

has('password') ? ' has-error' : '' }}">
                            @lang('forms.password')
                            <input id="password" type="password" class="form-control" name="password" required>
                            @if ($errors->has('password'))

                                    {{ $errors->first('password') }}

                            @endif

has('password_confirmation') ? ' has-error' : '' }}">
                            @lang('forms.confirm_password')
                            <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
                            @if ($errors->has('password_confirmation'))

                                    {{ $errors->first('password_confirmation') }}

                            @endif

                            <button type="submit" class="btn btn-primary">
                                @lang('buttons.reset_password')
                            </button>

                    </form>

@endsection

route file(web.php)
 Route::post('/password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail');

.env file
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=mymail@gmail.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tsl

ForgotPasswordController.php(controller)
<?php
/**
 * Indusrabbit - SMM Panel script
 * Domain: https://indusrabbit.com/
 * Codecanyon Item: https://codecanyon.net/item/indusrabbit-smm-panel/19821624
 *
 */
namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;

class ForgotPasswordController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Password Reset Controller
    |--------------------------------------------------------------------------
    |
    | This controller is responsible for handling password reset emails and
    | includes a trait which assists in sending these notifications from
    | your application to your users. Feel free to explore this trait.
    |
    */

    use SendsPasswordResetEmails;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }
}

?>
SendsPasswordResetEmails.php file (locate in vendor laravel/framework)
<?php

namespace Illuminate\Foundation\Auth;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;

trait SendsPasswordResetEmails
{
    /**
     * Display the form to request a password reset link.
     *
     * @return \Illuminate\Http\Response
     */
    public function showLinkRequestForm()
    {
        return view('auth.passwords.email');
    }

    /**
     * Send a reset link to the given user.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
     */
    public function sendResetLinkEmail(Request $request)
    {
        $this->validateEmail($request);

        // We will send the password reset link to this user. Once we have attempted
        // to send the link, we will examine the response then see the message we
        // need to show to the user. Finally, we'll send out a proper response.
        $response = $this->broker()->sendResetLink(
            $request->only('email')
            //$data['email']
        );

        return $response == Password::RESET_LINK_SENT
                    ? $this->sendResetLinkResponse($response)
                    : $this->sendResetLinkFailedResponse($request, $response);
    }

    /**
     * Validate the email for the given request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return void
     */
    protected function validateEmail(Request $request)
    {
        $this->validate($request, ['email' => 'required|email']);
    }

    /**
     * Get the response for a successful password reset link.
     *
     * @param  string  $response
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
     */
    protected function sendResetLinkResponse($response)
    {
        return back()->with('status', trans($response));
    }

    /**
     * Get the response for a failed password reset link.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  string  $response
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
     */
    protected function sendResetLinkFailedResponse(Request $request, $response)
    {
        return back()->withErrors(
            ['email' => trans($response)]
        );
    }

    /**
     * Get the broker to be used during password reset.
     *
     * @return \Illuminate\Contracts\Auth\PasswordBroker
     */
    public function broker()
    {
        return Password::broker();
    }
}

A: I'm not a Laravel Dev, but In your .env file, your MAIL_ENCRYPTION should be tls or maybe ssl.
MAIL_ENCRYPTION=tls

A: Spelling is wrong in the email encryption. It should be tls instead of tsl. I've used ssl which is working perfectly.
So,
Your environment configuration should look like this,
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=youremail@gmail.com
MAIL_PASSWORD=yourpassword
MAIL_ENCRYPTION=ssl

And make sure to clear configuration cache with following command,
php artisan config:cache

I hope you will understand.


text:
Q: Android Studio app keeps crashing after button click Im a beginner in java but I'm trying to build exercises and I ran into this problem. The user types in a donation, presses the button and the value of donations increments. Ive written the entire code but when I click the button to add to the donation count, the app crashes. Ive followed all the teachings of my teacher. I create a method in the activity, the in the ui builder I go to the button on click property and set it to that method. It should go smoothly but it crashes whenever I click the button. This is my activity which I set the onClick property to computeDonation.
public void computeDonation(View v){

    String addedText = ((EditText)findViewById(R.id.AmountText)).getText().toString();

    DonationModel donation = new DonationModel(addedText);
    String answer = donation.calcDonation();

    ((TextView)findViewById(R.id.totalText)).setText(answer);
}

This is the model:
String textAdded;
double addedDonation;

public DonationModel(String y) {
    textAdded = y;
}

public String calcDonation(){
    double counter = Double.parseDouble(textAdded);
    addedDonation += counter;

    Locale locale = new Locale("en", "CA");
    NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);

    return fmt.format(addedDonation);

}

Ive even tried without the number format just to see if it sends back to the activity but it doesn't. BTW for my class I'm using an older version of android studio.
This is the logcat:

02-15 17:12:28.797 21619-21619/ca.roumani.donations E/AndroidRuntime: FATAL EXCEPTION: main
Process: ca.roumani.donations, PID: 21619
java.lang.IllegalStateException: Could not execute method for android:onClick
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:293)
at android.view.View.performClick(View.java:5197)
at android.view.View$PerformClick.run(View.java:20909)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
at android.view.View.performClick(View.java:5197)
at android.view.View$PerformClick.run(View.java:20909)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.NumberFormatException: Invalid double: ""
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.parseDouble(StringToReal.java:267)
at java.lang.Double.parseDouble(Double.java:301)
at ca.roumani.donations.DonationModel.calcDonation(DonationModel.java:20)
at ca.roumani.donations.DonationActivity.computeDonation(DonationActivity.java:24)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
at android.view.View.performClick(View.java:5197)
at android.view.View$PerformClick.run(View.java:20909)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

A: It seems like your textAdded is an empty String, which causes the NumberFormatException and crashes your app. What you can do to prevent this, is to check if your textAdded is not empty before parsing it:
public String calcDonation() {
    if (TextUtils.isEmpty(textAdded)) {
        //textAdded is empty, so just return an empty String
        return "";
    }
    //We're sure that textAdded has a value, so we can try to parse it
    double counter = Double.parseDouble(textAdded);
    addedDonation += counter;

    Locale locale = new Locale("en", "CA");
    NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);

    return fmt.format(addedDonation);
}

Or just prevent the method from being invoked before the user has entered a value in the EditText view:
public void computeDonation(View v){
    String addedText = ((EditText)findViewById(R.id.AmountText)).getText().toString();
    if (TextUtils.isEmpty(textAdded)) {
        Toast.makeText(context, "Please enter a valid number", Toast.LENGTH_SHORT).show();
    } else {
        DonationModel donation = new DonationModel(addedText);
        String answer = donation.calcDonation();
        ((TextView)findViewById(R.id.totalText)).setText(answer);
    }
}

A: I don't see where double addedDonation; is initialized, you can't use += when the variable has no value.

A: The problem is that you attempt to parse an empty string as a double. You need to verify that the user entered valid data before doing any calculations. One way to help you do this is to separate the calculation from the String passing and formatting. I suggest that you modify calcDonation() so that it only handles numeric data. Another method can worry about converting numbers to and from Strings. This will allow you to validate user input and display an appropriate error message when necessary.


text:
Q: Infinite scroll not working properly using Intersection Api , useRef and useInfiniteScroll in react query? I am trying to implement infinite scroll using Intersection Api and useRef .

<div className="loader" ref={observedElement}>
                {isFetchingNextPage && hasNextPage ? "Loading..." : "No search left"}
            </div>

My idea is whenever this div is visible the fetchNextPage function should run to fetch the next page.

 useEffect(() => {
        console.log("I am loading");
           if (isLoading) return;
           console.log("I am running")
            const callback = (entries) => {
                if (entries[0].isIntersecting && hasNextPage) {
                    fetchNextPage();
                }
            };
          const option = { threshold: 0 };
            const observer = new IntersectionObserver(callback, option);
            const element = observedElement.current;
            observer.observe(element);
            return () => (observer.unobserve(element))
        }, [hasNextPage,fetchNextPage,isLoading]);

The problem is sometimes even when more data is left to be fetched the div displays "No search left" . When I open the responsive mode and make the screen smaller and hide the div and unhide it
again it works perfectly it shows loading and fetches the next page.
The thing is I have to manaually hide and unhide the div to make it work.