text:
Q: RequestHeader with Apache environment variable I have Apache set up as a load balancer. I wanted to make apache set the X-Forwarded-Proto header, but this doesn't work:
RequestHeader set X-Forwarded-Proto "%{SERVER_PROTOCOL}e"

The header gets set to null. Any idea why?

A: You can fix this by using the early keyword:
RequestHeader set X-Forwarded-Proto "https" early

Otherwise, you can do what John Crenshaw suggested, which is use RewriteRule instead of ProxyPass directives.

A: Found the cause. Turns out it is an order of operations issue. mod_rewrite is responsible for supplying these environment variables, but Apache doesn't process it until AFTER it handles any ProxyPass requests. Until then, it will just set null. The only workaround appears to be to do the proxying via mod_rewrite.
See http://www.gossamer-threads.com/lists/apache/users/267160?do=post_view_threaded#267160

A: Late but still, I've just dealt with the same issue, and this worked for me:
RequestHeader set X_FORWARDED_PROTO 'https' env=HTTPS

The documentation says:

When the RequestHeader directive is used with the add, append, or set
  argument, a fourth argument may be used to specify conditions under
  which the action will be taken. If the environment variable specified
  in the env=... argument exists (or if the environment variable does
  not exist and env=!... is specified) then the action specified by the
  RequestHeader directive will take effect. Otherwise, the directive
  will have no effect on the request.

While the HTTPS environment variable is only set when the request is made through SSL.

A: You don't want that; it'd set your header to "HTTP/1.1" (even on an https request) - probably not terribly useful to whatever you're passing to.
You have different VirtualHost blocks for http and https; just hardcode the RequestHeader setting in each.
<VirtualHost *:80>
    RequestHeader set X-Forwarded-Proto "http"
    ...
</VirtualHost>

<VirtualHost *:443>
    RequestHeader set X-Forwarded-Proto "https"
    ...
</VirtualHost>


text:
Q: How to avoid cross-join to find pairwise distance between each two rows in Spark dataframe I have a spark data frame with 3 columns that indicate positions of atoms i-e Position X, Y & Z. Now to find the distance between every 2 atoms for which I need to apply distance formula. The distance formula is d= sqrt((x2−x1)^2+(y2−y1)^2+(z2-z1)^2). For the smaller dataset, I was recommended cross-join but for the larger dataset that is very inefficient and time-consuming. Currently, I am using the following piece of code.
df = atomsDF.withColumn("id", F.monotonically_increasing_id())
windowSpec = W.orderBy("id")
df = df.withColumn("id", F.row_number().over(windowSpec))
df_1 = df.select(*(F.col(col).alias("{}_1".format(col)) for col in df.columns))
df_3 = df_1.crossJoin(df).where("id_1 != id")

df_3 = df_3.withColumn(
        "Distance",
        F.sqrt(
            F.pow(df_3["Position_X_1"] - df_3["Position_X"], F.lit(2))
            + F.pow(df_3["Position_Y_1"] - df_3["Position_Y"], F.lit(2))
            + F.pow(df_3["Position_Z_1"] - df_3["Position_Z"], F.lit(2))
        )
    )

My Dataframe look like the following:
Position_X|Position_Y|Position_Z|
+----------+----------+----------+
|    27.545|     6.743|    12.111|
|    27.708|     7.543|    13.332|
|    27.640|     9.039|    12.970|
|    26.991|     9.793|    13.693|
|    29.016|     7.166|    14.106|
|    29.286|     8.104|    15.273|
|    28.977|     5.725|    14.603|
|    28.267|     9.456|    11.844|
|    28.290|    10.849|    11.372|
|    26.869|    11.393|    11.161|
+----------+----------+----------+

Now how can I avoid cross-join because the number of rows grows exponentially after the cross-join? For example, just for the dataset with 3000 rows after the cross join the total number of rows grow to 3000 * 2999 = 8997000 which make it very time-consuming.
Any other Efficient way of finding the pairwise distance between every two rows?

A: You say that you need to find the distance between every 2 atoms. For this, since the result size is N^2, the run time is by definition quadratic. You can optimize it somewhat, but it will still be quadratic.
You can optimize it only if you don't actually need to find N^2 distances between every 2 atoms, but need to find only pairs based on some criteria.
E.g. commonly one needs to find pairs that are closer than some threshold distance - for this R-trees provide much better scalability. In Spark it might be easier to split atoms into grid of cubes of size equal to threshold distance, then you only need to cross-join between atom and atoms in same or neighboring cubes.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Determining roll angle (up/down) when Android phone is horizontal? When the Android phone is on its side (horizontal orientation), the Roll represents the tilt, so to speak.  When the phone is perpendicular to the ground (looking directly at the screen), the roll says 90.  However, when you start tilting it forward or backward, as if you wanted to look down or up, the angle just decreases either way.
This means looking up or down 45 degrees gives the same roll or 45 degrees.
How is it possible to know if you are rolling it forward or backward?
I have been looking around for an answer to this, and can't find anyone else with this problem.  Judging from different apps, it seems to be possible, so I think I am just missing some relationship to something, and was hoping someone might be able to nudge me in the right direction.  Thanks!

A: The way I fixed this was with the accelerometer data. Watch to see if the Z axis is positive or negative, and then adjust the roll value accordingly.


text:
Q: i want to delete a row from table in javascript which stored in localstorage I want to delete a row from LocalStorage
This Method Works properly But it is removing the last row only, when i refresh it so instead of what i have clicked is not deleting
so please help me to get this issue resolve
in simple word i want to delete that row from localstorage, so when i reload the page so it will not be appear
js file
 console.log('This is ES6 version of project 2');

const uid = function () {
    return Date.now().toString(36) + Math.random().toString(36).slice(2);
  };

class Book {

    constructor(name, author, type) {
        this.id = uid();
        this.name = name;
        this.author = author;
        this.type = type;
    }
}

class Display {
    add(book) {
        console.log('Adding to UI');
        let tableBody = document.getElementById('tableBody')
        let uiString = `

                            ${book.name}
                            ${book.author}
                            ${book.type}
                            <input type="button" value="Delete Row" class="btn btn-outline-danger" onclick="RemoveRow(this)">

`;
        tableBody.innerHTML += uiString;

        // save the data to the browser's local storage -----
        const books = JSON.parse(localStorage.getItem("books"));
        // console.log(books);
        if (!books.some((oldBook) => oldBook.id === book.id)) books.push(book);
        localStorage.setItem("books", JSON.stringify(books));

    }

    clear() {
        let libraryForm = document.getElementById('libraryForm');
        libraryForm.reset();
    }

    validate(book) {
        if (book.name.length < 2 || book.author.length < 2) {
            return false;
        }
        else {
            return true;
        }
    }

    show (type, displayMessage) {
        let message = document.getElementById('message');
        let boldText;
        if (type === 'success'){
            boldText = 'Success';
        }
        else{
            boldText = 'Error!';
        }
        message.innerHTML = `

                                ${boldText}: ${displayMessage}
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                ×
                                </button>

`

        setTimeout(function () {
            message.innerHTML = '';
        }, 5000);

    }
}

// Add submit event listener to libraryForm
let libraryForm = document.getElementById('libraryForm');
libraryForm.addEventListener('submit', libraryFormSubmit);

function libraryFormSubmit(e) {
    console.log('You have submitted library form')
    let name = document.getElementById('bookName').value;
    let author = document.getElementById('author').value;
    let type;
    let fiction = document.getElementById('fiction');
    let programming = document.getElementById('programming');
    let cooking = document.getElementById('cooking');
    if (fiction.checked) {
        type = fiction.value;
    }
    else if (programming.checked) {
        type = programming.value;
    }
    else if (cooking.checked) {
        type = cooking.value;
    }

    let book = new Book(name, author, type);
    console.log(book);

    let display = new Display();
    if (display.validate(book)) {
        display.add(book);
        display.clear();
        display.show('success', 'Your book has been successfully added')
    }
    else {
        // show error to the user
        display.show('danger', 'Sorry you cannot add this book.')
    }

    e.preventDefault();
}

(() => {
    const display = new Display();
    let books = localStorage.getItem("books");
    if (books) {
      books = JSON.parse(books);
      books.forEach((book) => display.add(book));
    }
    else
        localStorage.setItem("books", JSON.stringify([]));
})();

function RemoveRow(index) {
    let td1 = event.target.parentNode;
    let tr1 = td1.parentNode;
    tr1.parentNode.removeChild(tr1);
    const books = JSON.parse(localStorage.getItem("books"));
    // books.pop(books);
    const newBooks= books.filter(book=> book.id !== index).pop();
    localStorage.setItem("books", JSON.stringify(newBooks));
}

html file
<!doctype html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css"
        integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet">

    <title>Welcome to Juggu library</title>

             Juggu library
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
                data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
                aria-label="Toggle navigation">

            </button>

                        Home

                        About Us

                          Websites

                          AllYouNeed Notes App
                          Text Utils

                          github Profile

                <form class="d-flex" role="search">
                    <input class="form-control me-2" type="search" id="searchTxt" placeholder="Search" aria-label="Search">
                    <button class="btn btn-outline-success" type="submit">Search</button>
                </form>

        <form id="libraryForm">

Juggu library

                Name

                    <input type="text" class="form-control" id="bookName" placeholder="Book Name">

                Author

                    <input type="text" class="form-control" id="author" placeholder="Author">

            <fieldset class="form-group row">
                <legend class="col-form-label col-sm-2 float-sm-left pt-0">Type</legend>

                        <input class="form-check-input" type="radio" name="type" id="fiction" value="fiction" checked>

                            Fiction

                        <input class="form-check-input" type="radio" name="type" id="programming" value="programming">

                            Computer Programming

                        <input class="form-check-input" type="radio" name="type" id="cooking" value="cooking">

                            Cooking

            </fieldset>

                    <button type="submit" class="btn btn-primary" id="addBtn">Add Book</button>

        </form>

Your Books

                        Name
                        Author
                        Type
                        Status

A: Inside your add function, pass book.id to RemoveRow instead of this so that RemoveRow function gets the correct id of the book to remove
let uiString = `

                            ${book.name}
                            ${book.author}
                            ${book.type}
                            <input id="${book.id}" type="button" value="Delete Row" class="btn btn-outline-danger" onclick="RemoveRow(this)">

`;

I found a couple of more issues, in your RemoveRow function you don't have to use pop
function RemoveRow(element) {
    const bookId = element.id;
    let td1 = document.getElementById(bookId).parentNode;
    let tr1 = td1.parentNode;
    tr1.parentNode.removeChild(tr1);
    const books = JSON.parse(localStorage.getItem('books')) || [];
    const newBooks = books.filter((book) => book.id !== bookId);
    localStorage.setItem('books', JSON.stringify(newBooks));
 }

And in your add function, when retrieving books for the first time books will be null, so initialize it to an empty array.
....
tableBody.innerHTML += uiString;
// save the data to the browser's local storage -----
const books = JSON.parse(localStorage.getItem('books')) || [];
....


text:
Q: how to connect to WebSphere 7 admin console, or how to view error logs if it's not starting? I have IBM RAD / WebSphere 7 installed locally.  My web application I'm developing runs fine.
I'm trying to log into the WAS admin console.
In the "Servers" view, I right-click the server > Administration > Run Administration Console ... but I get a "webpage cannot be found" error page.
In Firefox, I attempt to browse to the admin console URL, I tried each of the following but no luck:
http://localhost:9091/ibm/console/logon.jsp
http://localhost:9091/ibm/console/
http://localhost:9060/ibm/console/
http://localhost:9060/admin

Any ideas what the URL is?
Or, alternately, if the admin console is not starting due to some error, is there a log file somewhere where I can find the error?
Any help is greatly appreciated!
Rob

A: The third of those would normally be the correct one, but the port number depends on what happened during the profile creation process. Find the profile directory and then look in the properties directory for the portdefs.props file. That will tell you what the correct port number should be.
It is possible to create a profile without the admin console application, in which case it will obviously never work. You could also try running wsadmin from the profile bin directory to see whether you can connect to the admin service that way.
Any errors from the admin console application will be reported in the normal log files in the profiles/profilename/logs/servername directory.


text:
Q: How can i get formatted HTML of selected part instead of simple text through this JS How can i get formatted HTML of selected part instead of simple text
Here is a script that add content to

  when we select some text and press  Get Selection button, with every time class mySlides Okay
But here is all text goes in one by one only in this structure, even though we select any HTML text like

 etc part.

 Some Text

 Some other

 Some another

But Now i want a little change here, my requirement is When i select text then it should be get with formatted rendered HTML Just Like This.

 Some Text

This is heading 3

          Select any part of this sentence
          and press the button. Select any part of this sentence
          and press the button. Select any part of this sentence
          and press the button

 Some another

i also checked this but i am not able to get solve my issue.
means simple i want rendered HTML format of selection.
My Whole Code IS Here:

const keySelected = new Set();

document.addEventListener('keydown', (e) => {
    keySelected.add(e.which);
    if(keySelected.has(17) && keySelected.has(90)){
        getSelectedText();
    }
});

document.addEventListener('keyup', (e) => {
     keySelected.delete(e.which);
});

// Function to get the Selected Text
function getSelectedText() {
  var selectedText = '';
  // #### create a new element with variable (nw) #### //
  var nw = document.createElement("div"); // Element's tag
  nw.className = "mySlides"; // Element's class name
   // some applied style

  // window.getSelection
  if (window.getSelection) {
    selectedText = window.getSelection();
  }
  // document.getSelection
  else if (document.getSelection) {
    selectedText = document.getSelection();
  }
  // document.selection
  else if (document.selection) {
    selectedText =
      document.selection.createRange().text;
  } else return;
  // #### get the Selected text appended to body #### //
  nw.innerHTML = selectedText;
  document.getElementsByClassName('container')[0].prepend(nw); // Append element to body
}

<button id="mybtn" onclick="getSelectedText()">Get Selection</button>

          Select any part of this sentence
          and press the button. Select any part of this sentence
          and press the button. Select any part of this sentence
          and press the button

This is heading 3

          Select any part of this sentence
          and press the button. Select any part of this sentence
          and press the button. Select any part of this sentence
          and press the button

Plz Help Me How to do that.


text:
Q: How to access the true RAW request body from post man on a pre-request script? I'm trying to authenticate myself against an API. This API uses the raw body from the request to create the hash that it will use to authenticate against my token.
For testing purposes, I'm using postman with a pre request script to create the hash. Everything works fine, with one exception:
In the code tab I have this

however if on the pre request script I dump the value of the request body I get by using request.data I obtain

The problem is, its not exactly the same string, then the value retrieved by request.data creates a hash with a different body that the server uses to create its hash (the server uses the one beautified with line endings and tabs). This is the script where I use the request body content:

So unless someone have an idea of how to retrieve the json body exactly on the format it was written, pretty much seems I cant use postman for this
thanks!

A: EDIT: I don't know if this existed 5 years ago when the original Question was posted, but it's available in PostMan 8.12.2 at least.
When you have a request open in Postman, show the "Code" pane at the right by clicking the </> button seen in the right-hand toolbar.

Then in the dropdown header for code type, choose "HTTP".

The line numbers in the HTTP snippet are significant -- in my screenshot, the last four displayed lines are concatenated into line 6 of the actual HTTP.

A: just changed the post body tab to
new post body
and it went just fine. Not really the best solution i was expecting, but does the job :)


text:
Q: Google Spreadsheet "Document Name" ImportXML XPath Query I want to write an ImportXML function in a Google Spreadsheet to return the document name of the same spreadsheet. For example, my spreadsheet is titled "Kimchi". I want' to return that name in cell "A1" to automate a series of functions within the spreadsheet based on the document name. I'm too lazy to type the value into the cell for each of the hundred or so spreadsheets I'll copy from the original template and rename.
I can't seem to nail a correct query structure.
This bit of XML looked promising, but I can't seem to get the query to pull it:

kimchi

I've tried so far...
=ImportXML("SOME URL HERE", "//div[@class='docs-title-inner']/@content")

It returns...
Error: Imported Xml content can not be parsed.

I've tried all kinds of variations, some probably equally poorly formed. Following is some of the XML structure that looked juicy:

     <title>kimchi - Google Sheets</title>

But this XPath query within the ImportXML function didn't work either
=ImportXML("SOME URL HERE", "/html/head/title")

It returned...
Error: Import Internal Error.

I'm stumpted.
Here's the spreadsheet with variations.
PS This ended up working after I shared the document with the world:
=ImportXml("THE URL", "//meta[@itemprop='name']/@content")

A: You dont have to do any of that.
Go to tools-> script editor -> blank project
replace the contents of the edit window with the code below:
function BookName() {
  return SpreadsheetApp.getActiveSpreadsheet().getName();
}

Ctrl-S, put BookName in the name box, click ok, wait for the yellow "saving" bar to dissapear. Close the tab with the code editor.
In your sheet you can now simply type =BookName() and the cell will display the workbook title.


text:
Q: Issue in Flicker Api when accessing own photos I am trying to access my own pictures via this function https://www.flickr.com/services/api/flickr.people.getPhotosOf.htm on a node package that I got from here https://www.npmjs.com/package/flickrapi\
If I try to access pictures of any other user (say, 136485307@N06 - Apollo Image Gallery) I have no problem getting the pictures. But, if I try to access my own pictures, via user_id: "132868185@N07 or user_id: "me" I get nothing back from the service. My code right now looks like this:
var Flickr = require("flickrapi");
var FlickCred = require("./flickrAuthCred");

var flickrOptions = FlickCred;

Flickr.authenticate(flickrOptions, function(error, flick){
    if(error){
        console.log("Error!");
        console.log(error);
        return;
    }

    var photosReqOptions = {
        user_id: "132868185@N07",
        extras: ["owner_name", "date_taken", "date_upload", "path_alias"]
    }

    flick.people.getPhotosOf(photosReqOptions, function(error, data){
        console.log(data.photos);
    });
});

I feel I am missing a step, but I cannot determine which. Any suggestion will help!

A: Ok I found the problem. I was trying to use the wrong function. Namely, I was trying to use flick.people.getPhotosOf https://www.flickr.com/services/api/flickr.people.getPhotosOf.htm
When I should have used flick.people.getPhotos https://www.flickr.com/services/api/flickr.people.getPhotos.html


text:
Q: Split a dataframe into smaller ones based on their value types I am writing a script to clean a very long data frame where I have a key-value pair in two columns named parameter and value, where parameter is a factor with multiple levels, and value can be either a date, a number, or a string.
In the example below I use as.numeric(), lubridate::dmy_hms() and use the NAs they generate to understand what is not numeric and not a date. This somehow allows me to generate different lists based on the value type and then split them based on their parameter type. I guess the rexprex is more explanatory than my description.
The issue is this approach seems slow, convoluted, and somehow patchy. Is there a better way to do this?
library(tidyverse)
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#>
#>     date, intersect, setdiff, union

df <- data.table::data.table(
  value = c(
    "13.249",
    "NN",
    "13.763",
    "13.665",
    "09/Mar/2022 11:05:12",
    "12.276",
    "13.405",
    "13.684",
    "13.744",
    "14.201"
  ),
  parameter = as.factor(
    c(
      "volume",
      "signature",
      "volume",
      "volume",
      "inoculated",
      "volume",
      "volume",
      "volume",
      "volume",
      "volume"
    )
  )
)

# Finds the numeric part of the data frame and separates it from the rest
vector_numeric_df <- df %>%
  mutate(value = as.numeric(value)) %>%
  filter(!is.na(value)) %>%
  group_by(parameter) %>%
  summarise(n = n()) %>%
  select(parameter) %>%
  pull() %>%
  as.vector()
#> Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

vector_non_numeric_df <- df %>%
  mutate(value = as.numeric(value)) %>%
  filter(is.na(value)) %>%
  group_by(parameter) %>%
  summarise(n = n()) %>%
  select(parameter) %>%
  pull() %>%
  as.vector()
#> Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

numeric_df <- df %>%
  filter(parameter %in% vector_numeric_df) %>%
  mutate(value = as.numeric(value))

numeric_df_list <- numeric_df %>%
  group_split(parameter) %>%
  setNames(sort(unique(numeric_df$parameter)))

# Finds the date part of the data frame and separates it from the rest
vector_date_df <- df %>%
  filter(parameter %in% vector_non_numeric_df) %>%
  mutate(value = dmy_hms(value)) %>%
  filter(!is.na(value)) %>%
  group_by(parameter) %>%
  summarise(n = n()) %>%
  select(parameter) %>%
  pull() %>%
  as.vector()
#> Warning: 1 failed to parse.

date_df <- df %>%
  filter(parameter %in% vector_date_df) %>%
  mutate(value = dmy_hms(value))

date_df_list <- date_df %>%
  group_split(parameter) %>%
  setNames(sort(unique(date_df$parameter)))

# Makes everything else a character
vector_char_df <- df %>%
  filter(!parameter %in% vector_numeric_df,
         !parameter %in% vector_date_df) %>%
  group_by(parameter) %>%
  summarise(n = n()) %>%
  select(parameter) %>%
  pull() %>%
  as.vector()

char_df <- df %>%
  filter(parameter %in% vector_char_df) %>%
  mutate(value = as.character(value))

char_df_list <- char_df %>%
  group_split(parameter) %>%
  setNames(sort(unique(char_df$parameter)))

# Generates all the objects

list2env(numeric_df_list, envir = .GlobalEnv)
#> <environment: R_GlobalEnv>
list2env(date_df_list, envir = .GlobalEnv)
#> <environment: R_GlobalEnv>
list2env(char_df_list, envir = .GlobalEnv)
#> <environment: R_GlobalEnv>

str(inoculated)
#> tibble [1 x 2] (S3: tbl_df/tbl/data.frame)
#>  $ value    : POSIXct[1:1], format: "2022-03-09 11:05:12"
#>  $ parameter: Factor w/ 3 levels "inoculated","signature",..: 1
str(signature)
#> tibble [1 x 2] (S3: tbl_df/tbl/data.frame)
#>  $ value    : chr "NN"
#>  $ parameter: Factor w/ 3 levels "inoculated","signature",..: 2
str(volume)
#> tibble [8 x 2] (S3: tbl_df/tbl/data.frame)
#>  $ value    : num [1:8] 13.2 13.8 13.7 12.3 13.4 ...
#>  $ parameter: Factor w/ 3 levels "inoculated","signature",..: 3 3 3 3 3 3 3 3

Created on 2022-10-17 with reprex v2.0.2

A: Since each parameter has a different data type, we can split() by parameter and then use parse_guess() to do most of the work. Your date data are non-standard and need a little special handling. Lastly, I usually try to avoid dumping related data into separate environment objects, but since it's apparently what you want, here's how to do it:
library(tidyverse)
library(lubridate)

# split the data frame by 'parameter' and attempt to guess each value format
df_split <- split(df, df$parameter) %>%
  lapply(\(x) x %>% mutate(value = parse_guess(value)))

# the date data have a non-standard format and need special handling
df_split$inoculated <- df_split$inoculated %>%
  mutate(value = dmy_hms(value))

# place list objects in global environment: not good practice but it seems to be what you want
list2env(df_split, envir = .GlobalEnv)

A: As jdobres points out, it seems you can simply do split by parameter.
If you still want to split by data type try this:
df_type <- suppressWarnings(ifelse(
    !is.na(as.numeric(df$value)),"volume",ifelse(
        !is.na(dmy_hms(df$value)),"inoculated","signature")))

l <- split(df,df_type)

l$inoculated
l$signature
l$volume

A: Others have pointed out that split does what you want in terms of creating the separate data frames.
Assuming you don't want to use df$parameter, or you can't trust it, you can just parse df$value with your as. functions to create the split factor:
split(df,
  is.na(suppressWarnings(as.numeric(df$value))) +      # +1 if not numeric
  2 * is.na(as.Date(df$value, "%d/%b/%Y %H:%m:%s"))    # +2 if not date
)
$`1`
                 value  parameter
5 09/Mar/2022 11:05:12 inoculated

$`2`
    value parameter
1  13.249    volume
3  13.763    volume
4  13.665    volume
6  12.276    volume
7  13.405    volume
8  13.684    volume
9  13.744    volume
10 14.201    volume

$`3`
  value parameter
2    NN signature

A small technical note, if there are any NAs in the df$value column they will be dropped (because split doesn't like them, and your parsing will return NAs)


text:
Q: Keep publishing data via publisher RabbitMQ (ruby bunny) I have a RabbitMQ with bunny working using consumer.rb and publisher.rb. If I run
    ruby consumer.rb

and then
    publisher.rb

I get data being published (data coming from another class). Data prints like this on ruby consumer.rb when I run publisher.rb:
Test New Data
1142.5186392493372

I need these two scripts run constantly so publisher keep pushing the data (@devise.value) through and i see the above output continuously. I have tried making a new server file using Daemon and run ruby server.rb start. But this does keep running publisher.rb but not constantly so it publishes the data. Also how can I make this RabbitMQ ruby app publish data to another web based rails app?
publisher.rb
require 'bunny'
require 'daemons'
class BunnyPublisher
def connection
    conn = Bunny.new
    conn.start
end

def channel
    connection.create_channel
end

def q
    channel.queue("que")
end

def exchange
    channel.default_exchange
end

def publish(data, q)
    exchange.publish(data, routing_key: "que")

    sleep(5)

    connection.close
end

server.rb
require 'daemons'

Daemons.run('publisher.rb')

Thanks

A: No need for Deamons. I changed Publisher class code in the original question to the current one. And I added a while loop as mentioned.
ruby file running publisher:
i = 0
while i < 1
data = {
            weight: @devise.value,
            pressure: @devise.value
        }
    m = data.to_json;
    @pub.publish(m, routing_key: @q) // @pub: Publisher class
end

in Publisher class:
def publish(data, q)
    exchange.publish(data, routing_key: "queue_name") //exchange another method

    sleep(5) //Publish every 5 seconds

    connection.close
end


text:
Q: bst insert recursion c++ I have a bst encapsulated in a class with a  nested node.
When I try to insert and then print tree, the root attribute of the class does not seem to be updated,
even though I do update it.
void bst::insert(int key,node* temp)
{
  if(temp==NULL)
  {
      node* ptr=getnewnode(key);
      if(root==NULL)
        root=ptr;
       else
       {
         temp=ptr;
         return ;
       }
  }
     if(key<temp->key)
      insert(key,temp->left);
     if(key>temp->key)
      insert(key,temp->right);
}

class bst
{
typedef struct node
{
int key;
node* left;
node* right;
}node;
node* root;
void insert(int key,node* temp);
public:
inline void _insert(int key){insert(key,root);}
};

When i insert say 22,11,33 and then print it, it just shows 22, always the root node.

A: I suppose that when you call insert() from outside the class,  NULL is provided as second argument, because root is private.
Problem 1:
If you insert(22, NULL) the first node is added to your bst as foolows:
  ...
     if(root==NULL)   // yes, the bst is still empty:
        root=ptr;     // so root is set to the new node that was created
     else {...}       // and this bloc is ignored
  }
  if(key<temp->key)   // OUCH !!!! temp is not initalized here
  ...

You risk here a memory corruption or a segfault !
Problem 2:
If you subsequently insert(11, NULL) here is what happens:
  ...
      if(root==NULL)   // No, the bst has already a root
      else {           // so the else block is executed
          temp = ptr;  // you prepare to do something with temp
          return;      // WHY ??  You end the function an return without having done anything
  ...

Problem 3:
Suppose you remove the return statement,  then remember that you just overwrote temp.  The code would continue as follows:
 if(key<temp->key)     // this is false, because temp points to the new node, which has the seme key (temp->key==key) !
 if(key>temp->key)     // this is false, for the same reason

So none of the recursive insert is done !
Solution:
I'd propose you something like this:
void bst::insert(int key,node* temp)
{
    if(temp==NULL) {
       if(root==NULL) {
           root=getnewnode(key);
           return;
       }
       else
           temp=root;  // we now start browsing the tree with root
    }
    if(key<temp->key) {
        if (temp->left==NULL)
           temp->left = getnewnode(key);
       else insert(key,temp->left);
    }
    else if(key>temp->key) {
        if (temp->right==NULL)
           temp->right = getnewnode(key);
       else insert(key,temp->right);
    }
    else if (key==temp->key) {
        // to do:  what happens if key==temp->key
    }
}

It's not clear what is expected when an existing key is inserted again.  Up to you to adapt according to your expectations.
Edit:  Solution with a wrapper:
Following your edit about using a wrapper I propose you following variant:
void bst::insert(int key,node*& temp)  // attention:  change of signature !!!
{
    if(temp==NULL) {  // either root is null or we have reached a null leave
       temp = getnewnode(key);    // temp is a reference to original root or node pointer.  It can be changed directly with this statement
       }
    else if(key<temp->key)
       insert(key,temp->left);
    else if(key>temp->key)
       insert(key,temp->right);
    else if (key==temp->key) {
        // to do:  what happens if key==temp->key
    }
}

A: I am still not sure what I was doing wrong here but now the code works with the below changes.
//wrapper function
void insert(int key)
{
   node * temp=_insert(key,root);
   preorder(root);
}

node* bst::insert(int key,node* temp)
{
 if(root==NULL)
  {
      node* ptr=getnewnode(key);
        root=ptr;
        return root;
  }
   if(temp==NULL)
  {
       node* ptr=getnewnode(key);
       return ptr;
  }
     if(key<temp->key)
      temp->left=insert(key,temp->left);
     if(key>temp->key)
      temp->right=insert(key,temp->right);
}


text:
Q: Base url in CodeIgniter HMVC lose www in secondary module I have a question please... this is my project where I use CI 3x HMVC in Linux hosting I have an error:
.htaccess is this:

Options +FollowSymlinks
RewriteEngine on
RewriteBase /
Options -Indexes

### Redirigir la URL sin www a con www ###
RewriteCond %{HTTP_HOST} ^myserver.com
RewriteRule (.*) https://www.myserver.com/$1 [R=301,L]

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^myserver.com [OR]
RewriteCond %{HTTP_HOST} ^www.myserver.com
RewriteRule (.*) https://www.myserver.com/$1 [R=301,L,QSA] #Falta www

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

RewriteCond $1 !^(index\.php|global|favicon\.ico|javascript)

In my file config.php I have this line:
$config['base_url'] = 'https://www.myserver.com/';

When I load https://www.myserver.com/ in the main "module" (front) I see in all my forms that all have this format:
<form action="https://www.myserver.com/controllerxxxx" action="post"....

The problem is when I load the https://www.myserver.com/admin module... I see in all my forms that have this format...

The difference is in "ADMIN" that my base_url is https://myserver.com/ Without WWW.
What is wrong? Can you help me please?
I need to solve this problem and keep my URL server with WWW in Front and Admin modules.
Thanks!

A: use this instead of that. so replace your .htaccess code with this code.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

for change HTTP to HTTPS try this.
 RewriteEngine On
 RewriteCond %{HTTPS} !=on
 RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]


text:
Q: Converting tensorflow 2 estimator to tf.lite I am trying to convert an estimator LinearClassifier into tflite.
However the code is throwing some error.. I am not able to understand where I am doing wrong.
Here is my code
import pandas as pd
import tensorflow as tf

dftrain = pd.read_csv('https://storage.googleapis.com/tf-datasets/titanic/train.csv')
dfeval = pd.read_csv('https://storage.googleapis.com/tf-datasets/titanic/eval.csv')
y_train = dftrain.pop('survived')
y_eval = dfeval.pop('survived')

#create feature columns. For testing I am using only numeric ones
NUMERIC_COLUMNS = ['age', 'fare']

feature_columns = []

for feature_name in NUMERIC_COLUMNS:
    feature_columns.append(tf.feature_column.numeric_column(feature_name,
                                           dtype=tf.float32))

# Use entire batch since this is such a small dataset.
NUM_EXAMPLES = len(y_train)

def make_input_fn(X, y, n_epochs=None, shuffle=True):
    def input_fn():
        dataset = tf.data.Dataset.from_tensor_slices((dict(X), y))
        if shuffle:
          dataset = dataset.shuffle(NUM_EXAMPLES)
        # For training, cycle thru dataset as many times as need (n_epochs=None).
        dataset = dataset.repeat(n_epochs)
        # In memory training doesn't use batching.
        dataset = dataset.batch(NUM_EXAMPLES)
        return dataset
    return input_fn

# Training and evaluation input functions.
train_input_fn = make_input_fn(dftrain[NUMERIC_COLUMNS], y_train)
eval_input_fn = make_input_fn(dfeval[NUMERIC_COLUMNS], y_eval, shuffle=False, n_epochs=1)

linear_est = tf.estimator.LinearClassifier(feature_columns)

# Train model.
linear_est.train(train_input_fn, max_steps=100)

# Evaluation.
result = linear_est.evaluate(eval_input_fn)

So model is working fine.
print(pd.Series(result))

accuracy                  0.659091
accuracy_baseline         0.625000
auc                       0.667095
auc_precision_recall      0.589936
average_loss              0.619227
label/mean                0.375000
loss                      0.619227
precision                 0.764706
prediction/mean           0.336755
recall                    0.131313
global_step             100.000000
dtype: float64

Now saving part:
serving_input_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn(
  tf.feature_column.make_parse_example_spec(feature_columns))
model_dir = 'model_data'
path = linear_est.export_saved_model(model_dir, serving_input_fn)

when I am using :
converter = tf.lite.TFLiteConverter.from_saved_model(path)
tflite_model = converter.convert()

it throws error :
ValueError: This converter can only convert a single ConcreteFunction. Converting multiple functions is under development.

I have also tried :
saved_model_obj = tf.saved_model.load(export_dir=path)
concrete_func = saved_model_obj.signatures['serving_default']
converter = tf.lite.TFLiteConverter.from_concrete_functions([concrete_func])
tflite_model = converter.convert()

And error is :
ConverterError: See console for info.
2020-02-18 16:23:15.446583: I tensorflow/lite/toco/import_tensorflow.cc:193] Unsupported data type in placeholder op: 20
2020-02-18 16:23:15.446687: F tensorflow/lite/toco/import_tensorflow.cc:2706] Check failed: status.ok() Input_content string_val doesn't have the right dimensions for this string tensor
     (while processing node 'head/AsString')
Fatal Python error: Aborted

Please help.

A: Please refer to the following info:

"Some of the operators in the model are not supported by the standard TensorFlow Lite runtime. If those are native TensorFlow operators, you might be able to use the extended runtime by passing --enable_select_tf_ops, or by setting target_ops=TFLITE_BUILTINS,SELECT_TF_OPS when calling tf.lite.TFLiteConverter(). Otherwise, if you have a custom implementation for them you can disable this error with --allow_custom_ops, or by setting allow_custom_ops=True when calling tf.lite.TFLiteConverter(). Here is a list of builtin operators you are using: ADD, ADD_N, ARG_MAX, EXPAND_DIMS, FULLY_CONNECTED, RESHAPE, SOFTMAX, TILE. Here is a list of operators for which you will need custom implementations: As
String."

For me, this problem was solved after adding option "--allow_custom_ops":
tflite_convert --enable_v1_converter --allow_custom_ops --output_file=xxx --saved_model_dir=xxx --saved_model_signature_key='predict'


text:
Q: Cannot find a differ supporting object angular / angularfire2 I am trying to make a ngFor but I receive the following error
[![enter image description here][1]][1]
<div class="col-md-4" *ngIf="service | async as service"><!-- categoryes -->
     <div *ngFor="let offer of offers">
         <div *ngFor="let o of offer">
              {{ o }}
         </div>
    </div>
  </div>

component.ts
this.serviceDoc = this.afs.doc('service/Estética');
this.service =  this.serviceDoc.valueChanges();
this.service.subscribe(data => {
  this.offers = Array.of(data.service);
  console.log(this.offers);
})

JSON.stringify(data.service)
{"Cabello":{"Cortes":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2FCortes.png?alt=media&token=f4b8243f-60fd-436c-877a-cd496cc6dd22","name":"Cortes"},"Peinados":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2FPeinados.png?alt=media&token=d2a87d76-a8f7-447d-bd35-3a3fdac54e07","name":"Peinados"},"Rizos":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2FRizos.png?alt=media&token=52bcf4b3-d5f3-44ba-a5b2-5475bf9332a3","name":"Rizos"},"Tintes":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2FTintes.png?alt=media&token=61ba135c-141d-47aa-a0f0-0ca277e302a1","name":"Tintes"},"color":"#4CAF50","icon":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/category-icon%2Fcabello.png?alt=media&token=476af203-5d5a-49a5-bdd9-276e529d658f","img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/category%2Fcabello_movil.jpg?alt=media&token=633c0664-6ebe-4af4-ab76-9b02de918482"},"Manos":{"Manicure":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fmanicure.png?alt=media&token=3fe6f405-ddc3-4d53-9b2b-c1a15b5afabe","name":"Manicure"},"Uñas":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fun%CC%83as.png?alt=media&token=c7cb50f2-bf06-40a9-a9b5-9d789a50ada6","name":"Uñas"},"color":"#9C27B0","icon":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/category-icon%2Fmanos.png?alt=media&token=0ee0ab0f-9455-4be5-b8e1-6fb6fe63a61e","img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/category%2Fun%CC%83as_movil.jpg?alt=media&token=59c858de-1b6e-47aa-a0ba-0797e6867b79"},"Novias y XV años":{"Maquillaje XV años":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fmaquillaje.png?alt=media&token=408f4919-e7bc-4ec5-a7f2-70c5e5def020","name":"Maquillaje XV años"},"Peinados XV años":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2FPeinados.png?alt=media&token=d2a87d76-a8f7-447d-bd35-3a3fdac54e07","name":"Peinados XV años"},"Uñas XV años":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fun%CC%83as_pies.png?alt=media&token=024e2b9a-41c7-4b82-a20b-4bca351c0ef5","name":"Uñas XV años"},"color":"#FCE4EC","icon":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/category-icon%2Fnovias.png?alt=media&token=81612459-fd6f-4d81-b6cc-f766192226fe","img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/category%2Fnovias_movil.jpg?alt=media&token=3bacc17f-3a19-4ce6-9a77-edabc8c2f290"},"Pies y piernas":{"Depilación":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fdepilacion.png?alt=media&token=213a6e55-866a-43cc-9772-bd0e6343a775","name":"Depilación"},"Pedicure":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fpedicure.png?alt=media&token=903f7408-77c3-42f8-81cb-d9b82daff061","name":"Pedicure"},"Uñas pies":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fun%CC%83as_pies.png?alt=media&token=024e2b9a-41c7-4b82-a20b-4bca351c0ef5","name":"Uñas en pies"},"color":"#03A9F4","icon":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/category-icon%2Fpiernas.png?alt=media&token=07ce0132-04b0-4cdf-beb8-3148ff833ff9","img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/category%2Fpiernas_movil.jpg?alt=media&token=c184e475-0e17-4f13-91a7-dcabdc9725be"},"Rostro":{"Cejas":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fcejas%20y%20pestan%CC%83as.png?alt=media&token=812676fe-96b0-4e18-b671-c15f21e0b533","name":"Cejas y pestañas"},"Exfoliacion":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fexfoliacion.png?alt=media&token=8293740f-e8fe-4881-80ae-60652af6e383","name":"Exfoliación"},"Maquillaje":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fmaquillaje.png?alt=media&token=408f4919-e7bc-4ec5-a7f2-70c5e5def020","name":"Maquillaje"},"Microblanding":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fmicroblanding.png?alt=media&token=b6fbd527-3964-47b9-bc4b-385e62f8c576","name":"Microblanding"},"color":"#FFC107","icon":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/category-icon%2Fmaquillaje.png?alt=media&token=ae952f56-6bb7-4d26-99de-29cb9210c533","img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/category%2Frostro_movil.jpg?alt=media&token=74f1e3ef-b732-48d8-8d66-37742956e0f9"},"Spa":{"Barro":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fbarro.png?alt=media&token=e2d05c09-39a2-48aa-a656-1769d3e5c07e","name":"Barro"},"Masaje":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fmasajes.png?alt=media&token=6df3e533-79dd-493e-9ce3-bd7ab284aab8","name":"Masaje"},"Piedras":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Fpiedras%20calientes.png?alt=media&token=70285d62-3699-41a8-890b-94c705e6a253","name":"Piedras calientes"},"Temazcal":{"img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/icon%2Ftemazcal.png?alt=media&token=835aa2fd-33c8-4b0b-9adb-8024266d3c7a","name":"Temazcal"},"color":"#795548","icon":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/category-icon%2Fspa.png?alt=media&token=352dad9b-457e-4919-aede-68b7300bcfb7","img":"https://firebasestorage.googleapis.com/v0/b/micatalogo-online.appspot.com/o/category%2Fspa_movil.jpg?alt=media&token=bea4dd80-fde2-4e70-9113-e0ff6211537c"}}

A: Based on your JSON, actually,
this.offers = Array.of(data.service);

returns a Object of objects.As the error denotes You need an array to bind with ngFor. You can convert to array of objects with this
this.offers = Object.values(data.service)


text: Q: Weighted measures in surveys In sample surveys a weight is typically calculated so that the weighted population measure by certain pre-selected categories (e.g., gender, age groups, geographic areas, etc.) match national total that is already known. The question is - are all the other weighted measures (e.g., income, wealth, health insurance coverage, prevalence of certain health conditions, etc.) accurately estimate the national total, which are mostly unknown?


text:
Q: Use result of previous loop as input for next loop I have the code below, which seems to accomplish what I'm trying to do but also throws the error output shown below the code.  What I'm trying to do, is run through the loop the first time with x = 1, then for each time the loop runs after that I want x = y, the result of the previous loop.  I always fumble with loops so any tips are greatly appreciated.
Code:

for(i in 1:5)
{
 if(i=1)
 {
 x<-1
 }
 else
 {
 x<-y
 }
 y<-x*i
 y
 }

ERRORS:

 for(i in 1:5)
+ {
+   if(i=1)
Error: unexpected '=' in:
  "{
    if(i="
   >   {
   +   x<-1
   +   }
    >   else
   Error: unexpected 'else' in "  else"
   >   {
   +   x<-y
  +   }
   >   y<-x*i
   >   y
   [1] 25
   > }
   Error: unexpected '}' in "}"

A: Here is your code re-written with slightly clearer syntax
for (i in 1:5) {
    if (i == 1) {
        x <- 1
    } else {
        x <- y
    }
    y <- x * i
}

Or even better syntax.
for (i in 1:5) {
    x <- ifelse(i == 1, 1, y)
    y <- x * i
}


text:
Q: samba share in /etc/fstab is ignored during mount -a but manual mount works It's one of these problems I'm running into every time that I set up a server :-(
I have an Ubuntu server 16.04 and would like to auto-mount a samba share.
In my /etc/fstab I have the entry:
//10.10.2.2/share    /media/share    cifs    defaults,_netdev,noauto,nofail,username=user,passwd=pass    0    0

When I execute
sudo mount -a

I get no error message but the share is not mounted :-(
The most interesting part however is that if I do a
sudo mount /media/share

The share is mounted
I had various problems with samba before but this behavior is new for me. Does anybody have an idea how to address this issue?

A: That's normal behaviour if you set noauto. From man mount:

noauto Can  only  be  mounted  explicitly (i.e., the -a option will not
                cause the filesystem to be mounted).


text:
Q: ArgumentOutOfRangeException Constructor (String) definition I am just trying to get some more details about how Exceptions work. From MSDN page ArgumentOutOfRangeException Constructor (String) I find the note: "This constructor initializes the ParamName property of the new instance using the paramName parameter. The content of paramName is intended to be understood by humans."
What does this really mean? Is it obligatory for the string input of ArgumentException to always match the method definition input name?
(i.e. double amount --> "amount")
If it is obligatory, wouldn't be easier for maintenance purposes that the string should be automatically updated somehow if the method input arguments changed names?
From MSDN unitTesting tutorial we have the following code:
       public void Debit(double amount)
    {
        if (m_frozen)
        {
            throw new Exception("Account frozen");
        }

        if (amount > m_balance)
        {
            throw new ArgumentOutOfRangeException("amount");
          //throw new ArgumentOutOfRangeException("whatever");  <-- this is my comment
          //throw new ArgumentOutOfRangeException("what is the point?"); <-- this is my comment
        }

        if (amount < 0)
        {
            throw new ArgumentOutOfRangeException("amount");
        }

        m_balance -= amount;
    }

A:
What does this really mean?

This means that the parameter passed as the paramName should be the the actual parameter that caused the exception. Why? Because if an exception is thrown, that means your program encountered errorness behavior and it would help to know which param was out of its range.

If it is obligatory, wouldn't be easier for maintenance purposes that the string should be automatically updated somehow if the method definition changed?

Yes, it definitely would. That is exactly why C# 6 introduced the nameof operator:
public void Foo(int amount)
{
     if (amount < balance)
         throw new ArgumentOutOfRangeException(nameof(amount));
}

A: It means exactly what it says. The content is supposed to be understood by the person reading it, not a machine. So, you should make it something that's descriptive to the problem (probably the argument that was out of range).
It's not "obligatory" for the paramName to match the actual name of the method parameter, but it will probably help those maintaining your code.

A: In order to simply and clearly answer your question, No it doesn't matter waht you pass as this argument. you just pass it here :
void SomeMethod(/*someParameters*/)
{
    ...
    throw new ArgumentOutOfRangeException("your desired name");
    ...
}

and use it as :
try
{
    ...
    SomeMethod(...);
    ...
}
catch(ArgumentOutOfRangeException exception)
{
    use exception.ParamName
}

you'd better pass the parameter name to realize which parameter was out of range
in catch.
I hope it helps.


text:
Q: Why 'd' in 'Aeneid'? The Latin poem Aeneis is Aeneid in English. How did the last d come about?
A few suspects by quick search:

*

*/ð/ → /d/ shift in English, but there must be a shift /s/ → /ð/.

*It seems romance languages write it with d, possibly it came from French? (German does not have d).

A: Latin words have different forms for different grammatical cases (depending on their function in a sentence or phrase). Aeneis is the nominative case form of the title in Latin, but the stem is actually Aeneid-. The -s at the end of Aeneis is a nominative singular ending that causes the d at the end of the stem to be deleted, since Latin doesn't allow words to end in a cluster *-ds. So the grammatical structure of the word is Aeneid-s which ends up as Aeneis. When the word has a different case in Latin, it takes other suffixes and the d is visible.
When a Latin word is taken into English, sometimes the nominative form is taken as-is, but sometimes a form based on the stem is used. It may depend on the details of how the word got into English. Actually, the Oxford English Dictionary says that in the case of Aeneid, a third type of form based on the Greek-type genitive singular (A)eneidos was once used in English.


text:
Q: How to clone a model with ReLU and concatenated layers in tf.keras 1.14? This code is provided by the official team of NeRF(2020) using tensorflow 1.14. I am trying to clone this model using tf.keras.clone_model(). The problem I am facing in the current code is that 'ReLU' object has no attribute '_name_'. The model is created with the following code. The summary of the model can be found at the end of the post.
def init_nerf_model(D=8, W=256, input_ch=3, input_ch_views=3, output_ch=4, skips=[4], use_viewdirs=False):
    relu = tf.keras.layers.ReLU()
    def dense(W, act=relu): return tf.keras.layers.Dense(W, activation=act)

    print('MODEL', input_ch, input_ch_views, type(
        input_ch), type(input_ch_views), use_viewdirs)
    input_ch = int(input_ch)
    input_ch_views = int(input_ch_views)
    inputs = tf.keras.Input(shape=(input_ch + input_ch_views))
    inputs_pts, inputs_views = tf.split(inputs, [input_ch, input_ch_views], -1)
    inputs_pts.set_shape([None, input_ch])
    inputs_views.set_shape([None, input_ch_views])

    print(inputs.shape, inputs_pts.shape, inputs_views.shape)
    outputs = inputs_pts
    for i in range(D):
        outputs = dense(W)(outputs)
        if i in skips:
            outputs = tf.concat([inputs_pts, outputs], -1)

    if use_viewdirs:
        alpha_out = dense(1, act=None)(outputs)
        bottleneck = dense(256, act=None)(outputs)
        inputs_viewdirs = tf.concat(
            [bottleneck, inputs_views], -1)  # concat viewdirs
        outputs = inputs_viewdirs
        # The supplement to the paper states there are 4 hidden layers here, but this is an error since
        # the experiments were actually run with 1 hidden layer, so we will leave it as 1.
        for i in range(1):
            outputs = dense(W//2)(outputs)
        outputs = dense(3, act=None)(outputs)
        outputs = tf.concat([outputs, alpha_out], -1)
    else:
        outputs = dense(output_ch, act=None)(outputs)

    model = tf.keras.Model(inputs=inputs, outputs=outputs)
    return model

As I searched, the only solution I found was to create a sequential model like below, but I wonder how to make a sequential model of the same structure - like, how do you make the input layer and the concatenate layers? You can see the summary at the bottom.
model = Sequential()
model.add(Dense(W))
model.add(ReLU())
...

So I attempted three other solutions:

*

*Make an independent ReLU layer in the current construction style:

    ...
    outputs = tf.keras.layers.Dense(W)(outputs)
    outputs = tf.keras.layers.ReLU()(outputs)

*Use tf.keras.activations.relu instead. I tried to set it as the activation for Dense layer, and then as a separate layer, but neither worked. The error message was the same. \

*Copy the model with "=". However, when I change the new_grad_vars, the weights of the original model also change, which is not desired.

    new_model = model
    new_grad_vars = new_model.trainable_variables

Now, I'm looking for an answer of either sort:
a. How to create a clonable ReLU layer in the current way of construction
b. How to build the current model with input and concatenated layers as it is now using Sequential().
I would highly appreciate your help!
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to
==================================================================================================
input_1 (InputLayer)            [(None, 90)]         0
__________________________________________________________________________________________________
tf_op_layer_split (TensorFlowOp [(None, 63), (None,  0           input_1[0][0]
__________________________________________________________________________________________________
dense (Dense)                   (None, 256)          16384       tf_op_layer_split[0][0]
__________________________________________________________________________________________________
dense_1 (Dense)                 (None, 256)          65792       dense[0][0]
__________________________________________________________________________________________________
dense_2 (Dense)                 (None, 256)          65792       dense_1[0][0]
__________________________________________________________________________________________________
dense_3 (Dense)                 (None, 256)          65792       dense_2[0][0]
__________________________________________________________________________________________________
dense_4 (Dense)                 (None, 256)          65792       dense_3[0][0]
__________________________________________________________________________________________________
tf_op_layer_concat (TensorFlowO [(None, 319)]        0           tf_op_layer_split[0][0]
                                                                 dense_4[0][0]
__________________________________________________________________________________________________
dense_5 (Dense)                 (None, 256)          81920       tf_op_layer_concat[0][0]
__________________________________________________________________________________________________
dense_6 (Dense)                 (None, 256)          65792       dense_5[0][0]
__________________________________________________________________________________________________
dense_7 (Dense)                 (None, 256)          65792       dense_6[0][0]
__________________________________________________________________________________________________
dense_9 (Dense)                 (None, 256)          65792       dense_7[0][0]
__________________________________________________________________________________________________
tf_op_layer_concat_1 (TensorFlo [(None, 283)]        0           dense_9[0][0]
                                                                 tf_op_layer_split[0][1]
__________________________________________________________________________________________________
dense_10 (Dense)                (None, 128)          36352       tf_op_layer_concat_1[0][0]
__________________________________________________________________________________________________
dense_11 (Dense)                (None, 3)            387         dense_10[0][0]
__________________________________________________________________________________________________
dense_8 (Dense)                 (None, 1)            257         dense_7[0][0]
__________________________________________________________________________________________________
tf_op_layer_concat_2 (TensorFlo [(None, 4)]          0           dense_11[0][0]
                                                                 dense_8[0][0]
==================================================================================================
Total params: 595,844
Trainable params: 595,844


text:
Q: Are all phrase verbs informal? Are all phrasal verbs informal and not appropriate to use in academic texts? For instance, 'carry out'. I see this word in papers very often. Is it formal? Is it necessary to distinguish which phrasal verb is formal and which not?

A: It is not true that "all phrasal verbs are informal and not appropriate to use in academic texts". The first two entries in the Collins Cobuild Dictionary of Phrasal Verbs are abide by and accede to, both of which the dictionary marks as formal.
What can said, however, is:

*

*highly informal phrasal verbs should be avoided in academic text (e.g. knock off, wise up, do in),

*most words in the Collins dictionary can be considered as existing around the center of the informal/formal cline,

*writers aspiring to a greater degree of formality can often choose a single-word equivalent (e.g. carry out → perform, conduct),

*often the phrasal verb may be the best choice, as  the Collins dictionary states:

It is often said that phrasal verbs tend to be rather 'colloquial' or
'informal' and more appropriate to spoken English than written, and
even that it is better to avoid them and choose single-word
equivalents or synonyms instead. Yet in many cases phrasal verbs and
their synonyms have different ranges of use, meaning and collocation,
so that a single-word equivalent cannot be substituted appropriately
for a phrasal verb. (Foreword)

As @nnnnnn said in the comment, if you are seeing phrasal verbs such as carry out many times in the writings in your academic field then you are safe to use them. But see point 3. above.

A: This article from Typely.com amplifies and enlarges upon previous answers (there is a previous thread). It includes some useful examples (though the actual definition of 'phrasal verb' they use seems, from some claimed examples,  more than usually imprecise), classifying by register (formality):

Because of their frequent occurrence in informal speech and writing,
it's not unreasonable to think that phrasal verbs are always informal.
You may have read that phrasal verbs should be avoided in formal
writing, and that the single verb equivalents should be used instead.
While to some extent that's true, the reality is more complicated.
Phrasal verbs in formal writing
There are many phrasal verbs that can and also should be used in
formal writing. You will often see them used in many quite formal and
formal texts such as business letters, academic writing, scientific
papers, technical papers, legal documents, news reports, and official
government documents.
Before we move on to examples of phrasal verbs that are useful and
appropriate for formal writing, let's look at language register for a
moment...
'Register' is the term we use to refer to different varieties or
styles of speaking and writing, and also the degree or level of
formality with which we speak or write. Degree of formality is on a
sliding scale rather than in distinct categories, and although phrasal
verbs are often thought of as an informal part of language, most of
them are neutral, and some are in fact rather formal.
Some phrasal verbs are definitely informal, for example:

*

*beaver away [at] – work hard for a long time

*belt out [T] – sing or play a musical instrument very loudly

*harp on [about] – talk non-stop about something in a boring or annoying way

*pig out – eat a lot of or too much food

In your formal writing, you should of course avoid phrasal verbs that
are at the informal end of register, and steer clear of slang phrasal
verbs, and those that would be considered by many to be offensive. A
good phrasal verb dictionary will tell you which phrasal verbs are
informal, slang, or offensive.
It's true that very often, single verbs are more formal and therefore
are more appropriate for formal writing than their phrasal verb
equivalents. Some examples of these are:

*

*Single verb/Phrasal Verb

*constitute/make up

*calculate/work out

*cause/bring about

*discover/find out

*discuss/talk about

*emerge/come out

*eradicate/stamp out

*increase/go up

*maintain/keep up

*organize/set up

*propose/put forward

*select/pick out
However, most phrasal verbs are neutral, neither informal or formal,
and in general there's no reason to specify they shouldn't be used in
formal writing. In fact, in some cases it's more appropriate to use a
phrasal verb in place of a single verb. For example, the phrasal verb
'carry out':
"Researchers carried out a survey into …" sounds much better for
formal writing than
"Researchers did a survey into …"
At the other end of the formality register, there are phrasal verbs
that are so formal they're only used in very formal or serious speech
or writing. If you were to use them in informal writing they would
very strange and out of place.
Examples of formal phrasal verbs

*

*adhere to

*appertain to

*ascribe to

*disabuse of

*emanate from/to

*depart from

*engage in

*enlarge on/upon

*enter on/upon

*offend against

*permit of

*pertain to

*provide against

*set forth

As always with writing, context is everything – remember to use the
language most appropriate to your audience. Your university,
organization, etc. will most probably have a guide to the language you
should use for formal writing, including their preferences for using
phrasal verbs or their single verb equivalents.
Summary
Often, single verbs are more formal than phrasal verbs and therefore
can be more appropriate for formal writing than their phrasal verb
equivalents. Nevertheless, phrasal verbs are very common in formal
writing. Offensive, slang, and informal phrasal verbs are not
appropriate for formal writing. Most phrasal verbs are neutral and
therefore, in general, there's no reason to specify they shouldn't be
used in formal writing. Some phrasal verbs are so formal they're only
used in very formal or serious writing. Yes, you can use phrasal verbs
in formal writing, as long as you choose those that are the most
suitable for your context or audience.

A: Shoe's and Edwin Ashworth's answers are useful, but one thing I think can be added is that "phrasal verb" is not a very specific term, so you may need to get more specific.
In particular, many of the examples of "formal phrasal verbs" in those two answers are actually verbs that take prepositional phrases as complements.
I don't think "prepositional verbs" sound informal
Verbs like "abide by", "accede to", "disabuse of", "engage in", "enlarge on/upon" all fall into that category: according to most analyses of English syntax, the second word here is a preposition that does not form a phrase with the preceding verb, but forms a prepositional phrase with the following noun phrase.
I would say prepositional verbs do not have any special tendency to sound informal. Many formal latinate verbs take a prepositional phrase as their complement; in fact, there are verbs in Latin itself that work the same way. For example, accedo, the Latin verb that is the source of the verb accede, could take as its complement a prepositional phrase starting with ad (the Latin preposition meaning "to").
One thing to consider: the highly formal "pied-piping" construction found in phrases like "important problems to which we must attend" is fully compatible with prepositional verbs like "attend to". If prepositional verbs were inherently informal, it would be odd if they could be used freely in such a formal construction.
"Particle verbs" might sound informal, but not always
The other type of "phrasal verb" is what are also called "particle verbs": words where the verb is accompanied by a word that (usually) has the same form as a preposition, but that does not take a noun phrase as its complement. For example, in the sentence "You need to push in the tab using a screwdriver", the word "in" does not form a phrase with the noun phrase "the tab", which can be seen from the alternative word order "You need to push the tab in using a screwdriver." Traditionally, words like in were considered to be used as "adverbs" in this kind of sentence, but modern linguists may categorize them as prepositions used intransitively.
Unlike prepositional verbs, particle verbs do not have a close parallel in classical Latin (Latin verbs could be prefixed with prepositions, but they couldn't have prepositions used without nouns as separate words going with the verb). This construction is I think the main type of "phrasal verb" that might be felt to be informal. "Carry out" is a particle verb: we can say "carry it out", showing that "out" does not form a phrase with a noun in this construction. I don't actually find that "carry out" sounds particularly informal to me, but I have never tried to write with a very high degree of formality (as you see, I use contractions, another feature that is sometimes said to be "informal"), so you'll have to look at the usage in the community that you want to be a part of, as Shoe advised.


text:
Q: Casting double to int in C When I cast the double value 44.000000 to int, I get the desired value of 44.
But, When cast the same double value (44.000000) that was derived by some arithmetic operations to int, I get 43.
How can I get rid of this problem and get 44 instead of 43 in the second case?
Below is the code I used,
#include<stdio.h>
#include<math.h>

int main(){

    double newd = 44.00;
    printf("Simple Direct Conversion: %d\n\n", (int)newd);

    double d = 100.44;
    double decPart;
    double fracPart = modf(d, &decPart);

    printf("Original Values:      %lf - %lf\n", decPart, fracPart);
    printf("Multiplied by 100:    %lf - %lf\n", decPart * 100, fracPart * 100);
    printf("Converted to Integer: %d - %d\n", (int)(decPart * 100), (int)(fracPart * 100));

    return 0;
}

and the output is,

Simple Direct Conversion: 44
Original Values:      100.000000 - 0.440000
Multiplied by 100:    10000.000000 - 44.000000
Converted to Integer: 10000 - 43


text:
Q: Branch and bound algorithm for maximization of importance I have a problem that should be solved with branch and bound algorithm, however i'm having a hard time thinking how to solve it. I'cant figure out how to start the branch and bound algorithm.
Here is the problem:
A car has a maximum weight and volume capacity, and i need to fill the car with packages. Those packages have a determined value of importance, weight and volume. The objective is to put in the car the combination of packages with highest importace value without passing the limits of weight and volume of the car.

A: For branch and bound you need to know how to describe a partial solution, and how to work out a bound on how good it could possibly be. A partial solution could be a list of packages that you have decided will definitely go in the car, regardless of what else you add. You can work out an upper bound on how much value will go in the car by looking to see how much space and weight is left, and, amongst the packages that are left, what the largest amount of value per unit volume and value per unit weight are.


text:
Q: How to remove certain unwanted response while uploading array of images in certain field of Schema using Mongoose? This is Api for storing images.While storing images I want only pathname to get stored in DB rather than fieldname,sizes etc. And below is the response I am getting. I need only path to get stored in Db.Also while fetching I am getting this response which is of no use . Only image name or pathname is sufficient.
 const createStore = async (req,res,next) => {
            var id = req.params.tempid;
            var tempDetail = await Template.findById({_id:id})

            console.log("create store runnin,,,,,,,,")

            var store={
                "store_id":req.body.store_id,
                "store_name":req.body.store_name,
                "context": req.body.context,
                "display_image": req.body.display_image,
                "DisplayImage":req.files.DisplayImage,
                "DisplayLogo":req.files.DisplayLogo
            }
            console.log("before store save")
            console.log(store)

            try{
              await Template.updateOne(
                { _id : id },
                { $push: { store:store }}
            )

Response -
 {
      store_id: '1',
      store_name: 'sample',
      context: 'dmstore',
      display_image: 'chings',
      DisplayImage: [
        {
          fieldname: 'DisplayImage',
          originalname: '12345610.jpg',
          encoding: '7bit',
          mimetype: 'image/jpeg',
          destination: './template-store/temporaryImage',
          filename: '12345610.jpg',
          path: 'template-store\\temporaryImage\\12345610.jpg',
          size: 39955
        },
       ]

Blockquote

A: You can map through each image and take only path instead of entire object
var store={
  "store_id":req.body.store_id,
  "store_name":req.body.store_name,
  "context": req.body.context,
  "display_image": req.body.display_image,
  "DisplayImage":req.files.DisplayImage.map(image => image.path),
  "DisplayLogo":req.files.DisplayLogo
}


text:
Q: How can I load the title of parent item in Drupal I want to extend Nodes with the title of the parentnode so I can display a hierarchy link.
I have a solution that sometimes works:
function modulename_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL)
{
    switch ($op)
    {
        case 'view':
        loadParentTitle($node);
        break;
    }
}

function loadParentTitle(&$node)
{
    $title = $node->title;
    $query = "SELECT mlid, p1, p2,p4,p5,p6,p7,p8,p9  FROM menu_links WHERE link_title like '%%%s%%'";

    $data =  db_fetch_array(db_query($query, $title));

    $mlid = $data["mlid"];
    $i = 9;
    while (($data["p". $i] == 0 || $data["p". $i] == $mlid) && $i >= 0)
    {
        $i--;
    }
    if ($i > 0)
    {
        $query = "SELECT `link_title` as parentTitle from  `menu_links` WHERE  mlid = " . $data["p" . $i];
        $data =  db_fetch_array(db_query($query));
        $parentTitle = ($data["parentTitle"]);
    }
    else
    {
        $parentTitle = $title;
    }
    $node->content['#parentTitle'] = $parentTitle;
}

This works as long as the title of the item is the same as the Menu Title. However i'm looking for a solution that will work all the time. Any ideas?

A: You did not specify really what do you mean by 'parent node' but the mlid of the parent of a menu link is stored in menu_links.plid. Now, the link_path is going to be node/nid and you can fetch the title from there.
$mlid = db_result(db_query("SELECT plid FROM {menu_links} WHERE link_path = 'node/%d'", $node->nid));
$link_path = db_result(db_query("SELECT link_path FROM {menu_links} WHERE mlid = %d", $mlid));
$title = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", substr($link_path, 5));

The first two queries can be unified by a JOIN but I strongly recommend against getting the third in there too (you can with CONCAT('node/', nid) = parent.link_path) because that is not going to be indexable. These three queries should be practically instant.
P.S. You won't forget to check_plain($title) before printing, would you? :)


text:
Q: Apache unable to find DocumentRoot even though it exists? I've been setting up a local web server, but I'm having an issue with the following error when I start or restart the Apache httpd service.
Starting httpd: Warning: DocumentRoot [/www/html/project1] does not exist
Now I've checked within the html folder and the project1 folder does exist. I can write to that directory via FTP, and the ownership of the folder is for root. I've also checked SELinux and I can confirm that this has been disabled.
Here is my Virtual Host information:
NameVirtualHost *:80

<VirtualHost *:80>
     ServerAdmin admin@local.com
     DocumentRoot /www/html/project1
     ServerName local.project1.com
     ErrorLog logs/local.project1.com-error_log
     CustomLog logs/local.project1.com-access_log common
</VirtualHost>

What's going wrong?
Edit
I've checked to see the folder permissions on the folder, and here they are:
drwxr-xr-x  2  apache  root  4096  Nov 20 15:32  project1

Apache is still giving the same errors.


text:
Q: Creating a Dynamic Image using Friends pictures I am working on a Facebook for which I need to get all the Profile Pictures of Friends of the users. Which I did using FQL query. I need these images for creating a poster of all the Friends Profile pics along tags in them.
For that I need to create a Dynamic poster for every user with their Friends tagged in them.
I tried using the GD Library for PHP.
I tried with the imagecreatefromjpeg() function of php for which I can use one image and pass it to the main image. But here I have more than 1 images (average about 100 images) depending on the number of friends the user has.
What function do I need to create this dynamic poster ?
Please any help would be appreciated !!

A: Refer this http://devzone.zend.com/29/dynamic-image-generation-with-php/


text:
Q: Parameter variation plot error h = -5; k = 0;
ParametricPlot[{{(t - Sin[t] + h), (1 - Cos[t])}, {(Cos[t] -
     1), (t - Sin[t]) + k} }, {t, 0, 2 Pi}, PlotLabel -> Cycloid_OT,
 PlotStyle -> {Red, Thick}, GridLines -> Automatic]
ParametricPlot[
 Evaluate@Table[{{(t - Sin[t] + h), (1 - Cos[t])}, {(Cos[t] -
       1), (t - Sin[t]) + k} }, {h, -5, 5, 1}], {t, 0, 2 Pi},
 PlotLabel -> Cycloid_OT, PlotStyle -> {Red, Thick},
 GridLines -> Automatic]

The two cycloid curves parametrized below have slopes that multiply to $-1$.
$$[( t-\sin t),(1- \cos t)]$$
$$[\cos t , (t-\sin t)]$$
I am trying to generate a mesh of plots by varying $h$ and $k$.
But $h$ itself is in error.
The plot aims to show that not all intersections are orthogonal, by visible verification.
Thanks for errors correction.
EDIT1:
Plot of two families of cycloids suggested by kglr with plot $Join$ using half interval for (h,k) steps in the intervals $ (-2<x<0),\, (0<y<2) :$


text:
Q: Ext JS 4.2: How to disable collapsing grouping in the grid I have a grid with grouping enabled. But I want to disable the ability to collapse the group items
Any ideas?
Thanks
Tharahan

A: http://docs-origin.sencha.com/extjs/4.2.2/#!/api/Ext.grid.feature.Grouping-cfg-collapsible

collapsible : Boolean
Set to false to disable collapsing groups from the UI. This is set to false when the associated store is buffered.
Defaults to: true

Use features: [{ftype:'grouping', collapsible: false}], on your grid

Ext.application({
    name: 'Fiddle',

    launch: function() {
        var store = Ext.create('Ext.data.Store', {
            storeId: 'employeeStore',
            fields: ['name', 'seniority', 'department'],
            groupField: 'department',
            data: {
                'employees': [{
                    "name": "Michael Scott",
                    "seniority": 7,
                    "department": "Management"
                }, {
                    "name": "Dwight Schrute",
                    "seniority": 2,
                    "department": "Sales"
                }, {
                    "name": "Jim Halpert",
                    "seniority": 3,
                    "department": "Sales"
                }, {
                    "name": "Kevin Malone",
                    "seniority": 4,
                    "department": "Accounting"
                }, {
                    "name": "Angela Martin",
                    "seniority": 5,
                    "department": "Accounting"
                }]
            },
            proxy: {
                type: 'memory',
                reader: {
                    type: 'json',
                    root: 'employees'
                }
            }
        });

        Ext.create('Ext.grid.Panel', {
            title: 'Employees',
            store: Ext.data.StoreManager.lookup('employeeStore'),
            columns: [{
                text: 'Name',
                dataIndex: 'name',
                flex: 1
            }, {
                text: 'Seniority',
                dataIndex: 'seniority',
                flex: 1
            }],
            features: [{
                ftype: 'grouping',
                collapsible: false
            }],
            width: 500,
            renderTo: Ext.getBody()
        });
    }
});
<script src="https://extjs.cachefly.net/ext/gpl/4.2.1/ext-all-debug.js"></script>
<link href="https://extjs.cachefly.net/ext/gpl/4.2.1/packages/ext-theme-classic/build/resources/ext-theme-classic-all.css" rel="stylesheet"/>


text:
Q: Where is properties menu in Visual Studio 2017 Xamarin I am getting an error in Xamarin when building a release version.  I actually have never released code before, and i have no idea what im doing.  if you could tell me, i am getting this error but i do not know how to follow the instructions because my Visual Studio doesnt have a menu called properties

Debug is not enabled in the current configuration. Please Start
  Without Debugging or change it in Properties -> iOS Build.

A: Right click to IOS project--> open Proprieties page and enabled debug for IOS


text:
Q: Python 3D histogram I have X, Y, Z data and I want to make a picture out of it where the colour represents the value of z (interval average value of Z).
So far I can make a colorfull 2D histogram using the X, Y data (the colour is the X, Y occurrency frequency)
import matplotlib.pyplot as plt
plt.hist2d(x, y, bins=(10,10))

Is there a python function to do what I need at once?

A: My first stop for questions like this is the matplotlib gallery. If you want to plot a function in x and y, you may want to check out pyplot.contour or pyplot.pcolormesh (this one has some funny business with wanting 'cell centered' values for the colors, so it may drop the last row/column of the data). You can also check out the mplot3d toolkit near the bottom of the gallery if you want a 3d representaiton.


text:
Q: Where to begin with programming an audio interface driver? I'm designing my own mic/line preamp (the analog portions) and would like to have it interface with a computer in a send-return fashion as well (like any typical audio interface).
I've noticed that Texas Instruments and other manufacturers sell A/D/A converter chips for dirt cheap.  However, the missing link would be the driver code to actually have the computer read and interpret the sent bits, as well as send bits back to the device via USB (having the correct USB topology would also be important).  I know a bit of C programming, and I've heard that is the language audio drivers are typically created in.
Here are my questions: are there pre-programmed microcontrollers that include all the necessary I/O and driver code for audio-to-computer interfacing?  Or can generic driver code be found on  a site like GitHub?  If not, where do I begin with programming such software?  i.e. what to research, what to focus on, etc.
Thanks a lot for your help!

A:
I've noticed that Texas Instruments and other manufacturers sell A/D/A converter chips for dirt cheap. However, the missing link would be the driver code to actually have the computer read and interpret the sent bits, as well as send bits back to the device via USB (having the correct USB topology would also be important).

Um, that's not true. TI, for example, sells several audio DACs/ADCs  that out of the box do USB.
You don't have to write any drivers: "sound card" is a specified USB profile, and thus, if the chip doesn't do anything special, all OSes will just out of the box support your device as generic sound card.

are there pre-programmed microcontrollers that include all the necessary I/O and driver code for audio-to-computer interfacing?

Although you don't need that, as explained above, yes, hundreds of such microcontrollers exist. Basically, every sufficiently fast microcontroller that has a USB interface can do that; look for the standard ARM Cortex-M0 or -M4 cores that get sold by ST (STM32F…), NXP, SiLabs, cypress, basically every medium sized to large silicon manufacturer out there. You're looking for a microcontroller that has an integrated USB2 PHY, and something like an I2S port, or sufficient DAC and ADC itself.


text:
Q: Android: Unexplained log errors I am getting these errors in log cat every time I touch the screen while on my app. The app is responding normally, and I can't understand the errors. They are all pretty much the same, here is an example:
10-23 14:25:48.865: E/ViewRoot exit(22232): Dispatching touchevent to com.android.internal.policy.impl.PhoneWindow$DecorView@2ff9a688
Could anybody explain it?
Thanks in advance!

A: That means that you are touching some view of yours. When that happens the onTouchEvent() method is called.
My thought is that you are not overriding that method, therefore the system launches that error to the Log to inform you of that. There is nothing wrong with that, so if the view is behaving normally, I wouldn't be worried.
Here's some information on InputEvents

A: I do meet a lot of that errors in my project, I agree with the first answer. I did't override some method or some kinds of touchment in u view. mostly u don't need to worry about those runtime errors.


text:
Q: How to split specified network into subnets using Python I've been working on this question, but can't find a clearance.
I have a Python script which should get two arguments - network/CIDR & a number. The script should divide specified network to a number of parts, subnets, and show parameters of those subnets, like network address, broadcast, number of hosts.
Actually, my current code state is here, on GitHub.
The reason I'm asking is there are other topic on Stack Overflow, like this, this or this. But all of them have prefixes. And my point is, for example, ./subnet-divider.py 200.100.33.65/26 3, so I should divide it into 3 subnets. Or ./subnet-divider.py 200.100.33.65/26 9. So this is a different point, although slightly similar to discussed.
I crossed around both modules - ipaddress and netaddr. Both are similar. There are generators for subnetting, but they have arguments like prefix, required, and count, which is good.
In [22]: s.get_subnet(27, count=3)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-22-5864cbfc587d> in <module>()
----> 1 s.get_subnet(27, count=3)

/home/simple/Projects/subnet-divider/ip_splitter.py in get_subnet(self, prefix, count)
     14         """ . """

     15         for ip_network in self.get_available_ranges():
---> 16             subnets = list(ip_network.subnet(prefix, count=count))
     17             if not subnets:
     18                 continue

/usr/local/lib/python3.5/dist-packages/netaddr/ip/__init__.py in subnet(self, prefixlen, count, fmt)
   1269
   1270         if not 1 <= count <= max_subnets:
-> 1271             raise ValueError('count outside of current IP subnet boundary!')
   1272
   1273         base_subnet = self._module.int_to_str(self.first)

ValueError: count outside of current IP subnet boundary!

Of course, that' correct.
So, How can I divide? To do it flexible, I don't need a prefix, but the script should be able to divide incoming network onto specified subnets, 3, 7, 10, etc to the max.
Thanks.

A: I think I solved this case for myself. Just to divide.
This message helped. So, we have a pair & number to divide. We can calculate prefix length of subnets.
The code is in repo.


text:
Q: Transferring domain to Amazon Route 53. Being asked for NS server's IP addresses I'm trying to migrate an existing domain to Amazon Route 53.  I've followed the guide at:

http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/MigratingDNS.html

My current DNS host is web24.com.au.  There seem to be two areas where the NS records are stored.  I looked in the zone file and updated the NS entries to point to Amazon Route53.  Changing those seems to have made no difference (checked via whois).
I've noticed another section in the configuration portal specifically for nameserver, but in order to change them from the default, I'm being asked to enter both the FQDN of the new name servers and also its IP address.
Amazon have not said anything about the IP address of their name servers (the "Delegation Set"), and I suppose it's simple enough to ping them and get their IPs that way.  But I'm wondering if those name servers are clusters and it's not intended that I supply a single IP address for them.
Is it safe for me to just ping each of the servers in the Route 53 delegation set and use the IP addresses I see when I ping it when transferring the domain from Web24.com.au to Route 53?

A: I found the answer elsewhere on Amazon's documentation site:

Some registrars only allow you to specify name servers using IP addresses; they don't allow you to specify fully qualified domain names. If your registrar requires using IP addresses, you can get the IP addresses for your name servers using the dig utility (for Mac, Unix, or Linux) or the nslookup utility (for Windows).

...and using the dig utility, only a single IP address is returned in the answer section, so using that is okay according to docs.aws.amazon.com

A: You need to update the domain registrar settings for your DNS servers.  The zone file you updated also needs to be done, but queries won't use Amazons servers until your registrar is updated.  This updates the DNS root with a new place to resolve your domains; if that data was stored only in your zone file nobody would ever know where to get your zone data from in the first place.
Once you've changed your DNS values on the registrar it might take a day for everything to update.


text:
Q: Expected number of trials until success, with multiple variables per trial My software engineering team has a suite of tests we run on every checkin.  Some of these tests are flakey and fail some percentage of the time independently of the change we're making.  I want to quantify how much time this wastes for the devs.
Let $T_1, ..., T_n$ denote each test in the suite, and let $p_i$ denote the probability of success for the $i$'th test on a given run.  For each run of the suite, if  $T_i$ passes, that success is cached and the test will not be re-run. What is the expected number of suite runs until every test has passed?

A: Let $X_i$ be the number of test suite runs until the test $T_i$ is succesfully finished. $X_i$ follows a negative binomial distribution with parameter $1-p_i$, i.e. $P(X_i = k) = (1-p_i)^{k-1} p_i$. This yields $P(X_i \le k) = p_i \sum \limits_{i=0}^{k-1}(1-p_i)^i = 1 - (1-p_i)^k$.
Now you are interested in the time until all tests were succesful, i.e. $N = \max(X_1, \ldots, X_n)$. To calculate this expectation, note that $P(N \le k) = P( X_i \le k \text{ for all } i) = \prod \limits_{i= 1}^n (1-(1-p_i)^k)$.
Finally, as $N$ is a discrete random variable the formula $E[N] = \sum \limits_{i=0}^n P(N > i) = \sum \limits_{i=0}^n 1-P(N \le i)$ holds.
It is probably not possible to give a closed expression of this term, but you can calculate approximations numerically.

A: It would be possible to do this calculation for specific cases using a Markov chain involving the $2^n$ joint states, but it is probably difficult to set out a simple general formula, particularly if the $p_i$ vary.
For $n=1$ (geometric distribution), the answer is $\dfrac{1}{p_1}$
For $n=2$, the answer is $\dfrac{{{p_1}^{2}}+p_1 p_2+{{p_2}^{2}}-{{p_1}^{2}} p_2-p_1 {{p_2}^{2}}}{p_1 p_2 \left( p_1+p_2-p_1 p_2\right) }$,  which reduces to the $\frac{1}{p_1}$ result when $p_2=1$, and to $\frac{3-2 p_1}{ p_1\left( 2-p_1\right) }$ when $p_2=p_1$
It just gets messier for larger $n$


text:
Q: How to get reference to first nested table in javascript? How to get reference to the second table nested within first one (second table has no id nor class) :

A: You can find DOM elements with functions Document.getElementsByClassName() and Element.getElementsByTagName() which return array (or better array-like object) of elements:
var table = document.getElementsByClassName('top')[0]; // or other selector
var nestedTable = table.getElementsByTagName('table')[0];

A: with plain javascript you can use
document.querySelector('table table') which searches for the first table element in the document, takes the found table element and searches inside it for the next table element.
if you can use jQuery just call $('table table') or $('table').next('table') its like using querySelector but returns an jQuery Object

A: Try document.getElementsByClassName('top')[0].getElementsByTagName('table')[0]


text: Q: How to save a tensorflow seq2seq model use save_model api? Now I want to train a chatbot model with tensorflow seq2seq, and deploy the chatbot on server. I select tensorflow serving to do this work, but only saved_model(*.pb) format model can be loaded! So if anyone could ask me how to save chatbot with saved_model api?


text:
Q: Delta-epsilon proof as $x\to \infty$ Doing my Calculus homework came across a "problem" regarding the applicability of the solution.
Using the delta-epsilon definition I tried to prove these two limits. Here is my work:
$$
\lim_{x\to \infty} \frac{1}{x+2}=0\\
\\\forall\epsilon>0\hspace{2mm} \exists M>0\hspace{1mm}\text{such that} \hspace{1mm} x>M \implies|f(x) - L|<\epsilon$$
$$
|\frac{1}{x+2}-0|<\epsilon\\|\frac{1}{x+2}|<\epsilon\\\frac{1}{x+2}<\epsilon\\x+2>\frac{1}{\epsilon}\\x>\frac{1}{\epsilon}-2=M
$$
And the second one is:
$$
\lim_{x\to \infty} \frac{1}{x^3+2}=0\\|\frac{1}{x^3+2}-0|<\epsilon\\|\frac{1}{x^3+2}|<\epsilon\\\frac{1}{x^3+2}<\epsilon\\x^3+2>\frac{1}{\epsilon}\\x>\sqrt[3]{\frac{1}{e}-2}=M
$$
Now, both the solutions seem right, but what does not make sense to me is the thing that according to the definition for all $\epsilon>0$ there has to be $M>0$ and in both cases, there are values for $\epsilon$ when $M$ will be negative. This happens always when there is addition in the denominator. Is there a "special" way of solving this type of task?

A: When you learnt to solve equations in high school, you might have done something like this:
$$\begin{array}{rcl}
\sqrt{x+1} - x + 1 &=& 0 \\
\sqrt{x+1} &=& x-1 \\
x+1 &=& (x-1)^2 \\
x^2 - 3x &=& 0 \\
x &=& 0 \text{(rej.) or } 3
\end{array}$$
It is important to understand what the underlying logic here is.
When we write one equation following the other, we're actually saying that the current equation implies the next equation.
For example, $\sqrt{x+1} = x-1$ implies $x+1 = (x-1)^2$, because if two numbers are equal, then their squares are equal.
However, $x+1 = (x-1)^2$ does not imply $\sqrt{x+1} = x-1$! This is exactly why the solution $x=0$ is rejected: because $\sqrt{0+1} = 1 \ne -1$ even though $1^2 = (-1)^2$.

However, when you're solving this type of delta-epsilon questions, it is very important to notice that the logic is reversed, since you started at the right hand side of the implication $$x > M \implies |f(x) - L| < \varepsilon$$
In other words, instead of trying to find out what $|f(x) - L| < \varepsilon$ implies, you're actually trying to find out sufficient conditions for $|f(x) - L| < \varepsilon$ to be true.
This is significant in the step $\left|\frac1{x+2}\right| < \varepsilon \impliedby \frac1{x+2} < \varepsilon$, where the arrow is not reversible.
You might find out that a sufficient condition is $x > -1$, i.e. $x > -1$ implies $|f(x) - L| < \varepsilon$.
This poses no problem, as you can simply set $M = 1000$ in this case: if we know that $|f(x) - L| < \varepsilon$ for any $x > -1$, then surely $|f(x) - L| < \varepsilon$ still holds for any $x > 1000$.

A: There is nothing to "solve" here. You are supposed to prove that, for each $\varepsilon>0$, there is some $M>0$ such that$$x>M\implies\bigl|f(x)-L\bigr|<\varepsilon.\tag1$$If it turns out that, in some cases, you get a $M\leqslant0$ for which $(1)$ holds, then $(1)$ will still be true if, say $M=1$.

A: You're missing the fact that the $M$ which you've solved for is the minimum value such that $x>M \implies |f(x)-L|<\epsilon$.
For some choices of $\epsilon$, this minimum value might be negative, which simply means that any positive value of $x$ (and even some negative ones) would put $f(x)$ within $\epsilon$ of $L$.  You could even have that there is no such minimum value - for example, if you were looking at the limit of $f(x)=\exp(-x^2)$ and chose $\epsilon =2$, then you'd find that $|f(x)|<\epsilon$ for every value of $x$.
The key question is whether you will be able to find some $M$ which works no matter which $\epsilon$ you pick, and you have shown that to be the case in both of your examples.

A: Sure, set $M=\max\{1,\frac1\epsilon-2\}$. We have two cases:
Case 1: $M=1$. In this case, we have $M>0$ (as needed), and $M\geq\frac1\epsilon-2$. So,
\begin{align*}
\left|\frac{1}{x+2}\right|<\left|\frac1{M+2}\right|\leq\left|\frac1{\frac1\epsilon-2+2}\right|=\epsilon
\end{align*}
Case 2: $M=\frac1\epsilon-2$. In this case, $\frac1\epsilon-2>1$, so $M>0$, as needed. So,
\begin{align*}
\left|\frac{1}{x+2}\right|<\left|\frac1{M+2}\right|=\left|\frac1{\frac1\epsilon-2+2}\right|=\epsilon
\end{align*}


text:
Q: Microsoft Office Interop: Cannot apply indexing with [] to an expression of type 'object' Following code of my Microsoft Office WORD VSTO Add-in, was successfully getting the document title before. But now, it's throwing the error shown below:
string sTitle = oActiveDoc.BuiltInDocumentProperties["Title"].Value;

Error:

Cannot apply indexing with [] to an expression of type 'object'

Based on some similar online solutions (such as this and this) to the issue I tried the following code but I'm still getting the exact same error.
Question: What I may be missing here and how can it be resolved?
Ref: Document.BuiltInDocumentProperties gets a Microsoft.Office.Core.DocumentProperties collection that represents all the built-in document properties for the document.
Following also gives the exact same error:
string sTitle = oActiveDoc.BuiltInDocumentProperties["Title"].Value as string;

or
string sTitle = oActiveDoc.BuiltInDocumentProperties["Title"] as string;

A: There are several ways to bridge the gap with exceptions you've got so far:

*

*Use dynamic and object references. Read more about this approach on the Read BuiltInDocumentProperties/CustomDocumentProperties alway null with Word 2010? page.

*Use the late-binding technology represented in .net framework by the Type.InvokeMember method.

A: Try
string sTitle = oActiveDoc.BuiltInDocumentProperties.Item("Title").Value;

A: could you try that:
         string sTitle;
         dynamic properties = oActiveDoc.BuiltInDocumentProperties;
         var property = properties["Title"];
         if (property != null)
          {
              sTitle = property.Value.ToString();
          }