text:
Q: Add B2B Azure Directory Signup to B2C tenant We are trying to setup a link between our B2C tenant (which uses app registrations and custom policies, userflows) for registering and authenticating user, with an azure tenant from a customer.
As far as I've seen, in B2B tenants, there is the option to choose Azure Active Directory signup as an IDP provider. In the B2C tenant, I only see Microsoft Account as an IDP, which is not for business user login.
I couldn't find a way to setup Azure Active Directory Sign Up as IDP on our B2C tenant. Has someone just added this linkage using OpenID Provider and adding it manually? Or did you encounter similar situation and worked out another solution?
Thanks in advance for any hints!
Best
Vito

A: •   Yes, you can add Azure Active Directory as an IDP to your Azure AD B2C tenant by adding Azure AD to the claims provider element in the 'TrustFrameworkExtensions.xml' file of your custom policy. To configure the same, kindly refer to the link below which explains in detail the actual configurations to be done in the above said file. The 'ClaimsProvider' element should look like the below: -
 <ClaimsProvider>
 <Domain>Contoso</Domain>
 <DisplayName>Login using Contoso</DisplayName>
 <TechnicalProfiles>
 <TechnicalProfile Id="AADContoso-OpenIdConnect">
  <DisplayName>Contoso Employee</DisplayName>
  <Description>Login with your Contoso account</Description>
  <Protocol Name="OpenIdConnect"/>
  <Metadata>
    <Item Key="METADATA">https://login.microsoftonline.com/tenant-name.onmicrosoft.com/v2.0/.well-known/openid-configuration</Item>
    <Item Key="client_id">00000000-0000-0000-0000-000000000000</Item>
    <Item Key="response_types">code</Item>
    <Item Key="scope">openid profile</Item>
    <Item Key="response_mode">form_post</Item>
    <Item Key="HttpBinding">POST</Item>
    <Item Key="UsePolicyInRedirectUri">false</Item>
  </Metadata>
  <CryptographicKeys>
    <Key Id="client_secret" StorageReferenceId="B2C_1A_ContosoAppSecret"/>
  </CryptographicKeys>
  <OutputClaims>
    <OutputClaim ClaimTypeReferenceId="issuerUserId" PartnerClaimType="oid"/>
    <OutputClaim ClaimTypeReferenceId="tenantId" PartnerClaimType="tid"/>
    <OutputClaim ClaimTypeReferenceId="givenName" PartnerClaimType="given_name" />
    <OutputClaim ClaimTypeReferenceId="surName" PartnerClaimType="family_name" />
    <OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
    <OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="socialIdpAuthentication" AlwaysUseDefaultValue="true" />
    <OutputClaim ClaimTypeReferenceId="identityProvider" PartnerClaimType="iss" />
  </OutputClaims>
  <OutputClaimsTransformations>
    <OutputClaimsTransformation ReferenceId="CreateRandomUPNUserName"/>
    <OutputClaimsTransformation ReferenceId="CreateUserPrincipalName"/>
    <OutputClaimsTransformation ReferenceId="CreateAlternativeSecurityId"/>
    <OutputClaimsTransformation ReferenceId="CreateSubjectClaimFromAlternativeSecurityId"/>
  </OutputClaimsTransformations>
  <UseTechnicalProfileForSessionManagement ReferenceId="SM-SocialLogin"/>
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>

https://learn.microsoft.com/en-us/azure/active-directory-b2c/identity-provider-azure-ad-single-tenant?pivots=b2c-custom-policy#configure-azure-ad-as-an-identity-provider-1
Ensure that after configuring as said in the link above, Azure AD is successfully communicated by Azure AD B2C. Also, update the domain name of your domain in the 'ClaimsProvider' element without the '.com' for proper distinguishment.

A: Thanks for the suggestions.
The answers/comments provided were right. In the end, I followed the approach described here https://learn.microsoft.com/en-us/azure/active-directory-b2c/identity-provider-azure-ad-multi-tenant?pivots=b2c-custom-policy (Set up sign-in for multi-tenant Azure Active Directory)
Also, have a look at following article from Microsoft, describing some more details about the solution as well as important information for system administrators on the corporate tenant: https://learn.microsoft.com/en-gb/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant (Sign in any Azure Active Directory user using the multi-tenant application pattern)


text:
Q: PCRE regex to sed regex First of all sorry for my bad english. I'm a german guy.
The code given below is working fine in PHP:
$string = preg_replace('/href="(.*?)(\.|\,)"/i','href="$1"',$string);

Now T need the same for sed. I thought it should be:
sed 's/href="(.*?)(\.|\,)"/href="{$\1}"/g' test.htm

But that gives me this error:

sed: -e expression #1, char 36:
  invalid reference \1 on `s' command's
  RHS

A: sed does not support non-greedy regex match.

A: You need a backslash in front of the parentheses you want to reference, thus
sed 's/href="\(.*?\)(.|\,)"/href="{$\1}"/g' test.htm

A: sed -e 's|href=\"\(.[^"][^>]*\)\([.,]\)\">|href="\1">|g' file

A: You have to escape the block selector characters ( and ) as follows.
sed 's/href="\(.*?\)\(.|\,\)"/href="{$\1}"/g' test.htm

A: If you want to match a literal ".", you need to escape it or use it in a character class. As an alternative to slashing the capturing parentheses (which you need to do with basic REs), you can use the -E option to tell sed to use extended REs. Lastly, the REs used by sed use \N to refer to subpatterns, where N is a digit.
sed -E "s/href=([\"'])([^\"']*)[.,]\1/href=\1\2\1/i"

This has its own issue that will prevent matches of href attributes that use both types of quotes.
man sed and man re_format will give more information on REs as used in sed.

A: here is a solution, it is not prefect, only deal with the situation of one extra "," or "."

sed -r -e 's/href="([^"]*)([.,]+)"/href="\1"/g' test.htm

redpajama_set_name: RedPajamaStackExchange


text:
Q: Black-list the [community] tag I think community is not on-topic on Stack Overflow (together with 90% of question tagged with it); it could be more appropriate for programmers SE, but not here.
What do you think about this?

A: Looking at few questions using the tag, it seems it is a meta-tag, which doesn't add anything to the question.
I doubt there are users who follow that tag, also because it is used in completely unrelated questions.


text:
Q: How to remove table name in the column names in the query? I have a hive query that looks like this:
set hive.cli.print.header=true;
select x1, x2, x3 from table1
union all
select x1, x2, x3 from table2

The problem is that, the hive automatically adds a new table name to the column names, so the column names in the result looks like this:
_u1.x1  _u1.x2  _u1.x3

I don't want the "_u1." How can I simply keep the column names as:
x1  x2  x3

A: select x1, x2, x3 from
(select x1, x2, x3 from table1
union all
select x1, x2, x3 from table2) as test;

Before:
select order_id,order_date from orders limit 1
union all
select order_id,order_date from orders limit 1;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_u1.order_id    _u1.order_date
1   2013-07-25 00:00:00.0
1   2013-07-25 00:00:00.0

After:
select order_id, order_date from
(select order_id,order_date from orders limit 1
union all
select order_id,order_date from orders limit 1) as test;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
order_id    order_date
1   2013-07-25 00:00:00.0
1   2013-07-25 00:00:00.0


text:
Q: Current State of Research on high $T_c$ Superconductors After looking at these two RevModPhys articles, I have found myself perplexed by the current state of high $T_c$ superconductivity research. Seeing as I cannot find any SE articles more recent than 5 years or so, I thought I'd ask this question.
What is the current state of research on high-Tc superconductors? In particular, this question I think has two major points, but perhaps an expert can correct me about other angles?

*

*Have people managed to rule out electron-phonon interactions as a pairing mechanism? Is there any strong evidence either way?

*Do we have more conclusive evidence for or against antiferromagnetic ordering contributing to pairing? There seems to more and more discussion about entanglement in the strange metal regime described by holographic conjectures as contributing to a more exotic pairing mechanism? What evidence would you need for this argument?

A: Probably, the problem is much deeper than it seems; the low temperature superconductivity (SC) is poorly understood, so a further evolution in the high temperature SC is locked. The dominating theories cannot explain not only latest facts, such as high-temperature SC, SC in two dimensional systems, SC in heterostructures etc., but also the "conventional" experiments. For example the BCS theory contradicts many effects in conventional metals: inverse/weak/giant isotope effect, Tc dome at high pressure, superconductor-insulator transitions, stable electronic pairs without SC, existence of persistent (for many years!) supercurrents, existence of permanent SC pairs.
A plausible solution of these old questions will open a road to correct solutions for new superconductors.


text:
Q: Bash script to find all folders containing a specific file and copy a new file to those folders I'm trying to write a script that will loop through all subfolders of a directory to search for a specific file and then copy a new file to those folders that contain that file.
This is what I have so far:
#!/bin/sh
dir=/Documents
find "$dir" -name Sample.doc -printf "%p\n" | sort -nr | while read -r i; do
  echo "$i"
  done

This works to list all the Sample.doc files and their folders within the Documents folder.
However, I cannot find a way to extract the path from those folders to copy the new file into them.
Any help would be appreciated.

A: I think you are almost there. You can replace %p with %h in the -printf expression :

%h : Leading directories of file's name (all but the last element).
  If the file name contains no slashes (since it is in the current
  directory) the %h specifier expands to ".".

so the command would be something like :
find "$dir" -name Sample.doc -printf "%h\n" | sort -nr | while read -r i; do cp SomeFile "$i"; done

by the way, why is the sort part needed ?

A: The dirname command removes the filename from the full path

A: Using %h instead %p has already been suggested in another answer, but I'd like to add some improvements to make your code more robust. If, for instance, a matching directory contains a newline character in its name, you will in the best-case end up missing directories and getting some error messages from cp. At worst, you might override files anywhere on your system.
So instead, try doing it like this:
find "$dir" -name Sample.doc -printf "%h\0" | xargs --null -L1 cp SomeFile

The ACSII zero is guaranteed to never show up in any filenames, so unlike \n it works as a reliable separator for passing the paths. --null tells xargs to use the \0 as a input delimiter. It will then execute the given command (cp Somefile) once per item passed through the pipe, while appending the respective item as additional argument.

A: In bash:
shopt -s nullglob globstar
for i in "$dir"/**/Sample.doc
do
    cp 'new file' "$(dirname "$i")"/
done

In fish:
for i in $dir/**Sample.doc
    cp 'new file' (dirname $i)/
end


text:
Q: scala: mixins depending on type of arguments I have a set of classes of models, and a set of algorithms that can be run on the models. Not all classes of models can perform all algorithms. I want model classes to be able to declare what algorithms they can perform. The algorithms a model can perform may depend on its arguments.
Example: Say I have two algorithms, MCMC, and Importance, represented as traits:
trait MCMC extends Model {
  def propose...
}

trait Importance extends Model {
  def forward...
}

I have a model class Normal, which takes a mean argument, which is itself a Model. Now, if mean implements MCMC, I want Normal to implement MCMC, and if mean implements Importance, I want Normal to implement Importance.
I can write:
    class Normal(mean: Model) extends Model {
      // some common stuff goes here
    }
class NormalMCMC(mean: MCMC) extends Normal(mean) with MCMC {
  def propose...implementation goes here
}

class NormalImportance(mean: Importance) extends Normal(mean) with Importance {
  def forward...implementation goes here
}

I can create factory methods that make sure the right kind of Normal gets created with a given mean. But the obvious question is, what if mean implements both MCMC and Importance? Then I want Normal to implement both of them too. But I don't want to create a new class that reimplements propose and forward. If NormalMCMC and NormalImportance didn't take arguments, I could make them traits and mix them in. But here I want the mixing in to depend on the type of the argument. Is there a good solution?

A: Using self types allows you to separate the Model-Algorithm implementations from the instantiations and mix them in:
trait Model
trait Result
trait MCMC extends Model {
  def propose: Result
}
trait Importance extends Model {
  def forward: Result
}

class Normal(val model: Model) extends Model

trait NormalMCMCImpl extends MCMC {
  self: Normal =>
  def propose: Result = { //... impl
    val x = self.model // lookie here... I can use vals from Normal
  }
}
trait NormalImportanceImpl extends Importance {
  self: Normal =>
  def forward: Result = { // ... impl
      ...
  }
}

class NormalMCMC(mean: Model) extends Normal(mean)
                              with NormalMCMCImpl

class NormalImportance(mean: Model) extends Normal(mean)
                                    with NormalImportanceImpl

class NormalImportanceMCMC(mean: Model) extends Normal(mean)
                                        with NormalMCMCImpl
                                        with NormalImportanceImpl

A: Thanks to Kevin, Mitch, and Naftoli Gugenheim and Daniel Sobral on the scale-users mailing list, I have a good answer. The two previous answers work, but lead to an exponential blowup in the number of traits, classes and constructors. However, using implicits and view bounds avoids this problem. The steps of the solution are:
1) Give Normal a type parameter representing the type of its argument.
2) Define implicits that take a Normal with the right type of argument to one that implements the appropriate algorithm. For example, makeImportance takes a Normal[Importance] and produces a NormalImportance.
3) The implicits need to be given a type bound. The reason is that without the type bound, if you try to pass a Normal[T] to makeImportance where T is a subtype of Importance, it will not work because Normal[T] is not a subtype of Normal[Importance] because Normal is not covariant.
4) These type bounds need to be view bounds to allow the implicits to chain.
Here's the full solution:
class Model

trait Importance extends Model {
  def forward: Int
}

trait MCMC extends Model {
  def propose: String
}

class Normal[T <% Model](val arg: T) extends Model

class NormalImportance(arg: Importance) extends Normal(arg) with Importance {
  def forward = arg.forward + 1
}

class NormalMCMC(arg: MCMC) extends Normal(arg) with MCMC {
  def propose = arg.propose + "N"
}

object Normal {
  def apply[T <% Model](a: T) = new Normal[T](a)
}

object Importance {
  implicit def makeImportance[T <% Importance](n: Normal[T]): Importance =
    new NormalImportance(n.arg)
}

object MCMC {
  implicit def makeMCMC[T <% MCMC](n: Normal[T]): MCMC = new NormalMCMC(n.arg)
}

object Uniform extends Model with Importance with MCMC {
  def forward = 4
  def propose = "Uniform"
}

def main(args: Array[String]) {
  val n = Normal(Normal(Uniform))
  println(n.forward)
  println(n.propose)
}

A: Much of your problem seems to be that NormalMCMC and NormalImportance take arguments but, as you correctly imply, traits can't have constructors.
Instead, you can take the parameters that you'd want to supply via a trait constructor (if such a thing existed) and make them abstract members of the trait.
The members then get realised when the trait is constructed.
Given:
trait Foo {
  val x : String //abstract
}

you can use it as either of the following:
new Bar with Foo { val x = "Hello World" }

new Bar { val x = "Hello World" } with Foo

Which gives you back the equivalent functionality of using Trait constructors.
Note that if the type Bar already has a non-abstract val x : String then you can simply use
new Bar with Foo

In some scenarios it can also help to make x lazy, which can gives you more flexibility if initialization order should become an issue.


text:
Q: How to make dynamic checkbox and post the data using fetch post? I have a constant file with this data in it:
export let testing= [
  { id: 'test1', label: 'Test1' },
  { id: 'test2', label: 'Test2' },
  { id: 'test3', label: 'Test3' }
]

In my checkboxes.js,
class CheckBoxes extends Component {
  constructor(props) {
    super(props);
    this.state = ({
      checkBoxArray: [],
      isChecked: false
    })
  }

  handleSubmit = (event) => {
    event.preventDefault();     //use for testing only
   fetch(`${process.env.REACT_APP_SERVER_URL}/testing`, {
      method: "POST",
     headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        check_box_data: event.target.check_box_name[].value,   //error
      })
    })
      .then(response => {
        console.log(response);
        if (response.status === 200) {
          console.log('Success')
        } else {
          alert('Failed')
        }
      })
      .catch(error => {
        alert('Server error')
      });
  }

  handleCheckBoxChange = (index) => {     //not working
    const {checkBoxArray} = this.state;

    checkBoxArray[index].checked = !checkBoxArray[index].checked;
    this.setState({           //this line causes maximum depth mount error
      checkBoxArray
  });
  }

  render() {
    return (

        <form onSubmit={this.handleSubmit}>

                {
                  this.state.checkBoxArray.map((object, index) => {
                    return (
                      <CheckBoxComponent
                        key={index}
                        check_box_id={object.id}
                        check_box_name='check_box_name[]'
                        check_box_label={object.label}
                        check_box_value={object.id}
                        isChecked={this.state.isChecked}
                        handleCheckBoxChange={this.handleCheckBoxChange(index)}
                      />
                    );
                  })
                }

            <SingleButtonComponent button_type='submit' button_value='Create Now' />

        </form>

    )
  }
}

export default CheckBoxes;

In my checkbox component js:
import React from 'react';

const CheckBoxComponent = (props) => {
  const { check_box_id, check_box_name, check_box_label, check_box_value, isChecked, handleCheckBoxChange } = props;
  return (

      <input type='checkbox' id={check_box_id} name={check_box_name} value={check_box_value} checked={isChecked} onChange={handleCheckBoxChange}/>
       {check_box_label}

  )
}
export default CheckBoxComponent;

My first problem is I can't post the checkbox value as an array in the fetch api. Apparently [] is not allowed in event.target.check_box_name[].value. I tried doing event.target.check_box_name.value but it returns cannot read property 'value' of undefined. I want to send an array of the checkbox values back to server.
My second problem is I do not know how to setup dynamically generated checkbox.  This piece of code will check all the check boxes. I am showing just 3 lines of data in the constant file and it is more than that so I will not accept any solution that works statically.

A: Do not directly call function in render handleCheckBoxChange() use => or bind for that:
class CheckBoxes extends Component {
    constructor(props) {
      super(props);
      this.state = ({
        checkBoxArray: [  { id: 'test1', label: 'Test1' },
        { id: 'test2', label: 'Test2' },
        { id: 'test3', label: 'Test3' }],
        isChecked: false
      })
    }

    handleSubmit = (event) => {
      event.preventDefault();     //use for testing only
     fetch(`${process.env.REACT_APP_SERVER_URL}/testing`, {
        method: "POST",
       headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          check_box_data: event.target.check_box_name.value,   //error
        })
      })
    }

    handleCheckBoxChange = (id) => {
      const checkBoxArray = [...this.state.checkBoxArray];
      const index = checkBoxArray.findIndex(object => object.id === id);
      checkBoxArray[index].isChecked = !checkBoxArray[index].isChecked;
      this.setState({
        checkBoxArray
      });
    }

    render() {
      return (

          <form onSubmit={this.handleSubmit}>

                  {
                    this.state.checkBoxArray.map((object, index) => {
                      return (
                        <CheckBoxComponent
                          key={object.id}
                          check_box_id={object.id}
                          check_box_name='check_box_name'
                          check_box_label={object.label}
                          check_box_value={object.id}
                          isChecked={object.isChecked}
                          handleCheckBoxChange={this.handleCheckBoxChange} //you can pass id here but affect performance
                        />
                      );
                    })
                  }

          </form>

      )
    }
  }

const CheckBoxComponent = (props) => {
  const { check_box_id, check_box_name, check_box_label, check_box_value, isChecked, handleCheckBoxChange } = props;
  return (

      <input type='checkbox' id={check_box_id} name={check_box_name} value={check_box_value} checked={isChecked} onChange={() => {handleCheckBoxChange(check_box_id)}}/>
       {check_box_label}

  )
}

CheckBoxComponent.defaultProps = {
  isChecked: false,
}

export default CheckBoxComponent;

A: Сhecked param checkbox depends on the props isСhecked which you recorded as this.state.isChecked and never change it.
Why??
Same for each checkbox???
Change the checked conditions to
<CheckBoxComponent
   key={index}
   // ... some props
   isChecked={object.checked} // you update this field in handleCheckBoxChange
/>


text:
Q: R how can I calculate difference between rows in a data frame Here is a simple example of my problem:
> df <- data.frame(ID=1:10,Score=4*10:1)
> df
       ID Score
    1   1    40
    2   2    36
    3   3    32
    4   4    28
    5   5    24
    6   6    20
    7   7    16
    8   8    12
    9   9     8
    10 10     4
    > diff(df)

Error in r[i1] - r[-length(r):-(length(r) - lag + 1L)] :
  non-numeric argument to binary operator

Can anyone tell me why this error occurs?

A: I would like to show an alternative way for doing such kind of things even often I have the feeling it is not appreciated doing this in that way: using sql.
sqldf(paste("SELECT a.ID,a.Score"
            ,"      , a.Score - (SELECT b.Score"
            ,"                   FROM df b"
            ,"                   WHERE b.ID < a.ID"
            ,"                   ORDER BY b.ID DESC"
            ,"                   ) diff"
            ," FROM df a"
            )
      )

The code seems complicated but it is not and it has some advantage, as you can see at the results:
    ID Score diff
 1   1    40 <NA>
 2   2    36 -4.0
 3   3    32 -4.0
 4   4    28 -4.0
 5   5    24 -4.0
 6   6    20 -4.0
 7   7    16 -4.0
 8   8    12 -4.0
 9   9     8 -4.0
 10 10     4 -4.0

One advantage is that you use the original dataframe (without converting into other classes) and you get a data frame (put it in res <- ....). Another advantage is that you have still all rows. And the third advantage is that you can easily consider grouping factors. For example:
df2 <- data.frame(ID=1:10,grp=rep(c("v","w"), each=5),Score=4*10:1)

sqldf(paste("SELECT a.ID,a.grp,a.Score"
            ,"      , a.Score - (SELECT b.Score"
            ,"                   FROM df2 b"
            ,"                   WHERE b.ID < a.ID"
            ,"                         AND a.grp = b.grp"
            ,"                   ORDER BY b.ID DESC"
            ,"                   ) diff"
     ," FROM df2 a"
     )
)

   ID grp Score diff
1   1   v    40 <NA>
2   2   v    36 -4.0
3   3   v    32 -4.0
4   4   v    28 -4.0
5   5   v    24 -4.0
6   6   w    20 <NA>
7   7   w    16 -4.0
8   8   w    12 -4.0
9   9   w     8 -4.0
10 10   w     4 -4.0

A: Adding this a few years later for completeness- you can use a simple  [.data.frame subseting in order to achieve this too
df[-1, ] - df[-nrow(df), ]
#    ID Score
# 2   1    -4
# 3   1    -4
# 4   1    -4
# 5   1    -4
# 6   1    -4
# 7   1    -4
# 8   1    -4
# 9   1    -4
# 10  1    -4

A: diff wants a matrix or a vector rather than a data frame. Try
data.frame(diff(as.matrix(df)))

A: Perhaps you are looking for something like this:
> tail(df, -1) - head(df, -1)
   ID Score
2   1    -4
3   1    -4
4   1    -4
5   1    -4
6   1    -4
7   1    -4
8   1    -4
9   1    -4
10  1    -4

You can subtract or add two data.frames together if they are the same dimensions. So, what we are doing here is subtracting one data.frame that is missing the first row (tail(df, -1)) and one that is missing the last row (head(df, -1)) and subtracting them.

A: Another option using dplyr would be using mutate_each to loop through all the columns, get the difference of the column (.) with the lag of the column (.) and remove the NA element at the top with na.omit()
library(dplyr)
df %>%
    mutate_each(funs(. - lag(.))) %>%
    na.omit()

EDIT:
Instead of mutate_each (deprecated - as mentioned by @PatrickT) use mutate_all
df %>%
    mutate_all(funs(. - lag(.))) %>%
    na.omit()

Or with shift from data.table.  Convert the 'data.frame' to 'data.table' (setDT(df)), loop through the columns (lapply(.SD, ..)) and get the difference between the column (x) and thelag(shiftby default gives thelagastype = "lag"`).  Remove the first observation i.e. NA element.
library(data.table)
setDT(df)[, lapply(.SD, function(x) (x- shift(x))[-1])]

A: Because df works on  vector or matrix. You can use apply to apply the function across columns like so:
 apply( df , 2 , diff )
   ID Score
2   1    -4
3   1    -4
4   1    -4
5   1    -4
6   1    -4
7   1    -4
8   1    -4
9   1    -4
10  1    -4

It seems unlikely that you want to calculate the difference in sequential IDs, so you could choose to apply it on all columns  except the first like so:
apply( df[-1] , 2 , diff )

Or you could use data.table (not that it adds anything here I just really want to start using it!), and I am again assuming that you do not want to apply diff to the ID column:
DT <- data.table(df)
DT[ , list(ID,Score,Diff=diff(Score))  ]
    ID Score Diff
 1:  1    40   -4
 2:  2    36   -4
 3:  3    32   -4
 4:  4    28   -4
 5:  5    24   -4
 6:  6    20   -4
 7:  7    16   -4
 8:  8    12   -4
 9:  9     8   -4
10: 10     4   -4

And thanks to @AnandaMahto an alternative syntax that gives more flexibility to choose which columns to run it on could be:
DT[, lapply(.SD, diff), .SDcols = 1:2]

Here .SDcols = 1:2 means you want to apply the diff function to columns 1 and 2. If you have 20 columns and didn't want to apply it to ID you could use .SDcols=2:20 as an example.

A: Look this answer:
Compute difference between rows in R and setting in zero first difference
I think that is the easiest way.
df <- data.frame(ID=1:8, x2=8:1, x3=11:18, x4=c(2,4,10,0,1,1,9,12))
df$vardiff <- c(0, diff(df$x4))
df

A: My personal easy way is to use pivot_wider to create another column then you can use summarise to subtract the difference :D
It's all from dyplr package


text:
Q: Comparar se dois campos datas são iguais em C# Tenho um form e nesse form tenho dois campos de data, o campodata1 e preenchido pelo usuário e o campodata2 e preenchido pelo banco de dados, agora preciso de um código para comparar se estes dois campos estão com a mesma informação.
Os campos são string mesmo estou usando no form o masktext para campos data, só preciso comparar pra ver se são iguais pra fazer uma ação.
Segue uma imagem do meu form

A: using System;

public class Example
{
   public static void Main()
   {
      DateTime date1 = new DateTime(2009, 8, 1, 0, 0, 0);
      DateTime date2 = new DateTime(2009, 8, 1, 12, 0, 0);
      int result = DateTime.Compare(date1, date2);
      string relationship;

      if (result < 0)
         relationship = "é mais nova que";
      else if (result == 0)
         relationship = "é igual a";
      else
         relationship = "é depois de";

      Console.WriteLine("{0} {1} {2}", date1, relationship, date2);
   }
}

Fonte:https://msdn.microsoft.com/pt-br/library/system.datetime.compare(v=vs.110).aspx

A: A solução aceita quebrará a aplicação sempre que alguém entrar um formato errado, assim funciona:
if (!datetime.TryParse(CampoData1.text, out var data1)) //faz o tratamento de erro aqui
if (!datetime.TryParse(CampoData2.text, out var data2)) //faz o tratamento de erro aqui
//só pode ir pra frente aqui se não houve erro acima
if (data1 > data2) //faz algo para o maior
else if (data1 < data2) //faz algo para o menor
else //faz algo para o igual

Coloquei no GitHub para referência futura.

A: O que pode fazer é simplesmente converter as datas em formato STRING para DATETIME e fazer uma comparação normal:
DateTime data1 = Convert.ToDateTime(CampoData1.text);
DateTime data2 = Convert.ToDateTime(CampoData2.text);

if (data1 > data2)
{
    /*...*/
}
else if (data1 == data2)
{
    /*...*/
}
else if (data1 < data2)
{
    /*...*/
}


text:
Q: Criteria API in Hibernate, multiple restrictions for same column in joining table I have  tables person and personDoc as below:
person :

personNo
dateofBirth
firstname
LastName
MiddleName
salutationCode

personDoc :

personNo
doctype
documentNo

I have to search person with name = "John" and (doctype = "passport" and documentNo = "XXXX') and (doctype = "Driving license" and documentNo= "YYYY")
I am using the criteria API to do the search.
I have joined the person and persondoc tables using alias.
How do I add restrictions (for the same table and column) more than once?
Note:for further scenarios, I need to search like:
person with name like "John" and (doctype = "passport" and documentNo = "XXXX') or (doctype = "Driving license" and documentNo= "YYYY").

A: To create the following query with Criteria:

person with name like "John" and (doctype = "passport" and documentNo
  = "XXXX') or (doctype = "Driving license" and documentNo= "YYYY").

You can try with Criteria's Disjunction and Conjunction feature
Without looking how Person and PersonDoc tables are mapped using the entity classes it is difficult to build the exact criteria. But I hope below example should give you the hint on you can do it.
Disjunction disjunction = Restrictions.disjunction(); //OR condition

Conjunction conjunction1  = Restrictions.conjunction(); //AND condition
conjunction1.add(Restrictions.eq("doc.doctype", "passport"));
conjunction1.add(Restrictions.eq("doc.documentNo", "XXXX"));

Conjunction conjunction2  = Restrictions.conjunction(); //AND condition
conjunction2.add(Restrictions.eq("doc.doctype", "Driving License"));
conjunction2.add(Restrictions.eq("doc.documentNo", "YYYY"));

disjunction.add(conjunction1);
disjunction.add(conjunction2);

And this disjunction can be used in criteria building (as an example):
session.createCriteria(Person.class, "p").createAlias(.., "doc").
add(Restrictions.and(Restrictions.like("p.name", "John"),   disjunction)).
setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

Added setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) to make sure it returns only distinct Person entities.
Note that we can achieve the same using Restrictions.and and Restrictions.oras well.
If this doesn't help, do post entities related to Person and PersonDoc tables.

A: You can achieve this like following:
Root<Person> r = cq.from(Person.class);
Root<PersonDoc> p = cq.from(PersonDoc.class);
cq.where(
   cb.and(
      cb.equal(r.get(Person_.name), "John"),
      cb.or(
        cb.and(
           cb.equal(p.get(PersonDoc_.doctype), "passport"),
           cb.equal(p.get(PersonDoc_.documentNo), "XXXX")
        ),
        cb.and(
           cb.equal(p.get(PersonDoc_.doctype), "driverLicense"),
           cb.equal(p.get(PersonDoc_.documentNo), "XXXX")
        )
      ),
      cb.equal(p.get(PersonDoc_.person), r)
   );


text:
Q: What is the rule for interning of strings are float values also interned? a="ab d"
b="ab d"
print(id(a))
print(id(b))

sometimes it is getting interned, sometimes not. What is the general rule for interning of a string in version 3.9 of python.
and are float also get interned or not. I am getting different result every time for this too.
c=3.02
d=3.02
print(id(c))
print(id(d))


text:
Q: Load partial view within partial view from kendo grid custom command I have a partial view that im displaying within jquery tabs on my mvc parent view.

Company Details

Annual Reviews

    @Html.Partial("CompanyProfilePartial")

CompanyProfilePartial loads when you initially visit the page, and selecting the AnnualReviews tab calls the AnnualReviews action which loads the AnnualReviewsPartial partial view.
This view contains a kendo ui grid.

    @(Html.Kendo().Grid<OriginGreen.Models.AnnualReviewViewModel>()
    .Name("AnnualReviews")
    .Columns(columns =>
    {
        columns.Bound(p => p.PlanId).Title("Plan").Visible(true).Width(50);
        columns.Bound(p => p.Duration).Title("Duration").Width(50);
        columns.Bound(p => p.BaseYear).Title("Base Year").Width(50);
        columns.Bound(p => p.MinYear).Title("Min Year").Width(50);
        columns.Bound(p => p.MaxYear).Title("Max Year").Width(50);
        columns.Bound(p => p.AnnReviewYear).Title("Ann. Review Year").Width(50);
        columns.Bound(p => p.Status).Title("Status").Width(100);
        columns.Bound(p => p.AnnReviewDate).Title("AR Due Date").Width(100);

        columns.Template(x => { }).ClientTemplate("Edit").Width(30);
        columns.Template(x => { }).ClientTemplate("View Log").Width(30);
        columns.Template(x => { }).ClientTemplate("View ARs").Width(30);
        columns.Template(x => { }).ClientTemplate("View AR's").Width(30);
        columns.Command(command => command.Custom("AnnualReviewsByPlan").Click("showAnnReviewByPlan").HtmlAttributes(new { planId = "#= PlanId #" }));

    })
    .Events(e => e.DataBound("onRowBound"))
    .Pageable()
    .Sortable()
    .Scrollable()
    .Selectable()
    .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
    .DataSource(dataSource => dataSource
                            .Ajax()
                            .ServerOperation(false)
                            .PageSize(10)
                            .Batch(true)
                            .Model(model =>
                            {
                                model.Id(p => p.PlanId);
                            })
                            .Read(read => read.Action("DisplayAnnReviewPlans", "ManageCompanies", new { companyId = ViewContext.RouteData.Values["id"]}).Type(HttpVerbs.Get))
                        )

    )

Javascript function recieving the row's record id -
function showAnnReviewByPlan(e)
{
    //alert("Hello World1");
    var dataItem = this.dataItem($(e.currentTarget).closest("tr"));

    var id = dataItem.id;
    alert(id);

    //alert("div hidden, lets show it");
    $('#AnnReviewsByPlan').show();
}

I'd like to show the sub-partial view here, based on the id value it should show a sub grid with more records.
The AnnualReviewsByPlan custom command is calling a javascript function and passing the id for the record of the row (this side of it is working).
What Im looking to do in this function is load another partial view within this partial, which will display another grid (maybe kendo grid, will decide upon this later).
Is this possible and if so how might I go about it? Open to any better solutions on what to do here.
Cheers.

A: Once your view is rendered the only way to load a partial view is via an Ajax call which returns the partial view to your JQuery/Javascript and then updates the DOM accordingly.
Server:
[HttpGet]
public ActionResult YourAction(string id)
{
  //ToDo custom logic here
  return PartialView("YourView");
}

Javascript:
function showAnnReviewByPlan(e)
{
    var dataItem = this.dataItem($(e.currentTarget).closest("tr"));

    var id = dataItem.id;

    $.ajax({
      type: "GET"
      url: '/YourController/YourAction',
      data : { id: id },
      success: function (data, textStatus, jqXHR) {
          $('#AnnReviewsByPlan').html(data);
     }
    });
}

Update
[Note]
If your Kendo UI widget defined with server-side wrappers depends on javascript functions placed within the PartialView you might want to consider the Deferring Initialization section of the documentation.
That's crucial as long as you include the partial view in the parent window (not in a iframe) because Kendo UI widgets are translated into $(function(){}) which are immediately executed and any of their dependent functions must be already defined.


text:
Q: Cauchy Riemann equations for real functions. Let $f(x+iy) = x^2 + i.0$.
Then $u(x,y) = x^2$ and $v(x,y) = 0.$
Hence $u_x = 2x$, $v_y = 0$, $u_y = 0$, and $v_x = 0.$
Clearly this doesn't satisfy Cauchy Riemann equations, and hence is not differentiable.
But we know from calculus that $f'(x) = 2x.$ So my question is, where I went wrong in my analysis?

A: There is a difference between real differentiation and complex differentiation. The function $f(x+iy)=x^2$ is real differentiable as a function of $x$ (with derivative $2x$) but, as you showed from applying the Cauchy-Riemann equations, is not complex  differentiable as a function of $z=x+iy$.
The question is: why is a function that is real differentiable not necessarily complex differentiable (as you've shown)? Recall that the derivative of a function $f(x)$ is defined as
$$
   f'(x) = \lim_{h \rightarrow 0} \frac{f(x+h)-f(x)}{h}.
$$
If $f$ is function of a real number then $h$ has to be real. Roughly speaking, the real number $h$ can only approach the limit 0 from two directions. Either you let $h$ be positive and make it smaller and smaller, or you let $h$ be negative and make it larger and larger, so approaching 0 in two ways. For the limit to exist these two ways of approaching 0 have to give the same result. This is why the function $f(x)=|x|$ is not differentiable at $x=0$: the result depends on whether you start with $h$ negative (giving "$f'(x)=-1$") or $h$ positive (giving "$f'(x)=+1$").
On the other hand, if $f$ is a function of a complex variable then $h$ is also complex. If $h$ is complex then it can approach 0 in an infinite number of ways. Think of the two dimensional complex plane: you can travel towards the origin $z=0$ though any of the infinite number of lines that pass through $z=0$.  In particular, we could  let $h$ approach 0 along the imaginary axis by setting $h=it$ for a real number $t$.
Let's try this out directly and show that your function $f(x+iy)=x^2+0i$ is not complex differentiable at $z=x+iy=1$. If we let $h$ be real then we get
$$
   f'(1) = \lim_{h\rightarrow 0}\frac{f(1+h)-f(1)}{h}\\
     f'(1) =\lim_{h\rightarrow 0}\frac{(1+h)^2-(1)^2}{h}\\
     f'(1) =\lim_{h\rightarrow 0}\frac{1+2h+h^2-(1)^2}{h}\\
     f'(1) =\lim_{h\rightarrow 0}(2+h) = 2
$$
On the other hand, if we let $h$ be purely imaginary by setting $h=it$ for a real $t$ we get
$$
   f'(1) = \lim_{h\rightarrow 0}\frac{f(1+it)-f(1)}{h}\\
     f'(1) =\lim_{h\rightarrow 0}\frac{(1)^2+0t-(1)^2}{h}\\
     f'(1) =\lim_{h\rightarrow 0}\frac{0}{h}=0
$$
Thus when we allow $h$ to be complex it is possible for the limit defining the derivative to take on different values depending on the way in which you approach 0, and hence the limit doesn't exist.

A: The function you're describing is $f(z)=Re(z)^{2}$. Even if you break a function into its real and imaginary parts, you have to bear in mind that you're still dealing with a complex function - you can't just ignore that and say $f(x)=2x$, as that's only true for a subset of the domain of $f$.

A: It looks like you're trying to think of $f(x+iy)=x^2$ in a way similar to $f(z)=z^2$, where $f'(z)=2z$. Your calculations are correct though.
Another way to approach complex differentiability is to see if the function depends on the conjugate $\bar{z}$. One nice result is that a function is (complex) differentiable if and only if $\frac{\partial f}{\partial \bar{z} }=0$. Since $x=\frac{z+ \bar{z}}{2}$ your function can be expressed as $f(x+iy)= \left( \frac{z+ \bar{z}}{2} \right)^2$, which depends on $\bar{z}$.


text:
Q: BigQuery - Transactions in internal promo report like in the question here (Replicate Internal Promotion report in BigQuery with transactions) I want to rebuild the internal promo report from Google Analytics.
I was able to get PromoViews and PromoClicks, but I don't get the transactions...
My query looks like this
SELECT
          clientid,
          fullvisitorid,
          visitstarttime,
          concat(fullvisitorid, cast(visitstarttime AS string)) AS sessionid,
          hp.promoid,
          hp.promoname,
          hp.promocreative
          hp.promoposition,
          promotionActionInfo.promoIsView as promoview,
          promotionActionInfo.promoIsClick as promoclick

FROM [MYDATA], UNNEST (hits) as h, UNNEST (h.promotion) as hp

When I sum promoview and promoclick I get the exact same results like in Google Analytics
The official Google Documentation says:
>How transactions are attributed
>The Internal Promotion report attributes transactions to either an internal-promotion click or >internal-promotion view.
>
>Each hit in an ecommerce session can have:
>
>0 or 1 internal-promotion clicks
>0 or more internal-promotion views
>Internal-promotion click attribution
>If a hit includes a single internal-promotion click, then that internal-promotion is credited >for the transaction.
>
>If a session includes multiple internal-promotion clicks, then the last-clicked internal->promotion is credited for the transaction.
>
>If a hit includes zero internal-promotions clicks but one of that user's previous hits does >include an internal-promotion click, then the internal promotion from the previous click is >credited for the transaction.
>
>Internal-promotion view attribution
>If none of the conditions above is true but a hit includes one or more internal-promotion >views, then the transaction is credited to all promotional views within the session.

https://support.google.com/analytics/answer/6014872?hl=en
Keeping this in mind, my approach was to do a join with a separate table where I query the enhanced ecommerce data using sessionid as the join key
SELECT
          clientid,
          fullvisitorid,
          visitstarttime,
          concat(fullvisitorid, cast(visitstarttime AS string)) AS sessionid,
          hp.v2ProductName AS ProductName,
          h.transaction.transactionId AS TransactionId,
          hp.productQuantity as Quantity,
FROM [MYDATA], UNNEST (hits) AS h, UNNEST (h.product) as hp
WHERE
h.eCommerceAction.action_type = "6" AND
(hp.isImpression IS NULL) AND
(
  (h.promotionActionInfo.promoIsView is true) OR
  (h.promotionActionInfo.promoIsClick is true)
)

But it seems that my WHERE clause (filtering the promoviews and clicks) is not working like I expect, because I receive an empty table as a result.
Can anybody help me with this?


text:
Q: Vue Router: Keep query parameter and use same view for children I'm rewriting an existing Angular 1 application with Vue.
The application always needs to authenticate an user by locale, id and token before entering any views. Respecting the conventions of our API, I specified the token as a query parameter within my main parent route.
Coming from the existing Angular's UI router implementation I thought this is the way to go:
// main.js
new Vue({
  el: '#app',
  router,
  store,
  template: '<router-view name="main"></router-view>'
})

// router.js
const router = new Router({
  mode: 'history',
  routes: [
    {
      name: 'start',
      path : '/:locale/:id', // /:locale/:id?token didn't work
      query: {
        token: null
      },
      beforeEnter (to, from, next) {
        // 1. Get data from API via locale, id and token
        // 2. Update store with user data
      },
      components: {
        main: startComponent
      },
      children: [{
        name: 'profile',
        path: 'profile',
        components: {
          main: profileComponent
        }
      }]
    }
  ]
})

When I navigate to the profile view, I expect the view to change and the query token to stay, e.g. /en-US/123?token=abc to /en-US/123/profile?token=abc. Neither happens.
I'm using Vue 2.3.3 and Vue Router 2.3.1.
Questions:

*

*Can I keep query parameters when navigating to child routes?

*Am I using the Vue router right here? Or do I need to blame my UI router bias?

A: You can resolve this in the global hooks of Router
import VueRouter from 'vue-router';
import routes from './routes';

const Router = new VueRouter({
  mode: 'history',
  routes
});

function hasQueryParams(route) {
  return !!Object.keys(route.query).length
}

Router.beforeEach((to, from, next) => {
   if(!hasQueryParams(to) && hasQueryParams(from)){
    next({name: to.name, query: from.query});
  } else {
    next()
  }
})

If the new route (to) does not have its own parameters, then they will be taken from the previous route (from)

A: You can add in a mounted hook a router navigation guard beforeEach like this preserveQueryParams:
// helpers.js
import isEmpty from 'lodash/isEmpty';

const preserveQueryParams = (to, from, next) => {
  const usePreviousQueryParams = isEmpty(to.query) && !isEmpty(from.query);
  if (usePreviousQueryParams) {
    next({ ...to, query: from.query });
  } else {
    next();
  }
};

// StartComponent.vue
removeBeforeEachRouteGuard: Function;

mounted() {
  this.removeBeforeEachRouteGuard = this.$router.beforeEach(preserveQueryParams);
}

// don't forget to remove created guard
destroyed() {
  this.removeBeforeEachRouteGuard();
  // resetting query can be useful too
  this.$router.push({ query: undefined });
}


text:
Q: Google Maps v 3.2 - Satellite View turns white I have written code that displays a map perfectly on a basic HTML page. However, when I embed it in my existing website code, all the functions work with the exception of "Labels" in Satellite view. When the Labels box (submenu of Satellite view) is clicked all imagery disappears from the Satellite view and the background turns white.
I suspect that one or more of my CSS classes is interfering with the Labels code but I don't know which one. If I knew how the Google API Satellite layer is coded perhaps I could figure it out. Does anyone have any ideas?
Here is a link to the map: http://landcallnow.com/man105_map.html


text:
Q: How can I get only those categories which has products on sale? I am trying to query woocommerce product categories but only those which have on sale products. Is there any possibilities? The result is hierarchy parent > child. I want to show both parent and its child. i.e. if child has product on sale print the parent category as well.
Here is the code I wrote so far

<?php  $terms = get_terms('product_cat', array( 'parent' => 0, 'exclude' => '15' ));
     if( $terms ):
     $original_query = $wp_query;
     foreach ( $terms as $key => $term ):
     $child = get_terms(
              'product_cat',
               array(
                   'child_of' => $term->term_id,
                   'hide_empty' => true
               )
          );
        ?>

                                            <a href="<?php echo get_term_link($term); //echo $term->name; ?>"><?php echo $term->name; ?>
                         <?php if ( ! $child ){ ?>
<?php
} else {
    ?>

    <?php
}
?>

          <?php
          $child_terms = get_terms(
              'product_cat',
               array(
                   'child_of' => $term->term_id,
                   'hide_empty' => true
               )
          );
          foreach ( $child_terms as $child_term  ) {
             $re_child_terms = get_terms(
                 'product_cat',
                 array(
                     'child_of' => $child_term->term_id,
                     'hide_empty' => true
                 )
             );
             if ( ! $re_child_terms ){
             ?>

                                                    <a href="<?php echo get_term_link($child_term);?>"> <?php echo $child_term->name; ?>

        <?php
        }
     }
     ?>

<?php
endforeach;
$wp_query = null;
$wp_query = $original_query;
?>

<?php endif; ?>

Thanks in advance.

A:

                                                                                <?php
        $args = array(
            'post_type'      => 'product',
            'posts_per_page' => -1,
            'orderby' => 'rand',
            'meta_query'     => array(
                    'relation' => 'OR',
                    array( // Simple products type
                        'key'           => '_sale_price',
                        'value'         => 0,
                        'compare'       => '>',
                        'type'          => 'numeric'
                    ),
                    array( // Variable products type
                        'key'           => '_min_variation_sale_price',
                        'value'         => 0,
                        'compare'       => '>',
                        'type'          => 'numeric'
                    )
                )
        );
        $loop = new WP_Query( $args );
        if ( $loop->have_posts() ) {
$terms = [];
            while ( $loop->have_posts() ) : $loop->the_post();

            $terms = array_diff($terms,wp_get_post_terms( get_the_id(), 'product_cat',['fields'=>'ids'] ) );
$term  = reset($terms);

            ?>

                                            <a href="<?php echo get_term_link($term);  ?>"><?php echo $term->name; ?>

                <?php

            endwhile;
        } else {
            echo __( '' );
        }
        wp_reset_postdata();
    ?>

this is how I get the on sale products and get their category name . where to use array_diff function

A: The code below solved the problem.

                                                                                <?php
        $args = array(
            'post_type'      => 'product',
            'posts_per_page' => -1,
            'orderby' => 'rand',
            'meta_query'     => array(
                    'relation' => 'OR',
                    array( // Simple products type
                        'key'           => '_sale_price',
                        'value'         => 0,
                        'compare'       => '>',
                        'type'          => 'numeric'
                    ),
                    array( // Variable products type
                        'key'           => '_min_variation_sale_price',
                        'value'         => 0,
                        'compare'       => '>',
                        'type'          => 'numeric'
                    )
                )
        );
        $loop = new WP_Query( $args );
        if ( $loop->have_posts() ) {

$alreadyDisplayed = [];
            while ( $loop->have_posts() ) : $loop->the_post();

$term_list = wp_get_post_terms($post->ID, 'product_cat', array("all"));
foreach($term_list as $term_single) {
    if ( !in_array( $term_single->name, $alreadyDisplayed) ) {
        echo '

';
        echo $term_single->name;
        echo '

';
        $alreadyDisplayed[] =  $term_single->name;
    }
}
            ?>
<?php

            endwhile;
        } else {
            echo __( '' );
        }
        wp_reset_postdata();
    ?>


text:
Q: Getting an error while importing Loader from 'react-loader-spinner'? The error I'm getting:
ERROR in ./src/components/Loading.jsx 9:33-39

export 'default' (imported as 'Loader') was not found in 'react-loader-spinner' (possible exports: Audio, BallTriangle, Bars, Circles, CradleLoader, Grid, Hearts, MutatingDots, Oval, Plane, Puff, RevolvingDot, Rings, TailSpin, ThreeDots, Triangle, Watch)

Here is my code:
import React from 'react';
import Loader from 'react-loader-spinner';

export const Loading = () => (

    <Loader type="Puff" color="#00BFFF" height={550} width={80} />

);

A: react-loader-spinner exports various loaders and you can use those loaders directly. And if you want to import all the loaders and use them. You can do it like this.
import * as Loader from "react-loader-spinner";

function App() {
  return <Loader.TailSpin />;
}

or
import {TailSpin} from "react-loader-spinner";

function App() {
  return <TailSpin />;
}

https://codesandbox.io/s/hopeful-herschel-652kq?file=/src/index.js:70-168

A: You just need to import that specific loader you want, as there are many of them that react-loader-spinner exports. For example the code below  is for Rings loader.

All loader types are here on the official documentation.

import { Rings } from 'react-loader-spinner';

export const Loading = () => (

    <Rings color="#00BFFF" height={80} width={80} />

);

A: You can import specific one from react-loader-spinner
import React from 'react'
import {Triangle} from 'react-loader-spinner'
const Loading = () => {
  return (

        <Triangle type='Puff' color='#00BFFF' height={550} width={80} />

  )
}

export default Loading

https://mhnpd.github.io/react-loader-spinner/ Here you can find many examples of Loaders

A: make sure use the correct method of import and Export ,It Normally occurs because false Way of importing and exporting
Use this for Making and Importing the Loader
Here we are targeting the specific loader from react-loader-spinner
import React from 'react';
import { Rings } from 'react-loader-spinner';
export const Loading = () => (

    <Rings color="#00BFFF" height={80} width={80} />

);

See carefully that we don't use default Here so to import in main component
import {Loading}  from './Loading.jsx';


text:
Q: Roku Smart TV - LabelList not showing I am submitting a Roku channel, and it is continually rejected because the "Play" button doesn't show up on the Springboard.
I used one of the templates for the base code. It puts the "Play" button on screen using a LabelList. It works perfectly fine on the device I test on, which is a Roku stick. They seem to be testing these on a Roku Smart TV though, and something about that device is preventing the LabelList from showing.
Below is the code the adds the content to the LabelList.
Sub OnContentChange()
    content = m.top.content
    m.description.content = content
    m.description.Description.width = "770"
    m.poster.uri = content.hdBackgroundImageUrl
    m.background.uri = content.hdBackgroundImageUrl

    ' create buttons
    m.buttonArray = []

    moviePlaysSection = CreateObject("roRegistrySection", "MoviePlays")
    if moviePlaysSection.Exists(content.guid)
        m.currentPosition = StrToI(moviePlaysSection.Read(content.guid))
    end if

    if content.url <> ""
        m.buttonArray.push({ title : "Play" })
    end if

    if content.trailerUrl <> invalid
        m.buttonArray.push({ title : "Play Trailer" })
    end if

    m.buttons.content = ContentList2SimpleNode(m.buttonArray)
End Sub

Function ContentList2SimpleNode(contentList as Object, nodeType = "ContentNode" as String) as Object
    result = createObject("roSGNode",nodeType)
    if result <> invalid
        for each itemAA in contentList
            item = createObject("roSGNode", nodeType)
            item.setFields(itemAA)
            result.appendChild(item)
        end for
    end if
    return result
End Function

Is there something weird about the Roku TV that prevents LabelLists from displaying or am I doing something wrong?

A: The problem ended up being that I was trying to access the Roku registry in the main thread. This is not allowed in Roku versions less than 8. You have to access it inside a Task instead. The code was working fine on my hardware which was running version 8. The hardware Roku was testing it on was running version 7. Simple fix but hard to track down without the correct hardware.


text:
Q: 2 in 1 Button like Dual-Button I can't seem to create a button that look something like this one (See Picture).
I've tried to combine a grid, 2 ellipses and 2 textblocks to something that looks like it, but can't get the two different buttons to look right..
It's generally a button split in half and then converted into 2 separate buttons, S button and A button..
Any input would be very helpful..

A: After tinkering with 1 grid, 2 ellipses and 2 textblocks I got it to work..
And 2 Viewboxes for resizing.
Xaml:
<Window x:Class="Dual_Button.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Dual_Button"
        mc:Ignorable="d"
        Title="Dual Button" Height="260" Width="260">
    <Window.Resources>
        <Style x:Key="FocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
        <SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
        <SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
        <SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
        <SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
        <SolidColorBrush x:Key="SubBack" Color="#FFD1FF00"/>
        <SolidColorBrush x:Key="AudioBack" Color="#FF00C5FF"/>
        <Style x:Key="ButtonStyle1" TargetType="{x:Type Button}">
            <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
            <Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
            <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Padding" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                            <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsDefaulted" Value="true">
                                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
                                <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
                                <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Grid x:Name="grid">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Ellipse x:Name="sub_Background" Height="{Binding ActualHeight, ElementName=grid, Mode=OneWay}" Width="{Binding ActualWidth, ElementName=grid, Mode=OneWay}" Fill="{DynamicResource SubBack}"/>
        <Button x:Name="btn_Sub" Background="{x:Null}" Foreground="White" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" VerticalAlignment="Center" Padding="0" BorderThickness="0" Click="btn_Sub_Click" Style="{DynamicResource ButtonStyle1}" MouseEnter="btn_Sub_MouseEnter" MouseLeave="btn_Sub_MouseLeave">
            <Viewbox Margin="25,10,10,25">
                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="S"/>
            </Viewbox>
        </Button>
        <Ellipse x:Name="Audio_Background" Height="{Binding ActualHeight, ElementName=grid, Mode=OneWay}" Width="{Binding ActualWidth, ElementName=grid, Mode=OneWay}" Fill="{DynamicResource AudioBack}" Grid.Column="1" HorizontalAlignment="Right"/>
        <Button x:Name="btn_Audio" Background="{x:Null}" Foreground="White" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" VerticalAlignment="Center" Padding="0" BorderThickness="0" Grid.Column="1" Click="btn_Audio_Click" Style="{DynamicResource ButtonStyle1}" MouseEnter="btn_Audio_MouseEnter" MouseLeave="btn_Audio_MouseLeave">
            <Viewbox Margin="10,10,25,25">
                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="A"/>
            </Viewbox>
        </Button>
    </Grid>
</Window>

Code behind:
public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        void btn_Sub_MouseEnter(object sender, MouseEventArgs e)
        {
            try { sub_Background.Fill = Brushes.Red; } catch { }
        }
        void btn_Sub_MouseLeave(object sender, MouseEventArgs e)
        {
            try { sub_Background.Fill = (Brush)FindResource("SubBack"); } catch { }
        }
        void btn_Sub_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Subtitles");
        }

        void btn_Audio_MouseEnter(object sender, MouseEventArgs e)
        {
            try { Audio_Background.Fill = Brushes.Purple; } catch { }
        }
        void btn_Audio_MouseLeave(object sender, MouseEventArgs e)
        {
            try { Audio_Background.Fill = (Brush)FindResource("AudioBack"); } catch { }
        }
        void btn_Audio_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Audio");
        }
    }

This is my result: And it's scale able..

When the mouse enters the S button the half Circle will change into Red.
When the mouse enters the A button the half Circle will change into Purple.

A: I have probably managed to create what you were looking for. Please note, that this requires further work since a lot of functionality was not implemented. What I did, was just creating a "DualButton" that has separate clickable parts and looks as you have provided.
You can work out your own style and functionality based off my example.
First, how it looks:

Now, to the code. I defined it as a userControl for easier management and reusability without clunkying the XAML too much.
XAML:
<UserControl x:Class="WpfApplication2.DualButton"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:local="clr-namespace:WpfApplication2"
         mc:Ignorable="d"
         d:DesignHeight="300" d:DesignWidth="300">
<Grid>
    <Button Click="Button_Click_1">
        <Button.Template>
            <ControlTemplate>
                <Grid>
                    <Path Fill="Lime" >
                        <Path.Data>
                            <PathGeometry>
                                <PathFigure StartPoint="150,0">
                                    <ArcSegment IsLargeArc="True"
                            Size="50, 50"
                            Point="150, 300"
                            SweepDirection="Counterclockwise" />
                                </PathFigure>
                            </PathGeometry>
                        </Path.Data>
                    </Path>
                    <TextBlock Margin="49,46,171,83" FontSize="150" TextAlignment="Center" HorizontalAlignment="Center" Foreground="White">S</TextBlock>
                </Grid>
            </ControlTemplate>
        </Button.Template>
    </Button>
    <Button Click="Button_Click_2">
        <Button.Template>
            <ControlTemplate>
                <Grid>
                    <Path Fill="Blue" >
                        <Path.Data>
                            <PathGeometry>
                                <PathFigure StartPoint="150,0">
                                    <ArcSegment IsLargeArc="True"
                            Size="50, 50"
                            Point="150, 300"
                            SweepDirection="Clockwise" />
                                </PathFigure>
                            </PathGeometry>
                        </Path.Data>
                    </Path>
                    <TextBlock Margin="162,47,41,84" FontSize="150" TextAlignment="Center" HorizontalAlignment="Center" Foreground="White" Width="97">A</TextBlock>
                </Grid>
            </ControlTemplate>
        </Button.Template>
    </Button>
</Grid>

So, what is actually happening here?
First, there is the layout grid of course. It contains two buttons, that have their template set to PathGeometry to create an Ellipse. (Here is already some place for improvement - I used fixed values, so the button won't be really scalable. Try to connect these properties with a grid size)
Then there is a textBlock for obvious letters on the button halves. Again, I didn't bother too much with placing, I just dragged them around so they looked nice. You can work out this on your own too (I hope :D )
Now, with the code-behind:
public partial class DualButton : UserControl
{
    public DualButton()
    {
        InitializeComponent();
    }

    public static readonly RoutedEvent ClickEvent =
EventManager.RegisterRoutedEvent("Click", RoutingStrategy.Bubble,
typeof(RoutedEventHandler), typeof(DualButton));

    public event RoutedEventHandler Click
    {
        add { AddHandler(ClickEvent, value); }
        remove { RemoveHandler(ClickEvent, value); }
    }

    private void Button_Click_1(object sender, RoutedEventArgs e)
    {
        System.Windows.MessageBox.Show("Left");
    }

    private void Button_Click_2(object sender, RoutedEventArgs e)
    {
        System.Windows.MessageBox.Show("Right");
    }
}

Here we are adding a RoutedEvent to make our button actually clickable. I also added some event handlers to check if everything worked as expected (it did!)
Again, this is just a quick example and is by no means optimized. There is a lot of space for improvement. I just wanted to push you in the right direction.
If you have any more questions, feel free to ask.


text:
Q: OpenLayers.Format.SLD - Ignores 'matchCase'? I've trying to use OpenLayers to construct an SLD element to include in a WMS layer's parameters.
This SLD document can contain a number of filters. This works fine and resultant SLD does work to filter the layer.
However, the matchCase=false property of the filter(s) are being stripped out on formatting the SLD.
Example:
var filter    = new OpenLayers.Filter.Comparison(
{
  type:       OpenLayers.Filter.Comparison.EQUAL_TO,
  property:   'my_property',
  value:      'A Value',
  matchCase:  false
});

var rule = new OpenLayers.Rule({
  filter: filter,
  symbolizer: {"Polygon": {}}
});

var style = new OpenLayers.Style();

style.addRules([rule]);

// Create the SLD
var sld_body = new OpenLayers.Format.SLD().write({
  namedLayers: [
    {
      name: 'myLayer',
      userStyles: [style]
    }
  ]
});

I think I know what the problem is, but I have no idea how to fix it.
If I check the output of OpenLayers.Format.Filter({version: "1.1.0"}).write( filter ); then I see correctly formatted XML, which includes my matchedCase property.
If I do the same with version 1.0 (the default), I see the same XML but without the matchedCase parameter.
The documentation for OpenLayers.Format.SLD states that it inherits from OpenLayers.Format.Filter.v1_0_0, which explains why it won't read the matchedCase parameter.
I'd hoped using OpenLayers.Format.SLD({version: "1.1.0}).write() would work, but it just throws an error about a driver not being available for that version.
So, how should I deal with this? I need to generate an SLD document and it needs to acknowledge the matchedCase property.
Thanks,
Tom

A: Officially, OpenLayers only supports SLD version 1.0.0 for now (patch welcome). I'm not sure this version of the SLD standard officially supports Filters version 1.1.0. That's the official standard point of view.
In the real world however, your WMS service probably do support it. So to force OpenLayers SLD version 1.0.0 to use Filters version 1.1.0, you can overwrite them like this:
var filter    = new OpenLayers.Filter.Comparison(
{
  type:       OpenLayers.Filter.Comparison.EQUAL_TO,
  property:   'my_property',
  value:      'A Value',
  matchCase:  false
});

var rule = new OpenLayers.Rule({
  filter: filter,
  symbolizer: {"Polygon": {}}
});

var style = new OpenLayers.Style();

style.addRules([rule]);

// Create the SLD
OpenLayers.Format.SLD.v1.prototype.readers = OpenLayers.Util.applyDefaults(
    OpenLayers.Format.Filter.v1_1_0.prototype.readers,
    OpenLayers.Format.SLD.v1.prototype.readers);
OpenLayers.Format.SLD.v1.prototype.writers = OpenLayers.Util.applyDefaults(
    OpenLayers.Format.Filter.v1_1_0.prototype.writers,
    OpenLayers.Format.SLD.v1.prototype.writers);
OpenLayers.Format.SLD.v1.prototype.writeSpatial = OpenLayers.Util.applyDefaults(
    OpenLayers.Format.Filter.v1_1_0.prototype.writeSpatial,
    OpenLayers.Format.SLD.v1.prototype.writeSpatial);
var sld_body = new OpenLayers.Format.SLD().write({
  namedLayers: [
    {
      name: 'myLayer',
      userStyles: [style]
    }
  ]
});

The code highlighted below replace all the Filter1.0.0 writing functions by Filter1.1.0 in the SLD class.
OpenLayers.Format.SLD.v1.prototype.writers = OpenLayers.Util.applyDefaults(
    OpenLayers.Format.Filter.v1_1_0.prototype.writers,
    OpenLayers.Format.SLD.v1.prototype.writers);

A: I did not have any luck with the accepted answer (although I am working with a GeoJSON layer, not WMS, so perhaps that makes the difference), but I found a sloppy workaround via some find-and-replace magic in the 1.1.0 SLD file:

*

*Changed beginning of file (xml prologue is it called??) to match 1.0 standards:
<?xml version="1.0" encoding="UTF-8"?>
<sld:StyledLayerDescriptor version="1.0.0"
xmlns:sld="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">

*Changed all instances of SvgParameter to CssParameter (credit to the suggestion at the end of this post).

*Changed all instances of <se:whatever>stuff</se:whatever> to <sld:whatever>stuff</sld:whatever> (this may have been just a QGIS feature, I am not sure).

Like I said, not pretty, but it allowed me to adapt a 1.1.0 SLD file exported from QGIS, which I was then able to use in OpenLayers.


text:
Q: override a css style I have the following line in the original theme style.css file:
background: none repeat scroll 0px 0px #CCC;

In my child-theme.. I want to delete the "background: line..
But how?
Update:
OK to make things clear....
As I'm using a child theme with an own style.css file.. This settings in the style.css file override the ones in the parent theme.
In the theme's style sheet the following is stated...
.content-ver-sep {
     background: none repeat scroll 0px 0px #CCC;
     border-bottom: 1px solid #FFF;
     clear: both;
     height: 1px;
}

but for the child theme's style.css sheet I don't wont a background declaration or a border bottom.. So I know how to override it (with another value) but how do i delete or ignore these settings.

A: You can not delete or ignore default styling in a child theme. You must override the declaration.
 .content-ver-sep {
 background: transparent !important;
 border-bottom: none !important;
 clear: both;
 height: 1px;
 }

this should do the trick -


text:
Q: How to make break after header in  in Blogger I'm trying to make a simple line break between a header h2 and the first paragraph of a post in a <data:post.snippet> in Blogger.
This post kind of helps (How to increase character lengh in blogger snippet instead of using limited length, 'data:post.snippet'?), but I limited the amount of characters using this javascript code (https://groups.google.com/d/msg/bloggerdev/8jUR9uISmA0/J8dmGwACJDgJ) (I don't want to show <data:post.body> until the read more tag).
Is there a way to style the snippet to make a line break after a heading?

A: You will need to utilize the new snippet operator introduced with new themes. It has an option to preserve the line breaks which are present in the actual post content. The code for the same will look like -
<b:eval expr='snippet(data:post.body, {length: 450, linebreaks: true})' />

This will process the data:post.body data tag and extract the first 450 characters from it while preserving the line breaks present in it.
For more detailed documentation of the snippet operator -

snippet(string, options)
Produces a short snippet from an HTML string.
options: Object specifying the snippeting options, which are:

*

*links: boolean for whether to preserve anchors/links in the snippet.
Defaults to true.

*linebreaks: boolean for whether to preserve linebreaks (tags) in the
snippet. Defaults to true.

*ellipsis: boolean for whether to append an ellipsis (…) to the end of
the snippet. Defaults to true.

*length: Number specifying the maximum length of the snippet.


text:
Q: Error while installing Dbeaver On Ubuntu 14.04 I am trying to install Dbeaver on Ubuntu (14.04) but i am unable to install. Seems like there is some issue with Java Installation.
Installtion Process
 1. $ sudo apt-get install gdebi
 2. $ wget http://dbeaver.jkiss.org/files/dbeaver_3.4.5_i386.deb
 3. $ gdebi dbeaver_3.4.5_i386.deb

I get this error when tring to install :
webwerks@BT-R4P9:~/Downloads$ sudo gdebi dbeaver_3.4.5_i386.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Building data structures... Done
Building data structures... Done

DBeaver
Universal Database Manager
Do you want to install the software package? [y/N]:y
Selecting previously unselected package dbeaver.
(Reading database ... 183011 files and directories currently installed.)
Preparing to unpack dbeaver_3.4.5_i386.deb ...
Unpacking dbeaver (3.4.5) ...
dpkg: dependency problems prevent configuration of dbeaver:
dbeaver depends on java7-runtime.

dpkg: error processing package dbeaver (--install):
dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.10.1-0ubuntu2) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu1) ...
Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.54ubuntu1.1) ...
Errors were encountered while processing:
dbeaver

When I run java -version I get this :
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)


text:
Q: 2 Extra Degree of Freedom in Linear Triatomic Molecules? Ok, there is a bit problem in understanding Degree of Freedom of Linear Molecules specially of Triatomic Linear Molecules.
See, the DOF in general is given as $f=3N-k$.
Here,
N=Number of atoms in a molecule
k=Total number of constraints
If there are no constraints, then DOF generally is, $f=3N$
Coming to Linear Molecules, let's first assume that the molecules are at low temperatures such that the constituent atoms are not vibrating.
Now, as per this wikipedia link of DOF(Physics and Chemistry) under Gas Molcules, it generalizes the degree of freedom of linear molecules.
With no vibrational modes to consider, it says that:-
DOF of linear molecules: $5$ and is independent to the atomicity of the molecule

Reason:-
$3$ Translational DOF + $2$ Rotational DOF + $0$ Vibrational DOF = $5$ DOF
Note: Translation and Rotation about it's Cente of Mass.
Pretty Logical for any type of linear molecules(Di-,Triatomic,etc.)
Similar generalization is also done for Non-Linear Molecules. But we'll keep our focus on Linear Molecules for now.
Now, let's use the formula stated at the beginning. As the formula clearly has the atomicity factor N, we'll consider a basic triatomic linear molecule (also, because this specific molecule is creating doubts).
As the 3 atoms aren't vibrating(assumed initially), so there are 2 fixed distances between the 3 atoms on a straight line.
Hence,
$k=2 ;N=3$
$f=3N-k=7=5+2$
Now, the doubt can be clearly seen.
The 5 degree of freedom of the molecule is explained earlier.
So, if vibrational modes are neglected for now, then what are those 2 extra DOFs for linear triatomic molecules signifies?
If 5 DOF of linear molecules(given in the wiki) is the actual answer, then, can we say that $f=3N-k$ which I think a general equation is not so general and reliable equation to evaluate DOF of molecules?

Pretty similar question is asked here in this community.
But, there's nothing in response to that post, so I thought to give it a second go.
Another question which give some insight to me is this.
But it didn't answer the 2 questions given above precisely.

EDIT
Recently, I noticed that the specific ratio, $\gamma$ of CO2(a trilinear molecule) is $1.30$.
Pretty close to $1.28$ which happens to be the $\gamma$ of trilinear molecules at low temperatures where any kind of vibrational degree of freedom is not present.
Now, for solving $\gamma$, first $C_p$ and $C_v$ are evaluated using dof of trilinear molecule which is taken $7$.
So, the discussion in this post earlier concluded that in those 7 dofs, 2 dofs are basically degenerate cases of bending in which the extreme atoms of the molecule remain at a constant distance from the vibrating middle atom.
But as bending is more like a vibrational dof, then it can't exist at low temperatures.
And so,
At this point, excluding the bending nature of atoms and evaluating $\gamma$ of trilinear molecules using $f=5$ seems more appropriate.
But assuming $f=5$ means rejecting the standard value of $\gamma=1.30$ of CO2.
So, the question here is that if those 2 extra dofs are really vibrational dofs(to be precise, degenerate cases of bending) then why these 2 are considered to evaluate $\gamma$ of CO2?

A: A trilinear molecule can bend in the middle. In two directions.
These are your extra two degrees of freedom.