text:
Q: How to display a WordPress Custom Field only on a specific day of the week? I've got WordPress site for which I've set up a custom post_type along with some custom fields created with CMB2 to display extra stuff within my custom posts.
When editing a single item for my custom post_type, it has a repeatable fields group set up in order to store prices and additional info, those are the fields:
price_tag, product_title, promo_desc, promo_price, check_promo // All fields exist within the CMB2 repeatable group, what increases the level of difficult for a new comer to php development like me...
What I need is a correct logic to output the promo_price field only if the checkbox field check_promo value = yes, if = no, then does not display/echo the promo_price field's value, then continue the logic to output the promo_price field's value only if is a specific day of the week, in this case, I thought that perhaps the WordPress Codex for Formatting Date and Time might help...
This is how I'm trying to retrieve and display them:
$foodPrices = get_post_meta( $post->ID, '_prefix_food_price_group', true ); // repeatable fields group
// A checkbox "Show promo prices?" with values no, yes exists within the metabox _prefix_food_price_group
$promoDay = date('l'); // returns Sunday

<?php
 foreach( (array) $foodPrices as $key => $value ){
     if(!( isset( $value['price_tag'] ) ))
        continue;

        echo '
';

        echo '
';
        echo '
';

        echo '
';

        echo ' '. $value['price_tag'] .' ';

     // if is Sunday
     if ( $promoDay == 'Sunday') {
     // display promo price if checkbox value =yes
      if( in_array( 'yes', $foodPrices ) ) {
        echo ' '. $value['promo_price'] .' ';
      }
     }
        echo '
';
        echo '
Serve de 1 a 2 pessoas
';
        echo '
';
        echo '
';
     if(!( isset( $value['price_title'] ) ))
        continue;
        echo '
' . $value['price_title'] . '
';

     if(!( isset( $value['price_desc'] ) ))
        continue;
        echo '
' . $value['price_desc'] . '
';

       echo '
';
       echo '
';
       echo '
';
       echo '
';
       echo '
';
 }
?>

So far everything works as intended, I can successfully display the fields on my theme template. However, it seems I'm not looping correctly through the repeatable fields and/or setting the right logic in order to achieve this.
Any help is very much appreciated.

A: You are not checking the current date correctly. You need to use current_time() funciton to get current datetime according to WordPress configuration. Then, using PHP date() you can check what day of week current date is:
// Get current date time of WordPress in Unix timestamp format
$timestamp = current_time( 'timestamp' );

// Get day of the week of current date
// See http://php.net/manual/es/function.date.php
$dw = date( "w", $timestamp);

// Check day of the week: 0 for Sunday to 6 for Saturday
if( $dw == 0 ) {

    // Display content if day of the week is Sunday

}


text:
Q: Hazelcast:how to detect network failure while getting cache from map There are two nodes in hazelcast cluster. i am trying to get cache from map which may be store on second node.In case of network failure it will go into wait loop while getting cache from map.
Is there any way to detect immediate network failure while getting cache from map instead of waiting .
I have tried tryLock  before calling get ,which return immediate true or false but not sure it will work in all cases.

A: What IMap.tryLock does is to invoke a LockOperation with 0 timeout, so that if there is a network partition it will return right away.
You can achieve similar scenario using IMap.getAsync(key) which returns ICompletableFuture object.
Then use ICompletableFuture.get(timeout, timeUnit) to set a timeout for getting entry from map.
Network partitions are detected via heartbeats. When a member doesn't send heartbeats for a certain timeout, it is considered dead. So there is no immediate way to detect network partitions but you can configure the behavior via hazelcast.heartbeat.interval.seconds and hazelcast.max.no.heartbeat.seconds properties. (see System Properties in Hazelcast Docs)

redpajama_set_name: RedPajamaStackExchange


text:
Q: why this happen in type conversion? i am new to springMVC ,today i write a DateConverter
like this
public class DateConverter implements Converter<String,Date>{

    private String formatStr = "";

    public DateConverter(String fomatStr) {
        this.formatStr = formatStr;
    }

    public Date convert(String source) {
        SimpleDateFormat sdf = null;
        Date date = null;
        try {
            sdf = new SimpleDateFormat(formatStr);
            date = sdf.parse(source);
        } catch (ParseException e) {
                e.printStackTrace();
            }
        return date;

    }
}

then i write a controller like this
@RequestMapping(value="/converterTest")
public void testConverter(Date date){
    System.out.println(date);
}

congfigure it to applicationContext,i am sure the DateConverter has been initialized correctly,when i test my converter with
http://localhost:8080/petStore/converterTest?date=2011-02-22

the browser says:
HTTP Status 400 -
type Status report
message
description The request sent by the client was syntactically incorrect ().

somebody could help me with it? thanks in advance

A: You have a typo in your converter. You misspelled the constructor param, so the assignment has no effect.  Instead of:
public DateConverter(String fomatStr) {
    this.formatStr = formatStr;
}

try:
public DateConverter(String formatStr) {
    this.formatStr = formatStr;
}

There may be other issues, but at a minimum you'll want to fix that.  I'm assuming you are using yyyy-MM-dd for your date format?


text:
Q: Why is the inner negative sign required for defining an involution over $L^1(\mathbb{R})$? I was reading Gerald Folland's A Course in Abstract Harmonic Analysis where the involution operation $f^*(x)=\overline{f(-x)}$ is defined over functions in $L^1(\mathbb{R})$. This is done in order to make $L^1(\mathbb{R})$ a $*$-algebra with convolution being the product operation.
But, I am unable to understand why the inner negative sign in $\overline{f(-x)}$ is necessary. I was able to verify that $f^*(x)=\overline{f(x)}$ satisfies all the properties required in the definition of involution (These are $(x+y)^*=x^*+y^*$, $(\lambda x)^*=\overline{\lambda}x^*$, $(xy)^*=y^*x^*$ and $x^{**}=x$).
Is there a good reason why the involution operation should be defined as $f^*(x)=\overline{f(-x)}$ instead of $f^*(x)=\overline{f(x)}$? Are there any important properties of $*$-algebras that are lost if the latter definition is used instead of the former?


text:
Q: Java Volleyball scoring program arrays and loops I am new to coding. Please be gentle with me.
I have been charged with creating a program that compares the scores of two competing volleyball. To win a match in volleyball, a team must get 25 points. But the team must also win by 2. These two teams are going to play five matches.
The program should accept from the user the scores for each team one match at a time. If at any time that user enters scores that violate the 25-point rule or the "win by 2" point rule, print an error on the screen and make the user enter both scores again.
When the user is finished entering the scores, print which team won the game, that is the team that won the most matches.
You have to use arrays and loops in this assignment.
My program is only scoring the first set of scores in the array.
How do I make it store all five sets of scores?
public static void main(String[] args) {
        int team1[];
        int team2[];
        team1=new int[5];
        team2=new int[5];
        int counter1=0;
        int counter2=0;
        int k = 0;

        for (int i=0;i<=4;i++){
        Scanner scanint = new Scanner(System.in);
        System.out.println("Enter the number of points Team 1 earned in Match " + (i+1));
        team1[i] = scanint.nextInt();
        System.out.println("Enter the number of points Team 2 earned in Match " + (i+1));
        team2[i] = scanint.nextInt();

////////////////////////////////////////////
        if (team1[i] < 25 & team2[i] < 25){
            System.out.println("That cannot be. One team must get at least 25 points. Please re-enter the data.");
            System.out.println("Enter the number of points Team 1 earned in Match " + (i+1));
        team1[i] = scanint.nextInt();
        System.out.println("Enter the number of points Team 2 earned in Match " + (i+1));
        team2[i] = scanint.nextInt();
        }

        else if (team1[i] - team2[i] < 2 || team2[i] - team1[i] < 2){
           System.out.println("That can't be. One team must win by at least two points. Please re-enter the data.");
            System.out.println("Enter the number of points Team 1 earned in Match " + (i+1));
        team1[i] = scanint.nextInt();
        System.out.println("Enter the number of points Team 2 earned in Match " + (i+1));
        team2[i] = scanint.nextInt();
        }

        else {
            System.out.println("Enter the number of points Team 1 earned in Match " + (i+1));
        team1[i] = scanint.nextInt();
        System.out.println("Enter the number of points Team 2 earned in Match " + (i+1));
        team2[i] = scanint.nextInt();
        }

        /////////////////////////////////////////////

        if (team2[i] < team1[i]){
           counter1++;}
       else{ counter2++;}

    }
     if (counter1 > counter2)  {
      System.out.println("Team 1 has won the game.");}
      else{
              System.out.println("Team 2 has won the game.");
              }

A: Well, there are only a few rules for finished games that I see:

*

*Neither team can have negative points.

*At least one team has to have 25 or more points.

*The points for a team can't be above 25 unless it's exactly two points above or below the other team.

So, how do we do this? With some if statements for each rule. For the first rule:
if ((team1 < 0) || (team2 < 0)) {
    System.err.println("A score cannot be negative!");
    i--;
    continue;
}

For the second rule:
if ((team1 < 25) && (team2 < 25)) {
    System.err.println("At least one team has to have 25 or more points!");
    i--;
    continue;
}

For the third rule (this can be converted into one if statement with an &&, but I've made it a bit simpler to understand):
if ((team1 > 25) || (team2 > 25)) {
    if ((team1 - team2 != 2) && (team2 - team1 != 2)) {
        System.err.println("If a team has more than 25 points, the other team must be two points away from it!");
        i--;
        continue;
    }
}

Note that the continue; means to go to the next iteration of the loop you're in. So, you go to the previous iteration with i--; and you go to the next iteration with continue;. This is a trick to allow you to restart the current iteration of the loop you're in.

Also, I wouldn't use arrays unless I used the scores somewhere outside the initial data input loop (though you should follow the rules for the assignment and use them anyway). I'd immediately point out when a game's scores were invalid and I'd keep track of the wins for both teams in some variables, like int team1Wins = 0; and int team2Wins = 0;.


text:
Q: Are different PHP variable variables that resolve to the same variable name the same variable? Let's say I have an array of strings that I use to create variable variables:
$var_arr = ["item1", "item2", "item3"];
foreach ($var_arr as $item) {
    $$item = array();
}

Then elsewhere in my code I have to recreate the variable variable based on a different data source:
$user_input = [ "prod1" => "widget", "qty1" => 3, "prod2" => "thingy", "qty2" => 1, "prod3" => "dingus", "qty3" => 7 ];
foreach ($user_input as $key => $value) {
    $a = "item" . substr($key, -1);
    array_push($$a, $value);
}

Are $$item and $$a the same variable, or do they reference different blocks of memory?

A: Both are the same what you need to consider here is that you are just referencing a variable through each assignment here:
<?php
    $hello ="hello in variable";
    $array_hello = ["hello","Yellow"];
    $hello_var = "hello";
    $item = $array_hello[0];
    echo $$hello_var;
    echo $$item; //result same as above result
?>

Here one thing to notice is ${$variable_name_string} is just using $variable_name_string to know the name of the variable you want so both will be accessing the same memory block because you are referencing same variable here.
One more thing to notice here is the change in interpretation in PHP 7 from PHP 5
Expression  $$foo['bar']['baz']    PHP 5 interpret it as ${$foo['bar']['baz']}  while PHP 7 interpret it as ($$foo)['bar']['baz']
Refer PHP manual for more


text:
Q: How can I select a random user from a server? I'm using discord.js version 12, the problem is that the bot is only selecting 2 users out of the entire server (The author of the message and the bot) and I want it to be able to pick anybody from the server.
Here's the code that I've tried:
client.on('message', msg=>{
  if(msg.content.toLowerCase() === "!sru"){
    const randomUser = msg.guild.members.cache.random();
    msg.channel.send(`${randomUser.user.username}#${randomUser.user.discriminator}`);
  }
})

Thanks in advance.

A: client.on('message', msg=>{
  if(msg.content.toLowerCase() === "!sru"){
    const randomUser = msg.guild.members.cache.random();
   msg.channel.send(`${randomUser.user.username}#${randomUser.user.discriminator}`);
  }
})

Make sure you have your SERVER MEMBERS INTENT in the developer portal activated.
Applications -> Bot -> Server Members Intent


text:
Q: .NET MVC Web API Upload file to local storage and data model to database I want to upload a file and pass the model with it. But when I try it from postman, it Always bring error.
Here is my code
public async Task<IHttpActionResult> PostArPumPd([FromBody] tx_arPumPd pum)
    {
        try
          {
            if (pum == null)
            {
                return Content(HttpStatusCode.BadRequest, "Enter the data correctly");
            }
            else
            {
            tx_arPumPd arpumpds = new tx_arPumPd()
            {
                doc_no = doc,
                doc_date = DateTime.Now,
                descs = pum.descs,
                currency_code = pum.currency_code,
                amount = pum.amount,
                employee_code = pum.employee_code,
                head_code = pum.head_code,
                company_code = pum.company_code,
                created_by = pum.emp_code,
                created_date = DateTime.Now
            };
            db.tx_arPumPd.Add(arpumpds);

            var multiFormDataStreamProvider = new MultiFileUploadProvider(Constants.MEDIA_PATH);

            var mod = "PP";
            var newFileName = mod + "_" + doc;

            await Request.Content.ReadAsMultipartAsync(multiFormDataStreamProvider);

            try
            {
                await FileHelper.Upload(multiFormDataStreamProvider, mod, newFileName);
                db.SaveChanges();
                return Content(HttpStatusCode.Created, "Data was save");
            }
            catch (Exception ex)
            {
                return Content(HttpStatusCode.BadRequest, ex);
            }
        }
    }
    catch (Exception ex)
    {
        return Content(HttpStatusCode.BadRequest, ex);
    }
}

I get an Error while i get to this part
await Request.Content.ReadAsMultipartAsync(multiFormDataStreamProvider);
This is the error

ioexception: unexpected end of mime multipart stream. mime multipart
  message is not complete test with postman

Is there anyone who know why? And Help me to upload file and the data model?
Thank you very much for your help

A: Okay I found the answer. To save a file and the Form data, i'm not parse the model. I'm just send the data from postmant using form data and the value is Json data. So I read the request from ReadAsMultipartAsync and get the Json data, and then deserilize the json. After that we can save the data.
This how I send the data from postmant
Postmant
and this is the code
public async Task<IHttpActionResult> PostArPumPd()
    {
        try
          {
            var multiFormDataStreamProvider = new MultiFileUploadProvider(Constants.MEDIA_PATH);
            var readToProvider = await Request.Content.ReadAsMultipartAsync(multiFormDataStreamProvider);

            // Get Json Data and Deserialize it
            var json = await readToProvider.Contents[0].ReadAsStringAsync();
            tx_arPumPd a = JsonConvert.DeserializeObject<tx_arPumPd>(json);

            // Set mod and file name for FileHelper classl
            var mod = "PP";
            var newFileName = mod + "_" + doc ;

            tx_arPumPd arpumpds = new tx_arPumPd()
            {
                doc_no = doc,
                doc_date = DateTime.Now,
                descs = a.descs,
                currency_code = a.currency_code,
                amount = a.amount,
                employee_code = a.employee_code,
                head_code = a.head_code,
                company_code = a.company_code,
                created_by = a.emp_code,
                created_date = DateTime.Now
            };
            db.tx_arPumPd.Add(arpumpds);

            var dtl = a.tx_arPumPdDtl;

            foreach (var item in dtl)
            {
                item.doc_no         = doc;
                item.bg_is_ok       = true;
                item.bg_approved    = true;
                item.bg_app_date    = DateTime.Now;
                item.created_by     = a.emp_Code;
                item.created_date   = DateTime.Now;
                db.tx_arPumPdDtl.Add(item);
            }

            try
            {
                await FileHelper.Upload(multiFormDataStreamProvider, mod, newFileName);
                db.SaveChanges();
                return Content(HttpStatusCode.Created, "Data was save");
            }
            catch (Exception ex)
            {
                return Content(HttpStatusCode.BadRequest, ex);
            }

        }
        catch (Exception ex)
        {
            return Content(HttpStatusCode.BadRequest, ex);
        }
    }

if anyone has a better way to do this, i'm still very happy getting to know about it.
Thank you.


text:
Q: How to "rsync" a catalog to multiple destination catalogs using the same filelist? I need someone help as I can't find a working solution to copy files from the Source catalog to 2 Destination catalogs using the rsync.
For instance,
I have the Source catalog with the following files
[root@s001tst-mariadb ~]# ls -l /tmp/SOURCE/
total 8388592
-rw-r--r-- 1 root root 2147479552 Nov 21 16:14 TESTFILE1
-rw-r--r-- 1 root root 2147479552 Nov 21 16:15 TESTFILE2
-rw-r--r-- 1 root root 2147479552 Nov 21 16:15 TESTFILE3
-rw-r--r-- 1 root root 2147479552 Nov 21 16:16 TESTFILE4

And I want to copy that files to the following destinations
[root@s001tst-mariadb ~]# ls -l /tmp/DEST1/ && ls -l /tmp/DEST2/
total 0
total 0

What I need is The rsync must use the same list of the files located in the Source catalog (/tmp/SOURCE/) when it copies to destinations. The rsync must not be run as 2 separate command as the list of files can be changed (eg user added new files while the first rsync is running) and destination catalogs will have different list of files in this case.
I've tried this but it's not working as files from the Source are placed only in one Destination catalog.
[root@s001tst-mariadb ~]# rsync -a  /tmp/SOURCE/ /tmp/DEST2/ /tmp/DEST1

As a solution I can generate list of files manually before and then run the rsync using the manually created filelist file. But I suppose there is something default at the rsync to accomplish this task

Added Later : The found solution

With the --write-batch option I got what I need
** Destinations are empty
[root@s001tst-mariadb ~]# ls -l /tmp/DEST1/ && ls -l /tmp/DEST2/
total 0
total 0

** Copy files from Source to any Destination
[root@s001tst-mariadb ~]# rsync --write-batch=ABC -av /tmp/SOURCE/ /tmp/DEST1/
sending incremental file list
./
TESTFILE1
TESTFILE2
TESTFILE3
TESTFILE4

sent 8,592,015,627 bytes  received 95 bytes  350,694,519.27 bytes/sec
total size is 8,589,918,208  speedup is 1.00

** Files are only in 1 catalog
[root@s001tst-mariadb ~]# ls -l /tmp/DEST1/ && ls -l /tmp/DEST2/
total 8388592
-rw-r--r-- 1 root root 2147479552 Nov 21 16:14 TESTFILE1
-rw-r--r-- 1 root root 2147479552 Nov 21 16:15 TESTFILE2
-rw-r--r-- 1 root root 2147479552 Nov 21 16:15 TESTFILE3
-rw-r--r-- 1 root root 2147479552 Nov 21 16:16 TESTFILE4

** Using the generated script copy files to the another Destination
[root@s001tst-mariadb ~]# ./ABC.sh /tmp/DEST2/
receiving incremental file list
./
TESTFILE1
TESTFILE2
TESTFILE3
TESTFILE4

sent 95 bytes  received 8,592,015,627 bytes  381,867,365.42 bytes/sec
total size is 8,589,918,208  speedup is 1.00

** Now the same list of files are in both catalogs
[root@s001tst-mariadb ~]# ls -l /tmp/DEST1/ && ls -l /tmp/DEST2/
total 8388592
-rw-r--r-- 1 root root 2147479552 Nov 21 16:14 TESTFILE1
-rw-r--r-- 1 root root 2147479552 Nov 21 16:15 TESTFILE2
-rw-r--r-- 1 root root 2147479552 Nov 21 16:15 TESTFILE3
-rw-r--r-- 1 root root 2147479552 Nov 21 16:16 TESTFILE4
total 8388592
-rw-r--r-- 1 root root 2147479552 Nov 21 16:14 TESTFILE1
-rw-r--r-- 1 root root 2147479552 Nov 21 16:15 TESTFILE2
-rw-r--r-- 1 root root 2147479552 Nov 21 16:15 TESTFILE3
-rw-r--r-- 1 root root 2147479552 Nov 21 16:16 TESTFILE4

When you use --write-batch option a temporary file is created with size equals to sum of all files copied. So you must have sufficient space on your disk.
** Generated Script
[root@s001tst-mariadb ~]# du -hs ABC.sh
4.0K    ABC.sh

** Content of the script
[root@s001tst-mariadb ~]# cat ABC.sh
rsync --read-batch=ABC -av ${1:-/tmp/DEST1/}

** Dump file
[root@s001tst-mariadb ~]# du -hs ABC
8.1G    ABC

A: RSync has a "Batch Mode" feature that should fit your purposes here. There's an excellent answer by Chloe over on this serverfault thread.
I'd anticipate that the example provided in that answer can be adapted to fit your exact needs fairly easily.


text:
Q: ¿Cómo leer en tiempo real un puerto serie RS232? Estoy intentando armar una interfaz en Python 2.7 a través de PyQt en la que despliega en tiempo real una serie de muestras que llegan por RS232. Una versión antigua del programa en visual basic imprime en tiempo real las muestra a través de la ejecución de "eventos".
¿Existe alguna forma de generar una función que se ejecute cuando llega un dato por el puerto?
Buscaría algo de la siguiente forma:
class MyWindowClass(QtGui.QMainWindow, form_class):
 def __init__(self, parent=None):
    self.serialCOM = serial.Serial("COM2", baudrate=9600, timeout = 00)
    ...
  self.connect(EVENTO DE PUERTO SERIE,self.Serial_event) #En esta parte es donde no logro llegar a nada

 def Serial_event(self):
    paquete = self.serialCOM.read()
    self.window_text.insertPlainText(paquete)

A: Crea una hebra que se quede constantemente leyendo.
s = serial.Serial()
while True:
   rx = s.read()
   if rx:
      print 'your-event', rx
   else:
      rx = None


text:
Q: Two state script monitor not working in SCOM 2012 R2 Trying to set up a simple two-state script monitor in SCOM 2012 R2 to check for the existence of a particular file on a server. my code is as follows:
$API = new-object -comObject 'MOM.ScriptAPI'

$Bag = $API.CreatePropertyBag()

$Exists = Test-Path 'c:\temp\testfile.txt'

if ($Exists)
{
    $Bag.addValue('State,'YES')
}
else
{
    $Bag.addvalue('State','NO')
}

$Bag

If I create the monitor and enable it for the given server, it registers and has an initial healthy state. If the result returned is 'YES', the state should change to unhealthy. However, if I create the test file, the monitor never changes state. It's targeted to a Windows 2008 R2 server, and is set to run on a 5 minute interval. If I manually execute the commands in a PS window on the server, it returns the appropriate data. The parameter I'm using to get the results back to the monitor is :
Property[@Name='State'] equals YES (unhealthy)
or                             NO (healthy)

I know I'm missing something dumb..there's just not much to this monitor. Any ideas?
TIA.

A: Try to specify datatype in your condition detection, like
          <Expression>
            <SimpleExpression>
              <ValueExpression>
                <XPathQuery Type="String">Property[@Name="State"]</XPathQuery>
              </ValueExpression>
              <Operator>Equal</Operator>
              <ValueExpression>
                <Value Type="String">YES</Value>
              </ValueExpression>
            </SimpleExpression>
          </Expression>


text:
Q: paragraph indentation does not work I am writing my master's thesis on Latex with TeXShop Version 3.88 on macOS Sierra. Anyone could help me as to why none of my paragraphs are indented, please?
MWE:
\documentclass[a4paper, 11pt]{article}
\usepackage{tikz}
\usepackage{cite}
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath, nccmath, amsfonts, amssymb, amsthm}
\usepackage{color}
\usepackage{array}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{trfsigns}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{datetime}
\usepackage{multirow}
\usepackage{placeins}
\usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage{relsize}
\usepackage{comment}
\usepackage{Macros_SCF}
\usepackage{mathrsfs}
\usepackage[toc]{glossaries}
\usepackage{indentfirst}

\includecomment{Graphics}

\titleformat{\section}{\normalfont\large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\paragraph}{\normalfont\bfseries}{\theparagraph}{}{}
\titlespacing{\section}{0pt}{6pt}{6pt}
\titlespacing{\subsection}{0pt}{3pt}{3pt}
\titlespacing{\paragraph}{0pt}{3pt}{-1pt}

\newcolumntype{Y}{>{\centering\arraybackslash}X}

\addtolength{\textwidth}{2.1cm}
\addtolength{\topmargin}{-2.4cm}
\addtolength{\oddsidemargin}{-1.1 cm}
\addtolength{\textheight}{4.5cm}
\setlength{\columnsep}{0.7cm}

\newlength{\mytocsep}
\setlength{\mytocsep}{1.5em}
\titlecontents{section}[0pt]{\addvspace{1pc}\bfseries}{\contentslabel{\mytocsep}}{}
    {\titlerule*[0.5pc]{-}\contentspage}
\newcommand{\myunnumberedsection}[1]{\addcontentsline{toc}{section}{#1}%
\section*{#1}}

\begin{document}

\setlength\parindent{30pt}

\section{Introduction}

\begin{flushleft}
\subsection{first subsection}
\end{flushleft}

\begin{flushleft}
This is the first paragraph. This is the first paragraph. This is the first paragraph.

\indent
This is the second paragraph, which should be indented but is not.
This is the second paragraph, which should be indented but is not.
This is the second paragraph, which should be indented but is not.
\end{flushleft}

\end{document}

A:
By default latex does not indent after section headings but you had over-ridden that with \titlespacing commands, The \titlespacing* form keeps the default behaviour of not indenting, so
\documentclass[a4paper, 11pt]{article}
\usepackage{tikz}
\usepackage{cite}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath, nccmath, amsfonts, amssymb, amsthm}
\usepackage{color}
\usepackage{array}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{trfsigns}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{datetime}
\usepackage{multirow}
\usepackage{placeins}
\usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage{relsize}
\usepackage{comment}
% not availaible\usepackage{Macros_SCF}
\usepackage{mathrsfs}
\usepackage[toc]{glossaries}

\includecomment{Graphics}

\titleformat{\section}{\normalfont\large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\paragraph}{\normalfont\bfseries}{\theparagraph}{}{}
\titlespacing*{\section}{0pt}{6pt}{6pt}
\titlespacing*{\subsection}{0pt}{3pt}{3pt}
\titlespacing*{\paragraph}{0pt}{3pt}{-1pt}

\newcolumntype{Y}{>{\centering\arraybackslash}X}

\addtolength{\textwidth}{2.1cm}
\addtolength{\topmargin}{-2.4cm}
\addtolength{\oddsidemargin}{-1.1 cm}
\addtolength{\textheight}{4.5cm}
\setlength{\columnsep}{0.7cm}

\newlength{\mytocsep}
\setlength{\mytocsep}{1.5em}
\titlecontents{section}[0pt]{\addvspace{1pc}\bfseries}{\contentslabel{\mytocsep}}{}
    {\titlerule*[0.5pc]{-}\contentspage}
\newcommand{\myunnumberedsection}[1]{\addcontentsline{toc}{section}{#1}%
\section*{#1}}

\setlength\parindent{30pt}

\begin{document}

\section{Introduction}

\subsection{first subsection}

This is the first paragraph. This is the first paragraph. This is the first paragraph.

This is the second paragraph, which should be indented but is not.
This is the second paragraph, which should be indented but is not.

\end{document}


text:
Q: Time difference between servers after disaster recovery We are running an old training system based on Windows Server 2003 and XP-clients. The solution is rather simple with four servers, two of them beeing DC:s. Everything is preconfigured and that goes for backup scheme as well. The backup software is Symantec BackupExec 2010. The scheme is a standard GF-F-S routine with full backups running once a week on Sundays. The other six days run differential backups.
Now let's say in a worst case scenario, a server crashes on Saturday and we have to restore it from backup. The last backup will then be six days old and thus it will come online with six days old configurations. Will this pose a problem for the other servers or will the recovered server "get in line" eventually?

A: From my experience, the following should happen:
Restoring Clients: it doesn't matter if they have "old" configuration, as long as their information in the domain are accurate, by information I mean their GUID and hostname, make sure that those are the same and everything else will be fine.
Restoring Servers: it depends on what you're restoring, let me break it down for you:

*

*Restoring the server OS (None DC): you will treat this as if you're restoring a normal client with the exception of Domain Controllers, as long as the OS you're restoring has the same GUID and name in the domain, you should be fine.

*Restoring the server OS for a DC: you will have to restore the OS first, and then sync the Active Directory information to the latest state, to do that you will have two options, Authoritative Restore and None Authoritative Restore, in general you will need to use the None Authoritative Restore when restoring a DC server in order for the Active Directory data to be synced from other servers to the server you're restoring, once the

That sums it up to answer your question, I would recommend you to do a further reading on the types of DC restore from here.
A couple of things that you might need to look at after the restore are IP addresses and drivers if you're restoring to different hardware, but those shouldn't be an issue.

A: That's not quite it.
You're performing Full backups once a week and Differential backups the rest of the week. If the system fails on Saturday you would restore the last Full backup and the last Differential backup and the system will be current up to the last Differential backup that you restore.


text:
Q: Reassigning to an existing variable after removing vowels from a string? I have a question regarding this code.  My aim is to remove all vowels from a string:
# 'California' is the_word I'm removing vowels from
the_word = "California"

# a for-loop that will look over and remove any vowels
for vowel in 'aeiou':
    # Assign the expression to an existing variable. Why?
    the_word = the_word.replace(vowel, '')

# print the output
print(the_word)

This program works if I reuse 'the_word' variable with a new expression in my for-loop.  However, if I choose to use a new variable (ie, 'new_word') in my for-loop it doesn't work.  For example:
the_word = "California"

for vowel in 'aeiou':
    new_word = the_word.replace(vowel, '')

print(new_word)

It may be a silly question, but, why do I have to use the existing variable instead of a new one?

A: The replace function does not modify the existing string, instead it returns a string contain the requested replacement, as such it needs to either be printed or assigned to a variable.
As an alternative to using replace, you will find Python's maketrans and translate functions are useful for this. In Python 2.7:
import string

def disemvowel(s):
    return string.translate(s, string.maketrans("",""), "EAIOUeaiou")

without_vowels = disemvowel("California")
print without_vowels

This would display the following:
Clfrn

Or for Python 3, the following can be used:
def disemvowel(s):
    return s.translate(str.maketrans("","", "EAIOUeaiou"))

without_vowels = disemvowel("California")
print(without_vowels)

A: In your for loop, you are calling replace on the_word each iteration. the_word always equals "California".
Thus, you have the following, after each run:
replacing 'a': Cliforni
replacing 'e': California
replacing 'i': Calforna
replacing 'o': Califrnia
replacing 'u': California

After 'u' is replaced, you exit your loop and new_word equals "California"


text:
Q: Inserting zero rows takes 2 minutes I have a long select statement finished with insert, the select returns zero rows in few seconds but insert part takes 1 to 2 minutes....
 with t1 as ()

insert into myscheme.sometable -- if I comment this line it will return zero rows in 3 sec

select t1

To simplify even more, this code is 3 seconds and result is zero rows:
 with t1 as ()

select t1

and below is 2 minutes however it is using select statement running 3 sec.(also for zero rows to insert):
 with t1 as ()
insert into myscheme.sometable
select t1

A: So I've used Arvo suggestion to do trick with tmp table:
select needed rows into temporary table and insert from there?

Not sure why postgres is doing such antioptimization while doing optimization but the trick with tmp table is good enough!
To sum up - when inserting into a table that is also used in select query before insert - best it is to create temp table and  do insert from that table.


text:
Q: Validity of regression diagnostics for deterministic computer experiments The question
Is it possible to justify the use of regression diagnostics such as F-tests or the AIC for the analysis of deterministic computer experiments?
Background
One way to analyse computer experiments is by building surrogate models. The unknown function $f$ is approximated by a nice and explicitly known function $\hat f$, determined from some training data $(x_i)$ and the according responses $(f(x_i))$.
To make the question more concrete it suffices to focus on multivariate polynomials as surrogate functions. They are fit using standard regression tools (e.g. "lm" in R or "sklearn.linear_model.LinearRegression" in Python). Furthermore, since design matrices can get large very quick, methods relying on variable selection such as stepwise regression are often used.
Notice that in most cases neither of the two main regression assumptions are fulfilled: More often than not the unknown function $f$ will be ill-specified, i.e. not be a polynomial of any degree, and there will be no noisy observations, i.e. independent errors with a normal distribution.
My issue
The minimisation of residual sum of squares makes perfect sense for an approximation task. Hence, I do understand the use of regression tools in general and diagnostics such as $R^2$ even though the regression assumptions are violated.
But it seems to me that diagnostics such as F-tests and the AIC do rely crucially on the likelihood or other statistical assumptions. While tools calculate them readily (but quite formally it seems), I do not see any reason why stepwise regression or variable selection based on such diagnostics should work in the deterministic and ill-specified case.
That said, I have seen this approach used in practice and it is also mentioned in textbooks (e.g. Chapter 7.2.2 of [1]). So maybe there is something to it?
In other words: Can stepwise regression or variable selection using AIC (or similar statistics based on the likelihood or distributional assumptions of the regression model) be justified also in the case of deterministic computer experiments?
[1] "The Design and Analysis of Computer Experiments" by Thomas J. Santner, Brian J. Williams, William I. Notz

A: Statistical methods applied to deterministic phenomena: Statistical methods like regression analysis can be quite useful in situations where one is dealing with deterministic values, particularly in cases where the deterministic behaviour is complex enough that it is not helpful to express this behaviour in deterministic terms.  In such cases, statistical methods can be employed, where we model deterministic data using a statistical model that includes an "error term" with a particular distribution.  As with other applications, you can still use diagnostic tests to check if the (deterministic) residuals from the model appear to follow the assumed distribution, etc.  Once it is determined that a statistical model is applicable to a set of data (deterministic or not) and diagnostic tests confirm plausibility of the model assumptions, the entire suite of tests and methods applicable to that model are okay to implement.  In a regression context, this includes methods like F-tests, AIC computations, etc.
In regard to this issue, it is worth noting that simulations used in statistical practice are generated by pseudo-random number generators (PRNGs) that are deterministic in nature.  (So long as you set the seed for these generators in a deterministic manner, the resulting series of numbers is deterministic.)  Indeed, the entire field of constructing valid PRNGs and the entire field of simulation analysis using their values involves the application of statistical models and tests to deterministic phenomena.
An applied example: As an example of a regression analysis of this kind, you can have a look at O'Neill (2020) (pp. 6-9, 11-12).  That paper examines the classical occupancy distribution and computes the accuracy of the normal approximation to that distribution over a large range of parameter values.  Part of the analysis involves showing that the approximation tends to get more accurate as the parameters get large, and this is done by computing some summary quantities relating to the approximation error, and showing how they change as the parameter values increase.  To this end, the paper includes a regression analysis looking at how these summary quantities for the approximation error reduce as the parameter values become large, using a model that has extremely high goodness-of-fit.  It turns out that these quantities follow very closely (but not exactly) to a simple deterministic function and so the regression analysis is able to show that this simple relationship has a high goodness-of-fit.  What is notable in this analysis is that the data used for the regression is purely deterministive --- it consists of computed RMSE values comparing two known distributions over a set of known parameter values.  There is no randomness or real-world data in that analysis.
Philosophical considerations: When conducting this kind of analysis it is worth noting that it is possible to take an underlying philosophical position with respect to probability that does not assume the existence of (aleatory) randomness and so does not contradict determinism.  Epistemic interpretations of probability generally consider probability distributions to describe our own uncertainty in values, even if those values are fixed.  Statisticians who take an underlying epistemic interpretation of probability (which would include most Bayesians at a minimum) usually have no in-principle aversion to applying statistical methods to deterministic phenomena.

A: It sounds like your deterministic experiments are effectively evaluating an unknown function $f$ at many different input values $x$. If evaluating $f$ at new $x$ values is cheap, then you can easily get arbitrarily large samples; so hypothesis tests (which are partly a measure of sample size) aren't going to be a very useful way to choose a parsimonious $\hat f$. Similar arguments can be made for AIC.
Instead, I'd suggest you think of a measure of "How good does my approximation need to be to be useful for my purposes?" What are the units of $f$? Choose the smallest value of a maximum or average discrepancy between $f$ and $\hat f$ that would be acceptable for your needs, on the range of $x$ values that you care about. Then, evaluate $f$ at many $x$ values, so that you have more than enough data to get low variance in the coefficient estimates when fitting fairly complex $\hat f$ models. Choose the simplest of these $\hat f$ models that meets your criteria for a "good enough" approximation.

On the other hand, if evaluating $f$ for new $x$ values is expensive or slow and your sample size is essentially fixed, then the F test or AIC might help you choose the most-complex $\hat f$ you can afford to fit with this sample size. The fact that $f$ is deterministic isn't a problem (though it might affect your choice of which test to carry out; see below).
It often helps to think of significance tests (like the F test) as a measure of sample size. I will assume you're using the F test that compares two nested regression models. Then the F test is basically asking: "Is my sample large enough to trust the larger / more complex model? Or is there too much variability relative to this sample size, and it would be safer to use the smaller / less complex model at this sample size?"
Say the true unknown $f$ is pretty close to a quadratic function (but not quite exactly quadratic). And say you first try to compare a linear $\hat {f_1}$ vs a quadratic $\hat {f_2}$ fit to the pairs $(x, f(x))$. If you've evaluated $f$ at very few values of $x$, the F test might fail to reject $H_0$, telling you that you don't have enough data and your estimated $\hat {f_2}$ is too noisy. But if you've evaluated $f$ at enough different $x$ values, the F test might reject $H_0$, telling you that you've got enough data to safely trust your estimated $\hat {f_2}$ as a better approximation than $\hat {f_1}$.
But this issue of "Is my sample big enough?" is distinct from "Is $\hat f$ a good enough approximation to $f$?" The latter question requires subject matter expertise. Again, imagine that $f$ is nearly-but-not-quite quadratic. And let's say that the true differences between $f$ and its best quadratic approximation are negligible for your purposes; a cubic $\hat{f_3}$ could technically be an even better fit, but it would make almost no practical difference in whatever you're using $\hat f$ for. Even so, if you have a large enough sample size, the F test comparing quadratic vs cubic will reject $H_0$ and say you've got enough data to trust the cubic approximation $\hat{f_3}$.
My key point is that "negligible for your purposes" is something that you must decide and the F test cannot answer for you. I don't know the context of your computer experiments, but here's a physics example. Say you're trying to predict $f$ = boiling point of water from $x$ = atmospheric pressure. The true relationship is not linear, but if your purpose is to suggest approximate baking times in a recipe book, a linear $\hat f$ might be plenty good enough. On the other hand if your purpose is to design high-performance meteorological equipment, a linear $\hat f$ may be nowhere near good enough and you'll need a more complex model (and enough data to fit it).

Finally, if you do use hypothesis tests in this scenario, and your deterministic $f$ is smooth and your $x$ values are very close together... then the independent-residuals assumption isn't going to be appropriate.
Think of time-series data. Imagine an extreme example: $y$ is changing once a day (and is independent from day to day), but I record measurements every hour. Then I don't really have $n$ independent measurements -- my "effective sample size" is more like $n/24$. If I fit a regression model to $y$ vs $time$ and don't account for this autocorrelation, my F tests will wrongly think that I do have $n$ independent measurements, and my p-values will be way smaller than they really ought to be for the effective sample size.
In your case it might not be quite as extreme. But I'd still look into autocorrelation models to account for the fact that similar $x$ values might have extremely similar $f$ values.

A: This question reminds me a bit of the question Could a mismatch between loss functions used for fitting vs. tuning parameter selection be justified? , where I answered that it can be useful to use a different loss function than the loss function which needs to be optimized. The reason is that statistical fluctuations might be best minimized by using a loss function that relates to the statistical distribution of the errors. For example: when we are estimating the location parameter of a Laplace distribution, then finding an estimator that minimizes the sum of absolute residuals will be better in optimizing the expected square error than an estimator that minimizes the sum of squared residuals.
In your example there is also in some way statistical variation. You have a deterministic function (the population), but you only take a sample $x_i$ where you evaluate $f(x_i)$, so you have a sub-selection of the population*, and that resembles the randomness of sampling.

I do not see any reason why stepwise regression or variable selection based on such diagnostics should work in the deterministic and ill-specified case.

The error distribution of this 'randomness' is not very clear, and to optimize AIC (based on an arbitrary likelihood) or F statistic will only make sense as a heuristic diagnostic. Yet they do work and that is because they introduce some way to penalize the number of terms. You can fit a high order polynomial and reach an $R^2 = 1$ but that is possibly introducing a larger prediction error.

Instead, to reduce this error, it might be better to use, for instance, leave one out cross validation, which relates to the mean squared error (Proof of LOOCV formula), and is asymptotically similar to optimizing a likelihood (Equivalence of AIC and LOOCV under mismatched loss functions)

*(If you would know the entire function $f$ then you could just optimize the entire function straight away, and if you have no limits to the number of terms then you get something like a perfectly fitting Taylor series or Fourier series).

A:
In other words: Can stepwise regression or variable selection using AIC (or similar statistics based on the likelihood or distributional assumptions of the regression model) be justified also in the case of deterministic computer experiments?

Here's an argument for likelihood-based statistics. Let $Y = f(X)$, where $f$ is a deterministic function. Assume you observe a finite number of realizations s.t. $\mathbf{y} = f(\mathbf{X})$. If you knew both $f$ and $\mathbf{X}$, then you would know $\mathbf{y}$ with probability one, or very vaguely $P(\mathbf{y} = f(\mathbf{X}) | \mathbf{X}, f) = 1$. You don't know $f$, so you place a Gaussian process prior $f | \mathbf{X}\sim\mathcal{GP}(\cdot, \cdot)$. You integrate out $f$ to obtain the output marginal likelihood, which is MVN Gaussian: $\mathbf{y} | \mathbf{X}\sim\mathcal{MVN}(\cdot, \cdot)$. Even if the computer code output is deterministic and there's no "innate" variability on it, the output marginal likelihood is multivariate normal due to your uncertainty on $f$. So, statistics based on this marginal likelihood seem sensible to me.
More general, here are a few things that might help you decide how comfortable you feel about using such diagnostic techniques.

*

*Your computer model is deterministic, i.e., $Y = f(X)$. Since the computer model does not have a random error component, there's no aleatoric uncertainty. However, you don't know $f$, so there's epistemic uncertainty. See Aleatoric and epistemic.

*Even though the underlying function $f$ might be deterministic, the output value is unknown a priori (before running the simulator). This is sometimes called code uncertainty and is enough to justify the use of a stochastic process.

*Surrogates are most frequently set up in a Bayesian framework, and so the probabilistic statements are about your uncertainty about the function that you are approximating $f$ and not really about the inherent random noise in your computer code. This applies even when Empirical Bayes is used, which in many contexts can get quite close to simply "find MLE estimates but interpret like a Bayesian model".

*Bastos and O'Hagan (2009, sec. 3.1) discusses the challenges associated with diagnostics for linear models fitted to a deterministic function. In particular, the training set predictions will be perfect if you use an interpolator, thus the need to use cross-validation or a new data set. Out-of-sample validation introduces some uncertainty. However, they also note that there might be scoring functions for deterministic computer experiments such as the Mahalanobis distance. See 10.1198/TECH.2009.08019
An adjacent note.

*

*A linear model might not be commonly used for a surrogate. However, you can cast a linear model as a Gaussian process with linear kernel $\mathbf{XX}^\top$ (Rasmussen and Williams, 2006, sec. 4.2.2).

References

*

*Bastos, L. S., & O'Hagan, A. (2009). Diagnostics for Gaussian process emulators. Technometrics, 51(4), 425–438. https://doi.org/10/bw62bq

*Rasmussen, C. E., & Williams, C. K. I. (2006). Gaussian processes for machine learning. MIT Press.


text:
Q: Proportion of unique words in typical English text? I recall hearing a statistic that, in a typical block of English text (e.g. a novel) a really suprisingly large proportion (a third? half?) of the distinct words that appear, appear only once. That is, if you counted each occurrence of each distinct word in the text, then you'd find a huge proportion of the distinct words appear only once each.
I think I heard this on a radio show but I can't find the source. Can anyone confirm where I might have heard this, and/or indicate whether there's any truth to it?
Thanks.

A: While I can't confirm (and don't know) where you might have heard this, it is true that Zipf's law seems applicable to representative corpuses of English text.  That is, it appears to represent patterns of word frequency, approximately but appropriately.  See the Zipf's law Wikipedia article for more information and detailed formulas, and also the question  Frequency of word use vs number of words, in which I gave some example calculations.  An implication of Zipf's law is that a large fraction of the words in a typical corpus are singletons, or hapax legomena.
A word frequency analysis of Moby Dick appears as an illustration in the hapax legomenon Wikipedia article.  The caption says "About 44% of the distinct set of words in this novel, such as "matrimonial", occur only once..."


text:
Q: What is balanced bagging in lightgbm? The lightgbm documentation mentions something called 'balanced bagging' under pos_bagging_fraction and neg_bagging_fraction but does not describe it.

Note: if balanced bagging is enabled, bagging_fraction will be ignored

Can somebody help me understand what it means?

A: They appear to be using the phrase "balanced bagging" to mean setting both pos_bagging_fraction and neg_bagging_fraction, i.e. you are bagging in a class-aware way to affect a balancing of the training data per tree.  Your quote supports this, saying that by setting pos_bagging_fraction and neg_bagging_fraction, the ordinary (class-unaware) bagging_fraction will be ignored.


text:
Q: Inserting with WHERE and AND, Error Code: 1241. Operand should contain 1 column(s) Getting an error saying: Error Code: 1241. Operand should contain 1 column(s)

INSERT INTO TBL_TESTER_INFO2 (
    board_id,
    tester_name,
    board_name,
    config,
    operating_system,
    log_created
) VALUES (
    (SELECT
        bl.id as 'board_id',
        bl.tester_type,
        bl.board_name
    FROM TesterDeviceMatrix.TBL_BOARD_LIST bl
    WHERE bl.tester_type = 'UFLEX'
    AND bl.board_name = 'HSD-U'
    ),
    'tester',
    'board',
    'slot',
    'windows',
    '2015-06-10 16:08:42'
);

Any help on this? There seems to be no syntax error.

A: Pretty sure you can't mix a SELECT statement with other values as part of an INSERT statement's VALUE set.
I'd just put the static values into the SELECT, eg
INSERT INTO TBL_TESTER_INFO2 (...)
SELECT
    bl.id,
    bl.tester_type,
    bl.board_name,
    'slot',
    'windows',
    '2015-06-10 16:08:42'
FROM TesterDeviceMatrix.TBL_BOARD_LIST bl
WHERE bl.tester_type = 'UFLEX'
AND bl.board_name = 'HSD-U';

A: Here is the syntax of insert select SQL.
INSERT INTO table_name1(id, name,address,contact_number)
SELECT id, name, address, contact_number FROM table_name2;

In your SQL insert statement columns are not matching in select SQL.
I modified your SQL. I think it will execute
INSERT INTO TBL_TESTER_INFO2 (board_id,tester_name,board_name, config,operating_system,log_created)
    SELECT bl.id AS 'board_id',bl.tester_type,bl.board_name,'slot','windows','2015-06-10 16:08:42'
    FROM TesterDeviceMatrix.TBL_BOARD_LIST bl
    WHERE bl.tester_type = 'UFLEX'
    AND bl.board_name = 'HSD-U'

Thank you.


text:
Q: R - Spotify API - Delay I'm using the below to extract the genres of a list of artists. While the list has approx. 400 artist ID's in there the result only keeps showing me a 100 artists. I'm assuming there is a limit to the API. Any recommendations on how to add a delay / or a different approach to extract this info for more than a 100 artists?
library(Rspotify)

keys <- spotifyOAuth("*****","*******","***********")

library(purrr)
library(dplyr)

# Create a vector of owners id

artist_id <- c(artist$artistId)

artist_id

################

# Create empty list

datalist = list()

# Tell loop to iterate over all entries p in artist_id

for(p in artist_id) {
pl <- getArtistinfo(p ,token=keys) %>%
mutate(artist_id = p)
datalist[[p]] <- pl
}

artiestfile <- do.call(rbind, datalist)

artiestfile

Thank you!


text:
Q: App launcher Icons suddently not working Android Studio I set my compileSDKVersion to 27, and now I get a default (b&w) icon on my Android App

What am I doing wrong?

A: You also need to use android:roundIcon="@mipmap/ic_launcher_round"

Round Icon Resources

When a launcher requests an app icon, the framework returns either android:icon or android:roundIcon, depending on the device build configuration. Because of this, apps should make sure to define both android:icon and android:roundIcon resources when responding to launcher intents.
<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

A: android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"`


text:
Q: Get function name from function itself
Possible Duplicate:
Can I get the name of the currently running function in javascript?

I want to get the function name from function itself.
Javascript:
Cube : {
    profile : {
        edit : function(){
            // Get function Path Cube.edit Here
            alert(arguments.callee.name); // Not Working
        }
    }
}

A: The function in your code snippet has no name, it's anonymous. The property it's assigned to on profile has a name (edit), but the function does not. No, there is no way to get edit or profile.edit or Cube.profile.edit from the function object.
You can give the function a name:
Cube : {

   profile: {
       edit : function edit(){

         alert(arguments.callee.name);

       }
   }
}

...but that's using a named function expression which will create two separate function objects on IE8 and earlier.
You can also do this:
Cube : {

   profile: {
       edit : Cube_profile_edit
    }
}
// ...

function Cube_profile_edit(){

    alert(arguments.callee.name);
}

However, in all of the above, two problems:

*

*You're using arguments.callee which is both very slow on a lot of browsers, and not valid in strict mode.

*The name property of function objects is non-standard, which is why this answer talks about possibly having to parse the result of Function#toString. The problem is, Function#toString is also non-standard (but fairly broadly supported, except on mobile browsers).
You could avoid that second problem by searching through the Cube object graph for the property that refers to the function, but that would still require using arguments.callee (unless you give the function a real name and then use that real name when searching to find the property path that leads to it).


text:
Q: How do I know when my sprite collides with an object? Sorry, My english isn't very good.
I have a quiet sprite with a map moving in the x-axis to the left, giving the impression that sprite run to the right.
_tileMap runAction:[CCMoveBy actionWithDuration:80.0 position:ccp(-2000,0)]];

My tilemap is set to true propiedates Collidable with programa "Tiled" with a "Tileset> properties>" "Collidable" set to "True"
Map position is known to me at all times with _tileMap.position.x
How do I know when my sprite collides with an object?
Thanks!!

A: Cocos2D won't do this for you, you need to calculate any collisions yourself.
If you want the simplest possible case, just take the position of your sprite, translate it into a tile map coordinate and then get the properties for that tile. If there is a collide-able property set to true then your sprite has hit collision and you need to code up the appropriate response.
This assumes that only the center point of your sprite will ever collide, you will want to define more points within your sprite to test.
A simpler approach may be to use Box2D or another 2D physics system and define collision shapes for your sprites, then you can get callbacks when collision occur.


text:
Q: How is this the chain rule? I'm having a hard time seeing why this is the chain rule [source here]. I cahnged some of the symbols used in order to shorten the expression. (https://arxiv.org/pdf/1806.09055.pdf). Let $w' = w - \xi\nabla_w T(w, \alpha), \alpha)$
$$
\nabla_{\alpha}V(w - \xi\nabla_w T(w, \alpha), \alpha) = \nabla_\alpha V(w', \alpha) - \xi\nabla^2_{\alpha, w} T(w, \alpha) \nabla_{w'}V(w', \alpha)
$$
I don't see how the chain rule can get us from the LHS to the RHS...


text:
Q: WordPress Redirect if logged into incorrect site with WPMU I am trying to get WordPress to automatically redirect from somesite.com/wp-admin (if the user logged in successfully) to the blog that the user is on (somesubsite.somesite.com/wp-admin). I have written the following code to do so:
add_action( 'admin_page_access_denied',     'redirect_user_to_correct_blog'             );

function redirect_user_to_correct_blog()
{
if ( ! is_user_logged_in() || is_network_admin() ){
    return;
}
$blogs = get_blogs_of_user( get_current_user_id() );
//var_dump($blogs);
if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) ){
    return;
}
if(count($blogs)==1){
    $blog=reset($blogs);
    wp_redirect(get_admin_url($blog->userblog_id));
    exit();
}
}

But this code does not appear to be executing (I placed logging code which has been removed). Does anyone have any idea what I'm doing wrong? I am running the latest version of all plugins/WordPress currently available.
Currently, when the user logs into somesite.com/wp-admin, I get: "You do not have sufficient permissions to access this admin page." and they are sent to "somesite.com/wp-admin" and not "somesubsite.somesite.com/wp-admin".
Thanks!

A: The issue was that I was using Admin Menu Editor, which overrides the default behavior for WordPress, and therefore, "admin_page_access_denied" was never called. I added a do_action('admin_page_access_denied') to this plugin where it was denying access to a user. I hope this helps someone else not bang their head against a wall for hours. :)


text:
Q: div image position fixed + scroll I want to create something like that: Page
I mean the first image. If i scroll the div under the img get over the image.
How can i create that? If i give my img the position: fixed, everything is destroyed^^
And the position absoulte is maybe usefull but the div is next to the nav then.
Here is my try: enter link description here
And here is the code:

*{
    font-family: "Open Sans";
    margin: 0px;
    padding: 0px;
    font-size: 18px;
}
html {
    height: 100%;
}
body{
    /*background: url("images/bg.png") repeat-x scroll left top #9EB5D6;
    background: url("images/bg2.png"); */
    height: 100%;
}

nav{
   background: url("images/line-header.png") repeat-x scroll center bottom #4A525A;
   padding: 15px;
}

nav > ul{
    margin: 0px;
    padding: 0px;
    text-align: center;
}

nav ul > li{
    margin-left: 25px;
    display: inline-block;
    list-style-type: none;
}

nav ul li > a{
    display: block;
    text-decoration: none;
    color: black;
    color: #697683;
    transition: color 0.5s;
}

nav ul li > a:hover{
    color: #FFF;
}

.pic1 {
    background: url(images/banner.jpg);
    height: 100%;
    width: 100%;
}

.text{
    height: 800px;
    background-color: orange;
}
<!DOCTYPE html>

        <title></title>
        <link rel="stylesheet" href="index.css" >

        <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

Link 1

Link 1

Link 1

A: You have to set the CSS rules as follows:
.pic1 {
    background-attachment: fixed;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: -1;
}

.text{
    margin-top: 792px;
}

This will make the div '.pic1' to be fixed and div '.text' to be able to scroll over div '.pic1'. That's the solution.
Something Extra:
Here I have given 'margin-top:792px' to div '.text'. But instead you can use jQuery to detect view-port height and assign that value as 'margin-top' for div '.text' which will make this always display properly below the fold across all screens.
here is how to do it via jQuery:
$(document).ready(function(){

var wH = $(window).height();
$('.text').css('margin-top',wH);

})

In this case you have to remove the following CSS rule:
 .text{
        margin-top: 792px;
    }

Please note, you have to initially link jQuery library in your web page. That is the whole jQuery code should be like shown below:

should be added inside the markup, just before closing your BODY tag.

A: It's about choosing the right approach. This type of scrolling can easily be done by a fixed menu (which you have at the top), a pushed-down div and a background image. I added a nice reusable cat image to show the effect.
You were almost there, just needed to give the nav a fixed position.

* {
  padding: 0;
  margin: 0;
}
body {
  background: url(https://c1.staticflickr.com/9/8226/8557105873_a82c51f03f_z.jpg) no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}
nav {
  background-color: #555555;
  text-align: center;
  height: 20px;
  position: fixed;
  top: 0px;
  width: 100%;
}
nav li {
  display: inline;
  list-style-type: none;
  padding-right: 20px;
}
nav li a {
  color: white;
  text-decoration: none;
}
.text {
  background-color: orange;
  margin-top: 500px;
  min-height: 1000px;
}

Link 1

Link 1

Link 1

    text


text:
Q: what does this selector select "#dialog:ui-dialog"? This selector is refered in http://jqueryui.com/demos/dialog/#modal-confirmation (source code).
$( "#dialog:ui-dialog" ).dialog( "destroy" );

#dialog is fine, how does :ui-dialog gets interpreted, i did not find it anywhere in docs.
Could anyone shed some light?

A: jquery.ui.widget.js defines custom selector for every jQuery UI widget:
// create selector for plugin
$.expr[ ":" ][ fullName ] = function( elem ) {
    return !!$.data( elem, name );
};

which goes through all elements and returns those with defined data (dialog in this case) object.
Try to:

*

*Select dialog(s) (returns jQuery)
$(':ui-dialog');

*Get dialog object (returns Object)
$(":ui-dialog").eq(0).data('dialog');

Your corrected statement:
$(":ui-dialog").dialog("destroy");

Selects and distroys all dialogs.

A: The comment right above that line of code reads:
// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!

So it might be best to just leave it alone.

A: I believe it just refers to an element whose id is dialog:ui-dialog, it doesn't have any semantical meaning


text:
Q: Combining stacked bars within grouped barchart in R i am quite new to R studio and I just can't figure out, how I can combine stacke bar and a normal barplot...I know the question has been answered before - but i do not work with ggplot yet (its too complicated for me right now.. will try my best to understand it another time).
This is how my graph looks like now:
enter image description here
This was my coding to this graph:
par(font.axis=2)
par(mar=c(5,4,6,8))
barplot(as.matrix(data), beside = TRUE, ylab="number of cells / well",
        ylim=c(0,350000),cex.axis=1,cex.lab=1.25,col=c("darkorchid4","gainsboro","darkolivegreen4"),
        legend("topright",c("alive","dead","sawed cells / well"),
               fill=c("darkorchid4","gainsboro","darkolivegreen4")))

What i actually want is that "alive and dead" are a stacked bar, and sawed cells is a normal bar plot beside the stacked bar... ist that even possible?
Thanks for any help :)
This is my Excel sheet that i've worked with
enter image description here


text:
Q: SQL Select - optional date check in where clause I have a view in sqlanywhere11 with the following structure (dates in dd-mm-yyyy format):

ID,    VALID_FROM,    VALID_UNTIL,    SOME_VALUE
1,     01-01-2013,    01-02-2013     1
1,     02-02-2013,    01-03-2013     2
1,     02-03-2013,    01-04-2013     3
1,     null,           null          3

So there are multiple entries with the same id but different dates, and dates may also be null.
Now I need a query that selects only the entry with the current date between VALID_FROM and VALID_UNTIL or the one with the null date if the current date is not in any of the valid ranges.
I tried the following query:

SELECT * FROM MYVIEW WHERE VALID_FROM IS NULL OR getdate() BETWEEN VALID_FROM AND VALID_UNTIL;

But this will not work because if there is a null row, it will always be selected, even if there is another row with a valid date range.
Is it possible to create a SELECT query that finds the right rows?

A: Can't you just do a [SELECT TOP 1] and order it so the null would be last?
SELECT TOP 1 *
FROM MYVIEW
WHERE VALID_FROM IS NULL OR getdate() BETWEEN VALID_FROM AND VALID_UNTIL
ORDER BY CASE WHEN VALID_FROM IS NOT NULL THEN 1 ELSE 2 END

A: Looks like you're explicitly selecting the null rows with the
VALID_FROM IS NULL

I'd suggest trying something like:
SELECT * FROM MYVIEW WHERE getdate() BETWEEN VALID_FROM AND VALID_UNTIL;

Or maybe I've missread the question ...


text:
Q: Log4j configured but no sql got printed out I have latest spring+mybatis
Spring 4.2.3 + MyBatis 3.4+ MyBatis-Spring 1.3

I want to sql got printed out,so configured log4j like this:
# Console output...
log4j.appender.stdout                            = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target                     = System.out
log4j.appender.stdout.Threshold                  = ALL
log4j.appender.stdout.layout                     = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern   = %5p [%t] - %m%n
#log4j.logger.com.idpweb                      = TRACE
log4j.rootLogger                                 = ERROR,stdout
log4j.logger.org.springframework                 = DEBUG, stdout
# SqlMap logging configuration...
log4j.logger.com.company.dept.mapper.map.SeniorMapper= TRACE
log4j.logger.com.mybatis                             = TRACE
log4j.logger.java.sql                                = TRACE
log4j.logger.java.sql.Connection                     = TRACE
log4j.logger.java.sql.PreparedStatement              = TRACE
log4j.logger.java.sql.Statement                      = TRACE
log4j.logger.java.sql.ResultSet                      = TRACE

and project struct like this
Project
   src
   war
       WEB-INF
           applicationContext.xml
           logj.properties

But nothing got printed out when app running,so what is the problem?
Another problem is that after appending "fgsdfgsd" to the end of log4j.properties,then restart web app,no exception got thrown out,so I doubt that spring doesn't take
project/war/WEB-INF/log4j.properties

as it's logging configuration.So I moved log4j.properties to
project/log4j.properties,

nothing changed.

A: 1、if you use maven project,then put the log4j.properties in the resources folder like this:
project/src/main/resources/log4j.properties
this is the default location where log4j try to locate its property file.
2、you can also specify you log4j config file in web.xml like this:
(1)add Log4jConfigListener
    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>

(2)add context param name 'log4jConfigLocation' to tell Log4jConfigListener where to locate the log4j.proterties
<context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/conf/log4j.properties</param-value>
</context-param>


text:
Q: iOS Clipboard (Paste) Modification I want to be able to edit how users paste strings and pictures. My application would be simple: on or off. If it is on I want to be able to edit how the iphone pastes information into textboxes, programs, ect...
My Goal: The user can be on any application, but my application kicks in right when the user trys to paste something. When the user pastes something (on any application) I want a dialog box with a few options to come up. Is this possible, and if so are their any apple guides for this?
Thanks!

A: Your application SHOULD and WILL not be able to modify the behavior of other applications.  To have something just step in and modify a particular action so important as the pasteboard is IMHO really freaking scary and a serious security concern.  You are limited to your sandbox unless you jailbreak the phone.

A: This is totally possible, but it would have to be distributed on Cydia


text:
Q: C++ - Replace spaces with %20 I am looking for a way to prepare a string for use as a URL.
The basics of the code is you type in what you are looking for and it opens a browser with what you typed in. I am learning C++, so this is a learning program. And please be as specific as possible for I am new to C++.
Here is what I am trying to do:
cin >> s_input;
transform(s_input.begin(), s_input.end(), s_input.begin(), tolower);
s_input = "start http://website.com/" + s_input + "/0/7/0";
system(s_input.c_str());

But I am trying to replace all the spaces the user enter with a '%20'. I have found one method this way but it only works with one letter at a time, and I am needing to do it with a full string and not an array of chars. Here is the method I have tried:
cin >> s_input;
transform(s_input.begin(), s_input.end(), s_input.begin(), tolower);
using std::string;
using std::cout;
using std::endl;
using std::replace;
replace(s_input.begin(), s_input.end(), ' ', '%20');
s_input = "start http://website.com/" + s_input + "/0/7/0";
system(s_input.c_str());

Thanks for your help!

A: If you have Visual Studio 2010 or later you should be able to use regular expressions to search/replace:
std::regex space("[[:space:]]");
s_input = std::regex_replace(s_input, space, "%20");

Edit: How to use the six-argument version of std::regex_replace:
std::regex space("[[:space:]]");
std::string s_output;
std::regex_replace(s_output.begin(), s_input.begin(), s_input.end(), space, "%20");

The string s_output now contains the changed string.
You might have to change the replacement string to std::string("%20").
As you see I have only five arguments, that's because the sixth should have a default value.

A: std::replace is only able to replace single elements (chars in this case) with single elements.  You are trying to replace a single element with three.  You will need a special function to do that.  Boost has one, called replace_all, you can use it like this:
boost::replace_all(s_input, " ", "%20");

A: If you google: C++ UrlEncode, you will find many hits.  Here's one:
http://www.zedwood.com/article/111/cpp-urlencode-function


text:
Q: Y_axis ticks stacking when values are set in logarithmic plot I am trying to plot a scatter plot with a logarithmic y-axis (Like this but with the y-axis being logarithmic). I am able to get the plot to work properly before I change the y tick values, but as soon as I change the values to the ones I desire the plot ends up with the wrong scale. I am displaying the plot on a GUI made using tkinter. What am I missing? Any help would be greatly appreciated.
The code I am using:
    x=np.array (x_values)
    y= np.array (y_values)

    fig = Figure(figsize=(6,6))
    a = fig.add_subplot(111)
    a.scatter(x,y,color='red')

    a.set_title ("Estimation Grid", fontsize=16)
    a.set_ylabel("Y", fontsize=14)
    a.set_xlabel("X", fontsize=14)

    a.set_yscale("log")
    #a.set_yticks([100, 50, 10, 1.5, 1, 0.5, 0.1, 0.01, 0])
    a.set_yticks([0, 0.01, 0.1, 0.5, 1, 1.5, 10, 50, 100])
    a.get_yaxis().set_major_formatter(matplotlib.ticker.LogFormatter())
    a.grid()

The resulting plot:

The values used for this plot are:
x_values =[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]
y_values = [99.99, 75, 60, 50, 45, 40, 35, 30]
Questions I've looked at:
Overlapping axis tick labels in logarithmic plots
set ticks with logarithmic scale

A:
Don't include zero in your yticks for a log plot. As log(0) is minus infinity the distance between tick 0 and tick 0.01 will be much too large. You can choose another small but positive value for the smallest y, e.g. 0.0001, depending on your data

Answered in the comment above by JohanC.


text:
Q: How to open .sql file at startup in SQL Server Management Studio? I'm looking to open specific .sql files that have multiple select statements on specific servers at startup in SQL Server Management Studio 2014.
For example, I want to open file 'EmQueries.sql' when I open server sqlemdata9. When I open server sqlplant2, I would like to see file 'PlantQueries.sql' open at startup.
How can I accomplish something like this?

A: You can  achieve the following procedure with Command Line Process, will help you connect to different databases related to specific files and user credentials.
This is Easy with command line (cmd)
ssms "C:\Users\Wizard\Documents\SQL Server Management Studio\query.sql" -S ServerAddressOrIP -d Database -U Username -P Passwordhere

Copy the following line to (.bat) batch file format and run it.


text:
Q: Entity Framework Code First - Reference same table I am still starting with Entity Framework Code First. I want to be able to select a Resource from list when creating a new resource. How do I reference a Resource with a Resource model.
public class Resource
{

    public int ResourceId { get; set; }
    [Required]
    [DataType(DataType.EmailAddress)]
    [EmailAddress]
    public string EmailAddress { get; set; }
    [Required]
    public string Password { get; set; }
    public string FullName { get; set; }

    public int TimeManagerId { get; set; }

    public int TravelManagerId { get; set; }

    public int OvertimeManagerId { get; set; }

    public int AbsenceManagerId { get; set; }
    public virtual Resource TimeManager { get; set; }
    public virtual Resource TravelManager { get; set; }
    public virtual Resource OvertimeManager { get; set; }
    public virtual Resource AbsenceManager { get; set; }

}

A: I think you're pretty close! If you want to do this by convention, you can change the foreign keys in your model to the form of [navigation property name][principal primary key property name]. Specifically, change Id to ResourceId so it matches the primary of the table you're referencing (which happens to be itself)...
public int TimeManagerResourceId { get; set; }
public int TravelManagerResourceId { get; set; }
public int OvertimeManagerResourceId { get; set; }
public int AbsenceManagerResourceId { get; set; }

Since you're just starting with EF code first, I'd recommend you install the Entity Framework Power Tools. You'll be able to right-click on the .cs file containing your DbContext, and it'll generate a read-only diagram of the mappings.
Try it out with your current model... right-click on entity in the diagram and view Table Mappings. You'll see EF wasn't able to figure out your foreign keys and created 4 more for you. Once you make the changes above, generate the diagram again and see the difference.
Edit: Docs on code first conventions... http://msdn.microsoft.com/en-us/data/jj679962.aspx


text:
Q: Why does #itself take a block? When passing a block to itself, unlike tap and yield_self, it does not seem to be executed, so what is it used for?
'a'.itself { |it| raise }

Nothing is raised.

*

*Ruby 2.6

A: I guess you can pass a block to any ruby method and it's silently ignored if not used:
1.to_s{ raise "1"}
# => "1"
1.to_f{ raise "1"}
# => 1.0
1.nil?{ raise "1"}
#=> false


text:
Q: Table display block behavior I have a table with display: block; max-width: 100px; overflow-x: auto css properties.
In some cases everything is fine, but in this snippet http://jsfiddle.net/TLP8x/ you can see that thead and tbody does not take all possible width.
Is this possible to make them take all possible width, just as usual table behavior?
I tried to use display: table-row and other display values on tbody, thead and tr, but this did not help me.

A: You need to remove the display: block attribute of the <table> and to apply width: 100%
http://jsfiddle.net/TLP8x/4/

A: You can get the behaviour you desire by:

*

*Removing the 'display:block' as noted above.

*Updating the table declaration to: table class="blocked_table" style="width:100%"

With those done, the table cells consume the entire 100px box in a 50/50 split.


text:
Q: .Net Mailkit Pop3 Connection with Proxy Settings I am trying to connect Pop3 client using given proxy settings. However, I got "Authentication failed" error. When i try it with imap which is with port 993, It works just fine. I cant understand why it does not work for Pop3 protocol. Is there any way that I could solve this problem? Any help would be appreciated.
 ProxySettings ProxySetting = new ProxySettings
                {
                    Name = "asaf",
                    Host = "192.168.3.55",
                    Port = 808,
                    Auth = new Authorization
                    {
                        Type = AuthenticationMethodConstants.Ntlm,
                        User = "User-001",
                        Password = "Deneme123"
                    }

        };
        using (var client = new Pop3Client())
        {
            client.Timeout = 120000;
            if (ProxySetting != null)
            {
                client.ProxyClient = ProxySetting.CreateHttpProxyClient();
                Console.WriteLine("Current proxy: " + client.ProxyClient.ProxyHost + ":" + client.ProxyClient.ProxyPort);
            }

            client.ServerCertificateValidationCallback = (s, c, h, e) => true;

            client.Connect("outlook.office365.com", 995, SecureSocketOptions.SslOnConnect);

            client.Authenticate("mcs234@lenfs.onmicrosoft.com", "phtfg456!");


text:
Q: Android Room, query with empty params I have an Android app that uses Room.
I have the following query:
@Query("SELECT * FROM model WHERE (:someInt is null)")
List<Model> myQuery(Integer someInt);

However, when I call it with a null value, it returns an empty List.
The following test fails.
    List<Model> models = myDao.myQuery(null);
    assertFalse(models.isEmpty());

In the other hand when I try it using the following query it returns items.
@Query("SELECT * FROM model WHERE (:someInt is not null)")

Is there something that I'm missing?
I'm using Room 2.2.5.
Thanks,


text:
Q: How do we apply Ito's lemma to a product of functions In finance an optimal portfolio choice it is common to use some tools of stochastic calculus. Going through a book, I found the following statement,
\begin{equation}
a_t = \int_s N_t(s) P_t(s) ds
\end{equation}
     By Ito's lemma:
\begin{equation}
da_t = \int_s N_t(s) dP_t(s)ds + \int_s dN_t(s) P_t(s)ds + \int_s dN_t(s) dP_t(s)ds
\end{equation}
I have being trying to understand how this follows from Ito's lemma, but I don't see it.
Thank you

A: The product rule for finite differences is $\Delta(fg)=\Delta f g + \Delta g f + \Delta f \Delta g$. In classical calculus, when we send $\Delta t \to 0$, the last term is much smaller than $\Delta t$, so it vanishes in the limit. In stochastic calculus, the lowest order terms in $\Delta X_t$ and $\Delta Y_t$ are on the order of $(\Delta t)^{1/2}$: namely, the stochastic integral terms. Consequently when those two terms multiply, we get a term which is on the order of $\Delta t$, which does not vanish in the limit, and we have to include it. So if
$$dX_t = a dt + r dW$$
and
$$dY_t = b dt + s dW$$
(for the same Brownian motion $W$), then
$$d(X_t Y_t)=X_t dY_t + Y_t dX_t + dX_t dY_t \\
= X_t (b dt + s dW) + Y_t ( a dt + r dW) + (a dt + r dW)(b dt + s dW) \\
= (a Y_t + b X_t + rs) dt + (r Y_t + s X_t) dW$$
using the informal rules $(dW)^2=dt$ and dropping all terms of order higher than $dt$. (Here $a,b,r,s$ might be functions, it doesn't matter.)
This can be rigorously justified with Ito's lemma: the "extra" term comes from the Hessian of $xy$, which is $\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}$.


text:
Q: Error creating bean with name 'authorController' defined in file "..." : Unsatisfied dependency expressed through constructor parameter 0 I have spent three days on this problem and still haven't found the solution why my program doesn't start.
I try to run the application and I get this huge problem text, I checked countless simular projects and they all are structured quite the same, with one major difference, mine doesn't start.
I tried every possible solution I could find, I am guessing I am missing something in the definition on the class but I literally checked every character.
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2022-12-07T22:48:47.782+01:00 ERROR 5504 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authorController' defined in file [C:\Users\Sashko\IdeaProjects\task_01\target\classes\com\example\task_01\controller\AuthorController.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'authorServiceImpl' defined in file [C:\Users\Sashko\IdeaProjects\task_01\target\classes\com\example\task_01\service\impl\AuthorServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'authorRepository' defined in com.example.task_01.repository.AuthorRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class com.example.task_01.entity.Author
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:793) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:242) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1344) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1188) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:961) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915) ~[spring-context-6.0.2.jar:6.0.2]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.2.jar:6.0.2]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[spring-boot-3.0.0.jar:3.0.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) ~[spring-boot-3.0.0.jar:3.0.0]
    at com.example.task_01.Task01Application.main(Task01Application.java:22) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-3.0.0.jar:3.0.0]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authorServiceImpl' defined in file [C:\Users\Sashko\IdeaProjects\task_01\target\classes\com\example\task_01\service\impl\AuthorServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'authorRepository' defined in com.example.task_01.repository.AuthorRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class com.example.task_01.entity.Author
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:793) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:242) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1344) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1188) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:880) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:784) ~[spring-beans-6.0.2.jar:6.0.2]
    ... 24 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorRepository' defined in com.example.task_01.repository.AuthorRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class com.example.task_01.entity.Author
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:880) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:784) ~[spring-beans-6.0.2.jar:6.0.2]
    ... 38 common frames omitted
Caused by: java.lang.IllegalArgumentException: Not a managed type: class com.example.task_01.entity.Author
    at org.hibernate.metamodel.model.domain.internal.JpaMetamodelImpl.managedType(JpaMetamodelImpl.java:181) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
    at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.managedType(MappingMetamodelImpl.java:496) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
    at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.managedType(MappingMetamodelImpl.java:99) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
    at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:77) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:69) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:246) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:211) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:194) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:81) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:317) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:279) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.util.Lazy.getNullable(Lazy.java:229) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.util.Lazy.get(Lazy.java:113) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:285) ~[spring-data-commons-3.0.0.jar:3.0.0]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:132) ~[spring-data-jpa-3.0.0.jar:3.0.0]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797) ~[spring-beans-6.0.2.jar:6.0.2]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747) ~[spring-beans-6.0.2.jar:6.0.2]
    ... 49 common frames omitted

`
```

Here is a snippet of my code:
[Author entity class](https://i.stack.imgur.com/qmN4x.png)
[Author service class](https://i.stack.imgur.com/HczT4.png)
[Author serviceImpl class](https://i.stack.imgur.com/Ntc9K.png)
[Author controller class](https://i.stack.imgur.com/S8ZdV.png)


text:
Q: An alternative to "pray" without a religious connotation When I write, I try my best to leave religion and words that carry some divine connotation out of it. I recently stumbled upon the phrase in one of my texts:

[...] but pray it never happens.

I am wondering how to rewrite it, removing the connection with deities but keeping the same effect/meaning. Any ideas?

A: Probably your best word is hope:

Hope: to wish for something with expectation of its fulfillment; the feeling that what is wanted can be had or that events will turn out well.

You can also wish well for someone:

Wish: A desire, longing, or strong inclination for a specific thing.

From the Free Dictionary.

A: Depending on the context you could swap it around and find a negative phrase instead: "I dread the day it happens", "the prospect terrifies me", or similar. It might be easier to find intense negative words than positive ones.

A: While this is not actually a response to your question, I'd suggest that you are being excessively deity-phobic. "Pray" has, in our secular society, taken on a non-religious meaning as well as its original.

: to speak to God especially in order to give thanks or to ask for
  something
: to hope or wish very much for something to happen
: to seriously ask (someone) to do something

http://www.merriam-webster.com/dictionary/pray
It's hard to see even a tinge of religious sentiment in a question like, "And what, pray tell, do you think you're doing?"
In trying to avoid "pray" in your original example, you make your sentence more complex and less pithy. If the phrase were "but pray to God that it never happens", I'd just suggest leaving out "to God", but the phrase as it stands has no religious connotation that I can detect.

A: Or simply,
  "May it never happen."
This implies the entreaty to someone or something greater than ourselves without raising the question of to whom the entreaty is addressed.

A: In the sense that a prayer is a begging request (Dictionary.com),

1) to offer devout petition, praise, thanks, etc., to (God or an object of worship)
  4) to make earnest petition to (a person)
  5) to make petition or entreaty for; crave

you could use plead (Dictionary.com):

1) to appeal or entreat earnestly


text:
Q: PHP Get Shape Coordinates From Points Im sure if the title is exactly what I am trying to describe so sorry if it isnt.
Ok here is what i am trying to do:

What i want to do is create a function that you can enter unlimited ammount of coordinates ( the blue dots) and then it will create a shape like so and then return all coordinates the shape covers. Because this is for working with pixels, there will be no decimal coordinates.
Something that can be used like so:
print_r(get_coords(12,6, 23,13, 30,9, 37,24, 24,34, 25,24, 7,30, 6,15));

// ^ Will output an array of all x and y coordinates that the shape covers

How would i go about doing something like this?

A: http://php.net/imagefilledpolygon