text:
Q: how to add custom speech in botframe work I am working on Custom speech in bot framework.I add Bing simple speech it is working on my website: here is link :https://envolvebot.azurewebsites.net/
but now i want to know how can we add custom speech (LUIS custom speech) in our webchat bot?
I create custom speech using : https://westus.cris.ai/Home/CustomSpeech
Now i want to add it and want it to work like bing speech .
i am using following code.
 /*! modernizr 3.6.0 (Custom Build) | MIT *
    * https://modernizr.com/download/?-getusermedia-speechsynthesis !*/
    !function (e, n, s) { function i(e, n) { return typeof e === n } function o() { var e, n, s, o, a, f, d; for (var c in t) if (t.hasOwnProperty(c)) { if (e = [], n = t[c], n.name && (e.push(n.name.toLowerCase()), n.options && n.options.aliases && n.options.aliases.length)) for (s = 0; s < n.options.aliases.length; s++)e.push(n.options.aliases[s].toLowerCase()); for (o = i(n.fn, "function") ? n.fn() : n.fn, a = 0; a < e.length; a++)f = e[a], d = f.split("."), 1 === d.length ? Modernizr[d[0]] = o : (!Modernizr[d[0]] || Modernizr[d[0]] instanceof Boolean || (Modernizr[d[0]] = new Boolean(Modernizr[d[0]])), Modernizr[d[0]][d[1]] = o), r.push((o ? "" : "no-") + d.join("-")) } } var t = [], a = { _version: "3.6.0", _config: { classPrefix: "", enableClasses: !0, enableJSClass: !0, usePrefixes: !0 }, _q: [], on: function (e, n) { var s = this; setTimeout(function () { n(s[e]) }, 0) }, addTest: function (e, n, s) { t.push({ name: e, fn: n, options: s }) }, addAsyncTest: function (e) { t.push({ name: null, fn: e          }) } }, Modernizr = function () { }; Modernizr.prototype = a, Modernizr = new Modernizr, Modernizr.addTest("speechsynthesis", "SpeechSynthesisUtterance" in e), Modernizr.addTest("getUserMedia", "mediaDevices" in navigator && "getUserMedia" in navigator.mediaDevices); var r = []; o(), delete a.addTest, delete a.addAsyncTest; for (var f = 0; f < Modernizr._q.length; f++)Modernizr._q[f](); e.Modernizr = Modernizr }(window, document);

    // Necessary for safari
    // Safari will only speak after speaking from a button click
    var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
    const params = BotChat.queryParams(location.search);
    debugger;
    function SpeakText() {
        var msg = new SpeechSynthesisUtterance();
        window.speechSynthesis.speak(msg);

        document.getElementsByClassName("wc-mic")[0].removeEventListener("click", SpeakText);
    }

    if (isSafari) {

        window.addEventListener("load", function () {
            document.getElementsByClassName("wc-mic")[0].addEventListener("click", SpeakText);
        });
    }

    var femaleVoice = null;

    if (Modernizr.speechsynthesis) {
        var baseSpeechPrototype = SpeechSynthesisUtterance.prototype;
        SpeechSynthesisUtterance = function (msg) {
            var utterance = new baseSpeechPrototype.constructor(msg);

            if (femaleVoice != null)
                utterance.voice = femaleVoice;

            return utterance;
        }

        window.speechSynthesis.onvoiceschanged = function () {
            var voice = "Microsoft Zira";
            var safariVoice = "Samantha";

            var voices = window.speechSynthesis.getVoices();
            voices.forEach(function (v) {
                if (v.name.startsWith(voice))
                    femaleVoice = v;
                else if (v.name == safariVoice && v.lang == "en-US")
                    femaleVoice = v;
            })
        }
    }

    //// Needed to change between the two audio contexts
    var AudioContext = window.AudioContext || window.webkitAudioContext;

    //// Sets the old style getUserMedia to use the new style that is supported in more browsers even though the framework uses the new style
    if (window.navigator.mediaDevices.getUserMedia && !window.navigator.getUserMedia) {
        window.navigator.getUserMedia = function (constraints, successCallback, errorCallback) {
            window.navigator.mediaDevices.getUserMedia(constraints)
                .then(function (e) {
                    successCallback(e);
                })
                .catch(function (e) {
                    errorCallback(e);
                });
        };
    }

    const bot = {
        id: params['botid'] || 'botid',
        name: params['botname'] || 'botname'
    };

    window.botchatDebug = params['debug'] && params['debug'] === 'true';

    var speechOptions;
    if (Modernizr.speechsynthesis) {
        speechOptions = {
            speechRecognizer: new CognitiveServices.SpeechRecognizer({
                fetchCallback: function (authFetchEventId) { return getBingToken() },
                fetchOnExpiryCallback: function (authFetchEventId) { getBingToken() }
            }),
            speechSynthesizer: new BotChat.Speech.BrowserSpeechSynthesizer()
        };
    }
    else if (Modernizr.getusermedia) {
        speechOptions = {
            speechRecognizer: new CognitiveServices.SpeechRecognizer({
                fetchCallback: function (authFetchEventId) { return getBingToken() },
                fetchOnExpiryCallback: function (authFetchEventId) { getBingToken() }
            }),
            speechSynthesizer: null
        };
    }
    else {
        speechOptions = null;
    }

    // for bot

    var botConnection = new BotChat.DirectLine({
        domain: params['domain'],
        //token: document.getElementById("directLineToken").value,
        secret: 'Secret',
        webSocket: params['webSocket'] && params['webSocket'] === 'true' // defaults to true
    });

        BotChat.App({
            sendTyping: true,
            locale: params['locale'],
            resize: 'detect',
            speechOptions: speechOptions,
            user: { id:'ID' name: "You" },
            bot: { id: 'Vera', name: "Vera" },
            botConnection: botConnection
        }, document.getElementById('BotChatElement'));

    function getBingToken() {
        // Normally this token fetch is done from your secured backend to avoid exposing the API key and this call
        // would be to your backend, or to retrieve a token that was served as part of the original page.
        return fetch(
            'https://api.cognitive.microsoft.com/sts/v1.0/issueToken',
            {
                headers: {
                    'Ocp-Apim-Subscription-Key': 'Key'
                },
                method: 'POST'
            }
            //).then(res => res.text());
        ).then(function (res) { return res.text() });
    }

aNY BODY Know how to do this  ?
Thank in advance .


text:
Q: Is there a way in eclipse to auto generate references/fields into a class for all specified views in a layout? Is there a way in eclipse to auto generate references/fields into a class for all specified views in a layout?
i.e. click somewhere to auto generate a variable in a specified activity-class, for a view on a layout.

A: No I dont think this is possible at this time but you could provide us with a candy eclipse plugin :D

redpajama_set_name: RedPajamaStackExchange


text:
Q: Responsive images with gatsby I'm using Gatsby-plugin-sharp to automatically use the best image size based on the client's device width, but I can't seem to get this right. In the description of gatsby-plugin-sharp it says that "ResponsiveSizes Create sizes (in width) for the image. If the max width of the container for the rendered markdown file is 800px, the sizes would then be: 200, 400, 800, 1200, 1600, 2400 – enough to provide close to the optimal image size for every device size / screen resolution."
First question: How do I set the max container width of the rendered markdown file?
Which leads me to the next question: How can I set this width dynamically? Say that the client's window size is 400px, and I want the image width of 400 to load. How do I make that happen?
Current Graph QL query:
export const pageQuery = graphql`
query BlogPostBySlug($slug: String! ) {
    markdownRemark(fields: { slug: { eq: $slug } }) {
      html
      timeToRead
      excerpt
      frontmatter {
        title
        cover
        date
        category
        tags
        thumbnail {
          childImageSharp {
            responsiveSizes(maxWidth: 800, quality: 50, cropFocus: CENTER, toFormat: JPG) {
              src
              srcSet
              sizes
              base64
            }
          }
        }
      }
      fields {
        slug
      }
    }
  }
`;


text:
Q: External package suddenly throwing relative reference error when trying to build up until tuesday we had ['@uniswap/v3-sdk', '@uniswap/sdk-core'] in build.rollupOptions.external in our vite config. Although we're suddenly getting this error:
TypeError: Failed to resolve module specifier "@uniswap/v3-sdk".
Relative references must start with either "/", "./", or "../".

Even thou the imports from that library are the same?


text:
Q: Is there a way to bypass the namespace/module name in Python? If you have a module like module, can you bypass it and use the functions available inside without using the module?
I imported the module, but the compiler still complains not having to find function. I still have to use module.function().
It has many more functions, so I don't want to redefine them one by one but just avoid typing module if possible.

A: Importing in Python just adds stuff to your namespace. How you qualify imported names is the difference between import foo and from foo import bar.
In the first case, you would only import the module name foo, and that's how you would reach anything in it, which is why you need to do foo.bar(). The second case, you explicitly import only bar, and now you can call it thus: bar().
from foo import * will import all importable names (those defined in a special variable __all__) into the current namespace. This, although works - is not recommend because you may end up accidentally overwriting an existing name.
foo = 42
from bar import * # bar contains a `foo`
print foo # whatever is from `bar`

The best practice is to import whatever you need:
from foo import a,b,c,d,e,f,g
Or you can alias the name
import foo as imported_foo
Bottom line - try to avoid from foo import *.


text:
Q: Question about the abelianization of a Lie algebra Let $\mathfrak{g}$ be a finite dimensional Lie algebra and $\mathfrak{h}$ a Lie subalgebra. If I know that $\mathfrak{g}/\mathfrak{h}$ is abelian, does it follow that $\mathfrak{g}/\mathfrak{h} \subset \mathfrak{g}/[\mathfrak{g}, \mathfrak{g}]$?

A: Assuming $\mathfrak{h}$ is indeed an ideal (to make sense of the statement, as noted by Qiaochu), saying that $\mathfrak{g}/\mathfrak{h}$ is abelian means that for any $x,y \in \mathfrak{g}$, $[x,y]\in\mathfrak{h}$, hence $[\mathfrak{g},\mathfrak{g}]\subset\mathfrak{h}$. Now consider the application
$$
\pi :\mathfrak{g}/[\mathfrak{g},\mathfrak{g}] \rightarrow \mathfrak{g}/\mathfrak{h}\\
\pi:x+[\mathfrak{g},\mathfrak{g}] \mapsto x+\mathfrak{h}
$$
It is well-defined because $[\mathfrak{g},\mathfrak{g}]\subset\mathfrak{h}$, and it is obiously linear, and commutes with the bracket. Now by elementary commutative algebra, $\mathfrak{g}/\mathfrak{h}$ is isomorpic to the quotient of $\mathfrak{g}/[\mathfrak{g},\mathfrak{g}]$ by the kernel of $\pi$, which is precisely what you want (following the remark of Ted).


text:
Q: REST API alternative to "docker trust inspect" Context: trying to find the way to retrieve the keys from signed docker image using golang or curl
Question: Is there docker REST API endpoint that would allow me to get the keys, similar  to command docker trust inspect


text:
Q: JSF form not shown i want to implement a login page using jsf for that i wanted
to implement a form:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Login</title>
    <link href="../resources/css/basic.css" type="text/css" rel="stylesheet" />
</h:head>
<h:body>

Home

Liste

Daten

Movies

People

Login

    <h:form id="j_security_check">

            <h:messages errorClass="errorMessage" infoClass="infoMessage" warnClass="warnMessage"></h:messages>
            <h:panelGrid columns="2">
                <h:outputText value="Username : "/>
                <h:inputText id="j_username" value="#{loginBean.username}"/>

                <h:outputText value="Password : "/>
                <h:inputSecret id="j_password" value="#{loginBean.password}"/>

                <h:commandButton value="Submit" action="#{loginBean.login}" type="submit"/>
            </h:panelGrid>

    </h:form>

</h:body>

The page is shown but the form defined here isnt shown. everything
after the title is just a white screen.
Why the form isnt rendered?

A: Ok i got it!
This is the jsf mapping in my web.xml:
<context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
</context-param>

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jspx</url-pattern>
</servlet-mapping>

As you see the url-pattern describes ".jspx"
So i have to call my jsf with "myjsf.jspx" instead of "myjsf.xhtml"
<login-config>
    <auth-method>FORM</auth-method>
    <realm-name>loginRealm</realm-name>
    <form-login-config>
        <form-login-page>/jsf/login.jspx</form-login-page>
        <form-error-page>/jsf/error.jspx</form-error-page>
    </form-login-config>
</login-config>


text:
Q: Electric circuit AC plug to DC Design Help I'm new to designing electric circuits... but I have a simple project that I really need help on.
All I need is a AC plug source to be connected to a 100 WATT bulb and a 3V motor(motor should only have 3V across it).
Also, Ive read that I need a rectifier to convert AC to DC for the DC 3V motor?
Can anybody point me in the right direction on how to do this...
or how to learn how to do this?
Here's what my schematic so far looks like (it doesnt work)

A: No, that circuit won't work. You have a closed circuit for the lamp (the right loop), but the motor and resistor are just shorted; the loop they make doesn't have a voltage source in it.
The solution is a DC power supply, which unfortunately consists of quite some components.
First you'll have to lower the 120V/230V mains voltage to a more workable voltage to go to the 3V. That's what a transformer does. Next, you'll have to rectify the low voltage AC that the transformer outputs.

The bridge rectifier takes care of that. The smoothing capacitor is needed to remove the bumps from the rectified voltage. You then have a more or less smooth voltage, but it will vary with varying mains voltage and with a changing load of the motor. If you need a clean 3V DC you'll have to end with a voltage regulator.
If you don't need the regulator you'll need a 3.6V transformer, which will be hard to find.
A 5V transformer will give you 5V DC across the capacitor. Replace the 7805 in the schematic by a 3V LDO voltage regulator to drive your motor.
edit
jippie makes an excellent suggestion.

Wall-warts like this one exist that output a regulated 5V DC. This includes everything in the schematic. If your motor accepts 5V you can directly connect it to it, if it has to be 3V you'll need the LDO voltage regulator.


text:
Q: How to get the textual representation of an LLVM IR instruction? If I is of type llvm::Instruction, we can print out the same in human-readable form (textual representation) by errs() << I;
I want the assign the exact same representation to a std::string to C type string. How can I do that?

A: Well, LLVM provides a string stream as well:
#include <llvm/Support/raw_ostream.h>

Use it like this:
std::string str;
llvm::raw_string_ostream(str) << I;

// use str

A: I ran into some problems using @eush77's answer. Here is my fix.
std::string str;
llvm::raw_string_ostream ss(str);
ss << I;
errs() << ss.str() << "\n";


text:
Q: Как удалить одну запись из бд в foreach? Циклом выводятся записи из базы в виде блоков. При нажатии на кнопку удаления из бд удаляются все записи, а нужно чтобы удалялась только та запись, на которой нажата кнопка удаления.
Помогите пожалуйста разобраться.
<? foreach($getCity as $key):

if (isset($_POST['del'])) {
    $del = mysqli_prepare($mysqli, "DELETE FROM city WHERE title =?");
    mysqli_stmt_bind_param($del, 's', $key['title']);
    mysqli_stmt_execute($del);
    $dell = mysqli_stmt_get_result($del);
    mysqli_stmt_close($del);
}

<?=$key['title']?>

                         <form action="" method="post">
                          <button type="submit" name="del">✖</button>
                          </form>

<? endforeach?>

A: Необходимо разделять логику от представления. Поэтому в вашем случае должно быть 2 скрипта, как минимум. Первый это вывод записей, а второй удаление этих записей. В случае если index.php выводит данные, то например, delete.php удаляет записи.
Пример шаблона вывода:

  <? foreach($getCity as $key): ?>

        <?=$key['title']?>

        <button
          onclick="location.href='http://www.example.com/delete.php?title=<? $key['title'] ?>'"
          type="submit"
         >
           Удалить
         </button>

  <? endforeach ?>

Тогда ваш скрипт для удаления записей будет выглядить примерно так:
<?php

if (isset($_GET['title'])) {
  $del = mysqli_prepare($mysqli, "DELETE FROM city WHERE title = ?");
  mysqli_stmt_bind_param($del, 's', $key['title']);
  mysqli_stmt_execute($del);
  $dell = mysqli_stmt_get_result($del);
  mysqli_stmt_close($del);
}

Теперь изменив адрес обранения на ваш сайт (например на localhost) и кликая по кнопке, вы будите удалять конкретную запись.
Это пример использует запрос типа GET. Данный вариант решения вашей проблемы не является безопасным и приведён в качестве обучения.
Чтобы аналогичное сделать через запрос типа POST необходимо использования JavaScript.

A: В foreach вы ничего не должны удалять. В foreach вы должны вывести ваши формочки, а потом направить POST запрос, в котором передать первичный ключ по которому вы собираетесь проводить удаление в вашей табличке, "проэкранировав" при этом данные запроса, чтобы обезопаситься от инъекций.
UPD. Почему вы обрабатываете POST запрос непосредственно рядом с версткой? Так делать нельзя.
Пример:
<?php
$connection = // Получаем объект соединения
$zaprosIzBD = // какой-то массив из запроса

if(isset($_POST['del']))
{
    //Елси запрос пришел -> вытаскиваем ключ, экранируем и удаляем
    $key = mysqli_real_escape_string($connection, $_POST['key']);
    mysqli_query($connection, "DELETE FROM city WHERE id ='{$key}' ");
}
?>

<!DOCTYPE html>

    <title></title>

<?php
foreach ($zaprosIzBD as $key => $value) {
?>
    <form action="/" method="POST">

Название : <?= $value['name']?>

        <input type="hidden" name="key" value="<?= $value['key']?>">
        <input type="submit" name="del" value="yes">
    </form>
<?php
}
?>


text:
Q: Handling package and function names dynamically I'm on my first Golang project, which consists of a small router for an MVC structure. Basically, what I hope it does is take the request URL, separate it into chunks, and forward the execution flow to the package and function specified in those chunks, providing some kind of fallback when there is no match for these values in the application .
An alternative would be to map all packages and functions into variables, then look for a match in the contents of those variables, but this is not a dynamic solution.
The alternative I have used in other languages (PHP and JS)  is to reference those names sintatically, in which the language somehow considers the value of the variable instead of considering its literal. Something like: {packageName}.{functionName}() . The problem is that I still haven't found any syntactical way to do this in Golang.
Any suggestions?
func ParseUrl(request *http.Request) {

    //out of this URL http://www.example.com/controller/method/key=2&anotherKey=3

    var requestedFullURI = request.URL.RequestURI()       // returns '/controller/method?key=2key=2&anotherKey=3'
    controlFlowString, _ := url.Parse(requestedFullURI)
    substrings := strings.Split(controlFlowString.Path, "/")       // returns ["controller","method"]

    if len(substrings[1]) > 0 {

        // Here  we'll check if substrings[1] mathes an existing package(controller) name
        // and provide some error return in case it does not

        if len(substrings[2]) > 0 {
            // check if substrings[2] mathes an existing function name(method) inside
            // the requested package and run it, passing on the control flow
        }else{
            // there's no requested method, we'll just run some fallback
        }
    } else {
        err := errors.New("You have not determined a valid controller.")
        fmt.Println(err)
    }

}

A: You can still solve this in half dynamic manner. Define your handlers as methods of empty struct and register just that struct. This will greatly reduce amount of registrations you have to do and your code will be more explicit and readable. For example:
handler.register(MyStruct{}) // the implementation is for another question

Following code shows all that's needed to make all methods of MyStruct accessible by name. Now with some effort and help of reflect package you can support the routing like MyStruct/SomeMethod. You can even define struct with some fields witch can serve as branches so even MaStruct/NestedStruct/SomeMethod is possible to do.
dont do this please
Your idea may sound like a good one but believe me its not. Its lot better to use framework like go-chi that is more flexible and readable then doing some reflect madness that no one will understand. Not to mention that traversing type trees in go was newer the fast task. Your routes should not be defined by names of structures in your backend. When you commit into this you will end up with strangely named routes that use PascalCase instead of something-like-this.

A: What you're describing is very typical of PHP and JavaScript, and completely inappropriate to Go. PHP and JavaScript are dynamic, interpreted languages. Go is a static, compiled language. Rather than trying to apply idioms which do not fit, I'd recommend looking for ways to achieve the same goals using implementations more suitable to the language at hand.
In this case, I think the closest you get to what you're describing while still maintaining reasonable code would be to use a handler registry as you described, but register to it automatically in package init() functions. Each init function will be called once, at startup, giving the package an opportunity to initialize variables and register things like handlers and drivers. When you see things like database driver packages that need to be imported even though they're not referenced, init functions are why: importing the package gives it the chance to register the driver. The expvar package even does this to register an HTTP handler.
You can do the same thing with your handlers, giving each package an init function that registers the handler(s) for that package along with their routes. While this isn't "dynamic", being dynamic has zero value here - the code can't change after it's compiled, which means that all you get from being dynamic is slower execution. If the "dynamic" routes change, you'd have to recompile and restart anyway.


text:
Q: how to insert query and save json data into sql server using nodejs I am trying to insert query into SQL Server using window authentication with nodejs. I have done with get request of select query. but now am trying the post request with insert query. But I can't pass my req.body.address into the following query. the address data have json value.
here my code

here my request data,

the sql table row,

That is the error,

A: Your mysql library is probably, by default, applying a standard string conversion to req.body.address. When you do this to a javascript object you obtain [object Object]:
req.body.address.toString() // "[object Object]"

Objects needs to be converted to string using JSON.stringify():
"user_address": JSON.stringify(req.body.address)

A: You need to save as string in user_address field.
eg:
If you want to save as address like this:
user_address: `${req.body.address.street},${req.body.address.district},${req.body.address.city}`

Or
user_address: JSON.stringify(req.body.address)

whenever you want to show the address you need to do JSON.parse(user_address).
In nutshell, value must be a single value.


text:
Q: How do I load tables in AWS RDS MySQL and Aurora MySQL databases using LOAD DATA LOCAL INFILE in MySQL Workbench 8.0 without getting Error Code 1148? I have been successfully loading data into tables in an Amazon Web Services (AWS) RDS MySQL 5.7 database from my laptop using a set of LOAD DATA LOCAL INFILE commands for several months, using an earlier version of MySQL Workbench. When I recently upgraded to MySQL Workbench 8.0 (without changing the underlying AWS RDS database), I consistently started getting

MySQL "Error Code 1148: The used command is not allowed with this MySQL version."

I get the same error when I use the same LOAD DATA LOCAL INFILE commands with AWS RDS Aurora MySQL 5.6 and 5.7 databases. When I issue the load commands using other applications, I don't get this error, so I think the problem is with MySQL WB 8.0. When I enter the command
"SHOW VARIABLES LIKE 'local_infile'"

the result indicates that the value of the 'local_infile' variable is "On", so I don't think that I need to set "local_infile = 1" in the configuration file.  What do I need to do to again successfully load tables in AWS RDS MySQL and Aurora MySQL databases using LOAD DATA LOCAL INFILE commands issued from MySQL Workbench 8.0?


text:
Q: Partial derivation with respect to a difference I have the following function
$$f(\gamma,\kappa)=\gamma\kappa M^{2}(h_{v}+2(\kappa+\gamma M-\gamma)h_{\epsilon})(\kappa-\gamma)$$
What I want to know is how does $f(.)$ vary when $(\kappa-\gamma)$ changes.
What I'm thinking of is to find the partial derivation with respect to $(\kappa-\gamma)$:
$$\frac{\partial f(\gamma,\kappa)}{\partial(\kappa-\gamma)}=?$$
I am quite sure, i cannot just do the following:
$$\frac{\partial f(\gamma,\kappa)}{\partial(\kappa-\gamma)}=\gamma\kappa M^{2}(h_{v}+2(\kappa+\gamma M-\gamma)h_{\epsilon})$$
How can I solve this Problem?

A: Assuming that the only variables ar $\gamma$ and $\kappa$:
you must make a change of variables, for example:
$$
\left\{
\begin{array}{c}
x=\gamma+\kappa\\
y=\kappa-\gamma
\end{array}
\right.
$$
Since $2\gamma=x-y$ and $2\kappa=x+y$, you can write
$$
g(x,y)=\frac{1}{4}(x+y)(x-y) M^{2}(h_{v}+2(y+\frac{x-y}{2} M)h_{\epsilon})y
$$
Now you can make the partial derivative of $g$ respect to $y$ and write again in the variables $\gamma$ and $\kappa$.


text:
Q: How to bypass all other MVC routes when a URL contains a specific query parameter? I need to capture any request that contains a query parameter of URLToken, such as in this URL:
http://test.server.com/product?URLToken=4abc4567ed...
and redirect it to a specific controller and action.
I have tried setting up various routes with constraints including the one shown below.
app.UseMvc(routes =>
{
    routes.MapRoute(
           name: "ssocapture",
           template: "{*stuff}",
           defaults: new { controller = "Account", action = "SingleSignOn" },
           constraints: new { stuff= @"URLToken=" }  );

    routes.MapRoute(
           name: "default",
           template: "{controller=home}/{action=index}/{id?}");
});

Break points at the beginning of SingleSignOn are never hit via this rule (the following direct link to the action does hit the break point, so I know the controller and action are working).
http://test.server.com/account/singlesignon?URLToken=4abc4567ed...
What I am I missing / doing wrong ?

A: Routes are not designed to do that. To achieve your goals, simply add a middleware before UseMVC()
app.Use((ctx , next)=>{
    var token = ctx.Request.Query["URLToken"].FirstOrDefault();
    if(token!=null){
        ctx.Response.Redirect($"somecontroller/specificaction/{token}"); // redirect as you like
        // might be :
        //  ctx.Response.Redirect($"Account/SingleSignOn/{token}");
    }
    return next();
});

app.UseMvc(routes =>
{
    routes.MapRoute(
        name: "default",
        template: "{controller=Home}/{action=Index}/{id?}");
});

A: I think it's quite easy to do within your controller if you don't want to use the middleware. Another benefit you will get is that you can set the RouteName for all other routes and simply redirect to the route using RedirectToRoute method. So within your UrlToken action:
[Route("[action]"]
public IActionResult SingleSignOn(string urlToken)
{
    If (!string.IsNullOrWhitespace(urlToken))
    {
        return RedirectToRoute("RouteName"):
    }
}

For the above to work you have to specify the RouteName for other actions either by using AttributeRouting or define globally in the startup:
[Route("[action]", Name = "otherroute")]
public IActionResult OtherAction(string param1, string param 2)
{
    //...
}

So simply replace the "RouteName" in your SingleSignOn action to "otherroute" and it will work. If you need to pass the route parameters to the "otherroute" you can use one of the overloads of RedirectToRoute method. I hope this helps.


text:
Q: React JS / ANTD: Create new object entries from exisiting object array I am currently working with ANTD and React v18.
I want to display my data inside the table. For this, I need to create objects with regarding index and values.
The logic for a table is like this:
const dataSource = [
  {
    key: '1',
    name: 'Mike',
    age: 32,
    address: '10 Downing Street',
  },
];

const columns = [
  {
    title: 'Name',
    dataIndex: 'name',
    key: 'name',
  },
  {
    title: 'Age',
    dataIndex: 'age',
    key: 'age',
  },
  {
    title: 'Address',
    dataIndex: 'address',
    key: 'address',
  },
];

<Table dataSource={dataSource} columns={columns} />;

Now I have an object array like this:
const personData = [
    {
        "_id": "C84113",
        "Firstname": "Hola",
        "Lastname": "Tester",
        "__typename": "Person"
    },
    {
        "_id": "C_C84113_0",
        "Firstname": "Hermanoi",
        "Lastname": "Oko",
        "__typename": "Person"
    }
]

How can I map or push these values, that I receive something like this ?
//we create the respective columns

const personTableColumn = [
    { title: 'Person (Teilakte)', dataIndex: 'personName' },
    { title: 'ID', dataIndex: 'personID' },
  ];

//I want to have it like this
//personData.foreach() or push()
{
   "key":"i",
   "personName":"Person.Firstname +" "+ Person.Lastname",
   "personID":"Person.ID>"
}

A: You can iterate over the array and use the map function to create a new array with the object you need.
const personDataSource = personData.map((person, i) => {
  return {
    key: i,
    personName: person.Firstname + " " + person.Lastname,
    personID: person._id
  };
});

The personDataSource will have JSON object:
[
  { key: 0, personName: "Hola Tester", personID: "C84113" },
  { key: 1, personName: "Hermanoi Oko", personID: "C_C84113_0" }
]


text:
Q: Get call is showing MQ messages with few other chracters I am writing simple program to read messages from MQ but looking few more other characters along with message.
The message is prefixed by "b" & appearing within quotes.
eg:
Message in MQ is:
{"vaultToken":"2223008965840750"}

After read its written in file as:
b'{"vaultToken":"2223008965840750"}'

Can you please let me know why it's happening? Is there any character conversion needed? ( It's happening with any sample message which i am inserting into MQ for test purpose.)
Below is the snippet of code:
qmgr = pymqi.connect(queue_manager, channel, conn_info)

queue = pymqi.Queue(qmgr, queue_name)
message = queue.get()
print(message)


text:
Q: Mule 3.2 XSLT node: How to keep the original payload as well as the transformed payload? I am trying to create a mule flow (still on mule 3.2). My flow has to take an inbound message, transform the message using an xslt node and then send the transformed message to a destination. The problem I have is, the destination type and the destination where I am supposed to send my transformed message are in the original message. But after the transformation, I do not have access to the original message anymore.
Any ideas on how I can solve this issue?
Any help will be appreciated!!!
thanks!!!

A: Store the original message in a flow variable (aka an invocation-scoped message property). You can retrieve it from there after the transformation.


text:
Q: Creating a partial index based on declared variables inside a DO block I have a table on which I want to have two different partial unique indexes that include unique constraints on different columns, based on a the value of another column in the table (which is a foreign key). Here's an example:
id | col1 | col2 | col3 | col4
------------------------------
1  | 3    | 4    | 'a'  | 13
2  | 2    | 2    | 'b'  | 431
3  | 3    | 4    | 'b'  | 18
4  | 10   | 8    | 'b'  | 211

Let's say in this table I want:

*

*to put a partial index on all the rows where col4=13 OR col4=18 with a unique constraint on col1, col2, and col3

*to put a partial index on all the rows where col4<>13 AND col4<>18 with a unique constraint on col1 and col2

The problem is that I want to do this based on the value of a column in another table since col4 is a foreign key. This SO post asks a similar question but there isn't really a solution. Here is what I've done with pl/pgsql:
DO
$$
    DECLARE
        -- typical subquery
        option1_id INTEGER := (SELECT id FROM option_table WHERE name = 'option1');
        option2_id INTEGER := (SELECT id FROM option_table WHERE name = 'option2');
    BEGIN

        RAISE INFO '%, %', option1_id, option2_id;

        -- option1
        CREATE UNIQUE INDEX option1_index ON ex_table (col1, col2) WHERE (
            col4 NOT IN (option1_id, option1_id)
        );

        -- option2
        CREATE UNIQUE INDEX option2_index ON ex_table (col1, col2, col3) WHERE (
            reference_type IN (option1_id, option2_id)
        );

        -- this works!
        CREATE UNIQUE INDEX this_works ON ex_table (col1, col2, col3) WHERE (
            reference_type IN (13, 18)
        );
    END
$$;

Here is the error that I'm getting:
ERROR:  column "option1_id" does not exist
I know the variables are properly declared because the RAISE INFO is returning INFO:  13, 18

A: DDL statements doesn't support parametrization - you cannot to use any variables there. You should to use dynamic SQL (in this case without clause USING):
EXECUTE format('CREATE UNIQUE INDEX ... WHERE reference_type IN (%L, %L)', option1_id, option2_id);


text:
Q: How to install linberry for Blackberry Bold? I've bought a Blackberry Bold 9700, and I need to connect it to my computer, reading in some blogs knew linberry, but when I looked for it in software center I didn't find it. could someone explain me how to install it by terminal or if it has another name. Help

A: In the software centre> search "blackberry" see the results below
This is what Ubuntu offers

you can download LinBerry which is a third-party application from here: http://linberry.webcindario.com/index.html
I did not see any installation instructions only to sudo dpkg --force-overwrite -i nombre_del_paquete.deb


text:
Q: Rendering as a function of DOM state Imagine a react component that renders an absolutely positioned element. This element's position on the page is a function of data extracted from the DOM (not from any component state).
Does react have a good pattern for rendering as a function of DOM state?

My best idea I'd call double rendering:

*

*Read the DOM in the relevant componentDidMount/componentDidUpdate.

*setState of the dependent component or otherwise re-render it.

*Requires defining shouldComponentUpdate to prevent infinite render/componentDidMount loops.

A: The componentDidMount event is where you would want to do this.

componentDidMount - from the react docs
At this point in the lifecycle, the component has a DOM representation
which you can access via React.findDOMNode(this).
If you want to integrate with other JavaScript frameworks, set timers
using setTimeout or setInterval, or send AJAX requests, perform those
operations in this method.

I would place the absolute element on the page but out of view, and then move it into position in the componentDidMount event.
I wouldn't call this double rendering.


text:
Q: Poisson normal approximation for comparing means of count data I'm trying to compare the values of two counts from an A/B test, $c_1$ and $c_2$.
If I assume the data is Poisson distributed then the mean and variance are $\lambda$ and the standard error is $\frac {\lambda}{n}$.  Since we only have one observation for each count the means and SE are just $c_1$ and $c_2$ for each.  If $\lambda$ is sufficiently large, I can assume that the Poisson distribution approximates a normal distribution.  I'm therefore creating a test statistic which is $\frac{c2-c1}{\sqrt{c1+c2}}$, and comparing this to 1.96 to check the significance of the difference.
Is this a valid procedure?

A: The generally accepted way of comparing 2 samples from Poisson distributions, to see if they have the same mean, is to note that the sum of 2 Poisson random variables $X_1$ and $X_2$ with means $\lambda_1$ and $\lambda_2$ is Poisson with mean $\lambda_1 + \lambda_2$; and the conditional distribution of $X_1$ given $X_1 + X_2 = n$ is $Binomial(n, \lambda_1 / (\lambda_1 + \lambda_2))$.
So you would compute the probability of observing $X_2 = c_2$ under that.
See http://www.biostat.jhsph.edu/~bcaffo/651_2006/files/lecture27.pdf


text:
Q: How to create a BigQuery dataset and a table/schema from Java client (without CSV file) I think the method starting line 200 here is relevant (edit: I needed to add a parameter to the line
    Insert insertReq = bigquery.jobs().insert(PROJECT_ID, insertJob);
) but it doesn't work. I get "Load configuration must specify at least one source URI"
I have tried the following:
    TableSchema schema = new TableSchema();
    List<TableFieldSchema> tableFieldSchema = new ArrayList<TableFieldSchema>();
    TableFieldSchema schemaEntry = new TableFieldSchema();
    schemaEntry.setName(myFirstFieldName);
    schemaEntry.setType("STRING");
    tableFieldSchema.add(schemaEntry);
    schema.setFields(tableFieldSchema);

    Table table = new Table();
    table.setSchema(schema);
    table.setId(tableName);
    table.setCreationTime(System.currentTimeMillis());
    table.setKind("bigquery#table");
    try {
        bigquery.tables().insert(PROJECT_ID, DATASET_ID, table).execute();
    } catch (IOException e) {
    }

but I get an error Required parameter is missing

A: Try setting the project id and the dataset id on the table (I realize that it seems redundant becuase you specify them on the insert() operation, but that is a quirk of REST ... the project and dataset are part of the URL, but they are also part of the resource.
From a raw HTTP api level, the following works:
https://www.googleapis.com/bigquery/v2/projects/myproject/datasets/mydataset/tables?alt=json
{"tableReference":
    {"tableId": "dfdlkfjx", "projectId": "myproject", "datasetId": "mydataset"},
 "schema":
     {"fields": [{"name": "a", "type": "STRING"}]}}

A: OK based on the idea by Jordan Tigani, here is the Java code that works to create a blank table in BigQuery with Google Java API Client:
TableSchema schema = new TableSchema();
List<TableFieldSchema> tableFieldSchema = new ArrayList<TableFieldSchema>();
TableFieldSchema schemaEntry = new TableFieldSchema();
schemaEntry.setName(myFirstFieldName);
schemaEntry.setType("STRING");
tableFieldSchema.add(schemaEntry);
schema.setFields(tableFieldSchema);

Table table = new Table();
table.setSchema(schema);
TableReference tableRef = new TableReference();
tableRef.setDatasetId(DATASET_ID);
tableRef.setProjectId(PROJECT_ID);
tableRef.setTableId(tableId);
table.setTableReference(tableRef);
try {
    bigquery.tables().insert(PROJECT_ID, DATASET_ID, table).execute();
} catch (IOException e) {
}

To create a dataset (before creating the table)
    Dataset dataset = new Dataset();
    DatasetReference datasetRef = new DatasetReference();
    datasetRef.setProjectId(PROJECT_ID);
    datasetRef.setDatasetId(DATASET_ID);
    dataset.setDatasetReference(datasetRef);
    try {
        bigquery.datasets().insert(PROJECT_ID, dataset).execute();
    } catch (IOException e) {
    }


text:
Q: Silverlight application doesn't run. I get an invalid or malformed application error I have a Silverlight application, and when I click 'run' Internet Explorer starts up and nothing is shown. I get an error icon in the bottom left that, when I click it, result in the following error.

Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
  Timestamp: Wed, 25 Nov 2009 00:11:41 UTC
Message: Unhandled Error in Silverlight Application
Code: 2103
Category: InitializeError
Message: Invalid or malformed application: Check manifest
Line: 54
  Char: 13
  Code: 0
  URI: http://localhost:50511/TestPage.html

Why do I get this error? And how can I fix it?
I have looked around and other people seemed to get this error when they renamed their application, however I haven't done this.
I have created a custom style, if that might have anything to do with it.
I have done no coding, all I have done is dragging on my style's controls and linked the pages.

A: Just in case this helps someone else:
I was banging my head against the wall for a while trying to figure out why I got this error.  Everything seemed correct.
The .xap file is just a .zip, so one is able to manually change information in the ClientConfig after deploying (simply by unzipping the file then re-archiving it).  I had been changing WCF endpoint information post-deployment then rezipping.  Well, without realizing it I had been zipping  the folder, which meant there was a folder inside the zip instead of the contents of that folder being in the root of the zip.
This was a stupid mistake, but from a client perspective, the .xap seemed to be coming across fine.   The only error I got was the 2103 error.  Moving the files to the root of the zip fixed my problem.

A: I have run into this issue a few times when deploying an existing Silverlight application to a  new environment or a repaved dev computer.
When you install IIS, make sure you have the Static Content feature enabled (under Common Http Features), so that you can see MIME Types feature available at the root of the IIS Manager. The type .XAP should be set to application/x-silverlight.
This resolved the issue for me.
Thanks to: http://keremozen.com/2012/10/18/solution-alternatives-to-invalid-or-malformed-application-check-manifest-error/

A: I got this error when I deleted a resource dictionary from my project that was referenced in App.xaml. Visual Studio built the solution fine and gave no indication that anything was wrong.
When I remembered to delete the line from App.xaml, everything worked fine.

A: I've had this error in a few circumstances.  Check that the Startup Object in the properties is correct (any namespace changes?).  Be sure to explicitly add your Silverlight project as a dependent project for your web project, this is not done by default.
Re-add your Silverlight project under the Silverlight Applications in the web project's properties.  Make sure that the App.xaml x:Class matches the code behind namespace and class name.  Hmm, I think those are the usual tricks.
I hope this helps.

A: Below things worked perfectly for me
(1)  Check that the Startup Object in the properties is correct.
(2) Be sure to explicitly add your Silverlight project as a dependent project for your web project, this is not done by default.
:Right click on Solution (not on the individual project) > Properties > Project Dependencies > Select Web Project under Project & Check Silverlight Client Project under Depends on. > Apply > Ok.
(3) Re-add your Silverlight project under the Silverlight Applications in the web project's properties..
:Right Click on Web Project > Properties > Silverlight Applications > Click on Add & Select Silverlight Client Project Under Project. :thumbsup:

A: Check to ensure all of the prerequists are installed on the web server.  I struggled with this for over 4 hours.  Every posting on the web talked about changing the Namespace which I did not do.  I eventually decided to try my application on another webserver and the problem went away.
Thanks to everyone posted their fix, but if all esle fails try another computer or check your prereqs.

A: The error occured when I went to object->Edit Style-> Edit A Copy on a 'Sketch' style object. I put the new style in a new resource.
When I removed these styles the error went away. I then remade the styles I wanted from scratch, instead of editing a copy and I did not get the error.

A: Even though this is an old post, this same issue had eaten up few hours of my time. The given above solutions had not worked out for me.
By setting the Copy Local = True for all the externally referenced assemblies had solved this problem for me.
Initially visual studio sets Copy Local = True for all the assemblies, but then the project will start to refer from the locally copied assembly(bin\debug). In order to make it to refer the common location, i have set Copy Local= False and so ended up with this issue.
Hope this would save somebody of yours time...

A: Here is another issue I found. The ordering of BasedOn Styles seem to matter.
The following will cause a WSOD with the errorcode 2103.
<Style x:Key="Style2" TargetType="TextBlock" BasedOn="{StaticResource Style1}" />
<Style x:Key="Style1" TargetType="TextBlock" />

But this will not.
<Style x:Key="Style1" TargetType="TextBlock" />
<Style x:Key="Style2" TargetType="TextBlock" BasedOn="{StaticResource Style1}" />

Took me a long time to find this. It seems like it's actually more of an issue with how the XAML interpreter works, but it's easy to work around.

A: We experienced the issue after a change in Wcf Query Service. We added overloaded methods to said Wcf service. Like so
    [OperationContract]
    int test(Guid id);

    [OperationContract]
    int test(Guid id, int id2);

When running the application it gave us the error. When we removed one of the 2 methods it ran perfectly fine. Putting it back error came back aswell. Renaming one solved the issue.
Therefore be very catious when doing overloading in Wcf.

A: I also ran into this very recently.  I discovered that if I renamed the assembly in the project properties, it didn't update the application HTML or ASPX file.


text:
Q: How to match nth occurrence in a string using regular expression How to match nth occurrence in a string using regular expression

set test {stackoverflowa is a best solution finding site
  stackoverflowb is a best solution finding site stackoverflowc is a
  best solution finding sitestackoverflowd is a best solution finding
  sitestackoverflowe is a best solution finding site}

regexp -all {stackoverflow} $test

The above one give "5" as output
regexp {stackoverflow} $test

The above one give stackoverflow as result, here it is matching first occurrence of stackoverflow (i.e) stackoverflowa
My requirement is i want to match 5th occurrence of stackoverflow (i.e) stackoverflowe from the above given string.
Please some one clarify my question..Thanks
Then another one question

A: Try
set results [regexp -inline -all {stackoverflow.} $test]
# => stackoverflowa stackoverflowb stackoverflowc stackoverflowd stackoverflowe
puts [lindex $results 4]

I'll be back to explain this further shortly, making pancakes right now.
So.
The command returns a list (-inline) of all (-all) substrings of the string contained in test that match the string "stackoverflow" (less quotes) plus one character, which can be any character. This list is stored in the variable result, and by indexing with 4 (because indexing is zero-based), the fifth element of this list can be retrieved (and, in this case, printed).
The dot at the end of the expression wasn't in your expression: I added it to check that I really did get the right match.  You can of course omit the dot to match "stackoverflow" exactly.
ETA (from Donal's comment): in many cases it's convenient to extract not the string itself, but its position and extent within the searched string. The -indices option gives you that (I'm not using the dot in the expression now: the index list makes it obvious which one of the "stackoverflow"s I'm getting anyway):
set indices [regexp -inline -all -indices {stackoverflow} $test]
# => {0 12} {47 59} {94 106} {140 152} {186 198}

You can then use string range to get the string match:
puts [string range $test {*}[lindex $indices 4]]

The lindex $indices 4 gives me the list 186 198; the {*} prefix makes the two elements in that list appear as two separate arguments in the invocation of string range.


text:
Q: Prove that $DQ \times DB = DP \times DC + DR \times DA$. Let $ABCD$ be a parallelogram, with $P$, $Q$, and $R$ the points on which a given circle passes through $D$ and cuts through the segments $CD$, $BD$ and $AD$ respectively:

How do you prove that $DQ \times DB = DP \times DC + DR \times DA$?

A: Since $\angle PRQ = \angle PDQ = \angle ABD$ and $\angle RQP = 180^\circ - \angle PDR = \angle DAB$, triangles $PQR$ and $DAB$ are similar. Therefore there exists $k>0$ such that $$k = \frac{PQ}{DA} = \frac{QR}{AB} = \frac{RP}{BD}.$$ By Ptolemy theorem in $DRQP$ we get $$DQ \cdot PR = DP \cdot RQ + DR \cdot PQ.$$ Substituting $PR = k\cdot DB, \ QR = k \cdot AB = k \cdot DC, \ PQ = k \cdot DA$ and dividing by $k$ we arrive at $$DQ \cdot DB = DP \cdot DC + DR \cdot DA.$$


text:
Q: $\sum_{n=1}^\infty \frac {\log(n)}{(n!)}$ Convergent using comparison test? I tried comparison test using $1/n!$ as the test series but when I use it in ratio, I get $\log(n)$ which goes to infinity which means the test series is divergent which is not true so I cannot figure out which series I can pick out that can be used in the comparison test.

A: As an alternative since eventually
$$n!\ge n^3\ge n^2\ln n$$
$$\sum_{n\ge n_0}^{ }\frac{\ln\left(n\right)}{n!}\le\sum_{n\ge n_0}^{ }\frac{\ln n}{n^2\ln n}=\sum_{n\ge n_0}^{ }\frac{1}{n^2}$$
which converges.

A: Use the fact that $\ln\left(n\right)<n$ for $n$ positive real number,then:
$$\sum_{n\ge1}^{ }\frac{\ln\left(n\right)}{n!}<\sum_{n\ge1}^{ }\frac{n}{n!}=\sum_{n\ge0}^{ }\frac{1}{n!}=e$$


text:
Q: Tranforming dates into Weeks and Fortnights by Months using lubridate I want to transform dates into weeks and fortnights by months using lubridate R package. My working example is below:
library(tidyverse)
library(lubridate)

dt1 <-
  tibble(
    Date      = seq(from = ymd("2021-01-01"), to = ymd("2021-12-31"), by = '1 day')
  , Week      = week(Date)
  , Fortnight = ceiling(week(Date)/2)
  , Month     =  month(Date)
    )
dt2 <-
  dt1 %>%
  group_by(Month) %>%
  mutate(
    WK = week(Date)
  , FN = ceiling(week(Date)/2)
    )

head(dt2, 10)
# A tibble: 10 x 6
# Groups:   Month [1]
   Date        Week Fortnight Month    WK    FN
   <date>     <dbl>     <dbl> <dbl> <dbl> <dbl>
 1 2021-01-01     1         1     1     1     1
 2 2021-01-02     1         1     1     1     1
 3 2021-01-03     1         1     1     1     1
 4 2021-01-04     1         1     1     1     1
 5 2021-01-05     1         1     1     1     1
 6 2021-01-06     1         1     1     1     1
 7 2021-01-07     1         1     1     1     1
 8 2021-01-08     2         1     1     2     1
 9 2021-01-09     2         1     1     2     1
10 2021-01-10     2         1     1     2     1

tail(dt2, 10)
# A tibble: 10 x 6
# Groups:   Month [1]
   Date        Week Fortnight Month    WK    FN
   <date>     <dbl>     <dbl> <dbl> <dbl> <dbl>
 1 2021-12-22    51        26    12    51    26
 2 2021-12-23    51        26    12    51    26
 3 2021-12-24    52        26    12    52    26
 4 2021-12-25    52        26    12    52    26
 5 2021-12-26    52        26    12    52    26
 6 2021-12-27    52        26    12    52    26
 7 2021-12-28    52        26    12    52    26
 8 2021-12-29    52        26    12    52    26
 9 2021-12-30    52        26    12    52    26
10 2021-12-31    53        27    12    53    27

Questions

*

*WK (Weeks by Months) and FT (Fortnight by Months) are not as expected.

*Want to label Weeks as January 01-07, January 08-14, January 15-21, January 22-28, January 29-31, etc.

*Want to label Fortnights as January 01-14, January 15-28, January 29-31, etc.

A: We may need to group by the 'WK', 'FT' to do this
library(dplyr)
library(lubridate)
library(stringr)
dt1 %>%
  group_by(Month) %>%
  mutate(WK = week(Date), FN = ceiling(week(Date)/2)) %>%
  group_by(WK, .add = TRUE) %>%
  mutate(WKfmt = str_c(format(min(Date), '%B %d-'),
      format(max(Date), '%d'))) %>%
  group_by(Month, FN) %>%
  mutate(FNfmt = str_c(format(min(Date), '%B %d-'),
      format(max(Date), '%d'))) %>%
  ungroup

-output
# A tibble: 365 × 8
   Date        Week Fortnight Month    WK    FN WKfmt         FNfmt
   <date>     <dbl>     <dbl> <dbl> <dbl> <dbl> <chr>         <chr>
 1 2021-01-01     1         1     1     1     1 January 01-07 January 01-14
 2 2021-01-02     1         1     1     1     1 January 01-07 January 01-14
 3 2021-01-03     1         1     1     1     1 January 01-07 January 01-14
 4 2021-01-04     1         1     1     1     1 January 01-07 January 01-14
 5 2021-01-05     1         1     1     1     1 January 01-07 January 01-14
 6 2021-01-06     1         1     1     1     1 January 01-07 January 01-14
 7 2021-01-07     1         1     1     1     1 January 01-07 January 01-14
 8 2021-01-08     2         1     1     2     1 January 08-14 January 01-14
 9 2021-01-09     2         1     1     2     1 January 08-14 January 01-14
10 2021-01-10     2         1     1     2     1 January 08-14 January 01-14
# … with 355 more rows


text:
Q: postgresql Importing csv integer error but the id number is in the file Hi I did this command on my original DB :
\COPY (SELECT * FROM cms_title WHERE title = 'Migration-test') TO '/Users/JayCee/cms_title_dump.csv' WITH CSV HEADER DELIMITER ';' NULL AS '';

It worked fine.
But when I try to copy it to an other DB I have this :
\COPY cms_title FROM 'cms_title_dump.csv' DELIMITER ';' CSV;

ERROR:  invalid input syntax for integer: "id"
CONTEXT:  COPY cms_title, line 1, column id: "id"

I don't understand, here is what I have when I do a cat -e on my file :
id;language;title;page_title;menu_title;meta_description;slug;path;has_url_overwrite;redirect;creation_date;published;publisher_is_draft;publisher_state;page_id;publisher_public_id$
217;en;Migration-test;"";"";"";migration-test;migration-test;f;"";2015-11-24 13:01:52.184969+00;t;t;0;99;218$

wow I am so lost even after reading tons of subject.. But contrary to those, I don't see any mistake here!

A: Your \COPY command generates a header line which is being read by the import command as data.
Either you do not generate the header line or tell the import command to not read the first line.
To avoid the header line generation omit the HEADER option.
To ignore the header line insert the HEADER option in the import command.


text:
Q: Why is CSS not being applied after adding a class with JQuery? So it works in jfiddle.
http://jsfiddle.net/S2B5Z/8/

//site .js
(function() {
  var $sidebarAndWrapper = $("#sidebar,#wrapper");
  $("#sidebarToggle").on("click", function() {
    $sidebarAndWrapper.toggleClass("hide-sidebar");

    if ($sidebarAndWrapper.hasClass("hide-sidebar")) {
      $(this).text("Show Sidebar");
    } else {
      $(this).text("Hide Sidebar");
    }
  });
})();
/*site.css*/

body {
  font-family: sans-serif;
  font-size: 14px;
  margin: 0;
}

label {
  font-weight: bold;
  display: block;
}

input[type=text],
input[type=password],
textarea {
  width: 150px;
}

#main {
  background-color: #eee;
  padding: 4px;
  margin: 0;
}

#footer {
  background-color: #222;
  color: #eee;
  padding: 8px 5px;
  position: fixed;
  bottom: 0;
  width: 100%;
}

.headshot {
  max-width: 50px;
  border: 1px solid #222;
  padding: 3px;
}

.menu {
  font-size: 12px;
}

.menu li {
  list-style-type: none;
}

.menu li.active {
  font-weight: bold;
}

.menu li a {
  color: #eee;
}

#sidebar {
  background: #2a2c36;
  color: #eee;
  position: fixed;
  height: 100%;
  width: 250px;
  overflow: hidden;
  left: 0;
  margin: 0;
  transition: left ease .25s;
}

#sidebar.hide-sidebar {
  left: -250px;
  transition: left ease .25s;
}

#wrapper {
  margin: 0 0 0 250px;
  transition: margin-left ease .25s;
}

#wrapper.hide-sidebar {
  margin-left: 0;
  transition: margin-left ease .25s;
}
<!DOCTYPE html>

    <link rel="stylesheet" href="css/site.css" />

    Test

Home

About

Contact

        <button id="sidebarToggle">Toggle Menu</button>

My site

      © 2017

For some reason it doesn't work when I debug it from visual studio. The JQuery is working and adds the class to the specified targets but the CSS does not get applied to them.
I do have the css in its own file and the JQuery in its own file as well.
I've added where my files are placed in comments just to show how it looks.
I must be missing something but what could it be?

A: It works fine in my end but you forgot to inluce jQuery, maybe you will need to add prefix -webkit- for transition css3 if you are using old browser.

//site .js
(function() {
  var $sidebarAndWrapper = $("#sidebar,#wrapper");
  $("#sidebarToggle").on("click", function() {
    $sidebarAndWrapper.toggleClass("hide-sidebar");

    if ($sidebarAndWrapper.hasClass("hide-sidebar")) {
      $(this).text("Show Sidebar");
    } else {
      $(this).text("Hide Sidebar");
    }
  });
})();
/*site.css*/

body {
  font-family: sans-serif;
  font-size: 14px;
  margin: 0;
}

label {
  font-weight: bold;
  display: block;
}

input[type=text],
input[type=password],
textarea {
  width: 150px;
}

#main {
  background-color: #eee;
  padding: 4px;
  margin: 0;
}

#footer {
  background-color: #222;
  color: #eee;
  padding: 8px 5px;
  position: fixed;
  bottom: 0;
  width: 100%;
}

.headshot {
  max-width: 50px;
  border: 1px solid #222;
  padding: 3px;
}

.menu {
  font-size: 12px;
}

.menu li {
  list-style-type: none;
}

.menu li.active {
  font-weight: bold;
}

.menu li a {
  color: #eee;
}

#sidebar {
  background: #2a2c36;
  color: #eee;
  position: fixed;
  height: 100%;
  width: 250px;
  overflow: hidden;
  left: 0;
  margin: 0;
  transition: left ease .25s;
}

#sidebar.hide-sidebar {
  left: -250px;
  transition: left ease .25s;
}

#wrapper {
  margin: 0 0 0 250px;
  transition: margin-left ease .25s;
}

#wrapper.hide-sidebar {
  margin-left: 0;
  transition: margin-left ease .25s;
}

<!DOCTYPE html>

    <link rel="stylesheet" href="css/site.css" />

    Test

Home

About

Contact

        <button id="sidebarToggle">Toggle Menu</button>

My site

      © 2017


text:
Q: Время на c# и на Android в C# есть возможность передать время через массив байтов таким образом:
DateTime FromDate = DateTime.Now;
b = BitConverter.GetBytes(FromDate.ToBinary())
//и обратно
FromDate = DateTime.FromBinary(BitConverter.ToInt64(b, 0));

как сделать тоже самое на андроид?
Date FromDate = new Date();
byte[] bb = ByteBuffer.allocate(8).putLong(FromDate.getTime()).array();

оно возвращает во первых массив развёрнутый. а во вторых значения разные.
можно привести в нужный вид из андроида с помощью функции:
static DateTime JavaLongToCSharpLong(long javaLong)
{
    TimeSpan ss = TimeSpan.FromMilliseconds(javaLong);
    DateTime Jan1st1970 =
        new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
    DateTime ddd = Jan1st1970.Add(ss);
    DateTime final = ddd.ToUniversalTime();

    return final;
}

но мне нужно чтобы андроид код сразу выдавал значение, которое можно будет принять без этой функции

A: решил так:
 ByteBuffer.allocate(8).putLong(dt2.getTime().getTime()*10000+621355968000000000l).array();

т.е. добавил разницу во времени
(dt2.getTime().getTime()*10000 - это не очень точно, но для моей задачи достаточно)


text:
Q: Highlight current menu item in sidebar I'm using django with Twitter Bootstrap.  My current view resembles one of the examples provided.  Looking at the example, one can imagine the user clicking one of the links in the sidebar to see different views, each framed with this same sidebar.  One would imagine that the link selected would then be highlighted just like the example using the code:

Link

The active class needs to be attached to the correct menu item.  How might I assign this "active" class to the correct menu item?  Originally, I tried using a variable from my view to assign it with jquery:
$(document).ready(function() {
    $("#{{ current_view }}_nav").addClass('active');
});

Link

This seems cumbersome though.  It requires that I pass the id to the template from the view.  Lots of ids to manage as well.  Is there a better / more preferred way to assign this active class?

A: I think your use of # for the href in your sample code is clouding the issue. I'm assuming your real-world scenario is actual real links and automatically highlighting them based on the active URL. If that's correct, then just do:
{% url something as url %}

Link1

Where, "something" is the name of a urlpattern or dotted-path to a view, etc. This assumes you're reversing the URL, obviously, so if you're using a static URL, you'd just hardcode it:

Link1

A: If you've organized your project into a base.html template that is extended by other templates, e.g. appname/pagename.html, you can use a template-centric approach to highlighting the active navigation element.
This approach gives you some decoupling advantages, which I've noted in detail at the end of this answer.
I've found this approach to be very useful for handling broad navigation items that remain the same across most or all of a site.  It is probably not an appropriate solution for more detailed navigation elements, such as rendering a dynamic list of items gleaned from your data store.
In your base.html template, add a block to each navigation element, giving unique names to the blocks:

    Home

    About

    Pricing

In your appname/pagename.html template, if you want one of the nav elements to appear active, override the appropriate block using active as the content.  For example, to highlight the "About" item:
{% block navbar_class-about %} active {% endblock %}

When you use a view that renders that template, it'll render like this:

    Home

    About

    Pricing

This provides an initial rendering that doesn't rely on JavaScript.  (You can modify the nav bar classes in place using JavaScript if you're doing a single-page app.)
For many (but not all) cases, this can be a better separation presentation from view logic:

*

*You can modify views to attach site-navigation data to the template context, but doing so strongly couples the presentation to the view layer, and makes it more difficult to create reusable apps or to integrate third-party apps.
The view is already selecting a named template, which means that you are already passing some navigation-related information to the template layer.  That may be all you need.

*You can use a template context processor to get some information about the view, but this just moves the strong coupling to another layer of the system, rather than staying within the template layer.

A: Better solution, with less code. Woks well with Bootstrap. Just change the "addClass" query to select your menu items.
On Javascript, create this function:
var highlight_menu = function(path) {
    /* Highlight current link */
    $('.nav li').removeClass('active');
    $('.nav li:has(a[href="' + path + '"])').addClass('active')
};

On the base.html, call the JS function with the current path:

A: FWIW, the Twitter Bootstrap page itself has this functionality provided by using the Scrollspy plugin.
Otherwise, you could just listen to a click event in your menu.
$('.nav').on('click', 'li:has(a[href^="#"])', function (e) {
  $('.nav li').removeClass('active');
  $(this).addClass('active');
});

A: Make an inclusion snippet for your menu:

Link1

Link2

Link3

...

Include it in your basic template as:
{% include "menu.html" with opt=request.GET.opt %}

You don't need to use $( document ).ready(...) as you see.
Don't forget to add a request to your TEMPLATE_CONTEXT_PROCESSORS:
TEMPLATE_CONTEXT_PROCESSORS = (
  # ...
  'django.core.context_processors.request',
  # ...
)

A: You might consider the following approach to resolve the issue in Django.
It works fine without using javascript. Just by using the pure Django you should be able to address the most of the situations where you need to highlight menu  options.
In this example I am using Bootstrap 4 but it is not important. You can use your own CSS and you will be ok. The idea here is just to show the use of request.resolver_match.url_name as url_name to achieve what you need.
{% with request.resolver_match.url_name as url_name %}

       Menu option 1

       Menu option 2

{% endwith %}

A: I used a a simple_tag for that purpose. Maybe someone will find it helpful.
Make a file isactive.py and put in your templatetags directory on the level of your app template path.
from django import template
from django import urls
register = template.Library()

@register.simple_tag
def isactive(page_name, request_url):
    rev_url = ''
    try:
        rev_url = urls.reverse(page_name)
    except:
        return ''
    if (rev_url == request_url):
            return 'active'
    return ''

And in your html template
{% load isactive %}

after loading static
and in your menu

When rendering - django is executing function isactive where 1st parameter is the name of the page and the other is the path. Inside the isactive function the name is resolved and compared. When it matches the active string is returned and placed in resulting html.
You have to put that call in every nav link.
The name of the page is taken from urlpatterns in urls.py of your app
urlpatterns = (
    ...
    path("my_table/list/", views.mytableListView.as_view(), name="my_table_list"),
    ....


text:
Q: Sending string list from Android to vb.net Stuck in this since 2 days now. I am trying to send complex data to vb.net WCF service.
This is the service request:
class saveLoadParts extends AsyncTask<List<String>, String, String>{

@Override
protected String doInBackground(List<String>... params) {

    List<String> checkList = new ArrayList<String>();
    checkList = oldList;
    SoapObject request  = new SoapObject(NAMESPACE, METHOD_NAME4);
    SoapObject soapLogs  = new SoapObject(NAMESPACE, "checkList");
    for (String i : checkList){
        soapLogs.addProperty("ItemList", i);
    }

    request.addSoapObject(soapLogs );

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.setOutputSoapObject(request);
    envelope.dotNet = true;
    HttpTransportSE transport = new HttpTransportSE(URL);
    try {
        transport.call(GETUSER_SOAP_ACTION + METHOD_NAME4, envelope);
        SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
        finalResult = response.toString();

    }catch (SoapFault e) {
        e.printStackTrace();
    } catch (HttpResponseException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (XmlPullParserException e) {
        e.printStackTrace();
    }

    return finalResult;
}

@Override
protected void onPostExecute(String result) {
    if (!result.equals("")){
        Toast.makeText(OrderDetailView.this, "List Stored",Toast.LENGTH_SHORT).show();
    }
}}

And this is my VB.net code
Public Class ItemList
     Public abc As String
End Class

Function SaveLoadParts(ByVal checkList As ItemList()) As String Implements IService1.SaveLoadParts
    Dim a As String = checkList(0).abc.ToString()
    Return a
End Function

I have tried almost everything I can possibly find on Internet, It always give me an error
 Now I am getting this.

SoapFault - faultcode: 'a:DeserializationFailed' faultstring: 'The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:checkList. The InnerException message was 'Error in line 1 position 361. Element 'http...' contains data from a type that maps to the name 'http...'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'checkList' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details.' faultactor: 'null' detail: null
Please help!!


text:
Q: arcpy.da.insertCursor not saving output? Referencing an answer to Interpolating points along line in Python for ArcGIS Desktop?, I have copied this code verbatim (swapping out my two feature classes; a line layer and an empty point layer) but for some reason it does not save the output (e.g. the point feature class is empty). I'm running it in IDLE and if I leave the Python shell open I can add (after the script runs) the following code:
outPath = r"C:\path\to\MyData\testGDB.gdb"
outName = 'test_points'
ftrCount = int(arcpy.GetCount_management(outPath + "\\" + outName).getOutput(0))

and then I can type
"> ftrCount"

and it returns "17"
So obviously there are seventeen features created that are not being stored in the output feature class.
This is similar to Insert Cursor fails to write results to table but my results ARE in tuple format so I'm failing to understand what is wrong.
If I print the xy variable in the loop I get my state plane coordinates ...
(617914.0259078296, 612215.8199066787)
(617894.1203419868, 612230.9450000166)
(617874.214776144, 612246.0700933544)
(617854.3092103013, 612261.1951866923)
(617834.4036444585, 612276.3202800301)
(617814.4980786156, 612291.445373368)
(617794.5925127729, 612306.5704667058)
(617774.6869469301, 612321.6955600437)
(617754.7813810873, 612336.8206533815)
(617734.8758152445, 612351.9457467194)
(617714.9702494018, 612367.0708400572)
(617695.0646835589, 612382.195933395)
(617675.1591177161, 612397.3210267328)
(617655.2535518734, 612412.4461200706)
(617635.3479860306, 612427.5712134085)
(617615.4424201878, 612442.6963067463)
(617595.536854345, 612457.8214000842)

A: I think I solved it already.
I changed the last two lines of that script from
xy = (xPoint, yPoint)
insertCursor.insertRow([xy])
to ...
xy = (xPoint, yPoint)
insertCursor.insertRow(([xy]))
and that got the coordinates into the correct format which appears to be a tuple inside of a list.
I'm not sure why I need a list for just updating the SHAPE@ field and I'm also not sure why the documentation isn't a little bit clearer on this.


text:
Q: Compare two sql server tables Can anyone suggest me how to compare two database tables in sql server and return the rows in the second table which are not in the first table. The primary key in both the tables is not the same. For instance, the tables are as follows.
Table1
ID             Name               DoB
1              John Doe           20/03/2012
2              Joe Bloggs         31/12/2011

Table2
ID             Name                DoB
11             John Doe            20/03/2012
21             Joe Bloggs          31/12/2011
31             James Anderson      14/04/2010

The sql query should compare only the Name and DoB in both tables and return
31 James Anderson 14/04/2010
Thanks.

A: Pretty simple, use a LEFT OUTER JOIN to return everything from Table2 even if there isn't a match in Table1, then limit that down to only rows that don't have a match:
SELECT Table2.ID, Table2.Name, Table2.DoB
FROM Table2
LEFT OUTER JOIN Table1 ON Table2.Name = Table1.Name AND Table2.DoB = Table1.DoB
WHERE Table1.ID IS NULL

A: use CHECKSUM () function in sql server
select T1.* from Table1 T1 join Table2 T2
on CHECKSUM(T1.Name,T1.DOB)!= CHECKSUM(T2.Name,T2.DOB)

Details

A: Look into the use of SQL EXCEPT
SELECT Name, DOB
FROM Table1
EXCEPT
SELECT Name, DOB
FROM Table2

http://msdn.microsoft.com/en-us/library/ms188055.aspx

A: You want a LEFT OUTER JOIN. http://en.wikipedia.org/wiki/Join_(SQL)#Left_outer_join
This type of JOIN will return all records of the 'left' table (the table in the FROM clause in this example) even if there are no matching records in the joined table.
SELECT Table2.ID, Table2.Name, Table2.DoB
FROM Table2
LEFT OUTER JOIN Table1 ON Table1.Name = Table2.Name AND Table1.DoB = Table2.DoB
WHERE Table1.ID IS NULL

Note that you can substitue LEFT OUTER JOIN for LEFT JOIN.  It's a short cut that most DBMSs use.

A: This SQL statement compares two tables without having to specify column names.
SELECT 'Table1' AS Tbl, binary_checksum(*) AS chksum, * FROM Table1
WHERE binary_checksum(*) NOT IN (SELECT binary_checksum(*) FROM Table2)
UNION
SELECT 'Table2' AS Tbl, binary_checksum(*) AS chksum, * FROM Table2
WHERE binary_checksum(*) NOT IN (SELECT binary_checksum(*) FROM Table1)
ORDER BY <optional_column_names>, Tbl

The output will display any rows that are different and rows that are in Table1, but not Table2 and vice versa.


text:
Q: Implementing AOL AdTech/One Ad Server ads on Facebook Instant Articles I was wondering if anyone had any experience with running ads on Facebook Instant Articles using AOL AdTech (now known as AOL One Ad Server)? If so how would one go about integrating this?
Unfortunately, all the documentation on Facebook's developer site at https://developers.facebook.com/docs/instant-articles/monetization/direct-sold refers to Google DFP and not AdTech, and there's nothing about Facebook Instant Articles within the help pages in AdTech.


text:
Q: reCaptcha / Form Validation Hello,
I want to import reCaptcha(2) to my Register form. I have already imported, but their don't validate it. On submit click, skip's empty reCaptcha and ignores it. Can someone post full HTML & JAVA/SCRIPT code's(without using php). I can't find the right code. I want to have a full html/script code. :x
I tried this, but I need a

<form method="POST" action="register.html">
<input type="text" name="name" required>

<input type="email" name="email" required>

<input type="password" name="password" required>

<input type="submit" value="submit">

Thanks.

A: Since you have to do server-side captcha validation, hence your action part of the form should be register.php, not register.html. Your HTML code should be like this:
<form method="POST" action="register.php">
    <input type="text" name="name" required>

    <input type="email" name="email" required>

    <input type="password" name="password" required>

    <input type="submit" name="submit" value="submit">
</form>

And this is how you can validate the input captcha in register.php file,
<?php

    if(isset($_POST['submit'])){

        //your site secret key
        $secret = 'XXXXXXX_Secret-key_XXXXXXX';

        if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])){
            //get verified response data
            $param = "https://www.google.com/recaptcha/api/siteverify?secret=".$secret."&response=".$_POST['g-recaptcha-response'];
            $verifyResponse = file_get_contents($param);
            $responseData = json_decode($verifyResponse);

            if($responseData->success){
                // success
                echo "success";
            }else{
                // failure
            }

        }

    }

?>

Here are the references:

*

*Displaying the widget

*Verifying the user's response
Edited:
From your comment,

2x borders on side of  . for example then i get a error, it add's a style(border-left:1px solid red;border-right:1px solid red;) or it add's a class(recaptcha-error). When success shows only the reCaptcha green mark withuot a border.

Here's the solution,
Your stylesheet should be like this:

Your HTML will be as it is, and your jQuery should be like this:


text:
Q: Bias current in the Amplifier branch In this Common Source CMOS amplifier, the current is set by PMOS (3), it's 2* Ibias  due to 1:2 mirror.
However NMOS (1) is also a current source with gate at Vi, why the current in the branch is not set by this?

A: I've used this topology ---- constant current source load for bipolar amplifiers ---- to achieve gains of 10,000x (80 dB) in one stage. The output was buffered using a JFET to avoid bias currents.
The "vi" was part of a negative feedback loop, thus "vi" was servo-loop adjusted to hold the gain node near the mid-swing for adequate linearity.
Summary: Fet#1 cannot be operated as constant current.


text:
Q: Zip directory in different batches I'm trying to zip a massive directory with images that will be fed into a deep learning system. This is incredibly time consuming, so I would like to stop prematurely the zipping proccess with Ctrl + C and zip the directory in different "batches".
Currently I'm using zip -r9v folder.zip folder, and I've seen that the option -u allows to update changed files and add new ones.
I'm worried about some file or the zip itself ending up corrupted if I terminate the process with Ctrl + C. From this answer I understand that the cp can be terminated safely, and this other answer suggests that gzip is also safe.
Putting it all together: Is it safe to end prematurely the zip command? Is the -u option viable for zipping in different batches?

A:
Is it safe to end prematurely the zip command?

In my tests, canceling zip (Info-ZIP, 16 June 2008 (v3.0)) using CtrlC did not create a zip-archive at all, even when the already compressed data was 2.5GB. Therefore, I would say CtrlC is "safe" (you won't end up with a corrupted file, but also pointless (you did all the work for nothing).

Is the -u option viable for zipping in different batches?

Yes. Zip archives compress each file individually, so the archives you get from adding files later on are as good as adding all files in a single run. Just remember that starting zip takes time too. So set the batch size as high as acceptable to save time.
Here is a script that adds all your files to the zip archive, but gives a chance to stop the compression at every 100th file.
#! /bin/bash
batchsize=100
shopt -s globstar
files=(folder/**)
echo "Press enter to stop compression after this batch."
for ((startfile=0; startfile<"${#files[@]}"; startfile+=batchsize)); do
  ((startfile==0)) && u= || u=u
  zip "-r9v$u" folder.zip "${files[@]:startfile:batchsize}"
  u=u
  if read -t 0; then
    echo "Compression stopped before file $startfile."
    echo "Re-run this script with startfile=$startfile to continue".
    exit
  fi
done

For more speed you might want to look into alternative zip implementations.


text:
Q: All git commands are hanging I'm working on a repository on a remote server. The repo uses LFS and totals ~10GB of files. I was able to check out this branch with minimal issues, and have before now had no issues switching branches (this server and the git server are in the same room with 10GE connections). I've modified some code, and I'm trying to save it on another branch.
git checkout -b my_new_branch

Is hanging. I understand it's a big repo, but it's hanging for quite a long time. I tried
git diff

To no avail. It also hangs effectively indefinitely. I've yet to leave it for more than a few minutes but I don't see it doing any i/o in iotop.
I've tried cleaning up swap files. There were none so that is not causing any hang issues.
Is this just an indexer of some sort running for a ridiculously long time in git? I'm not seeing any CPU or I/O usage, which is misleading.


text:
Q: Extract unique values of a key in a object - Javascript/d3 legend Consider the following simplified csv file
x,y,names
1,2,group1
3,2,group2
4,3,group1
7,8,group3
3,5,group2

which I am reading in with d3.csv and afterwards apply a some function on it
d3.csv('file_name.csv').then(data => {
    render(dataset)
});

Could someone explain to me how I could extract the unique strings in the category names and store them in a list
---> iam_a_list = [group1, group2, group3]
The elements in this list will later be used as text for a legend in a plot.

A: You can use a set to get unique results. Just loop over your data and make an array of all the names. Then make a set, which will remove all the duplicates and give you a unique list.
Using .map() and d3.set().values()
let uniqueListOfNames= []
d3.csv('file_name.csv').then(data => {
    // listOfNames = ['group1', 'group2', 'group1', 'group3', 'group2']
    const listOfNames = data.map(row => row.names)
    // uniqueListOfNames = ['group1', 'group2', 'group3']
    uniqueListOfNames = d3.set(listOfNames).values()
});

Using a loop.
let uniqueListOfNames= []
d3.csv('file_name.csv').then(data => {
    const listOfNames= []

    for (const row of data) {
        listOfNames.push(row.names)
    }
    // listOfNames= ['group1', 'group2', 'group1', 'group3', 'group2']
    // uniqueListOfNames = ['group1', 'group2', 'group3']
    uniqueListOfNames = d3.set(listOfNames).values()
});


text:
Q: REST API and GET with structured data I'm designing a REST API where given an address, I will return the timezone corresponding to the address. I started along this path,
GET /api/TimeZone?address=
Now this address is a free form address field that I need to parse on the server.
To avoid errors, I'd really like to have the user send in a record like {"city": "", "state": "", "country": "" }
But I can only do this using a POST or a PUT endpoint => which semantically implies that the data is changing on the server but its actually NOT.
What would be a good way to address this?

A: You can have multiple fields in your query:
TimeZone?city=London&country=uk

Or if you could use hierarchical URLs such as:
TimeZone/UK

TimeZone/UK/London

I would expect the first of these to supply a bunch of cities, such as those found in most clocks, for UK, London would be the only suggestion as the whole of the UK is "London Time", but for America, there would be many suggestions.


text:
Q: Elementor recent update 3.6, the frontend editing sidebar loader loading continuously I'm using Elementor pro. The website was fine till the Elementor version was 3.5.5. After upgrading the plugin now when I'm trying to edit the page, the Elementor sidebar is loading continuously. As I know Elementor uses many resources, I increased the memory limit. Still, it's loading.

A: You can try following these step

*

*you can disable step by step plugin and check again.

*Go to admin dashboard -> settings -> permalink and set post name and click save button.

*Increase memory limit (set memory limit 1024)

A: It has nothing to do with the other plugins.
I encountered the same problem.
The solution is to rollback to 3.5.6
Hope Elementor team can fix this.


text:
Q: InterpolatingPolynomial: magnitude of coeffictions I have a list of the type {{x,y},f} and want to get an InterpolatingPolynomial for that list. The x values all run between 1.3 and 2, the y values between 0 and 1. The function values all lie in the range 0 to 1.2:
A = {{{1.35, 0.273984}, 0.728733}, {{1.375, 0.257642},
0.818659}, {{1.4, 0.242488}, 0.92725}, {{1.425, 0.228405},
1.02997}, {{1.45, 0.215288}, 1.12053}, {{1.475, 0.203047},
1.24364}, {{1.5, 0.191601}, 0.991427}, {{1.525, 0.180881},
0.591806}, {{1.55, 0.170822}, 0.536831}, {{1.575, 0.16137},
0.626643}, {{1.6, 0.152475}, 0.593617}, {{1.625, 0.144091},
0.515524}, {{1.65, 0.136179}, 0.45724}, {{1.675, 0.128702},
0.478962}, {{1.7, 0.121628}, 0.582782}, {{1.725, 0.114927},
0.537581}, {{1.75, 0.108572}, 0.533521}, {{1.775, 0.10254},
0.524312}, {{1.8, 0.0968073}, 0.519375}, {{1.825, 0.0913544},
0.495156}, {{1.85, 0.0861626}, 0.466659}, {{1.875, 0.0812149},
0.426044}, {{1.9, 0.0764957}, 0.387338}, {{1.35, 0.344327},
0.391499}, {{1.375, 0.324598}, 0.681933}, {{1.4, 0.306041},
0.835192}, {{1.425, 0.288563}, 0.962204}, {{1.45, 0.272079},
1.12803}, {{1.475, 0.256515}, 1.02705}, {{1.5, 0.241801},
0.985249}, {{1.525, 0.227875}, 0.488567}, {{1.55, 0.214682},
0.456916}, {{1.575, 0.202169}, 0.406596}, {{1.6, 0.190289},
0.40218}, {{1.625, 0.179001}, 0.322154}, {{1.65, 0.168264},
0.307378}, {{1.675, 0.158042}, 0.375889}, {{1.7, 0.148304},
0.436761}, {{1.725, 0.139017}, 0.460715}, {{1.75, 0.130155},
0.459744}, {{1.775, 0.121691}, 0.415649}, {{1.8, 0.113601},
0.372864}, {{1.825, 0.105864}, 0.332083}, {{1.85, 0.0984584},
0.307228}, {{1.875, 0.091366}, 0.282702}, {{1.9, 0.0845688},
0.282029}, {{1.925, 0.0780506}, 0.283576}, {{1.95, 0.0717961},
0.245998}, {{1.35, 0.522927}, 1.21534}, {{1.375, 0.49884},
1.23622}, {{1.4, 0.475296}, 1.21129}, {{1.425, 0.452287},
1.17794}, {{1.45, 0.429808}, 1.14154}, {{1.475, 0.407849},
1.05781}, {{1.5, 0.386401}, 0.735886}, {{1.525, 0.365456},
0.20484}, {{1.55, 0.345005}, 0.169725}, {{1.575, 0.325039},
0.29341}, {{1.6, 0.305547}, 0.33619}, {{1.625, 0.286519},
0.290241}, {{1.65, 0.267947}, 0.234699}, {{1.675, 0.24982},
0.259155}, {{1.7, 0.232129}, 0.425316}, {{1.35, 0.768514},
0.803047}, {{1.375, 0.75328}, 0.856855}, {{1.4, 0.737953},
0.896618}, {{1.425, 0.722541}, 0.937661}, {{1.45, 0.707051},
0.894388}, {{1.475, 0.691488}, 0.918156}, {{1.5, 0.675859},
0.782395}, {{1.525, 0.66017}, 0.253692}, {{1.55, 0.644428},
0.300553}, {{1.575, 0.628638}, 0.544507}, {{1.6, 0.612806},
0.707503}, {{1.625, 0.596938}, 0.802465}, {{1.65, 0.58104},
0.871258}, {{1.675, 0.565117}, 0.941302}, {{1.7, 0.549175},
0.984023}, {{1.725, 0.533218}, 0.895298}, {{1.75, 0.517252},
0.856245}, {{1.775, 0.501282}, 0.871947}, {{1.8, 0.485312},
0.893617}, {{1.825, 0.469347}, 0.91226}, {{1.85, 0.453392},
0.923564}, {{1.875, 0.437452}, 0.92351}, {{1.9, 0.42153},
0.908258}, {{1.925, 0.40563}, 0.878031}, {{1.95, 0.389758},
0.838854}, {{1.975, 0.373915}, 0.798399}, {{2., 0.358107},
0.761601}, {{1.35, 0.780351}, 0.155121}, {{1.375, 0.766322},
0.389603}, {{1.4, 0.75226},
0.397601}, {{1.425, 0.738171}, -0.0631589}, {{1.45,
0.724062}, -0.358085}, {{1.475, 0.709939}, -0.0143939}, {{1.5,
0.695809}, 0.42667}, {{1.525, 0.681677},
0.53292}, {{1.55, 0.66755}, 0.627926}, {{1.575, 0.653433},
0.671135}, {{1.6, 0.639331}, 0.563348}, {{1.625, 0.625249},
0.44906}, {{1.65, 0.611193}, 0.371806}, {{1.675, 0.597168},
0.576316}, {{1.7, 0.583177}, 0.957115}, {{1.725, 0.569226},
1.13763}, {{1.75, 0.555318}, 1.07013}, {{1.775, 0.541459},
0.993664}, {{1.8, 0.527651}, 0.945529}, {{1.825, 0.513899},
0.923353}, {{1.85, 0.500206}, 0.951844}, {{1.875, 0.486575},
0.941281}, {{1.9, 0.47301}, 0.938516}, {{1.925, 0.459513},
0.917569}}

When I apply InterpolatingPolynomial to that list
test = InterpolatingPolynomial[A,{x,y}]

I get a polynomial with very large expansion coefficients of the order 10^8 to 10^13. This is undesirable. How can I avoid this behavior? Further: if I then try to check the interpolating polynomial by simply doingtest[1.4,0.5]  I am just getting the polynomial again, but no value. What am I doing wrong here?


text:
Q: Wordpress how to use  in wp_query? I have a wp_query to list the posts title and excerpt for a subcategory. I want the title to link to its respective post, but unable to figure out how to get the a href working properly in the following code. The link that is being generated from the below code is, /category/sub-category/the_permalink(). Any suggestions please?
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

$args = array( 'posts_per_page' => 10, 'order'=> 'ASC', 'orderby' => 'title', 'category_name' => 'diet-tips', 'paged' => $paged,'post_type' => 'post' );
$postslist = new WP_Query( $args );

if ( $postslist->have_posts() ) :
    while ( $postslist->have_posts() ) :
        $postslist->the_post();

        echo "

";
        the_title();
        echo "

";
        the_excerpt();
        echo "

";

        "
";
    endwhile;

    next_posts_link( 'Older Entries', $postslist->max_num_pages );
    previous_posts_link( 'Next Entries »' );
    wp_reset_postdata();
endif;

Thanks for your help everyone, the code that is producing the results I was seeking is this:
echo "

";
             the_title();
echo "

A: You are trying to print the word the_permalink() as text and not a function. Try this:
 echo "

";
    the_title();
    echo "

";

Shorter version:
echo "

".the_title()."

";

Edit: Without echoing functions:

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

A: echo '';
Somelinks
echo '';

A: Try this
echo "

".the_title()."

".the_excerpt()."

";


text:
Q: Configure Google Cloud Build to deploy to private GKE cluster via proxy After I have completed the steps required to set up access to a private GKE cluster via a proxy instance, how do I configure Google Cloud Build to deploy to the cluster via the proxy?
I'm looking for a solution that will not require manipulating the cluster's authorized Master Networks beyond adding the IP address of the proxy server.


text:
Q: how insert lookup field in Zoho via PHP-SDK APIv2 I try insert record in Calls module, its ok, but when i try insert record linked to Lead or Contacts i get such error -  Caused by:'required field not found'
I try add that lookup field such ways:
 $record->setFieldValue("What_Id", '"id":"4270452000000312806"');
 $record->setFieldValue("What_Id", '"entityId":"4270452000000312806"');
 $record->setFieldValue("What_Id", '"name":"Markus List"');
 $record->setFieldValue("What_Id", '"entityId":"4270452000000312806", "name":"Markus List"');
 $record->setFieldValue("What_Id", '"id":"4270452000000312806" "name":"Markus List"');

A: Need use field "se_module":
$record->setFieldValue("What_Id", "4270452000000312806");/*Contact or Lead ID*/
$record->setFieldValue("Who_Id", "4270452000000242013");/*Company linked to contact*/
$record->setFieldValue("se_module", "Leads");/*Leads or Contacts*/

Thans to Dharani form Zoho CRM Support who share with me that info.


text:
Q: Get dplyr count of distinct in a readable way I'm new using dplyr,
I need to calculate the distinct values in a group. Here's a table example:
data=data.frame(aa=c(1,2,3,4,NA), bb=c('a', 'b', 'a', 'c', 'c'))

I know I can do things like:
by_bb<-group_by(data, bb, add = TRUE)
summarise(by_bb, mean(aa, na.rm=TRUE), max(aa), sum(!is.na(aa)), length(aa))

But if I want the count of unique elements?
I can do:
  > summarise(by_bb,length(unique(unlist(aa))))

  bb length(unique(unlist(aa)))
1  a                          2
2  b                          1
3  c                          2

and if I want to exclude NAs I cand do:
> summarise(by_bb,length(unique(unlist(aa[!is.na(aa)]))))

  bb length(unique(unlist(aa[!is.na(aa)])))
1  a                                      2
2  b                                      1
3  c                                      1

But it's a little unreadable for me. Is there a better way to do this kind of summarization?

A: How about this option:
data %>%                    # take the data.frame "data"
  filter(!is.na(aa)) %>%    # Using "data", filter out all rows with NAs in aa
  group_by(bb) %>%          # Then, with the filtered data, group it by "bb"
  summarise(Unique_Elements = n_distinct(aa))   # Now summarise with unique elements per group

#Source: local data frame [3 x 2]
#
#  bb Unique_Elements
#1  a               2
#2  b               1
#3  c               1

Use filter to filter out any rows where aa has NAs, then group the data by column bb and then summarise by counting the number of unique elements of column aa by group of bb.
As you can see I'm making use of the pipe operator %>% which you can use to "pipe" or "chain" commands together when using dplyr. This helps you write easily readable code because it's more natural, e.g. you write code from left to write and top to bottom and not deeply nested from inside out (as in your example code).
Edit:
In the first part of your question, you wrote:

I know I can do things like:
by_bb<-group_by(data, bb, add = TRUE)
summarise(by_bb, mean(aa, na.rm=TRUE), max(aa), sum(!is.na(aa)), length(aa))

Here's another option to do that (applying a number of functions to the same column(s)):
data %>%
  filter(!is.na(aa)) %>%
  group_by(bb) %>%
  summarise_each(funs(mean, max, sum, n_distinct), aa)

#Source: local data frame [3 x 5]
#
#  bb mean max sum n_distinct
#1  a    2   3   4          2
#2  b    2   2   2          1
#3  c    4   4   4          1


text:
Q: Is there a need to have both private IP and private DNS when EC2 instance is launched. Isn't one of them sufficient? I am trying to understand the difference between a private IP and a private DNS. From what I can tell either can be used to SSH into the instance, then what is the use case/advantage of having both assigned when an EC2 is spun up. Having either one of them wasn't sufficient? Am I missing something?

A:
private IP and a private DNS

Private means not public, so it cannot be used publicly.

either can be used to SSH into the instance

None of them can be used for that. Because you cannot connect to private instance via SSH.
IP can be changed, DNS name can be preserved. i.e. One DNS name can correspond to many IPs in different moments. Users of this service don't need to be updated every time IP is changed, because they use its DNS name that is static.


text:
Q: Robo copy errors I am not sure what I am doing wrong here but that is why I am here. Any help would be appreciated.
I run the command:
robocopy "\\okee01.ini.org\D2 Temp\Fonts 7.10\T^&E\"  "C:\Program Files\Adobe\Adobe InDesign CC 2017\Fonts\"

This is the output
Started : Wednesday, July 12, 2017 3:09:02 PM Source - \\okee01.ini.org\D2 Temp\Fonts 7.10\T^&E" C:\Program\ Dest - C:\Users\pcoleman\Files\Adobe\Adobe\ Files : InCopy ------------------------------------------------------------------------------ ERROR : Invalid Parameter #5 : "2017\Fonts""

Any thoughts?

A: It was due to the double quotations. I removed the first set and it works just fine.


text:
Q: Area ratio of a minimum bounding rectangle of a convex polygon Take a convex polygon $P$ in the plane, and find its minimum area bounding rectangle, $R$. I'm interested in the ratio of the area of $R$ to the area of $P$. The ratio has a minimum of $1$ for rectangles and is $2$ for triangles. I want to say that $2$ is the maximum ratio possible.
Is this known? Is there a nice proof/counterexample for it?

A: I believe this is easy to prove.  Assume you have at least four points and take the longest chord $C$ of the polygon.  Now choose your rectangle such that two edges are parallel and the same length as $C$.  Now observe that since each "half" of the polygon contains a triangle inscribed in the "half" rectangle (where "half" means cut by $C$), at least half of each side of the rectangle is filled.

A: Not quite an answer: it is a result of Dutkovsky that the area of a rectangle containing a curve of perimeter $2\pi$ is at most $4.$
EDIT I have just learned (from Erwin Lutwak) that the result is NOT a result of Dutkovsky, but a result of Lutwak, as in:
Lutwak, E.
On isoperimetric inequalities related to a problem of Moser.
Amer. Math. Monthly 86 (1979), no. 6, 476–477.


text:
Q: CKEditor - display table without Table button in toolbar? Is there any way to show tables in CKEditor (inline div if possible) without having the Table toolbar button displayed?
It worked just fine in a textarea in FCKEditor, but I'm trying to move on to the current version. When I remove the Table toolbar button, the table briefly shows and then all table tags are removed. I'm just left with any text that was in the table.  I did find Ckeditor removes table tags but that just mentions the change in functionality.

A: You are hitting the content filtering functionality. Since the table toolbar button is not there, it assumes the tables should be filtered out. You can verify this by disabling content filtering:
config.allowedContent = true;

See the CKEditor for more information on this functionality so you can fine tune it better to your needs:
http://docs.ckeditor.com/#!/guide/dev_acf

A: We have the full table functionality available but do not use the Table button, too. It is removed by
config.removeButtons = 'Table';

We do not want users to just add tables from scratch. If a user wants to add a new table, we provide some templates. We made a small custom plugin for that.