text:
Q: How to implement less and greater than rules with decision table in drools? I would like to implement simple rules based on the less and greater values in drools using decision table.
It is easy enough to implement the rules in drl, for example:
rules "less than"
when Example(value < 10)
then
    System.out.println("Less than 10")
end

rules "equals"
when Example(value = 10)
then
    System.out.println("Equals 10")
end

rules "greater than"
when Example(value > 10)
then
    System.out.println("Greater than 10")
end

But how can I translate it into decision table in drools? All the examples I have seen so far is to have the comparison done in condition cell. Is it even possible to do the comparison in value cell?
All example I had seen are in format of:
CONDITION                          |  ACTION
Example                            |
value                              |
-----------------------------------|-------------------------------------
10                                 |  System.out.println("equals to 10")

But that only applies to 1 rule, and doing the following totally has different meaning:
CONDITION  | CONDITION  | CONDITION  | ACTION
Example
value      | value > $1 | value < $1 |
-----------+------------+------------+----------------
10         | 10         | 10         | ???

Is even possible to do the following?
CONDITION                          |  ACTION
Example                            |
value                              |
-----------------------------------+----------------------------------------
10                                 |  System.out.println("equals to 10")
> 10                               |  System.out.println("greater than 10")
< 10                               |  System.out.println("less than 10")

What is the right way to implement these rules?

A: I found out that I can achieve what I needed by putting just $param in the constraint field cell and put in the whole constraint in the value cells. So the decision table looks like this:
CONDITION                      | ACTION
Example                        |
$param                         | System.out.println("$param");
-------------------------------+-----------------------------------
value == 10                    | equals to 10
value > 10                     | greater than 10
value < 10                     | less than 10

A: It is possible to give the part of the condition as a value. In the header you can give "value $param" to evaluate. (BTW to be able to enter values like == 10 you have to change the cell format to Text in Excel)
CONDITION                          |  ACTION
Example                            |
value $param                       |
-----------------------------------+----------------------------------------
== 10                              |  System.out.println("equals to 10")
in (10, 11)                        |  System.out.println("is 10 or 11")
> 10                               |  System.out.println("greater than 10")
< 10                               |  System.out.println("less than 10")

A: You can take look at this
http://s11.postimage.org/oya6zxr83/Screenshot.png
here we take userlocation and count from user and check if count is less than initial count of each city and if condition satisfied the loop will run till Loop Condition.
Hope It will Be Helpful .


text:
Q: Diagnosing / Servicing A Notebook GPU I have a GPU (a GTX 260M) that is causing windows to lockup.
I was talking to a service rep from the notebook manufacturer and they said typically the technicians go through this process:

Usually to diagnose a GPU multiple things are done.  If the computer will still boot then they will put in a test drive with the original factory created driver and test the GPU with a variety of burn in tests i.e. 3dmark vantage, 3dmark06, furmark, etc.  If it cannot boot up then they would take a physical look at it and check to see that the solder around the seating of the chipset is still intact and not melted away.  Then it would be removed and placed in its own chassis by itself for independent testing and a possible refurbishing.  If they think it can be refurbished a price to do so will be quoted out, otherwise they will recommend that it be replaced.
Most likely your GPU has just failed.  Whether it is due to prolonged use, excessive heat, electrical problems, or most commonly the seating around the GPU melts and the chip pops out slightly.  Laptop GPU's work a little differently than desktop GPUs.  In most cases they will work without artifacting or render problems.  They will typically start to make your driver reset itself continuously as windows 7 will reset the driver instead of bluescreen when the video card has a failure.

So basically what I want to know is how do I go about this process myself. Is a service manual 100% necessary and where can I find one [notebook is a sager NP8662(SKU M860TU-2)]. If the seating has failed or the chip has popped out, is this something I can fix myself ? What other possibilities for hardware failure could i diagnose myself ?
Sorry if this isn't the best place to ask this, but notebooks aren't the modular, well documented, computer that today's desktops are and I haven't been able to find any literature on the subject.

A: If it is still barely working, you may only manually check if cooling/thermo-interface failed by checking core temperature (should not exceed 70-80C when idle/under load).
If it's not the case, then it might be broken solder balls, which manifest only when PCB expands due to heat... Usual solution is to reball/resolder GPU, but this is... not easy at home (But here in Soviet Russia we fix such issues at home by baking board at 250-300C for few minutes).

redpajama_set_name: RedPajamaStackExchange


text:
Q: React - PropTypes are checked at creation time not render time I have a react component which can accept children component and decide whether or not to render them. If it renders them, it also passes along a onClick handler to the children.
render() {
    const { children } = this.props;
    return (

        { this.state.showDropdown
          ? (

              {React.Children.map(children, (child, index) => React.cloneElement(child, {
                onClick: () => this.onOptionSelected(index),
              }))}

          )
          : null }

    );
  }
}

As it seems, these children component would always require an onClick handler to be passed on from the parent, so i have marked it as isRequired in the children proptypes.
Option.propTypes = {
  children: PropTypes.node.isRequired,
  onClick: PropTypes.func.isRequired,
};

The problem is, onClick is always added by the parent, so when we write the parent component like this:
<Select>
      <Option>One</Option>
      <Option>Two</Option>
      <Option>Three</Option>
</Select>

We shouldn't need to specify an onClick on the children. But React warns about it:
 Warning: Failed prop type: The prop `onClick` is marked as required in `Option`, but its value is `undefined`.
     in Option

which is understandable as it seems the Option elements are created and propTypes checked even before they are passed on to the Select element for rendering.
Is there a way to make it work well, should i make the onClick not required , or should i pass in a no-op function whenever i create Option element , though i know it would be overridden later by the parent.


text:
Q: Show that $\operatorname{div}(f∇g) = f∇^2g + ∇f \cdot ∇g$ where $f$ and $g$ are scalar functions. Show that $\operatorname{div}(f∇g) = f∇^2g + ∇f \cdot ∇g$ where $f$ and $g$ are scalar functions.
How can I verify this?

A: You can proceed by direct computation
$$
\mathrm{div}(f\nabla g)=\sum_{j=1}^n\partial_j(f\partial_jg)=\sum_{j=1}^n
(\partial_jf\partial_jg+f\partial_{jj}g)=\nabla f\cdot\nabla g+f\Delta g.$$

A: Have you encountered the equality $div(\phi \vec F)=\nabla\phi.\vec F+\phi div(\vec F)$? Direct application I think that should give you what you wanted.

A: You need to know the properties of the operator $\nabla.$ In particular here a product rule has been used. Then the left hand side is $$\nabla \cdot f\nabla g=f\nabla\cdot \nabla g+\nabla g\cdot\nabla f=f\nabla^2g+\nabla g\cdot\nabla f.$$


text:
Q: exclude weekends from month except a particular weekend I have written the following query in SQL Server
(QUERY)

select ISNULL(count(WORKHOUR) ,'-') AS present,
ISNULL((count(*)-count(WORKHOUR)),'-') AS absent,
ISNULL(cast(SUM(DateDiff(MINUTE,  CAST('0:00' as time), WORKHOUR))/60 as nvarchar(3)) + ':' + cast(SUM(DateDiff(MINUTE,  CAST('0:00' as time), WORKHOUR))%60 as nvarchar(2)),'-') AS TOTALWRKHRS,
ISNULL(cast(AVG(DateDiff(MINUTE,  CAST('0:00' as time), WORKHOUR))/60 as nvarchar(3)) + ':' + cast(AVG(DateDiff(MINUTE,  CAST('0:00' as time), WORKHOUR))%60 as nvarchar(2)),'-') AS AVGWRKHRS
from "+**currMonthVal**+" m,"+**currYearVal**+" e WHERE E.EMPID=M.EMPID AND E.LOCATION=M.LOCATION AND M.EMPID = ?
and DATENAME(WEEKDAY, attdate) not IN ('Saturday', 'Sunday') and CONVERT(VARCHAR(10),ATTDATE,3) not in ("+**resultantHL**+")

where currMonthVal and currYearVal are Month and Year values passed from outside and resultantHL are the holiday_dates (like '24/12/2016','25/12/2016') passed from outside.
This query works fine.
I have a table named WORKING_DAYS as follows:'

COLUMN_ID     COLUMN_NAME     DATA_TYPE
---------------------------------------
1                ID           NUMBER
2               WDATE         DATE
3             INSTITUTE_ID    NUMBER

and sample data in table is:

COLUMN_ID     WDATE     INSTITUTE_ID
---------------------------------------
1            05-12-15     1
2            19-11-16     1

These two dates in table are actually declared as extra working days in respective months and fall on either Saturday or Sunday.
My requirement is :
I have excluded all Saturday and Sunday from the month in the query above [using DATENAME(WEEKDAY, attdate) not IN ('Saturday', 'Sunday')] but I do not want to exclude the above two dates in WORKING_DAYS table but include them
And I want to do that in the same query if possible as that too in WHERE clause.
How can I do so?
Note:  I have already retrieved the extra working days from WORKING_DAYS table and stored in a string variable and wish to pass that variable value in the condition

A: An OR your date is also on WORKING_DAYS should suffice :
Replace
DATENAME(WEEKDAY, attdate) not IN ('Saturday', 'Sunday')

by
(DATENAME(WEEKDAY, attdate) not IN ('Saturday', 'Sunday') or adddate in (select wdate from WORKING_DAYS))


text:
Q: Trivial HAProxy UrlRewrite I would like all traffic to an arbitrary domain, let's call it www.example.com, to be url-rewritten to www.google.com so that when I hit http://www.example.com/search?q=haproxy doesn't result in a 404.  Is this even possible?
Here is my .cfg file's content:
global

defaults
        mode http
        timeout connect 5000ms
        timeout client 5000ms
        timeout server 5000ms

frontend http-in
        bind *:80
        default_backend my_backend
        reqrep ^([^\ :]*)\ /\d+/(.+)/?     \1\ /\2

backend my_backend
        server forwardsvr www.google.com:80 check

Thanks in advance for any help!


text:
Q: BIT Type collection sql only store false value In the BIT type SQL collection, only false values or null values can be insert through the api body, but true values or 1 cannot be insert. How can I do it?

In my phpMyAdmin SQL database table, flag is bit type collection. This bit type can't assign true or "1" value from my postman but it can assign false or null value. I would like to assign 1 value in this SQL database. 'm working in a personal project and besides using prepared statements, I would like to use every input as threat. For that I made a simple function.

Here is Alarm class

<?php
    class Alarm{
        // Connection
        private $conn;
        // Table
        private $db_table = "tbl_alarm";
        // Columns
        public $alid;
        public $alarm_time;
        public $flag;
        // Db connection
        public function __construct($db){
            $this->conn = $db;
        }

            public function createAlarm(){
            $sqlQuery = "INSERT INTO
                        ". $this->db_table ."
                    SET
                        alarm_time = :alarm_time,
                        flag = :flag";

            $stmt = $this->conn->prepare($sqlQuery);

            // sanitize
            $this->alarm_time=htmlspecialchars(strip_tags($this->alarm_time));
            $this->flag=htmlspecialchars(strip_tags($this->flag));

            // bind data
            $stmt->bindParam(":alarm_time", $this->alarm_time);
            $stmt->bindParam(":flag", $this->flag);

            if($stmt->execute()){
               return true;
            }
            return false;
        }
}?>

This is create-alarm.php
Is this enought or should I use to the following code?

There is Alarm API php code

<?php
    header("Access-Control-Allow-Origin: *");
    header("Content-Type: application/json; charset=UTF-8");
    header("Access-Control-Allow-Methods: POST");
    header("Access-Control-Max-Age: 3600");
    header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
    include_once '../database.php';
    include_once 'alarm.php';
    $database = new Database();
    $db = $database->getConnection();
    $item = new Alarm($db);
    $data = json_decode(file_get_contents("php://input"));

    $item->alarm_time = $data->alarm_time;
    $item->flag = $data->flag;

    if($item->createAlarm()){
        echo 'Alarm created successfully.';
    } else{
        echo 'Alarm could not be created.';
    }
?>

Sorry this could be a silly question but I would like to avoid any problem with me code :) Thanks for your help


text:
Q: Executing dplyr::left_join within a function using by=c(x=y) error I am trying to write a function around dplyr::left_join, to simplify a repeated procedure I need to carry out multiple times.
Consider the following code:
    testdf <- data.frame(X1 = c("A", "B", "C"), X2 = c(1,2,3))

    testdf2 <- data.frame(Y1 = c("a", "b", "c"), Y2 = c(1,2,3))

    testdf3 <- dplyr::left_join(testdf, testdf2, by=c("X2" = "Y2"))

This approach works, as testdf3 will be a dataframe consisting of X1, X2 and Y1.
Now, consider the following function:
    test_function <- function(df1, df2, col1, col2){

        output_dataframe <- dplyr::join(df1, df2, by=(col1 = col2))

        return(output_dataframe)

    }

    output1 <- test_function(testdf, testdf2, "X2", "Y2")

This code throws me the following error:
"Error: by can't contain join column col1 which is missing from LHS
It might be something minor as it seems to me it will not copy the column name variable into the left_join function properly, but I have been struggling with this problem for quite a while now.
I tried approaches such as the following:
    test_function <- function(df1, df2, col1, col2){

        helper <- c(col1 = col2)

        output_dataframe <- dplyr::join(df1, df2, by=helper)

        return(output_dataframe)

    }

However, the error is identical and I have no idea how to solve this.
I need this for a function which condenses several steps I need to execute repeatedly, executing the left_join within another function will therefore help me keep my code clean and readable. Does anyone know how to solve this?

A:  This has something to do with evaluation, i think (see here:https://adv-r.hadley.nz/evaluation.html)  Maybe not...
I found a kind of hacky way, but it works for me:
test_function <- function(df1, df2, col1, col2){

   helper <- col2
   names(helper) <- col1

   output_dataframe <- dplyr::left_join(df1, df2, by=helper)

   return(output_dataframe)

}


text:
Q: Convert String Expression into boolean expression class A{

    public static void main(String a[]){
        String ad ="1<2";
        Boolean b = Boolean.parseBoolean(ad);
        if(b){
            System.out.println("true");
        }
        else
        {
            System.out.println("false");
        }
    }
}

I was hoping the output would be true but it actually prints false.

A: You seem to confuse how Boolean.parseBoolean works. The javadoc clearly states that:

The boolean returned represents the value true if the string argument
  is not null and is equal, ignoring case, to the string "true".

I.e. only expressions like Boolean.parseBoolean("True") or Boolean.parseBoolean("tRuE") return true, there is no argument evaluation done like for example in Javascript's eval() (although you can use the ScriptEngine in Java).
See this example:
public static void main (String[] args) throws java.lang.Exception
{
    String ad ="1<2";
    ScriptEngineManager manager = new ScriptEngineManager();
    ScriptEngine engine = manager.getEngineByName("js");
    Object result = engine.eval(ad);
    System.out.println(Boolean.TRUE.equals(result)); // true
}

A:     Here we go:
class A{

public static void main(String a[]){
    String ad ="1<2";
    String tmpDataArray[] = ad.split("<");
   int num1 = Integer.parseInt(String.valueOf(tmpDataArray[0]));
   int num2 = Integer.parseInt(String.valueOf(tmpDataArray[1]));

   // Boolean b = Boolean.parseBoolean(ad);
    if(num1<num2){
        System.out.println("true");
    }
    else
    {
        System.out.println("false");
    }
}}


text:
Q: Get URL of specific domain from a text if this text contains a certain date pattern I have a String STRING of this form:
[CDATA[A title for the URLs with a date 2013.12.10 in it

    http://www.foobar.com/foo/bar

http://bar.com/foo

http://myurl.com/foo

http://desiredURL.com/files/ddd

http://asdasd.com/onefile/g.html

http://second.com/link

]]

Theres a date in the first line that I need to compare to today's date and if that is true I want to get the URL of a specific domain from one of the succeeding lines.
I have done some parsing on the date line:
DATE=`date +%Y.%m.%d`
LINEDATE=`echo "$line" | grep  $DATE |   sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p'`

So what I need is a regular expression that finds in between  [CDATA and ]] said Datepattern and if this is todays date, gets the URL of domain desiredURL.com. Maybe something like this:
URL = `echo $STRING | sed 'Pattern'`

Where URL is empty if the string didnt contain todays date or did not contain a url of that domain (or both).

A: This will work:
DATE=`date +%Y.%m.%d`
DESIRED="desiredURL.com"
URL=`echo ${STRING} | sed -n s"/.*\[CDATA\[\(.*${DATE}.*${DESIRED}.*\)\]\].*/\1/gp"`
echo "URL=${URL}"

A: In KSH/AIX (so pipe var work outside the line and sed is POSIX and not GNU sed)
date +"%Y[.]%m[.]%d" | read DATE
echo "desiredURL.com" | sed 's/\./[.]/g' | read -r URL

echo "${STRING}" | sed -n "/A title for the URLs with a date ${DATE}/, {
   /${URL}/ s|^[[:blank:]]*
||p
   }'

Be carrefull of RegEx char in your A title for the URLs with a date


text:
Q: Network connection keeps failing on some networks [Ubuntu 20.04] I have a strange issue regarding my network connection. On most networks there is no problem and everything works great, and then on some networks I cannot seem to load any pages or keep any connection stable. Also ssh connections on the terminal and other connections are unstable. The network says it is still connected, but apparently it is not.
My first thought was it could be a WiFi issue, but the problem remains when trying through a wired connection. Everytime I reconnect it works for a brief moment, but never long.
I have read through some other questions here and one StackOverflow, but none look like they describe the same issue.
Does anyone have any idea what this could be or had the same issue and found a fix for it?
I am running Ubuntu 20.04 on a Dell Precision 5550, if any more details are needed please comment so I can provide them.
Thanks in advance!


text:
Q: How to compare dates with different precision I asked this question regarding how to compare datetime2 values, but ignoring the nanoseconds. Since there is some rounding involved, it fails to compare the values properly.
In java, I can get a Long-value from Date and Timestamp which represents the milliseconds since January 1, 1970, 00:00:00 GMT. This is a pretty safe way to compare dates in java.
Is there a way to either
A) Get a numeric value from a datetime2 value which on represents the amount of milliseconds
B) Alter the rounding from the milliseconds to round down instead of up.
Example values:
2018-01-24 16:20:51.0715460
2018-01-25 09:52:04.1946950
2018-01-25 09:52:04.1946950

should match with
2018-01-24 16:20:51.0710000
2018-01-25 09:52:04.1940000
2018-01-25 09:52:04.1940000

Currently I am using cast(date as datetime2(3)) to receive the most precise result, but they still don't match due to rounding.
Can anyone give me a convenient way to compare the values above to match?

A: You can do this by extracting the number of milliseconds from your unrounded date, use the modulus function to get the remainder from 1000000, then deduct this from your original date, e.g.
SELECT  A,
        B,
        RoundDown = DATEADD(NANOSECOND, -DATEPART(NANOSECOND, A) % 1000000, A),
        Match = CASE WHEN DATEADD(NANOSECOND, -DATEPART(NANOSECOND, A) % 1000000, A) = B THEN 1 ELSE 0 END
FROM    (VALUES
            (CONVERT(DATETIME2(7), '2018-01-24 16:20:51.0715460'), CONVERT(DATETIME2(7), '2018-01-24 16:20:51.0710000')),
            (CONVERT(DATETIME2(7), '2018-01-25 09:52:04.1946950'), CONVERT(DATETIME2(7), '2018-01-25 09:52:04.1940000')),
            (CONVERT(DATETIME2(7), '2018-01-25 09:52:04.1946950'), CONVERT(DATETIME2(7), '2018-01-25 09:52:04.1940000'))
        ) x (A, B);

Gives:
A                               B                               RoundDown                       Match
-------------------------------------------------------------------------------------------------------
2018-01-24 16:20:51.0715460     2018-01-24 16:20:51.0710000     2018-01-24 16:20:51.0710000     1
2018-01-25 09:52:04.1946950     2018-01-25 09:52:04.1940000     2018-01-25 09:52:04.1940000     1
2018-01-25 09:52:04.1946950     2018-01-25 09:52:04.1940000     2018-01-25 09:52:04.1940000     1

For comleteness, here is the same thing with normal rounding, rounding up, and rounding down
SELECT  Original = A,
        RoundDown = DATEADD(NANOSECOND, -DATEPART(NANOSECOND, A) % 1000000, A),
        RoundUp = DATEADD(NANOSECOND, 1000000 - DATEPART(NANOSECOND, A) % 1000000, A),
        RoundNormal = CONVERT(DATETIME2(3), A)
FROM    (VALUES
            (CONVERT(DATETIME2(7), '2018-01-24 16:20:51.0715460')),
            (CONVERT(DATETIME2(7), '2018-01-25 09:52:04.1946950')),
            (CONVERT(DATETIME2(7), '2018-01-25 09:52:04.1946950')),
            (CONVERT(DATETIME2(7), '2018-01-25 09:52:04.1943950'))
        ) x (A);

A: One quick option is to convert to varchar(23) which will essentially truncate the value
Example
Declare @YourTable Table ([D1] datetime2)
Insert Into @YourTable Values
 ('2018-01-24 16:20:51.0715460')
,('2018-01-25 09:52:04.1946950')
,('2018-01-25 09:52:04.1946950')

Select *
      ,NewVal = convert(varchar(23),D1)+'0000'
from @YourTable

Returns
D1                             NewVal
2018-01-24 16:20:51.0715460    2018-01-24 16:20:51.0710000
2018-01-25 09:52:04.1946950    2018-01-25 09:52:04.1940000
2018-01-25 09:52:04.1946950    2018-01-25 09:52:04.1940000


text:
Q: SpecFlow + Selenium-WebDriver: Sharing a WebDriver Across Steps? Say I have a scenario that uses steps that are contained in two different classes. Is there a way for both of them to have a handle to the same IWebDriver instance without going through ScenarioContext.Current["webdriverVariableName"]?
That's so ugly. Is there a cleaner way?
I was going to make a class with a public static IWebDriver property that gets assigned at the start of every scenario, so that all my steps could refer to it, but I don't think that will work when I start to run them in parallel, as each scenario would overwrite the global driver.

A: Specflow offers a Dependency Injection mecanism, so you could get your web driver instance injected in your steps.
See https://github.com/techtalk/SpecFlow/wiki/Context-Injection
See the "Avanced options" section.

A: I have just started using Specflow but this appears to work;

*

*Create a class which takes IObjectContainer as a constructor and has a BeforScenario method to create the WebDriver instance;
[Binding]
public class WebDriverSupport
{
    private readonly IObjectContainer _objectContainer;

    public WebDriverSupport(IObjectContainer objectContainer)
    {
        _objectContainer = objectContainer;
    }

    [BeforeScenario]
    public void InitializeWebDriver()
    {
        var webDriver = DriverFactory.CreateDriver();
        _objectContainer.RegisterInstanceAs<RemoteWebDriver>(webDriver);
    }
}

*Create your step classes with a constructor which take RemoteWebDriver;
[Binding]
public class POCSteps
{
    private readonly IdlWebDriver _driver;

    public POCSteps(IdlWebDriver driver)
    {
        _driver = driver;
    }
}

Your steps steps will now have access to a fully instantiated WebDriver object

A: My tests, which are currently working fine running multithreaded webdriver instances, are using a base step definitions class to hold the driver instance. All step definitions inherit from this, so the driver is available to all steps..
namespace Project.StepDefinitions
{
    [Binding]
    public class BaseStepDefinitions
    {
        private const string CurrentPageKey = "Current.Page";
        public static IWebDriver Driver { get; set; }

        protected LogonPageModel LogonPage
        {
            get { return (LogonPageModel)ScenarioContext.Current[CurrentPageKey]; }
            set { ScenarioContext.Current[CurrentPageKey] = value; }
        }

        protected RegisterPageModel RegisterPage
        {
            get { return (RegisterPageModel)ScenarioContext.Current[CurrentPageKey]; }
            set { ScenarioContext.Current[CurrentPageKey] = value; }
        }
    }
}

//////////////
namespace SpecDriver.StepDefinitions
{
    [Binding]
    public class LoginSteps : BaseStepDefinitions
    {
        [Given(@"I navigate to the homepage")]
        public void GivenINavigateToTheHomepage()
        {
            Driver.Navigate().GoToUrl(SettingsManager.BaseUrl);
        }
    }
}

etc etc...

A: Just create a new separated class with a static property that returns driver:
static class DriverProvider
{
    private static IWebDriver _driver;
    public static IWebDriver Driver
    {
        get
        {
            if (_driver == null)
            {
                _driver = new ChromeDriver();
                _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(40);
                _driver.Manage().Window.Maximize();
            }
            return _driver;
        }
    }

}

Each time you will need to do something with driver, just call it in a such way:
SomeMethod(DriverProvider.Driver);
//
IWebelement e = DriverProvider.Driver.FindElement(By.XPath("you_XPath"));
e.Click();
// etc etc etc


text:
Q: Is there any way to know what cache size is needed? I am using mysql as a db.
Is there any formula for determining the cache size needed to cache the results?
Thanks

A: Caching where?
PHP has no cache - if you don't enough memory allocated the instance will through a fatal error and stop.
There are lots of caches within MySQL by default it allocates large values for these. IME these can safely be left alone - note that any memory allocated for MySQL means less memory available for the system's I/O caching.
Why do you think you need to fix something?
C.

A: This is usually a function of how much spare RAM you have, the size of your database, and how much of the dataset is "popular".
(Below is assuming that you are talking about an application-level cache, and not I/O caches, buffer caches, or other lower-level caching.)
If you're sizing your cache for performance (i.e., maximize throughput, and minimize latency), then one simple formula would be to use as much as your spare RAM as possible that is less than your total database size. Another simple formula would be to start somewhere between 1% and 10% of your database size, and grow based on usage.
If you want to carefully calculate how much cache you need, then the most reliable way to do it is by experimentation, i.e., run load-tests against growing cache-sizes and graph the hit-rate (This is especially true if your database load/usage characteristics are complicated.)
For example, you can have a graph where the X-axis is the cache-size, and the Y-axis has both hit-rate and query-latency. Your goal would be to find the minimum X (cache-size) where hit-rate is maximized and query-latency is minimized (these could be different points).
In order to do this correctly, you need a real-world load test i.e., if you keep logs of your queries, you can replay them. You may want to limit your replay of only non-mutating queries only (for simplicity).
Note that instead of loadtests, you can simplify this process by adding a cache (start somewhere between 1% and 10%) to a live database, then watching the hit-rate and query-latency over time. This is a bit easier to do if you don't have a load-test framework setup, but may be more intrusive on a production system. If the hit-rate is too low (or query-latency too high), then grow the cache. If not, then see if shrinking it makes a noticeable difference.
(Of course, there are edge cases here, which I'm glossing over, but this is the general idea. E.g., sometimes different types of queries can have different costs, and you may need to allocate different caches for different query types.)
Once you do have a cache, you should monitor it's statistics along with other query stats, such as latency. You may need to grow it over time.
Or, you may find that you need to warm the cache up before you can get any reliable performance. For example, if you rely on your cache to be able to serve out a specific query-load, and your caching component crashes, starting up cold, then your database will get overloaded for some period of time while the cache warms up.
Anyhow, the short answer is that there is no simple solution, and sizing your cache best done by experimentation.


text:
Q: Spring Rest & Jackson: Empty values are transformed in Null values in XML transformation For an app working with:

*

*Spring Framework 4.3.3

*Jackson 2.8.2, modules used:

*

*jackson-annotations

*jackson-core

*jackson-databind

*jackson-dataformat-xml (it disables JAXB 2 annotations)

I use jackson for JSON and XML.
About Spring for Rest working according with:
@PutMapping(value="/{id}",
            consumes={MediaType.APPLICATION_XML_VALUE,
                      MediaType.APPLICATION_JSON_UTF8_VALUE})

and
@PostMapping(value="/{id}",
             consumes={MediaType.APPLICATION_XML_VALUE,
                       MediaType.APPLICATION_JSON_UTF8_VALUE})

And for both scenarios exists the following parameter:
@Validated @RequestBody Persona persona,

The Persona class is declared how:
@JacksonXmlRootElement(localName="persona")
public class Persona implements Serializable {

    @JacksonXmlProperty(localName="id")
    @JsonProperty("id")
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }

    @JacksonXmlProperty(localName="nombre")
    @JsonProperty("nombre")
    public String getNombre() {
        return nombre;
    }
    public void setNombre(String nombre) {
        this.nombre = nombre;
    }
    ...

Note validation annotations (@NotNull, @Size etc) have not been included above
Now about Testing for validation data purposes:
for an Entity with:
null values such as:
person.setNombre(null)
person.setApellido(null)

empty values (of course, it only applies for String type) such as:
person.setNombre("")
person.setApellido("")

When I use the invalid objects to be transformed in JSON and then is send to the rest method in JSON, I can confirm that when the data is transformed to Java again (Remember @Validated @RequestBody Persona persona), through logging I can confirm:
Null scenario:
Invalid data is: Persona [id=null, nombre=null, apellido=null, ...]

Empty scenario:
Invalid data is: Persona [id=, nombre=, apellido=, ...]

for JSON I have
public static String objectToJson(Object object) throws JsonProcessingException {
        ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
        String json = ow.writeValueAsString(object);
        return json;
    }

Until here all is ok.
The problem is with XML
Working with:
public static String objectToXml(Object object) throws JsonProcessingException {
        XmlMapper xmlMapper = new XmlMapper();
        return xmlMapper.writeValueAsString(object);
    }

I did realize the following when the data invalid objects are transformed to XML to be sent to the rest controller when it arrives and is transformed again Java, the following happens:
Null scenario:
Invalid data is: Persona [id=null, nombre=null, apellido=null, ...]

Empty scenario:
Invalid data is: Persona [id=null, nombre=null, apellido=null, ...]

The problem is for the Empty scenario: the data arrives or is transformed how null. It should be
Invalid data is: Persona [id=, nombre=, apellido=, ...]

I need the data how an 'empty' value, not how a null value
Therefore how is possible fix this?
I am assuming I need an extra configuration in some place.
BTW, Jackson for XML in Spring is:
@Bean
public MappingJackson2XmlHttpMessageConverter mappingJackson2XmlHttpMessageConverter(){
    MappingJackson2XmlHttpMessageConverter converter = new MappingJackson2XmlHttpMessageConverter();
        converter.setObjectMapper(jackson2ObjectMapperBuilder().createXmlMapper(true).build());
    converter.setPrettyPrint(true);
    converter.setDefaultCharset(StandardCharsets.UTF_8);
        converter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_XML));
    return converter;
}

@Bean
public Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder(){
    Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
    builder.simpleDateFormat("yyyy-MM-dd");
    return builder;
}

What I need:
Hello, What I need is the following:
If I send an Entity with null values for any field, it must arrives to the rest controller and the @RequestBody Persona must contains the same the null values for the same fields, same thought if the Entity contains empty values and it is sent. It works how is expected in JSON
It only happens for XML when the Entity has null values for any field. When the Entity has empty values for any field. The @RequestBody Persona contains null values, it does not keep the empty values, they have been transformed how null instead. I need keep the same empty values.
Therefore if the Entity has been sent with either null or empty values or both, I need that JSON and XML when the @RequestBody Persona works, it contains the same null or empty values for the same fields how they have been defined originally.
Note seems it is a bug, closely related with:

*

*XML Empty tag to Empty string in the object during xml deserialization


text:
Q: Wordpress Media Library not working properly I'm having an issue with Wordpress media library. No matter how small or big the file, it takes a lot of time to upload, and in most cases it fails to upload; it justs freezes at like 10%. Also, when I try to upload a file, the whole website becomes slow and stops working until I close all the tabs and open the website again. There are like 80 images in the library but only about 10 are showing thumbnails.
Things I have tried but didn't work:
deactivating all the plugins,
deactivating the theme (set it to twenty twenty),
checking folder permission (755)
any help please?


text:
Q: Enable Data Profiling on Apache Airflow Data profiling although present in documentation is not visible in a fresh installation. Is there a way to enable it, or it has been deprecated? Installed version is apache-airflow==1.10.3 in case it helps.

A: Airflow 2 disabled Data Profiling  due to security reasons: (Breaking changes section)

Due to security concerns, the new web server will no longer support the features in the Data Profiling menu of the old UI, including Ad Hoc Query, Charts, and Known Events.

A: Data profile is default UI when install airflow v1.10.3.
If you can not see data profile menu, you might need to double check if 3rd party customized airflow for you.
Airflow use flask as web framework. you can go to the related folder to see if it has been modified.
the configuration file is at [you airflow source code folder]\www\app.py

Thanks for vote for the answer.
The default app.py section related to dataprofiling is below:
 with app.app_context():
        from airflow.www import views

        admin = Admin(
            app, name='Airflow',
            static_url_path='/admin',
            index_view=views.HomeView(endpoint='', url='/admin', name="DAGs"),
            template_mode='bootstrap3',
        )
        av = admin.add_view
        vs = views
        av(vs.Airflow(name='DAGs', category='DAGs'))

        if not conf.getboolean('core', 'secure_mode'):
            print("create_app", __file__)
            av(vs.QueryView(name='Ad Hoc Query', category="Data Profiling"))
            av(vs.ChartModelView(
                models.Chart, Session, name="Charts", category="Data Profiling"))
        av(vs.KnownEventView(
            models.KnownEvent,
            Session, name="Known Events", category="Data Profiling"))

As you can see from above code, it related to secure mode.
      if not conf.getboolean('core', 'secure_mode'):
you might need check you secure mode configuration as well.
Note: pls check if the secure_mode in airflow.cfg is configurated properly.
the data profiling can only be showed in secure_mode = False.
# If set to False enables some unsecure features like Charts and Ad Hoc Queries.
# In 2.0 will default to True.
secure_mode = False


text:
Q: shows blank page after deploying a grails war file on openshift i deployed a war file to openshift after creating a tomcat 7(JBoss EWS 2.0) app using the following guide lines (deploy war file using git)
but after deploying my app it only shows a blank page. here are the logs i got by using the rhc tail command.
==> app-root/logs/jbossews.log <==
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1571)
        at net.sf.ehcache.util.concurrent.ConcurrentHashMap$ValuesView.iterator(
ConcurrentHashMap.java:3252)
        at net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl$1.run(Exten
dedStatisticsImpl.java:104)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47
1)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
access$301(ScheduledThreadPoolExecutor.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
        at java.lang.Thread.run(Thread.java:745)

==> app-root/logs/mysql.log <==
160420 10:20:46 InnoDB: highest supported file format is Barracuda.
160420 10:20:46  InnoDB: Waiting for the background threads to start
160420 10:20:47 InnoDB: 5.5.45 started; log sequence number 1595675
160420 10:20:47 [Note] Server hostname (bind-address): '127.9.179.2'; port: 3306

160420 10:20:47 [Note]   - '127.9.179.2' resolves to '127.9.179.2';
160420 10:20:47 [Note] Server socket created on IP: '127.9.179.2'.
160420 10:20:47 [Warning] 'proxies_priv' entry '@ root@ex-std-node563.prod.rhclo
ud.com' ignored in --skip-name-resolve mode.
160420 10:20:47 [Note] Event Scheduler: Loaded 0 events
160420 10:20:47 [Note] /opt/rh/mysql55/root/usr/libexec/mysqld: ready for connec
tions.
Version: '5.5.45'  socket: '/var/lib/openshift/571649900c1e669c5c00017c/mysql//s
ocket/mysql.sock'  port: 3306  MySQL Community Server (GPL)

==> app-root/logs/phpmyadmin.log <==
[Tue Apr 19 11:24:41 2016] [notice] Apache/2.2.15 (Unix) PHP/5.3.3 configured --
 resuming normal operations
[Tue Apr 19 12:27:32 2016] [notice] SIGHUP received.  Attempting to restart
[Tue Apr 19 12:27:32 2016] [notice] Digest: generating secret for digest authent
ication ...
[Tue Apr 19 12:27:32 2016] [notice] Digest: done
[Tue Apr 19 12:27:32 2016] [notice] Apache/2.2.15 (Unix) PHP/5.3.3 configured --
 resuming normal operations
[Wed Apr 20 10:20:38 2016] [notice] caught SIGWINCH, shutting down gracefully
[Wed Apr 20 10:21:05 2016] [notice] SELinux policy enabled; httpd running as con
text unconfined_u:system_r:openshift_t:s0:c4,c884
[Wed Apr 20 10:21:05 2016] [notice] Digest: generating secret for digest authent
ication ...
[Wed Apr 20 10:21:05 2016] [notice] Digest: done
[Wed Apr 20 10:21:05 2016] [notice] Apache/2.2.15 (Unix) PHP/5.3.3 configured --
 resuming normal operations

the name of the war file i deployed is ROOT.war using git push and it deployed successfully.i am using mysql database and phpmyadmin cartridges.
i just want to figure out why it is showing me a blank page when i try to access the url of my application.
thanks in advance.

A: The log you provided is not helpfull at all, because it's not full, I even can't see what exception was thrown.
This is the best article about deploying grails application on OpenShift, it will help you a lot:
Grails on Openshift
Also the troubleshoutting will be more productive if you use ftp to see what's going on on your server
Using FileZilla and SFTP on Windows with OpenShift

A: i have fixed the problem with the help i got from @Taras Kohut. i added the following lines to my BuildConfig.groovy file.
 grails.project.war.exploded.dir = "/yourLocalPathToClonedOpenshiftFile/webapps/ROOT"
 grails.war.exploded=true

the above lines will generate an exploded war file in your openshift app in the webapps folder.
next i added ROOT.war.deploy file again in the webapps directory.This is a file which instructs jboss that after the push it must take the ROOT folder and deploy it on Tomcat (which is emulated by JBoss) as if it was a war file.
after that i committed and pushed my changes and the app is deployed successfully and everything works fine.


text:
Q: Funcion que devuelve año de una persona sin tener que especificar el mismo Estoy iniciandome en JavaScript y quiero hacer una funcion que devuelva el año de nacimiento de una persona pero tomando el año del servidor (en esta practica, mi notebook). Probe de las siguientes maneras :
    function calcularEdad(yearNacimiento) {
    let today = new Date();
    let year = today.getFullYear;
    return year - yearNacimiento;
}

let edad = calcularEdad(1996);
console.log(edad);

En ese caso la consola me arroja como resultado NaN.
Luego probe de esta manera :
    function calcularEdad(yearNacimiento) {
    let year = new Date().getYear();
    return year - yearNacimiento;
}

let edad = calcularEdad(1996);
console.log(edad);

Y la consola me arroja como resultado -1876.
Agradezco la amabilidad de la comunidad para responder esta pregunta de principiante

A: La primera opcion que pusiste estaba bien, solo te falto colocar el () para poder ejecutar la funcion, asi que enrealidad estabas haciendo una operacion aritmetica con una funcion, lo cual porsupuesto da como resultado NaN, lo he corregido colocando parentesis a getFullYear:

function calcularEdad(yearNacimiento) {
    let today = new Date();
    let year = today.getFullYear();
    return year - yearNacimiento;
}

let edad = calcularEdad(1996);
console.log(edad);

A: Estas tomando como parámetro el prototype de date incorrecto en el segundo caso.

Esta característica ya no se recomienda. Aunque algunos navegadores aún pueden admitirlo, es posible que ya se haya eliminado de los estándares web relevantes, que se esté descartando o que solo se conserve por motivos de compatibilidad. Evite usarlo y actualice el código existente si es posible;

El getYear() método devuelve un año de 2 dígitos o de 4 dígitos:

*

*Para los años comprendidos entre 1900 y 1999, el valor devuelto por getYear()es el año menos 1900. Por ejemplo, si el año es 1976, el valor devuelto es 76.

*Para años menores de 1900 o mayores de 1999, el valor devuelto por getYear()es el año de cuatro dígitos. Por ejemplo, si el año es 1856, el valor devuelto es 1856. Si el año es 2026, el valor devuelto es 2026.

En tu caso necesitamos el año completo, para ello usaremos el prototype de date getFullYear().

function calcularEdad(yearNacimiento) {
    let year = new Date().getFullYear();
    return year - yearNacimiento;
}

let edad = calcularEdad(1996);
console.log(edad)


text:
Q: nodejs express ReferenceError: next is not defined I am trying to control the input I took from a form with joi validation. The function validateCampgrount is a middleware to check it but when I try to write the next function it says next is not defined.*
Where I am using next()
const validateCampground = (req, res, next) => {
  const { error } = campgroundSchema.validate(req.body);
  if (error) {
    const msg = error.details.map((el) => el.message).join(",");
    throw new ExpressError(msg, 400);
  } else {
    next();
  }
};

Error Message
next();
    ^

ReferenceError: next is not defined

Where I am using function
app.post(
  "/campgrounds",
  validateCampground(
    catchAsync(async (req, res, next) => {
      // if(!req.body.campground) throw new ExpressError('Invalid Data', 400)
      const campground = new Campground(req.body.campground);
      await campground.save();
      res.redirect(`/campgrounds/${campground._id}`);
    })
  )
);

A: It seems that you are using middleware wrong. See this tutorial for a full guide.
In your code, you are wrapping a function in your middleware. Instead, you need to pass the middleware as a parameter to app.post(). Like this:
app.post("/campgrounds", validateCampground, async (req, res, next) => {
  const campground = new Campground(req.body.campground);
  await campground.save();
  res.redirect(`/campgrounds/${campground._id}`);
});


text:
Q: emmeans doesn't show the correct output I am running the following LMER model with Place (five dummy-coded levels: bilabial, dental, retroflex, palatal, and velar) and Laryngeal (three dummy-coded levels: voiceless unaspirated, voiceless aspirated, and voiced unaspirated) as fixed factors, Speaker as a random factor.
lmer_model <- lmer(VOT ~ Place+Laryngeal + (1+Place+Laryngeal|Speaker), data = data)

summary(lmer_model)

Then I use emmeans() to look at the pairwise comparisons.
emmeans(lmer_model, pairwise~Laryngeal|Place, lmer.df = "satterthwaite")

The output of emmeans can be found below.
If you look at the p values and estimates, they all look similar. I am not sure what may be wrong.
Thanks

A: The results you see are consistent with the model that you built.
Your model includes only additive terms for Place and Laryngeal, without any interactions. That makes an assumption that the effect of differences among Laryngeal categories will be the same regardless of Place.
The absolute values of VOT might well differ from Place to Place, which you could examine with a different call to emmeans(). But the pairwise comparisons you show are between pairs of Laryngeal categories within the same Place, so those differences should be the same for each Place, as you found.
If you expect the influence of Laryngeal categories to have different effects on VOT depending on Place, then you need to include an interaction term between those predictors. You will need a pretty large study to evaluate that possibility, as with 5 levels of Place and 3 of Laryngeal the interactions between them will add 8 more fixed predictors to your model. You also will need to evaluate whether you need to incorporate more random effects for interactions.


text:
Q: Print string with spaces which complete it to requested length - Python 2.7 I'm using Python 2.7 and I want to print a variable which its length is unknown, with spaces which complete the string to requested length.
Example of how it is done in Python 3.7 using f-strings:
print(f"{variable:<20}")

The 2.7 version doesn't support f-strings. Is there another way to do it?

A: As suggested in comments, you can use str.format.
variable = 'hello'
"{:<20}".format(variable)
# 'hello               '

Or:
"%-20s" % variable
# 'hello               '

If you prefer to do it the hard way.
def pad(s, width):
  if len(s) < width:
    return s + ' ' * (width - len(s))
  else:
    return s

pad(variable, 20)
# 'hello               '


text:
Q: Save and Restore an object to database Lets say i have an object with this format:
   public class ObjectClassSample
    {
        public string product { set; get; }
        public string Description { set; get; }
        public int Price { set; get; }
    }

Im trying to same this object inside a string field in a record in my database. is it possible to this without converting this to JSON, as i was thinking what is the best way to save and restore this.

A: One way or another you have to convert that object to a string, I'm unsure why you don't want to use JSON, but to do it without converting to JSON, you could make your own error prone format.
Here is an example of just converting the object to a string, separating each property by a comma.
Some Extension Methods
public static class ObjectSampleExtensions
{
    public static ObjectClassSample ToObjectClassSample(this string s)
    {
        var parts = s.Split(new [] { ','});
        return new ObjectClassSample
        {
              product = parts[0],
              Description = parts[1],
              Price = int.Parse(parts[2])
        };
    }

    public static string ConvertToString(this ObjectClassSample objectToConvertToString)
    {
        const string delimiter = ",";
        var sb = new StringBuilder();
        sb.Append(objectToConvertToString.product);
        sb.Append(delimiter);
        sb.Append(objectToConvertToString.Description);
        sb.Append(delimiter);
        sb.Append(objectToConvertToString.Price);

        return sb.ToString();
    }
}

Then Usage
void Main()
{
    var obj = new ObjectClassSample
    {
        Description = "this is the description",
        Price = 3,
        product = "my product"
    };

    var s = obj.ConvertToString();

    //you can now save s to the database
    Db.Save(s);

    //later on pretend you read 's' back from the database
    s = Db.ReadAnItem();
    var objectFromDb = s.ToObjectClassSample();
}

So yeah, you can serialize the data anyway you want, but I would use a common format: json, xml, csv, whatever.
I wouldn't recommend using the code above, that was just an example to show you can basically do whatever you want to convert it to a string, so long as you can convert it back.  Using a json parser would be much easier though.
An example with ServiceStack.Text would look like this
var objToSerialize = new ObjectClassSample(); //fill this with data
string myObjectAsString = objToSerialize.ToJson();

//reading it back from the database

ObjectClassSample myObj = myObjectAsString.FromJson<ObjectClassSample>();

I'm sure newstonsoft.json is similar.
As you can see...much prettier.


text:
Q: Can one alter a PostgresSql table to have an autogenerated keys after the table has values? Is it possible to only alter a table to make an existing column a serial auto generated key, without adding a new column? Sorry if this question is a bit newbie-ish for PostgreSQL, I'm more a SQL Server person but moving to PostgreSQL..
In a nut shell the program will copying an existing SQL Server database into PostgreSQL. With the desire to have a mirrored DB in PostgreSQL as the source from SQL Server with the only caveat one may selectively include/exclude any table or column as desired, or do everything...
Given the process copies all values, thought one should be able create the keys after the copy has finished just as one may do in SQL Server. Thought PostgreSQL would have a comparable methods as SQL Server's SET INSERT_IDENTITY [ON|OFF] so one may override the auto generated key with a desired value. Not seeing an equivalent in PostgreSQL. So my fallback is to create the mirrored records in Postgres without keys any keys and then alter the tables. But it seems to fix up the table as desired one has create a new column, but doing this break or cause a headache fixing up the RI for PK/FK relationships.
Any suggestions? Thanks in advance.

A: In PostgreSQL, the auto-generated key is always overridden if you insert an explicit value for it. If you don't specify a value (omit the column), or specify the keyword DEFAULT, a generated key is used.
Given table
 CREATE TABLE t1 (id serial primary key, dat text);

then both these will get a generated key from sequence t1_id_seq:
 INSERT INTO t1 (dat) VALUES ('fred');
 INSERT INTO t1 (id, dat) VALUES (DEFAULT, 'bob');

This will instead provide its own value:
 INSERT INTO t1 (id, dat) VALUES (42, 'joe');

You are responsible for ensuring that the provided value doesn't conflict with existing data, or with future values the identity sequence will generate. PostgreSQL will not notice that you manually inserted a row with id 42 and skip when its own sequence counter gets to that point.
Usually what you do is load with provided values, then reset the sequence to the max of all keys already in the table, so it keeps counting from there for new local inserts.


text:
Q: The norm squared of a moment map I am studying the paper by E. Lerman:
https://arxiv.org/abs/math/0410568
Let $(M,\sigma)$ be a connected symplectic manifold with a Hamiltonian action of a compact Lie group $G$, so that there exist a moemnt map
 $$\mu : M\to\mathcal{G}^\ast$$
$\mathcal{G}^\ast$ being the dual of the Lie algebra of $G$. We assume that $\mu$ is $G$-equivariant:
$$\mu(g\cdot x)=\mathrm{Ad}_g^\ast\circ\mu(x)$$
and that $\mu$ is proper (the preimage of any compact is compact).
Let $f=\|\mu\|^2$ (for an $\mathrm{Ad}$-invariant norm on $\mathcal{G}^\ast$).
I know that the moment map is important by:

*

*a convexity theorem of Atiyah and Guillemin-Sternberg.

*symplectic reduction, where the quotient of the zero level of the moment map by the group makes it possible to construct new symplectic manifolds.

Hence my question:

What is the motivation to study the norm squared of a moment map? in particular, why is it important to know that the zero level set of the moment map is a retract by deformation of a piece of the manifold?

As I understand it, $f$ behaves like a Morse-Bott function (Kirwan works) and that the stable manifold of a critical component of $f$ is a submanifold.
That the gradient flow of $f$ is defined for all $t\geq0$. Here Lerman asserts that this is true because $f$ is proper, but $x^3$ is proper but its gradient $-3x^2\partial_x$ is not defined for all $t\geq0$.
I think we have to show that $\nabla_f$ is $G$-invariant and therefore complete.
That $f$ is real analytic to show that the limit of a trajectory of any point $\phi_t(x)$ is reduced to a point $\phi_\infty(x)$. That the applications $t\to\phi_t(x)$ and $x\to\phi_\infty(x)$ are continuous.


text:
Q: Nuxt generate does not generate index.html I have a Nuxt JS Project on my local maschine and if I launch it, it works with no Problems...But when I try to genereare the files in the dist Folder to Copy it on my Linux Server, it does not work, because there is no index.html....here a shot what it generates me:

As you can see, there is no index.html generated....
Our config is the default nuxt config....would be nice if you could help me :)

A: This often happens, if you have some syntax errors in your pages/index.vue. nuxt:generate won't stop the generation process on error, but skip only this one route. Which leaves you with a missing route.
You should however get a error message similar to this one in your console:
[...]

ℹ Generating pages with full static mode                                                                                12:22:37

 ERROR   /                                                                                12:22:37

ReferenceError: window is not defined
    at pages/index.js:2832:31
    at pages/index.js:1252:10
    at Object.<anonymous> (node_modules/dat.gui/build/dat.gui.js:18:0)
    at __webpack_require__ (webpack/bootstrap:25:0)
    at Module.<anonymous> (components/scene/App.js:1:0)
    at __webpack_require__ (webpack/bootstrap:25:0)
    at Module.<anonymous> (pages/index.js:4603:11)
    at __webpack_require__ (webpack/bootstrap:25:0)
    at Module.<anonymous> (pages/index.vue?b245:27:0)
    at __webpack_require__ (webpack/bootstrap:25:0)
    at async server.js:3496:21
    at async Promise.all (index 0)
    at async getRouteData (node_modules/.cache/nuxt/utils.js:181:0)
    at async Promise.all (index 0)
    at async setContext (node_modules/.cache/nuxt/utils.js:259:0)
    at async createApp (node_modules/.cache/nuxt/index.js:150:0)

✔ Generated route "/sitemap"                                                                                12:22:43
✔ Generated route "/search"

[...]

You can also use nuxt generate --fail-on-error. (see https://nuxtjs.org/docs/2.x/get-started/commands/#fail-on-error)


text:
Q: Using Liouville's theorem to conclude that if $|f(z)| \le |\sin^3 z|$ then $f$ is a multiple of $\sin^3 z$ Let $f(z)$ be an entire function and suppose that $
|f(z)| \leq |\sin^3(z)|$ for all $z \in \mathbf{C}$. Show that $f(z) = \lambda \sin^3(z)$ for some $\lambda \in \mathbf{C}$.

A: It is a theorem that if a function $g$ is holomorphic in a (deleted) neighborhood of a point and bounded in that neighborhood, then $g$ has only a removable singularity. (And analogously, if $|g(z)| \to \infty$ as $z \to z_0$, then $g$ has a pole there; the remaining case is that $g$ has an essential singularity.) In this case $g$ has a holomorphic extension across that point.
Following your comments, this deals with the issue of concluding that $f$ has zeros of multiplicity at least $3$ at every zero of $\sin^3 z$. So setting $g(z) = f(z) / \sin^3 z$ leads to a holomorphic function with a discrete set of removable singularities. Replacing $g$ with an entire extension and invoking Liouville completes the proof.


text:
Q: Slack blocks nested bullet point list I need to send a API request to slack with a message containing a nested bullet point list. I've found the following answer to a existing question: https://stackoverflow.com/a/68483110/16659015 but sadly this only shows a normal bullet point list without nesting.
I couldn't find any resources or documentation to this rich_text and rich_text_list types and when trying different orders the block kit builder threw errors.
How can I utilize the blocks with rich_text to create a nested bullet point list?
(I know there are workarounds but if a 1 dimensional bulletpoint exists through blocks then a nested should also be possible somehow)


text:
Q: STM32 - Dangers of using Data Watchpoint and Trace (DWT) Looking at the code that is required to initialize Data Watchpoint and Trace (DWT) on STM32F7:
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
DWT->LAR = 0xC5ACCE55;
DWT->CYCCNT = 0;
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;

Especially this line to unlock access to DWT register:
DWT->LAR = 0xC5ACCE55;

It resembles switching a safety catch before pulling the trigger. Like getting access to some dangerous action.
At the same time, looking in the documentation I didn't find any dark sides of using DWT. So
Why this explicit set of 0xC5ACCE55 is required here (not like for the other subsystems)? Is there any drawbacks? Dangers? Or something that is really need this safety catch?
P.S. I'm using DWT to access DWT->CYCCNT for performance profiling.

A: The CoreSight docs provide some info on the need for the lock and possible dangers from not using it.
That info is copied below.
In the copied text (below), it says that this lock feature is deprecated starting in CoreSight v3.
Further down in that doc (not copied here) there is info on the LSR and LAR registers, including a bit that specifies whether "a Software lock mechanism is implemented". Perhaps that bit indicates whether the lock feature is depricated?
I could not find info on how to determine my MCU's CoreSight version.
This post has discussion on which MCUs have the lock feature:
https://community.st.com/s/question/0D50X0000AIeZvnSQF/help-what-is-going-on-

From, "ARM® CoreSight™ Architecture Specification v3.0":
B2.3.10 LSR and LAR, Software Lock Status Register and Software Lock Access Register
*Purpose
The Software lock mechanism prevents accidental access to the registers of CoreSight components. Software that is being debugged might accidentally write to memory used by CoreSight components.  Accidental accesses might disable those components, making the software impossible to debug.  The CoreSight programmers' model includes a Lock Status Register LSR, and a Lock Access Register, LAR, to control software access to CoreSight components to ensure that the likelihood of accidental access to CoreSight components is small.
Note From CoreSight version 3.0 onwards, implementation of the Software lock mechanism that is controlled by LAR and LSR is deprecated.
To ensure that the software being debugged can never access an unlocked CoreSight component, a software monitor that accesses debug registers must unlock the component before accessing any registers, and lock the component again before exiting the monitor.
ARM recommends that external accesses from a debugger are not subject to the Software lock, and therefore that external reads of the LSR return zero.  For information on how CoreSight components can distinguish between external and internal accesses, see Debug APB interface memory map on page D2-116.
A system can include several bus masters capable of accessing the same CoreSight component, for example in systems that include several processors.  In this case, it is possible for software running on one processor, processor A, to accidentally access the component while it is being programmed by a debug monitor running on another processor, processor B.  Because the component that is being accessed cannot distinguish between the two processors, processor A might disable the component and cause problems for processor B.  The probability of this occurring is low, but must be considered if there are special circumstances that make this scenario more likely.*


text:
Q: ToIsoString is not a function when I get my date object from v-datetimepicker When I use Vuetify datetimepicker, I get the following date: "Wed Mar 16 2022 04:20:00 GMT+0100"
I need to convert this to ISO8601. But if I store this date in a variable called "date" and try to convert it like this:
date1 = new Date(date).toISOstring();

It returns an error that says "(intermediate value).toIsoString is not a function".
What am I doing wrong here? I'm assuming it's not a valid date object, but how can I then convert this mess into a working date object?

A: This happenes when the toISOString() method is called on a value that is not a date object. To solve the error, make sure to only call the toISOString() method on valid date objects.
const d1 = new Date().toISOString();
console.log(d1); // 2022-03-10T09:15:54.224Z


text:
Q: Android: UDP client on HTC devices My application contains a client thread (UDP and TCP) which receive data from a wifi interface. I've tested the app on some devices (Samsung, sony, and HTC). It works well on all the devices in TCP mode, but in UDP mode it only works on Sony and Samsung devices, not in HTC.
Here is my UDP code:
                socketUDP = new DatagramSocket(SERVERPORT);
                byte[] buf = new byte[50];
                socketUDP.setSoTimeout(timeOut);

                DatagramPacket packet = new DatagramPacket(buf, buf.length);

                while (UDPRunning) {

                    socketUDP.receive(packet);

                    String str = new String(packet.getData(), 0,
                            packet.getLength());
                    packet.setLength(buf.length);

                    Message msg = handler.obtainMessage();
                    Bundle b = new Bundle();
                    b.putString("getStr", str);
                    msg.setData(b);

                    handler.sendMessage(msg);
                }

HTC Devices tested : HTC sensation (android 4.0.3), HTC desire (android 2.2), HTC One SV (4.0.4)
My question:
Is there any specific autorisations to use for HTC devices in order to use this UDP client?

A: I had the same issue with my device it was also HTC sensation. It was not reachable by the other side(client) on pc.
May the link will help you sorting it out . I never tried that solution because i changed my phone.
http://www.flattermann.net/2010/09/fix-udp-broadcasts-on-htc-phones-running-stock-firmware/


text:
Q: What's wrong with named pipes used between 2 processes (no. 2)? So, let's start from beginning: 2 processes 1 pipe to communicate, right? No! because communication is blocking, one waits for another. We need results from the second process through a different channel. Though it seems redundant it is not.
Let's change it a bit: 2 processes 2 pipes, you can call one process the server and the other the client. One pipe sends jobs to clients and the other is used to collect results from the clients to the server.
For convenience we call each pipe with the process name that is used for reading so, london reads london pipe and so on. That's the diagram of pipes and processes:
london ----writes madrid pipe-------->
london <----reads london pipe------  |
                                  ^  |
                                  |  |
madrid ----writes london pipe----->  v
madrid <----reads madrid pipe---------

Let's use 'london' as server and 'madrid' as client: server is responsible to end the endless loop.
And this is the solution:
#!/bin/bash
shopt -u failglob
shopt -s extglob nullglob dotglob

DIR=$( cd "$( dirname "$0" )" && pwd )

function london (){
   local i message answer london madrid
   london=london_$RANDOM.$RANDOM.$RANDOM.$$
   madrid=madrid_$RANDOM.$RANDOM.$RANDOM.$$
   cd $DIR
   mkfifo $london
   mkfifo $madrid
   ( madrid $madrid $london ) &
   echo "parent id: $$, child id: $!"
   i=0
   #a mesterious situation: sometimes '3< $london' just breaks it (?!)
   exec 3<> $london
   exec 4> $madrid

   while true; do

      message="Greetings from London!($i)"
      echo "$message" >&4

      read -r answer <&3
      echo 'London says:> '"$answer" #>& /dev/stdout
      (( i++ ))

      if [[ i -gt 1 ]]; then
         echo 'quit' >&4
         break
      fi
   done

   wait
   cd "$DIR"
   rm -rf $london
   rm -rf $madrid
}

function madrid (){
   local i message answer madrid london
   madrid=$1
   london=$2
   cd $DIR
   i=0
   exec 3> $london
   exec 4< $madrid
   while true; do

      read -r answer <&4
      echo 'Madrid says:> '"$answer" #>& /dev/stdout

      message="Greetings from Madrid!($i)"
      echo "$message" >&3
      (( i++ ))

      if [[ $answer = 'quit' ]]; then
         break
      fi
   done
}

london

At function 'london' there is a comment just before
   exec 3<> $london

if you change this to
   exec 3< $london

as it should(!) be then, I faced a situation where my program stalled repeatedly!
After a few changes from <> to < and vice versa the problem eliminated and I can't reproduce it! I'm using an Ubuntu system so if anybody can test the program with his/her system and post some comments it will welcomed.

A: Here the program only stopped if it was started in the background, due to tty output. You should have attached strace to the first process when you could reproduce the problem.


text:
Q: How to update a single (edited) App in a compiled Android image I have compiled Android source code already  (which I downloaded using GIT)
and I am being editing the source code of an Application for testing on Emulator
each time I wanna see results I have to re-Compile the source code again using 'make'
I am pretty sure that there is a way to partly-compile the image
Notes: I use Ubuntu ,and Android Eclair source

A: you can use this command
mmm packages/apps/yourApp
or whatever the path of your APP is
Assuming that :

*

*your working directory is the same of your source files (which YOU downloaded using GIT)

*you already run these commands source build/envsetup.sh and lunch 1
Next step: to update your emulator to see your changes
Run these commands
adb remount
adb sync
Finally, an advice , using Eclipse will make life easier for you


text:
Q: Is it possible to find an explicit form of the solution to $y'=\frac{1-x+y}{x-y}$ We want to solve the differential equation $y'=\frac{1-x+y}{x-y}$, What i did is define $z=x-y$, and then $y'=1-z'$, so overall we have
$1-z'=\frac{1-z}{z}$, or in other words $z'=\frac{2z-1}{z}$ This can be solved because $z$ and $x$ are separable:
$\int \frac{z}{2z-1}dz=\int dx$
I don't know any method to integrate the left side, so I'll be grateful if someone can show an analytic way to do that, but i managed to guess the integral: $\frac{1}{2}z+\frac{1}{4}\ln (2z-1)=x+c$
Now to revert back to our original $y$:
$\frac{1}{2}(x-y)+\frac{1}{4}\ln (2(x-y)-1)=x+c$
Is this the best we can do? Is there a way to find an explicit form for $y$? or an implicit equation like this is the best solution we can hope for in this situation

A: There is a simple way to integrate the integral you have:
$$\frac{z}{2z-1} = \frac{1}{2}\frac{2z}{2z-1} = \frac12\frac{(2z-1)+1}{2z-1} = \frac12\left(1 + \frac1{2z-1}\right).$$
As for solving your equation for $y$, no, I do not think it is possible to get a closed form of $y$. I am not sure (there are theorems that tell you, but I don't know them), but the rule of thumb is that if an equation contains the variable both in the exponent and in line, or in your case, in the logarithm and in line, then a closed form solution is not likely.


text:
Q: "He thought that that might be awkward." "He thought that that might be awkward."
I know this sentence is a bit awkward, but is it grammatically incorrect?

A: It may sound awkward, but it is grammatically correct.
The answers to this question exhibit more awkward ones: Awkward sounding but grammatically correct sentences?

A: There's nothing wrong, IMO, with re-wording the sentence if you feel it sounds awkward.  For example (with a context I provide):

"Jim thought reprimanding her would be appropriate.  Bill, on the other hand, thought it might be awkward."  (The indefinite pronoun "it" replaces "reprimanding her.")


text:
Q: jQuery Animation fade in, fade out…How do I create the second event? I have just started coding and I have encountered a problem that seems very obvious to fix.
To animate my website, I decided to write a Javascript code using jQuery
https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js.
The first part of the code work for me:
I click on "Hover Me" and the video pop-up.
All good.
Heres my code:
<meta name="viewport" content="initial-scale=1, height=device-height, width=device-width, maximum-scale=1">

   I Wanted to test a video autoplay on hover, using javascript & this time is finally worked, thanks codepen, I appreciated. Want to try? I Wanted to test a video autoplay on hover, using javascript & this time is finally worked, thanks codepen, Want to try?

   Hover Me

            <video poster="https://intmagic-wordpress.s3.amazonaws.com/mamag/uploads/802500821_1280x720.jpg" playsinline=""             autoplay="" muted="" loop="" >
               <source src="https://player.vimeo.com/external/351032574.hd.mp4?s=b11ffe2804304867bd86bd956411f61ac45f1840&profile_id=174&oauth2_token_id=1204276317" type="video/mp4">
            </video>

I Wanted to test a video autoplay on hover, using javascript & this time is finally worked, thanks codepen, I appreciated. Want to try? I Wanted to test a video autoplay on hover, using javascript & this time is finally worked, thanks codepen...

   I Wanted to test a video autoplay on hover, using javascript & this time is finally worked, thanks codepen, I appreciated. Want to try? I Wanted to test a video autoplay on hover, using javascript & this time is finally worked, thanks codepen, Want to try?

   Hover Me

         <video poster="https://intmagic-wordpress.s3.amazonaws.com/mamag/uploads/802500821_1280x720.jpg" playsinline=""             autoplay="" muted="" loop="" >
            <source src="https://player.vimeo.com/external/351032574.hd.mp4?s=b11ffe2804304867bd86bd956411f61ac45f1840&profile_id=174&oauth2_token_id=1204276317" type="video/mp4">
         </video>

I Wanted to test a video autoplay on hover, using javascript & this time is finally worked, thanks codepen, I appreciated. Want to try? I Wanted to test a video autoplay on hover, using javascript & this time is finally worked, thanks codepen...

The CSS linked just fine
body {
   padding: 0;
   margin: 0;
   width: 100%;
   background-color: #ddd;
}
/*example-hoverVideo strip*/
.popup-container {
   width: 100%;
   height: 100%;
   pointer-events: none;
}
.popup-box {
   position: fixed;
   width: 74%;
   height: 100%;
   border-radius: 14px;
   background-color: red;
   padding: 0px 0px;
   z-index: 1000;
   margin: auto;
   top: 0;
   left: 0;
   bottom: 0;
   right: 0;
   display: none;
}

.popup-box-2 {
   position: fixed;
   width: 100%;
   height: 100%;
   background: rgba(0, 0, 0, 0.8);
   padding: 0px 0px;
   z-index: 330;
   margin: auto;
   top: 0;
   left: 0;
   bottom: 0;
   right: 0;
   display: none;
}

.hover-popup {
   cursor: pointer;
   font-size: 50px;
   color: red;
   font-family: helvetica;
   width: 100%;
   height: 100%;
}
video {
   z-index: 1200;
   margin: 0;
   padding: 0;
   box-sizing: border-box;
   padding: 150px;
   width: 100%;
   height: 100%;
}
@media only screen and (max-width: 800px) {
   video {
      padding: 50px;
   }
}
@media only screen and (max-width: 500px) {
   video {
      padding: 0px;
   }
}

.example-text {
   padding: 30px;
   font-size: 50px;
}
.camera-vector {
   pointer-events: none;
   width: 35px;
   margin: 5px;
}
/*example-hoverVideo strip*/

and here is what i wrote on main.js to see if it works :
$(function() {
        var self = $('.hover-popup');
      self.click(function () {
            self.next().children('.popup-box').fadeIn(150);
      });
});

So as you can see, what I'm trying to do now is to make the video fade-out when the mouse click again over it.
I kindly ask if somebody could teach me the event to make it work.
Thanks in advance

A:   $('#logoimage').hide("fade",2000,function() {
    $( "#logoimage" ).show( "fade",2000);
  });

A: You can add a "show or visible" class to that element when it is clicked to show it and show it if it is clicked a second time to check if that element has "show or visible" this class if it should then Hide it!
example :

$(function() {
      var self = $('.hover-popup');
      self.click(function () {
      var popUp = self.next().children('.popup-box');
      if(popUp.hasClass( "visible" ))
      {
        popUp.fadeOut(150);
        popUp.removeClass('visible');
      }
      else {
        popUp.fadeOut(150);
        popUp.addClass('visible');
      }

      });
});

A: If you just want to show/hide on click, then you can use
.fadeToggle()

https://api.jquery.com/fadetoggle/
$(function() {
    var popup = $('.hover-popup');
    popup.click(function() {
        $(this).next().children('.popup-box').fadeToggle(150);
    });
});

Edit:
To add a basic "click anywhere to close"
$(function() {
    $(document).on("click", function() {
        $(".popup-box:visible").fadeOut(150);
    });
});

but this will only pickup clicks that haven't already been handled (eg clicking on the background, but not clicking on another button).
Ideally, you would also show a "modal background" which covers the whole page and clicking that would hide the popup-box.  But that's a bit too broad for an SO question and you might be better off looking at a 3rd-party plugin (asking for one is also off-topic).

A: Thanks everybody..
..and thanks freedomn-m.
Fade Toggle work perfectly
$(function() {
        var self = $('.hover-popup');
      self.click(function () {
            self.next().children('.popup-box').fadeToggle(150);
      });
});


text:
Q: UWP AdaptiveTrigger Not Triggering I have the VisualStateManager inside the root grid, but it's not triggering the AdaptiveTrigger. I'm trying to change the textblock inside the StackPanel. Also, what are the rules on priority of VisualState setters over the default? For example, the textblock CreateNewAccount is using x:Uid to get a string resource, but when the setter tries to change the Text value, which one gets priority? Same with FontSize being set by a static resource style.

<Page.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="../Style/ApparentTheme.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Page.Resources>

<Grid x:Name="MainGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Margin="20 0 20 0">
    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup>
            <VisualState x:Name="Mobile_720">
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="720" />
                </VisualState.StateTriggers>

                <VisualState.Setters>
                    <Setter Target="CreateNewAccount.FontSize" Value="12"/>
                    <Setter Target="CreateNewAccount.Text" Value="Test"/>
                </VisualState.Setters>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>

    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="2*"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <StackPanel x:Name="FormStackPanel" Grid.Row="0" Grid.Column="1" Orientation="Vertical">
        <TextBlock x:Name="CreateNewAccount" x:Uid="CreateNewAccount" Style="{StaticResource TitleTextBlockStyle1366}"/>
        <TextBox x:Uid="EmailField" x:Name="emailField"
                 Style="{StaticResource TextBoxStyle1366}" InputScope="EmailNameOrAddress"
                 Text="{Binding NewSignUp.Email, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <TextBox x:Uid="FirstNameField" x:Name="firstNameField"
                 Style="{StaticResource TextBoxStyle1366}" InputScope="AlphanumericFullWidth"
                 Text="{Binding NewSignUp.FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <TextBox x:Uid="LastNameField" x:Name="lastNameField"
                 Style="{StaticResource TextBoxStyle1366}" InputScope="AlphanumericFullWidth"
                 Text="{Binding NewSignUp.LastName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <PasswordBox x:Uid="PasswordField" x:Name="passwordField"
                     Style="{StaticResource PasswordBoxStyle1366}"
                     Password="{Binding NewSignUp.Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <PasswordBox x:Uid="PasswordConfirmField" x:Name="passwordConfirmField"
                     Style="{StaticResource PasswordBoxStyle1366}"
                     Password="{Binding NewSignUp.PasswordConfirm, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <Button x:Uid="CreateAccountButton"
                Style="{StaticResource ButtonStyle1366}"
                Command="{Binding CreateAccountCommand}" Click="CreateAccountButton_Click"/>
        <TextBlock x:Name="errorMessage"
                   FontSize="16pt" Foreground="Red" Margin="0 5 0 0"
                   Text="{Binding SignUpErrorMessage, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
        <ProgressRing x:Name="signUpProgressRing"
                      HorizontalAlignment="Center" IsActive="False" Height="30" Width="30"/>
    </StackPanel>
</Grid>

A: It is better to design for a small form factor, and use AdaptiveTrigger for larger widths and heights. Because I was doing the opposite, and testing on a smaller mobile screen, I was unable to see the changes. Here is the revised XAML:
<Page
x:Class="apparent_uwp.View.SignUpPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:apparent_uwp.View"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Page.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="../Style/ApparentTheme.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Page.Resources>

<Grid x:Name="MainGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Margin="20 0 20 0">
    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup>
            <VisualState x:Name="Mobile_720">
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="720" />
                </VisualState.StateTriggers>

                <VisualState.Setters>
                    <Setter Target="CreateNewAccount.FontSize" Value="24"/>
                    <Setter Target="MainGrid.ColumnDefinitions[0].Width" Value="*"/>
                    <Setter Target="MainGrid.ColumnDefinitions[2].Width" Value="*"/>
                </VisualState.Setters>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>

    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <StackPanel x:Name="FormStackPanel" Grid.Row="0" Grid.Column="1" Orientation="Vertical" Margin="10 0 10 0">
        <TextBlock x:Name="CreateNewAccount" x:Uid="CreateNewAccount" Style="{StaticResource TitleTextBlockStyle}"/>
        <TextBox x:Uid="EmailField" x:Name="emailField"
                 Style="{StaticResource TextBoxStyle}" InputScope="EmailNameOrAddress"
                 Text="{Binding NewSignUp.Email, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <TextBox x:Uid="FirstNameField" x:Name="firstNameField"
                 Style="{StaticResource TextBoxStyle}" InputScope="AlphanumericFullWidth"
                 Text="{Binding NewSignUp.FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <TextBox x:Uid="LastNameField" x:Name="lastNameField"
                 Style="{StaticResource TextBoxStyle}" InputScope="AlphanumericFullWidth"
                 Text="{Binding NewSignUp.LastName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <PasswordBox x:Uid="PasswordField" x:Name="passwordField"
                     Style="{StaticResource PasswordBoxStyle}"
                     Password="{Binding NewSignUp.Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <PasswordBox x:Uid="PasswordConfirmField" x:Name="passwordConfirmField"
                     Style="{StaticResource PasswordBoxStyle}"
                     Password="{Binding NewSignUp.PasswordConfirm, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <Button x:Uid="CreateAccountButton"
                Style="{StaticResource ButtonStyle}"
                Command="{Binding CreateAccountCommand}" Click="CreateAccountButton_Click"/>
        <TextBlock x:Name="errorMessage"
                   FontSize="16pt" Foreground="Red" Margin="0 5 0 0"
                   Text="{Binding SignUpErrorMessage, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
        <ProgressRing x:Name="signUpProgressRing"
                      HorizontalAlignment="Center" IsActive="False" Height="30" Width="30"/>
    </StackPanel>
</Grid>


text:
Q: How to set navigation properties that are collections using a collection of ids I have just spent a couple of hours on this problem, and I would like to simplify it in future because I can see it being a common requirement.
I have a Question class with a navigation property that is a collection:
public class AnsweredQuestion : ModelBase
{
    public virtual ICollection<Answer> Answers { get; set; }
}

All my models inherit a single base class:
public abstract class ModelBase
{
    public int ID { get; set; }
}

Now I want to set the Answers collection from a collection of answer ids and I have this method in my controller - and it does work
    private void SetAnswers(AnsweredQuestion question,
                            IEnumerable<int> newAnswerIDs)
    {
        //First remove any answers we don't want
        question.Answers.RemoveAll(a => !newAnswerIDs.Contains(a.ID));

        //Then project the current ids
        IEnumerable<int> currentAnswerIds = question.Answers.Select(a => a.ID);

        //Now go to the database to get the answers that match the ids that
        //we have to add
        IQueryable<Answer> answersToAdd = _uow.AnswerRepository.All
                 .Where(dbAnswers => newAnswerIDs.Contains(dbAnswers.ID)
                                   &&
                                   !currentAnswerIds.Contains(dbAnswers.ID));

        //and add them to the navigation property
        question.Answers.AddRange(answersToAdd);
    }

But this code is quite complicated, and I can see me having to write it again and again in each Model where I have a navigation property.
If this was a 1 to many relationship I'd have an Answer property and an AnswerID property in my entity and the framework would resolve the issue for me. But, as far as I know, I cant do that for many to many relationships.
Can anyone think of a way to turn this into a method that can be called on any navigation property in any model? I thought about creating an extension method on a collection of models, but my stumbling block is that I need to go to the database to get the Answers that match the ids I have before I add them to the Answers collection and that would mean that my extension method would need to know which repository to use

A: Here is what I have come up with:
public static bool SetById<T>(this ICollection<T> collection,
    IEnumerable<int> ids,
    IRepository<T> repo)
where T : ModelBase
{
    //First remove any answers we don't want
    int count = collection.Count;
    collection.RemoveAll(a => !ids.Contains(a.ID));
    bool isAltered = count != collection.Count;

    //Then project the current ids
    IEnumerable<int> currentIds = collection.Select(a => a.ID);

    IQueryable<T> toAdd = repo.All.Where(dbAnswers => ids.Contains(dbAnswers.ID) && !currentIds.Contains(dbAnswers.ID));
    isAltered = isAltered || toAdd.Any();

    //and add them to the navigation property
    collection.AddRange(toAdd);

    return isAltered;
}

This is dependent on all my entities inheriting from a base class with an ID:
public abstract class ModelBase
{
    public int ID { get; set; }
}

And in my controller I call it like this (passing in my repository):
    question.Answers.SetById(newAnswerIDs, _uow.AnswerRepository);


text:
Q: How to get web access when running DDEV in a Droplet using Jenkins/Jenkinsfile? I provisioned a droplet with Jenkins/Docker/DDEV, the idea is to have Jenkins to run tests and provide a staging environment for multiple web projects. Each web project is already using DDEV to be used as a local dev environment. Ideally what I want to build is, having Jenkins pull from the repo, and start DDEV on the droplet, providing the staging environment.
So far, I have accomplished all of the above, however, I am a bit stack on the network configuration to allow people visiting my droplet through a web browser to access each Jenkins build.
Below is my Jenkinsfile so far, ideally if I could setup the network in the Jenkinsfile would be brilliant.
pipeline {
  agent any
  stages {
    stage('Checkout') {
      steps {
        checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkinsSSH', url: 'https://myrepo.git']])
      }
    }

    stage('Example') {
      steps {
        echo "Running ${env.BUILD_ID} on ${env.JENKINS_URL}"
        sh 'cd $WORKSPACE && ddev start'
      }
    }

    stage('Release') {
      steps {
        echo 'Ready to release etc.'
      }
    }

  }
}

I had a look extensively in Google in case someone else has tried a similar endeavour. Also, looked if Jenkins has plugins for this task. I can't access the DDEV through the web browser.

A: If you want to access a running DDEV project via the web browser, you'll have to open it up with ddev config global --router-bind-all-ports, and then deal with handling name resolution. There are full details about this class of thing in https://ddev.readthedocs.io/en/latest/users/topics/sharing/; you may also be interested in the full sharing solution in https://ddev.readthedocs.io/en/latest/users/topics/hosting/
Also note that there is a GitHub action for this kind of testing that may help you, https://github.com/marketplace/actions/setup-ddev


text:
Q: Trouble with regex matching last part I have the following regex:
solo_LL01_[\p{Alnum}|-]+_\d{10}_V\d{4}(1[0-2]|0[1-9])(3[01]|[12][0-9]|0[1-9])(2[0-3]|[01][0-9])([0-5][0-9])(I|C)?(_firsttest)?\.fits$

Matched against:
solo_LL01_eui-fsi-174_0715246200_V201607271145C_firsttest.fits

I would like to make the firsttest text any numbers/characters. I tried some variations such as:
solo_LL01_[\p{Alnum}|-]+_\d{10}_V\d{4}(1[0-2]|0[1-9])(3[01]|[12][0-9]|0[1-9])(2[0-3]|[01][0-9])([0-5][0-9])(I|C)?(_[\p{Alnum}_])?\.fits$

But just seem to get it to work.
Many thanks for any help

A: Looking at the documentation of Pattern, especially the parts about "Predefined character classes" :

\w    A word character: [a-zA-Z_0-9]

and "Quantifiers":

X*  :  X, zero or more times
X+  :  X, one or more times

The following should match any number of charatcter / numbers :-
[\w]*

For one or more Characters or Numbers :-
[\w]+

In fact what you tried is also correct, except that you missed the quantifier * (any number of matches) or + (1 or more matches) ... so your regex just needs to be :-
solo_LL01_[\p{Alnum}|-]+_\d{10}_V\d{4}(1[0-2]|0[1-9])(3[01]|[12][0-9]|0[1-9])(2[0-3]|[01][0-9])([0-5][0-9])(I|C)?(_[\p{Alnum}_]*)?\.fits$

or
solo_LL01_[\p{Alnum}|-]+_\d{10}_V\d{4}(1[0-2]|0[1-9])(3[01]|[12][0-9]|0[1-9])(2[0-3]|[01][0-9])([0-5][0-9])(I|C)?(_[\p{Alnum}_]+)?\.fits$

Depending on which Quantifier (* or +) you wish to use

A: Why not use [A-Za-z0-9]+?
solo_LL01_[\p{Alnum}|-]+_\d{10}_V\d{4}(1[0-2]|0[1-9])(3[01]|[12][0-9]|0[1-9])(2[0-3]|[01][0-9])([0-5][0-9])(I|C)?_([A-Za-z0-9]+)?\.fits$


text:
Q: Consequences of changing a value (struct) type to a reference (class) type Consider a struct type defined as follows:
public struct Device
{
    public string Name {get; set;}
    public string Data {get; set;}

    public void UploadData(DataSource source)
    {
        source.data += Data;
    }
}

Now, I would like to change the Device to a class type and use it to describe different types of devices:
public class Device
{
    public string Name {get; set;}
    public string Data {get; set;}

    public virtual void UploadData(DataSource source)
    {
        source.data += Data;
    }
}

I'm aware that one should be cautious in making this step because the parameters are passed by reference in the second case. But somehow I can't figure out a use case where this change will have negative consequences for uploading data to the data source.


text:
Q: Minimizing Frobenius norm of a special type Given that $A$ is a symmetric matrix, find $X$ that solves
$$\mathop {\min }\limits_X {\left\| {A - X{X^T}} \right\|_F}$$
I think that the problem can be solved using eigenvalue or singular value decomposition technics. $XX^T=A$ seems an obvious solution, but the problem is that $XX^T$ is positive semidefinite, while $A$ may not be, although they are both symmetric.
At this point I am thinking about taking eigenvalue decomposition of A, then replace the negative eigenvalues in the middle diagonal matrix with 0-s (denote the resulting matrix by $\bar{A}$). But am having difficulties to understand why  $XX^T=\bar{A}$ gives the $X$ with minimal distance from A.

A: Alternative Formulation
I'm trying to solve a similar problem. I don't think this answers your question, but I hope it might be useful to you.
\begin{align*}
\mathop{\min}\limits_X {\left\| {A - X{X^T}} \right\|_F} &\equiv \mathop {\min }\limits_X {\left\| {A - X{X^T}} \right\|_F^2} \\
&= \mathop{\min}\limits_X {\left\langle {A - X{X^T}},{A - X{X^T}} \right\rangle_F} \\
&= \mathop{\min}\limits_X \Big( \left\langle {A,A} \right\rangle_F -2 \left\langle {A,XX^T} \right\rangle_F + \left\langle {XX^T,XX^T} \right\rangle_F \Big) \\
&= \mathop{\min}\limits_X \Big( \left\langle {XX^T,XX^T} \right\rangle_F -2 \left\langle {A,XX^T} \right\rangle_F \Big) \\
&= \mathop{\min}\limits_X \Big( \operatorname{Tr}\left( {XX^TXX^T} \right) -2 \operatorname{Tr}\left( {AXX^T} \right) \Big) \\
\end{align*}
If you apply the SVD as
\begin{align*}
X &= U\Sigma V^T \\
A &= BDB^T,
\end{align*}
then this is
\begin{align*}
&\mathop{\min}\limits_X \Big( \operatorname{Tr}\left( {U\Sigma^4U^T} \right) -2 \operatorname{Tr}\left( {BDB^TU\Sigma^2U^T} \right) \Big) \\
=& \mathop{\min}\limits_X \Big( \operatorname{Tr}\left( {\Sigma^4} \right)-2 \operatorname{Tr}\left( {BDB^TU\Sigma^2U^T} \right) \Big).
\end{align*}
Useful Properties of the Trace
The trace allows cycling the product in its argument.  Taking matrices of various (compatible) sizes, because the trace is defined for square matrices, the outer dimensions of the matrix product must match. These are equivalent:
$$\operatorname{Tr}(ABCD) = \operatorname{Tr}(BCDA) = \operatorname{Tr}(CDAB) = \operatorname{Tr}(DABC)$$


text:
Q: What is the default indexing type of scipy.sparse.csr_matrix? scipy.sparse.csr_matrix has data, indices, and indptr attributes.
What are the default dtype of indices and indptr?
For numpy, the default indexing type is numpy.intp, but that doesn't match the dtype of indices of a scipy.sparse.csr_matrix.
Documentation of scipy.sparse.csr_matrix
For my laptop:
import numpy as np
import scipy.sparse as ss
a = ss.csr_matrix(np.arange(12).reshape(3,4), dtype=float)
print(a.indices.dtype)
print(np.intp)

Result:
int32
<class 'numpy.int64'>

A: sparse.compressed._cs_matrix __init__ has
            idx_dtype = get_index_dtype(maxval=max(M,N))
            self.data = np.zeros(0, getdtype(dtype, default=float))
            self.indices = np.zeros(0, idx_dtype)
            self.indptr = np.zeros(self._swap((M,N))[0] + 1, dtype=idx_dtype)

sparse.compressed.get_index_dtype chooses between np.int32 and np.int64 depending on the shape of the matrix.  If too big to index with 32 it uses 64.  But check that function for details.

In [789]:  np.iinfo(np.int32).max
Out[789]: 2147483647
In [790]: a=sparse.csr_matrix((1,2147483646))
In [791]: a
Out[791]:
<1x2147483646 sparse matrix of type '<class 'numpy.float64'>'
    with 0 stored elements in Compressed Sparse Row format>
In [792]: a.indices.dtype
Out[792]: dtype('int32')
In [793]: a=sparse.csr_matrix((1,2147483648))
In [794]: a.indices.dtype
Out[794]: dtype('int64')


text:
Q: hover OR focus in Tailwind CSS So I want to change the color of the text on hover or focus

foo bar

But I was wondering if is possible to compress all in one statement, so I would not need to repeat the text-green-500 for both. I tried the code below, but it becomes an and statement instead of or.

foo bar

In pure css, what I'm looking for to do would be something like this:
div:hover, div:focus {
  color: green
}

Is that possible in TailwindCSS?

A: You may write a simple plugin to combine focus and hover into one  custom variant as described in the documentation.
The key is that addVariant() allows passing in multiple selectors as rules in the second parameter:
//tailwind.config.js

const plugin = require('tailwindcss/plugin')

module.exports = {
  plugins: [
    plugin(function({ addVariant }) {
      addVariant('hocus', ['&:hover', '&:focus'])
    })
  ],
}

usage:

foo bar

DEMO on tailwind play

A: You can @apply to re-use existing tailwind styles so that you don't end-up writing color: green or whatever extra you would otherwise be writing in plain CSS>
https://tailwindcss.com/docs/functions-and-directives#apply
div:hover, div:focus {
  @apply text-green-500;
}

This way, you will also end up having less code in your class attribute.


text:
Q: github.worspace is not returning the right path I'm currently working on a terraform form and github actions where is connected to my Azure instance.
My current main.yml file is set up like this:
name: 'Terraform'

on:
  push:
    branches:
    - main
  pull_request:

env:
      TF_VERSION: latest
      ARM_CLIENT_ID: ${{ secrets.CLIENT_ID }}
      ARM_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
      ARM_SUBSCRIPTION_ID: ${{ secrets.SUBSCRIPTION_ID }}
      ARM_TENANT_ID: ${{ secrets.TENANT_ID }}
      ROOT_PATH: '${{ github.workspace }}/src/terraform'

jobs:
  terraform:
    name: 'Terraform'
    runs-on: ubuntu-latest
    environment: dev

    defaults:
      run:
        shell: bash

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Directory Path
        run: |
          ls -la

      - name: Terraform Init
        uses: hashicorp/terraform-github-actions@master
        # run: |
        #   cd src
        #   cd terraform
        #   terraform init
        with:
          tf_actions_version: ${{ env.TF_VERSION }}
          tf_actions_subcommand: 'init'
          tf_actions_working_dir: ${{ env.ROOT_PATH }}
          tf_actions_comment: true
        env:
          TF_VAR_env: 'dev'
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Terraform Format
        uses: hashicorp/terraform-github-actions@master
        with:
          tf_actions_version: ${{ env.TF_VERSION }}
          tf_actions_subcommand: 'fmt'
          tf_actions_working_dir: ${{ env.ROOT_PATH }}

      - name: Terraform Plan
        uses: hashicorp/terraform-github-actions@master
        with:
          tf_actions_version: ${{ env.TF_VERSION }}
          tf_actions_subcommand: 'plan'
          tf_actions_working_dir: ${{ env.ROOT_PATH }}

At the time I see the directory path, I found out that is outside of my working directory. Then, further steps are going to tell me that I don't have any configuration.
Do you know if ROOT_PATH: '${{ github.workspace }}/src/terraform needs to be setup differently? or What else can I do to make sure I'll have the root directory which is src/terraform?