text:
Q: Access server context from websockets ws_handler I'm writing a simple websocket server application in python using the websockets library.
In my ws_handler function I'd like to access some server data.
Here is an imaginary piece of code which expresses what I'm looking for:
async def ws_handler(websocket, path, context):
    await websocket.send("Count={}".format(context.current_count))

some_data = Data()

start_server = websockets.serve(ws_handler, 'localhost', 8765, context=some_data)

I'm thinking websockets should have a way to do something like this but I can't figure it out.

A: This is explained in websockets's cheat sheet documentation: "Passing additional arguments to the connection handler".
Is this case, it would be:
import asyncio
import functools
import websockets

async def ws_handler(websocket, path, context):
    await websocket.send("Count={}".format(context.current_count))

some_data = Data()

bound_handler = functools.partial(ws_handler, context=some_data)
start_server = websockets.serve(bound_handler, 'localhost', 8765)

asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()


text:
Q: Understanding ffmpeg map option I came across the following command in a blog post which creates different quality video streams that are packaged into DASH format via the dash muxer.
ffmpeg -i $VIDEO_IN \
    -preset $PRESET_P -keyint_min $GOP_SIZE -g $GOP_SIZE -sc_threshold 0 \
    -r $FPS -c:v libx264 -pix_fmt yuv420p -c:a aac -b:a 128k -ac 1 -ar 44100 \
    -map v:0 -s:0 $V_SIZE_1 -b:v:0 2M -maxrate:0 2.14M -bufsize:0 3.5M \
    -map v:0 -s:1 $V_SIZE_2 -b:v:1 145k -maxrate:1 155k -bufsize:1 220k \
    -map v:0 -s:2 $V_SIZE_3 -b:v:2 365k -maxrate:2 390k -bufsize:2 640k \
    -map v:0 -s:3 $V_SIZE_4 -b:v:3 730k -maxrate:3 781k -bufsize:3 1278k \
    -map v:0 -s:4 $V_SIZE_4 -b:v:4 1.1M -maxrate:4 1.17M -bufsize:4 2M \
    -map v:0 -s:5 $V_SIZE_5 -b:v:5 3M -maxrate:5 3.21M -bufsize:5 5.5M \
    -map v:0 -s:6 $V_SIZE_5 -b:v:6 4.5M -maxrate:6 4.8M -bufsize:6 8M \
    -map v:0 -s:7 $V_SIZE_6 -b:v:7 6M -maxrate:7 6.42M -bufsize:7 11M \
    -map v:0 -s:8 $V_SIZE_6 -b:v:8 7.8M -maxrate:8 8.3M -bufsize:8 14M \
    -map 0:a \
    -init_seg_name init\$RepresentationID\$.\$ext\$ -media_seg_name chunk\$RepresentationID\$-\$Number%05d\$.\$ext\$ \
    -use_template 1 -use_timeline 1  \
    -seg_duration 4 -adaptation_sets "id=0,streams=v id=1,streams=a" \
    -f dash Dash/dash.mpd

The thing I'm struggling to understand is how the maps work. I've read the Map docs but they don't seem to have a comparable example.

*

*Why is -map v:0 used for every video stream?

*Why does the first map line operate on stream 0 (e.g. -b:v:0) and the next map line operates on stream 1 (e.g. -b:v:1), etc.

Would really appreciate a breakdown.

A:
Why is -map v:0 used for every video stream?

The correct string should be -map 0:v:0. The file index was omitted and thus implicitly interpreted as file index 0. Such syntax is best avoided.

Why does the first map line operate on stream 0 (e.g. -b:v:0)

Don't think in terms of lines or proximity of options in relation to a map. The 0 in -b:v:0 is part of a stream specifier and targets which output stream to target.
See
What the different between -b:v <target bitrate> and -b <target bitrate> FFmpeg flags?
https://superuser.com/q/1219784/

redpajama_set_name: RedPajamaStackExchange


text:
Q: CTFontDrawGlyphs draws at incorrect position EDITED: I replaced my original code stub with a self-contained version
I am using Quartz2D to draw musical symbols to a CGContext. I am doing this in a Playground using Swift 4.
Musical Notes are composed of a single CGGlyph for the notehead and a line primitive for the stem. The glyph is taken from the music font "bravura".
The x-position of the notehead glyph is exactly positioned at its left edge. The stem must be aligned perfectly to this origin, therefore its x-position must be the notehead's x-position + the stem's thickness / 2.
I have a function that takes a CGFloat as the x-position and draws the glyph and the stem into the CGContext. This works perfectly fine when the value for x is a rounded value like 30.0. However, when the value is a fractional number like 30.9, the stem gets misaligned:

It is obvious that the line is drawing correctly but the glyph is ignoring the fractional part of the CGFloat. When I raise the x-value further to 31.0 both parts are in sync again.
Here is the simplified Code, which will work in your XCode9 Playground:
import PlaygroundSupport
import Cocoa

let fontSize = CGFloat(64)

// uncomment the next paragraph if you have added the "Bravura" Font to the ressources folder
/*
let fontURL = Bundle.main.url(forResource: "Bravura", withExtension: "otf")
CTFontManagerRegisterFontsForURL(fontURL! as CFURL, CTFontManagerScope.process, nil)
var font = CTFontCreateWithName("Bravura" as CFString, fontSize, nil)
*/

// comment out the next line if you use Bravura
var font = CTFontCreateWithName("Helvetica" as CFString, fontSize, nil)

func drawAtXPosition(_ posX: CGFloat, inContext context: CGContext) {
    // draw font glyph (notehead)
    var glyph = CTFontGetGlyphWithName(font, "uniE0A3" as CFString)
    var notePosition = CGPoint(x: posX, y: 100)
    CTFontDrawGlyphs(font, &glyph, &notePosition, 1, context)

    // draw line (note stem)
    let stemThickness = CGFloat(fontSize/4*0.12)
    let x: CGFloat = posX + stemThickness / 2
    let y: CGFloat = 100 - (0.168 * fontSize / 4)
    let stemBegin = CGPoint(x:x, y:y)
    let stemEnd = CGPoint(x:x, y: y - (3.5 * fontSize / 4))

    context.setLineWidth(stemThickness)
    context.strokeLineSegments(between: [stemBegin, stemEnd])
}

class MyView: NSView {
    override func draw(_ rect: CGRect) {
        let context = NSGraphicsContext.current!.cgContext
        context.setStrokeColor(CGColor.black)
        context.setFillColor(CGColor.black)

        drawAtXPosition(100, inContext: context)    // this draws as expected

        drawAtXPosition(200.99, inContext: context) // here the glyph is drawn at x=200, while the line is correctly drawn at 200.99
    }
}

var myView = MyView(frame: CGRect(x: 0, y: 0, width: 500, height: 200))
let myViewController = NSViewController()
myViewController.view = myView
PlaygroundPage.current.liveView = myViewController

You can download the music font "Bravura" from...
https://www.smufl.org/fonts/
... but I rewrote the code so it uses Helvetica per default, which also works for demonstration.
As a workaround in my original code I have implemented the .rounded() method of Foundation before passing the x-values to the drawing function. This works, but I'm afraid that at small font sizes (the whole code is written so that everything scales around the font size) the inaccuracy will be noticable.
I came across the methods setShouldSubpixelPositionFonts and setAllowsFontSubpixelPositioning of CGContext, but setting them to true does not do any change.
So, is there a way to draw the font objects just as precisely as the primitives (there must be one)? Or is my concern about rounding the CGFloats to Ints unjustified?

A: After endless digging I found the solution:
It is not sufficient to set
context.setShouldSubpixelPositionFonts(true)

You also have to set
context.setShouldSubpixelQuantizeFonts(false)

as the latter seems to override the former.


text:
Q: intersection of null space of a complex matrix with a real set, real part of range of a complex matrix Suppose $A$ is a complex matrix, with range (column space) $\mathcal{R}(A)$
and nullspace $\mathcal{N}(A)$. Have these
$$\mathcal{N}(A) \cap \mathbb{R}^p$$
$$\Re(\mathcal{R}(A)) \quad \text{(real part of the column space)}$$
been considered in the literature? I'd appreciate a reference.


text:
Q: How can I get the popup value to change when I click on another feature, without clicking on a map area where there are no features first? I'm working with openLayers 3, which is new to me, and I've been able to add a popup to my map that comes up when you click on a feature in a vector layer. The trouble is the popup content does not update when you click on another feature; you need to click on an area where there isn't a feature to close it, then click on another feature for the popup content to refresh. I'd like for the popup content to update when you click on a new feature, without having to click on an area where there is not feature first. Is there a way I can do this? Here is the code for the popup that I am using:
map.on('click', function(evt) {
  var feature = map.forEachFeatureAtPixel(evt.pixel,
      function(feature, layer) {
        return feature;
      });
  if (feature) {
    popup.setPosition(evt.coordinate);
    $(element).popover({
      'placement': 'top',
      'html': true,
      'content': 'Parcel No:
'+
      feature.get('parcel')+'
'+
      'Owner:
'+
      feature.get('primowner')
    });
    $(element).popover('show');
  } else {
    $(element).popover('destroy');
  }
});

A: Destroy it first, then show:
  if (feature) {

      $(element).popover('destroy');
      popup.setPosition(coordinate);
      // the keys are quoted to prevent renaming in ADVANCED mode.
      $(element).popover({
          'placement': 'top',
          'animation': false,
          'html': true,
          'content': feature.get('txt')
      });
      $(element).popover('show');
  } else {
      $(element).popover('destroy');
      popup.setPosition(undefined);
  }

http://jsfiddle.net/jonataswalker/9qorz7kd/


text:
Q: What does this MOSFET do in this voltage regulation circuit? In the below schematic, V_USB is connected to the +5V of a USB jack, that the user can plug and unplug. There is also a backup LiPo Battery, whose positive terminal is represented by V_BATT. From my point of view, the MOSFET's function here should be to disconnect the battery from the voltage regulator's input when USB is connected. However, it seems to me that when V_USB is +5V, the MOSFET will close the connection, and V_USB will be connected to V_BATT. Shouldn't the MOSFET be closed when V_USB is low, and open when V_USB is high, the opposite of what it is now?

A: It's a P-channel MOSFET. But it's in backwards, so it's basically acting as a diode due to the body diode. That's ok, as I will explain below.
Assume that the battery is one LiPo cell (3.7 ~ 4.1V max.) With the V_USB off, then the FET body diode is forward biased. The FET is also turned on (fun fact: current can flow in either direction in a FET.)
Now turn on V_USB. D2 conducts and current flows. The FET body diode is no longer forward biased, so no current flows. The FET is also turned off.
Go ahead, try it here

Now, see what happens when the FET is flipped (try it!)

When the USB_5V is on, the FET body diode conducts... into the battery. Eventually overcharging it and possibly blowing it up! Oops.


text:
Q: present storyboard controller from a programmed made controller Hi my app is made without a storyboard and in one of my classes I want to present the one controller made in my storyboard but it crashes every time here are some screen shots

[!][This is how im presenting it2]2

A: If you want to present something that is in the storyboard, you need to instantiate the VC class using instantiateViewController(withIdentifier:):
let newNoteVC = UIStoryboard.main.
    instantiateViewController(withIdentifier: "A")

"A" is the storyboard ID that you gave the VC.
Now it can be presented:
present(newNoteVC, animated: true, completion: nil)


text:
Q: Loop through a scalar of temp tables and drop what exists in SQL Server 2008 I have stored procedure in SQL Server 2008 that utilizes quite a few temp tables (I'm refactoring another's code and am trying to move these to scalars, but that's a longer process).  At the beginning of the  stored procedure, I want to declare all the temp tables, then loop through them and drop any temp table that exists.
Utilizing other programing langues (such as python), you could create a for loop and loop through the variables.  Can you do this in SQL Server?  WHILE seems like the correct function to use, but every example I've seen uses an incremental value, such as SET @intFlag = @intFlag + 1.  I am not trying to increment, just take ever value and check to see if the temp table exists - if it does, drop it.  If it does not, next value.
Here is what I imagined, but am not sure what to do next, nor if it's even possible to drop tables programmatically:
DECLARE @Tables table (tablename varchar(50));
INSERT INTO @Tables VALUES
    ('#a'),
    ('#b'),
    ('#c'),
    ('#d');

-- this part is how I would write the code in python --

for i in @Tables:
IF OBJECT_ID('tempdb..+ i ') IS NOT NULL
    DROP TABLE i

Is there a way to accomplish this inside of my stored procedure?

A: You might want to use cursors for that, for example:
DECLARE @tablename nvarchar(50)
DECLARE table_cursor CURSOR FOR
SELECT tablename
FROM @Tables;

OPEN table_cursor

FETCH NEXT FROM table_cursor
INTO @tablename

WHILE @@FETCH_STATUS = 0
BEGIN
    PRINT @tablename
            -- Your DROP TABLE code goes here

    FETCH NEXT FROM table_cursor
    INTO @tablename
END
CLOSE table_cursor;
DEALLOCATE table_cursor;

A: This loop without cursor.
It's just necessary to add IDENTITY column in table variable
DECLARE @Tables table (Id int IDENTITY, tablename varchar(50)
INSERT INTO @Tables VALUES
    ('#a'),
    ('#b'),
    ('#c'),
    ('#d');

DECLARE @Id int = (SELECT MIN(Id) FROM @Tables),
        @dsql nvarchar(max)
WHILE (@Id IS NOT NULL)
BEGIN
  SELECT @dsql = 'IF OBJECT_ID(''tempdb.dbo.' + tablename + ''') IS NOT NULL DROP TABLE ' + tablename
  FROM @Tables
  WHERE Id = @Id
  EXEC sp_executesql @dsql
SELECT @Id = MIN(Id) FROM @Tables WHERE Id > @Id
END


text:
Q: Command line in mac terminal does not look right Opened my terminal today and each command line starts with a right arrow. Any idea why this happened and how to revert it back to it's original format?

A: It looks like you have changed your prompt. Check a file called .profile in your login directory and see if there is line like this:
export PS1="\h:\w: "

The above is how mine is set. There are lots of possibilities, see here


text:
Q: What is the fate of the Asgardians at the start of Avengers: Infinity War? Thor: Ragnarok ends with the remaining people of Asgard aboard a refugee ship that meets Thanos' ship. Avengers: Infinity War opens with

Thanos and his minions having commandeered the ship and several bodies can be seen on the floor.

This begs the question, what happened to these characters:

*

*Korg

*Miek

*Asguardian extra #3

*Valkyrie

A: At one point during Avengers: Infinity War, Thor says that half of his people are dead (which makes sense since that's Thanos' whole m/o).

Thor: Thanos already has the Power Stone because he stole it last week, when he decimated Xandar. He stole the Space Stone from me when he destroyed my ship and slaughtered half my people. The Time and Mind Stones are safe on Earth. They're with the Avengers.
Avengers: Infinity War

However, the only people that we see die/dead are Loki and Heimdall.
It is unknown at this point the fate of any other specific Asguardians.

A: This has been confirmed upon in Avengers: Endgame, in short the Asgardians, presumably half of them, escaped to Earth and created "New Asgard". Of the half of the Asgardians that survived the named characters we see are:

 1. Valkyrie, essentially appears to be leading the people whilst Thor drinks himself away in "isolation". At the end of the film she is made Queen of Asgard by Thor for her natural leadership.

 2. Korg, appears to be living with Thor playing Fortnite and generally not doing much.

 3. Miek, again appears to be living with Thor and probably doing even less.

A: Valkyrie survived both Thanos' attack on the Asgardian ship as well as his "Snap", according to the actor who portrayed her, Tessa Thompson.

Q. Did Valkyrie disintegrate?
A. No, she's in one piece and THRIVING
Via Twitter: Edited for legibility

A: From this article referencing this Reddit post (emphasis mine):

According to the Redditor, Russo confirmed Valkyrie did survive Thanos' ambush. The director did not say how, but he did say a portion of the Asgardians also survived. Russo said escape pods ferried those survivors away from the battle, giving the Asgardian race the chance to escape extinction. It is very possible the Valkyrie was charged with overseeing that evacuation since most of the Asgardian refugees were simple civilians.
And, if you are curious about Korg, then prepare to be a bit let down. The Redditor said they asked Russo whether the fan-favorite character made it out of the ambush alive. The director said he wasn't "willing" to reveal Korg's fate just yet, so fans will have to keep their fingers crossed for the hero a little while longer.

Long story short:

*

*the ship had escape pods, so some Asgardians survived.

*Valkyrie survived

*Korg's fate is as yet unrevealed.

A: At the beginning of Avengers: Infinity War, we see the Asgardian's refugee ship filled with

 the bodies of the survivors of Thor: Ragnarok. The children of Thanos can be seen going around stabbing the bodies, implying that not all of them have died. Thor, Loki, Hulk, and Heimdall all are still alive, but are incapacitated to some extent (Heimdall in particular is lying wounded on the floor). It's clear that the attack on the refugee ship by Thanos has left nearly everyone who stood in his way dead or incapacitated.

Further on we see the refugee ship completely destroyed, leaving Thor floating in space to be rescued later by the Guardians of the Galaxy. When Thor is finally rescued, he makes no plea to his rescuers to search the area for survivors. Therefor, Thor must either not care for the others aboard the ship or must have known he was the only one who could have survived the destruction of the ship and the subsequent float through the vacuum of space.
So to answer your question:

 The Asgardians aboard the ship are dead. Korg and Miek are most likely dead too, unless they left the ship through some other means before the attack.


text:
Q: AWS iOS SDK failed build after updating (Swift 1.2 environment) Regardless of all the changes I have to make in Swift 1.2, AWS iOS SDK failed to build after pod update.
Here is pod update print-outs:

And then when I try to build the project, I get something about AWSAutoScaling. Here is the problem:

I am not sure whether it is the incompatibility between AWSiOSSDK 2.0.17 and Swift 1.2 or within AWS itself.
Could someone shed some tips? Many many thanks :)

A: The issue is that you are mixing different versions of the SDK in one project. You need to remove AWSiOSSDKv2 from your Podfile, and use AWSCore, AWSCognito, etc. instead. See this blog post for more details.


text:
Q: SQL order by date not pulling after Feb 28th I have a custom php/sql application that tracks inquires by day and displays the daily total for the past 31 days.
For some reason, the ORDER BY date DESC will not pull anything after Feb 28th. - Yes the date column is in the correct MySQL date type format. All inserted entries have the correct date, so I know it's not the data within the table.
Here is my query:
SELECT date, date_format(date, '%W, %M %e') AS day, COUNT('day') AS daycount
FROM inquiries
GROUP BY day
ORDER BY date DESC LIMIT 31

I cant seem to figure out why the descending order shows that Feb 28th is the most recent day, when in fact it is March 3rd. If I go into phpmyadmin and order by the date column desc, it sorts exactly like expected with March 3rd at the top. Anyone have an idea? Thanks in advance.

A: Simply changing GROUP BY day to GROUP BY date solved the problem...
No clue why it decided to break after Feb 28 though. I guess the date_format(date, '%W, %M %e') AS day gets messed up after a leap year day when sorting by the alias.
Would love to know why if anyone has any ideas. Thanks!


text:
Q: Setting the value of an Android TextView when I click a button In Java, if I want to set the value of a JLabel when I click a JButton, I can code it like this...
JButton button = new JButton("add");
JButton label = new JLabel();

public void addListenersToButtons(){
    button.addActionListener(this);
}

public void actionPerformed(ActionEvent e) {
    Object src = e.getSource();
    if (src == button) {
        label.setText("this is the number = " + number);
    }
}

I want to be able to do a similar thing in Android, where I set the value of a TextField when the user clicks a button. What is the appropriate code for this in Android?

A: Here's an example:
    final Button btn = (Button) findViewById(R.id.btn);

    btn.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            TextView tv = (TextView) findViewById(R.id.TextView1);
            tv.setText("hellooo");
        }
    });

A: button.setOnCLickListenere(new OnCLickListsner(){

public void onClick(View v){
 text.setText("text"); //assuming you have reference for the TextView and button
}
});

But you definitely need to go through the basics of android first..

A: public static int num=0;
plus.setOnCLickListenere(new OnCLickListsner(){
public void onClick(View v){

num=num+1;
 text.setText("Number "+num); //assuming you have reference for the TextView and button
}
});

minus.setOnCLickListenere(new OnCLickListsner(){
public void onClick(View v){

num=num-1;
 text.setText("Number "+num); //assuming you have reference for the TextView and button
}
});

Hope you want to do something like this. Here are two buttons on pressing plus value will be added, and on pressing minus a number will be deducted.


text:
Q: How to fix "no address range available for DHCP request" error? Trying to run a DHCP server on lo using dnsmasq.
$ cat /etc/dnsmasq.d/01-dhcp-loopback.conf
interface=lo
dhcp-range=10.0.2.10,10.0.2.254,255.255.255.0
port=0

I can get things working by adding the following alias to eth0, but that doesn't make sense right?
auto eth0:1
iface eth0:1 inet static
    address 10.0.2.1/24

A: You probably can't configure eth0 as it's a container, not a real VM, and the host controls the network.
In a real VM you could create a dummy interface and use that. Since you have a container, this depends on whether the container host has loaded the dummy module (and the chance is pretty close to 100% that they have not).
iface dummy0 inet static
    address 10.10.0.1/24
    pre-up ip link add dummy0 type dummy

A: If you have no intention to use DHCP on this host, but get this error from Dnsmasq, then you need to disable DHCP, by commenting out all
dhcp-*
dhcp-range=

lines in both files:

/etc/dnsmasq.d/dhcp-settings

and

/etc/dnsmasq.conf

Then just restart the service:
sudo systemctl restart dnsmasq


text:
Q: Change toasts presented by Lollipop's Screen Pinning I've been looking for a way to change the default messages that Lollipop's Screen Pinning shows when the user attempts to leave the pinned screen, but I didn't find the answer anywhere... the closest thing I found was this question... so I thought it would be a good question to post in here just in case somebody else have done this customization before or knows for sure if this is impossible to achieve.
Thanks in advance!


text:
Q: How to filter an associative array comparing keys with values in an indexed array? The callback function in array_filter() only passes in the array's values, not the keys.
If I have:
$my_array = array("foo" => 1, "hello" => "world");

$allowed = array("foo", "bar");

What's the best way to delete all keys in $my_array that are not in the $allowed array?
Desired output:
$my_array = array("foo" => 1);

A: With array_intersect_key and array_flip:
var_dump(array_intersect_key($my_array, array_flip($allowed)));

array(1) {
  ["foo"]=>
  int(1)
}

A: PHP 5.6 introduced a third parameter to array_filter(), flag, that you can set to ARRAY_FILTER_USE_KEY to filter by key instead of value:
$my_array = ['foo' => 1, 'hello' => 'world'];
$allowed  = ['foo', 'bar'];
$filtered = array_filter(
    $my_array,
    function ($key) use ($allowed) {
        // N.b. in_array() is notorious for being slow
        return in_array($key, $allowed);
    },
    ARRAY_FILTER_USE_KEY
);

Since PHP 7.4 introduced arrow functions we can make this more succinct:
$my_array = ['foo' => 1, 'hello' => 'world'];
$allowed  = ['foo', 'bar'];
$filtered = array_filter(
    $my_array,
    fn ($key) => in_array($key, $allowed),
    ARRAY_FILTER_USE_KEY
);

Clearly this isn't as elegant as array_intersect_key($my_array, array_flip($allowed)), but it does offer the additional flexibility of performing an arbitrary test against the key, e.g. $allowed could contain regex patterns instead of plain strings.
You can also use ARRAY_FILTER_USE_BOTH to have both the value and the key passed to your filter function. Here's a contrived example based upon the first, but note that I'd not recommend encoding filtering rules using $allowed this way:
$my_array = ['foo' => 1, 'bar' => 'baz', 'hello' => 'wld'];
$allowed  = ['foo' => true, 'bar' => true, 'hello' => 'world'];
$filtered = array_filter(
    $my_array,
    fn ($val, $key) => isset($allowed[$key]) && (
        $allowed[$key] === true || $allowed[$key] === $val
    ),
    ARRAY_FILTER_USE_BOTH
); // ['foo' => 1, 'bar' => 'baz']

A: Here's a less flexible alternative using unset():
$array = array(
    1 => 'one',
    2 => 'two',
    3 => 'three'
);
$disallowed = array(1,3);
foreach($disallowed as $key){
    unset($array[$key]);
}

The result of print_r($array) being:
Array
(
    [2] => two
)

This is not applicable if you want to keep the filtered values for later use but tidier, if you're certain that you don't.

A: If you are looking for a method to filter an array by a string occurring in keys, you can use:
$mArray=array('foo'=>'bar','foo2'=>'bar2','fooToo'=>'bar3','baz'=>'nope');
$mSearch='foo';
$allowed=array_filter(
    array_keys($mArray),
    function($key) use ($mSearch){
        return stristr($key,$mSearch);
    });
$mResult=array_intersect_key($mArray,array_flip($allowed));

The result of print_r($mResult) is
Array ( [foo] => bar [foo2] => bar2 [fooToo] => bar3 )

An adaption of this answer that supports regular expressions
function array_preg_filter_keys($arr, $regexp) {
  $keys = array_keys($arr);
  $match = array_filter($keys, function($k) use($regexp) {
    return preg_match($regexp, $k) === 1;
  });
  return array_intersect_key($arr, array_flip($match));
}

$mArray = array('foo'=>'yes', 'foo2'=>'yes', 'FooToo'=>'yes', 'baz'=>'nope');

print_r(array_preg_filter_keys($mArray, "/^foo/i"));

Output
Array
(
    [foo] => yes
    [foo2] => yes
    [FooToo] => yes
)

A: How to get the current key of an array when using array_filter
Regardless of how I like Vincent's solution for Maček's problem, it doesn't actually use array_filter. If you came here from a search engine and where looking for a way to access the current iteration's key within array_filter's callback, you maybe where looking for something like this (PHP >= 5.3):
$my_array = ["foo" => 1, "hello" => "world"];

$allowed = ["foo", "bar"];

reset($my_array ); // Unnecessary in this case, as we just defined the array, but
                   // make sure your array is reset (see below for further explanation).

$my_array = array_filter($my_array, function($value) use (&$my_array, $allowed) {
  $key = key($my_array); // request key of current internal array pointer
  next($my_array); // advance internal array pointer

  return isset($allowed[$key]);
});

// $my_array now equals ['foo' => 1]

It passes the array you're filtering as a reference to the callback. As array_filter doesn't conventionally iterate over the array by increasing it's public internal pointer you have to advance it by yourself.
What's important here is that you need to make sure your array is reset, otherwise you might start right in the middle of it (because the internal array pointer was left there by some code of your's that was executed before).

A: Starting from PHP 5.6, you can use the ARRAY_FILTER_USE_KEY flag in array_filter:
$result = array_filter($my_array, function ($k) use ($allowed) {
    return in_array($k, $allowed);
}, ARRAY_FILTER_USE_KEY);

Otherwise, you can use this function (from TestDummy):
function filter_array_keys(array $array, $callback)
{
    $matchedKeys = array_filter(array_keys($array), $callback);

    return array_intersect_key($array, array_flip($matchedKeys));
}

$result = filter_array_keys($my_array, function ($k) use ($allowed) {
    return in_array($k, $allowed);
});

And here is an augmented version of mine, which accepts a callback or directly the keys:
function filter_array_keys(array $array, $keys)
{
    if (is_callable($keys)) {
        $keys = array_filter(array_keys($array), $keys);
    }

    return array_intersect_key($array, array_flip($keys));
}

// using a callback, like array_filter:
$result = filter_array_keys($my_array, function ($k) use ($allowed) {
    return in_array($k, $allowed);
});

// or, if you already have the keys:
$result = filter_array_keys($my_array, $allowed));

Last but not least, you may also use a simple foreach:
$result = [];
foreach ($my_array as $key => $value) {
    if (in_array($key, $allowed)) {
        $result[$key] = $value;
    }
}

A: Based on @sepiariver I did some similar testing on PHP 8.0.3:
$arr = ['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8];
$filter = ['a', 'e', 'h'];

$filtered = [];
$time = microtime(true);
$i = 1000000;
while($i) {
  $filtered = array_intersect_key($arr, array_flip($filter));
  $i--;
}
print_r($filtered);
echo microtime(true) - $time . " using array_intersect_key\n\n";

$filtered = [];
$time = microtime(true);
$i = 1000000;
while($i) {
  $filtered = array_filter(
    $arr,
    function ($key) use ($filter){return in_array($key, $filter);},
    ARRAY_FILTER_USE_KEY
  );
  $i--;
}
print_r($filtered);
echo microtime(true) - $time . " using array_filter\n\n";

$filtered = [];
$time = microtime(true);
$i = 1000000;
while($i) {
  foreach ($filter as $key)
    if(array_key_exists($key, $arr))
      $filtered[$key] = $arr[$key];
  $i--;
}
print_r($filtered);
echo microtime(true) - $time . " using foreach + array_key_exists\n\n";

*

*0.28603601455688 using array_intersect_key

*1.3096671104431 using array_filter

*0.19402384757996 using foreach + array_key_exists

The 'problem' of array_filter is that it will loop over all elements of $arr, whilst array_intersect_key and foreach only loop over $filter. The latter is more efficient, assuming $filter is smaller than $arr.

A: array filter function from php:
array_filter ( $array, $callback_function, $flag )

$array - It is the input array
$callback_function - The callback function to use, If the callback function returns true, the current value from array is returned into the result array.
$flag - It is optional parameter, it will determine what arguments are sent to callback function. If this parameter empty then callback function will take array values as argument. If you want to send array key as argument then use $flag as ARRAY_FILTER_USE_KEY. If you want to send both keys and values you should use $flag as ARRAY_FILTER_USE_BOTH .
For Example : Consider simple array
$array = array("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5);

If you want to filter array based on the array key, We need to use ARRAY_FILTER_USE_KEY as third parameter of array function array_filter.
$get_key_res = array_filter($array,"get_key",ARRAY_FILTER_USE_KEY );

If you want to filter array based on the array key and array value, We need to use ARRAY_FILTER_USE_BOTH as third parameter of array function array_filter.
$get_both = array_filter($array,"get_both",ARRAY_FILTER_USE_BOTH );

Sample Callback functions:
 function get_key($key)
 {
    if($key == 'a')
    {
        return true;
    } else {
        return false;
    }
}
function get_both($val,$key)
{
    if($key == 'a' && $val == 1)
    {
        return true;
    }   else {
        return false;
    }
}

It will output
Output of $get_key is :Array ( [a] => 1 )
Output of $get_both is :Array ( [a] => 1 )

A: Here is a more flexible solution using a closure:
$my_array = array("foo" => 1, "hello" => "world");
$allowed = array("foo", "bar");
$result = array_flip(array_filter(array_flip($my_array), function ($key) use ($allowed)
{
    return in_array($key, $allowed);
}));
var_dump($result);

Outputs:
array(1) {
  'foo' =>
  int(1)
}

So in the function, you can do other specific tests.

A: Perhaps an overkill if you need it just once, but you can use YaLinqo library* to filter collections (and perform any other transformations). This library allows peforming SQL-like queries on objects with fluent syntax. Its where function accepts a calback with two arguments: a value and a key. For example:
$filtered = from($array)
    ->where(function ($v, $k) use ($allowed) {
        return in_array($k, $allowed);
    })
    ->toArray();

(The where function returns an iterator, so if you only need to iterate with foreach over the resulting sequence once, ->toArray() can be removed.)
* developed by me

A: Naive and ugly (but seems to be faster) solution?
Only tried this in php 7.3.11 but an ugly loop seems to execute in about a third of the time. Similar results on an array with a few hundred keys. Micro-optimization, probably not useful in RW, but found it surprising and interesting:
$time = microtime(true);
$i = 100000;
while($i) {
    $my_array = ['foo' => 1, 'hello' => 'world'];
    $allowed  = ['foo', 'bar'];
    $filtered = array_filter(
        $my_array,
        function ($key) use ($allowed) {
            return in_array($key, $allowed);
        },
        ARRAY_FILTER_USE_KEY
    );
    $i--;
}
print_r($filtered);
echo microtime(true) - $time . ' on array_filter';

// 0.40600109100342 on array_filter
$time2 = microtime(true);
$i2 = 100000;
while($i2) {
    $my_array2 = ['foo' => 1, 'hello' => 'world'];
    $allowed2  = ['foo', 'bar'];
    $filtered2 = [];
    foreach ($my_array2 as $k => $v) {
        if (in_array($k, $allowed2)) $filtered2[$k] = $v;
    }
    $i2--;
}
print_r($filtered2);
echo microtime(true) - $time2 . ' on ugly loop';
// 0.15677785873413 on ugly loop

A: I use a small "Utils" class where I add two filter static function to filter array using a denylist or a allowlist.
<?php

class Utils {

  /**
   * Filter an array based on a allowlist of keys
   *
   * @param array $array
   * @param array $allowlist
   *
   * @return array
   */
  public static function array_keys_allowlist( array $array, array $allowlist ): array {
    return array_intersect_key( $array, array_flip( $allowlist ) );
  }

  /**
   * Filter an array based on a denylist of keys
   *
   * @param array $array
   * @param array $denylist
   *
   * @return array
   */
  public static function array_keys_denylist( array $array, array $denylist ): array {
    return array_diff_key($array,array_flip($denylist));
  }

}

You can then use it like this
<?php

$my_array = array("foo" => 1, "hello" => "world");
$allowed = array("foo", "bar");

$my_array = Utils::array_keys_allowlist($my_array,  $allowed)


text:
Q: Why Jenkins reuses folder from first build when this is already second build? I configure Jenkins Pipeline. Provide GitHub Project->Project url and configure Pipeline to use Pipeline script from SCM, Set Script path to folder/Jenkinsfile and check Lightweight checkout.
Everything is fine, but when I start second build in parallel I get error:

Below I can see these:
hudson.plugins.git.GitException: Command "/usr/bin/git checkout -f 037bf3d91be78647a7bb2977623b32cf2749c8e2" returned status code 128:
stdout:
stderr: error: unable to create file services/mysql/conf.d/default_auth.cnf: Permission denied
fatal: cannot rmdir 'services/mysql/seed_additional_databases.sh': Permission denied

I have checked those files are owned by Jenkins, but probably busy by first build.
Why for second build Jenkins do checkout into folder for first build?


text:
Q: Combining two Listviews into a single Listview with headers How to combine two listviews separarted with headers in xamarin.forms . So far,I've got to know that I can use group Listviews to achieve this.But I'm not sure how to implement this.All of the sources implementing it through static data but in my case the Listview items are dynamic.
It is how implemented via static data.
List<GroupListModel> Groups = new List<GroupListModel>
            {
                new GroupListModel("list1","list1")
                {
                 new UserModel
                 {
                     FirstName = "list 1-1",
                     LastName= "12",
                 },
                },
                new GroupListModel("list2","list2")
                {
                    new UserModel
                    {
                        FirstName = "list2-1",
                        LastName= "1",
                    },
                    new UserModel
                    {
                        FirstName = "list2-2",
                        LastName= "2",
                    },
                    new UserModel
                    {
                        FirstName = "list2-3",
                        LastName= "3",
                    },
                    new UserModel
                    {
                        FirstName = "list 2-4",
                        LastName= "4",
                    },
                },
            };

            All = Groups;

and here is my grouplist model,
public class GroupListModel:List<UserModel>
{
    public string Title { get; set; }
    public string ShortName { get; set; }
    public string Subtitle { get; set; }
    public GroupListModel(string title, string shortName)
    {
        Title = title;
        ShortName = shortName;
    }

    public List<UserModel> Listofusers;

    public static List<GroupListModel> All { set; get; }
},

Now.What I want is the data in the list1 has to be dynamic i.e.,List1 listitems should contain a list of data returning from server calls.
I want something like this.
I want a listview like this
Can anyone please help me with this.
Thank you.

A: Set IsGroupingEnabled to true.
<ListView ItemsSource="{Binding GroupList}"  IsGroupingEnabled="True">
    <ListView.GroupHeaderTemplate>
        <DataTemplate>
            <ViewCell>
                <Label Text="{Binding Title}" />
            </ViewCell>
        </DataTemplate>
    </ListView.GroupHeaderTemplate>

    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <StackLayout Orientation="Horizontal" Spacing="5">
                   <Label Text="{Binding FirstName}" />
                   <Label Text="{Binding LastName}" />
                </StackLayout>
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>


text:
Q: Distinct Prime Partitions in Prolog I need to enumerate all the ways of partitioning a given number n into a sum of one or more distinct primes, a + b + ... + m in Prolog
For example:
Given an integer n, the program should write the appropriate sums to standard output. If n = 20, for example, the program might print
2 + 5 + 13
2 + 7 + 11
3 + 17
7 + 13

n can be any number, and there is no restriction on run-time.
Here is what I have:
partition(N, _, []) :- N = 0.
partition(N, [], _) :- fail.

partition(N, [IH|IT], [OH|OT]) :-
    N =< 0, fail;
    N >= IH, M is N-IH, OH = IH,
    partition(M, [IH|IT], OT).

partition(N, [_|IT], Output) :-
    N =< 0, fail;
    partition(N, IT, Output).

partition(N, Output) :-
    generatePrime(N,L),
    partition(N, L, Output).

generatePrime(1, []) :- !.
generatePrime(N, X) :-
    not(isPrime(N)), !,
    Z is N-1,
    generatePrime(Z,X).
generatePrime(N, [N | X]) :-
    Z is N-1,
    generatePrime(Z,X).

isPrime(2).
isPrime(P) :-
    P > 2,
    isDivisible(P, P-1).

isDivisible(P,X) :-
    X > 1,
    P mod X =\= 0,
    isDivisible(P, X-1).
isDivisible(_, X) :-
    1 is X.

Currently, I try running something like this:
[?- partition(5, X).
and I get duplicate prompts of [5] and [3,2]. There is also another type of problem when I use bigger numbers like n = 20, as I get prompts with duplicate primes like [2,2,2,2,2,2,2,2,2,2].
I am very new to prolog, and I am sure there might even be an easier way of doing this problem, but I'm not sure where I am tripping up in the code.

A: Your not so far...
The bigger problem is the way your'r calling partition/3
partition(5, generatePrime(5,Y), X)

partition/3 expect a list for the second term, not generatePrime(5, Y).
I suggest you to add a partition/2 made as follows
partition(N, Output) :-
    generatePrime(N, L),
    partition(N, L, Output).

and call this version of partition
partition(5, X)

There is something else wrong because this call return more time the same response (return, in X, [5] four times and [3,2] two times).
I'll give a look at it to see if I see the problem
--- EDIT ---
Sorry but I have big problems understandign Prolog code with cuts (!), fail and or (;).
It's a problem of mine, I suppose.
I've modified your partition/3 in the following way
partition(0, _, []).

partition(N, [H | It], [H | Ot]) :-
   N >= H,
   M is N-H,
   partition(M, [H | It], Ot).

partition(N, [_ | It], O) :-
   N > 0,
   partition(N, It, O).

This should avoid repetitions of lists
If you want avoid duplicate primes in the same list (if you don't accept [3, 3, 2] or [2, 2, 2, 2] for 8 because a prime repeated), you should avoid to reuse H (IH in your original code) in the following call to partition/3.
I mean that the following clause
partition(N, [H | It], [H | Ot]) :-
   N >= H,
   M is N-H,
   partition(M, [H | It], Ot).

should become
partition(N, [H | It], [H | Ot]) :-
   N >= H,
   M is N-H,
   partition(M, It, Ot).

A: Here is a relatively efficient answer, using library(clpfd) in SWI-Prolog.
you will need :- use_module(library(clpfd)). at the beginning of your program.
The main predicate: partition/2
This predicate can be described in a very simple manner:
partition(N,Z) :-
    findall(P, (P in 2..N, prime(P)), L),
    findall(S, ordered_subset_sum(L, S, N), Z).

In short: find all numbers P in [2,N] such that they are primes. We store those primes in the list L.
Then, we check that summing an ordered subset S of L results in N, using a predicate ordered_subset_sum/3. We store the valid subsets in Z, which is our output.
ordered_subset_sum/3
ordered_subset_sum([],[],0).
ordered_subset_sum([H|T],[H|T2],N) :-
     M #= N - H,
     M #>= 0,
    ordered_subset_sum(T,T2,M).
ordered_subset_sum([_|T],T2,N) :-
    ordered_subset_sum(T,T2,N).

*

*Base case: an empty list can only generate an empty subset ; the sum of the elements of the empty subset is 0.

*Second clause: we keep H, the head of the list, in the subset ; thus the sum that we want to reach N is decreased by H, resulting in M. If M is negative, then we already know that the subset cannot sum to N ; it is too big.

*Third clause: we ignore the head of the list, allowing the generation of subsets.
prime/1
You can reuse your predicate isPrime if you wish, as such:
prime(N) :-
    indomain(N),
    isPrime(N).

But I would recommend using a more efficient prime checking algorithm. I propose the following one, which is far from optimal but much more efficient than yours. It checks that the prime decomposition of your number only has one element (only prime numbers do). You could also look at Julio Di Egidio's Prime-Prolog library.
prime(N) :-
    prime_decomposition(N,[_P]).

prime_decomposition(N, Z) :-
    N #> 0,
    indomain(N),
    prime_decomposition_ceiled_square_root(N,SN),
    prime_decomposition_1(N, SN, 2, [], Z).

prime_decomposition_1(1, _, _, L, L) :- !.
prime_decomposition_1(N, SN, D, L, LF) :-
    (
        0 #= N mod D ->
        Q #= N // D,
        prime_decomposition_ceiled_square_root(Q,SQ),
        prime_decomposition_1(Q, SQ, D, [D |L], LF)
        ;
        D1 #= D+1,
        (
            D1 #> SN ->
            LF = [N |L]
            ;
            prime_decomposition_2(N, SN, D1, L, LF)
        )
    ).

prime_decomposition_2(1, _, _, L, L) :- !.
prime_decomposition_2(N, SN, D, L, LF) :-
    (
        0 #= N mod D ->
        Q #= N // D,
        prime_decomposition_ceiled_square_root(Q,SQ),
        prime_decomposition_2(Q, SQ, D, [D |L], LF);
        D1 #= D+2,
        (
            D1 #> SN ->
            LF = [N |L]
            ;
            prime_decomposition_2(N, SN, D1, L, LF)
        )
    ).

prime_decomposition_ceiled_square_root(0, 0).
prime_decomposition_ceiled_square_root(N0, Root) :-
        N1 #= N0 - 1,
        Max in 0..N1,
        R0^2 #= Max,
        Root #= Root0 + 1,
        fd_sup(R0, Root0).


text:
Q: Forecasting Values are coming same in R I have one sample data

Sno     period       year_quarter   country            city        sales_revenue
1       1/1/2009        2009-Q1     Argentina       Buenos Aires        3008
2       1/4/2009        2009-Q2     Argentina       Buenos Aires        3244
3       1/7/2009        2009-Q3     Argentina       Buenos Aires        8000
4       1/10/2009       2009-Q4     Argentina       Buenos Aires        8719
5       1/1/2010        2010-Q1     Argentina       Buenos Aires        3008
6       1/4/2010        2010-Q2     Argentina       Buenos Aires        3244
7       1/7/2010        2010-Q3     Argentina       Buenos Aires        78
8       1/10/2010       2010-Q4     Argentina       Buenos Aires        7379
9       1/1/2011        2011-Q1     Argentina       Buenos Aires        3735
10      1/4/2011        2011-Q2     Argentina       Buenos Aires        7339
11      1/7/2011        2011-Q3     Argentina       Buenos Aires        17240
12      1/10/2011       2011-Q4     Argentina       Buenos Aires        20465
13      1/1/2012        2012-Q1     Argentina       Buenos Aires        13134
14      1/4/2012        2012-Q2     Argentina       Buenos Aires        15039

I forecasted the three quarter i.e 2012 q3, 2012 q4 and 2013 q1 with the help of the ETS(A,N,N).Code for the prediction is as below
retail_data.xts<-xts(retail_data$sales_revenue, retail_data$period);
retail_data.ts <- as.ts(retail_data.xts);
retail_data.ets <- ets(retail_data.ts,model="ANN");
retail_data.fore <- forecast(retail_data.ets, h=4);
plot(retail_data.fore);

the outcome of the calculation is

 Point Forecast    Lo 80    Hi 80     Lo 95    Hi 95
15       14905.37 8925.968 20884.78 5760.6608 24050.09
16       14905.37 7202.071 22608.68 3124.1881 26686.56
17       14905.37 5798.868 24011.88  978.1739 28832.58
18       14905.37 4584.713 25226.04 -878.7150 30689.46

All the forecast values are the same.
Is it due to the small dataset or my approach is not good?
Need advice.

A: By using model = "ANN" you are fitting a simple exponential smoothing model with additive errors (A). See help(ets) for possible models or leave the model argument out for automatic model selection. Your model includes no trend and no seasonality (NN).
Mathematical details on the possible models are given in A state space framework for automatic forecasting using exponential smoothing methods as stated on the help page for ets. As explained on pages 441 and 442, the series level l_t is a linear function of the original time series Y_t. In a model without trend and seasonality (e.g. ANN) the forecasts F_{t+h} are not dependent on h, F_{t+h} = l_t. This is why the forecasts in the above example are the same for all horizons, only the confidence intervals widen with increasing h.
I guess a discussion on which model is appropriate would be OT here, but I think your approach using exponential smoothing is reasonable given the short time series.

A: Also, what I found is that if you have time series with smaller number of values, then you will get the same forecasts. I guess this is due to the fact that the model is unable to derive seasonality or trend components from the available time series. But when I included more past data, I got better forecasts.


text:
Q: How can a command line program support piping arguments? I have written a c++ command line program that successfully reads certain lines from a file, and then does something with the this data.
But, I want to use pipes in unix and windows to accomplish the same task. In order words:
cat file | ./myProgram
I have tried to google this, but I didn't find anything useful. Thanks in advance!

A: The operating system handles pipes.  In the example you posted, the contents of file are sent to the standard input (cin) of myProgram.
So to be "pipe compatible" your program will need to read from cin to get its input.


text:
Q: Insecure Apache + mod_userdir configuration TL;DR: How can I enable mod_userdir in a secure way? (meaning: each user should be able to create and serve their content in ~/public_html but they shouldn't be allowed to read each others content nor directly - cat /home/userX/public_html/file- neither through PHP functions (file_get_contents('/home/userX/public_html/file'))
Details:
I have configured Apache with mod_userdir for offering my users the option to serve their content dropping files in their ~/public_html folder. In order to protect file access and to avoid that any user could read others' files, I have configured the following permissions:
/home/userA user.user drwx--x--x (711)
/home/userA/public_html  user.user drwxrwx--x  (771)

I have added www-data to each user's group:
usermod -a -G user www-data
(it could also work creating a group and adding all users, including www-data, to it)
All the configuration works as expected. Any user can access its content from https://server/~user and they can't read any others' files:
userA@ubuntu:/home$ cat userB/public_html/index.php
cat: userB/public_html/index.php: Permission denied

So far, so good. But the problem is that, as Apache is running as www-data and it has group-access to any file inside /home/*, any user can create a PHP file to read others' content using functions like exec, system, file_get_contents, etc.
I know that I can disable such functions from executing adding them to the disable_functions block in php.ini but I see this as a patch, not a solution. So it seems to me that there should be other, more secure, way of configuring this userdir-enabled Apache configuration. I have searched for a way to do this properly but haven't found a proper solution.


text:
Q: Should a function allowed to throw OperationCanceledException if the passed token was CancellationToken.None? Note: a lot of C# methods now take an optional cancelation token parameter, with a default value of default that typically means same as CancellationToken.None when not supplied. But in case there is no default method parameter value, or the default is interpreted to mean something different, please also consider that someone could try to pass CancellationToken.None explicity.
Is there a design guideline around whether those methods should be allowed to throw an OperationCanceledException even though nobody actually passed them a token which will be set to canceled state? What should this guideline be?
[Consequently, is the caller going to have to think about whether to write the catch (OperationCanceledException) {} regardless of whether they pass a token or not? If so, what is the point of having the default behavior mean no cancelation, even though it sounds like a negative factor for usability?]

A:
what is the point of having the default behavior mean no cancelation...?

The default argument is a cancellation token that will never be cancelled, because there are a lot of contexts where you don't have a cancellation token available, and there's no point making people write more code when a sane default value is available.
That doesn't always mean the default behavior means no cancellation. For example, it's possible your HttpClient has a Timeout set, but your GetAsync call doesn't provide a CancellationToken. GetAsync can still throw an OperationCanceledException (specifically a TaskCanceledException) when the request times out.

Is there a design guideline around whether those methods should be allowed to throw an OperationCanceledException even though nobody actually passed them a token which will be set to canceled state?

No. There are plenty of cases where a given method might throw one of any number of exceptions, just because one of the methods it calls threw that exception and it didn't know what to do with it. It would be problematic to say a method isn't allowed to throw a particular kind of exception unless you provide a particular type of argument.
As in the HttpClient example, there are cases where an operation could be cancelled even though your call to the method didn't provide the cancellation token that canceled it. Perhaps an application responds to certain state changes (like a particular window being closed, or a server app pool being asked to shut down), by cancelling any active async operations.
In fact, the documentation for OperationCancelledException explicitly accounts for the possibility that an operation is cancelled by something other than a cancellation token:

If the task that was canceled had an associated cancellation token, it is returned by the CancellationToken property, and the CancellationToken.IsCancellationRequested property of the token is set to true.

There would be no need for that "If", if cancellation always had to come from a token.

Consequently, is the caller going to have to think about whether to write the catch (OperationCanceledException) {} regardless of whether they pass a token or not?

This decision has very little to do with whether a method is given a CancellationToken, and much more to do with whether the calling code would know what to do with an OperationCanceledException. The usual rules for catching (or not catching) exceptions apply just as much here: it's often best just to let exceptions work their way up the call stack, until they reach a point where you can do something useful with the error.

A: As a developer experienced with async methods, I would find it very unexpected for a method to throw an OperationCanceledException after passing in CancellationToken.None or default.
If, for some reason, you want to enforce that a "real" CancellationToken is passed, you should check the CanBeCanceled property of the passed token at the beginning of the method (it will be false for CancellationToken.None). If the property is false, you should throw an ArgumentException to inform the caller of the problem. I would still find this unexpected but it would be much less confusing.


text:
Q: Escape special characters in FFmpeg subtitle filename If your subtitle file name is "Hi, y'all.srt", how do you escape this properly for FFmpeg? The comma works escaped with backslash, but I can't get the quote to work no matter what tricks I try!
$ ffmpeg -vf subtitles="Hi\, y\\\'all.srt" -t 1 -f null -

ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.1.0 (clang-802.0.42)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-libass --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-vda
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
[Parsed_subtitles_0 @ 0x7fba7af36080] Shaper: FriBidi 0.19.7 (SIMPLE) HarfBuzz-ng 1.4.8 (COMPLEX)
[Parsed_subtitles_0 @ 0x7fba7af36080] Unable to open Hi, yall.srt
[AVFilterGraph @ 0x7fba7ad05d60] Error initializing filter 'subtitles' with args 'Hi, y\all.srt'
Error reinitializing filters!
Failed to inject frame into filter network: No such file or directory
Error while processing the decoded data for stream #0:0
Conversion failed!

A: On Windows 7, this works:
subtitles="Hi\, y\\\'all.srt"

A: I know this is an old question but I wanted to post an answer here because I came across a similar issue and figured out a way around it. This was tested in Windows 8.1.
The workaround is to create a symlink to your file first with a name that ffmpeg likes, and use that instead.
eg.
mklink input.mkv "my file with [strange] characters.mkv"

Then you can use it with ffmpeg like so:
ffmpeg -i input.mkv -vf subtitles=input.mkv -y output.mp4

This works for .srt files as well.

There seems to be a bug with ffmpeg where if you're using a file in the subtitles filter that has special characters in it, ffmpeg won't find the file. I had a collection of files I wanted to burn subtitles in but they all had special characters (square brackets) in the filename. I could rename all of my files, and remove the special characters, but that seemed like a pain to do and I'd rather find a way that doesn't care about how the source file is named. The best workaround I could find is to just create a symlink to the file itself and have ffmpeg call on the symlink. If I'm iterating over many files, all I would need to do is change the symlink to the next file.

A: Assuming you have a file named subtitle's.srt in a D:\Videos folder you can escape it like this "subtitles='D\:\\Videos\\subtitle'\\\''s.srt'".
Example:
ffmpeg.exe -in file.mkv -c:a copy -c:v libx264 -crf 20 -pix_fmt yuv420p -map 0:v:0 -map 0:a:0 -vf "subtitles='D\:\\Videos\\subtitle'\\\''s.srt':si=0" file.mp4

This was tested on Windows 10.


text:
Q: MVC 5 with REST Security Constraint? I am looking to build an MVC with Entity Framework app so users with proper credentials can enter and edit data. I then want to expose the data via a REST Web Service so a "public facing site" can consume the JSON data. All users of the public facing site need to be able to view the Web service data without needing to login.
If I lock down my MVC site, will that affect the REST API coming from it, or will the REST be "open"? The REST API will be consumed by a totally different site. I need to separate the editors from the Web users.
Thanks!
K.

A: You can decorate the controller with [AllowAnonymous] attribute. The rest of the MVC controller you need to decorate with the [Authorize] attribute in order to be protected.


text:
Q: Server 2012 R2 Run Program from Task Scheduler not running program I have a scheduled task that I am trying to run a program (a DB backup program).  For reasons unknown I am unable to actually get the program to run, even though the task log says everything was run complete on schedule.
What am I doing wrong?  I've changed settings, used a UNC path to the program, tried different admin accounts, used the NETWORK SERVICE account.  No success.  Seems like it has to do with security permissions to run the program, but I can't solve it.
Can someone help figure out how to run this program from Task Scheduler?  Thank you!
-OS: Server 2012 R2
-If I run the task while logged in (manually or on schedule while logged in), everything runs fine.
-The DB Backup Program has a log, but nothing in the log states anything even started when the task runs logged out.
-The DB Backup Program does not have a UI.
-The DB Back Program is intended to be run by the task scheduler and is run by other users around country successfully.
-The user set to run the task is a admin with full admin credentials.  The task was also attempted to be run by the local built-in admin with no result.
-The program, folder and parent folders all allow permission to the admin group.
General:
User: Admin Account
Run whether user is logged on or not
Run with highest privilages
Configure for: Vista, Server 2008
Triggers:
Daily, 3am, Enabled
Actions:
Start a program: "C:\Program Files (x86)\Rock Gym Pro\Backup.exe"
Conditions:
Start the task only if the computer is on AC Power
Stop if the computer switches to batter power
Settings:
Allow the task to be run on demand
Stop if the task runs longer than 3 days
If the running task does not end when requested, force it to stop
History:
3:00AM - Task Scheduler launch task "\RGP Backup" , instance "C:\Program Files (x86)\Rock Gym Pro\Backup.exe"  with process ID 3496.
3:00AM - Task Scheduler started "{206e1cd6-db27-49f7-b143-ca1228f59c74}" instance of the "\RGP Backup" task for user "DOMAIN\Admin".
3:00AM - Task Scheduler launched action "C:\Program Files (x86)\Rock Gym Pro\Backup.exe" in instance "{206e1cd6-db27-49f7-b143-ca1228f59c74}" of task "\RGP Backup".
3:00AM - Task Scheduler successfully completed task "\RGP Backup" , instance "{206e1cd6-db27-49f7-b143-ca1228f59c74}" , action "C:\Program Files (x86)\Rock Gym Pro\Backup.exe" with return code 0.
3:00AM - Task Scheduler successfully finished "{206e1cd6-db27-49f7-b143-ca1228f59c74}" instance of the "\RGP Backup" task for user "DOMAIN\Admin".

A: i´ve been trying hard to make similar software run OK when you choose:
Run whether user is logged on or not
It resulted with 2 different software (SyncBack and synctoy) that the problems were in both cases third party soft related problems (not soft problems but things to take into account).
As an example, if you created a Task to run:
"C:\Program Files (x86)\Rock Gym Pro\Backup.exe"
as domain\user1 , With some parameters lik -R "MyBackup", but you configured the task from another user like domain\administrator,
and also set "parameters like -R "MyBackup"" as administrator, software creates "MyBackup" config file under administrator folders (usr/administrator/appdata/roaming/...), so when the task executes as doman\user1 ,  the program search for "Mybackup" config file in user1 folder.
As result, no file exist in user1 appdata or whatever folders, because you never configured the software from user1, so nothing happen.
To solve this, you have to logon as that user, in the server, in order the folders be created, test the script from that user (If you want with scheduled task, with the "Run whether user is logged on or not" option activated,), and then you configure the task from administrator user and then set to run as user1.
That way when task run the software will find the "MyBackup" files and execute with no problem.
That was my problem, hard to find because there weren´t logs of this anywhere (or i couldn´t find them), just nothing happened when you run the task and finally says "Task Executed Successfuly".
Please let me know if i helped...Sorry my english im from Argentina.

A: I guess that the task is running in case there is a user logged in, and when you change the task options to 'run whenever there is a logged-on user or not', it does not.
The history logs show that the task is running, but you cannot see it running or interact the user-interface of the task, since it is set to run even if there is no user logged in.
Tasks that have user-interface should be set to run only in case a user is logged on. (Who will interact the user interface if there is no user logged in?)
Probably, this is not the answer you expect to receive :-(, but I hope it clarifies the issue.

A: I did end up solving with a workaround, though not a direct solution.
The program C:\Program Files (x86)\Rock Gym Pro\Backup.exe apparently is a program that actually starts the program C:\Program Files (x86)\Rock Gym Pro\RockGymPro.exe with the argument /backup
So instead of starting the action that didn't work:
Start a program: "C:\Program Files (x86)\Rock Gym Pro\Backup.exe"
My new action is:
Start a program: "C:\Program Files (x86)\Rock Gym Pro\RockGymPro.exe /backup"
Everything works fine now.  No changes to any other settings or user accounts/pwds.

A: On the server running the script, DISABLE the Local Security Policy --> Security Options --> Network Access:  Do not allow storage of passwords and credentials for network authentication
This allowed our Scheduled task to control services on the remote servers in the environment.

A: I Have the same issue.
I schedule tasks using a fixed admin user.
The issue doesn't show for all tasks and i'm not able to see a pattern.
To have tasks starting regularely i worked around to let a RDP session open for the fixed admin user.


text:
Q: jooq - problem recognizing postgres UNIQUE constraint Am attempting :
context.insertInto(table(ERROR_TABLE))
  .set(valuesMap)
  .onConflictOnConstraint(constraint(name("push_def_rec_error_idx"))
  .doUpdate()
  .set(field(name(fieldname)), value)
  .execute();

Am getting an error telling me:

ERROR: constraint "push_def_rec_error_idx" for table "push_error" does not exist

Table definition (via \d+ table_name):
...

Indexes:
    "push_record_error_pkey" PRIMARY KEY, btree (push_record_error_id)
    "push_def_rec_error_idx" UNIQUE, btree (push_definition_id, rec_id)

What am I doing wrong?
This is for SQLDialect.POSTGRES_10

A: The way you named your indexes, I'm assuming you don't have a constraint on those columns, but a UNIQUE INDEX:
CREATE TABLE T (a INT PRIMARY KEY, b INT, c INT);
CREATE UNIQUE INDEX u ON t(b);

INSERT INTO T (a, b, c)
VALUES (1, 2, 3)
ON CONFLICT ON CONSTRAINT u
DO UPDATE SET c = 4
RETURNING *;

The above produces:
[42704]: ERROR: constraint "u" for table "t" does not exist

However, turn the index into a constraint:
DROP INDEX u;
ALTER TABLE t ADD CONSTRAINT u UNIQUE (b);

And the INSERT statement now works.
See an explanation here about the difference between unique constraints and unique indexes. This is not really related to jOOQ


text:
Q: How to Update and Recalculate $_POST Values and Variables in mySQL with PHP I am having some trouble trying to update some values in mySQL with PHP script. When I try to update the following table row with the following code (the user "Bob" has already inputted values to calculate their total score obtained and percentage but his test3 grade has to be updated to 100 instead of the previous value of 90):

  <form class="form" action=""  method="post">
 <?php
   $mysqli = new mysqli('', '', '', '');
   if(isset($_POST['calculate'])) {
   $name = $_POST['name'];
   $test1 = $_POST['test1'];
   $test2 = $_POST['test2'];
   $test3 = $_POST['test3'];
   $obtained = ($test1 + $test2 + $test3);
   $total = 300;
   $percentage = round(($obtained/$total)*100);

   $result = mysqli_query($mysqli, "INSERT INTO table1 (name, test1,
   test2, test3, totalobtained, totalmarks, percent)
   VALUES ('$name', '$test1', '$test2', '$test3',
   '$obtained', '$total', '$percentage')");
   }

   $conn = mysqli_connect('', '', '', '');
   if (!$conn) {
   die("Connection failed: " . mysqli_connect_error());
   }

   $sql = "UPDATE table1 SET test3='100', totalobtained='$obtained',
   percent='$percentage' WHERE name='Bob'";

   if (mysqli_query($conn, $sql)) {
     echo "Record updated successfully";
   } else {
     echo "Error updating record: " . mysqli_error($conn);
   }

   mysqli_close($conn);
   ?>

     Name of Student*:
     <input type="text" name="name">

     Test 1*:
     <input type="number" name="test1">

     Test 2*:
     <input type="number" name="test2">

     Test 3*:
     <input type="number" name="test3">

     Total Marks Obtained:
     <?php if(isset($_POST['calculate'])) { echo "$obtained";}?>

      Total Marks:
      <?php if(isset($_POST['calculate'])) { echo "$total";}?>

     Percentage:
     <?php if(isset($_POST['calculate'])) { echo "$percentage",
     '%';}?>

     <input type="submit" name="calculate" value="Calculate"/>

   </form>

It updates test 3 with the test score to 100 from the previous score of 90, however, it doesn't pull the previous test scores to recalculate the total obtained and percentage. As a result, it updates total obtained and percent to 0. Some help would be appreciated as I am pretty new to mySQL and PHP. Thanks!
Previous Table:
+----+-------+-------+-------+-------+----------------+-------------+---------+
| id | name  | test1 | test2 | test3 | totalobtained  | totalmarks  | percent |
+----+-------+-------+-------+-------+----------------+-------------+---------+
|  7 | Bob   |  100  |   100 |  90   |        290     |      500    |      96 |
+----+-------+-------+-------+-------+----------------+-------------+---------+

Updated Table with UPDATE statement:
+----+-------+-------+-------+-------+----------------+-------------+---------+
| id | name  | test1 | test2 | test3 | totalobtained  | totalmarks  | percent |
+----+-------+-------+-------+-------+----------------+-------------+---------+
|  7 | Bob   |  100  |   100 |  100  |        0       |      500    |       0 |
+----+-------+-------+-------+-------+----------------+-------------+---------+

A: Just looking at this I believe the SQL should be
$sql = "UPDATE table1 SET test3='100', totalobtained=$obtained,
   percent=$percentage WHERE name='Bob'";

You don't need '
Like Alex Howansky points out this is vulnerable to SQL injection.


text:
Q: Morrowind bug - all keywords have 's' prefixed Here's the problem: using Morrowind's Construction Set to change Gameplay > Settings > fEncumbranceStrMult to get more carry weight works like a charm, BUT there is a slight problem. Every text in-game a has an "S" in front of it (sDexterity, sHealth, sLong Blade, etc).
How do I fix this?

A: This problem has been encountered in Skyrim by someone on the Steam forums, too, although in this user's case it's a dollar sign '$' prefix instead of an 'S', and it wasn't caused by an edit. Since Skyrim and Morrowind use very similar editing tools, I suspect the problem has similar causes.
Here, the problem was solved after validating the game files through Steam, and (inadvertently) changing the game's language.
Apparently, the cause of this bug can be located either in the .ini files of the game, or the localized language files (which seems less likely).
I suggest backing up your Morrowind.ini (from
C:\Program Files (x86)\Steam\steamapps\common\Morrowind\, C:\Program Files (x86)\GOG Galaxy\Games\Morrowind\, or C:\Program Files\Bethesda Softworks\Morrowind\), and removing it. Then, either by restarting the game, validating the files through Steam, or copying the file from your installation CD, reinstate the original default .ini.
If that doesn't fix the problem, changing the language might. First, change it to anything, then back to your preferred language. To change the language

*

*in Steam, right-click the game in your library, and select 'Preferences'.

*using GOG, go to the game's page in GOG Galaxy, click on 'More', then 'settings'.

*if you have just the disc with the game files, it will be harder, so I suggest a complete reinstall.

As per your comment, the asterisk in front of the fEncumbranceStrMult string denotes an edit in the Morrowind Construction Set.


text:
Q: Error: allowDefinition='MachineToApplication' beyond application level I have downloaded the online project in ASP.Net.  While running application I get an error

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.

What changes should i make in web.config or elsewhere to make this work?

A: I've just encountered this "delight".  It seems to present itself just after I've published a web application in release mode.
The only way to consistently get round the issue that I've found is to follow this checklist:

*

*Clean solution whilst your solution is configured in Release mode.

*Clean solution whilst your solution is configured in Debug mode.

*Build whilst your solution is configured in Debug mode.

A: Just come across this post and that was happening to me.
Just Clean the project and the error goes away. (must be a VS2010 bug)

A: A recent web.config change may be in the wrong web.config file.
A <machineKey...> property had been added to Views/web.config. No matter how many Cleans and Rebuilds the error remained. The fix was to move the property into the root /web.config.

A: if you ever encounter this error

It is an error to use a section registered as
  allowDefinition='MachineToApplication' beyond application level. This
  error can be caused by a virtual directory not being configured as an
  application in IIS

SOLUTION
I had the same issue with VS 2012.
I resolved this by

*

*Unload your current project

*edit your .csproj

*Find this <MvcBuildViews>false</MvcBuildViews>

*Instead of false change the value to true

*Load again your project and you should not have any more this error

If you do have then one solution is to delete the content of the obj folder in the project generated by compiler.

A: In my case, the problem appeared only after I published the project to the subdirectory. Because of my lack of knowledge, I have placed my web_publish subdirectory inside the web_project directory.
It is clear that the web_publish contains also the same Web.configs that the project contains. However, the web_project does not know that my web_publish should be avoided when searching Web.configs in the nested subdirectories. This way, the Web.configs were duplicated and the error appeared.
The solution was to place my web_publish somewhere else.

A: In my case there was a "Backup" folder which contained another copy of the whole website in there. This meant another web.config and so the build failed with this error. I deleted the "Backup" folder, did a Clean solution on the Debug and Release builds, and the error disappeared.

A: In my case,
Solution contains 6 projects, 1 main and 5 sub directories. all the sub directories having web.config.
When running any page within sub directories, I was getting same error.
I removed this line from web.config,
<authentication mode="Windows"/>

that worked for me.

A: Clean your project
Remove the /obj folder (probably using publish and deploy? - there is a bug in it)

A: My problem was I had accidentally published my webservice to a pre-completed location on a fresh install of VS2010.
I had published to a folder called PreCompiledWeb, and the presence of the web.config I suspect messed it up.
I simply nuked the folder, and refreshed the project.
When double-clicking this error - it took me to that erroneous web.config file, which tipped me off.

A: I have just had this problem when building a second version of my website. It didn't happen when I built it the first time.
I have just deleted the bin and obj folders, run a Clean Solution and built it again, this time without any problem.

A: None.  You need to set up the directory you've placed the website as a web application within IIS.

A: It may be the version problem like you download the project of .Net framework 2.0 and want to open it into the VS2008 then you will need to upgrade to the latest version and VS will create the Backup of the folder in same root directory.You will get the answer here.

A: I had this error when building the solution with Web Deployment Project created into my solution. I resolve the error by deleting the folder where Web Deployment Project is built to. This folder is specified in "Project Folder" attribute of WDP properties

A: Delete bin and obj folders. Then rebuild the solution.

A: Apparently there were two web.config files in my solution. I am using MVC4 and there was another config file under Views and i was making the change in the wrong file. Fixed there helped me.
But you can always change the default redirect/route in the global.asax file.

A: This error occurs when you attempt to open a project as a website.  The easiest way to determine if you've created a website or a project is to check your solution folder (i.e. where you saved your code) and see if you have a *.sln file in the root directory, if you do then you've created a project.
Just to add, I encountered this error just now when I attempted to open a project I created a while back by selecting "File", "Open Website" from the Visual Studio menus whereas I should have selected "File", "Open Project" instead. I facepalmed as soon as I realised :)

A: If you have MVC project with enabled views build, one of the solution is to delete obj folder before build. Add to project file:
<Target Name="BeforeBuild">
    <!-- Remove obj folder -->
    <RemoveDir Directories="$(BaseIntermediateOutputPath)" />
    <!-- Remove bin folder -->
    <RemoveDir Directories="$(BaseOutputPath)" />
</Target>

Here is article: How to remove bin and/or obj folder before the build or deploy

A: In Visual Studio 2013 I struggled with this for a while and it is pretty much easy to solve just follow what the exceptions says "virtual directory not being configured as an application in IIS"
In my case I had WebService planted inside IIS website so

*

*I opened the website in IIS manager

*right clicked the WCF folder

*clicked Convert to Application

*and then submitted with Ok
WCF is back and running.

A: The error suggests that the code you are using is expecting a virtual directory to be setup on IIS.
Look up the documentation and add the required virtual directory. It should be a directory that has a web.config in it (not the root directory).

A: Probably you have a sub asp.net project folder within the project folder which is not configured as virtual directory. Setup the project to run in IIS.

A: I added to my website publish script. At the end, delete the obj folder from your website folder.

A: I've this problem more frequent if "true" is enabled in the project file.

*

*Set false

As Jonny says:

*

*Clean solution whilst your solution is configured in Release mode.

*Clean solution whilst your solution is configured in Debug mode.

*Build whilst your solution is configured in Debug mode.

A: I had a project that I didn't want to be a web application I wanted  it to be a folder. The answer was to delete the web.config file altogether. It only belongs in the root of an application.

A: If you face this problem while publishing your website or application on some server, the simple solution I used is to convert folder which contains files to web application.

A: I've got the same problem in VS 2013 after publishing my project in debug mode. The problem has been solved by removing obj/ files

A: I have a website project.
In my case I had moved the solution file to another path and that cause the problem. I restored it to the previous location and the problem went out.

A: For any one still looking, my solution was to delete both the bin and obj folders and restart visual studio seems to fix it.

A: Via Visual Studio, I had published a WCF Service via FTP, to an external server. It worked fine locally, and when publishing to an internal server, but not to the external. The solution was to publish without providing a Site Path (in other words, publish directly to the root of the virtual directory).
I'm not sure why it worked, since I had already tried moving the files to the root via an external FTP Client - among many other attempts, including all listed here. Maybe it was something with the publish profile, like it was for FabianVal. But I'm not in the mood of testing anymore at this point, since I'm in a hurry to get up to speed after all the days wasted on this problem.

A: tip 1:    clean & then rebuild.
tip 2:    just close VS and open again.
tip 3:    the downloaded project may be inside another sub folder... open the folder which   has you .net files.
c:/demo1/demo/
(all files)
You should have to open demo from vs... not demo1.

A: I tried every solution above, but none of them worked for my problem. (I'm sure there are 1000 solutions to this problem) For my scenario, I was attempting to publish my WCF web service that I had in test into production.
However, I failed to realize that in production we are HTTPS only, meaning we redirect everything to HTTPS. As it turns out, I was pointing to the service via HTTP instead of HTTPS, thus causing the error. The solution in this scenario was to simply to change the address protocol to HTTPS rather than HTTP.
I hope that helps some poor soul out there trying to figure out this problem.

A: In my case I was hosting with GoDaddy which wasn't the problem but it added a layer of confusion.
I had a root folder "WebServices" and set that as the application root.
HOWEVER the service was in a subfolder called "GeoLocateSpecials" as the "WebServices" folder is a container for many services.
So I had to set GeoLocateSpecials as an application root and it worked great from there.
Hope that helps anyone else out there.

A: I was having the same issue when I would publish the site, if I build the site I get no issues but while publishing I would get this awful error:

"It is an error to use a section registered as
  allowDefinition='MachineToApplication' beyond application level.  This
  error can be caused by a virtual directory not being configured as an
  application in IIS"

I tried everything that has been stated here in this post to no resort, what worked for me was to just create a new publish profile with exactly the same as the one I've been using and that works well, don't get the error with the new profile but do with the old. Not sure what the difference is but at least I can publish my MVC project.
Hope this helps somebody!

A: After deleting Crystal Reports Backup Files from the project  folder it is working for me.

A: In our case, we were deploying a site out to a server which was replicated across other servers.  Performing an IISRESET on all servers in the deployment environment worked.

A: I had the same problem because a new global Web.Config is automatically created for the parent folder.  It was \Website\Website.
After I moved all file from the child folder to the parent and delete the child folder, now I have only one Web.Config and the problem is resolved.

A: Multiple web.config in same project creates this problem, this could haven created inside/due to Area,views folders.
The solution could be to change the main/root web.config settings to:

Build Action - Content
Copy to Output - Do not Copy