text:
Q: Default ErrorPage element after no routes matched location (wrong url) React-Router 6.2.1 Hi i'm learning react and have some poblem.
I wont to display error element when url doesn't match with none path.
I create ErrorPage element
but stil getting this warning "No routes matched location".
Here is my code i wrote:
import React, { Component } from "react";
import {
  BrowserRouter as Router,
  NavLink,
  Route,
  Routes,
} from "react-router-dom";
import "./App.css";

const Home = () =>
Home
;

const News = () =>
News
;

const Contact = () =>
Contact
;

const ErrorPage = () =>
Page not found
;

class App extends Component {
  state = {};
  render() {
    return (
      <Router>

                  <NavLink to="/">Home</NavLink>

                  <NavLink to="/news">News</NavLink>

                  <NavLink to="/contact">Contact</NavLink>

            <Routes>
              <Route path="/" element={<Home />} />
              <Route path="/news" element={<News />} />
              <Route path="/contact" element={<Contact />} />
              <Route element={<ErrorPage />} />
            </Routes>

      </Router>
    );
  }
}

export default App;

A: Replacing
<Route element={<ErrorPage />} />
with
<Route path="*" element={<ErrorPage />} />
would do the trick.


text:
Q: Twilio API For C++ ? Was curious if there was an implementation of the Twilio Phone Search API for C++, and if not is there a way of interfacing let's say python within C++ to get around it?

A: There is no SDK for c++ . You can view the list of available libraries on their website https://www.twilio.com/docs/libraries.
That said their API works over http and the sdk is just a wrapper for an http request , so you can just make the http requests directly with c++
You can view different REST calls here:
https://www.twilio.com/docs/api/rest/available-phone-numbers?code-sample=code-find-available-local-phone-numbers&code-language=curl&code-sdk-version=json

redpajama_set_name: RedPajamaStackExchange


text:
Q: sequence of absolutely continuous functions, uniform convergence Let $\{f_n\}$ be absolutely continuous functions on $[0,1]$, $f_n \geq 0$ $\forall n \in \mathbb{N}$.
Suppose that $\lim_{n \to \infty} \int^1_0 f_n dx = 0$.
Moreover, suppose that $\forall$ $\epsilon > 0$ $\exists$ $\delta > 0$ such that $\int_{E} |f_n'(x)|dx$ < $\epsilon$ $\forall n \in \mathbb{N}$,  if $m(E) &lt \delta$.
Prove that $f_n$ converges to $0$ uniformly on $[0,1]$.
Can someone help show this?
Thanking you in advance.

A: Suppose that $f_n$ does not converge uniformly to $0$. Then, there is an $\epsilon>0$ so that for all $N$ there is an $n>N$ and an $x_n$ so that
$$
f_n(x_n)>2\epsilon\tag{1}
$$
Find $\delta>0$ so that $|E|&lt\delta$ implies
$$
\int_E|f_n^\prime(x)|\,\mathrm{d}x&lt\epsilon\tag{2}
$$
Suppose that $n$ is such that $(1)$ is true. Let
$$
E_n=\left\{x\in[0,1]:|x-x_n|&lt\dfrac{\delta}{3}\right\}\tag{3}
$$
Note that $\dfrac\delta3\le|E_n|\le\dfrac{2\delta}{3}&lt\delta$ (since $x_n$ could be near the boundary of $[0,1]$).
Then $(2)$ says that for $x\in E_n$ we have
$$
|f_n(x)-f_n(x_n)|\le\int_{E_n}|f_n^\prime(t)|\,\mathrm{d}t&lt\epsilon\tag{4}
$$
The triangle inequality applied to $(1)$ and $(4)$ says that for $x\in E_n$, $f_n(x)>\epsilon$. Thus,
$$
\int_{E_n}f_n(x)\,\mathrm{d}x>\epsilon\frac{\delta}{3}\tag{5}
$$
Since there are arbitrarily large $n$ so that $(1)$ is true, $(5)$ contradicts the assumption that
$$
\lim_{n\to\infty}\int_0^1f_n(x)\,\mathrm{d}x=0\tag{6}
$$

A: Following Mike's comment, pass to a subsequence to get almost everywhere convergence to 0.  Thus there is a set $A$ of measure 1 with $f_n(x) \to 0$ for all $x \in A$.  In particular $A$ is dense.  Now the assumption about the $f'$ guarantees that the family $\{f_n\}$ is equicontinuous (since $|f(x)-f(y)| \le \int_x^y |f'(t)|\,dt$).  One can now follow the proof of the Arzela-Ascoli theorem to obtain the uniform convergence.


text:
Q: getDateTimeInstance(): Different Behavior for Different Languages I am doing date format using this function sap.ui.core.format.DateFormat.getDateTimeInstance({ pattern: "yyyy-MM-dd HH:mm" });
The date format is working fine in "DE" but it is returning wrong value in "EN".
In both language the time is 24 hour, what i need is that in english should shown am and pm.
if (oData) {
   let oDateFormat = DateFormat.getDateTimeInstance({ pattern: "yyyy-MM-dd HH:mm"});
   oData.forEach(item => {
                 item.startDataTime = oDateFormat.format(new Date(item.startDataTime));
})

A: According to http://unicode.org/reports/tr35/tr35-dates.html#table-date-field-symbol-table, HH matches "the 24-hour-cycle format" whereas hh matches "the 12-hour-cycle format." If the date time value should be formatted dynamically depending on the user locale, hardcoding the pattern won't work.
Instead, let the UI5 framework format the date time for you. Run this snippet to see the result:

globalThis.onUI5Init = () => sap.ui.require([
  "sap/ui/core/format/DateFormat",
  "sap/ui/core/Locale",
  "sap/ui/core/Configuration",
  "sap/m/VBox",
  "sap/m/ObjectStatus",
], (DateFormat, Locale, Configuration, VBox, ObjectStatus) => {
  "use strict";
  const currentUserLocale = Configuration.getLanguageTag();
  const control = new VBox({
    items: [
      new ObjectStatus({
        title: "Locale \"de-DE\"",
        text: DateFormat.getDateTimeInstance({ style: "medium/short" },/*force:*/new Locale("de-DE")) // Otherwise, UI5 automatically detects the locale for you according to https://sdk.openui5.org/topic/91f21f176f4d1014b6dd926db0e91070
          .format(new Date())
      }),
      new ObjectStatus({
        title: "Locale \"en-US\"",
        text: DateFormat.getDateTimeInstance({ style: "medium/short" },/*force:*/new Locale("en-US")) // Otherwise, UI5 automatically detects the locale for you according to https://sdk.openui5.org/topic/91f21f176f4d1014b6dd926db0e91070
          .format(new Date())
      }),
      new ObjectStatus({
        title: `Your locale ("${currentUserLocale}")`,
        text: DateFormat.getDateTimeInstance({ style: "medium/short" })
          .format(new Date())
      })
    ],
    renderType: "Bare",
  });

  control.addStyleClass("sapUiTinyMargin").placeAt("content");
});
<script id="sap-ui-bootstrap"
  src="https://sdk.openui5.org/resources/sap-ui-core.js"
  data-sap-ui-libs="sap.ui.core,sap.m,sap.ui.layout,sap.ui.unified"
  data-sap-ui-theme="sap_horizon_dark"
  data-sap-ui-async="true"
  data-sap-ui-oninit="onUI5Init"
  data-sap-ui-compatversion="edge"
  data-sap-ui-excludejquerycompat="true"
  data-sap-ui-xx-waitfortheme="init"
></script>
<body id="content" class="sapUiBody"></body>

Locale "de-DE": 16.11.2022, 17:26
Locale "en-US": Nov 16, 2022, 5:26 PM

The same can be achieved in property binding definitions within XML declaratively via type and formatOptions.


text:
Q: What are Ubuntu cloud images? What's the difference between Ubuntu's cloud images and Ubuntu's server images?

A: From the first link : "Ubuntu Cloud Images are pre-installed disk images that have been customized by Ubuntu engineering to run on cloud-platforms such as Amazon EC2, Openstack and LXC." So, that's what those are for.
The second link is for their normal distro. If you wanted to install Ubuntu on a physical (or virtual) machine that you are sitting in front of or otherwise have access to and good control of, you would download something from the second link and install it.

A: Ubuntu cloud images dispense installing to a (virtual) disk from the ISO
When you install a desktop ISO, it takes you through an interactive installation setup that sets things like partition sizes, username and language settings. You can see such a setup at: https://askubuntu.com/questions/884534/how-to-run-ubuntu-16-04-desktop-on-qemu/1046792#1046792
This is however too inconvenient for Cloud deployments, which require spinning up a large number of OSes, and things have to be automated. This is why the Cloud images exist.
In particular, as of 18.04 it ships a pre-installed qcow2 image that you can just boot out of the box without the installer. This image format can also be easily resized.
These images are also very useful for emulation if you just want to get Ubuntu up and running quickly, I have shown a QEMU setup at: https://askubuntu.com/questions/281763/is-there-any-prebuilt-qemu-ubuntu-image32bit-online/1081171#1081171

A: One difference between standard images and cloud images is that Ubuntu Cloud Images come with cloud-init

A: Not sure that the first answer is correct.
cloud-init is the Ubuntu package that handles early initialization of a cloud instance. It is installed in the official Ubuntu live server images since the release of 18.04, Ubuntu Cloud Images and also in the official Ubuntu images available on EC2.
https://help.ubuntu.com/community/CloudInit


text:
Q: .htaccess allow specific subfolder only I have folder structure
/Root
   /folder1
   /folder2
   /folder3
  ...
  /folder100
  ...
  /Share
    /subshare1
    /subshare2

What I like to do is allow directory/index browising for subshare 1 with
Options +Indexes
IndexOptions +FancyIndexing

but I don't want them to navigate to parent folder (share)
When I use .htaccess for
deny from all

I can still see /share folder but not sub directories?
I can't put deny from all in to /root because I don't want it impacting the folder1, folder2 etc...

A: You can set Options -Indexes in the parent folder, and that would deny index on them.

When Apache reads the .htaccess files, it goes by the path (from root inwards), and in order to get to the children one must have access right to all the parents on the way. So when you use deny from all on parent, you effectively deny access to the whole sub-tree...


text:
Q: Find the lowest value of every row of selected columns As the result of the query, I want to get all rows (Drivers), order by the drivers who got most series wins.
If a driver has won 4 tacks at least one or more times but failed to win the remaining track at least once, his series count is 0.
Driver Table
ID|Name| .........

1   A
2   B
3   C
4   D

Tracks Table
TID |FK|Track1_Wins|Track2_Wins| Track3_Wins|Track4_Wins|Track5_Wins|

1     1   5           6            3           2           4

2     2   2           4            0           5           3

3     3   6           3            9           4           7

4     4   5           8            2           4           1

My code sample
SELECT `Drivers`.`Name`, LEAST(`Track1_Wins`, `Track2_Wins`, `Track3_Wins`, `Track4_Wins`, `TRACK5_Wins`) AS Series
FROM `Drivers`, `Tracks`
ORDER BY Series DESC;

Accidently I got part expected output when I use WHERE with Driver ID
SELECT `Drivers`.`Name`, LEAST(`Track1_Wins`, `Track2_Wins`, `Track3_Wins`, `Track4_Wins`, `TRACK5_Wins`) AS Series FROM `Drivers`, `Tracks` WHERE `Drivers`.`ID` = 2 ORDER BY Series DESC;

It will give the expected result but with Same Driver Name as expected
B 3

B 2

B 1

B 0

My expected output is
Name | Series

C           3

A           2

D           1

B           0

A: Run this,
SELECT d.`Name`,
  LEAST(`Track1_Wins`, `Track2_Wins`, `Track3_Wins`, `Track4_Wins`, `TRACK5_Wins`) AS Series
FROM `Drivers` d  INNER JOIN `Tracks` t
ON t.`FK` = d.`ID`
ORDER BY Series DESC;

This returns the user name associated with the FK. Also, try to use kebab_case and lower case for all your column and table name. Makes it much easier to run the code


text:
Q: Is it possible to write an htpasswd file that redirects certain users to certain directories? Assuming that I have a domain, say, mydomain.com and three directories under it call them dir1, dir2 and dir3, then is it possible to put an htpasswd file at the web root and have it redirect authenticated users to their respective directories (e.g. user joecorleone101 always get redirected to dir3 upon being authenticated.)?
First of all I want to know if this is possible and second is it safe or practical (or impractical)? Am I thinking about it the wrong way? Should I maybe use an htaccess file?

A: Apache mod_rewrite is your friend, it can use HTTP headers.
RewriteEngine On
RewriteCond %{REMOTE_USER} ^joecorleone101$
RewriteRule .* dir3/ [R,L]

*

*If HTTP REMOTE_USER equals joecorleone101 use the rewrite rule

*Match against everything (.*)

*Rewrite url to dir3

*[R] is redirect

*[L] stop rewriting

You can also use the REMOTE_USER in the substition part:
RewriteCond %{REMOTE_USER} ^.*$
RewriteRule .* %{REMOTE_USER}/ [R,L]

*

*If REMOTE_USER is filled (^.*$) use the rewrite rule

*Match against everything (.*)

*Rewrite url to the value in REMOTE_USER

*[R] is redirect

*[L] stop rewriting

This also works from .htaccess but has some behavior differences, the directory is removed in the pattern matching and added in the substitution part.
To use the value matched in the RewriteCond you can use the %N (1 <= N <= 9).
RewriteCond %{REMOTE_USER} (\d{3})$
RewriteRule .* http://www.example.com/%1 [R,L]

*

*Match against users who's name end with 3 digits (\d{3})$

*Match against any given url (.*)

*Rewrite it to http://www.example.com/123 (if user ends with 123)

*Redirect and stop rewriting [R,L]


text:
Q: Accidentally did sudo chmod -R 777 /usr/ on Ubuntu Server AWS I am using AWS to run Ubuntu server 14.04 and by mistake I issued this command
sudo chmod -R 777 /usr/

Since issuing this command, I can't switch from ubuntu to root. When I issue this command
sudo su

It shows me error
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

I don't have a backup of my server.


text:
Q: Line Breaks - Gmail Apps Script I have made some code to automate my email from a spreadsheet and want to expand it across my team but I would like to add a footer/signature to it and also not have to include the recipient and subject in the code itself but rather pull it from the spreadsheet. I have it laid out in the spreadsheet as;

I would like the email footer to look like that but when I run the script it brings back "Range"
function EODReportEmail() {

  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("EOD Email Tasks");;        // Use data from the active sheet
  var startRow = 2;                                                                            // First row of data to process
  var numRows = sheet.getLastRow();                                                            // Number of rows to process
  var lastColumn = sheet.getLastColumn();                                                      // Last column
  var dataRange = sheet.getRange(startRow, 1, numRows, lastColumn)                             // Fetch the data range of the active sheet
  var data = dataRange.getValues();                                                            // Fetch values for each row in the range

  var recipient = "shea.a.murphy@icloud.com"                                                                              // Email address report will be sent to
  var subject = "Shea Murphy - EOD Email"                                                                              // Subject heading of email e.g. Shea Murphy - EOD Email
  var footer = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("EOD Email Information").getRange("C2");
  Logger.log(footer);

  // Work through each row in the spreadsheet
  for (var i = 0; i < data.length; ++i) {
    var row = data[i];

 // Assign each column a variable
    var Point1 = row[0];              // Col A: 1st point to be included in email
    var Point2 = row[1];              // Col B: 2nd point to be included in email
    var Point3 = row[2];              // Col C: 3rd point to be included in email
    var Point4 = row[3];              // Col D: 4th point to be included in email
    var Point5 = row[4];              // Col E: 5th point to be included in email

    var Num1 = "1. "           // Number variables for email points
    var Num2 = "2. "
    var Num3 = "3. "
    var Num4 = "4. "
    var Num5 = "5. "

    var Task1 = Num1 + Point1         // Note 1 to be inlcuded in the email
    var Task2 = Num2 + Point2         // Note 2 to be inlcuded in the email
    var Task3 = Num3 + Point3         // Note 3 to be inlcuded in the email
    var Task4 = Num4 + Point4         // Note 4 to be inlcuded in the email
    var Task5 = Num5 + Point5         // Note 5 to be inlcuded in the email

    if (Point1 == undefined) {Task1 = " "};
    if (Point2 == undefined) {Task2 = " "};
    if (Point3 == undefined) {Task3 = " "};
    if (Point4 == undefined) {Task4 = " "};
    if (Point5 == undefined) {Task5 = " "};

  // Build the email message
      var emailBody =  'EOD Report';
          emailBody += '
Please see what I have worked on today below:
';
          emailBody += '

'+ Task1 +'
';
          emailBody += '

'+ Task2 +'
';
          emailBody += '

'+ Task3 +'
';
          emailBody += '

'+ Task4 +'
';
          emailBody += '

'+ Task5 +'
';

          emailBody += '
Let me know if you have any questions.
';
          emailBody += footer

    // Create the email draft
      GmailApp.sendEmail(
        recipient,          // Recipients
        subject,            // Subject
        ' ',                // Body
        {
        htmlBody: emailBody,    // Options: Body (HTML)

        }
      )

  }
}

Basically, is there any way of bringing the code across the two pages for the recipient, subject and include the signature at the end with all correct formatting rather than writing it out line by line in the code itself?
EOD Email Information

EOD Email Tasks

Email Itself

A: I believe your goal as follows.

*

*You want to convert the rich text put in the cell "C2" to the HTML data using Google Apps Script.

For this, how about this answer?
Modification points:

*

*About when I run the script it brings back "Range", the reason of this issue is due to the script of var footer = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("EOD Email Information").getRange("C2");.

*

*In this case, the range object is retrieved. By this, Range is put to the footer of the email.

*In order to use the rich text retrieved from the cell as the footer of the HTML body of the email, it is required to convert from the rich text to HTML.

When I saw the image of your question, I could confirm that your rich text put to the cell "C2" uses "Bold", "Italic", "ForegroundColor" and the hyperlink. Using this, I would like to propose the following modified script.
When your script is modified, please modify as follows.
Modified script:

From:

var footer = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("EOD Email Information").getRange("C2");

To:

var range = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("EOD Email Information").getRange("C2");
var footer = range.getRichTextValue().getRuns().reduce((s, r) => {
  let text = r.getText().replace(/\n/g, "
").replace(/ /g, " ");
  if (r.getLinkUrl()) text = `<a href="${r.getLinkUrl()}">${text}<\/a>`;
  const style = r.getTextStyle();
  const obj = {
    fontFamily: style.getFontFamily(),
    fontSize: style.getFontSize(),
    foregroundColor: style.getForegroundColor(),
    bold: style.isBold(),
    italic: style.isItalic(),
    strikethrough: style.isStrikethrough(),
    underline: style.isUnderline(),
  };
  const fontFamily = obj.fontFamily ? `font-family: '${obj.fontFamily}';` : "";
  const fontSize = obj.fontSize ? `font-size: ${obj.fontSize * 1.333}px;` : "";
  const foregroundColor = obj.foregroundColor ? `color: ${obj.foregroundColor};` : "";
  const bold = obj.bold ? 'font-weight: bold;' : "";
  const italic = obj.italic ? 'font-style: italic;' : "";
  const strikethrough = obj.strikethrough ? 'text-decoration: line-through;' : "";
  const underline = obj.underline ? 'text-decoration: underline;' : "";
  const keys = [fontFamily, fontSize, foregroundColor, bold, italic, strikethrough, underline];
  if (keys.some(e => e != "")) {
    s += `${keys.reduce((str, e) => str += e, '<span style="')}">${text}</span>`;
  } else {
    s += text;
  }
  return s;
}, "");

Result:
When the value of your image is used for this modified script, the following HTML is retrieved. (The email address was changed to a sample value.)

Kind regards
  --
Shea Murphy
Mobile: 074xxxxxx93
Email: sample@email.com

For further information - please contact

References:

*

*getRichTextValue()

*getRuns()

*getTextStyle()


text:
Q: Change Website from Plain HTML to Wordpress I have a static html website that I need to convert to Wordpress. I was able to successfully load wordpress on my hosting and configured a theme. However, the front end still displays the original html page. I need the whole website to be converted to wordpress, but I can't figure out where to add the htaccess and index.php files as I read from a blog. Someone help out.
Thanks
Sam

A: 1) you're kind of asking for the whole of how the internet operates. I'm not saying that to be confrontational, just know that you'll likely be downvoted for such an impossible question.
2) more to the point, your server is looking for a directory index. In general, most servers look for index.html, index.htm, index.php, and then others, but in that order. If it encounters index.html in your directory then it stops and says that is the file to load.
3) you can get around this by changing the name of your file.
"index.html" -> "index_OLD.html" (or any name not index.html)

4) you can also change the way your server processes the index order using the DirectoryIndex directive in your HTAccess file. Ask your hosting provider about how to do this and if it's supported (although, I don't recommend you do this, it's just an available option).
5) your wordpress install should be in the root directory. That is to say, your .htaccess and index.php files should live in the same directory that your current index.html file lives in. Once the html file has a different name, the server will locate the php file and use it to server up as the directory index.
6) good luck friend!


text:
Q: Loop through array of input objects Lets say I have these HTML objects:
<button id="addMore" class="button">+</button>

    <input type="text" name="gsm[]" placeholder="GSM" required>
    <input type="text" name="gsm[]" placeholder="GSM" required>
    <input type="text" name="gsm[]" placeholder="GSM" required>

Now I want to loop through each one of them in JavaScript. Each of the input text has different values. This is what I have tried (the current code is a small snippet of a bigger code):
$('input[name^="gsm"]').each(function(i,obj) {
        var eachGsm = $(this).val();

        "This line has " + eachGsm[i] + ", as the value." + "%0D%0A" +
    });

When running this, the script gives me: [object Object]. What is the correct approach?

A: You're already iterating over the list of elements, therefore this is already your desired value.
<button id="addMore" class="button">+</button>

    <input type="text" name="gsm[]" placeholder="GSM" value='1' required>
    <input type="text" name="gsm[]" placeholder="GSM"  value='2' required>
    <input type="text" name="gsm[]" placeholder="GSM" value='3' required>

$('document').ready(()=>{
  $('input[name^="gsm"]').each(function(i,obj) {
        var eachGsm = $(this).val();
         console.log("each: " + eachGsm);
    });
})

A: In this case, you can simply do
$('input[name^="gsm"]').each(function(i) {
    console.log("This line has " + this.value + ", as the value." + "%0D%0A")
});

In the context of this function, this is the object referring to the HTML input element, and this.value is the text content entered by the user.
A runnable example:
https://jsfiddle.net/23ao7mup/1/


text:
Q: Web-scraping has weird format of date, need to convert. "Error in charToDate(x) : character string is not in a standard unambiguous format" I'm trying to scrape this website by day. https://www.basketball-reference.com/boxscores/?month=9&day=30&year=2020
As you can see, the date is not in the right format and I can't figure out how to get R to recognize it as a date.
Here is my code so far:
url <- "https://www.basketball-reference.com/boxscores/"

timevalues <- seq(as.Date("month=10&day=2&year=2020"), as.Date("month=10&day=2&year=2020"), by = "day")
head(timevalues)

Error in charToDate(x) : character string is not in a standard unambiguous format

A: You can't generate sequences (or dates) like this. Here's a solution using the lubridate package
library(lubridate)

url <- "https://www.basketball-reference.com/boxscores/"

my_dates <- seq(as.Date("2020-09-25"), as.Date("2020-10-05"), by = "day")

urls <- paste0(url,
               "?month=", month(my_dates),
               "&day=", day(my_dates),
               "&year=", year(my_dates))

urls
#>  [1] "https://www.basketball-reference.com/boxscores/?month=9&day=25&year=2020"
#>  [2] "https://www.basketball-reference.com/boxscores/?month=9&day=26&year=2020"
#>  [3] "https://www.basketball-reference.com/boxscores/?month=9&day=27&year=2020"
#>  [4] "https://www.basketball-reference.com/boxscores/?month=9&day=28&year=2020"
#>  [5] "https://www.basketball-reference.com/boxscores/?month=9&day=29&year=2020"
#>  [6] "https://www.basketball-reference.com/boxscores/?month=9&day=30&year=2020"
#>  [7] "https://www.basketball-reference.com/boxscores/?month=10&day=1&year=2020"
#>  [8] "https://www.basketball-reference.com/boxscores/?month=10&day=2&year=2020"
#>  [9] "https://www.basketball-reference.com/boxscores/?month=10&day=3&year=2020"
#> [10] "https://www.basketball-reference.com/boxscores/?month=10&day=4&year=2020"
#> [11] "https://www.basketball-reference.com/boxscores/?month=10&day=5&year=2020"

A: We can use glue to create
library(lubridate)
url <- "https://www.basketball-reference.com/boxscores/"
my_dates <- seq(as.Date("2020-09-25"), as.Date("2020-10-05"), by = "day")
urls <- glue::glue("{url}?month={month(my_dates)}&day={day(my_dates)}",
               "&year={year(my_dates)}")

-output
#https://www.basketball-reference.com/boxscores/?month=9&day=25&year=2020
#https://www.basketball-reference.com/boxscores/?month=9&day=26&year=2020
#https://www.basketball-reference.com/boxscores/?month=9&day=27&year=2020
#https://www.basketball-reference.com/boxscores/?month=9&day=28&year=2020
#https://www.basketball-reference.com/boxscores/?month=9&day=29&year=2020
#https://www.basketball-reference.com/boxscores/?month=9&day=30&year=2020
#https://www.basketball-reference.com/boxscores/?month=10&day=1&year=2020
#https://www.basketball-reference.com/boxscores/?month=10&day=2&year=2020
#https://www.basketball-reference.com/boxscores/?month=10&day=3&year=2020
#https://www.basketball-reference.com/boxscores/?month=10&day=4&year=2020
#https://www.basketball-reference.com/boxscores/?month=10&day=5&year=2020


text:
Q: Favicon won't load Refused to load the image 'http://localhost:8000/favicon.ico' because it violates the following Content Security Policy directive: "default-src 'none'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.

A: I am not sure if this is the issue, but I had a similar issue about a year ago because the FAVICON was not the right dimensions. They are usually 15X15, 20X20, and 30X30. I hope that helps.


text:
Q: reverse database won't work from terminal (PROPEL / BAKE CAKEPHP) I've been trying to generate model classes from a local database using both propel and bake for cakephp , it seems that i have the same problem :
When I try to acces the database through bake or propel it gives me an error that it can't open the connection:
So I tried this :
I try to acces the database from the application using pdo it works just fine!!!
When I tried to acces database through terminal it's also working !!!
I really don't know what's the problem here !

A: You most likely have a separate php.ini config file for CLI and pdo_mysql is not loaded for CLI.


text:
Q: Information flow in Linux - how to tell who is currently active and typing? I'm currently playing a mafia/werewolves game with my cyber-security class.
The basic idea is:

*

*on one machine, the moderator starts a server program

*all the players ssh into the machine and launch a client program

*the server / clients communicate through named pipes (not accessible with stat)

*during the bad guy (mafia/werewolf) phase, they vote on someone to kill (communicating through server to other bad guys)

*during the good guy phase, the townspeople guess / infer who is a bad guy and vote to kill them

*last group still alive wins

I wrote a bash script to tell me when each user is typing (by watching for nr_voluntary_switch in /proc/####/sched). I run this during the bad guy phase to check who is voting.
This worked until the server started assigning people random names instead of their username. Now the server just notifies us that "'rabid marshmallow' voted" instead of the user's name.
Any ideas on how to tell who people actually are now?

A: Since this is over SSH, you might consider snagging users' unique IP addresses and building your assumptions based on that. Assuming the client devices connecting to the moderator's server are obtaining statically assigned addresses, this would make it easy to assign an individual to an IP address, especially if you can see whom is at what machine.


text:
Q: Which C datatype can represent a 40-bit binary number? I need to represent a 40-bit binary number. Which C datatype should be used to handle this?

A: long long is an integer type with at least 64 bits. It will fit signed 40 bit values on all platforms. You can also use unsigned long long for unsigned values of 64 bits or more.

A: You can use long long, which can contain 64 bits or more.  For more information, see
http://en.cppreference.com/w/cpp/language/types
http://en.wikipedia.org/wiki/Integer_(computer_science)#Common_long_integer_sizes
Define the 64 bit width integer in Linux

A: If you're using a C99 or C11 compliant compiler, then use int_least64_t for maximum compatibility. Or, if you want an unsigned type, uint_least64_t. These are both defined in <stdint.h>
<stdint.h> usually also defines int64_t, but since it's not required by the standard, it may not be defined in every implementation. However:

*

*int_least64_t - at least 64 bits, and

*int_fast64_t  -  the fastest size in this implementation of at least 64 bits

are both required to be present in C99 and C11 (See § 7.18.1.2-3 in the C99 standard, and § 7.20.1.2-3 in the C11 standard).

Although C99 specifies that long long is at least 64 bits on a particular machine (§ 5.2.4.2.1), the types in <stdint.h> are designed to be explicitly portable.
You can read more about integer sizes on different platforms here.
Note that the size of integer types are a problem with the long data type - on 64 bit Windows, it's currently 32 bits, whereas on 64 bit linux it's 64 bits. For this reason, I believe you're  safest using the types from <stdint.h>
It's worth noting that some feel that long long is more readable. Personally, I prefer the types from <stdint.h>, because they allow you to say what you mean when you use them - which I find more readable. Of course, readability is often a matter of taste - and if you're working with an existing codebase, I'd just follow whatever they do :)

If your compiler only supports C89, then R..'s solution will allow you up to 53 bits of integer precision.

A: The existing answers are good, but if you want C89 support too, double will be able to store 40-bit integers exactly on all IEEE 754 conformant implementations.


text:
Q: Angular compile new dom with directive I have an angular app in which there is a process I add new DOM elements.
For example:
$("#thingsAppendedHere").append('

            <directive something="someObject" />

');

which will produce:

        <directive something="someObject" />

and my directive:
someApp.directive('directive', function() {
        return {
            restrict: 'E',
            templateUrl: 'directive.html',
            controller: DirectiveController,
            scope: {
                something: '='
            }
        }

and compilation is:
var scope = angular.element('#thingsAppendedHere').scope();
var element = angular.element('#imNewlyAppended');

$injector.invoke(function($compile) {
     $compile(element)(scope);
});

The problem is that after the manual compile the directive doesnt have $scope.something.
it seems it's scope is the #thingsAppendHere div.
I assume this is because i forced the scope while doing the compile.
What can I do to make it work? How can I tell the directive to creates its own isolated scope and to bind the '$scope.something' to outer scope '$scope.someObject'
Kind regards.


text:
Q: Which method is better for liquid crystal overdriving? Recently, I started to design a LC (Liquid Crystal) shutter glass. The question is which component should I use. This is the LC shutter I might use: PolarSpeed®-S
However, there are a few more shutters to test so this shutter is not the only option. Anyway, we need fast switching response (below 100us) and to do that overdriving is essential.
Coming back to the question, this is the usual way to implement overdrive:

you see, applying higher voltage for enough time of period then returning to nominal voltage level makes LC switching faster.
And this is the overdriving method of PolarSpeed®-S:

PolarSpeed®-S uses two cells and this way it achieves below 50 uS rise and fall time.
So I was thinking there must be several ways to apply those voltage levels to LC cells.
1- An analog switch + Linear regulator(3 outputs)

simulate this circuit – Schematic created using CircuitLab
I couldn't find a deMUX in schematic so think those switches as 1:3 deMUX, everything is digital.
the other options are similar also:
2- Several Linear Transistor Driver
3- Several Voltage references + Swicthes
Or, can I:
4- Just use a few Op-Amps + resistors + switch

simulate this circuit
4- is the easiest and most flexible one because I already have 28V supply and all I will need are 3 Op-Amps, a voltage conterter to < -15V and switch. Also, this might be a good fit because I am allowed to change the gain of the opAmps so I can change the applied voltage to cells via changing resistors that way I can use the same pcb to test several shutters.
But I can not think of anything about pros and cons of those 4 options. So would you help me through this? What is the finest way for LCD overdriving? There may be other options I missed so if you know other options please share. Thanks per advance.
edit: a new idea by ChrisR is added below:

simulate this circuit
in the schematic GD(Gate driver) supplies are different in tme mean of overdrive purpose. GD1 supply is 14V - 0V, GD2 supply is 8V - 0V and GD3 is 14V - 8V. And just to simplify, diodes forward voltages are 1 V. So if I use this configuration, output will be like:

this I think, but I am not sure. Is this configuration safe to use?
edit(2): I decided to go with gate driver IX4428N and boost reg MIC2288YD5-TR.

simulate this circuit

A: ad 1: it is completely wrong, you do always get the +5V if any of the switches is activated.
My proposal: if the intervals can be determined as an even number of base time, for example: t1 equals to (t4-t3) and (t2-t1), (t3-t2), (t5-t4), (t6-t5) are N * t1, then you could use a synchrnous counter made of flip-flops and use those analog swithes to switch +Vd, -Vd.

A: Try any Mosfet driver e.g. TC4420/29 from Microchip.
They switch in 25nS, will work at 4.5 to 20 or so volts, are small, cheap and designed for high speed switching of capacitive loads such as this shutter.
Some e.g. TC4427 are available in dual package with complimentary outputs in cases where you want a 10V swing over floating inputs (e.g. a bare LCD panel).
The specs, circuits and graphs all call for what is a digital drive. An analog solution such as an opamp will have difficulty generating the fast rise times (slew rates) you desire as they are not designed for fast switching.
For belt and braces, you can add a dual mosfet to the driver, but for he load you have, there is no need for extra circuitry, though these chips are at their limit near the 24 volt levels.
In order to achieve intermediate voltages, simply put a small capacitor across the output and feed the switch with a PWM. To boost current, add a dual FET to the output, or go to a 'high and low side' driver such as IRL2110.
The purpose of the 24 volt drive, from what I can see is to discharge the energy stored in the LC quickly, this can be done by reversing the 'sense' of the two outputs of a bridge configuration per the SE post below. You will not need the diodes referred to since your load appears to be capacitive.
To reverse sense, you would toggle the outputs i.e. whichever pin was high, would go low, and the pin that was lo would go high.
The beauty of the bridge configuration is that the load device sees an effective double supply voltage at the instant it is toggled. You could probably drive the entire device from a 12 volt source a the same speed as a 24 volt source without the danger of damaging it,since the effective 24V differntial is soon dissipated to the 12 volt capability of the supply.
To bring back to 12V, you would leave one driver driven low, and the other driven at 50%.  6V would be 25% etc. Measuring the voltage with an ADC would provide accurate control.
Please speak to the vendor / OEM for the shutter - I am sure they can advise on these SE solutions, or perhaps a better way.

simulate this circuit – Schematic created using CircuitLab
When Clk1 == Clk2 there are zero volts across shutter1
When CLK1 != Clk2 There are 12 volts across shutter1
at the instant you change Clk1 and Clk2 simultaneously, Shutter1 sees an effective -24V dropping to -12V (i.e. 12 volts in the opposite sense to what it was). This is effectively what happens in the graph on on page 7.
By changing both clocks simultaneously, then toggling one back to what it was, you can drop the shutter from 12V to 0V almost as fast as if you applied 24V per the manual. The speed of TC4420 is >> shutter speed (25nS vs 100us section 9 pg 7)
The low impedance of TC4420 is about 7ohms, if this is too large to switch the shutter fast enough, then add a dual low Rds Mosfet (e.g. SSD2025TF)to the output per the spec sheet for the TC4420.
I posted the question which you may find relevant


text:
Q: Finding the distance between two points on a circle The question I am posing is coming from a programming issue I am having but the concept is strictly math related. I am working on a hue circle that is fully 360 deg. I have two points: 1). blue @ 11deg, 2.) orange @ 216deg. What I am trying to do is basically changing the hues of a pixel based on proximity of the pixels hue. For example: pixel x.hue = 135deg. Since the hue is closer 216, I would change the hue to 216. My only issue is the case of a "wrap around". For example, if I had a hue point 345deg, I would color the pixel blue, however from a mathematical standpoint, how would I take care of finding the distance for any hue point on a circle between 11deg and 216deg since I cannot use the arc length formula due to not having a radius.
Visual Representation enter image description here

A: Your question is slightly difficult to understand but it seems like you want the shorter of the two differences between two angles considering wraparounds.
If the absolute difference between two angles is greater than $180^\circ$ then you subtract from $360^\circ$ the absolute difference. For example $x=30^\circ$, $y=300^\circ$ has a distance of $270^\circ$ going the "right way" around the circle, but a distance of $90^\circ$ going the "wrong way", which is $360-|300-30|=90^\circ$. In computer code terms the absolute value is given by something like math.Abs(), so you want 360-math.Abs(y-x).
In full this would be something like
    diff := math.Abs(a-b)
    if diff > 180 {
         diff = 360 - diff
    }


text:
Q: Yii2: Pretty URL Rule to allow garbage data in URL I am using URL Rewriting rules and URL manager on my project. This is the code of my URLManager rules:
        'rules' => [
            '/'=>'site/index',
            '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
            '<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>',
            '<module:\w+>/<controller:\w+>/<action:\w+>/<type:(admin|driver|user)>' => '<module>/<controller>/<action>',
            '<module:\w+>/<controller:\w+>/<action:\w+>/<type:(admin|driver|user)>/<id:\d+>' => '<module>/<controller>/<action>',
            '<module:\w+>/<controller:\w+>/<action:\w+>/<type:(admin|driver|user)>/<_:\w+>' => '<module>/<controller>/<action>',
        ],

The problem is that DataTables is sending data with an extra parameter in the URL ?_=1474714889055 which is messing everything. I added the last line of code to allow this param or any other garbage data that Datatable adds.
How to remove this code or allow it to be in the URL without affecting the routing?
Regards
EDIT:
public function actionVerified()
{
    Yii::$app->response->format = Response::FORMAT_JSON;
    $expression = new \yii\db\Expression('CONCAT(`driver_details`.`first_name`, " ", `driver_details`.`last_name`) as `driver_name`');
    $bookings = \app\models\Bookings::find()
    ->select(["bookings.*",
        "TIME_FORMAT(booking_start, '%h:%i %p') as booking_start",
        "TIME_FORMAT(booking_end, '%h:%i %p') as booking_end",
        "users_main.name as verified_by_name",
        "user_details.name as booked_by",
        "user_details.contact as contact",
        new \yii\db\Expression("CONCAT('STARWAY-BKNG-',bookings.id) as id_show"),
        $expression
    ])->joinWith('userDetail')
    ->joinWith('driverDetail')
    ->joinWith('usersMain')
    ->where(['verified'=>1, 'canceled'=> 0, 'completed'=>0])->asArray()->all();
    foreach ($bookings as $key => $booking) {
        unset($booking['userDetail']);
        unset($booking['driverDetail']);
        unset($booking['usersMain']);
        $booking_send[] = $booking;
    }
    if(!isset($booking_send)){
        $booking_send = [];
    }
    return $booking_send;
}

A: I think i know why you are getting 404 error. It's  the last '/' part, just before '?_=1474714889055', which is causing 404.
According to Yii2 following these two URLs are different:
// these two are not same
http://domain.com/controller/action
http://domain.com/controller/action/

And you will find several discussions on Yii Github Issues page if you just search with trailing slash.
I don't know where that last / was coming from so i checked DataTables Documentation but didn't find any last '/' on their example code or ajax url:
// their ajax code
$(document).ready(function() {
    $('#example').DataTable( {
        "ajax": '../ajax/data/arrays.txt'
    } );
} );

// ajax url being called in their example page
https://datatables.net/examples/ajax/data/arrays.txt?_=1474729703286

So I'm guessing you might have a type somewhere on your source code which is adding that last /. Fixing that should solve your issue.
If however this wasn't the case, you can try to use following rules in your config:
'rules' => [
    '/'=>'site/index',
    '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
    '<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>',
    '<module:\w+>/<controller:\w+>/<action:\w+>/<type:(admin|driver|user)>' => '<module>/<controller>/<action>',
    '<module:\w+>/<controller:\w+>/<action:\w+>/<type:(admin\/|driver\/|user\/)>' => '<module>/<controller>/<action>', // allow the trailing slash
    '<module:\w+>/<controller:\w+>/<action:\w+>/<type:(admin|driver|user)>/<id:\d+>' => '<module>/<controller>/<action>',
],

Although your current solution worked, but I am not recommending
'<module:\w+>/<controller:\w+>/<action:\w+>/<type:(admin|driver|user)>/<_:\*?>' => '<module>/<controller>/<action>'

this rule because it's incorrect. <_:\*?>part means the following URLs are also allowed:
// .......................................^ these are definitely not valid.
YOUR_DOMAIN/module/controller/action/type/*
YOUR_DOMAIN/module/controller/action/type/?
YOUR_DOMAIN/module/controller/action/type/*?
YOUR_DOMAIN/module/controller/action/type/?*

I hope you got my point.
And lastly, i am just using standard wordpress like .htaccess file. Here it is  just in case:
# BEGIN WordPress
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
# END WordPress


text:
Q: how to extecute multiple select queries with different returning data in postgresql? I'm using postgreql and i have two tables and i want to execute two select queries on them. the data that returning from each select are varying!
the data that returns from first table is:
id integer, first_name varchar, last_name varchar, email varchar, company varchar,positions varchar,address varchar,phone varchar

and the second table return:
group_contact_id integer, contact_id integer, group_id integer

i want to do it in a function like this:
create function findcontactbyid(id integer) returns table (id integer, first_name varchar, last_name varchar, email varchar, company varchar,positions varchar,address varchar,phone varchar, group_contact_id integer, contact_id integer, group_id integer) as $$
select * from cms_contact where id = $1
UNION ALL
select * from cms_groups_contacts where contact_id = $1
$$ language 'sql'

but i get errors
$1 mentions to (id integer) and it exists in both tables

A: I rather wonder about your function! What do you really need here.
Comeback to the issues:
I think it will raise an error because PostgreSQL have an ambiguous between id (INPUT), id (RETURN) and id of tables in query. So, if you can, you can named it different to each other and then check it again.
The second think, I have some worry about the UNION QUERY. In my knowledge, when you want to UNION 2 query to each other, the result of both query must be the same column and the same type of column.
So, I think after you fix the first issue, the function is also can not run. But you can try first.


text:
Q: Run node_module package command in js file In the package.json file, I have a line in the scripts object like this:
"scripts": {
     // some commands..
     "runpackage": "someNpmPackage -args"
}

This someNpmPackage is a package I have in my node_modules, but not in the command line. (i.e. I can run the command in the terminal).
This works fine. However, I want to be able to do in the scripts: "runPackage": "node scripts/runPackage.js"
I try something like
var exec = require('child_process').exec;
exec('someNpmPackage -args', function (err) {
    if (err) {
      console.log(err.message);
      process.exit();
    }
    console.log('success');
});

But all I get is, /bin/sh: someNpmPackage: command not found.
How can I make the exec function know about this package?

A: Why don't you install the someNpmPackage globally in your system?

A: Try in the root project folder, on the command line: ./node_module/.bin/someNpmPackage. If this command works, then it should work with exec.


text:
Q: Saving decision tree's output into a text file I'm looking for a method to save decision tree's output in R. Here is a simple decision tree code in R:
library(rpart)
data(kyphosis)
fit <- rpart(Kyphosis ~ Age + Number + Start, data = kyphosis)

and here is the value of fit:
1) root 81 17 absent (0.79012346 0.20987654)
   2) Start>=8.5 62  6 absent (0.90322581 0.09677419)
     4) Start>=14.5 29  0 absent (1.00000000 0.00000000) *
     5) Start< 14.5 33  6 absent (0.81818182 0.18181818)
      10) Age< 55 12  0 absent (1.00000000 0.00000000) *
      11) Age>=55 21  6 absent (0.71428571 0.28571429)
        22) Age>=111 14  2 absent (0.85714286 0.14285714) *
        23) Age< 111 7  3 present (0.42857143 0.57142857) *
   3) Start< 8.5 19  8 present (0.42105263 0.57894737) *

I tried save, dump and dput but they do not work and change tree's format. Is there any method to save the tree into a text file keeping its? sink does not work for me.

A: I used sink and it worked for me.
sink("clipboard")  # works in Windows, substitute "clipboard" for file name
print(fit)
sink()

Pasting from clipboard, I get
n= 81

node), split, n, loss, yval, (yprob)
      * denotes terminal node

 1) root 81 17 absent (0.79012346 0.20987654)
   2) Start>=8.5 62  6 absent (0.90322581 0.09677419)
     4) Start>=14.5 29  0 absent (1.00000000 0.00000000) *
     5) Start< 14.5 33  6 absent (0.81818182 0.18181818)
      10) Age< 55 12  0 absent (1.00000000 0.00000000) *
      11) Age>=55 21  6 absent (0.71428571 0.28571429)
        22) Age>=111 14  2 absent (0.85714286 0.14285714) *
        23) Age< 111 7  3 present (0.42857143 0.57142857) *
   3) Start< 8.5 19  8 present (0.42105263 0.57894737) *

Tested changing "clipboard" to a text file name, and had the same content above.
Am wondering about your comment that sink didn't work for you, what was the problem / output?

A: save() and load() should work if you want to preserve fit for future use. Experiment with something like
is.list(fit)                       # check it is there
save(fit,file="thisexample.txt", ascii=TRUE)
rm(fit)                            # to remove fit object
is.list(fit)                       # check it is not there
load(file="thisexample.txt")
is.list(fit)                       # check it is there

You should see [1] TRUE then Error: object 'fit' not found then [1] TRUE and you will be good to go on using fit
I may have misunderstood what you are trying to save, in which case use Ricky's answer instead, with a file name
sink("exampletree.txt")
print(fit)
sink()


text:
Q: How to append string after file extension via batch file Checking the integrity of zip archives recursively how can i rename bad files in a folder by appending a string after the file extension via a batch file under Windows?
I tried this script and it gives me no errors but doesn't rename bad files either.
FOR /R \backup %%A IN (*.zip) DO (
   7z t "%%A" | FIND "Everything is Ok" || ((REN "%%A" "%%A.bad") & (ECHO.%%A BAD >> error.log))
)

I have experience in PHP scripting and understand this code block in general (the meaning of the pipe and the logical OR operator). However, i have absolutely no experience in Batch-scripting and adopted the script from this source. From what i understand the check receives either an "OK" or adds an entry to the log file and renames the file. The log entry is added, however the renaming is not applied. I don't understand why. Can you tell me what is going wrong and how it would have to look to work as intended?

A: You can use this batch code for your task.
@echo off
rem Test all ZIP files recursive from directory backup in root of
rem current drive and append .bad to those ZIP files not validate.
rem The names of those files are additionally written into an
rem error.log text file in current working directory.

for /R "\backup" %%A in (*.zip) do (
   7z.exe t "%%A">nul
   if errorlevel 1 (
      ren "%%A" "%%~nxA.bad"
      echo %%A BAD>>error.log
   )
)

In help of 7-zip there is a page about Exit Codes. As it can be read on this help page any value greater 0 means something was wrong.
Therefore if errorlevel 1 can be used to check if the test on the ZIP file was positive (exit code is 0) or failed (value is greater or equal 1).
Look on help output in a command prompt window after entering if /? or help if for details about errorlevel. if errorlevel 1 means: if exit code of previous command was greater or equal 1 then ...
Further command ren requires just new file name without path as second parameter as otherwise it does not rename the file specified with or without path as first parameter. This is the reason why %%~nxA must be used as second parameter for command ren to reference just name and extension of the file to rename. Help of command for output after entering for /? or help for contains a list of those modifier letters for a file name.


text:
Q: Jquery Cool Drag and Drop snap to position Anyone know how you do that cool thing in JQuery where you can drag and drop divs and it snaps to position and saves location?

A: This tutorial suits your needs.

A: Try checking out jQuery UI - more relevantly the Draggable feature.

A: Have a look at DropThings.
This is an open source project available at Codeplex that could be a good source of information for your requirement

A: You can also use interactjs with a great support for touch events


text:
Q: Adjectives that Imply Nouns Often we may see adjectives with nouns that are implied, but not explicitly written. I see this mostly with sports team names and demonyms. For example:
The Notre Dame Fighting Irish
Is "Irish" a noun, or is it strictly an adjective where "people" is implied? In Latin, which has genders, you could write an adjective without a noun, and "man" or "woman" could be implied based on its gender (and generally, I've seen the masculine plural referring to people without gender importance). We can't do that in English as adjectives are not grammatically grouped into genders.
Here's another example:
"The Chinese are very hard-working."
Is "Chinese" officially a noun or is it merely an adjective?

A: Due to the fact that the English adjective has no endings for gender, case and numerus (singular/plural) it can become unclear when used without noun.
So the system is to use adjective + noun or adjectve + one/ones when the noun is dropped.
There are only two possibilities to use the adjective (adj) without noun or one/ones.
1 the beautiful, the sublime, the good, the evil. Here the adj stands for the singular neuter.
Added: To avoid misunderstandings I should say: Here the adj stands for something that in languages with genders is called singular neuter.
2 When the adj refers to people as in the rich, the poor. Here "people" is simply dropped.
As to the question about the word class when an adj is used without noun the simplest answer is in "the beautiful/the rich" the adj stands for a noun.
By the way Wikipedia's article The Adjectival Noun is a good example for lengthy academic articles where linguistics needs a whole page for saying the adj can be used
without noun when it is singular neuter or when it refers to people. Tree diagrams in such cases are useless.


text:
Q: Proxy Rotator PHP iam trying to make my script use diffrent ip on evry try using proxy.. like specifying
4-5 proxies and keeps rotating them randomly, i used this code but somehow not working ?
thnx in advance
$proxies = array(
    '101.78.209.133:1080',
    '108.16.231.7:24476',
    '108.30.227.209:50684',
    '109.167.201.26:1080',

);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,15);
curl_setopt($ch, CURLOPT_HTTP_VERSION,'CURL_HTTP_VERSION_1_1' );
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_ENCODING , "gzip,deflate");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT,$agents[array_rand($agents)]);
curl_setopt($ch, CURLOPT_USERAGENT,$proxies[array_rand($proxies)]);

A: You're setting the CURLOPT_USERAGENT instead of CURLOPT_PROXY.


text:
Q: Почему не работает цепочка css анимаций? Если нажать на кнопку in, а затем на in-out, то второе звено второй анимации выполнено не будет. Почему и как это исправить?  Неужели перед добавлением новых классов старые не очищаются в следствии чего получается то что в примере?

document.querySelector('.button-group').addEventListener('click',
    event => {
        let id = event.target.classList.value;
        let rect = document.querySelector('.rect');

        if(id === "in"){
            rect.classList.add('zoom-in-animation');
        }else if(id === "in-out"){
            rect.classList.remove('zoom-in-animation');
            rect.classList.add('zoom-in-out-animation')
        }
    }
)
.center {
    position: absolute;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);
}

.rect-control {
    width: 400px;
    height: 400px;

    border: 1px solid black;

}

.rect {
    width: 320px;
    height: 320px;

    background: lightcoral;

    transform-origin: center center;
}

.zoom-in-animation {
    animation: zoom-in 1s linear 0s 1 normal running forwards;
}

.zoom-in-out-animation {
    animation-name: zoom-out, zoom-in;
    animation-duration: 1s, 1s;
    animation-delay: 0s, 1s;
}

@keyframes zoom-in {
    from {
        opacity: 0;
        transform: scale(1.2);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoom-out {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(1.2);
    }
}

    <button class="in">in</button>
    <button class="in-out">in-out</button>

A: Попробуй  вот так if(~selector.className.indexOf('in')) {console.log('hasClass');} или
if(selector.classList.contains('in')) {console.log('selector hasClass in');}

PS Почему название переменной id ?


text:
Q: Autetificate users in AWS Api Gateway with Cognito I want to build a rest api using Aws Rest Api Gateway. This will be the new version of a already in production api (hosted on private servers).
On the current version of the api we use oauth2 with grant type password for authentication. This means that a client send his username and pass to a ".../access_token" endpoint from where it gets his token.  With this token he can then call the other endpoints.
On the new api version I'm using the AWS Api Gateway with Authorizer. I want to provide acces to resources based on the username & passwords fields
I've created a user pool and added my users there. How do i get authenticated using only api endpoints?
I cannot use Oauth "client credentials" flow since is machine to machine and client secret will have to be exposed.
On Authorization code or Implicit grant i have to ask the user to login on AWS / custom ui and get redirected. So i cannot use these in an Api.
What i'm missing ?

A: I understand that you need to authenticate your users without using a browser. An idea would be to create a login endpoint, where users will give their username and password and get back a token. You should implement this endpoint yourself. From this question:
aws cognito-idp admin-initiate-auth --region {your-aws-region} --cli-input-json file://auth.json

Where auth.json is:
{
    "UserPoolId": "{your-user-pool-id}",
    "ClientId": "{your-client-id}",
    "AuthFlow": "ADMIN_NO_SRP_AUTH",
    "AuthParameters": {
        "USERNAME": "admin@example.com",
        "PASSWORD": "password123"
    }
}

This will give access, id and refresh tokens (the same way as the authorization grant type) to your users. They should be able to use the access token to access resources and the refresh token against the Token endpoint to renew access tokens.
This isn't the common way to authenticate an API and may have some security implications.

A: I solved this issue by creating custom Lambda in NodeJS 16x with exposed URL, that does Basic Authentication on the Cognito side with stored app client id, user pool id, secret. I attach the code here, but you still need to create lambda layer with Cognito SDK, configure IAM yourself.
const AWS = require('aws-sdk');
const {
  CognitoIdentityProviderClient,
  AdminInitiateAuthCommand,
} = require("/opt/nodejs/node16/node_modules/@aws-sdk/client-cognito-identity-provider");
const client = new CognitoIdentityProviderClient({ region: "eu-central-1" });
exports.handler = async (event, context, callback) => {

    let username = event.queryStringParameters.username;
    let password = event.queryStringParameters.password;
    let app_client_id = process.env.app_client_id;
    let app_client_secret = process.env.app_client_secret;
    let user_pool_id = process.env.user_pool_id;
    let hash = await getHash(username, app_client_id, app_client_secret);

    let auth = {
        "UserPoolId": user_pool_id,
        "ClientId": app_client_id,
        "AuthFlow": "ADMIN_NO_SRP_AUTH",
        "AuthParameters": {
            "USERNAME": username,
            "PASSWORD": password,
            "SECRET_HASH": hash
        }
    };
let cognito_response = await requestToken(auth);
var lambda_response;
    if (cognito_response.startsWith("Error:")){
        lambda_response = {
          statusCode: 401,
          body: JSON.stringify(cognito_response) + "\n input: username = " + username + " password = " + password,
        };
    }
    else {
      lambda_response = {
        statusCode: 200,
        body: JSON.stringify("AccessToken = " + cognito_response),
      };
    }
    return lambda_response;
};
async function getHash(username, app_client_id, app_client_secret){
    const { createHmac } = await import('node:crypto');
    let msg = new TextEncoder().encode(username+app_client_id);
    let key = new TextEncoder().encode(app_client_secret);
    const hash = createHmac('sha256', key)  // TODO should be separate function
               .update(msg)
               .digest('base64');
    return hash;
}
async function requestToken(auth) {
  const command = new AdminInitiateAuthCommand(auth);
    var authResponse;
  try {
    authResponse = await client.send(command);
  } catch (error) {
    return "Error: " + error;
  }
  return authResponse.AuthenticationResult.AccessToken;
}


text:
Q: Draw High DPI compatible Windows Forms via VS 2017 designer on a low DPI screen I develop a VSTO add-in for Ms Word, which includes a WinForm UserControl object embedded into a Microsoft.Office.Tools.CustomTaskPane.
Development and testing are done via Visual Studio 2017, from two machines:

*

*A desktop on Windows 7 + "Low" DPI screen

*A laptop on Windows 10 + High DPI screen

The user control was designed from machine 1. When I open the project on machine 2, or when I compile from machine 1 and run on machine 2, I have the classic Low DPI to High DPI problems: the form layout becomes messy.
I understand the basics of DPI awareness, the various modes VS can run, and have been told that WPF handles DPI far better than WinForms.

My upmost concern is: Is there a way to design my forms from machine 1 so that they display correctly under high DPI environments? Or is it better to (re) design the forms on machine 2 ?
From this, derive other questions:

*

*Once I will have re-designed the forms from a high DPI environment, should I expect to run into the reverse problem? (i.e., dodgy High DPI to Low DPI conversions?)

*A CustomTaskPane only accepts WinForm UserControl objects. Would I gain anything in creating a blank UserControl in which I would embed a WPF?

*I target the .Net Framework 4.0. Would I gain anything (DPI compatibility-wise) in targeting a later version?

For those who bumped into this question because they face the same problem, some reading I found useful:

*

*https://learn.microsoft.com/en-us/dotnet/framework/winforms/automatic-scaling-in-windows-forms

*https://learn.microsoft.com/en-us/dotnet/framework/winforms/disable-dpi-awareness-visual-studio

*https://learn.microsoft.com/en-us/dotnet/framework/winforms/high-dpi-support-in-windows-forms

*https://learn.microsoft.com/en-us/office/client-developer/ddpi/handle-high-dpi-and-dpi-scaling-in-your-office-solution

*https://stackoverflow.com/a/52454103/10794555


text:
Q: Packaged Lightning Flow Throws Error on Load When Apex Action is The First Element in The Flow I run into a very bizarre issue when I packaged a lightning flow in a Managed Beta Package and try to tested out on the installed package.
My lightning flow is linked to a quick action button and it loads fine and worked alright in a dev environment. But after packaged the component and launch it in a staging environment(Managed Beta installed) it fail to launch and give the following error:

In the browser console I got something like this:

Salesforce debug log shows only following:

Log
  48.0 APEX_CODE,FINEST;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;NBA,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WAVE,INFO;WORKFLOW,INFO
  14:35:41.0 (121919)|USER_INFO|[EXTERNAL]|00521000004BnCM|test-rgprccdwkvhd@example.com|(GMT-04:00) Eastern Daylight Time (America/New_York)|GMT-04:00

The flow I had has one thing different than the other flows that does not have problem loading. That is this flow started with an Apex Action. And the apex action was taking variables from flow as input variables to run.
When I remove the apex action as first element run by the flow, and made a beta package. I tested on the new beta package everything works ok.
This seems like an issue with salesforce. Anyone has any idea on why this is happening. Is it best practice to call "Apex Action" at the beginning of a lightning flow?
Here is a screen shot of the flow I have:

A: Ok I have got some progress on this problem. I changed the first Apex Action class to be global class instead of public as it was before, then the problem went away. However, my understand was that the apex action in a packaged flow does not need to be global... Still seem to me like a bug in salesforce


text:
Q: How to be sure that an unknown number of map updates have been completed? I am facing the problem that I need to update a map on the screen such that the all points from the route the user has taken is visible.
In the code below, I count the number of times I request a map update, but I noticed that sometimes the number of requests doesnt match the number of callbacks. So waiting for 'mapLoaded' to become 0 is not a good idea.
Therefore I have added a time limit of 10 seconds, but this is arbitrary and sometimes just not enough.
So, how can I know for sure that all map update has been completed?
private void adjustMapCompleteSO(LatLng from, LatLng to){//3.3.17 show all points for screenshot
    double x1=(from.latitude+to.latitude)/2;
    double x2=(from.longitude+to.longitude)/2;
    LatLng del=new LatLng(x1,x2);
    map.moveCamera(CameraUpdateFactory.newLatLng(del));

    mapLoaded=0;

    for(Polyline pol : allcrumbs){
        List<LatLng> points = pol.getPoints();
        for (LatLng point : points){

            LatLngBounds.Builder builder = new LatLngBounds.Builder();
            builder.include(point);

            LatLngBounds bounds = builder.build();
            int padding = 40; // offset from edges of the map in pixels

            CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);

            mapLoaded++;
            map.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
                public void onMapLoaded() {
                    mapLoaded--;
                }
            });

            map.moveCamera(cu);
        }
    }
    Date started = new Date();
    while (mapLoaded !=0 && new Date().getTime() - started.getTime() < 10000){
        try {//wait until map has loaded, but max 10 seconds
            Thread.sleep(500);//wait half a second before tyring again
        } catch (InterruptedException e) {}
    }
}

A: Show all polylines on the map.
Create a builder
        LatLngBounds.Builder builder = new LatLngBounds.Builder();

Iterate over all the points in the polylines sending them to lat long bounds builder.
for(Polyline pol : allcrumbs){
    List<LatLng> points = pol.getPoints();
    for (LatLng point : points){
        //   dude never initialize variables in a loop again
        //   its automatic fail for speed of execution.
        // String never = "Do this in a loop";
        // int padding = 40; // offset from edges of the map in pixels
        builder.include(point);
    }
 }

Now move the camera
LatLngBounds bounds = builder.build();
int padding = 40; // offset from edges of the map in pixels
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
map.moveCamera(cu);

IDK what your doing in the maploaded callback so its not in the above code.
Tip:  populate latlngbounds.builder as you create the polylines the simply move the camera when your finished loading the polylines.
LatLngBounds bounds = builder.build();
int padding = 40; // offset from edges of the map in pixels
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
map.moveCamera(cu);

Note: moving the camera along a route would be similar to your code but you would typically only update the camera when the camera is finished for each point.


text:
Q: What can cause a file corruption of a windows system file (ntdll.dll)? I'm observing strange behaviour of a Windows 10 installation and trying to figure out the cause to assess possible damage:
Windows started to act strange in the way that programs which perform system file verifications (like VirtualBox when trying to start a VM) failed with a hint in the log file to \\Windows\System32\ntdll.dll and a signature mismatch.
When I right clicked this file and checked the details of the Microsoft Windows signature it indeed said the signature is invalid.
Next I performed a check with the Windows Resource Checker (sfc \scannow) and it also found ntdll.dll to be corrupted. In its log it looked like several repair tries failed but eventually the file was repaired correctly. This however turned out to be incorrect since I had the same invalid signature and problems after a restart.
Finally I took ownership of ntdll.dll (originally it belongs to TrustedInstaller and therefore cannot be modified), renamed it to ntdll.dll.old and copied a Version from a 3 days old backup in the folder. At this point the hash of copied ntdll.dll and ntdll.dll.old were different through they had the exact same size and the signature of the copied ntdll.dll was valid while the 'old' file still had an invalid signature.
After a restart everything works like before. However for some really odd reason now the hashs of ntdll.dll and ntdll.dll.old are matching as well and the signature of ntdll.dll.old is valid as well?
Any ideas what kind of problem / cause of the corruption I am facing? SSD SMART values look perfect (the SSD would have been my first culprit). If possible I'd like to prevent more damage and switch maybe defect hardware or take other countermeasures...


text:
Q: how do I verify this value? entering total value of two numbers in a text box to prevent spam
<?php
     $rand = rand(2,9);
     $rand1 = rand(2,9);
     echo $rand." + ".$rand1;
?>
               *

               <input name="randm" class="intext" id="county" type="text" />

How do I verify this value of both in a POST method??

A: There is nothing to verify in your code. You cannot compare the received value, because you did not keep the originals. You throw away $rand and $rand1 in the snippet that you have shown.
You need to keep them in the session (don't forget session_start() beforehand) like so:
$_SESSION["rand"] = $rand + $rand1;

Then you might be able to do this when you receive the form:
if (strlen($_POST["randm"]) && ($_POST["randm"] == $_SESSION["rand"])) {

    $_SESSION["rand"] = "";   // unset afterwards to prevent replays

A: I would use a CAPTCHA instead. With math problems, you still have to display the equation for users to solve, which opens the door for a spammer to write a script to parse the operands from your HTML, solve the math problem, and submit a POST request containing the correct answer. Automating such a script would allow for the continuous misuse of your form, a scenario which is actually not as unlikely or difficult to accomplish as one might think.
reCATCHA is a good option should you choose to go the CAPTCHA route.


text:
Q: What's the right way to use Akavache's LoadImageFromUrl in a Windows Phone project? The goal is to asynchronously fetch an image from a url and then set it to a BitmapSource viewmodel property (which is databound in a view).
I can use LoadImageFromUrl to get a Splat.IBitmap, but I can't figure out how to connect that to a BitmapSource. In fact, I'm not sure that I'm using this method correctly at all.
Here's what I've got:
using Akavache;
using System.Reactive.Linq;

// ...others...

var myViewModel = ...;

var url = @"http://upload.wikimedia.org/wikipedia/meta/0/08/Wikipedia-logo-v2_1x.png";

BlobCache.LocalMachine.LoadImageFromUrl(url, false, 200, 183)
    .ObserveOnDispatcher()

    // up to here, it's fine
    // what goes below is the question

    // I manually instantiate an Action object so as to explicitly pick that override,
    // but LoadImageFromUrl returns an IObservable<Splat.IBitmap>, so I'm not picking the wrong <T> here
    .Subscribe(new Action<Splat.IBitmap>(pic => {
        // haha, nope: myViewModel.someBitmapSource = (BitmapSource)pic);
    }), ex => Debug.WriteLine(ex));

Other things I thought of:

*

*Check documentation: none seems to exist that I can find

*Google around: slim pickings, nothing directly helpful

*Look to see how this method is used in Akavanche tests: it doesn't appear to be called anywhere

*Since a Splat-namespace object is returned, check Splat tests/docs: Closer. The splat readme says:

.
// ToNative always converts an IBitmap into the type that the platform
// uses, such as UIBitmap on iOS or BitmapSource in WPF
ImageView.Source = ViewModel.ProfileImage.ToNative();

Great, except ToNative() doesn't make sense in this case because it's not a member of the Splat.IBitmap interface.
And now I'm out of ideas.

A: ToNative is a Splat extension of the IBitmap interface. Adding a dependency on Splat and using it in this context will make that method available.
Whether or not that's the Right™ way to do it, I'm not sure.


text:
Q: magento system configuration show blank page, When i set the Merge JavaScript Files and Merge CSS Files to "yes" and go Advanced closed the following two modules output off
Mage_AdminNotification
Mage_Poll
The issues arise,magento/system/configuration show blank page right,click on the left of the module not reflect, display is still blank.

A: Is this issue cause by the merging of js/css or because you disable those modules or both (could you try narrowing it down by disabling one at a time)?
Do you have any js error in your js console (does js work on the regular site)?
Normally if add custom js to your site and dont add semicolon (;) to line ending when you enable merge on your site you will have js error.
Do you have any custom module installed (does the system config work if you enable both)?


text:
Q: How to change color of cells in a DT::dataTable in shiny, based on cells in another column? I am new to shiny/r and trying to change the background color of a cell (DT table) base on value of another cell. I tried using this example from https://rstudio.github.io/DT/010-style.html
datatable(df) %>% formatStyle(
  'V1', 'V6',
  backgroundColor = styleEqual(c(0, 1), c('gray', 'yellow'))
)

But somehow it doesn't seem to work for me
Here's my code :
dt_output = function(title, id) {
        fluidRow(column(
        12, h1(paste0(title)),
        hr(), DTOutput(id)
        ))
        }

 render_dt = function(data, editable = 'cell', server = TRUE, ...) {
    renderDT(data, selection = 'none', server = server, editable = editable, ...)
    }

ui = fluidPage(
downloadButton("mcp_csv", "Download in CSV", class="but"),

dt_output('Report', 'x9'),
)

server = function(input, output, session) {
d1 = readRDS("cmp.rds")
d9 = d1

output$x9 = render_dt(d9, 'cell', rownames = FALSE, extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = I('colvis')))

observeEvent(input$x9_cell_edit, {
d9 <<- editData(d9, input$x9_cell_edit, 'x9', rownames = FALSE)
saveRDS(d9, 'cmp.rds', version = 2)
})

datatable(d9) %>% formatStyle(
'R/Y/G', 'Y', #'R/Y/G' is the column cell I'm trying to change values for based on column 'Y'
backgroundColor = styleEqual(c(0, 1), c('red', 'yellow'))
)

I'm not sure what I'm doing wrong. Maybe it's in the wrong place, I don't know. Also if I needed to change color of column 'R/Y/G' based on three different columns (R, Y, G), based on dynamic input (not hardcoded like 0 and 1) =, how would I implement that?
Thanks
P.S.
If I add this code
dt_d9=datatable(d9) %>% formatStyle(
'R/Y/G', 'Y',
backgroundColor = styleEqual(c(0, 1), c('red', 'yellow'))
)

and replace
output$x9 = render_dt(d9, 'cell', rownames = FALSE, extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = I('colvis')))

with
output$x9 = render_dt(dt_d9, 'cell', rownames = FALSE, extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = I('colvis')))

I do get the colors on the R/Y/G column, but the edit cell function stops working. The edit cell function can be found here : https://yihui.shinyapps.io/DT-edit/

A: Your code gives the following error:

renderDataTable ignores ... arguments when expr yields a datatable object;

Since you now return a DT::datatable object to renderDT and not a dataframe. This is a bit similar to this Q/A. So now you have to move all arguments to the DT::datatable constructor:
render_dt = function(data) {
 renderDT(data)
}

and
  dt_d9 <- datatable(d9, editable = 'cell', rownames = FALSE, extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = I('colvis'))) %>% formatStyle(
'R/Y/G', 'Y', #'R/Y/G' is the column cell I'm trying to change values for based on column 'Y'
backgroundColor = styleEqual(c(0, 1), c('red', 'yellow'))
 )

 output$x9 = render_dt(dt_d9)


text:
Q: Add application to Privacy >> Accessibility in Objective-C For enabling some of my application's features, I need the user to add the application in the accessibility list:

I understand this is not possible to do it without any user interaction, but at least I would like to know two things:

*

*How to know if the application is already in this list or not?

*If application does not yet belong to the list, how to display this dialog:

I am using the last version of XCode and Objective-C.
Thank you for your help.

A: AXIsProcessTrustedWithOptions returns whether the current process is a trusted accessibility client. Option kAXTrustedCheckOptionPrompt indicates whether the dialog will be displayed.


text:
Q: yourkit not giving string objects during memory profiling on trying to monitor object sizes, string objects are not shown in the profiled results.
Can anyone tell me wat is the procedure to make them shown in results....
public class calling extends called {
called myobj3 = new called();
called myobj4 = new called();
    public void function() {
    myobj3.d="Plz";
    myobj3.e="Help";
    myobj4.d="Thank";
    myobj4.e="You";
    myobj3.act();
    myobj4.act();
    }
 public static void main(String [] args) {
    System.out.println("calls an object from called.java");
    calling obj = new calling();
    obj.function();
 }
 }
class called {
public String d;
public String e;
public void act() {
System.out.println(d+e);
}
}

memory profile Retained size Shallow Size
    [Unreachable] called 40 40
    [Unreachable] called 40 40

A: Perhaps, your objects have been collected or scheduled for collection (unreachable). In which point do you capture memory snapshot?
Disclaimer: I'm a YourKit developer.


text:
Q: The "How to Ask" page might lead new users to ask their programming questions here. How can we deal with that? When a user tries to post a new question on Stack Overflow for the first time, he's redirected to this page.
For a new user who is usually not very patient, it's just a wall of text. He goes over the words quickly, ticks the obvious "thanks, I will keep these tips in mind when asking " checkbox and then he might easily miss the "proceed" link which is both aligned to the right, far far away from the checkbox and has a light gray color.
In such a case the user will scan the page again looking how to get past that obstacle, then to the right of the big search box he'll see this:

Now he thinks "great, let's discuss my question on meta (whatever meta is)" and click the link happily and full with hope. He gets to a site with a very similar design to Stack Overflow. Remember that he's under the impression that's the place to discuss his question.
The "Ask Question" button is 100% the same as the one on Stack Overflow, so our dear user clicks it. Jackpot! There's no irritating wall of text asking him to confirm things he'll never really remember.  He posts the question there and quickly forgets the bumpy way he went through... until his question is downvoted and deleted on that mysterious "meta" site he never really meant to reach in the first place.
What can we do? I'm open for suggestions or objections, if you don't think that's the source for many of the programming questions we see here on daily basis.

A: One possible improvement I can think of is to make the "proceed" link much more visible on the page, by making it an actual button:

Then a user won't have to scan the page again to find it.

A: In addition to the somewhat hidden "proceed" button, I think the choice of phrasing in the link to meta is inaccurate.
Rarely is anyone who is reading this page actually going to want to initiate an appropriate discussion for meta, but instead is looking for help about the site, or how to craft a question.  So rather than  "Discuss on meta", maybe the link should reflect the desire usage?
Some ideas:

*

*"Need help asking a question, get support on meta >>"

*"Get support for this site on meta >>"

*"Have more questions on writing your question, check out meta >>"

Hopefully someone can find something shorter, but I couldn't think of one that would be on par with the length of "discuss on meta".

A: How about removing the Meta link altogether?
You get to that page when asking your first question. There is a lot of information on how to ask a question, and links to even more information. Do you at that point, as a new user, need to be informed about Meta? I don't see why you'd need to be at that particular moment.
Just have users focus on the thing they have to focus on. And that is asking good questions. Don't distract them with Meta. They will be informed about it if, despite all help provided, their question is poor enough to get closed. That's a much better opportunity to point out the additional community support.
So why not get rid of that link?

A: I think it's quite clear for everyone, what is discussion...
From what I've seen, a typical pattern is someone asking on SO, being downvoted and closed, asking once again, being blocked, and finding out that he can't ask more on SO, but he can still ask on Meta.
The problem is that users doing so are resistant to reading any FAQs or hints, so adding additional won't help much.

A: I think the main problem is that there's barely any difference between the "Ask a Question" page on SO and MSO. The only big difference the average Joe, who can't be bothered to read small print, notices is the big red "meta" in the logo/header and probably the slightly more grey feel. Now, there are a lot of people, who don't know what meta means.
I think there should be a notice for low reputation users on the "Ask a Question" page, here on meta, clearly notifying the user that this site is for discussing the main site or SE network, reporting bugs, posting feature requests, etc.


text:
Q: Live video. (#100) No permission to perform current operation I want to make live video stream from my IOS app to Facebook. I have two facebook account: first - with registered iOS app, second account - only for the test. If I log in with my first account(in my iOS app) - I get the required rtmp://rtmp-api.facebook.com:80/rtmp URL and secret key for the streaming (everything as stated on the FB documentation: https://developers.facebook.com/docs/videos/live-video-api). But if I'm using second account for login, I'm receiving this error:
com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
    body =     {
        error =         {
            code = 100;
            "fbtrace_id" = Ed9BmMChIsn;
            message = "(#100) No permission to perform current operation.";
            type = OAuthException;
        };
    };
    code = 400;
}, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=400,

My code for live streaming:
- (void)enableFacebookLiveStreamingWithCompletionHandler:(void(^)(NSString* facebookStreamURL, NSString* facebookStreamKey, NSError* error))completionHandler;
{
    dispatch_async(dispatch_get_main_queue(), ^{
        if ([[FBSDKAccessToken currentAccessToken] hasGranted:permissionPublishActions])
        {
            NSString* liveVideosRequestPath = [NSString stringWithFormat:@"/%@/live_videos",[FBSDKAccessToken currentAccessToken].userID];
            FBSDKGraphRequest* request = [[FBSDKGraphRequest alloc] initWithGraphPath:liveVideosRequestPath parameters:nil HTTPMethod:@"POST"];

            [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {

                NSLog(@"%@",[FBSDKAccessToken currentAccessToken].permissions);

                if (error)
                {
                    if (completionHandler)
                        completionHandler(@"",@"",error);
                }
                else
                {
                    if (completionHandler)
                        completionHandler(@"rtmp://rtmp-api.facebook.com:80/rtmp/",[[result objectForKey:@"stream_url"] lastPathComponent],nil);
                }

            }];
        }
    });
}

P.S// Very interesting that even though I have included all the permissions here: https://developers.facebook.com/tools/explorer, all the same to me denied access for second account for testing(on which the application is not registered)!
Help me please.

A: Most permissions need to get reviewed by Facebook, else you can only use them as users with a role in the App. Read about "Login Review" in the docs: https://developers.facebook.com/docs/facebook-login/review


text:
Q: bitwise operation, change bit from 0 to 1 then 1 to 0 without affect the other bit in same variabel 8 bit (uint8_t) I have a unsigned 8 bit variable SG1 which have value 0 or 1.
I want to put SG1's value at a new 8bit variabel (eg:coil) at 4th bit without affect the other bit.
can anyone help me ?
example :
uint8_t coil = 0b00010001;
SG1 = 0 or 1; //this value from the other function
expected result : (focus on 4th bit)
if SG1 == 1
coil change from the previous value (0b00010001) become 0b00011001;
then,
if SG1 == 0
coil change from the previous value (0b00011001) become 0b00010001;
below is the code that I build, it can work, but I want to change it without if else.
if(SG1 == 1){ //SG1 change from 0 to 1
    Coil |= (1 << 3);
}
else if(SG1 == 0){ //SG1 change from 1 to 0
    Coil &= ~(1 << 3);
}


text:
Q: How to cancel a deferred NServiceBus Message? Say I use the deferred messaging feature to send a message at some later future point in time, but then later I might want to cancel that message.
Question 1 - When making the original bus.Defer(...) call, how do I get a unique identifier back for that message?  I would expect there to be a message id or a timeout id of some sort.
Question 2 - Short of calling the RavenDB database directly, is there a way to query the bus to get back all pending deferred messages?
Question 3 - Is there some way to cancel a deferred message?  I would expect something like bus.CancelDeferred(messageid)
Is any of this available, or are there any other mechanisms I can use to achieve similar results?

A: I've had the need to abandon deferred messages and outstanding replies a few times, and I did it by "incrementing the correlation ID" on my saga. You don't mention sagas though, so I'm not sure if this solution will be usable to you. I do think, however, that it goes under "any other mechanisms" that you ask for :)
Check out this example - here I have the state of my saga which, among other things, contains a custom CorrelationId:
public class MySagaData : ISagaData
{
    // ... the usual stuff here

    public string CorrelationId { get; set; }
}

and then, each time I defer a message or request something, I correlate the deferred message and/or reply with the current value of the correlation ID:
bus.Defer(time, new Something { CorrelationId = Data.CorrelationId });

bus.Send(new SomeRequest { CorrelationId = Data.CorrelationId });

thus conceptually correlating the deferred message and the reply with the current state of the saga.
And then, in cases where I want to abandon all outstanding messages, I simply re-set the saga's correlation ID to a new value - I usually set the value to something like somethingWithBusinessMeaning/timestamp.
This way, abandoned messages will not correlate with any saga instance, effectively being ignored.
Does it make sense?

A: 1) There is currently no way to do this. You could add your own header with a app specific id if you need to keep track of them
2) No, you have to query the storage as you mention. That said what would be the use case for this?
3) No, and this is by design. Given that you can't assume when a message will arrive you can't rely on timeouts being canceled since a defered message might be stuck in a queue and processed right after you cancel. The "cancel" message might also get lost.
In short: your code needs to be prepared to discard "invalid" messages no matter what.


text:
Q: Implicit Differentiation: cot(r(Θ)^4) = 1/6 ???? cot(r(Θ)^4) = 1/6 ---- Solving for dr/dΘ
So I differentiate, and I get -csc^2(r(Θ)^4)(4r(Θ)^3 + (dr/dΘ)(Θ^4)) = 0
farthest point I got to is (-4r(Θ)^3-(dr/dΘ)(Θ^4))/sin^2(r(Θ^4)) = 0
how are you supposed to put anything else on the right hand side when all is being multiplied?

A: $$\cot(r\theta^4)=\frac{1}{6}$$
$$-\csc^2(r\theta^4)\big(4r\theta^3+\frac{dr}{d\theta}\theta^4\big)=0$$
Notice that $\csc^2(x)\ne0$ for all $x\in \mathbb R$, so we can divide both sides by it:
$$-(r\theta^4)\big(4r\theta^3+\frac{dr}{d\theta}\theta^4\big)=0$$
Now notice that since
$$\cot(r\theta^4)=\frac{1}{6}$$
it is impossible for $\theta$ to equal $0$. Thus we can divide both sides by $\theta$ as much as we want, and the same goes for $r$:
$$\big(4r\theta^3+\frac{dr}{d\theta}\theta^4\big)=0$$
$$4r+\frac{dr}{d\theta}\theta=0$$
$$\color{green}{\frac{dr}{d\theta}=-\frac{4r}{\theta}}$$

A: Consider the implicit function $$f=\cot(r\theta^4)-\frac{1}{6}=0$$ and compute the partial derivatives $$\frac{\partial f}{\partial r}=-\theta ^4 \csc ^2\left(r\theta ^4 \right)$$
$$\frac{\partial f}{\partial \theta}=-4 \theta ^3 r \csc ^2\left(r\theta ^4 \right)$$ and, from the implicit function theorem $$\frac{dr}{d \theta}=-\frac{\frac{\partial f}{\partial \theta} } {\frac{\partial f}{\partial r} }=-\frac{4 r}{\theta }$$


text:
Q: Spring Major version '3' expected, but you are running with version: 4.0.5.RELEASE I recently upgraded to spring-core 4.0.5 and made sure all other Spring components are in compatible versions. The only things that I didn't upgrade were spring-ldap-1.3.1 and spring-security-3.1.2.
After I deployed the WAR to the Tomcat server, I saw some message on the Tomcat console that reads "Spring Major version '3' expected, but you are running with version: 4.0.5.RELEASE. Please check your classpath for unwanted jar files.". But there was no exception or anything, the server started up successfully and application seemed to work just fine.
Listening for transport dt_socket at address: 8889
Mar 26, 2015 6:08:39 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.32 using APR version 1.5.1.
Mar 26, 2015 6:08:39 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters false], random [true].
Mar 26, 2015 6:08:40 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized with version OpenSSL 1.0.1j 15 Oct 2014
Mar 26, 2015 6:08:40 PM org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8888
Mar 26, 2015 6:08:40 PM org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8009
Mar 26, 2015 6:08:40 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1142 ms
Mar 26, 2015 6:08:40 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Mar 26, 2015 6:08:40 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.43
Mar 26, 2015 6:08:40 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
Mar 26, 2015 6:08:41 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
Mar 26, 2015 6:08:41 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive my-application-ui.war
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
Mar 26, 2015 6:08:42 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive my-application-web-service.war
**-*** Spring Major version '3' expected, but you are running with version: 4.0.5.RELEASE. Please check your classpath for unwanted jar files.**
-Root WebApplicationContext: initialization completed in 39254 ms

I went to WEB-INF\lib and saw the Spring jars as follows.
spring-aop-4.0.5.RELEASE.jar
spring-beans-4.0.5.RELEASE.jar
spring-context-4.0.5.RELEASE.jar
spring-context-support-4.0.5.RELEASE.jar
spring-core-4.0.5.RELEASE.jar
spring-expression-4.0.5.RELEASE.jar
spring-jdbc-4.0.5.RELEASE.jar
spring-jms-4.0.5.RELEASE.jar
spring-orm-4.0.5.RELEASE.jar
spring-oxm-4.0.5.RELEASE.jar
spring-tx-4.0.5.RELEASE.jar
spring-web-4.0.5.RELEASE.jar
spring-webmvc-4.0.5.RELEASE.jar
spring-ws-core-2.2.0.RELEASE.jar
spring-ws-security-2.2.0.RELEASE.jar
spring-ws-support-2.2.0.RELEASE.jar
spring-xml-2.2.0.RELEASE.jar
spring-ldap-1.3.1.RELEASE-all.jar
spring-ldap-core-1.3.1.RELEASE.jar
spring-security-config-3.1.2.RELEASE.jar
spring-security-core-3.1.2.RELEASE.jar
spring-security-ldap-3.1.2.RELEASE.jar
spring-security-web-3.1.2.RELEASE.jar

I couldn't figure out where this message comes from and for what reasons. Any help is greatly appreciated.

A: I'm afraid Spring Security 3.1.2 depends on Spring Core 3, so it's not possible to include Spring Core 4 (check here).
But it is possible to use Spring Security 3.2 with Spring Core 4 (details on how to handle dependencies here).


text:
Q: How to get all the dates between two dates with each hour everyday? I am working on something in which i need to get all the dates with hours between two dates. Below is the example what i tried so far and what actually i need -:
declare @sTime datetime = '03/03/2019 02:00:00.000'
declare @stopTime datetime = '01/01/3000 02:00:00.000'
declare @interval int = 60
declare @temp_time datetime

declare @tempHourtb ( StartTime datetime not null, StopTime datetime
not null)

select @temp_time = @sTime
while(datediff(hh, @temp_time, @stopTime) > 0)
begin
   insert into @HourTable
   select @temp_time,dateadd(mi, @interval, @temp_time)
   set @temp_time = dateadd(mi, @interval, @temp_time)
end
select * from @tempHourtb

And this giving me following output, which is correct -:

But the problem i am facing, its taking too much time when i have long gap between start and stop date. Is there any way in which i get same output but in less time?

A: This should generate 8,597,809 records in just over 3 seconds
You may want to rethink the year 3000
Declare @Date1 datetime = '2019-03-03 02:00'
Declare @Date2 datetime = '3000-01-01 02:00'

Select StartTime = D
      ,StopTime  = DateAdd(HOUR,1,D)
 Into  #YourTempTable
 From (
        Select Top (DateDiff(HOUR,@Date1,@Date2)+1)
               D=DateAdd(HOUR,-1+Row_Number() Over (Order By (Select Null)),@Date1)
         From  master..spt_values n1,master..spt_values n2,master..spt_values n3
      ) A

Which will look like this

EDIT -
Added Into  #YourTempTable


text:
Q: Distinct with joins How do I get distinct rows based on the Last_Name field when my format is as follows:
    public ActionResult Index()
    {

        ResumeDbEntities srd = new ResumeDbEntities();

        List<M_Employees> First_Name = srd.M_Employees.ToList();
        List<M_Employees> Last_Name = srd.M_Employees.ToList();
        List<M_Employees> CurrentLaborCategory = srd.M_Employees.ToList();
        List<M_Offices> Location_Number = srd.M_Offices.ToList();
        List<M_Offices> City = srd.M_Offices.ToList();
        List<M_Offices> State = srd.M_Offices.ToList();
        List<S_Emp_Resume> Resume_Name = srd.S_Emp_Resume.ToList();

        var multipleTbl = (from p in Resume_Name
                           join t in Last_Name on p.Employee_Rec_Key equals t.Employee_Rec_Key
                           join o in Location_Number on t.Office_Rec_Key equals o.Office_Rec_Key
                           where t.Employee_Rec_Key == 3633
                           select new MultipleClassRes { M_Employeesdetails = t, S_Emp_Resumedetails = p,  M_Officesdetails = o});

        return View(multipleTbl);
    }

A: Newly working with MVC but included the auto number from one of the joins.