text:
Q: Google Script Web App: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided does not match the recipient window's origin First of all I checked already this, this, this, this, this, this and this. And they don't seem to be a duplicate of my problem exactly.
I have a web app, generated by Google Script. In my Code.gs, inside my doGet(e) function, I have a routing mechanism for handling different webpages, which I simplified below in a if else statement block. The doGet(e) returns different pages based on the URL, meaning, if the URL ends in ?v=page1 it returns page1.html, if it ends in ?v=about it returns about.html, and so on. It all works fine if I type the whole thing in the Address URL space in the browser.
Now, my home.html has a menu with hyperlinks for those pages. The pages open fine if I click on the links, as long as the default target is _top.
Now, my problem is: I put an iframe below the menu so all the pages would open in the same home. They failed with error below:

Load denied by X-Frame-Options: "SAMEORIGIN" from
  "https://script.google.com/macros/s/AKfycbz80HBBQPcs-sYm9CsVNT7iyeBQjySR1FXN0TmgjKc/dev?v=page1",
  site does not permit cross-origin framing from
  "https://n-72ap4753yyujkagtmqc7xoskf2cznnrfk23rzbq-0lu-script.googleusercontent.com/blank".

I figured the reason would be the app was not published yet, so I publish the app and started returning page1.html with .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL). Now the error is:

Failed to execute 'postMessage' on 'DOMWindow': The target origin
  provided
  ('https://n-72ap4753yyujkagtmqc7xoskf2cznnrfk23rzbq-0lu-script.googleusercontent.com')
  does not match the recipient window's origin
  ('https://script.google.com').

The error seems to be related to the page hitting another address in googleusercontent.com and that could be causing the issue?
The home page:
As you can see below in my home.html, there are 3 links:
iframes opens the wikipedia article about HTML/Iframes in the iframe of my home.html, just fine.
Page1 should open my page1.html in my home.html iframe section, but that is where the error takes place.
about open the about.html as another page, on _top of everything, so it works fine. But as soon as the iframe issue is solved I will change the target for that one to open in the iframe as well.
My files are as below:
Code.gs:
function doGet(e) {
  Logger.log(e.parameters.v);
  if (e.parameters.v == "page1") {
    return HtmlService.createTemplateFromFile("page1").evaluate().setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
  } else if (e.parameters.v == "about") {
    return HtmlService.createTemplateFromFile("about").evaluate();
  } else
    return HtmlService.createTemplateFromFile("home").evaluate();
}

home.html:
<!DOCTYPE html>

    <base target="_top">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <?
      var url = ScriptApp.getService().getUrl();
      var imgLogo = "https://png2.cleanpng.com/sh/e2fa53a06dccb65dbd183cfa6b13c455/L0KzQYm3VsIzN5dmj5H0aYP2gLBuTgRpbV5rfd9qbHWwcsPoif4ucKZyedC2YoLkebA0kP9tgZh0hp9xdX3kfn7vhfFlNaF0hOtwb37kfH75ifZtcZ9sRadrMnTkRoPsWPJkQJI2RqU8OEa3Q4q4UcUzQWg2UKU6OEW6Qoe1kP5o/kisspng-the-female-brain-human-brain-polygon-human-head-polygonal-rifling-5b2da62e8bc8a1.3386439115297183185726.png";
    ?>

        <a href="<?= url ?>" class="brand-logo"><img id="img-logo" src="<?= imgLogo ?>">

IFrames

<a href="<?= url ?>?v=page1" target="iframePages">Page1

<a href="<?= url ?>?v=about">About

page1.html:
<!DOCTYPE html>

    <base target="_top">

Page 1

about.html:
<!DOCTYPE html>

    <base target="_top">

About

the URL:
https://script.google.com/macros/s/AKfycbxBBaGG_rZl1jAuNqDzL8O9un7bfn9Qm_cfA_nAjMxE1w-dl2U/exec

Error image:

Error in the console. Frame on the left hand side is empty.
Please keep in mind this is a simplified version of my full app which is providing the same behavior so I could share.
Can anyone please shed some light on this?


text:
Q: Selenium example code does not work, what is the wrong? I am new to python and learning selenium now. but when I download the selenium and try the example code provided by selenium it does not work at all.
the code is here
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()

the message from python is :
Traceback (most recent call last):
  File "<tmp 1>", line 4, in <module>
    driver = webdriver.Ie()
  File "c:\python27\lib\site-packages\selenium\webdriver\ie\webdriver.py", line 49, in __init__
    self.iedriver.start()
  File "c:\python27\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
    os.path.basename(self.path), self.start_error_message)
WebDriverException: Message: 'IEDriverServer.exe' executable needs to be in PATH. Please download from http://selenium-release.storage.googleapis.com/index.html and read up at https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver

I do not quite understand the problem. Help please.

A: 1) Download any driver to emulate the browser. Your message says you need to download IEDriverServer from:
http://selenium-release.storage.googleapis.com/index.html?path=3.0/
If you have 32-bits windows, download "IEDriverServer_Win32_3.0.0.zip", otherwise try the x64 version below.
2) Unzip the file and place anywhere. I placed for example in C:\libraryIE  (i created a folder).
3) in your code change the first line
driver = webdriver.Firefox('C:\libraryIE\IEDriverServer.exe')

redpajama_set_name: RedPajamaStackExchange


text:
Q: Are multiple tabs secure for submiting forms? I am trying to make an online shop that allow users to spend minimum time on checkout.
They have to select from 4 possibilities which i can make it two ways.
First i can make a select field with jquery to update the next fields from database or i can make 4 tabs and each of them have diferent forms that take data from database.
Bassicaly i want to ask what should i choose and i don't really know how to do it with jquery so if you suggest that way please post a tutorial if available cause i didn't found one related to updating select fields from database.
Second i need to know if choosing the tabs should cause any problem of security on posting form or something like that.
i use CI2.
Thank you in advance.

A: Thats true, sorry. Here a code fragment from one of my projects
$('select.myfield').change(function(){

    var data = $('select.myfield').val();
    $.ajax({
            url: 'Url/to/your/script',
            dataType: 'json',
            type: 'post',
            data: data,
            success: function(data) {
                //validate
                //change form fields

            }
    });
});

in your PHP method, you need return json_encode($data);


text:
Q: JavaScript - return function value outside of another function I am trying to get the returned response from the code below.
The below is a cloud function (Parse Server) which currently not returning anything, the only returned value is inside .then(verification => {})
Parse.Cloud.define("sendVerificationCode", async (request) => {
    await client.verify.services('VAc357322eb2d70fd893237ba44d42333')
        .verifications
        .create({
            to: request.params.phoneNumber,
            channel: 'sms',
        }).then(verification => {
            //The value here is readable
            return verification;
        }, error => {
            return error;
        });

    // Can I return `verification` value here too?
});

The question is, can I return verification value below await ?
P.S. I use the client side to get the returned value.

A: Parse.Cloud.define("sendVerificationCode", async (request) => {
    return await client.verify.services('VAc357322eb2d70fd893237ba44d42333')
        .verifications
        .create({
            to: request.params.phoneNumber,
            channel: 'sms',
        });
});

This will return verification where you ask for it but I can not see where this value should be returned to since the whole function is passed as a callback.


text:
Q: List all media and document files loaded with webpage with requests python I'm looking for a way to list all loaded files with the requests module.
Like there is in chrome's Inspector Network tab, you can see all kinds of files that have been loaded by the webpage.

The problem is the file(in this case .pdf file) I want to fetch does not have a specific tab, and the webpage loads it by javascript and AJAX I guess, because even after the page loaded completely, I couldn't find a tag that has a link to the .pdf file or something like that, so every time I should goto Networks tab and reload the page and find the file in the loaded resources list.
Is there any way to catch all the loaded files and list them using the Requests module?

A: When a browser loads an HTML file it then interprets the contents of that file. It may discover that there is a  tag referencing an external JavaScript URL. The browser will then issue a GET request to retrieve that file. When said file is received, it hen interprets the JavaScript file by executing the code within. That code might contain AJAX code that in turn fetches more files. Or the HTML file may reference an extern CSS file with a  tag or image file with an  tag. These files will also be loaded by the browser and can be seen when you run the browser's inspector.
In contrast, when you do a get request with the requests module for a particular URL, only that one page is fetched. There is no logic to interpret the contents of the returned page and fetch those images, style sheets, JavaScript files, etc. that are referenced within the page.
You can, however, use Python to automate a browser using a tool such as Selenium WebDriver, which can be used to fully download a page.


text:
Q: Web audio volume change on two sliders I have asked this question previously but deleted it because it was the wrong code, i am currently working on a radio player and kinda new in Javascript, i need to add two volume sliders and when one goes up the other one also needs to go up with it. I tried checking and tried everything but nothing seems to help. What am i doing wrong?
This is my current code (give it some time to load the radio player)

const audio = document.querySelector('#stream')
const playPauseButton = document.querySelector('[name="play-pause"]')
const playPauseButtonIcon = playPauseButton.querySelector('i.fas')
const volumeControl = document.querySelector('[name="volume"]')
const currentlyPlaying = document.querySelector('.currently-playing-title')

let isPlaying = false
let fetchInterval = null
let currentVolume = 0.8

audio.volume = currentVolume

const fetchCurrentlyPlaying = () => fetch('...')
    .then(response => response.json())
    .then(data => currentlyPlaying.innerText = data.currentSong)

volumeControl.addEventListener('input', () => {
    const volume = parseFloat(volumeControl.value)

    audio.volume = currentVolume = volume
    currentVolume = volume

})

playPauseButton.addEventListener('click', () => {
    if (isPlaying) {
        audio.pause()

        playPauseButtonIcon.classList.remove('fa-pause')
        playPauseButtonIcon.classList.add('fa-play')

        clearInterval(fetchInterval)
        currentlyPlaying.innerText = 'Er wordt geen nummer gedraaid'
    } else {
        audio.play()

        playPauseButtonIcon.classList.remove('fa-play')
        playPauseButtonIcon.classList.add('fa-pause')

        fetchCurrentlyPlaying()
        fetchInterval = setInterval(fetchCurrentlyPlaying, 3000)
    }

    isPlaying = !isPlaying
})
.radio-player {
    margin: 30px;
}
.button {
    vertical-align: middle;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background-color: #F59E0B;
    color: #fff;
    border-radius: 100%;
}
.play-pause-button {
    width: 70px;
    height: 70px;
    font-size: 25px;
    margin-right: 24px;
}
.mute-button {
    width: 30px;
    height: 30px;
    margin-right: 12px;
}

.player-controls {
    display: flex;
    align-items: center;
}
.currently-playing {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}
.volume-controls {
    display: flex;
    align-items: center;
}

.currently-playing-label {
    font-size: 12px;
    font-weight: 300;
}
.currently-playing-title {
    font-size: 22px;
}

.volume {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid #000;
    border-radius: 50px;
    overflow: hidden; /* This will help with styling the thumb */
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;

    height: 15px;
    width: 15px;

    cursor: ew-resize;
    background: #F59E0B;
    box-shadow: -400px 0 0 390px #FDE68A;
    border-radius: 50%;
}
input[type="range"]::-moz-range-thumb {
    /* same as above */
}
input[type="range"]::-ms-thumb {
    /* same as above */
}
input[type="range"]:focus {
    border-radius: 50px;
    box-shadow: 0 0 15px -4px #F59E0B;
}
<!DOCTYPE html>

    <meta charset="utf8">
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans" />
    <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/>

    <audio src="https://live.hostingbudget.nl:1045/stream" class="visually-hidden" id="stream">

    </audio>

    <button name="play-pause" class="button play-pause-button" aria-label="Play/pause">

    </button>

            Now playing on Some Radio Station
            Listen to Some Radio Station

            <input type="range" name="volume" class="volume" min="0" max="1" step="0.05" value="0.2" aria-label="Volume">
            <input type="range" name="volume2" class="volume" min="0" max="1" step="0.05" value="0.2" aria-label="Volume">

Source code

A: One thing you could do is add the event listener to the parent div. Then in the event listener, get the value of the slider and assign it to both sliders:

const audio = document.querySelector('#stream')
const playPauseButton = document.querySelector('[name="play-pause"]')
const playPauseButtonIcon = playPauseButton.querySelector('i.fas')
// *** Use the parent div
const volumeControl = document.querySelector('[class="volume-controls"]');
const currentlyPlaying = document.querySelector('.currently-playing-title')

let isPlaying = false
let fetchInterval = null
let currentVolume = 0.8

audio.volume = currentVolume

const fetchCurrentlyPlaying = () => fetch('...')
    .then(response => response.json())
    .then(data => currentlyPlaying.innerText = data.currentSong)

volumeControl.addEventListener('input', (e) => {
    // Get the value from whichever slider caused the event
    const volume = parseFloat(e.srcElement.value);

    // Assign the value to all sliders
    document.querySelectorAll('[type="range"]').forEach((v) => v.value = volume);

    audio.volume = currentVolume = volume
    currentVolume = volume

})

playPauseButton.addEventListener('click', () => {
    if (isPlaying) {
        audio.pause()

        playPauseButtonIcon.classList.remove('fa-pause')
        playPauseButtonIcon.classList.add('fa-play')

        clearInterval(fetchInterval)
        currentlyPlaying.innerText = 'Er wordt geen nummer gedraaid'
    } else {
        audio.play()

        playPauseButtonIcon.classList.remove('fa-play')
        playPauseButtonIcon.classList.add('fa-pause')

        fetchCurrentlyPlaying()
        fetchInterval = setInterval(fetchCurrentlyPlaying, 3000)
    }

    isPlaying = !isPlaying
})
.radio-player {
    margin: 30px;
}
.button {
    vertical-align: middle;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background-color: #F59E0B;
    color: #fff;
    border-radius: 100%;
}
.play-pause-button {
    width: 70px;
    height: 70px;
    font-size: 25px;
    margin-right: 24px;
}
.mute-button {
    width: 30px;
    height: 30px;
    margin-right: 12px;
}

.player-controls {
    display: flex;
    align-items: center;
}
.currently-playing {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}
.volume-controls {
    display: flex;
    align-items: center;
}

.currently-playing-label {
    font-size: 12px;
    font-weight: 300;
}
.currently-playing-title {
    font-size: 22px;
}

.volume {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid #000;
    border-radius: 50px;
    overflow: hidden; /* This will help with styling the thumb */
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;

    height: 15px;
    width: 15px;

    cursor: ew-resize;
    background: #F59E0B;
    box-shadow: -400px 0 0 390px #FDE68A;
    border-radius: 50%;
}
input[type="range"]::-moz-range-thumb {
    /* same as above */
}
input[type="range"]::-ms-thumb {
    /* same as above */
}
input[type="range"]:focus {
    border-radius: 50px;
    box-shadow: 0 0 15px -4px #F59E0B;
}

    <audio src="https://live.hostingbudget.nl:1045/stream" class="visually-hidden" id="stream">

    </audio>

    <button name="play-pause" class="button play-pause-button" aria-label="Play/pause">

    </button>

            You are listening to radio
            Currently playing:

            <input type="range" name="volume" class="volume" min="0" max="1" step="0.05" value="0.2" aria-label="Volume">
            <input type="range" name="volume2" class="volume" min="0" max="1" step="0.05" value="0.2" aria-label="Volume">


text:
Q: maven and Atmosphere 0.8.4 i need Atmosphere 0.8.4 in my pom.xml
    <dependency>
        <groupId>org.atmosphere</groupId>
        <artifactId>atmosphere-runtime</artifactId>
        <version>0.8.4</version>
        <type>bundle</type>
    </dependency>

but i get
Could not find artifact org.atmosphere:atmosphere-runtime:bundle:0.8.4 in central (http://repo1.maven.org/maven2) -> [Help 1]

does anybody know an repository with this dependency?

A: It is right there http://repo1.maven.org/maven2/org/atmosphere/atmosphere-runtime/0.8.4/
You need to remove type bundle from your dependency declaration.


text:
Q: what aws services should i use in this scenario? A company's data warehouse receives orders from multiple ordering systems. This data needs to be stored and sales commission needs to be paid based on the state's sales made. A mapping table is present which associates state to Sales manager. How would you implement such a solution? Which AWS services would you use?  What are the major design decisions you will take to ensure that a payment is accurately tracked?

A: You would need a database to store the information, such as Amazon RDS for MySQL. It doesn't sound like the data volume or usage justifies a Data Warehouse solution like Amazon Redshift.
You'll also need to run some application logic somewhere, presumably on an Amazon EC2 instance.
The design of the application, including ensuring that the "payment is accurately tracked", is totally your responsibility. AWS provides the infrastructure for such a system, but not the software application.


text:
Q: Trying to use Winelib with standard macOS build tools: getting strange compiler errors I'm trying to compile a win32 application on macOS using Winelib. I'd prefer to use the standard macOS compiler provided with Xcode if at all possible. However, so far I'm not able to get it to compile. If I try to compile the file test.cpp with the following contents:
#include <windows.h>
#include <list>

int main(int argc, char *argv[]) {
    std::list<int> blah;
    blah.push_back(1);
    return 0;
}

on Ubuntu 16.04 using the following command:
g++ -c -W -fexceptions -fshort-wchar -DWIN32 -D_DEBUG -D_WINDOWS -I/usr/include/wine-development/windows/ -I/usr/include/wine-development/msvcrt/ test.cpp

... I get a few compiler warnings but it still compiles successfully.
However, if I try to compile the same file on macOS with the following equivalent command:
clang++ -c  -W -fexceptions -fshort-wchar -DWIN32 -D_DEBUG -D_WINDOWS -I/usr/local/Cellar/wine/3.0/include/wine/msvcrt -I/usr/local/Cellar/wine/3.0/include/wine/windows test.cpp

...I get the following compiler errors that I have no idea how to fix:
In file included from test.cpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/list:173:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:104:9: error: no member named 'lldiv_t' in the global namespace
using ::lldiv_t;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:110:9: error: no member named 'atoll' in the global namespace; did you
      mean 'atol'?
using ::atoll;
      ~~^
/usr/local/Cellar/wine/3.0/include/wine/msvcrt/stdlib.h:186:23: note: 'atol' declared here
__msvcrt_long __cdecl atol(const char*);
                      ^
In file included from test.cpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/list:173:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:113:9: error: no member named 'strtof' in the global namespace
using ::strtof;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:114:9: error: no member named 'strtold' in the global namespace
using ::strtold;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:117:9: error: no member named 'strtoll' in the global namespace
using ::strtoll;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:121:9: error: no member named 'strtoull' in the global namespace; did you
      mean 'strtoul'?
using ::strtoull;
      ~~^
/usr/local/Cellar/wine/3.0/include/wine/msvcrt/stdlib.h:205:24: note: 'strtoul' declared here
__msvcrt_ulong __cdecl strtoul(const char*,char**,int);
                       ^
In file included from test.cpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/list:173:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:132:9: error: no member named '_Exit' in the global namespace; did you
      mean '_exit'?
using ::_Exit;
      ~~^
/usr/local/Cellar/wine/3.0/include/wine/msvcrt/stdlib.h:179:23: note: '_exit' declared here
void          __cdecl _exit(int);
                      ^
In file included from test.cpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/list:173:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:140:9: error: no member named 'llabs' in the global namespace; did you
      mean 'labs'?
using ::llabs;
      ~~^
/usr/local/Cellar/wine/3.0/include/wine/msvcrt/stdlib.h:195:23: note: 'labs' declared here
__msvcrt_long __cdecl labs(__msvcrt_long);
                      ^
In file included from test.cpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/list:173:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:145:9: error: no member named 'lldiv' in the global namespace; did you
      mean 'ldiv'?
using ::lldiv;
      ~~^
/usr/local/Cellar/wine/3.0/include/wine/msvcrt/stdlib.h:190:16: note: 'ldiv' declared here
ldiv_t __cdecl ldiv(__msvcrt_long,__msvcrt_long);
               ^
9 errors generated.

Note that I am using wine / winelib installed via homebrew.
From the looks of things, it seems that Winelib's implementation of msvcrt causes Xcode's toolchain to blow up.
Is there anything I can do to fix this?

A: All of the declarations for these functions are present as of Wine 3.8. Update your copy of Wine to version 3.8 or later and try again.


text:
Q: Spring Boot can't find DataSource for JdbcTemplate I have a Spring Boot application that happens to use Camunda for BPMN.  Everything works fine.  I have the Hikairi DBPool and the datasource properties in my application.properties file.  Every thing runs fine,  and workflows work etc...
I now want to access my DB via JdbcTemplate,  using the same DataSource, as all the tables are on the same DB.  I add this class:
@Component
public class MyDao extends JdbcDaoSupport {

  public MyRow getMyRowById(int id) {
    String sql = "select * from MyTable where id = ?";
    try {
        MyRow myRow = (MyRow)getJdbcTemplate().queryForObject(sql, new Object[] { id }, new MyRowMapper());
        return myRow;
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
    return null;
  }
}

And I get the error:
Caused by: java.lang.IllegalArgumentException: 'dataSource' or 'jdbcTemplate' is required

How is that possible when I know it's there.  I see in the logs that Hikari is using it and adding itself as the DataSource for pooling.  If I simply remove the @Component and it at least deploys,  but as you would think,  it throws a null pointer at the getJdbcTemplate() call.
Is there an annotation I am missing to get this to autowire correctly and expose the DataSource to my JdbcTemplate?

A: First, you should annotate your MyDao with the @Repository annotation and not with just the @Component one. For this reason, please take a moment to read What's the difference between @Component, @Repository & @Service annotations in Spring?.
Second, looking at your exception, seems you are missing the injection of the jdbcTemplate/datasource in the MyDao. For this point, if you are working with the datasource itself and not with the JdbcTemplate, you can inject the datasource as following:
@Autowired
public void setDs(DataSource dataSource) {
     setDataSource(dataSource);
}

However, if you are using the JdbcTemplate, you can add a setter injection inside you MyDao as following:
@Autowired
public void setJt(JdbcTemplate jdbcTemplate) {
     setJdbcTemplate(jdbcTemplate);
}


text:
Q: Compiletime validation of enum parameters There is a constructor with three parameters of type enum:
public SomeClass(EnumType1 enum1,EnumType2 enum2, EnumType3 enum3)
{...}

The three parameters of type enum are not allowd to be combined with all possible values:
Example:

EnumType1.VALUE_ONE, EnumType2.VALUE_SIX, EnumType3.VALUE_TWENTY is a valid combination.

But the following combination is not valid:

EnumType1.VALUE_TWO, EnumType2.VALUE_SIX, EnumType3.VALUE_FIFTEEN

Each of the EnumTypes knows with which values it is allowed to be combined:
EnumType1 and the two others implement a isAllowedWith() method to check that as follows:
public enum EnumType1 {

VALUE_ONE,VALUE_TWO,...;

    public boolean isAllowedWith(final EnumType2 type) {
    switch (this) {
        case VALUE_ONE:
            return type.equals(Type.VALUE_THREE);
        case VALUE_TWO:
            return true;
        case VALUE_THREE:
            return type.equals(Type.VALUE_EIGHT);
        ...
    }
}

I need to run that check at compile time because it is of extreme importance in my project that the combinations are ALWAYS correct at runtime.
I wonder if there is a possibility to run that check with user defined annotations?
Every idea is appreciated :)

A: The posts above don't bring a solution for compile-time check, here's mine:
Why not use concept of nested Enum.
You would have EnumType1 containing its own values + a nested EnumType2 and this one a nested EnumType3.
You could organize the whole with your useful combination.
You could end up with 3 classes (EnumType1,2 and 3) and each one of each concerned value containing the others with the allowed associated values.
And your call would look like that (with assuming you want EnumType1.VALUE_ONE associated with EnumType2.VALUE_FIFTEEN) :
EnumType1.VALUE_ONE.VALUE_FIFTEEN  //second value corresponding to EnumType2

Thus, you could have also:  EnumType3.VALUE_SIX.VALUE_ONE (where SIX is known by type3 and ONE by type1).
Your call would be change to something like:
public SomeClass(EnumType1 enumType)

=> sample:
SomeClass(EnumType1.VALUE_ONE.VALUE_SIX.VALUE_TWENTY) //being a valid combination as said

To better clarify it, check at this post: Using nested enum types in Java

A: So the simplest way to do this is to 1) Define the documentation to explain valid combinations and
2) add the checks in the constructor
If a constructor throws an Exception than that is the responsibility of the invoker.  Basically you would do something like this:
public MyClass(enum foo, enum bar, enum baz)
{
    if(!validateCombination(foo,bar,baz))
    {
        throw new IllegalStateException("Contract violated");
    }
}

private boolean validateCombination(enum foo, enum bar, enum baz)
{
    //validation logic
}

Now this part is absolutely critical.  Mark the class a final, it is possible that a partially constructed object can be recovered and abused to break your application.  With a class marked as final a malicious program cannot extend the partially constructed object and wreak havoc.

A: One alternative idea is to write some automated tests to catch this, and hook them into your build process as a compulsory step before packaging/deploying your app.
If you think about what you're trying to catch here, it's code which is legal but wrong.  While you could catch that during the compilation phase, this is exactly what tests are meant for.
This would fit your requirement of not being able to build any code with an illegal combination, because the build would still fail.  And arguably it would be easier for other developers to understand than writing your own annotation processor...

A: The only way I know is to work with annotations.
Here is what I do I mean.
Now your constructor accepts 3 parameters:
public SomeClass(EnumType1 enum1,EnumType2 enum2, EnumType3 enum3){}
so you are calling it as following:
SomeClass obj = new SomeClass(EnumTupe1.VALUE1, EnumTupe2.VALUE2, EnumTupe1.VALUE3)
Change the constructor to be private. Create public constructor that accept 1 parameter of any type you want. It may be just a fake parameter.
public SomeClass(Placeholder p)
Now you have to require to call this constructor while each argument is annotated with special annotation. Let's call it TypeAnnotation:
SomeClass obj = new SomeClass(TypeAnnotation(
    type1=EnumType1.VALUE1,
    type2=EnumTupe2.VALUE2,
    type3=EnumTupe1.VALUE3)
    p3);

The call is more verbose but this is what we have to pay for compile time validation.
Now, how to define the annotation?
@Documented
@Retention({RetentionPolicy.RUNTIME, RetentionPolicy.SOURCE})
@Target(PARAMETER)
@interface TypeAnnotation {
    EnumType1 type1();
    EnumType2 type3();
    EnumType3 type3();
}
Please pay attention that target is PARAMETER and retention values are RUNTIME and SOURCE.
RUNTIME allows reading this annotation at runtime, while SOURCE allows creating annotation processor that can validate the parameters at runtime.
Now the public constructor will call the 3-parameters private construcor:
public SomeClass(Placeholder p) {
    this(readAnnotation(EnumType1.class), readAnnotation(EnumType2.class), readAnnotation(EnumType3.class), )
}
I am not implementing readAnnotation() here: it should be static method that takes stack trace, goes 3 elements back (to caller of the public costructor) and parses annotation TypeAnnotation.
Now is the most interesting part. You have to implement annotation processor.
Take a look here for instructions and here for an example of annotation processor.
You will have to add usage of this annotation processor to your build script and (optionally) to your IDE. In this case you will get real compilation error when your compatibility rules are violated.
I believe that this solution looks too complicated but if you really need this you can do this. It may take a day or so. Good luck.

A: Well, I am not aware of a compile time check but I do not think it is possible because how can the compiler know which value will be passed to the constructor (In case the value of your enum variable is calculated in runtime (e.g. by an If clause) ?
This can only be validated on runtime by using a validator method as you implemented for the enum types.
Example :
If in your code you have something like this :
EnumType1 enumVal;

if (<some condition>) {
  enumVal = EnumType2.VALUE_SIX;
} else {
  enumVal = EnumType2.VALUE_ONE;
}

There is no way the compiler can know which of the values will be assigned to enumVal so it won't be able to verify what is passed to the constructor until the if block is evaluated (which can be done only in runtime)


text:
Q: Обмен строк статической матрицы Воспользовался материалами:
ссылка 1
ссылка 2
К сожалению не смог интерпретировать это на свой случай.
Идея простая, есть двоичная матрица xyz:
XY Y1  Y2  ... Yn
X1 Z11 Z12 ... Z1n
X2 Z21 Z22 ... Z2n
.. ... ... ... ...
Xn Zn1 Zn2 ... Znn
Требуется отсортировать по строкам через указатели
Вот код:
    void sort_matrix(double mtr[10][10], int n, int m) {
    // sort by x
        for (int j = 1; j < n - 1; j++) {
            if (mtr[j][0] > mtr[j + 1][0]) {
                double *addr1 = &mtr[j];
                double *addr2 = &mtr[j + 1];
                double *temp = addr1;
                addr1 = addr2;
                addr2 = temp;
            }
        }
}

Не работает сортировка ни по отдельности для строк или столбцов, ни вместе
Как этот код привести в порядок?

A: Для начала - тут
double *addr1 = &mtr[j][0];
double *addr2 = &mtr[j + 1][0];
double *temp = addr1;
addr1 = addr2;
addr2 = temp;

вы просто меняете местами содержимое двух переменных - адреса элементов массива, но никак не сами элементы!
double temp = mtr[j][0];
mtr[j][0] = mtr[j+1][0]
mtr[j+1][0] = temp;

куда больше толку...
Дальше - а что вы хотите в конечном итоге? Допустим, вы отсортировали по строкам, но, сортируя по столбцам, вы же опять перемешаете строки.
Какова конечная цель?


text:
Q: How to use findViewById for an autocomplete textview inside a fragment Here is my code so far. I should mention this is my first time attempting to use Android studio. Any books you all could recommend would be great as well:
public class master_profile extends Fragment {

    AutoCompleteTextView autoCompleteTextView;
    public master_profile() {
    // Required empty public constructor
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    return inflater.inflate(R.layout.fragment_master_profile, container, false);
    autoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);
    String[] words = getResources().getStringArray(R.array.auto_complete);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,words)

}

}

A: public class master_profile extends Fragment {

    AutoCompleteTextView autoCompleteTextView;

    public master_profile() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View rootView = inflater.inflate(R.layout.fragment_master_profile, container, false);
        autoCompleteTextView = (AutoCompleteTextView) rootView.findViewById(R.id.autoCompleteTextView);
        String[] words = getResources().getStringArray(R.array.auto_complete);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, words);

        return rootView;

    }
}


text:
Q: Date manipulation issues/questions using AngularJS and MomentJS I'm using a datepicker and a timepicker to have a user choose a specific date and time.  In my controller, I intend to combine the selected date and the selected time.
I'm using the most current production versions of AngularJS, Bootstrap, Angular UI-Boostrap, and MomentJS.  I have the latest Angular-Moment added too, but not sure if/how it might help address the issues noted below.

I'd use a datetimepicker, but there's too many to choose from and not
  a lot of time to figure out which one does everything I need
  (validation, masking, bootstrap v3, dependency on other datetimepickers, etc.).

In my app I have included and successfully used MomentJS for other purposes, but in this case, I'm having an issue where the datepicker and the timepicker are each returning the correct value, but MomentJS is returning the wrong value when I load those dates/times into a moment() object.
Here's some examples of what I'm running into...  First BeginDate, and EndDate values are coming from the Angular UI-Bootstrap DatePicker.  BeginTime and EndTime are coming from the TimePicker of the same library.
DatePicker and TimePicker examples
<!-- datepicker nearly mirrors the example on the ui-bootstrap docs -->

<uib-timepicker ng-model="task.BeginTime" ng-change="TimeChanged()" hour-step="hourSteps" minute-step="minuteSteps" show-meridian="true" required></uib-timepicker>

JS console output examples
// returns correct value:  Wed Nov 04 2015 00:00:00 GMT-0800 (Pacific Standard Time)
console.log("$scope.task.BeginDate = " + $scope.task.BeginDate.toString());
// 11/04/2015 selected

// returns correct value:  Sat Oct 31 2015 08:00:52 GMT-0700 (Pacific Daylight Time)
console.log("$scope.task.BeginTime = " + $scope.task.BeginTime.toString());
// 08:00 PM selected

// returns correct value:  Wed Nov 04 2015 00:00:00 GMT-0800 (Pacific Standard Time)
console.log("$scope.task.EndDate = " + $scope.task.EndDate.toString());
// 11/04/2015 selected

// returns correct value:  Sat Oct 31 2015 09:00:52 GMT-0700 (Pacific Daylight Time)
console.log("$scope.task.EndTime = " + $scope.task.EndTime.toString());
// 09:00 PM selected

This situation gets worse when I involve MomentJS to help me parse and concatenate the dates and times. (I've tried with and without .toString(). The next lines in my test are as follows:
// returns:  04/20/2015
var beginDate = moment($scope.task.BeginDate.toString(), "MM/DD/YYYY");
console.log("beginDate = " + beginDate.format("MM/DD/YYYY"));

// returns: Invalid date
var beginTime = moment($scope.task.BeginTime.toString(), "HH:mm A");
console.log("beginTime = " + beginTime.format("HH:mm A"));

// returns: 04/20/2015
var endDate = moment($scope.task.EndDate.toString(), "MM/DD/YYYY");
console.log("endDate = " + endDate.format("MM/DD/YYYY"));

// returns: Invalid date
var endTime = moment($scope.task.EndTime.toString(), "HH:mm A");
console.log("endTime = " + endTime.format("HH:mm A"));

If I combine the dates and times right now, I'll of course get 04/20/2015 00:00 AM returned.
Why are the dates being changed to be 8 months earlier?
Why are the times an invalid date after being loaded into MomentJS?
How do you proposed I fix this?
Why in the world does JavaScript make dates and times so difficult to work with?  (I can Google that one later - just venting.)

A: I think perhaps the Moment syntax is off a bit.  Try something like this:
var beginDate = moment($scope.task.BeginDate.toString()).format("MM/DD/YYYY");


text:
Q: Cloud Function with too many insertions in BigQuery Good morning,
I'm developing a cloud function that when someone deposits a file in a bucket, the function moves it to another bucket, performs an insert in BigQuery (getting info from another table with info from the file) and deletes the file from the original bucket.
The problem is that usually about 100 files are deposited at once and this causes the function to fail because too many insertions are made in BigQuery and this causes that the insert from that file is not inserted and the file is not deleted from the original bucket.
The function do something like this:
async function archive(data, context) {

const file = data;

console.log(`Detected new or overwritten file 'gs://${file.bucket}/${file.name}'`); // 'finalize' GCS trigger

 const filepath = file.name.split('/');

 const filename = filepath.slice(-1).join('/');
 const filenameWithoutExtension = filename.split('.').slice(0, -1).join('.')
 const filenameData = filenameWithoutExtension.split('_');

 const fileData = { // exemple : 0023_ROMERO_2021_02.xml
    id_file: filenameData[0],
    name: filenameData[1],
    year: filenameData[3],
    month: filenameData[4]
  };

await copyFile(srcBucketName, srcFilename, destBucketName,...)

const [job] = await bigquery.createQueryJob({
    query: `INSERT INTO table1 (....)
    SELECT
      ...
      timestamp('${file.timeCreated}')
    FROM
      table2
    WHERE
      month = '${file.month}'
      and year = '${file.year}'
      and id_file = '${file.id_file}'
      `,
location: 'EU',
  });

console.log(`BigQuery job ${job.id} started.`);

await job.getQueryResults();
console.log(`BigQuery job ${job.id} completed.`);

await deleteFile(file.bucket, file.name);

console.log('Completed');
}

There is a way to solve this problem?
Thanks in advance

A: Bigquery has limitations, which we cannot over come it, but you can customize your to handle it.
Solution Proto type:-

*

*Create a wrapper script/code which will be responsible to list all files landed over GCS- bucket.

*Create a loop in wrapper code to process each file sequentially or a bath of Small parallel loading instance. These sequentially/small-parallel instance will call your Function for each file.


text:
Q: How many milliseconds interval does angularjs re-render the ui? as title shown.
when we bind somethings like
$scope.text="ASD";

in html:
this is {{text}}

and when we change $scope.text, in html the value also changed, because of the 2 way binding.
my question is how many milliseconds does angularjs update the ui?
EDITED:
Sorry, i think my question not details enough and i also quite confuse how to perfect define my question.
the extra question is,
there is a $http, after successful get the data,
assgin to some variable, called $scope.list. and this list is bind to ui ngRepeat. So when i get the data, i am not directly assign like this
$scope.list = data;

because it will re-render the ngRepeat DOM, instead of that, i am manually assign the data
pseudo-code
for loop scope list
  for loop data
    if object equal then assing value to scope list [index] = data[index]
  end loop
end loop

here is the example http://plnkr.co/edit/IHt6AoVUhRsUlBuumEGr?p=preview why i manually set instead of using "="
so back to the question, when i doing update list and i also add up time condition, for example in the loop
pseudo-code
for loop scope list
  for loop data
    every 0.001 secs do somethings, and manual set the value to the list
  end loop
end loop

So in the inner loop and at that time of assign value , the UI update is it trigger by the event or by a certain time?

A: Short answer: none, but you may feel like it is taking a few milliseconds depending on your processor speed and the amount of things angular need to check before it updates the HTML
Long answer: As soon as you update the model (well, at the end of the current javascript context), Angular will execute a digest cycle on which it will process all the $watchers (in this case {{text}} is a watcher over the text property). If a watcher has a different value than last time, it will run a new digest cycle, and so on, until all watchers are stable. Then it will process the HTML and updates all value, before the browser finally render the view. Hence from a "machine" point of view, it is immediate as in the same execution context: your browser will not render anything in between.
Now if your code is asynchronous (like a call to some server), that "immediaticity" I have been talking about starts from the latest call to $scope.$apply

A: AngularJS updates the UI on every $digest cycle. $digest does not run on a fixed millisecond interval; instead it is run when certain events are triggered in the UI (e.g. changing the text in a text box with an ng-model directive).
As @Joe pointed out, if you are running code in an event that Angular knows about (such as an ng-change event), then the UI will be updated almost immediately.
If you are running some code that runs at a time that AngularJS is not expecting (e.g. using setInterval or setTimeout, you can force a $digest cycle to happen manually by calling scope.$apply(), assuming you have a reference to an Angular scope.

A: Assuming $scope.text="ASD" is executed within a digest cycle, the ui will be updated almost immediately.
You can think of the thread of execution to be:
$scope.text="ASD"
...other code in this digest cycle (most likely nothing)
...renderui()

In terms of milliseconds, I guess that depends on how fast your CPU is.
Another way to say this is that it's going to be just as fast as if you manually updated the DOM yourself, with a small amount of overhead included for running angular's digest cycle.


text:
Q: Make NSTableView cells editable programmatically only How to configure a view-based NSTableView to behave like so:

*

*Rows are selectable

*The user are unable to trigger edit mode by clicking a cell

*Edit mode can be triggered by calling NSTableView-editColumn:row:withEvent:select: programmatically

The table view is dragged from the object library of Xcode interface builder, i.e., it uses an NSTableCellView (with an NSImageView and an NSTextField as its subviews) as the table view's cell view.

A: For view-based table views, -editColumn:row:withEvent:select: is relatively ineffective. It attempts to make the cell view the first responder for the window, but only certain views will accept first responder status. NSTableCellView does not, because it is not itself editable.
If you want to programmatically initiate editing in the text field within an NSTableCellView, you can do something like:
NSTableCellView* cellView = (NSTableCellView*)[tableView viewAtColumn:col row:row makeIfNecessary:YES];
if ([cellView.textField acceptsFirstResponder])
    [cellView.window makeFirstResponder:cellView.textField];

To disable the user from starting editing through the UI, I think you will need to set the text field to not be editable. You would make it editable just before you initiate editing programmatically. For example, add a line cellView.textField.editable = YES; between the above two lines.
Then, you'll want to set it back to non-editable after editing ends. To do this, you can set the delegate of the text field to your controller object and implement -controlTextDidEndEditing:. Or, similarly, you can add an observer of the NSControlTextDidEndEditingNotification notification from the text field. Either way, when your code is called, you set the text field's editable property back to false. (If you don't otherwise have a reference to the text field in question, you can obtain it from the NSNotification's object property.)


text:
Q: How to make a persistent USB/SD from Mac I've been searching the internet for ages now and I haven't been able to find a way to make a persistent Ubuntu 20.04 USB from a Mac. All the articles seem to either be outdated or just say "now boot to it" at the end, and when I do, it doesn't work. The closest I've got is using these articles (https://ubuntu.com/tutorials/create-a-usb-stick-on-macos#1-overview and https://www.linuxuprising.com/2019/03/create-persistent-storage-live-usb-with.html)

*

*Using Etcher to make a normal live USB

*Booting to it, downloading mkusb and making a live 'persistent' USB

*Booting to that USB and getting stuck at the loading page, and when I try recovery mode I get a kernel panic

I have a 2013 MacBook Air, loads of 8GB USB sticks, and a 16 GB SD card. If anyone could help me that would be amazing.

A: UNetbootin
Has a MacOS version, it can be downloaded here:
https://unetbootin.github.io/
Off the shelf persistence is limited to 4GB but it is easy to create a persistent partition of any size, see: Can I convert a live Ubuntu USB to one with persistent memory?


text:
Q: Lose gnome3 wallpaper My wallpaper is now white, the icons are displayed, but the app in parameters/background does not launch.
In gconf, /desktop/gnome/background/picture_filename is set to a valid image (I can see my wallpaper when I'm under the Activity mode)
I'm using debian testing updated today.
Any clue? Need other Infos?
See the

A: I had the same problem. Just solved it, in gnome tweak tool under Desktop tab I disabled option "Have file manager handle the desktop".


text:
Q: Python - Prime numbers Code I'm trying to find a prime factor of the number 705561475143.
In my code, the function primeFactor() searches for all the factors in a certain integer, plugs them into the function Prime(), which either changes the number into 0 or doesn't change it at all. If the number isn't changed to 0, it's a prime number that should be added to the list.
import math

def Prime(n):
    isPrime = False
    r = range(2, int(math.sqrt(n)+5))
    a = 1
    for b in r:
        if r[a] >= int(math.sqrt(n)+2):
            break
        elif n % r[a] != 0:
            a += 1
        elif n % r[a] == 0 & n != r[a] & n != 1:
            n = 0
            break

def primeFactor(m):
    l = []
    for x in range(1, m+1):
        if m % x == 0:
            if Prime(m) != 0:
                l.append(x)
    print(l)

However, when I input
> primeFactor(36)

I get
> [1,2,3,4,6,9,12,18,36]

Instead of
> [2,3]

And when I input
> primeFactor(705561475143)

The code cannot give me an answer.

A: Firstly, why do you use m+1 for the x in range()? Note, you might want to only use range(2, m/2, 1) - see if you can figure out why.
Secondly,
    if m % x == 0:
        if Prime(m) != 0:
            l.append(x)

If m is divisible by x then it can't be prime and calling Prime(m) is useless. I suspect you meant to pass x as the argument. (Assuming x is not 0 or == m)
Thirdly Prime() never returns anything. This means that it is always != 0.
Finally, to help you out a bit, I'll link you to some of my own answers to this question.


text:
Q: Confused by a section in the introduction to Hormanders first PDE book? I have a question on the introduction to Hormanders first PDE book. The introduction seems poorly (i.e. confusingly) written to me, hopefully the rest of the book is better. Anyway, he says classical solutions of the wave equation
$$
\frac{\partial^2}{\partial x^2}v - \frac{\partial^2}{\partial y^2}v = 0,
$$
are twice continuously differentiable functions satisfying the equation
everywhere. These solutions are functions of the form
$$
v(x,y) = f(x+y) + g(x-y), \quad \quad (*)
$$
where $f$ and $g$ are twice continuously differentiable. So far so good. He then says that classical solutions have as uniform limits all functions of the form $(*)$ with $f$ and $g$ continuous. All such functions ought to be recognized as solutions of the wave equation so therefore the definition of a classical solution is too restrictive.
So is Hormander saying that if we take a sequence of classical solutions $\{v_n\}$ such that $v_n(x,y) = f_n(x+y) + g_n(x-y)$ with $f_n$ and $g_n$ twice continuously differentiable, then the uniform limit of the sequence $\{v_n\}$ may be just continuous? He says 'uniform limit' but uniform with respect to what, is he about talking pointwise uniform convergence? Finally he seems to be saying that we should recognise certain merely continuous functions as solutions of the wave equation..surely this can't be correct, we need functions to be at least continuously differentiable in order to have weak solutions?
Can anybody clarify this section in Hormanders book for me?


text:
Q: Spring Boot cors configuration allows all sources I'm trying to make my frontend only place from request to backend can be made. Problem is that it doesn't work and every request is being invoked. Below is code which configures Spring Security and cors.
@Override
    protected void configure(HttpSecurity http) throws Exception {
        http.cors().and().csrf().disable().authorizeRequests()
                .antMatchers(HttpMethod.POST, SIGN_UP_URL).permitAll()
                .antMatchers(HttpMethod.GET, "/groups").permitAll()
                .antMatchers("/").permitAll()
                .anyRequest().authenticated()
                .and()
                .addFilter(new JWTAuthenticationFilter(authenticationManager()))
                .addFilter(new JWTAuthorizationFilter(authenticationManager()))
                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
    }

@Bean
    CorsConfigurationSource corsConfigurationSource() {
        CorsConfiguration configuration = new CorsConfiguration();
        configuration.setAllowedOrigins(Arrays.asList("http://192.168.0.16:8080"));
        configuration.setAllowedMethods(Arrays.asList("GET", "POST"));
        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
        source.registerCorsConfiguration("/**", configuration);
        return source;
    }

A: You might want to add OPTIONS http method to the CORS allowed methods. Most of the front end languages sent an OPTIONS request before sending the real one. Something like
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "OPTIONS"));


text:
Q: Maximum Event Hub receivers exceeded. Only 5 receivers per partition are allowed I have a Azure Stream Analytics job that receives some raw events, transforms them and then writes them to some different outputs. I get the following error:

Maximum Event Hub receivers exceeded. Only 5 receivers per partition are allowed.
Please use dedicated consumer group(s) for this input. If there are multiple queries using same input, share your input using WITH clause.

This is weird, because I use a common table expression (the WITH clause) at the beginning to get all the data, and then I don't access the event hub anymore. Here is the query:
WITH
ODSMeasurements AS (
    SELECT
        collectionTimestamp,
        analogValues,
        digitalValues,
        type,
        translationTable
    FROM EventhubODSMeasurements
),
-- Combine analog and digital measurements
CombineAnalogAndDigital AS (
    SELECT
        CAST(CONCAT(SUBSTRING(ODS.collectionTimestamp, 1, 10), ' ', SUBSTRING(ODS.collectionTimestamp, 12, 12)) AS datetime) AS "TimeStamp",
        ROUND(AV.PropertyValue.value / (CAST(TT.ConversionFactor AS float)), 5) AS "ValueNumber",
        NULL AS "ValueBit",
        CAST(TT.MeasurementTypeId AS bigint) AS "MeasurementTypeId",
        TT.MeasurementTypeName AS "MeasurementName",
        TT.PartName AS "PartName",
        CAST(TT.ElementId AS bigint) AS "ElementId",
        TT.ElementName AS "ElementName",
        TT.ObjectName AS "ObjectName",
        TT.LocationName AS "LocationName",
        CAST(TT.TranslationTableId AS bigint) AS "TranslationTableId",
        ODS.Type AS "Status"
    FROM ODSMeasurements ODS
    CROSS APPLY GetRecordProperties(analogValues) AS AV
    INNER JOIN SQLTranslationTable TT
    ON
        TT.Tag = AV.PropertyName AND
        CAST(TT.Version as bigint) = ODS.translationTable.version AND
        TT.Name = ODS.translationTable.name

    UNION

    SELECT
        CAST(CONCAT(SUBSTRING(ODS.collectionTimestamp, 1, 10), ' ', SUBSTRING(ODS.collectionTimestamp, 12, 12)) AS datetime) AS "TimeStamp",
        CAST(-9999.00000 AS float) AS "ValueNumber",
        CAST(DV.PropertyValue.value AS nvarchar(max)) AS "ValueBit",
        CAST(TT.MeasurementTypeId AS bigint) AS "MeasurementTypeId",
        TT.MeasurementTypeName AS "MeasurementName",
        TT.PartName AS "PartName",
        CAST(TT.ElementId AS bigint) AS "ElementId",
        TT.ElementName AS "ElementName",
        TT.ObjectName AS "ObjectName",
        TT.LocationName AS "LocationName",
        CAST(TT.TranslationTableId AS bigint) AS "TranslationTableId",
        ODS.Type AS "Status"
    FROM ODSMeasurements ODS
    CROSS APPLY GetRecordProperties(digitalValues) AS DV
    INNER JOIN SQLTranslationTable TT
    ON
        TT.Tag = DV.PropertyName AND
        CAST(TT.Version as bigint) = ODS.translationTable.version AND
        TT.Name = ODS.translationTable.name
)

-- Output data
SELECT *
INTO DatalakeHarmonizedMeasurements
FROM CombineAnalogAndDigital
PARTITION BY TranslationTableId

SELECT *
INTO FunctionsHarmonizedMeasurements
FROM CombineAnalogAndDigital

SELECT Timestamp, ValueNumber, CAST(ValueBit AS bit) AS ValueBit, ElementId, MeasurementTypeId, CAST(TranslationTableId AS bigint) AS TranslationTableId
INTO SQLRealtimeMeasurements
FROM CombineAnalogAndDigital

SELECT *
INTO EventHubHarmonizedMeasurements
FROM CombineAnalogAndDigital
PARTITION BY TranslationTableId

And this is the event hub input that I use:
{
    "Name": "EventhubODSMeasurements",
    "Type": "Data Stream",
    "DataSourceType": "Event Hub",
    "EventHubProperties": {
        "ServiceBusNamespace": "xxx",
        "EventHubName": "xxx",
        "SharedAccessPolicyName": "xxx",
        "SharedAccessPolicyKey": null,
        "ConsumerGroupName": "streamanalytics",
        "AuthenticationMode": "ConnectionString"
    },
    "DataSourceCredentialDomain": "xxx",
    "Serialization": {
        "Type": "Json",
        "Encoding": "UTF8"
    },
    "PartitionKey": null,
    "CompressionType": "None",
    "ScriptType": "Input"
}

I use a separate consumer group for this as well. As far as I see it, I do everything right. Does anyone know what's up?
Edit: I enable the diagnostic logs, and it says this:

Exceeded the maximum number of allowed receivers per partition in a
consumer group which is 5. List of connected receivers - nil, nil,
nil, nil, nil.

A: Turns out the issue was PEBKAC. There is another Job that accidentally pointed to the same input Event Hub.


text:
Q: How to write query to get progressbar is present or not I have written query check whether progressbar is present on view or not.
I issue following command but it does not works
query("progressbar class:'android.widget.ProgressBar'")

When I issue query("*") command it will returns as one of the element
[8] {
                      "id" => "progress",
                 "enabled" => true,
      "contentDescription" => nil,
                   "class" => "android.widget.ProgressBar",
                    "rect" => {
          "center_y" => 419.0,
          "center_x" => 194.0,
            "height" => 72,
                 "y" => 383,
             "width" => 72,
                 "x" => 158
      },
             "description" => "android.widget.ProgressBar@4138e948"
  },

Any body knows how to fetch progressbar element using query command?
Thanks in advance

A: Well better late then never - try something like
  def check_loading
   wait_for_elements_exist([query_progress_bar], :timeout => 22, :timeout_message => "No Progress Bar")
  end

  def query_progress_bar
   'android.widget.ProgressBar'
  end

If you are looking for a certain class, just query for the class name like
query('android.widget.ProgressBar')

you can add information like in your case
query('android.widget.ProgressBar id:"progress"')


text:
Q: Multiple network adapters, how does it affect the connection? Background:
I have a custom built gaming machine running Windows 7 RC for which I bought a fairly cheap wireless adapter because I thought my dorm would have firewire internet again this year.  When I got there they were all wireless.  I immediately ordered a new decent wireless-n adapter and just installed it today.  As I was installing, i thought "why should I even bother removing my older adapter?"
So, my question is: should I?
What are the pros/cons of having two adapters instead of one?
Is there a speed increase if they're connected to different networks? The same network?
Is the opposite true, will it slow my download speed?
Speakeasy speed test was inconclusive on those last points.
So far the biggest benefit I've seen is that I can always get a good signal from at least one of my adapters, since they have different antenna setups.
What do you think?  Any tips?

A: For using multiple adapters, you will want to look at NIC Bonding.
Here is a linux reference on Serverfault: NIC bonding with two uplinks.

*

*Windows 7 reference : forcing programs to use a specific NIC

*Also look at : Windows 2003 Server 2 NIC/Network Cards Multi-homed connection

A: Generally with wireless there's no particular advantage to multiple adapters on the same network since the total bandwidth (eg 54mbps for 802.11g) is shared amongst all the clients rather than like a network port where you have an amount per port.  If you were to connect to different networks you would have a certain amount of bandwidth on each network but generally speaking each application would only be able to use one or the other.

A: Even if your software would handle which app uses which NIC, the chances are both NICs are attached to the same access point thus rendering the exercise moot. Remember wireless is simplex communication.  When anyone or anything is using the channel, you cannot send or receive.  Even if it is your neighbor, and lord forbid he still has a 802.11b client.  If your access point can see any 802.11b client then you will be running in RTS/CTS protection mode and your wireless will not be running as efficient as possible.
Turn off your lower data rates.  These rates are not needed around a normal house.  Ideally you want 11mbs and below disabled with 12mb being mandatory with all others supported.  This will result in a performance increase if there are any 802.11b clients in the area (remember not just your devices but anything within RF range of the access point).  In addition, the 12mb beacon rate is much faster than the 1mb beacon rate which means less channel overhead and more time for client frames.
If you find turning off these data rates causes you issues, then i would suggest another access point to cover the area having issues or in a pinch you could get larger antennas.  Larger antenna presents other problems like hidden-node scenarios and creates unbalanced cells.  Hidden-Node can cause the same RTS/CTS protection mechanisms used for 802.11b clients to be enabled causing performance issues.  You avoid hidden nodes by managing your gain.  You want your overall power to be relatively close to those of the clients.  This allows clients on the access point to see each other and avoid issues.
To avoid issues with wireless you must think in terms of wireless quality vs quantity.  What i mean by this is you really need to sacrifice coverage for quality.  To make up for the coverage you add access points.

*

*Sirmuzz


text:
Q: How do you keep the user logged in across multiple sessions on Firebase on Android? I'm currently using Firebase's email and password authentication to login my users.
How do I keep a user logged in across multiple sessions so that if they close the app and come back later, they don't have to login again?
Do I need to save an auth token in my SharedPreferences and attempted to login the user via this token when they start the app again? If so, is this the token in the AuthData object returned by authWithPass() (via Firebase's API), and which Firebase login method should I use with this token?

A: Firebase already saves the authentication token in the SharedPreferences of your app and restores them when the app restarts.
If you are not seeing this as "the user is already authenticated" behavior in your app, it is likely that you're not monitoring authentcation, but only handle the active flow to log users in.
From the Firebase guide for Android developers (which I highly recommend you read) comes this example:
Firebase ref = new Firebase("https://<YOUR-FIREBASE-APP>.firebaseio.com");
ref.addAuthStateListener(new Firebase.AuthStateListener() {
    @Override
    public void onAuthStateChanged(AuthData authData) {
        if (authData != null) {
            // user is logged in
        } else {
            // user is not logged in
        }
    }
});

Also see:

*

*How deal with cold start of an app where user has beeing logged with Firebase at previous run

*How to keep a user persistent logged in through my Android application with Firebase


text:
Q: Jenkins Slave Swap Space In my Jenkins setup there is a single upstream build that triggers several downstream projects that run on slave nodes. I recently added an additional slave node with the same settings (except IP and labels) as currently working slaves. When the new slave tries to run a job, however, none of the files pulled by the upstream SCM are there to run. Therefore, I receive a file not found error. I've spent the morning trying to figure out why to no avail. The console output, the Jenkins log, and the gerrit repo log don't have any other relevant information.
The main difference is that the new computer is a small ARM board (others are x86). In the new slave's attributes, it shows 3GB of free disk space but 0 byes of swap space. Does anyone know if a swap space > 0 is a requirement? I figured it would copy to disk. I've been searching the documentation and configuration settings but can't seem to find any other leads.


text:
Q: 2011 Mac Mini not working with included HDMI to DVI adapter I've got a brand new Mac Mini with a peculiar video issue.  It just won't show video using the included HDMI to DVI adapter.:

*

*I've plugged this Mac Mini and adapter into three separate DVI monitors.  No video from any of them.

*The HDMI port works, and shows beautiful 1080p on my TV.

*The Thunderbolt port works on those aforementioned DVI monitors using a Mini DisplayPort to DVI Adapter.

*I've tested the HDMI to DVI adapter alone (no Mac Mini involved) and it works great.

So the adapter works, the HDMI port works, the cable works, and the monitors work.  Just not together, for some reason.
Other voodoo attempted (unsuccessfully):

*

*Ran a full Software Update.  All updates have been downloaded and installed as of the time of this question.

*Put the Mac Mini to sleep, then woke it back up (using the Apple Remote).

A: Same problem here with a Specter x20G Naga III monitor. A few days ago I tried to set up a new Mac mini for my wife. There was no video from the HDMI to DVI converter. I plugged the old Mac mini (circa 2007 but updated to Snow Leopard) in and the video worked just fine. I called Apple Care, they made an appointment with me at the Genius Bar, I took the new mini in and, using the same display adapter, it worked fine with their monitor. While installing the software updates at the Genius Bar, that mini kenel panicked. So they issued me a new one.
I brought the new mini home, plugged it in, and I had no video just like the first one. I tried a different DVI cable. No love. I tried another monitor with the HDMI to DVI converter and the video came through just fine. So I went back to the Apple store to pick up a mini display port to DVI converter. It didn't work on the Mac mini. It also did not work on my Macbook air.
My conclusion is that some DVI monitors just don't work with Lion. (Lion being the one commonality between my Macbook Air and my wife's Mac mini.) I ended up buying a new monitor. It works fine with the new Mac mini. I took the old monitor and set it up as a second display on my daughter's Mac mini which is still running Snow Leopard. It works great.

A: The only thing that I can think of would be a monitor detection issue when it's plugging in the HDMI to DVI-D adapter. I would see if you can plug in a second monitor via Thunderbolt, and try to detect the other display(s). Otherwise, this may be a job for 1(800)MY-APPLE.

A: After an unfortunate (but somewhat understandable, given the confusing nature of the issue) runaround from 1-800-APL-CARE, I managed to get a brand new HDMI to DVI adapter.
After extensive testing, it appears that the original HDMI to DVI adapter included with my Mac Mini works, with (seemingly) any device except for my Mac Mini.  The new HDMI to DVI adapter works great.  Must have been a very slight manufacturing defect in the original adapter.

A: I had the same problem with my new Mac Mini, went to the Apple store and they gave me a new DVI to HDMI adapter. I asked to have them test it before I left the store but they could not come up with a monitor with a DVI port. In the end they sold me a Belkin HDMI to DVI cable for one cent, just to have the goods transfer on record.
In my opinion, the store personnel did not know about the problem with the HDMI to DVI cable adapters, but after a few trips to the back room, they did the right thing without admitting that there is a problem. My monitor is a ViewSonic VP1201s (1600x1200) it is a few years old.
The "new" adapter that they gave me did not work either, but the Belkin was fine.


text:
Q: MySQL mapping null boolean to Java with Hibernate I'm developing a Bet service with Java and MySql using Spring and Hibernate, but I have a question about a mapping:
In my database I have bet types (questions) like: ¿Who will win the match? and bet options for each type like: 1, X, 2. Each option has a boolean indicator to show if an option is a winner option or not. So, the mapping in MySql for this attribute is a boolean like this: 1 if the option is winner, 0 if the option is looser, and null if the option is not yet neither winner or looser
So, in my service layer, how can I check if the winner attribute in an option is null? I've tried option.getIsWinner() != null but boolean is a primitive type so it can be null. Any idea on this?
Thanks.

A: Java has two boolean types; lowercase-b boolean, which is a primitive, and one is capital-B Boolean, which is an object.  The object variant can also be null, so it should be possible for it to be null in the event that the database column is null.  If you switch over to java.lang.Boolean you should get the behavior you expect.  I just looked in the Hibernate docs, and it supports both.


text:
Q: How does one know that the user is already logged in when implementing OAuth? I'm building a twitter application in PHP/CodeIgniter which gets an [access_token] back successfully. At the moment, I'm not writing anything to the database as I am still in testing.
But how do you determine that user is simply returning back if the user already logged in at a earlier time (meaning they did not explicitly press log out)? What do you need to store in db? Because storing everything in SESSION will obviously result in user needing to login everytime  if he/she closes your website..Just trying to get some clarification!
thanks.

A: When you call oauth/access_token you get the access token back (this is a last oAuth token - there is several in the authentication process, but this is the one you use to make calls).
Save this token and the secret in a session and it should last "forever".
When a user returns, you can verify the token is still valid with "Verify credentials" https://dev.twitter.com/docs/api/1.1/get/account/verify_credentials


text:
Q: In Azure App Insight, how to get properties of events tracked from App Center? I use App Center with a Xamarin.Forms mobile application.
I use App Center's Analytics, especially Events to log a lot of information.
In order to compute those informations, I use Azure App Insights.
I have configured the export from App Center to App Insight, it is working well.
My problem is, in App Insight, I can see Events, but I cannot see the properties of the Events.
For instance, from that doc https://learn.microsoft.com/en-us/appcenter/sdk/analytics/xamarin#custom-events
I am able to see the "Video clicked" event, but not the "Category" and the "FileName".
How can I have those informations in App Insight please ?
Also, is it possible to know a relation ship between each properties ? In other words, to group all properties by date and time they have been tracked ?
Thanks in advance :)
Here are two print screen to illustrate my question :

A: You can use this query in Application Insights Analytics:
customEvents
| where timestamp >ago(90d)
| where name == "your custom event"

Then to see if the properties can be fetched in the results.


text:
Q: Pebble SDK: Store color as a variable I'm make Pebble Time versions of my watchfaces.
I want to be able to set a color variable that will hold a color depending on whether the Pebble Time is used or the Pebble OG is used.
I know you can do this:
#ifdef PBL_COLOR
  window_set_background_color(s_main_window, GColorDukeBlue);
#else
  window_set_background_color(s_main_window, GColorBlack);
#endif

But I don't want to apply this to the 50 different elements that I want to change the color to.  Could I set a variable called myColor at the start of my program at the start of my program and set it to GColorPastelYellow if it's using the Basalt hardware and set it to GColorWhite if it's the Aplite hardware?
I have this right now:
static GColor *myColor;

#ifdef PBL_COLOR
  myColor = GColorPastelYellow;
#else
  myColor = GColorWhite;
#endif

Unforuntately that doesn't work :/  Anyone have a solution to accomplishing this?

A: You were probably getting an error because window_set_background_color expects a GColor not a GColor *, but you still can't make GColor static. A great explanation is here.
You can however use #define to your advantage. Like:
#ifdef PBL_COLOR
  #define MYCOLOR GColorPastelYellow
#else
  #define MYCOLOR GColorWhite
#endif


text:
Q: Using Scrapy,how can I jump back to the point where Request's errback function was called? When an exception was raised while processing the request, the errback  function will be called. The question is, how can I jump back to the point where  the errback function was called?
For example:
for url in self.urls:
    yield scrapy.Request(url, callback=self.parse_httpbin,
                        errback=self.errback_httpbin,
                        dont_filter=True)

def errback_httpbin(self, failure):
    #do something to fix the error#

If when processing url[k], errback_httpbin is called, how can I jump back to process url[k] in the for loop.
Thanks in advance to anyone who can give an advice :)

A: From the official guide:

errback (callable) – a function that will be called if any exception was raised while processing the request. This includes pages that failed with 404 HTTP errors and such. It receives a Twisted Failure instance as first parameter.

The Twisted Failure object contains some useful methods and properties that might help you:

Instance Variable  value:  the exception instance responsible for this failure.
Instance Variable  type:   the exception's class.
Instance Variable  stack:  list of frames, innermost last, excluding Failure. __ init __.
Instance Variable  frames: list of frames, innermost first.
Method getTracebackObject: get an object that represents this Failure's stack that can be passed to traceback.extract_tb.
Method getErrorMessage:    get a string of the exception which caused this Failure.

Or you can try with debugging. My favorite method is to add a main.py that you can launch from the IDE in debug mode, letting you using breakpoints etc... the content of main.py will be:
from scrapy import cmdline
cmdline.execute("scrapy crawl yourspider".split())


text:
Q: Move files from local to remote server using sftp in python I want to copy all files from a local directory to a remote directory. I used the pysftp library for that. My code below is not showing any errors, but my local files are also not being transferred to my remote server.
My code:
import pysftp
remotepath = '/home/a7user/sftp/sftp/CentralData/'
localpath = 'E:\\backup\\'
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None

with pysftp.Connection(host='xx.xxx.xx.xx',username='user',password='5fTPt00',cnopts=cnopts) as sftp:

 sftp.put_d(localpath,remotepath)
 print('Upload finished')

What am I doing incorrectly?

A: Chances are what you really want to use is put_r() and not put_d()?


text:
Q: original copies I want to ask someone to give me 2 copies of a letter but I don't mean photocopying it I mean two letters which both of them contain original signature and stamp, how should I say that in a letter so that he doesn't confuse what I want with 2 photocopies?
I wanted to have 2 copies of this letter
or
I wanted to have 2 of original copies of  this letter
or
something else

A: Be as specific as possible.  I have received such letters (USA) and the wording goes along the lines of "...two original copies with original (not machine) signatures on each..."
It is fun to observe that the oxymoron "original copy" is in standard use, to distinguish from photocopies and the like.

A: Hand-signed is pretty clear, and not uncommon (many Google hits are autographed items being sold, but there are plenty of more relevant items).  It would take a bit of effort to misunderstand "Two hand-signed and stamped copies"

A: I would ask for "Two hand-signed and stamped originals of the letter."


text:
Q: What does this Adjusted Binomial Expansion approach for one half? So I recently learned about Sequence Calculus from a Mathologer video on the subject, and have been pondering about a number of different sequences of which I can apply the Gregory-Newton formula to. One that intrigued me was to, in a sense, shift the binomial expansion backwards, by having $\Delta^nf(0) = n$ . This led to a sequence of the following:
$$0,1,4,12,32,80...$$
If you lay out the terms and differences, then $\Delta^nf(0) = n$. Then, I used the Gregory-Newton Method and plugged in 6, to continue the pattern.
$$0\frac{6^\underline{0}}{0!}+1\frac{6^\underline{1}}{1!}+2\frac{6^\underline{2}}{2!}...+6\frac{6^\underline{6}}{6!}=0\,+\,6\,+\,30+\,60\,+\,60\,+\,30\,+\,6 = 192$$
One thing I noticed was the inclusion of $\Delta^nf(0) = n$ seemed to offset the Binomial Expansion's factorial denominator, $n\frac{q}{n!} = \frac{q}{(n-1)!}$. Notably, this is obviously present with the sequence constructed, and I would be lying if i said i didn't consider this beforehand, but what has happened  is instead of the regular binomial expansion apprearing, the factorial has decreased by one.
Now, instead of the regular binomial sum being:
$$\sum_{m=0}^\infty \frac{n^\underline{m}}{m!} $$
It is now:
$$\sum_{m=1}^\infty \frac{n^\underline{m}}{(m-1)!} $$
And just like this, for $n \geq 1 $ the expansion gives values of $f(n)$ in the sequence.
If I try the original binomial theorem  with a negative you get the iconic $1-1+1-1+1-1+...$ that everyone knows.
If i try it with the new theorem i get:
$$\frac{-1}{1}+\frac{2}{1}+\frac{-6}{2}+\frac{24}{6} ... = -1+2-3+4-5+6- . . .$$
Then I tried $\frac{1}{2}$ and got a converging series. What I want to find is:
$$\sum_{m=1}^\infty \frac{\frac{1}{2}^\underline{m}}{m!}$$
What does this approach? Thank you.
-Adri

A: $n^{\underline m}$ appears to be notation for the "falling factorial", $n^{\underline m}=n(n-1)(n-2)\cdots(n-m+1)$. Then $${n^{\underline m}\over m!}={n\choose m}$$ for all $n$, not just positive integer values of $n$. So, $$\sum_1^{\infty}{(1/2)^{\underline m}\over m!}=\sum_1^{\infty}{1/2\choose m}$$ By the Binomial Theorem, $$\sum_0^{\infty}{1/2\choose m}x^m=(1+x)^{1/2}$$ Letting $x=1$, we get $$\sum_1^{\infty}{(1/2)^{\underline m}\over m!}=\sqrt2-1$$


text:
Q: What is the dotted blue underlining when I use dictation on OS X? When I use the dictation feature in OS X, sometimes some of my text has got dotted blue underlining below it after entry:

What does this mean? Am I able to use it to correct the mistakes in the text more easily?
I am using OS X 10.8.

A: This highlighting "hyperlinks" the text, if the system is unsure of what you said. It will typically take a couple of best guesses, and display them as options from which you can choose from. You can see the suggestions by right-clicking the word or control clicking it.
It also selects the text when you click on it, which allows you to simply type a replacement if the options provided aren't correct.
This article may provide helpful information on dictation.

A: The blue underline allows you to control click and select from alternate transcriptions of the sounds for that phrase.
The blue underline is similar to the red underline that appears when the system detects alternate suggestions for a typed word.
In this case, it might have a high confidence that you could have said one of several phrases and offers you both an indication that there is some doubt about that dictation as well as a shortcut to choose from an alternate word choice.
Oddly, this isn't covered in the Mac Basics: Dictation article that does have a helpful list of editing tips and punctuation words that are supported.


text:
Q: Python, Pandas dataframe, merge dataframe's rows that have same two column values and aggregate data in rows I have this DF and I am trying to merge any two rows with similar workDate and ID. I do not know how many columns this DF will have. it might have hundreds of columns so I am looking for a way to merge without having to specify all column names
    |workDate   |ID       | Hours |Groundsman  |names2  |Teachers       |Profs
---------------------------------------------------------------------------------
0   |2020-01-09 |13702    | 1.0   |   Ted      |        |               |
1   |2020-01-09 |13702    | 1.0   |            |Seline  |               |
2   |2020-01-10 |13702    | 20.0  |            |Ted,Sam |               |
3   |2020-01-10 |13702    | 20.0  |            |        |Pete,Norm,Tim  |
4   |2020-01-10 |13702    | 20.0  |            |        |               |Joe

Desired output:
    |workDate   |ID       | Hours |Groundsman  |names2  |Teachers       |Profs
---------------------------------------------------------------------------------
0   |2020-01-09 |13702    | 1.0   |   Ted      |Seline  |               |
1   |2020-01-10 |13702    | 20.0  |            |Ted,Sam |Pete,Norm,Tim  |Joe

I have tried multiple ways of grouping by but non of got me the desired output. As I mentioned DF might have a lot of other columns so I can not use a solution that expects all columns names to be included.
it's basically group by workDate and ID but I also want to keep all values in other columns

A: Try:
import pandas as pd
import numpy as np #only required because the example df creation needs np.nan

df = pd.DataFrame({'workDate': {0: '2020-01-09',
  1: '2020-01-09',
  2: '2020-01-10',
  3: '2020-01-10',
  4: '2020-01-10'},
 'ID': {0: 13702, 1: 13702, 2: 13702, 3: 13702, 4: 13702},
 ' Hours': {0: 1.0, 1: 1.0, 2: 20.0, 3: 20.0, 4: 20.0},
 'Groundsman': {0: '   Ted', 1: np.nan, 2: np.nan, 3: np.nan, 4: np.nan},
 'names2': {0: np.nan, 1: 'Seline', 2: 'Ted,Sam', 3: np.nan, 4: np.nan},
 'Teachers': {0: np.nan, 1: np.nan, 2: np.nan, 3: 'Pete,Norm,Tim', 4: np.nan},
 'Profs': {0: np.nan, 1: np.nan, 2: np.nan, 3: np.nan, 4: 'Joe'}})

print(df.groupby(by=['workDate', 'ID']).last().reset_index())

Outputs:
     workDate     ID   Hours Groundsman   names2       Teachers Profs
0  2020-01-09  13702     1.0        Ted   Seline           None  None
1  2020-01-10  13702    20.0       None  Ted,Sam  Pete,Norm,Tim   Joe


text:
Q: WYSIWYG Multiple Inputs (jQuery Plugin) I have a page that requires two Rich Text Editors, so I went with WYSIWYG (What You See Is What You Get). They work fine, except for one little annoying detail. When I click the buttons to bold, italicize or indent, it applies to BOTH RTEs, and focuses on the second input. I can't quite figure out how to separate the toolbars from each other.
HTML:

    Definition:

    Consent:

JS (not really needed, but just in case...)
$(function() {
    $("#definition, #consent").wysiwyg();
})

A: After a while of research, the answer is quite simple. Read into the source code and you'll see that it has a toolbar selector:
toolbarSelector: '[data-role=editor-toolbar]',

So you have to override that with a unique data-role like so:
$("#consent").wysiwyg({ toolbarSelector: '[data-role=editor2-toolbar]'} );

Making sure to change the data-role to match the new selector.

A: Was going to just comment but it ran long.
If it's anything like my WYSIWYG editor, it's because the system is set up to work with one container. Even if you add 2 items, it will do the same to both. The only way you could get around this would be to create two separate pages and house them on the same page (via seamless Iframes, possibly AJAX).
Note that I don't know for sure how this particular editor works, but it looks like the backend works very similar (ie, those data- attributes are housing the related execCommand() arguments just as mine).

A: Haven't tried it but did you try separating the the WYSIWYG initialization.
$(function() {
    $("#definition").wysiwyg();
    $("#consent").wysiwyg();
})


text:
Q: Using GetValue inside of Where clause I have an api in asp.net core (I am new to apis btw), and I am trying to have the results filtered by a class property, and that properties value. If I have a class named info and its properties are attack, defense, etc... the types of the properties are int. The user wants to see results where attack > 5 or defense > 7 etc... Here are my classes:
public class Champion
{
    public string version { get; set; }
    public string id { get; set; }
    public string key { get; set; }
    [JsonProperty("name")]
    public string Name { get; set; }
    public string title { get; set; }
    public string blurb { get; set; }
    public info info { get; set; }
    public string[] tags { get; set; }
    //etc
}
public class Root
{
    public Dictionary<string, Champion> data { get; set; }
}
public class info
{
    public int attack { get; set; }
    public int defense { get; set; }
    public int magic { get; set; }
    public int difficulty { get; set; }
}
public class stats
{
    public double hp { get; set; }
    public double hpperlevel { get; set; }
    public double mp { get; set; }
    public double mpperlevel { get; set; }
    //etc
}

Here is my controller:
[HttpGet("{property}/{value}")]    //property is attack, defense, etc
public ActionResult Get(string property, int value)
{
    var json = //json string;
    var champions = JsonConvert.DeserializeObject<Root>(json);
    info i = new info { };

    //Here is what I am trying to implement
    var returnValues = champions.data.Values
                          .Where(x => x.info.GetType()
                               .GetProperty(property)
                               .GetValue(i, null) > value);

    //remaining code and return statement;
}

What I would like to do is use returnValues as a list of all of the values in the champions object
Where(x => x.property > value).ToList().
When I use GetType().GetProperty().GetValue() > value I am attempting to compare an object to an int .Where requires a bool to filter. So my question is how I can implement this? Or is there a better way?

A: Try it:
x.info.GetType().GetProperties()
 .Where(y=> y.Name.ToLower() == property.ToLower())
 .FirstOrDefault().GetValue(x.info) > value

https://i.stack.imgur.com/rffk4.png

A: You should cast that object to actual type of the property. In this case, it is an int. In addition, you don't need the other null parameter. Just GetValue(yourObject) will work. You call it and cast it to the type of your property.
Try this:
var returnValues = champions.data.Values
    .Where(x => (int) (x.info.GetType()
        .GetProperty(property)
        .GetValue(x.info)) > value);


text:
Q: html control/widget to inline edit a word or section in a paragraph Is there a library or widget out there that allows inline editing of certain sections of a paragraph?  I have a mad lib like interface that have certain words highlighted.  The idea is to allow the user to click on these highlighted sections and then inline edit the words , even supporting an edit field to word wrap around to the next line.
Are there any pre-made widgets or libraries that do this?

A: Assign contentEditable as an attribute to highlighted sections.

A: Jeditable matches your criteria perfectly I think.
It allows you to define custom styles for what you want to be editable and various events that trigger the textbox to show up. Check out the demo here!


text:
Q: how to move all commits from a particular commit to new branch By mistake, I made several commits to the master branch. Now I want to clean up the master branch and move all commits from it to an entirely new branch. How do I do that? I found few similar questions but none seemed to move all the following commit. I did the following
git checkout -b bulk-work <hash of the first commit I made>

I was expecting this to move all commits after the first commit to move to new branch. Instead it moved the particular commit and its parent to new commit. How do I do the reverse i.e. move the first commit and all commits after that to a new branch?

A: If I understand what you want to do correctly, I would do this:
git checkout -b bulk-work

Like you sort of had there; this essentially makes a copy of all of the master branch. Then I would do this:
git checkout master
git reset --hard <the hash of a commit to reset to>

This makes it so that your master branch rewinds all the way to whatever hash you put in the '<>'.

I think to simplify this by the way you can just do this:
git branch bulk-work
git reset --hard <hash>

Since the very first command I did makes a new branch and checks it out.

After doing those, make sure to checkout your bulk-work branch to continue working until you're ready to merge, and I assume you know from there.