text:
Q: Working on templates for columns in kendo grid I have been trying to use if and else in a template of one of the field in kendoGrid.I have two fields "StatusDesc" and "newStatusDesc". I want show one of the value as an anchor tag. That is displaying fine but if you notice onclick defined for anchor tag,it has one of the field from the grid itself because it has to open a another page but when i click on the anchor tag, console of my browser shows:

uncaught ReferenceError: WEW6101 is not defined

Actually if I check firebug, it shows below value set to my anchor tag parameter which is correct but I am not able to call the function "WEW6101"
onclick='openStatusReload(WEW6101)

  $("#Grid").kendoGrid({
        dataSource: TUEDataSource,
        autoBind: false,
        scrollable: false,
        sortable: {
            allowUnsort: false
        },
        //filterable: { mode: "row", style: "max-width:100px;" },
        //groupable: true,
        pageable: {
            refresh: true,
            buttonCount: 5,
            pageSizes: 5
        },
        dataBound: gridDataBound,
        columns:
            [
                { field: "newStatusDesc", hidden: true },
            { field: "StatusDate", title: "Status Date", width: 200, format: "{0:MM/dd/yyyy}", filterable: { cell: { showOperators: false, suggestionOperator: "contains" } } },
            { field: "Status", title: "Status", width: 150, filterable: { cell: { showOperators: true } } },
            { field: "LimitedDate", title: "Expiration Date", format: "{0:MM/dd/yyyy}", width: 150, filterable: { cell: { showOperators: true } } },
            {
                field: "StatusDesc", title: "Comments", width: 150,
                template: "#if(StatusDesc == '' && newStatusDesc!='' && newStatusDesc!= null  ) {# #:newStatusDesc##} else{##:StatusDesc##}#", filterable: { cell: { showOperators: true } }
                // template: "#=TueStatusDesc#", filterable: { cell: { showOperators: true } }
            },
            ]
    });

A: As per @Quantastical's comment you are missing the quotes around your text which is what is causing the issue but the below answer may help with this and any future templating you need to do with the kendo grids.
I think this dojo may help you out: http://dojo.telerik.com/AVeBU
I find doing inline templating like this can be difficult so prefer to extract the method out and either use a templating engine like kendo provides or craft the html like you have done.
I have made the following changes to your column so from what you have provided to:
 { field: "StatusDesc", title: "Comment", width: "130px" ,
   template: "#=generateLink(data)#" }

Here I am passing the dataItem for the row into a function called generateLink which calls this code:
function generateLink(data) {
  var ret = '';

  if (data.StatusDesc === '' && data.newStatusDesc !== '' && data.newStatusDesc !== null) {

    var linkElement = 'openStatusReload("' + data.newStatusDesc + '")';

    ret = "" + data.newStatusDesc + '';

    console.log(ret);

  } else {
    ret = data.StatusDesc;
  }

  return ret;
}

all this does is applies the same logic you had but allows you to use native javascript rather than the kendo widgets having to interpret the breakouts with the #= {some javascript in here}  #
this way if you need to modify the code it is easier to read and change rather than having to figure out which # may be missing.
In my example I have the code just popping up an alert box with the value passed in and logging to console so you can see the magic that is occurring.
Hope this helps but if you anything changing/explaining better let me know and I will update my answer accordingly.


text:
Q: Style is not loading in local html using WKWebView when css file is in parent folder My Xamarin Forms application downloads several HTML files (stored in .../Application/{AppId}/Documents/) that use the same CSS file . The problem is that when I link the CSS sheet to an HTML file that is at a lower level, the CSS can't load.
Ex :
[Documents]
    style.css
    [folder]
        index.html

Example of the index.html
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="../style.css">
    </head>
    <body>
        <div>
            Some content
        </div>
    </body>
</html>

You can see here that I'm using the ../ to get to the previous level.
According to the tests I've done, this only happened in the iOS on a real device. The simulator's working fine.
I opened Safari with the html inspector and indeed HTML cannot access the CSS file.
It also works well if the CSS file is below/equal to the HTML file.
On the other hand, it is present when I run File.Exist({CssPathFile}).
I also tried to add the reference to the css file in JS with the HTML Inspector and I got :
Failed to load resource: ... (kCFErrorDomainCFNetwork error 1.)

redpajama_set_name: RedPajamaStackExchange


text:
Q: A study in JOINs with many-to-many relationships Consider, if you will, the following tables:
Vacation Model http://imagetiger.org/images/vacatilrl.png
This may seem like a strange structure, but allow me to explain.  The goal of this structure is to create a report listing all people, excluding those on vacation (for simplicity, we'll pretend that the vacation record will only exist if a person is on vacation.)
The reason I have the Vacation table at all is because the Event table is a more general use table for "insignificant" events, whereas the Vacation table includes more details such as the location and date.
What I can't seem to figure out is how to design a query that includes, say, Person.personId and Vacation.location, but only those personIds that exist in Person_Vacation.  Or the inverse, only personIds that DO NOT exist in Person_Vacation.
Also, does this seem to be the best way to implement this solution, design-wise?  Any ideas on what I might have done wrong or suggested improvements?
EDIT:  Maybe i'm just not too good at communicating my intentions:  turns out getting only the persons on vacation is easy, but i would like to perform the inverse, basically all persons NOT on vacation.

A: Design-wise I don't see why you need Person_Vacation. If I understand your design correctly, every vacation is an event (i.e. "inheritance"), so the connection between Vacation and Person can be made through Person_Event. Then the queries would be:
Persons in vacation:
SELECT P.PersonID, V.locaton
FROM Person P, Vacation V, Person_Event PE
WHERE P.personid = PE.personID AND PE.eventid = V.eventid

Persons in NON-vacation events:
SELECT P.PersonID, E.title
FROM Person P, Person_Event PE, Event E
WHERE P.personid = PE.personID AND PE.eventid = E.eventid
AND E.eventID NOT IN (SELECT eventid FROM Vacation)

Persons not on any vacation:
SELECT P.PersonID, E.title
FROM Person P, Person_Event PE, Event E
WHERE P.personid = PE.personID AND PE.eventid = E.eventid
AND P.personID NOT IN
  (SELECT personid FROM Person_Event PE, Vacation V WHERE PE.eventid = V.eventid)

If you want to go with your own design, then you have to decide if you will insert a person's vacation only in Person_Vacation or in Person_Vacation and Person_Event. If you do the former, then the queries above would become a bit simpler.
However I would still vote for my design, because what you are essentially doing is prematurely splitting data just to get a bit of performance / simplicity. This may not pay off in the long run.

A: Probably I didn't full understand in your database design. If Vocation is also an event and the Person_Event table has all events which conserned the person personId then the table should contain the subset of Person_Vacation and one can eliminate it. Moreover all persons have sometime vocation so I would find more logical to include a dates in some tables.
Nevetheless how I understend your database design you can receive the results which you want with a query like following
SELECT p.name, e.title
FROM Person AS p
    INNER JOIN Person_Event AS pe ON p.personId = pe.personId
    INNER JOIN [Event] AS e ON pe.eventId = e.eventId
    LEFT OUTER JOIN Vacation AS v ON e.eventId = v.eventId
WHERE v.eventId IS NULL


text:
Q: How to extract .emz files from word in c# I have Ms-word file which is having embedded images in .emz format and want to extract those .emz images and want to store in particular folder.
I am trying this but did not get any useful solution
var package = Package.Open(this.FilePath);
// Get the embedded files names.
foreach (var packagePart in package.GetParts())
        {
          using (var packagePartStream = packagePart.GetStream())
                using (var packagePartMemoryStream = new sys.MemoryStream())
                {
                    packagePartStream.CopyTo(packagePartMemoryStream);
                    string fileName1 = packagePart.Uri.ToString().Remove(0, embeddingPartString.Length);
                    File.WriteAllBytes(fileName1,packagePartMemoryStream.ToArray());
             }
       }


text:
Q: Extracting filesnames in bash with regex Can please someone help me to set up a regular expression.
I have a large LaTeX3 TeXDoc file.  LaTeX3 TeXDoc defines the macro \TestFiles{}, which should be used, to list the names of files, which itself should be used as an unit tests.  You can name more than one file between the braces.  So \TestFiles{foo-bar} and \TestFiles{foo-bar, bar+baz,foo_bar_baz} are syntactical correct use cases for this macro.
I would like to write a bash script, to extract all the uni test files, named in the \TestFiles{} macros, to compile them with pdflatex and check, if pdflatex will be able to produce an output file successfully.
I have something like this in my script:
function get_filenames () {
  ## This regex works but is not sensible enough
  # regex='\\TestFiles{(.*)}'
  ## This works also, but is again not precise enough
  regex='\\TestFiles{([0-9a-zA-Z+-_, ]*)}'
  ## This should give more than one matching group
  ## (separated by ", " or ","), but this regex doesn't
  ## work.  I have no idea why or how to modify, to get
  ## it working

  while read -r line ; do
    if [[ $line =~ $regex ]] ; then
      i=1
        while [ $i -le 3 ]; do
          echo "Match $i: \"${BASH_REMATCH[$i]}\""
          i=$(( i + 1 ))
        done
      echo
    fi
  done < mystyle.dtx
}

Here is an excerpt of the DTX file
\TestFiles{foo-bar}

\TestFiles{foo-bar, bar+baz,foo_bar_baz}

(You can store this as mystyle.dtx, in order to reproduce the next example.)
Using the above noted examples, my script gives me the following results:
get_filenames
Match 1: "foo-bar"
Match 2: ""
Match 3: ""

Match 1: "foo-bar, bar+baz,foo_bar_baz"
Match 2: ""
Match 3: ""

I wasn't able, to modify my regex expression, to split the content of the last \TestFiles{foo-bar, bar+baz,foo_bar_baz} example into three matching results.
I tried a regular expression like this regex='\\TestFiles{([[:alnum:]+-_]*)[,]+[ ]*}'.  I thought the [:alnum:]+-_]* would match the filenames.  As far as I understand regular expressions, the (...) should form a group, that should be listed afterwards in the bash array BASH_REMATCH[$i].
The part [,]+ should reflect that every file name must be separated by at least one comma.  Between the filenames there might be some white space, so something like [[:space:]]* or at least [ ]* should represent this.  The quantifier * means any repetition, ranging from 0 to ..., while + should at least appear one or more times.
But that regular expression did not work at all, if had no matching results.
How must regex be defined, to store each filenames as a matching group?  I am searching for the correct regular expression, to get this result:
get_filenames
Match 1: "foo-bar"
Match 2: ""
Match 3: ""

Match 1: "foo-bar"
Match 2: "bar+baz"
Match 3: "foo_bar_baz"

EDIT: in my real world files, there may be (and are) more than tree test files.
Thanks in advance.

A: ## This should give more than one matching group
regex='\\TestFiles{([0-9a-zA-Z+-_, ]*)}'

The element of BASH_REMATCH with index n is the portion of the string matching the nth parenthesized subexpression.

Your regex only has 1 "parenthesized subexpression" - which is why everything ends up in BASH_REMATCH[1]
$ regex='\\TestFiles{([0-9a-zA-Z+-_, ]*)}'
$ [[ $line =~ $regex ]]
$ declare -p BASH_REMATCH
declare -a BASH_REMATCH=(
    [0]="\\TestFiles{foo-bar, bar+baz,foo_bar_baz}"
    [1]="foo-bar, bar+baz,foo_bar_baz"
)

As you're trying to match an unknown number of filenames you would have to "dynamically" create your regex so it contains the needed amount of groups.
$ regex='\\TestFiles{([^, }]+)([,}] ?)'
$ [[ $line =~ $regex ]]
$ declare -p BASH_REMATCH
declare -a BASH_REMATCH=(
    [0]="\\TestFiles{foo-bar, "
    [1]="foo-bar"
    [2]=", "
)

Add another group and see if it still matches:
$ regex+='([^, }]+)([,}] ?)'
$ [[ $line =~ $regex ]]
$ declare -p BASH_REMATCH
declare -a BASH_REMATCH=(
    [0]="\\TestFiles{foo-bar, bar+baz,"
    [1]="foo-bar"
    [2]=", "
    [3]="bar+baz"
    [4]=","
)

You could keep looping until the regex no longer matches - or perhaps a simpler approach would be to count the number of , characters on the line.
regex='\\TestFiles{([^, }]+)([,}] ?)'
line='\TestFiles{foo-bar, bar+baz,foo_bar_baz}'
commas=${line//[!,]}

for ((i=0; i<${#commas}; i++))
do
    regex+='([^, }]+)([,}] ?)'
done

[[ $line =~ $regex ]]

Which results in:
$ declare -p BASH_REMATCH
declare -a BASH_REMATCH=(
    [0]="\\TestFiles{foo-bar, bar+baz,foo_bar_baz}"
    [1]="foo-bar"
    [2]=", "
    [3]="bar+baz"
    [4]=","
    [5]="foo_bar_baz"
    [6]="}"
)

Alternative approach using IFS
You can set IFS=', ' and have bash do the splitting for you.
line='\TestFiles{foo-bar, bar+baz,foo_bar_baz}'

[[ $line = \\TestFiles{* ]] && {
    # Remove leading '\Testfiles{'
    # Remove trailing }
    line=${line#*{}
    line=${line%}}

    IFS=', ' read -a filenames <<< "$line"

    declare -p filenames
}

declare -a filenames=([0]="foo-bar" [1]="bar+baz" [2]="foo_bar_baz}}")

A: EDIT (without external programs, though it's rather impractical, and tied to exactly three matches)
function get_filenames () {
    p='([^, }]*) *,? *'
    regex="\\TestFiles\{$p$p$p"

    while read -r line ; do
        if [[ $line =~ $regex ]] ; then
            i=1
            while [ $i -le 3 ]; do
                echo "Match $i: \"${BASH_REMATCH[$i]}\""
                i=$(( i + 1 ))
            done
            echo
        fi
    done < mystyle.dtx
}

If you really need to output exactly three file names (even empty) for each '\TestFiles' row then here's the code.
function get_filenames () {
    MAX_FILES_CNT=3
    IFS=$'\n'
    for line in $(grep -oP '\\TestFiles\{\K[^}]*' < mystyle.dtx); do
        filenames=()
        for filename in $(grep -m $MAX_FILES_CNT -oP "[^, ]+" <<< "$line"); do
            filenames+=("$filename")
        done
        i=0
        while [ $i -lt $MAX_FILES_CNT ]; do
            echo "Match $(($i+1)): \"${filenames[i]}\""
            i=$(( i + 1 ))
        done
        echo ""
    done
    unset IFS
}

Match 1: "foo-bar"
Match 2: ""
Match 3: ""
Match 1: "foo-bar"
Match 2: "bar+baz"
Match 3: "foo_bar_baz"

By the way, BASH_REMATCH is no good for this task, cause it captures only last rematch. Look
[[ "asdf" =~ (.)* ]]
echo "${BASH_REMATCH[@]}"

asdf f

Also I would recommend to read this question https://unix.stackexchange.com/questions/169716/why-is-using-a-shell-loop-to-process-text-considered-bad-practice

A: Use set with IFS to split each line into new positional parameters. Assign $@ to an array so that elements can be accessed by index. Trying this with $@ directly results in a bad substitution error.
get-filenames.sh
#!/usr/bin/env bash

get_filenames() {
    local IFS=' {},'
    declare -a names

    while read -r line; do
        set -- $line
        names=($@)
        test "${names[0]}" == '\TestFiles' && {
            for i in {1..3}; do
                printf "Match %i: \"%s\"\n" $i ${names[$i]}
            done
        }
        echo
    done < 'mystyle.dtx'
}

get_filenames

mystyle.dtx

\TestFiles{foo-bar}
\TestFiles{foo-bar, bar+baz,foo_bar_baz}

output

Match 1: "foo-bar"
Match 2: ""
Match 3: ""

Match 1: "foo-bar"
Match 2: "bar+baz"
Match 3: "foo_bar_baz"

A: Suggesting an awk script that would do the trick on one or more files.
get_filenames.awk
/\\TestFiles{[^}]*}/ { # handle only lines matching regex filter
  filesCount = split($0, fileNamesArr, "\\\\TestFiles{[ ]*|[ ]*,[ ]*|[ ]*}"); # parse line to array fileNamesArr
  for (i = 2; i < filesCount; i++) { # read elements 2 --> filesCount - 1
    printf("Match %d in %s: \"%s\"\n", i - 1, FILENAME, fileNamesArr[i]); # format print fileNames
  }
  print"";
}

test file: input.1.txt
some text line 1
\TestFiles{foo-bar0}
some text \TestFiles{foo-bar1, bar+baz1, foo_bar_baz1}
some text \TestFiles{foo-bar2 ,bar+baz2 ,foo_bar_baz2 }
some text \TestFiles{ foo-bar3 , bar+baz3 , foo_bar_baz3 } some text
line 4

test file: input.2.txt
    \TestFiles{file10, file11}
text
text \TestFiles{  file20 } some text
text\TestFiles{file30,file31,file32   }text
text

testingget_filenames.awk
awk -f get_filenames.awk input.1.txt input.2.txt

Match 1 in input.1.txt: "foo-bar0"

Match 1 in input.1.txt: "foo-bar1"
Match 2 in input.1.txt: "bar+baz1"
Match 3 in input.1.txt: "foo_bar_baz1"

Match 1 in input.1.txt: "foo-bar2"
Match 2 in input.1.txt: "bar+baz2"
Match 3 in input.1.txt: "foo_bar_baz2"

Match 1 in input.1.txt: "foo-bar3"
Match 2 in input.1.txt: "bar+baz3"
Match 3 in input.1.txt: "foo_bar_baz3"

Match 1 in input.2.txt: "file10"
Match 2 in input.2.txt: "file11"

Match 1 in input.2.txt: "file20"

Match 1 in input.2.txt: "file30"
Match 2 in input.2.txt: "file31"
Match 3 in input.2.txt: "file32"

A: I believe this is the regular expression you're looking for:
(?<=\\TestFiles{.*)([\w\d\-\+_]+)[, }]+

You can see it working, modify it and have an explanation on what it does in the following link: https://regex101.com/r/0W8PBi/1


text:
Q: Download file using url doestwork JavaScript I need to start a download by pressing a button, I tried use the follow code, but it DOESN'T start the download, just open a new tab in browser and show the content. I am doing wrong?
The dataurl is exactly something like : http://localhost:8000/storage/shipment/b61ffc10-6798-4b94-ba91-daec6efbbdfdShipment2020-10-05.txt
  download: function(name, dataurl) {
      const link = document.createElement("a");
      link.setAttribute("download", name+'.txt');
      link.setAttribute("target", "_blank")
      link.href = dataurl;
      document.body.appendChild(link);
      link.click();
    }

I also tried convert the url to Blob
      const url = window.URL.createObjectURL(new Blob([data]));
      const link = document.createElement("a");
      link.href = url;
      link.setAttribute("download", filename);
      document.body.appendChild(link);
      link.click();
    },

That way, it trigged the download, but the content was the url, not the file itself.
Any idea? Thanks!

A: if you want to download a content from your server try this one , its so simle...
<a href="http://localhost:8000/storage/shipment/b61ffc10-6798-4b94-ba91-daec6efbbdfdShipment2020-10-05.txt" download="filename-here"> Click here to Download </a>

Added Download Atribute in <a> tag , when clicking on this link, the file will download as filename-here.txt


text:
Q: Postman test for empty dictionary value of json name How can I write a test for an empty value of a specific JSON name pair. For example I have this JSON:
{
    "data": {
        "sectionGroupName": "PPConfig:APIMethod",
        "sections": {}
    },
    "success": true,
    "errorMessage": ""
}

I want to check if sections is empty, like it is in this case. I have other successful tests written like this:
tests["Status code is 200"] = responseCode.code === 200;
var body = JSON.parse(responseBody);
tests["Success Response"] = body.success === true;
tests["No Error message"] = body.errorMessage === "";
tests.Data = body.data.sectionGroupName === "PPConfig:APIMethod";

But I haven't been able to find successful test code for checking if the value of a specific name is an empty dictionary. Can someone help me with this as an example please?

A: You can get the list of properties of sections and test its length.
let sectionKeys = Object.keys(body.data.sectionGroupName)
if(sectionKeys.length){
  //Proceed with section
} else {
  //Proceed when it's empty
}

See Object.keys()

A: from this link
to check if it's a dictionary (use your 'sections' as v)
function isDict(v) {
    return !!v && typeof v==='object' && v!==null && !(v instanceof Array) && !(v instanceof Date) && isJsonable(v);
}

Then check that it is empty (from this other link) use:
function isEmpty(obj) {
   for (var x in obj) { return false; }
   return true;
}

That should work


text:
Q: Photo Upload On Facebook I want to Upload Photo to Facebook Page using HttpWebRequest
and I don't want to use Facebook Graph API ..
via live http header i get the url and data which is need to be posted
user=XXXXXXXXXXXXX&_a=1&_dyn=XXXXXXXXXXXX&_req=s&fb_dtsg=AQAszPoc&ttstamp=26581651151228011199&__rev=1141676">https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished?target_id=XXXXXXXXXXXXXX1&_user=XXXXXXXXXXXXX&_a=1&_dyn=XXXXXXXXXXXX&_req=s&fb_dtsg=AQAszPoc&ttstamp=26581651151228011199&__rev=1141676
DATA which will be used for sending with url
  -----------------------------3300296215819
Content-Disposition: form-data; name="fb_dtsg"

AQAszPoc
-----------------------------3300296215819
Content-Disposition: form-data; name="source"

8
-----------------------------3300296215819
Content-Disposition: form-data; name="profile_id"

xxxxxxxxxxx
-----------------------------3300296215819
Content-Disposition: form-data; name="grid_id"

u_6_0
-----------------------------3300296215819
Content-Disposition: form-data; name="qn"

a9f0f5a0f2104b0ef0656f692cda9893
-----------------------------3300296215819
Content-Disposition: form-data; name="0"; filename="1794679_698919370150942_1311355907_n.jpg"
Content-Type: image/jpeg

YOUR DATA OR IMAGE

-----------------------------85332783618735
Content-Disposition: form-data; name="upload_id"

1025
-----------------------------85332783618735--

I m not sure how to get this value
Content-Disposition: form-data; name="qn"
a9f0f5a0f2104b0ef0656f692cda9893

can someone helpe me out
everytime when i tried to upload i got error
for (;;);{"__ar":1,"error":1357032,"errorSummary":"Sorry, we got confused","errorDescription":"Please try refreshing the page or closing and re-opening your browser window.","payload":null,"bootloadable":{},"ixData":[]}

reason why i don't want to use FaceBook Graph API is that whenever we post/upload it display message " 33 minutes ago via Graph API Explore"
please help me out
Thanks


text:
Q: React Trouble updating state with useReducer Utilizing React useReducer and attempting to do state update and have react re-render as I make changes.
JSX calling the reducer:
<button onClick={() => dispatch({ type: "DECREMENT", item })} >+</button>

and the useReducer:
const reducer = (state, action) => {
  const { item, type } = action;
  switch (type) {
    case "INCREMENT": {
      const newCart = state;
      const u = { ...item, quantity: item.quantity + 1 };
      const index = newCart.findIndex(eachitem => item.id === eachitem.id);
      newCart.splice(index, 1, u);
      console.log("INCREMENT", newCart);
      return newCart;
    }
    case "DECREMENT": {
      const newCart = state;
      const u = { ...item, quantity: item.quantity - 1 };
      const index = newCart.findIndex(eachitem => item.id === eachitem.id);
      newCart.splice(index, 1, u);
      console.log("DECREMENT", newCart);
      return newCart;
    }
    case "REMOVE": {
      return state.filter(eachitem => item.id !== eachitem.id);
    }
    default: {
      return state;
    }
  }
};

Full code can be found below.

A: Your reducer can't detect the state change since you return the same object. The change is detected by comparing prev state value and new one, by === comparison or Object.is() comparison which is basically the same thing (not sure which one, can try to find in React docs).
So instead of:
const newCart = state;

You need to do:
// shallowly copy the state so now Object.is(newState, prevState) returns false
const newCart = [...state];
...
return newCart

A: You are setting the newCart as the state, which point to the same thing.
Either you clone the state, or return a new object instance.
switch (type) {
    case "INCREMENT": {
      const newCart = state;
      const u = { ...item, quantity: item.quantity + 1 };
      const index = newCart.findIndex(eachitem => item.id === eachitem.id);
      newCart.splice(index, 1, u);
      console.log("INCREMENT", newCart);

      return [...newCart];
    }
    case "DECREMENT": {
      const newCart = state;
      const u = { ...item, quantity: item.quantity - 1 };
      const index = newCart.findIndex(eachitem => item.id === eachitem.id);
      newCart.splice(index, 1, u);
      console.log("DECREMENT", newCart);
      return [...newCart];
    }
    case "REMOVE": {
      return state.filter(eachitem => item.id !== eachitem.id);
    }
    default: {
      return state;
    }
  }
};

Updated SandBox


text:
Q: PHP error messages triggered including wordpress php file I would like to run a php script with an ajax request. I got it all working except for warning messages that appear upon triggering the ajax request. The functionality of the script works fine, however, I would like to solve the warning messages or suppress them if they aren't important.
Here is the script file.
<?php
//If the warnings aren't important, uncomment
//error_reporting(0);
//Required include for the wp_mail() function
include '../../../wp-load.php';

$to = 'emailhere@gmail.com';
$subject = 'Donation to cbc at' . ' ' . time();
$body = 'The email body content';
$headers = array('Content-Type: text/html; charset=UTF-8');

wp_mail( $to, $subject, $body, $headers );
?>

Here are the warnings produced
Warning: include(../../../wp-load.php): failed to open stream: No such file or directory in /home2/cbc/public_html/wp-content/themes/bento/page-example.php on line 5

Warning: include(../../../wp-load.php): failed to open stream: No such file or directory in /home2/cbc/public_html/wp-content/themes/bento/page-example.php on line 5

Warning: include(): Failed opening '../../../wp-load.php' for inclusion (include_path='.:/opt/php56/lib/php') in /home2/cbc/public_html/wp-content/themes/bento/page-example.php on line 5

I have tried multiple different types of includes and requires for the wp-load.php that I have found on stackoverflow. All of them that I've tried so far have produced warnings, although some produce different warnings. Again, the functionality works, but these errors are concerning.

A: Try:
$my_url= explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );
require_once( $my_url[0] . 'wp-load.php' );

Instead of
include '../../../wp-load.php';


text:
Q: In 14.04, how do I persist a view in Nautilus-Gnome? I just upgraded from 12.04 to 14.04 and I use the Gnome (MetaCity) UI. I set up a view in Nautilus like this, including the side bar and location entry box.

I want to persist this view so that whenever I open Nautilus it will look like this. But each time I close and re-open Nautilus it reverts to my default view:

The settings that are available in Location Options-> Preferences persist but those set in other menus, such as View Options->Show Sidebar do not.
How can I set things up so that Nautilus always opens with my preferred view (first screen shot). I think this worked in 12.04, but perhaps not?


text:
Q: boost ptime to unix timestamp conversion error I'am using boost date time to calculate the unix time for a particular date.
In most cases the returned value is correct but sometimes the calculated number of
second is not correct.
This is an example :
boost::posix_time::ptime t(boost::gregorian::date(1900, 1, 1));

boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
boost::posix_time::time_duration dur;

dur = t - epoch;

int tstamp = dur.total_seconds();

if (t < epoch) tstamp = -tstamp ;

The expected value is -2208902400 but I get -2085978496.
Do you have a workaround for this issue ?

A: For some reason boost has the year 2038 bug.
The work around is to avoid dates from before your grandparents were born :)
update: the boost bug tracker has a bug for this.  It's 3 years old.

A: If your system has time_t defined to int and 32-bit int, than earliest date representable in it is 1901-12-13T20:45:52. As Michael Slade said in the other answer, apparently boost uses 32 bits internally somewhere even if time_t is larger, so date 1900-01-01 does not work with boost::posix_time::ptime.


text:
Q: Passing values to mysql query to check a condition I have a Mysql QUERY
'SELECT *
FROM city
WHERE name = ?
ORDER BY STREETNO' [Keyname]

SCENARIO:: IF i pass a name say sam as Keyname to this query the query is functional when where clause & orderby both functional.
[NOTE]::Passing the value is dynamic by client

*

*But when i(Client) dont pass anything as Keyname to this query.... Can i still
make sure order by is functional

*Is there any condition to make this happen

Or is it not possible in Database part and must be taken care in client itself ?
Hope i am clear


text:
Q: If you specify a data method the second argument in D3.js, existing elements are undefined If you specify a data method the second argument in D3.js, existing elements are undefined

C

A

Z

X

In phase1, d is the bound data, which is undefined, so the key function returns the text of the nodes.  In phase2, d is the data values so they are returned.  Because none of the keys in phase2 match the ones in phase1, there is no update group.
Just to be perverse, you can also confuse it with this...
        d = d || dataset[i];

Because the key function returns the same values for i = 0 and 1 in both phases, the first 2 nodes are considered update nodes and because all of the data is bound according to the key function, the enter group is empty.
But the most useful case is if you have data like this...
dataset = [4, 9, 'X', 'C'];
d3.select("#hoge").selectAll("p").data(dataset, function (d, i) {
    d = d || this.textContent;
    console.log(d);
    return d;
}).attr('class', 'update')
  .enter()
  .append("p").attr('class', 'enter')
  .text(function (d) {
      return d;
  })

this is the result...

C

A

Z

X

4

9

In phase1, all of the nodes are included in the collection with their text content as key.  In phase2, the data values are used to look up the collection and there is a match on C and X, so they are in the update collection and the numbers, which have no match, are in the enter selection.

A: You should probably just use .data(dataset) and then this would bound data to the first two paragraphs. Remaining two elements should be available in .exit(), so you can .remove() them or something else (maybe add some other data to them, like default data).


text:
Q: Sql Server 2008 R2 - SSMA converted extended procedure calls(IMPL procedures) impacting performance We are working on a Oracle to SQL Server 2008 migration project. So we have lot of oracle package functions which used to call other Stored procedures. These functions have been converted by SSMA to IMPL procedures which are executed via extended procedures from the functions. We had converted most of such functions to simple UDF where ever possible. Now we are facing a peculiar performance problem. The queries invoking such functions with IMPL procedure calls are taking a longer time to run. Whats interesting is that the same queries used to run on old server with Sql Server 2008 in 2 mins. Now in the new server with SQL Server 2008 R2, its taking very long time (around 25-30 mins).
We have verified that the indexes and statistics are also up to date. We also noticed that IMPL calls go though master and sysdb databases and uses internal tables to store and pass the result back from the IMPL procedure call to the function. Their space allocation is different from old server. But they are not running out of space. Can they be causing the problem? Is there any guidelines available for the space allocation of master/sysdb databases?
The databases are of around 300GB and tempdb is around 50GB.
Old Server

*

*SQL Server 2008 / Windows

*Xenon Quad Core x4 - 3GHz, 64GB RAM

New Server

*

*SQL Server 2008 R2 RTM

*Opteron 6 core x6 - 2.2GHz, 64GB RAM

Please let me know if any more details are needed.
Thanks

A: User-defined functions in SQL Server are not just SPs that can return value (they cannot modify database tables, for example). Oracle functions can do basically the same what procedures can. Therefore a lot of Oracle functions are converted to a func_name$IMPL stored procedure + some wrapper function (that calls corresponding $IMPL procedure through SSMA-specific extended SP as far as I can remember). In cases where possible, SSMA will try to avoid calling functions directly (generating call to appropriate ...$IMPL SP instead), but some cases are not covered. Those harder cases will result in direct call to generated wrapper function. I believe they tend to be quite slow indeed :( Just no better automatic conversion was found in your case by SSMA... Therefore you should try to change your generated SQL Server code to use func_name$IMPL stored procedures directly (just using normal EXECs, and not calling wrapper functions as much as you can till performance is fine for you).


text:
Q: Как мне на C# для консоли написать штучки? Я не имею понятия как такие штучки написать на C#. Что я хочу сделать:

*

*Мигающий текст ну для типа ошибка

*Нарисовать ветки как в git, и в эти кружочки должна быть анимация и статус и надпись. build/err active/empty. И вокруг кружочками идёт линия как загрузка. И, внутри кружочка будет галочка/крестик или пустое место.

*Перед прелоадера поставить время выполнения скрипта.

*Меню

*Как спарсить строку, мой синтаксис написания команд должен быть таков:

[ get | set | container |... ] [ property | name | check | <command>] {flags}

*Подсветка текста, если команда то она должна быть какого-то определенного цвета. Ну это как код типа того.
7.как лучше реализовать (6 пункт)

Вот что я хочу сделать на C#.


text:
Q: Show that the depth of a BFS tree can't be larger than the depth of a DFS tree while they're operate on the same vertex Given a connected and undirected graph $G=(V,E)$ and given $T_{BFS}$ the BFS tree that was called on $s\in V$ , also given $T_{DFS}$ that was called on the same vertex $s$. Show that $depth(T_{BFS})\leq depth(T_{DFS}$)
I will be happy to see some opinions on my solution.It will help me a lot.
My  solution:
If $G$ is a tree then since $T_{BFS}$ has $|V|-1$ edges of $E$,
and $G$ has the same $|V|-1$ edges of $E$ we can conclude that $T_{BFS}=G$.
We can argue the same for $T_{DFS}$ and therefore $T_{BFS}=T_{DFS}$, and the cliam holds.
Second case - Proof (by contradiction):
If $G$ is connected and also $G$ is not a tree then it must contain a cycle on a path rooted at $s$.
Let $\{y,x\}$ be the $back\; edge$ on the cycle. let $z\in V$ be a third vertex on the cycle.The cycle is: $s\rightsquigarrow x\rightsquigarrow z\rightsquigarrow y\rightarrow x$ Now:
At $T_{DFS}$ we get : $d(s,y)\ge d(s,x)+2\;\;\;$   //at least 1 for $x\rightsquigarrow z $ and at least 1 for $z\rightsquigarrow y$
At $T_{BFS}$ we get: $d(s,y)=\delta(s,y)\leq \delta(s,x)+1 $  //triangle inequality for shortest path on an undirected and unweighted graph
To conclude , we have : $d(s,y)=\delta(s,y)\leq \delta(s,x)+1 < d(s,x)+2 \leq d(s,y)$ and we got a contradiction, since if the longest Path from $s$ to some $u$ do not contains a cycle than it contains in a tree (and we delt with it in case 1), otherwise the longest path contains a cycle, and in $T_{BFS}$ the path to the deepest edge in the cycle is shorter than the path to the deepest edge in the cycle if reached via $T_{DFS}$

A: Your proof seems to be getting at the right idea, but there are a few details missing that are important for a clear writeup. In order from most to least important:

*

*You say that your second case is a proof by contradiction, but you never say what assumption you are making that leads to a contradiction.

*The definition of the cycle and the "back edge" on it is under-specified. I assume from context that you're saying that there's specifically an edge $yx$ that's not part of $T_{DFS}$, from which we may conclude that $x$ lies somewhere on the path from $s$ to $y$ in $T_{DFS}$.

*The notations $d(x,y)$ and $\delta(x,y)$ seem ambiguous given that there are three, not two, different distances between vertices to keep track of: the distance in $G$, the distance in $T_{DFS}$, and the distance in $T_{BFS}$. (You also have not said which of these are $d$ and which are $\delta$, but perhaps this has been decided for you if you're doing homework for a specific class.) As a result, your concluding inequality makes no sense.
Also, there is a much simpler argument: if $T_{BFS}$ has depth $d$, it is because there is a vertex $t$ at distance $d$ from $s$ (in $G$). This vertex cannot be at a depth smaller than $d$ in any other tree (any other spanning tree of $G$ rooted at $s$), because there is no path from $s$ to $t$ of length $d-1$. So all other spanning trees of $G$ rooted at $s$, including $T_{DFS}$, must have depth at least $d$.


text:
Q: How to bulk insert and validate data against existing database data Here is my situation, my client wants to bulk insert 100,000+ rows into the database from a csv file which is simple enough but the values need to be checked against data that is already in the database (does this product type exist? is this product still sold? etc.). To make things worse these files will also be uploaded into the live system during the day so I need to make sure I'm not locking any tables for long. The data that is inserted will also be spread across multiple tables.
I've been adding the date into a staging table which takes seconds, I then tried creating a WebService to start processing the table using Linq and marking any erroneous rows with an invalid flag (this can take some time). Once the validation is done I need take the valid rows and update/add the rows to the appropriate tables.
Is there a process for this that I am unfamiliar with?

A: For a smaller dataset I would suggest
IF EXISTS (SELECT blah FROM blah WHERE....)
UPDATE (blah)
ELSE
INSERT (blah)

You could do this in chunks to avoid server load, but this is by no means a quick solution, so SSIS would be preferable


text:
Q: blocked [] from asking for credentials because it is a cross-origin request we have developed an ui5 - Webapplication. For this application we implemented a sso scenario with saml over an ADFS.
If the side is loaded, the first oData (webservice) request is send with Authorization Basic... our backend determine, that no login is available and ridirect the request to the saml endpoint on adfs. This response is send back to the client to display an "popup" if the user is not logged-in in the sso domain, to put in the domain credentials. After send this credentials back, the original request is send again with an JWT instead of basic, that indicates a valid login.
Everxthing worksfine. Chrome, Chromium, Firefox, InternetExplorer, Android, Edge ... BUT the same Website in iPhone or iPad doens't show the "browser popup" to put in the domain credentials.
i get this error: blocked from asking for credentials because it is a cross-origin request.
The Headers seems to be correct. Origin is set to fqdn of the website host. the $.ajax request is send with parameter crossDomain: true, xhrFields: {withCredentials: true}
What is the difference in iOS regarding all other browsers?
regards Micha


text:
Q: What is the advantage of having instructions in a uniform format? Many processors have instructions which are of uniform format and width such as the ARM where all instructions are 32-bit long. other processors have instructions in multiple widths of say 2, 3, or 4 bytes long, such as 8086.

*

*What is the advantage of having all instructions the same width and in a uniform format?

*What is the advantage of having instructions in multiple widths?

A: Fixed Length Instruction Trade-offs
The advantages of fixed length instructions with a relatively uniform formatting is that fetching and parsing the instructions is substantially simpler.
For an implementation that fetches a single instruction per cycle, a single aligned memory (cache) access of the fixed size is guaranteed to provide one (and only one) instruction, so no buffering or shifting is required. There is also no concern about crossing a cache line or page boundary within a single instruction.
The instruction pointer is incremented by a fixed amount (except when executing control flow instructions--jumps and branches) independent of the instruction type, so the location of the next sequential instruction can be available early with minimal extra work (compared to having to at least partially decode the instruction). This also makes fetching and parsing more than one instruction per cycle relatively simple.
Having a uniform format for each instruction allows trivial parsing of the instruction into its components (immediate value, opcode, source register names, destination register name). Parsing out the source register names is the most timing critical; with these in fixed positions it is possible to begin reading the register values before the type of instruction has been determined. (This register reading is speculative since the operation might not actually use the values, but this speculation does not require any special recovery in the case of mistaken speculation but does take extra energy.) In the MIPS R2000's classic 5-stage pipeline, this allowed reading of the register values to be started immediately after instruction fetch providing half of a cycle to compare register values and resolve a branch's direction; with a (filled) branch delay slot this avoided stalls without branch prediction.
(Parsing out the opcode is generally a little less timing critical than source register names, but the sooner the opcode is extracted the sooner execution can begin. Simple parsing out of the destination register name makes detecting dependencies across instructions simpler; this is perhaps mainly helpful when attempting to execute more than one instruction per cycle.)
In addition to providing the parsing sooner, simpler encoding makes parsing less work (energy use and transistor logic).
A minor advantage of fixed length instructions compared to typical variable length encodings is that instruction addresses (and branch offsets) use fewer bits. This has been exploited in some ISAs to provide a small amount of extra storage for mode information. (Ironically, in cases like MIPS/MIPS16, to indicate a mode with smaller or variable length instructions.)
Fixed length instruction encoding and uniform formatting do have disadvantages. The most obvious disadvantage is relatively low code density. Instruction length cannot be set according to frequency of use or how much distinct information is required. Strict uniform formatting would also tend to exclude implicit operands (though even MIPS uses an implicit destination register name for the link register) and variable-sized operands (most RISC variable length encodings have short instructions that can only access a subset of the total number of registers).
(In a RISC-oriented ISA, this has the additional minor issue of not allowing more work to be bundled into an instruction to equalize the amount of information required by the instruction.)
Fixed length instructions also make using large immediates (constant operands included in the instruction) more difficult. Classic RISCs limited immediate lengths to 16-bits. If the constant is larger, it must either be loaded as data (which means an extra load instruction with its overhead of address calculation, register use, address translation, tag check, etc.) or a second instruction must provide the rest of the constant. (MIPS provides a load high immediate instruction, partially under the assumption that large constants are mainly used to load addresses which will later be used for accessing data in memory. PowerPC provides several operations using high immediates, allowing, e.g., the addition of a 32-bit immediate in two instructions.) Using two instructions is obviously more overhead than using a single instruction (though a clever implementation could fuse the two instructions in the front-end [What Intel calls macro-op fusion]).
Fixed length instructions also makes it more difficult to extend an instruction set while retaining binary compatibility (and not requiring addition modes of operation). Even strictly uniform formatting can hinder extension of an instruction set, particularly for increasing the number of registers available.
Fujitsu's SPARC64 VIIIfx is an interesting example. It uses a two-bit opcode (in its 32-bit instructions) to indicate a loading of a special register with two 15-bit instruction extensions for the next two instructions. These extensions provide extra register bits and indication of SIMD operation (i.e., extending the opcode space of the instruction to which the extension is applied). This means that the full register name of an instruction not only is not entirely in a fixed position, but not even in the same "instruction". (Similarities to x86's REX prefix--which provides bits to extend register names encoded in the main part of the instruction--might be noted.)
(One aspect of fixed length encodings is the tyranny of powers of two. Although it is possible to used non-power-of-two instruction lengths [Tensilica's XTensa now has fixed 24-bit instructions as its base ISA--with 16-bit short instruction support being an extension, previously they were part of the base ISA; IBM had an experimental ISA with 40-bit instructions.], such adds a little complexity. If one size, e.g., 32bits, is a little too short, the next available size, e.g., 64 bits, is likely to be too long, sacrificing too much code density.)
For implementations with deep pipelines the extra time required for parsing instructions is less significant. The extra dynamic work done by hardware and the extra design complexity are reduced in significance for high performance implementations which add sophisticated branch prediction, out-of-order execution, and other features.
Variable Length Instruction Trade-offs
For variable length instructions, the trade-offs are essentially reversed.
Greater code density is the most obvious advantage. Greater code density can improve static code size (the amount of storage needed for a given program). This is particularly important for some embedded systems, especially microcontrollers, since it can be a large fraction of the system cost and influence the system's physical size (which has impact on fitness for purpose and manufacturing cost).
Improving dynamic code size reduces the amount of bandwidth used to fetch instructions (both from memory and from cache). This can reduce cost and energy use and can improve performance. Smaller dynamic code size also reduces the size of caches needed for a given hit rate; smaller caches can use less energy and less chip area and can have lower access latency.
(In a non- or minimally pipelined implementation with a narrow memory interface, fetching only a portion of an instruction in a cycle in some cases does not hurt performance as much as it would in a more pipelined design less limited by fetch bandwidth.)
With variable length instructions, large constants can be used in instructions without requiring all instructions to be large. Using an immediate rather than loading a constant from data memory exploits spatial locality, provides the value earlier in the pipeline, avoids an extra instruction, and removed a data cache access. (A wider access is simpler than multiple accesses of the same total size.)
Extending the instruction set is also generally easier given support for variable length instructions. Addition information can be included by using extra long instructions. (In the case of some encoding techniques--particularly using prefixes--, it is also possible to add hint information to existing instructions allowing backward compatibility with additional new information. x86 has exploited this not only to provide branch hints [which are mostly unused] but also the Hardware Lock Elision extension. For a fixed length encoding, it would be difficult to choose in advance which operations should have additional opcodes reserved for possible future addition of hint information.)
Variable length encoding clearly makes finding the start of the next sequential instruction more difficult. This is somewhat less of a problem for implementations
that only decode one instruction per cycle, but even in that case it adds extra
work for the hardware (which can increase cycle time or pipeline length as well as use more energy). For wider decode several tricks are available to reduce the cost of parsing out individual instructions from a block of instruction memory.
One technique that has mainly been used microarchitecturally (i.e., not included in the interface exposed to software but only an implementation technique) is to use marker bits to indicate the start or end of an instruction. Such marker bits would be set for each parcel of instruction encoding and stored in the instruction cache. Such delays the availability of such information on a instruction cache miss, but this delay is typically small compared to the ordinary delay in filling a cache miss. The extra (pre)decoding work is only needed on a cache miss, so time and energy is saved in the common case of a cache hit (at the cost of some extra storage and bandwidth which has some energy cost).
(Several AMD x86 implementations have used marker bit techniques.)
Alternatively, marker bits could be included in the instruction encoding. This places some constrains on opcode assignment and placement since the marker bits effectively become part of the opcode.
Another technique, used by the IBM zSeries (S/360 and descendants), is to encode the instruction length in a simple way in the opcode in the first parcel. The zSeries uses two bits to encode three different instruction lengths (16, 32, and 48 bits) with two encodings used for 16 bit length. By placing this in a fixed position, it is relatively easy to quickly determine where the next sequential instruction begins.
(More aggressive predecoding is also possible. The Pentium 4 used a trace cache containing fixed-length micro-ops and recent Intel processors use a micro-op cache with [presumably] fixed-length micro-ops.)
Obviously, variable length encodings require addressing at the granularity of a parcel which is typically smaller than an instruction for a fixed-length ISA. This means that branch offsets either lose some range or must use more bits. This can be compensated by support for more different immediate sizes.
Likewise, fetching a single instruction can be more complex since the start of the instruction is likely to not be aligned to a larger power of two. Buffering instruction fetch reduces the impact of this, but adds (trivial) delay and complexity.
With variable length instructions it is also more difficult to have uniform encoding. This means that part of the opcode must often be decoded before the basic parsing of the instruction can be started. This tends to delay the availability of register names and other, less critical information. Significant uniformity can still be obtained, but it requires more careful design and weighing of trade-offs (which are likely to change over the lifetime of the ISA).
As noted earlier, with more complex implementations (deeper pipelines, out-of-order execution, etc.), the extra relative complexity of handling variable length instructions is reduced. After instruction decode, a sophisticated implementation of an ISA with variable length instructions tends to look very similar to one of an ISA with fixed length instructions.
It might also be noted that much of the design complexity for variable length instructions is a one-time cost; once an organization has learned techniques (including the development of validation software) to handle the quirks, the cost of this complexity is lower for later implementations.
Because of the code density concerns for many embedded systems, several RISC ISAs provide variable length encodings (e.g., microMIPS, Thumb2). These generally only have two instruction lengths, so the additional complexity is constrained.
Bundling as a Compromise Design
One (sort of intermediate) alternative chosen for some ISAs is to use a fixed length bundle of instructions with different length instructions. By containing instructions in a bundle, each bundle has the advantages of a fixed length instruction and the first instruction in each bundle has a fixed, aligned starting position. The CDC 6600 used 60-bit bundles with 15-bit and 30-bit operations. The M32R uses 32-bit bundles with 16-bit and 32-bit instructions.
(Itanium uses fixed length power-of-two bundles to support non-power of two [41-bit] instructions and has a few cases where two "instructions" are joined to allow 64-bit immediates. Heidi Pan's [academic] Heads and Tails encoding used fixed length bundles to encode fixed length base instruction parts from left to right and variable length chunks from right to left.)
Some VLIW instruction sets use a fixed size instruction word but individual operation slots within the word can be a different (but fixed for the particular slot) length. Because different operation types (corresponding to slots) have different information requirements, using different sizes for different slots is sensible. This provides the advantages of fixed size instructions with some code density benefit. (In addition, a slot might be allocated to optionally provide an immediate to one of the operations in the instruction word.)


text:
Q: Redefining multicolumn environment I am using multicolum under tabularx a lot. Instead of removing spaces
\multicolumn{2}{@{}l}{...}

I want to create a new environment which removes trailing spaces from both front and end. Any suggestions on doing the same? Thanks.
Regards,
Edit :
When I use the following piece of code,
\begin{tabularx}{\textwidth}{@{}Xc@{}}
\toprule\toprule
Some random text & 1,75,650\\\midrule
\multicolumn{2}{@{}l}{\textbf{Panel A1: AAA}} \\\midrule
Number of observations ... & 1,75,650\\

I get
But if I use (@{} removed from multicloumn)
\begin{tabularx}{\textwidth}{@{}Xc@{}}
\toprule\toprule
Some random text & 1,75,650\\\midrule
\multicolumn{2}{l}{\textbf{Panel A1: AAA}} \\\midrule
Number of observations ... & 1,75,650\\

I get
As I would have to use \multicolumn{2}{@{}l} multiple times, hence I was looking to create a new env. which takes care of @{}.
In case someone is looking for MWE:
\documentclass{article}
\usepackage{ltablex}
\usepackage{threeparttable}
\usepackage{booktabs}

\title{Document}
\begin{document}
\maketitle

\begin{tabularx}{\textwidth}{Xc}
\toprule\toprule
Some random text & 1,75,650\\\midrule
\multicolumn{2}{l}{\textbf{Panel A1: AAA}} \\\midrule
Number of observations ... & 1,75,650\\
Delete: ... & (78,420)\\
Delete: ... & (7,104)\\
Final sample & 90,126\\
Delete: & (2,143)\\
Delete: & (8,345)\\
Final sample & 79,638\\\midrule
\multicolumn{2}{l}{\textbf{Panel A2: AAA}} \\\midrule
Number of observations & 79,638\\
Delete: & (39,540)\\
Delete: & (7,979) \\
Final sample & 32,119 \\\midrule
\multicolumn{2}{l}{\textbf{Panel B1: BBB }} \\\midrule
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule
\multicolumn{2}{l}{\textbf{Panel B2: BBB}} \\\midrule
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Number of observations  & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule\bottomrule
\end{tabularx}

\end{document}

Edit:
In case, someone might be interested, this is how I defined:
\newcommand{\gmc}[2]{\multicolumn{#1}{@{}#2@{}}}


text:
Q: Writing spark DataFrame In Apache Hudi Table I am new to apace hudi and  trying to write my dataframe in my Hudi table using spark shell.
For type first time i am not creating any table and writing in overwrite mode so I am expecting it will create hudi
table.I am Writing below code.
    spark-shell \
    --packages org.apache.hudi:hudi-spark-bundle_2.12:0.7.0,org.apache.spark:spark-avro_2.12:3.0.1 \
    --conf 'spark.serializer=org.apache.spark.serializer.KryoSerializer'

    //Initialize a Spark Session for Hudi

    import org.apache.spark.sql.SaveMode
    import org.apache.spark.sql.SaveMode
    import org.apache.spark.sql.functions._
    import org.apache.hudi.DataSourceWriteOptions
    import org.apache.hudi.config.HoodieWriteConfig
    import org.apache.hudi.hive.MultiPartKeysValueExtractor
    import org.apache.spark.sql.SparkSession

    val spark1 = SparkSession.builder().appName("hudi-datalake").master("local[*]").config("spark.serializer", "org.apache.spark.serializer.KryoSerializer").config("spark.sql.hive.convertMetastoreParquet", "false").getOrCreat ()

    //Write to a Hudi Dataset

    val inputDF = Seq(
    ("100", "2015-01-01", "2015-01-01T13:51:39.340396Z"),
    ("101", "2015-01-01", "2015-01-01T12:14:58.597216Z"),
    ("102", "2015-01-01", "2015-01-01T13:51:40.417052Z"),
    ("103", "2015-01-01", "2015-01-01T13:51:40.519832Z"),
    ("104", "2015-01-02", "2015-01-01T12:15:00.512679Z"),
    ("105", "2015-01-02", "2015-01-01T13:51:42.248818Z")
    ).toDF("id", "creation_date", "last_update_time")

    val hudiOptions = Map[String,String](
    HoodieWriteConfig.TABLE_NAME -> "work.hudi_test",
    DataSourceWriteOptions.TABLE_TYPE_OPT_KEY -> "COPY_ON_WRITE",
    DataSourceWriteOptions.RECORDKEY_FIELD_OPT_KEY -> "id",
    DataSourceWriteOptions.PARTITIONPATH_FIELD_OPT_KEY -> "creation_date",
    DataSourceWriteOptions.PRECOMBINE_FIELD_OPT_KEY -> "last_update_time",
    DataSourceWriteOptions.HIVE_SYNC_ENABLED_OPT_KEY -> "true",
    DataSourceWriteOptions.HIVE_TABLE_OPT_KEY -> "work.hudi_test",
    DataSourceWriteOptions.HIVE_PARTITION_FIELDS_OPT_KEY -> "creation_date",
    DataSourceWriteOptions.HIVE_PARTITION_EXTRACTOR_CLASS_OPT_KEY -> classOf[MultiPartKeysValueExtractor].getName)
    //  Upsert Data
    // Create a new DataFrame from the first row of inputDF with a different creation_date value

    val updateDF = inputDF.limit(1).withColumn("creation_date", lit("2014-01-01"))

    updateDF.write.format("org.apache.hudi").options(hudiOptions).mode(SaveMode.overwrite).saveAsTable("work.hudi_test")

    while writing this write statement i m getting below error message.

    java.lang.NoClassDefFoundError: org/apache/spark/sql/execution/datasources/v2/FileDataSourceV2

can somone Kindly Guide me how should I write this statement.

A: Here is a working sample for your question in pyspark:
from pyspark.sql import SparkSession
from pyspark.sql.functions import lit

spark = (
    SparkSession.builder.appName("Hudi_Data_Processing_Framework")
    .config("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
    .config("spark.sql.hive.convertMetastoreParquet", "false")
    .config(
        "spark.jars.packages",
        "org.apache.hudi:hudi-spark-bundle_2.12:0.7.0,org.apache.spark:spark-avro_2.12:3.0.2"
    )
    .getOrCreate()
)

input_df = spark.createDataFrame(
    [
        ("100", "2015-01-01", "2015-01-01T13:51:39.340396Z"),
        ("101", "2015-01-01", "2015-01-01T12:14:58.597216Z"),
        ("102", "2015-01-01", "2015-01-01T13:51:40.417052Z"),
        ("103", "2015-01-01", "2015-01-01T13:51:40.519832Z"),
        ("104", "2015-01-02", "2015-01-01T12:15:00.512679Z"),
        ("105", "2015-01-02", "2015-01-01T13:51:42.248818Z"),
    ],
    ("id", "creation_date", "last_update_time"),
)

hudi_options = {
    # ---------------DATA SOURCE WRITE CONFIGS---------------#
    "hoodie.table.name": "hudi_test",
    "hoodie.datasource.write.recordkey.field": "id",
    "hoodie.datasource.write.precombine.field": "last_update_time",
    "hoodie.datasource.write.partitionpath.field": "creation_date",
    "hoodie.datasource.write.hive_style_partitioning": "true",
    "hoodie.upsert.shuffle.parallelism": 1,
    "hoodie.insert.shuffle.parallelism": 1,
    "hoodie.consistency.check.enabled": True,
    "hoodie.index.type": "BLOOM",
    "hoodie.index.bloom.num_entries": 60000,
    "hoodie.index.bloom.fpp": 0.000000001,
    "hoodie.cleaner.commits.retained": 2,
}

# INSERT
(
    input_df.write.format("org.apache.hudi")
    .options(**hudi_options)
    .mode("append")
    .save("/tmp/hudi_test")
)

# UPDATE
update_df = input_df.limit(1).withColumn("creation_date", lit("2014-01-01"))
(
    update_df.write.format("org.apache.hudi")
    .options(**hudi_options)
    .mode("append")
    .save("/tmp/hudi_test")
)

# REAL UPDATE
update_df = input_df.limit(1).withColumn("last_update_time", lit("2016-01-01T13:51:39.340396Z"))
(
    update_df.write.format("org.apache.hudi")
    .options(**hudi_options)
    .mode("append")
    .save("/tmp/hudi_test")
)

output_df = spark.read.format("org.apache.hudi").load(
    "/tmp/hudi_test/*/*"
)

output_df.show()

Output:

Hudi table in Filesystem looks as follows:

Note:
Your update operation actually creates a new partition and it does an insert, since you are modifying the partition column (2015-01-01 ->  2014-01-01). You can see that in the output.
And I have provided an update example where it updates the last_update_time to 2016-01-01T13:51:39.340396Z which actually updates the id 100 in partition 2015-01-01 from 2015-01-01T13:51:39.340396Z to 2016-01-01T13:51:39.340396Z
More samples can be found in Hudi Quick Start Guide


text:
Q: Question on quotient presentations of affinoid/Tate algebras I'm confused on some basic constructions/facts with Tate/affinoid algebras. Let $k$ be a complete non-archimedean field with abs value $| \cdot |$
$T_n = k\langle{X_1,\ldots,X_n} \rangle =  \{ \sum_{J \geq 0} a_JX^{J}: |a_J| \to 0 \ \textrm{as}  \ J \to \infty \}$ $J$ a multi-index is the Tate algebra over $k$ in the variables $X_1,\ldots,X_n$. This is a $k$-Banach alg with Gauss norm. It's mspec recovers the closed unit polydisc $\{(c_1,\ldots,c_n) \in \bar{k}^n |c_i| \leq 1 \}$ (modulo $\operatorname{Aut(\bar{k}/k)}$ action.)
An affinoid algebra is a quotient of the form $T_n/I$, given the quotient Banach norm/topology. I know it is a fact that two different presentations may induce different norms but they will induce the same topology.
Let $M(A)$ be max-spec of $A$. I don't understand some things regarding the handling of some subtleties of constructions like $A \langle X \rangle / (X-a) = A \langle a \rangle $ versus $A$. The former which by definition "makes $a$ power bounded" and moreover the natural map $M(A\langle a \rangle ) \subset M(A)$ naturally has image $\{ s \in M(A): |a(s)| \leq 1 \}$ where $a(s)$ means the image of $a$ in the residue field $A/\mathfrak{m}_{s}$.
But in the example $k = \mathbb{Q}_p$ and $T_2 \cong k\langle x,y \rangle$ and consider the quotient onto $k\langle x,y \rangle / (y-\frac{1}{p}) = (k\langle x \rangle) \langle \frac{1}{p} \rangle$. My question is, what is this object? If it is supposed to be the subset of $\operatorname{mspec}({k\langle x \rangle}) = \{ |c| \leq 1 \}$ such that $\frac{1}{p} \equiv \frac{1}{p} \mod (x-c)$ is power bounded then isn't this set empty? That conclusion doesn't seen correct. Any comments on what I'm getting wrong are appreciated. How are we "forcing $\frac{1}{p}$ to be power bounded", if that is possible? All definitions and notations are following lectures 1 and 2 in Brian Conrad's notes "several approaches to non-archimedian geometry".
$\mathbf{Edit}$: as reuns points out, there is no contradiction: $y-\frac{1}{p}$ is a unit in $T_2$ and so doesn't generate an ideal.


text:
Q: Is experience countable or uncountable? "Seeing the Grand Canyon was certainly____(an /some) experience." Is experience countable or uncountable? Should I use some or an?

A: In some instances, it's countable and in other uncountable, depending on its meaning. According to the Longman dictionary if it means "something that happens to you or something you do especially when this has an effect on what you feel or think", it's countable.Seeing the grand Canyon, of course, has a great effect on everybody, so in this case it's countable and you should say: "Seeing the Grand Canyon was certainly an experience". More examples:
Ballooning is quite an experience.
I have a lot of experiences from trip to Africa.
Seeing the Grand Canyon was a really fantastic experience.
But if it means "knowledge or skill that you gain from doing a job or activity", it's uncountable.

A: And yet one will hear far more native speakers saying

Our visit to the Grand Canyon was some experience!
That was some experience, when we got drunk and went over Niagara Falls in a barrel!

Some experience connotes that the experience was memorable in some positive way. An experience can connote that it was quite an ordeal.  As can some experience, except that the pleasure is in telling the tale of the ordeal.
So, depending upon how much the barrel riders enjoyed the falls, we might also have:

That was an experience, when we got drunk and went over Niagara Falls in a barrel!


text:
Q: Lagom + LagomPlay - There is no started application During
val value = Play.current.configuration.getString("confKey")

An exception or error caused a run to abort: There is no started application
java.lang.RuntimeException: There is no started application

A: You are accessing the global play instance when using Play.current. This is incorrect in many cases (during testing you may not have a started application).
You should use dependency injection to inject your configuration.
See: https://www.lagomframework.com/documentation/1.3.x/scala/DependencyInjection.html and https://www.playframework.com/documentation/2.5.x/ScalaDependencyInjection


text:
Q: Why does my Vue.js app not run when I use the runtime version of Vue? I have changed my Vue.js version to the runtime version by modifying Webpack as follows:
  resolve: {
    extensions: ['.ts', '.js', '.vue', '.json'],
    alias: {
      'vue$': 'vue/dist/vue.runtime.js'
      // 'vue$': 'vue/dist/vue.esm.js'
    }
  },

The commented out version is what I previously used, and my app worked. Here is my Vue.js code (which previously worked):
import Forgot from "./components/Forgot.vue";
import Vue from "vue";

new Vue({
    el: "#app",
    components: {
        Forgot
    },
    data: {
        email: ""
    }
});

Under the runtime version of Vue.js, I am getting the following error:
Uncaught TypeError: n(...).default is not a constructor

and Chrome DevTools isolates the error to the following line:
new Vue({

Why doesn't my code work under the runtime version of Vue?

A: If you look at the official documentation (https://v2.vuejs.org/v2/guide/installation.html#Explanation-of-Different-Builds) you will find a description about the different builds. So you are trying to use an UMD build (which is supposed to run in browser - not to be transformed by Webpack) in an ES environment. You should try vue.runtime.esm.js instead. By the way if you do not configure an alias for vue$ it should automatically pickup the right one - vue.runtime.esm.js


text:
Q: How do I style an external SVG file, included in my HTML, with no symbol name? I have an SVG file that looks like this (the value for the d attribute omitted for brevity):
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="..."/></svg>

I would like to embed this file in HTML (without including the SVG source inline). I know that there are multiple ways to do this, you can use <img src="file.svg">, <object data="file.svg"> and so forth. I want to be able to style this SVG file using CSS (in my case, to make colours match the colour of text in the HTML). I also don't want to use symbol names, since none of the SVG files at my disposal use symbols.
So far, I haven't found a solution that meets all three of these requirements. To re-iterate:

*

*The HTML code needs to reference an external SVG file

*It must be possible to style the SVG image using external CSS

*It must not require that the SVG file have within it a symbol name.

If it's not possible, let me know, I'll accept that as an answer.

A: This should be possible if the SVG does not have a fill color defined in its code. I could be mistaken. Have you tried something like this?
HTML
<svg class="icon-1">
   <use xlink:href="#icon-1"></use>
</svg>

CSS
.svg {
  fill: red;
}

SOURCE:
https://css-tricks.com/svg-use-with-external-reference-take-2/


text:
Q: Regex to return all words in a line that starts with specific word I know this may be a common question and a duplicate, but I don't know how to
express it well. For example, using Perl,
@arr = "a bb ccc" =~ /\b(\w+)\b/g;

can successfully get the three words.
But if I add one condition, that the line must start with a specific word, such as
begin(excluding in the result array)
@arr = "begin:a bb ccc" =~ /begin:.*\b(\w+)\b/g;

This time the array contains only the last match ccc
How should I write a correct regex?

A: Seems that you're looking for contiguous matching.

*

*What good is \G in a regular expression?

*perlre Assertions

The \G assertion can be used to chain global matches

@arr = ("begin: a bb ccc" =~ /(?:^begin:|\G)\h*(\w+)\b/g);

See demo at eval.in

*

*(?:^begin:|\G(?!^)) This part is to bind the matches to begin: at ^ start. \G matches at the end of a previous match. Without (?!^) \G would also match at start.

*\h*(\w+)\b matches * any amount of \h horizontal whitespace followed by group (\w+) to capture one or more word characters if followed by a \b word boundary to $1.

*Instead of \h+ use [^\w\n]+ to match any characters that are not word-characters or newline in between. To match begin: anywhere in the string, remove the ^ start anchor.
Also see demo at regex101
\G is especially useful to match an "anchored" sequence and extract each subsequent match.

A: You don't say very much about your data, especially what happens if there is no begin at the start of the line. But you probably want split instead of a regex pattern
Something like this
use strict;
use warnings 'all';
use feature 'say';

my $s = 'begin:a bb ccc';

my @arr;

if ( $s =~ /\Abegin:(.*)/ ) {
    @arr = split ' ', $1;
}
else {
    say 'No "begin"';
}

say join ',', @arr;

output
a,bb,ccc


text:
Q: Creating RDS cloudformation with route 53 I am having trouble with aws cloud formation. I need to create cloudformation that will install and configure RDS with RHEL and mariadb with route 53 and master user. I started first with basic config.yaml but i am getting an error with vpc, it says

No default VPC for this user (Service: AmazonEC2; Status Code: 400;
  Error Code: VPCIdNotSpecified; Request ID:
  407bd74c-9b85-4cce-b5a7-b816fe7aea15)

My config.yaml is this
Resources:
   Ec2Instance1:
      Type: 'AWS::EC2::Instance'
      Properties:
           SecurityGroups:
               - !Ref InstanceSecurityGroup
           KeyName: adivir
           ImageId: ami-07dfba995513840b5
           AvailabilityZone: eu-central-1
           InstanceType: t2.micro
           UserData:
              Fn::Base64: !Sub |
               #!/bin/bash -xe
               yum install -y httpd
               yum install -y git
               yum install -y php php-mysql
               git clone https://github.com/demoglot/php.git /var/www/html
               systemctl restart httpd
               systemctl enable httpd
   Ec2Instance2:
      Type: 'AWS::EC2::Instance'
      Properties:
           SecurityGroups:
               - !Ref InstanceSecurityGroup
           KeyName: adivir
           ImageId: ami-07dfba995513840b5
           AvailabilityZone: eu-central-1
           InstanceType: t2.micro
           UserData:
             Fn::Base64: !Sub |
               #!/bin/bash -xe
               yum install -y httpd
               yum install git -y
               git clone https://github.com/demoglot/php.git /var/www/html
               systemctl restart httpd
               systemctl enable httpd
   InstanceSecurityGroup:
    Type: 'AWS::EC2::SecurityGroup'
    Properties:
      GroupDescription: Enable SSH access
      SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: '2256'
          ToPort: '2256'
          CidrIp: 0.0.0.0/0

        - IpProtocol: tcp
          FromPort: '80'
          ToPort: '80'
          CidrIp: 0.0.0.0/0
   ElasticLoadBalancer:
    Type: 'AWS::ElasticLoadBalancing::LoadBalancer'
    Properties:
        AvailabilityZones:
             - eu-central-1
             - eu-central-1b
        Listeners:
            - InstancePort: '80'
              LoadBalancerPort: '80'
              Protocol: HTTP
        HealthCheck:
              Target: 'HTTP:80/'
              HealthyThreshold: '3'
              UnhealthyThreshold: '5'
              Interval: '30'
              Timeout: '5'
        Instances :
           - !Ref Ec2Instance1
           - !Ref Ec2Instance2
   DBSECURITYGROUP:
    Type: 'AWS::RDS::DBSecurityGroup'
    Properties:
          GroupDescription: Security Group for RDS private access
          DBSecurityGroupIngress:
            - CIDRIP: 0.0.0.0/0
   MyDB:
    Type: 'AWS::RDS::DBInstance'
    Properties:
        DBName: kk
        AllocatedStorage: '20'
        DBInstanceClass: db.t2.micro
        Engine: MariaDB
        EngineVersion: '10.1.31'
        MasterUsername: admin
        MasterUserPassword: admin123
        DBSecurityGroups:
            - !Ref DBSECURITYGROUP
        Tags:
           - Key: name
             Value: kk
    DeletionPolicy: Snapshot

What i need to do in order to resolve vpc error and have RDS create successfully and how and where to add route 53 creation in yaml file? Also database neds to be connected to java app athat is on other instance. What do i need to share with person making app in order for him to connect to database? Also, is it possible to have one shell script that will run cloudformations in order, create stacks and then exit so that not each team member needs to run his own cloud formation? Thank you

A: Solution to this problem and why it occurs have been documented and explained in the resent AWS blog:

*

*How do I resolve the CloudFormer error "No default VPC found for this user" in AWS CloudFormation?
Basically, the solution is to create new default vpc.
p.s.
I also agree with @mokugo-devops. You ask too many sub-questions which limits the focus and precision of your main question and issue you have reported.


text:
Q: nginx: 403 Forbidden & 301 Moved Permanently I am trying to access example.com/api but when I do I'm getting "403 Forbidden" I'm able to access files in it such as example.com/api/v1.php in my browser, but when trying to access example.com/api/v1.php in my c++ project below ""301 Moved Permanently". How can I access the folder that is there?
Edit: I fixed the issue of not being able to access the "example.com/api" dir by adding index.php into the folder, but im still having an issue letting my c++ program seeing the "example.com/api/v1.php" page as said seeing it in browser works but in the program it prints "301 Moved Permanently"
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 21 Jul 2022 04:20:08 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: https://example.com/api/v1.php
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Permitted-Cross-Domain-Policies: master-only
Referrer-Policy: same-origin

<title>301 Moved Permanently</title>

301 Moved Permanently

nginx

This is my Vhost
server {
  listen 80;
  listen [::]:80;
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  {{ssl_certificate_key}}
  {{ssl_certificate}}
  server_name www.example.com;
  return 301 https://example.com$request_uri;
}

server {
  listen 80;
  listen [::]:80;
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  {{ssl_certificate_key}}
  {{ssl_certificate}}
  server_name example.com www1.example.com;
  {{root}}

  {{nginx_access_log}}
  {{nginx_error_log}}

  if ($scheme != "https") {
    rewrite ^ https://$host$uri permanent;
  }

  location ~ /.well-known {
    auth_basic off;
    allow all;
  }

  {{settings}}

  try_files $uri $uri/ /index.php?$args;
  index index.php index.html;

  location ~ \.php$ {
    include fastcgi_params;
    fastcgi_intercept_errors on;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    try_files $uri =404;
    fastcgi_read_timeout 3600;
    fastcgi_send_timeout 3600;
    fastcgi_param HTTPS $fastcgi_https;
    fastcgi_pass 127.0.0.1:{{php_fpm_port}};
    fastcgi_param PHP_VALUE "{{php_settings}}";
  }

  location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf)$ {
    add_header Access-Control-Allow-Origin "*";
    expires max;
    access_log off;
  }

  if (-f $request_filename) {
    break;
  }
}


text:
Q: Authorize.NET creating a subscription from authorized CC charge We are using AuthOnlyTransaction, and later PriorAuthCaptureTransaction transaction types to authorize and capture order charges.
We would like to add a subscription option, which would follow the same scenario - user funds are first authorized, then captured.
There is currently a way to Create ARB Subscription from Transaction in the Sanbox GUI, Sandbox > Unsettled Transactions > Pick on auth-only transaction > Click "Create ARB Subscription from Transaction":

How can we create an ARB Subscription for an authorized charge from the API?

A: You can create a customer profile and payment profile using the CIM API when you first get your authorization. Then once you are ready to create the subscription you can create it using those profile IDs.
Here is sample XML:
<?xml version="1.0" encoding="utf-8"?>
<ARBCreateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
    <merchantAuthentication>
        <name>API_USERNAME</name>
        <transactionKey>API_TRANSACTION_KEY</transactionKey>
    </merchantAuthentication>
    <refId>Sample</refId>
    <subscription>
        <name>Sample subscription</name>
        <paymentSchedule>
            <interval>
                <length>1</length>
                <unit>months</unit>
            </interval>
            <startDate>2020-08-30</startDate>
            <totalOccurrences>12</totalOccurrences>
            <trialOccurrences>1</trialOccurrences>
        </paymentSchedule>
        <amount>10.00</amount>
        <trialAmount>0.00</trialAmount>
        <profile>
            <customerProfileId>12345678</customerProfileId>
            <customerPaymentProfileId>987654342</customerPaymentProfileId>
        </profile>
    </subscription>
</ARBCreateSubscriptionRequest>


text:
Q: asp.net, wcf authentication and caching I need to place my app business logic into a WCF service. The service shouldn't be dependent on ASP.NET and there is a lot of data regarding the authenticated user which is frequently used in the business logic hence it's supposed to be cached (probably using a distributed cache). As for authentication - I'm going to use two level authentication:

*

*Front-End  - forms authentication back-end

*(WCF Service) - message username authentication.

For both authentications the same custom membership provider is supposed to be used.
To cache the authenticated user data, I'm going to implement two service methods:
1) Authenticate - will retrieve the needed data and place it into the cache(where username will be used as a key)
2) SignOut - will remove the data from the cache
Question 1. Is correct to perform authentication that way (in two places) ?
Question 2. Is this caching strategy worth using or should I look at using aspnet compatible service and asp.net session ?
Maybe, these questions are too general. But, anyway I'd like to get any suggestions or recommendations.
Any Idea

A: Question 1:
From my experience the ASP forms authentication would be enough. No reason to send credentials as POST and certainly not GET. You can use that for a change password or account info method.  You might want to look into Membership and Roles.
Question 2:
I would stick with the ASP.NET session.  This might make your application more prone to issues and vulnerabilities in the end, and I see it as unnecessary.

A: Passing the password to between the services is not a good practice. You should consider creating a custom security token in your front-end application and passing this token to the WCF service. WCF service can validate the token using a certificate. With this approach  you can

*

*insert any user data into the security token and use in the WCF service

*cache the token in the front-end application session, therefore you don't need any distributed cache

*centralize login and avoid authenticating user twice

A: If you don't want to be dependant on ASP.NET then you shouldn't use any session
What I could advice:

*

*Use a UserNameValidator, so that you need to send username/password on each request to the wcf service (there are a lot of article on the web on how to configure a UserNameValidator)

*Implement an IAuthorizationPolicy where you can retrieve user data to set the roles etc. This object is created once then reused
The problem is that if you only use these 2 components, you'll need to fetch the data for each request as you've no way to transfert the username from the UserNameValidator to the IAuthorizationPolicy
To avoid that, you'll need to implement the complete authentication mechanism in WCF. It's not hard at all, and here is a very nice link that help me to do it in 1 or 2 hours:
http://www.neovolve.com/post/2008/04/07/wcf-security-getting-the-password-of-the-user.aspx
The "PasswordAuthorizationPolicy" (in the link above) is created once, then reused. And for each request the Evaluate method is called.
It means that you can add any custom property on this class, fill them in the constructor, and then use them forever. You don't need to manage this cache lifetime as it's binded to the client channel, so once the client close the connection the channel will expire all these data will be removed from memory

A: My suggestion is to create class Authentication (or something else) on WCF side:
public class Authentication<T>
{
    public static Dictionary<string, T> Users { get; set; }
}

And if you have User class:
public class User
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    ...
}

You can manage users like this:
Authentication<User>.Users.Add("username", new User());


text:
Q: Nautilus does not launch in Ubuntu 19.04 Some time after upgrading to Ubuntu 19.04, I have become unable to launch nautilus by double-clicking it and also unable to launch using terminal.
Output of which nautilus
/usr/bin/nautilus

Output of apt-cache policy nautilus
nautilus:
Installed: 1:3.32.0-0ubuntu2
Candidate: 1:3.32.0-0ubuntu2
Version table:
*** 1:3.32.0-0ubuntu2 500
    500 http://archive.ubuntu.com/ubuntu disco/main amd64 Packages
    100 /var/lib/dpkg/status

Output of nautilus
Does not give any output, it hangs there itself and does not give any output.
UPDATE
Output of sudo nautilus -q
** (org.gnome.Nautilus:4911): WARNING **: 03:46:22.268: Error on getting      connection: Failed to load SPARQL backend: Could not connect: Connection refused

(org.gnome.Nautilus:4911): GLib-GIO-CRITICAL **: 03:46:22.281: g_dbus_connection_signal_unsubscribe: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(org.gnome.Nautilus:4911): GLib-GObject-CRITICAL **: 03:46:22.281: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(org.gnome.Nautilus:4911): GLib-GObject-CRITICAL **: 03:46:22.281: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

(org.gnome.Nautilus:4911): libunity-CRITICAL **: 03:46:22.373: unity-launcher.vala:157: Unable to connect to session bus: Could not connect: Connection refused

A: In my 18.04 setup I had problems with tracker causing the same issue, nautilus not launching, then it worked by killing tracker, but now that did not work either.
What did work, was resetting tracker. I performed a hard reset, you might try a soft reset, maybe it could work too, I didn't test, since it got fixed by the hard reset. Sidenote: I disabled search in files.
tracker hard reset in terminal :
tracker reset -r

tracker soft reset :
tracker reset -e

A: I also had this problem. All was good in the  beginning, but after some time I was unable to open Files to access to my folders.
Try cleaning your operating system with Bleachbi:
sudo apt update
sudo apt install bleachbit

Run Bleachbit and clean your OS, then restart the computer.
This worked for me.

A: I had an identical observation. I updated to 19.04 and then noticed sporadic behave with folders and the terminal. I would click the home folder and the busy icon would appear for a few seconds but sadly the home folder would not open. I would try to open a terminal (quick keys and through apps) but seemingly nothing happened. Then everything worked after a couple of restarts, with none of the methods tried on this thread, before reverting back to not working.
After searching for a more substantial answer than the ones provided on this thread I believe that I found a more plausible solution on another thread. I uninstalled Google Remote Desktop, and everything appears to be working robustly now (I even had old pages open that I had not seen since I installed Google Remote Desktop):
Ubuntu 18.04 can't start nautilus or terminal


text:
Q: Irradiation at high frequency I read this statement in Feynman Lecture on Physics (see here for more details):

In low-frequency circuits the connection is made with wires, but this method doesn't work very well at high frequencies because the circuits would radiate energy into all the space around them, and it is hard to control where the energy will go. The fields spread out around the wires; the currents and voltages are not "guided" very well by the wires.

I read this statement many times but I do not have in mind the physical (why the electromagnetic field goes "far" from the circuit) and also the mathematical reason of this (I image there should be a frequency dependence on some parameters which defines the "irradiation"). Why, given a certain circuit, high frequency means irradiation?

A: The antenna in a radio transmitter or receiver is basically just a piece of wire. OK, the wire is usually made into a special shape, but that is just to make it more efficient.
Every piece of wire in a physical circuit acts like an antenna and picks up some of the EM field radiated from every other piece of wire.
At low frequencies this effect is too small to interfere with the way the circuit is intended to work, but at high frequencies it becomes more important.
These effects become critical when "wires" are longer than about 10% of the wavelength of the EM radiation. For computers and cellphones operating at frequencies of a few GHz, the wavelength is the order of 100mm so any "wire connection" more than 10mm long can act as a transmitting or receiving antenna.
These issues are overcome by careful design of the physical layout of the connections, and "shielding" conductors from each other by placing another conductor between them to absorb the unwanted EM radiation. Reducing the size of the device also helps, by making all the interconnecting "wires" shorter - devices like cellphones need to be small in order to work at all, not just to make them easier to carry about!


text:
Q: Why does the compiler not deduce captures relationships in generics? Imagine an interface like this
public interface MessageParameter<T> {

  public List<T> unmarshal(byte[] array);
  public int getLength(List<T> values);

}

and a consumer of that interface
public class GenericUser {

  List<MessageParameter<?>> payload = new ArrayList<>();

  public void run() {
     byte[] byteArray = new byte[] { 1, 2 };

     for (MessageParameter<?> element : payload) {
        element.getLength(element.unmarshal(byteArray)); //compiler error
     }
  }
}

The compiler gives an error
 The method getLength(List<capture#1-of ?>) in the type MessageParameter<capture#1-of ?> is not applicable for the arguments (List<capture#2-of ?>)

Clearly since I am using element in both method calls, the type of both is the same and it should be allowed. Another way to ask the same question, why is the compiler creating capture#2?? why can't it deduce that they are logically both the same capture?
Am I missing something? is there a counter-example where this code would throw a runtime exception??
My main question is not how to fix the code (although that would be interesting as well, my current solution is to use Object instead of ?), but what is the logical reason for this error? It looks to me like a shortcoming on the implementation of the compiler more than a logical limitation

A: The answer is that the compiler is not that smart to accept that the runtime type corresponding to ? is the same because it does not care that your one-line expression involves the same element:
element.getLength(element.unmarshal(byteArray));

is semantically similar to:
List<?> unmarshalledList = element.unmarshal(byteArray);
element.getLength(unmarshalledList);

In this case, it is not so obvious that the list unmarshalledList would surely have to have the same "any-type" as the one expected by getLength(). The above are two separate statements (even though they're contiguous). Imagine that they're not contiguous. You may have something like:
MessageParameter<?> otherElement = getOtherElement();
for (MessageParameter<?> element : payload) {
    List<?> unmarshalledList = element.unmarshal(byteArray);
    // unmarshalledList can be re-assigned from another parameterized type
    unmarshalledList = otherElement.unmarshal(byteArray);
    element.getLength(unmarshalledList);  // error
}

In other words, the compiler cannot assume that the variable unmarshalledList will retain the same ? type from element when the program reaches the statement invoking getLength on the same element. It can be re-assigned to a different parameterized type in between.

A: I believe you're misinterpreting the meaning of ? in a generic. That symbol is known as the wildcard; and it refers to a truly unknown type. This is different from your current effort, in which it would literally be better to use Object, as your types are not completely unknown—you know that they both implement Object and can reference them as such. (? extends Object might be better in some places).
As to the reason why ? is not synonymous with Object, remember that primitives do not inherit from Object, but may be referenced with the wildcard. Therefore, after type erasure, your program cannot be certain that the two wildcards are referring to compatible entities; unless you explicitly tell it as much.


text:
Q: Graphs with no vertices of even degree Let $G$ be a graph on $n$ vertices, in which every vertex has odd degree. The Handshaking Lemma implies that $n$ is even. Also, if $G$ is disconnected, then it is the disjoint union of smaller graphs with odd degrees only, so wlog. assume that $G$ is connected.
I'm just wondering if there is anything else that can be said about such $G$ in general? Are there any theorems that expose some sort of restrictions on the structure of $G$? Or any noteworthy sufficient conditions on a graph to contain an even degree vertex?


text:
Q: How to do a Cartesian product for words in a list using Python It turned out I was looking for combinations and not the Cartesian product.

I need to do a Cartesian product of several words (all of them inside a list).
My input looks something like this:
[[id, [word1,word2,word3]],[id2,[word4,word5,word6]]]

The product needs to be made on the words in the first index inside each list of lists. Meaning - on word1, words2, and word3 between themselves, on word4, words5, and word6 between themselves and so on.
My code so far:
for row in x:
    row[1] = list(itertools.product(*row[1])

The problem is that the script does the product on each of the letters and not on each one of the words.
I get something like: (w,w,w), (w,o,r), (w,o,d), etc.
The expected output is: (word1,word2), (word1,word3), (word2,word3). The same thing for the other parts..

A: itertools.product takes several iterables as input. The Cartesian product is taken between the iterables given. E.g. itertools.product([1, 2], [3, 4]) gives [(1, 3), (1, 4), (2, 3), (2, 4)].
Having said that, what you actually meant to call was itertools.combinations
for row in x:
    row[1] = list(itertools.combinations(row[1], 2))

A: You're looking for [list(itertools.product(row[1], repeat=len(row[1]))) for row in x]. You do not need to use the * operator to unpack row[1], as itertools.product() takes whole iterables as arguments. To calculate the Cartesian Product of each row "between themselves", use the repeat paramater.

A:   1 #!/usr/bin/python
  2 # vim: noet sw=4 ts=4
  3
  4 d = [["id", ["word1","word2","word3"]],["id2"["word4","word5","word6"]]]
  5 inner = d[0][1]
  6 outer = d[1][1]
  7 for o in outer:
  8     for i in inner:
  9         print '{0}x{1}'.format( i, o )

word1xword4
word2xword4
word3xword4
word1xword5
word2xword5
word3xword5
word1xword6
word2xword6
word3xword6


text:
Q: Send https post request I can able to send http post request. I used chrome's SimpleRestClient extension to send following http post request
http://localhost:8161/api/message/QueueTest?type=queue&body=message

Now I want to do https(http secure) post request, I try to do the following link but I can't. How can I send?
https://localhost:8161/api/message/QueueTest?type=queue&body=message


text:
Q: Memory Leak while using NSDateFormatter I have seen many questions/answers on memory leaks in NSDateFormatter, but none seems to help me determine what is causing memory to leak in my app. Here is my code:
- (id)init
{
    if ((self = [super init]))
    {
        items = [[NSMutableArray alloc] init];
        events = [[NSMutableArray alloc] init];
        buffer = [[NSMutableData alloc] init];
        format = [[NSDateFormatter alloc] init];
        lastFromDate = @"";
    }
    return self;
}

- (void)presentingDatesFrom:(NSDate *)fromDate to:(NSDate *)toDate delegate:(id<KalDataSourceCallbacks>)delegate
{
    [format setTimeZone:[NSTimeZone systemTimeZone]];
    [format setDateFormat:@"MM/dd/yyyy"];
    NSString *stringFromDate = [NSString stringWithString:[format stringFromDate:fromDate]];
    NSString *stringToDate = [NSString stringWithString:[format stringFromDate:toDate]];

    NSLog(@"From date: %@, To date: %@", stringFromDate, stringToDate);

    [self didDatesChange:stringFromDate];

    if (dataReady) {
        [callback loadedDataSource:self];
        return;
    }
    callback = delegate;
    [self retrieveEventData:stringFromDate to:stringToDate];
}

- (void)dealloc
{
    [items release];
    [events release];
    [buffer release];
    [lastFromDate release];
    [format release];
    [super dealloc];
}

When I run "Profile" -> "Leaks", I get a memory leak every time the function is called on line
NSString *stringFromDate = [NSString stringWithString:[format stringFromDate:fromDate]];

Can someone explain what might be going on?
thanks, mike

A: FYI you can change this:
 NSString *stringFromDate = [NSString stringWithString:[format stringFromDate:fromDate]];

to this:
 NSString *stringFromDate = [format stringFromDate:fromDate];

stringWithString should return an autoreleased NSString though so I don't believe that is the source of your leak. It looks like there is no leak in your code to me.

A: you just use bellow method for get string from date its work properly......
-(NSString *)StringFromDate:(NSDate *)DateLocal{
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:@"MM/dd/yyyy"];
    NSString *dateString = [dateFormat stringFromDate:DateLocal];
    NSLog(@"Date is HERE  =====>> %@",dateString);
    return dateString;
}

after when you want to get date string just use like bellow....
NSString *stringFromDate = [self stringFromDate:fromDate]];
[stringfromdate retain];
NSString *stringToDate = [self stringFromDate:toDate]];
[stringTodate retain];

and above -(NSString *)StringFromDate:(NSDate *)DateLocal method is must be define in your viewcontroller.m file....
Its work fine....


text:
Q: Using EJB with Future> object How I can use async EJB's and asking for result with Future object ? Can anyone show me by a complete example.

A: Before EJB 3.1,If you want to execute an asynchronous processing you had to use JMS and a MDB,In
EJB 3.1, you can use a simple session EJB with the @Asynchronous annotation on the method which must be called asynchronously.
@Stateless
@Remote(HelloEjbAsynchronousRemote.class)
public class HelloEjbAsynchronous implements HelloEjbAsynchronousRemote {

@Asynchronous
@Override
public Future<String> ejbAsynchronousSayHello(String name){

If your method has a return value, your method has to return an AsyncResult object which is an implementation of Future.
return new AsyncResult<String>("Hello "+name);