text:
Q: what are linear divisors of integer powers? I have been trying to prove that $n^4$ is eithere divisible by $5k$ or $5k+1$, couldn't help wonder if there is a more general theme to try later , namely if it is true that $n^m$ is divisble by at least one of the $mk , mk+1 , mk+2 , mk+3 , \cdots , mk+(m-1)$ or something similar?

A: I will post this as an answer, mostly since it is too long for a comment.
It is critical in mathematics to state questions precisely.  Interestingly enough, the same need not apply to proofs.  In many settings, conveying the idea of the proof may be enough.
So what does "$n^4$ is divisible by $5k$ or $5k+1$" mean? What is $k$?
Chandru, from the link he gave, interprets the question to mean "$n^4$ is either of the form $5k$ or of the form $5k+1$."  This is a way of saying what, in more modern language, would be expressed by writing that either $n^4 \equiv 0 \pmod{5}$ or $n^4 \equiv 1 \pmod{5}$.
Proving that this is true is easy.  Imagine dividing $n$ by $5$.  The remainder is $0$, $1$, $2$, $3$, or $4$.  Now we need to find, in each of these cases, the remainder when $n^4$ is divided by $5$. This is easy by using basic properties of congruences.
But even if we know nothing about congruences, we can solve the problem because of our familiarity with the decimal system.  We will be taking a fourth power, and $(-a)^4=a^4$.  So we need only worry about $n^4$ for $n \ge 0$.
Look at the last digit of $n^4$ for $n=0$, $1$, $2$, and so on up to $9$.  We get the pattern $0$, $1$, $6$, $1$, $6$, $1$, $6$, $1$, $6$, $1$.  And if we continue, looking at $10^4$, $11^4$, and so on, the pattern obviously repeats.
When the last digit of $n^4$ is $0$, the number $n^4$ is divisible by $5$, that is, is of the form $5k+1$.   When the last digit of $n^4$ is $1$, $n^4$ leaves a remainder of $1$ on division by $5$, so is of the form $5k+1$.  This is also the case when the last digit of $n^4$ is $6$, for in this case also $n^4$ is $1$ more than a multiple of $5$.
We could use fancier tools to tackle the problem.  Here is a nice result, called Fermat's (little) Theorem.
Let $p$ be prime, and let $a$ be an integer not divisible by $p$. Then
$$a^{p-1}\equiv 1 \pmod{p}$$
To apply this to our problem, let $p=5$.  If $a$ is divisible by $5$, then clearly $a^4$ is divisible by $5$.  In all other cases, use Fermat's Theorem to conclude that $a^4 \equiv 1 \pmod{5}$, which means that the remainder when $a^4$ is divided by $5$ is $1$, which means that $a^4$ is of the form $5k+1$.
Your question: You asked a question that could be interpreted as being about the "shape" of $n^m$ in general.  When the power $m$ is $1$ more than a prime, there is very useful information contained in Fermat's Theorem.  There is also an important generalization due to Euler that you could easily track down by reading about Fermat's Theorem.  Every beginning Number Theory book has the details.
A possible exploration: All of the above stuff has nothing to do with the phrase "linear divisors of integer powers."  We have not been examining the divisors of $n^4$, only $n^4$ itself.  A bit of thought will show that numbers of every shape whatsoever can divide $n^4$, if you put no restrictions on $n$.
Even with a simple example like $2^4$, the divisors are $1$, $2$, $4$, $8$, and $16$.  Note that if you divide these by $5$, all remainders except $0$ occur.
It could be interesting to explore the following question.  For a given integer $a$, and a given prime $p$, what are the possible remainders when powers of $a$ (things of the shape $a^m$) are divided by $p$.
If you start looking at these things, with the help of a good Number Theory book and/or the Internet, you will bump into interesting things, like primitive roots.
Divisors of $n^2+1$:  At a more advanced level in number theory, one can tackle questions about possible shapes of divisors of, for example, $n^2+1$, and related questions.  List to yourself the divisors of $n^2+1$ for various $n$.  You will find no numbers of the from $4k+3$. This is no accident, it can be proved in general.   A lot is known the shape of divisors of $n^4+1$.  But for this sort of question, powers higher than $2$ in general lead to very difficult problems.
For power $2$, more subtle facts of this kind can be proved when one looks at quadratic residues and non-residues.

A: Well googling leads me to this link: (Note: This answers one part of your question.) I don't have any idea about the second part.

*

*http://www.math.wisc.edu/~jensen/567/hwk1.pdf

A: There is a very nice answer to this question when $m+1$ is a prime number.  In this case, $n^m$ is divisible by either $km$ or $km+1$ for some $k$.  (Notice that this solves your first question when $m=4$)
So we look at $n^{p-1}$.  Well, either $p$ divides $n$, or it doesn't.  In the first case, we have that $kp|n$ with $k=1$.  In the second case, by Fermat's little theorem, $$n^{p-1}\equiv 1\pmod{p}.$$ This means that $n^{p-1}=kp+1$ for some $k$, so that in particular $kp+1$ divides $n^{p-1}$.
Hope that helps,

A: By Fermat's Little Theorem $\rm\: n^{p-1}\:$ has form $\rm\:p\:k\:$ or $\rm\:p\:k+1\:,\:$ so it has itself as a divisor of that form.
More generally $\rm\ gcd(n,m)= 1\ \Rightarrow\ n^{\lambda(m)}\equiv 1\ \ (mod\ m)\ $ for $\rm\: \lambda(n)\:$ the Carmichael function.
Your last remark is always true: every integer on division by $\rm\:m\:$ has remainder $\rm\:0,1,\cdots$ or $\rm\:m-1\:.$


text:
Q: Externalization of postgreSQL database from windows comtainer I have an APP running inside container on windows 2016 platform . The app uses the postgreSQL database .we want to persist the database when container destroy and another container up  again . So we want to persist the database record . I see the postgress container for Linux platform but not for windows container .We are using window server core image as base . Can someone suggest how can we persist database info.
Thanks
Ravi

A: The program will run in the Windows container. The DB will run in a Linux container. Since they're in different containers, the OS needn't be the same. You'll simply be connecting to the DB over a URL in a network.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Django templates: HTML validation errors I'm running my code through validator and it's coming back with four errors which I don't know how to fix as the code has been imported from django forms.
Does anyone know how to fix these?

  <form method="POST">
    <input type="hidden" name="csrfmiddlewaretoken" value="...">

Username: <input type="text" name="username" maxlength="150" autofocus class="form-control" required id="id_username"> Required. 150 characters or
                fewer. Letters, digits and @/./+/-/_ only.

First name: <input type="text" name="first_name" class="form-control" maxlength="100" required id="id_first_name">

Last name: <input type="text" name="last_name" class="form-control" maxlength="100" required id="id_last_name">

Email: <input type="email" name="email" required id="id_email">

Password: <input type="password" name="password1" autocomplete="new-password" class="form-control" required id="id_password1">

Your password can't be too similar to your other personal information.

Your password must contain at least 8 characters.

Your password can't be a commonly used password.

Your password can't be entirely numeric.

Password confirmation: <input type="password" name="password2" autocomplete="new-password" class="form-control" required id="id_password2"> Enter the same password as before, for verification.

      <button class="btn btn-dark ">Register</button>

  </form>

I have used:
from django import forms

and in my views.py file I used:
from .forms import SignUpForm

my register.html page is as following:
{% extends 'base.html' %}
{% block title %}Register{% endblock %}

{% block content %}

Register

    <form method="POST">
        {% csrf_token %}

        {{ form.as_p }}

            <button class="btn btn-dark ">Register</button>

    </form>

{% endblock %}


text:
Q: Get bottom coordinates of ImageView? In Android, suppose I have an ImageView:
ImageView imgView;

public void doSomething(){
   imgView.setRotation(30);
   //How do I get the bottom right coordinates of this rotated ImageView now?
}

I want to get the bottom right-coordinates of the ImageView, how can I do that with Android and Java?


text:
Q: Excel Merge three columns into one with leaving empty cells blank Hello i need to do the following thing in excel but i am completely new to it and i find myself at a loss.
I need to take the value of J1 which is text, the values of the column K:K
and the value of L1 and merge them in the column F:F.
Usually this would be made with =$J$1&K:K&$L$1 however the column K:K have a lot of empty cells which have to be left empty in column F:F as well but right now the empty cells return the value of J1&L1.
I am sure this could be made with some if statement but i can formulate it :(

A: Try this:
=IF($K1="","",$J$1&$K1&$L$1)

And drag it down.


text:
Q: Run user application on a Switch/router? Can we run a packet sniffer/capture application on switch or router? My use case is to write a small software which will make certain decisions based on the content of the packet. Thanks. -Kedar

A: It's called a multilayer switch, and probably it is layer 7 content routing you are after.
http://www.networkdictionary.com/networking/content.php


text:
Q: Create Groupboxes conditionally from lists I have the following lists that are automatically generated with which I want to create groupboxes with PyQt5:
Country = ['France', 'France', 'Germany', 'Austria', 'Austria','Spain', 'Portugal','Portugal','Portugal','Spain']
Date = ['26.04', '14.05', '25.02', '18.04','15.06','18.09', '15.05', '28.03', '09.09', '10.10']
Lines = ['Line1', 'Line2', 'Line3', 'Line4', 'Line5', 'Line6', 'Line7', 'Line8', 'Line9', 'Line10']

I know that I can get this type of Groupbox that would look like a table with the following code:

import sys
from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *

class MainWindow(QMainWindow):

    def __init__(self):
        super().__init__()

        Country = ['France', 'France', 'Germany', 'Austria', 'Austria','Spain', 'Portugal','Portugal','Portugal','Spain']
        Date = ['26.04', '14.05', '25.02', '18.04','15.06','18.09', '15.05', '28.03', '09.09', '10.10']
        Lines = ['Line1', 'Line2', 'Line3', 'Line4', 'Line5', 'Line6', 'Line7', 'Line8', 'Line9', 'Line10']

        self.setGeometry(100, 100, 800, 600)
        self.setWindowTitle('Window')
        self.centralWidget = QWidget()
        self.setCentralWidget(self.centralWidget)
        self.mainB  = QHBoxLayout()

        self.GB1 = QGroupBox("")
        self.GB1.setStyleSheet('QGroupBox {'
                 'border: 0px solid gray; }')
        self.GB1.setFixedHeight(250)
        self.GB1.setFixedWidth(250)

        self.mainB.addWidget(self.GB1)

        grid1 = QGridLayout()
        for i in range(0,len(Country)):
           grid1.addWidget(QLabel(Country[i]), i, 0)
           grid1.addWidget(QLabel(Date[i]), i, 1)
           grid1.addWidget(QLabel(Lines[i]), i, 2)

        self.GB1.setLayout(grid1)

        self.centralWidget.setLayout(self.mainB)

def main():
    app = QApplication([])
    mainWin = MainWindow()
    mainWin.show()
    app.exec_()

if __name__ == '__main__':
   main()

However, I would like to create Groupboxes that would combine elements that correspond to a same 'Country' in the first list when that country occurs successively.
It might be better to visualize it by seeing an example of what I intend to do below:

Is there a way to generate those groupboxes automatically to achieve the intended result?

A: The key to the solution is to group the data, in this case I use a dictionary where each key is the country, and its value is a list of date and line tuples.
import sys
from PyQt5 import QtGui, QtCore, QtWidgets

class MainWindow(QtWidgets.QMainWindow):
    def __init__(self):
        super().__init__()

        Country = ['France', 'France', 'Germany', 'Austria', 'Austria','Spain', 'Portugal','Portugal','Portugal','Spain']
        Date = ['26.04', '14.05', '25.02', '18.04','15.06','18.09', '15.05', '28.03', '09.09', '10.10']
        Lines = ['Line1', 'Line2', 'Line3', 'Line4', 'Line5', 'Line6', 'Line7', 'Line8', 'Line9', 'Line10']

        central_widget = QtWidgets.QWidget()
        self.setCentralWidget(central_widget)

        lay = QtWidgets.QVBoxLayout(central_widget)

        d = {}
        for country, date, line in zip(Country, Date, Lines):
            if country in d:
                d[country].append((date, line))
            else:
                d[country] = [(date, line)]

        for country, content in d.items():
            groub_box = QtWidgets.QGroupBox(country)
            grid_layout = QtWidgets.QGridLayout()
            groub_box.setLayout(grid_layout)
            lay.addWidget(groub_box)

            for row, (date, line) in enumerate(content):
                grid_layout.addWidget(QtWidgets.QLabel(date), row, 0)
                grid_layout.addWidget(QtWidgets.QLabel(line), row, 1)

def main():
    import sys

    app = QtWidgets.QApplication(sys.argv)
    mainWin = MainWindow()
    mainWin.show()
    sys.exit(app.exec_())

if __name__ == "__main__":
    main()


text:
Q: Neo4J Browser ServiceUnavailable failure after connecting with Neo4J Java driver I regularly use Neo4J Browser on http://localhost:7474/browser/. However, yesterday I used the java driver to connect to Neo4J and execute queries. Since then, I'm unable to login to Neo4J Browser.
I start Neo4J from the terminal (I'm on ubuntu) using sudo neo4j start, and this is the output -
 % sudo neo4j start
Active database: graph.db
Directories in use:
  home:         /var/lib/neo4j
  config:       /etc/neo4j
  logs:         /var/log/neo4j
  plugins:      /var/lib/neo4j/plugins
  import:       /var/lib/neo4j/import
  data:         /var/lib/neo4j/data
  certificates: /var/lib/neo4j/certificates
  run:          /var/run/neo4j
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.
/usr/share/neo4j/bin/neo4j: line 411: /var/run/neo4j/neo4j.pid: No such file or directory

Then, I visit localhost:7474, which gives me the :server connect screen, but as soon as I enter the password, I get this error -

ServiceUnavailable: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being

Screenshot -

Normally, the only authentication fields are "Username" and "Password". I don't think I've seen the "Host" field in there before.
I searched for this error, and came across a question with similar error and an article on the Neo4J KB that says -

In Neo4j 3.0 and its implementation of the Bolt protocol, if a remote browser connects to Neo4j (http://:7474) and attempts to authenticate, the following error may be encountered:

But I don't think this situation applies here.
How can I fix this?

A: As logisima pointed out, neo4j is not compatible with Java 9. You can install multiple versions of Java and use environment variables to swap between them. For instance on MacOS you might have these two lines in your .bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
export JAVA8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home

The first line gets your normally installed java home and the second points to the older java8 location.
Then before starting your neo4j instance, execute for example:
export JAVA_HOME=$JAVA8_HOME
$NEO4J_HOME/bin/neo4j start


text:
Q: Orthogonality relations for Legendre functions second kind Does someone know the orthogonality relations for the associated Legendre functions of the second kind $Q_{n}^{m}(z)$? Are they the same as the orthogonality relations $\int{P_{n}^{m}(z) P_{j}^{k}(z) dz}=\frac{2(n+m)!}{(2n+1)(n-m)!} \delta_{jn} \delta_{km}$ for the associated Legendre functions of the first kind?

A: Given the imaginary unit modulus $i$, and integers $q$, and $p$, the orthogonality relationship for the associated Legendre functions of imaginary order for $x\in\mathbb{R}$ is
$$
 \int_{-1}^{1} Q^{i q}_{l}(x) Q^{i p}_{l}(x) \frac{dx}{1-x^{2}} = I^{q,p}_{3}
$$
where
$$
 I^{q,p}_{3} =
\frac{\pi^{2}}
{2q \sinh (\pi q)}
\left(
\left( \cosh^{2} (\pi q) + 1\right) \delta^{q+p} +
     2 \cosh     (\pi q)
\frac{\Gamma\left( 1 + l + i q\right)}
{\left( 1 + l + i q\right)}  \delta^{q-p}
\right)
$$
Reference: Orthogonality relations for the associated Legendre functions of
imaginary order, eqns 1.10, 3.25

The orthogonality relationships for the associated Legendre functions of the second kind with imaginary argument $Q^{m}_{n}(i x)$ with integer indices
$$
 \int_{\infty}^{\infty} Q^{k}_{m}(i x) Q^{k}_{n}(i x) dx =
\begin{cases}
  (2m)! \pi \left( \prod^{k}_{i=m+2} (m+1)(m-i+1)\right) \delta^{m}_{n} & k > m + 1 //
  (2m)! \pi  \delta^{m}_{n} & k = m + 1 //
\end{cases}
$$
with $k\in\mathbb{Z}_{+}$, $l\in\mathbb{N}$,$k>m$, and $x\in\mathbb{R}$.

ArXive reference: Orthogonality of the Ferrers' Associated Legendre
Functions of the Second Kind with Imaginary
Argument


text:
Q: Unable to retrieve saved image in flutter (issue reproducible only on iOS) I'm saving the image using SQflite, when I restart app from scratch I couldn't locate the image file again.
Below is the code for your reference.
  File _storedImage;

  Future<void> _takePicture() async {
    final imageFile = await ImagePicker.pickImage(
      source: ImageSource.gallery,
      maxWidth: 600,
    );
    if (imageFile == null) {
      return;
    }
    setState(() {
      _storedImage = imageFile;
    });
    final appDir = await syspaths.getApplicationDocumentsDirectory();
    final fileName = path.basename(imageFile.path);
    final savedImage = await imageFile.copy('${appDir.path}/$fileName');
    widget.onSelectImage(savedImage);
  }

Below is the exception details for your reference.
════════ Exception caught by image resource service ════════════════════════════
The following FileSystemException was thrown resolving an image codec:
Cannot open file, path = '/Users/*****/Library/Developer/CoreSimulator/Devices/C561CB20-67D1-4188-996C-8B06CFB483A9/data/Containers/Data/Application/0A5D4A4F-3B4B-41E5-AFBA-B1A99C2CBFDB/Documents/image_picker_6231C3D6-D4D4-4962-861B-0792D42D2C24-78611-000007A4CC408DD4.jpg' (OS Error: No such file or directory, errno = 2)

When the exception was thrown, this was the stack
#0      _File.open.<anonymous closure>  (dart:io/file_impl.dart:364:9)
(elided 13 frames from package dart:async)
Path: /Users/*****/Library/Developer/CoreSimulator/Devices/C561CB20-67D1-4188-996C-8B06CFB483A9/data/Containers/Data/Application/0A5D4A4F-3B4B-41E5-AFBA-B1A99C2CBFDB/Documents/image_picker_6231C3D6-D4D4-4962-861B-0792D42D2C24-78611-000007A4CC408DD4.jpg

A: Xcode update seem to have fixed the issue! weird though :-P
Thanks for all of you, who tried finding a solution to this :)


text:
Q: PHP form post HTML special characters as plain text I have a basic form to submit comments to a database through PHP and display them on the page via AJAX, and everything works OK but the problem is that simple HTML code like  or
Hi!
 is displayed valid HTML and is executed by the client as such.
After doing research I've found that the PHP htmlspecialchars() function can prevent XSS code from being executed:
<form method="post" action="<?PHP echo htmlspecialchars($_SERVER['PHP_SELF']);?>" onsubmit="return post();">
    <textarea id="comment"></textarea>
    <input type="submit" value="Submit">
</form>

the PHP document that processes the form is this:
<?php

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

$host="localhost";
$username="user";
$password="password";
$databasename="comments";

$connect=mysql_connect($host,$username,$password);
$db=mysql_select_db($databasename);

if(isset($_POST['user_comm']))
{
  $comment = mysql_real_escape_string($_POST['user_comm']);
  $insert=mysql_query("insert into comments values('','$comment',CURRENT_TIMESTAMP)");

  $id=mysql_insert_id();

  $select=mysql_query("select comment,post_time from comments where comment='$comment' and id='$id'");

  if($row=mysql_fetch_array($select))
  {
      $comment = mysql_real_escape_string($row['comment']);
    $time=$row['post_time'];
  ?>

<?php echo stripslashes($comment);?>

<?php echo date('l d M Y - H:i a', strtotime($time));?>

  <?php
  }
exit;
}

?>

But in my case that isn't working and Javascript code is still executed by the client after the message has been sent. How can I display HTML special characters as plain text on the comments to prevent that?

A: htmlspecialchars() replaces special characters by their html code, like < by <
Protecting the action of the form has no sense, protect the display of your comment :

<?php echo htmlspecialchars($comment);?>

A: htmlspecialchars() replaces HTML special characters with an encoded version, for example < is replaced by <
As well as protecting your form's "action", you also need to use this to encode any input variables whose data might later be injected into HTML on the screen.
A good time to encode the values would be just before you insert them into the database, so that any time you come to use that data later it can no longer be a danger.
So in your example for you just have the "comment" field, therefore you can encode it like this just before you prepare it for database insertion:
$comment = htmlspecialchars($_POST['user_comm']);
$comment = mysql_real_escape_string($comment);

N.B. Please heed my comment (in the main comments section, above) regarding the use of mysql_query and associated functions. You should not be using these for any new code, and for old code you should be planning to replace it. Switch to a supported library as soon as possible.


text:
Q: Count number of times in a row strings appear in a vector, then removing them if count is below a Threshold I am currently trying to remove the "noise" from a Vector and Can't find an elegant way to do it. I currently have a Vector of strings, and another vector representing the number of times in a row those strings occur.
For some reason I just can't seem to get it working. The method I created to do this is shown below.
public static void correctDisturbance(Vector<String> names, Vector<Integer> lengths, int lengthGuard){

    int guard = lengths.size();

    int total = 0;

    for(int i = 0; i < guard; i++)
    {
        if(lengths.elementAt(i) <= lengthGuard)
        {
            int newTotal = total + lengths.elementAt(i);

            while(total < newTotal)
            {
                System.out.println("Removing: " + names.elementAt(newTotal));
                names.removeElementAt(newTotal);
                newTotal--;
            }
            lengths.removeElementAt(i);
            guard--;
        }
        else
        {
            total += lengths.elementAt(i);
        }
    }

It removes some of the ones I need but not others. I have the threshold set to 5.
An example of the contents of the lengths vector is this:
[15, 15, 1, 15, 2, 1, 1, 2, 1, 3, 1, 2, 1, 5, 1, 4, 1, 1, 3]
Thanks in advance for any help.

A: Use a Hash instead of a Vector to keep the count. The key is the line and the value is the count.
And btw use ArrayList instead Vector, if you need you can make it thread safe.

A: There was very little wrong with your method. Here is the debugged version:
public static void correctDisturbance(List<String> names,
        List<Integer> lengths, int lengthGuard) {
    int guard = lengths.size();
    int total = 0;
    for(int i = 0;i < guard;i++) {
        if (lengths.get(i) <= lengthGuard) {
            int newTotal = total + lengths.get(i);
            while( total < newTotal ) {
                newTotal--; // LINE MOVED
                System.out.println("Removing: " + names.get(newTotal));
                names.remove(newTotal);
            }
            lengths.remove(i);
            i--; // LINE ADDED
            guard--;
        } else {
            total += lengths.get(i);
        }
    }
}

As you can see only two changes were required. First the newTotal had to be decremented before used because Java arrays and lists are zero based. Second when you removed an item from the lengths list, you had to decrement i as well so you would not miss an entry.


text:
Q: not hiding the textarea when uncheck the checkbox i have the code given below:
its working fine when i click on the rejected checkbox it shows the textarea but its not hiding it when i uncheck the rejected checkbox.
Please help....

Accepted: <input type='checkbox' name='ar' value='Accepted' />
Rejected: <input type='checkbox' name='ar' value='Rejected' onClick="return checkValue(this)" />

    Rejection Detail:

    <textarea width="900" style="width: 910px; resize:vertical;" name="rejectdt"><?php if( $_SERVER['REQUEST_METHOD'] === 'POST' ) { print_r($_POST['rejectdt']); } ?></textarea>

A: HTML:
 Rejected: <input type='checkbox' name='reject' id='reject' value='Rejected' onClick="checkValue()" />

function :
function checkValue()
{

if(document.getElementById("reject").checked == true)
 {
   document.getElementById('xtraInfo').style.display='block';
 }
else
 {
   document.getElementById('xtraInfo').style.display='none';
 }
}

A: document.forms["frmcnt"]["ar"].checked returns true or false, change to:
if (rejected) {
    document.getElementById('xtraInfo').style.display='block';
} else {
    document.getElementById('xtraInfo').style.display='none';
}

Update:: since you are doing onClick="return checkValue(this)", do
function checkValue(obj) {
    var rejected=obj.checked;

    if (rejected) {
       document.getElementById('xtraInfo').style.display='block';
    } else {
       document.getElementById('xtraInfo').style.display='none';
    }
}

Demo:: jsFiddle

A: The equal to conditional statement needs to have another equal sign. Also, you left a semi-colon off in the line that you defined the rejected variable
function checkValue() {
    var rejected = document.forms["frmcnt"]["ar"].checked;

    if(rejected == 'true') {
        document.getElementById('xtraInfo').style.display='';
    } else {
        document.getElementById('xtraInfo').style.display='none';
    }
}

A: There may be other problems with your code, but I did notice that you are doing
if (rejected = 'Rejected') {

instead of
if (rejected == 'Rejected') {

(two equal signs are required to check against a value)

A:

    <textarea width="900" style="width: 910px; id="TextContent" resize:vertical;" name="rejectdt">


text:
Q: Positive averages of different tabs I have weather information of a lot of weather stations over 5 years. There is one file for each station, for each year, and each year is divided in 12 tabs; one for each month. The measuring was done every 10 minutes so there is a huge number of data (imagine one measurement every 10 minutes of each month). Im trying to make an average of the weather information of each month of only positive numbers with the function =averageif(range,">0",range) on another tab, say one after the month "December". Do you know how to program that function so that it starts from the cell B2 to the last value of that column when working on another tab, not on the tab that has the values?
Thanks in advance!
Regards.

A: If B1 is just a header of text your equation will ignore the text and calculate everything else.  Applying the formula from another tab is straight forward.  On the tab you want the equation select a cell and enter the equal sign = then click the tab you want and select the column you want.  Excel will do everything else.
Here is what it should look like:
=AVERAGEIF(Sheet1!B:B,">0",Sheet1!B:B)

My test data look like this:

Result on the other tab looks like this:

EDIT
If your header row is a number that messes up the average you can ignore the first row like this:
=AVERAGEIF(Sheet1!B2:OFFSET(Sheet1!B2,COUNT(Sheet1!B:B),0),">0",Sheet1!B2:OFFSET(Sheet1!B2,COUNT(Sheet1!B:B),0))


text:
Q: Does $nx=0$ imply $x\in \mathbb{Z}_n$? For some reason, I am having trouble convince myself that $nx=0$ implies $x\in\mathbb{Z}_n$.
I know if $x\in\mathbb{Z}_n$ that $nx=0$ is true. But does the converse hold?  Here is what I am thinking...

I know if $x\sim 0$ in $\mathbb{Z}_n$ iff $n|(x-0)$. If $n|(x-0)$, then $n|x$. This means $x=nb$ where $b\in\mathbb{Z}$. Then
\begin{eqnarray}
x&=&nb\\
x^2&=&nxb\\
x^2&=&0\cdot b\\
x^2&=0
\end{eqnarray}
Because $x^2=0$, we know $x=0$. Hence $x\in\mathbb{Z}_n$. Right? I feel like this argument is correct. I am just looking for confirmation.


text:
Q: smoothening image boundaries for NxN kernel size In my open source project ( https://github.com/mmj-the-fighter/GraphicsLabFramework ) i am trying to add a image smoothening box filter for NxN kernel size. I have already implemented the algorithm for 3x3 kernel size. As you can see from the source code below I am not processing the image for edges. Using this logic, for a 5x5 kernel size I have to skip two rows or columns from top, right, bottom and left of the image. So the edges will not be blurred. Is there any other solution.
Here is the code:
/*applying a box filter of size 3x3*/
void blur_image(unsigned char *img, int width, int height)
{
    int n = width * height;
    int i, j;
    int r, g, b;
    int x, y;
    float v = 1.0 / 9.0;
    float kernel[3][3] =
    {
        { v, v, v },
        { v, v, v },
        { v, v, v }
    };
    unsigned char* resimage = (unsigned char *)malloc(width * height * 4 * sizeof(unsigned char));
    memcpy(resimage, img, width*height * 4);

    for (x = 1; x < width - 1; ++x) {
        for (y = 1; y < height - 1; ++y) {
            float bs = 0.0;
            float gs = 0.0;
            float rs = 0.0;
            for (i = -1; i <= 1; ++i) {
                for (j = -1; j <= 1; ++j){
                    float weight = (float)kernel[i + 1][j + 1];
                    unsigned char* buffer = img + width * 4 * (y + j) + (x + i) * 4;
                    bs += weight * *buffer;
                    gs += weight * *(buffer + 1);
                    rs += weight * *(buffer + 2);
                }
            }
            unsigned char* outbuffer = resimage + width * 4 * y + x * 4;
            *outbuffer = bs;
            *(outbuffer + 1) = gs;
            *(outbuffer + 2) = rs;
            *(outbuffer + 3) = 255;
        }
    }
    memcpy(img, resimage, width*height * 4);
    free(resimage);
}


text:
Q: In Java, what is a shallow copy? java.util.Calendar.clone() returns "...a new Calendar with the same properties" and returns "a shallow copy of this Calendar".
This does not appear to be a shallow copy as answered here on SO.  That question is tagged language-agnostic, Java does not seem to follow the language agnostic definition.  As I step through the code I notice that the structure and the elements are copied to this new object, more than the language agnostic structure only.
In Java, what is a shallow copy?
How does it differ from a Java deep copy (if that exists)?

A: A shallow copy just copies the values of the references in the class. A deep copy copies the values. given:
class Foo {
  private Bar myBar;
  ...
  public Foo shallowCopy() {
    Foo newFoo = new Foo();
    newFoo.myBar = myBar;
    return newFoo;
  }

  public Foo deepCopy() {
    Foo newFoo = new Foo();
    newFoo.myBar = myBar.clone(); //or new Bar(myBar) or myBar.deepCopy or ...
    return newFoo;
  }
}

Foo myFoo = new Foo();
Foo sFoo = myFoo.shallowCopy();
Foo dFoo = myFoo.deepCopy();

myFoo.myBar == sFoo.myBar => true
myFoo.myBar.equals(sFoo.myBar) => true
myFoo.myBar == dFoo.myBar => **false**
myFoo.myBar.equals(dFoo.myBar) => true

In this case the shallow copy has the same reference (==) and the deep copy only has an equivalent reference (.equals()).
If a change is made to the value of a shallowly copied reference, then the copy reflects that change because it shares the same reference. If a change is made to the value of a deeply copied reference, then the copy does not reflect that change because it does not share the same reference.
C-ism
int a = 10; //init
int& b = a; //shallow - copies REFERENCE
int c = a;  //deep - copies VALUE
++a;

Result:
a is 11
*b is 11
c is 10

A: A shallow copy is a copy of the reference pointer to the object, whereas a deep copy is a copy of the object itself.  In Java, objects are kept in the background, what you normally interact with when dealing with the objects is the pointers.  The variable names point to the memory space of the object.  A shallow copy is made when you set one variable equal to another like so:
Object B = A;

A deep copy could be made by getting the properties of object A and putting them in a new object B.
Object B = new Object(A.getProperty1(), A.getProperty2()...);

This affects program behavior in that if you make a shallow copy and perform a task on it, that affects all shallow copies of the object.  If you make a change to a deep copy, only that copy is affected.  I hope this is detailed enough for you.

A: The 1.6 docs document Calendar.clone as "Creates and returns a copy of this object." A literal shallow copy as specified by Object.clone wouldn't make any sense. Java uses the term "shallow copy" in a fairly typical sense.

A: Shallow copy is a just a set of pointers to the same memory locations. Actually it does not create a real copy so the memory usage is lower.
In a case of a deep copy, an exact copy of the memory segment is created and pointers are set to new memory locations. So theoritically the memory consumption should be twice in this case.

A: It appears to be a mistake in the documentation.  I don't see how anything that Android's Calendar.clone method does meets the typical definition (in Java or otherwise) of a "shallow copy".

A: SHALLOW COPY is PASS-BY-REFERENCE ...
DEEP COPY is PASS-BY-VALUE …
The context is different, but the process is exactly the same. First remember that in Java method calling, primitives are passed by value, while objects are passed by reference (in other languages, objects may also be passed by value). Now, in Java, when the caller passes a primitive to the called method, the called method simply clones it as a new local variable, which is a deep copy. While if an object is passed, the called method will only make a new local reference to the same object, which is shallow copy. If you understand calling, you understand deep/shallow copy, & vice versa.

A: Where are you getting this documentation?
The official Java 6 docs on java.sun.com simply have Calendar.clone() returning a copy of the object.  No mention of shallow.
More generally, a shallow copy in Java is one where you get a new object reference but the new object holds (directly or indirectly) references to data in the original.
For example:
class MyClass{
  private List<Integer> innerList;

  public MyClass(List<Integer> list) { innerList = list; }

  //Some code...

  public Object clone(){
    return new MyClass(innerList);
  }
}

returns a shallow copy in its clone().

A: First of all, the Javadoc of ArrayList is somewhat wrong if we are talking about one-dimensional arrays, as it uses the method copyOf in Arrays. So clone() gives back a one-dimensional copy, at least since 1.5 (I didn't test further)! So that's what "shallow" means in Java: one-dimensional
You can read more here: http://www.javapractices.com/topic/TopicAction.do?Id=3. So clone() is no shallow copy! If you want a real shallow copy of a one-dimensional array, just reference it:
Array a = new Array();
Array b = a;                    //a is only a shallow copy, nice for synchronisation

Arrays in Java are tricky, also because Java does pass-by-value, but the values of arrays are only their pointers! In the other hand this allows us to synchronize the objects, which is a great thing. Still, there are some problems if you use arrays within arrays (or ArrayLists), because a clone() of the container array (or ArrayList) won't copy their values, only their references! So you simply shouldn't put any arrays into an array, you should only deal with objects in an array!
And Javadoc is difficult to understand sometimes, so give testing a try...
Have fun!

A: A shallow copy just copies the object reference into the target reference. It does not create a new object on the heap.
By default, Java does shallow cloning using clone() function.
To get a new object on the heap, one has to perform deep cloning which can be implemented by Serialization and De-serialization.

A: In a shallow copy,the clone object has a copy of primitive values but the object references refer to the same objects as the original copy.
Shallow Copies have a significant drawback, cloned object and original copy refer to the same address object. Any change that cloned object makes in address object will also be reflected in original copy, which is an unwanted behaviour. What we really wanted is two separate copies of user object. Deep copying comes to our rescue for this kind of situation.
Deep copying clones not just the  primitive values, it also creates copies of object references.
You can have a look at working example on this at here :https://codingninjaonline.com/2017/11/09/deep-vs-shallow-copy/

A: Shallow Copy : In this cloning any changes to Cloned Object is reflected to Original Object also.
Deep Copy : In this cloning a separate cloned memory is alloted which means any changes to cloned object will not be reflected to original object.


text:
Q: can lm_sensors still damage hardware? I just ran lm_sensors and foolishly typed YES to everything.. This is a brand new PC I've built and I'm worried I've damaged something now. Then I read that it can overwrite EEPROM and damage hardware from probing i2c. This is a recent desktop chipset based on Intel series 300 (b360) with an i3-8100.
Is lm_sensors still a risk? I'm kinda freaking out here, how would I even know if something was damaged?


text:
Q: Increasing image size after uploading React js + Django I have a react frontend backed by Django rest API. I use react-cropper to crop and upload images. When I upload images, the image size gets increased. Ex:- When I upload 149.5kb image it increases to 1.5MB. I notice that size in my API calls. But when I directly upload images to Django admin it remains in the same size. I can not figure out the exact reason for this. Photos are saved in DIgitalOcean Spaces.
Cropper
<div className="cropper_be">
                                    <Cropper
                                        style={{ height: '100%', width: "100%" }}
                                        initialAspectRatio={16 / 9}
                                        aspectRatio={16 / 9}
                                        preview=".img-preview"
                                        src={image}
                                        viewMode={1}
                                        guides={true}
                                        minCropBoxHeight={10}
                                        minCropBoxWidth={10}
                                        background={false}
                                        responsive={true}
                                        autoCropArea={1}
                                        checkOrientation={false}
                                        onInitialized={(instance) => {
                                        setCropper(instance);
                                        }}
                                    />
                                </div>

//function for base64 to blob
    const b64toBlob = (b64Data, contentType='', sliceSize=512) => {
        const byteCharacters = atob(b64Data);
        const byteArrays = [];

        for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
          const slice = byteCharacters.slice(offset, offset + sliceSize);

          const byteNumbers = new Array(slice.length);
          for (let i = 0; i < slice.length; i++) {
            byteNumbers[i] = slice.charCodeAt(i);
          }

          const byteArray = new Uint8Array(byteNumbers);
          byteArrays.push(byteArray);
        }

        const blob = new Blob(byteArrays, {type: contentType});
        return blob;
    }


text:
Q: android update view at runtime I have a custom imageView and I change it's background drawable at runtime. Images don't have the same height and when a resource have higher height, the top margin does not update itself (if top margin is 2 dp and after I set another resource as background which is higher with 2 do, the top margin becomes 0 because layout hasn't updated). How to force layout to update itself at runtime and not schedule a layout pass in the future? I've tried with:
imageView.invalidate()
imageView.requestLayout()
imageView.forceLayout()
parent.updateViewLayout(imageView, layoutParams)

but none of these methods works. The layout is updated only after I switch device's orientation. Do you have any ideas how to force layout to be refreshed at runtime?


text:
Q: Implement HTTP to HTTPs redirect preserving Google Analytics referrer Google Analytics shows a suspicious amount of (direct)/(none) as source for my website. I know that when an HTTP website is linked from an HTTPs website, the referrer information is lost.
In my case, I have a secure website https://example.com and I use the following Apache settings to forward users in case they try to access the non-secure version:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
RewriteRule ^([^\.]+)$ $1.html [NC,L]

Of course, I cannot control whether an external (secure) website links me via http or https.
Now my questions are:

*

*why referrer information is lost from https to http?

*if an external website links me as http://example.com, will this be showed as direct in analytics?

*is there a way to redirect the user to the secure website, while preserving the referrer?

A: This is due to security:

Because the source of a link might be private information or might reveal an otherwise private information source, it is strongly recommended that the user be able to select whether or not the Referer field is sent. For example, a browser client could have a toggle switch for browsing openly/anonymously, which would respectively enable/disable the sending of Referer and From information.
Clients SHOULD NOT include a Referer header field in a (non-secure) HTTP request if the referring page was transferred with a secure protocol.
Authors of services which use the HTTP protocol SHOULD NOT use GET based forms for the submission of sensitive data, because this will cause this data to be encoded in the Request-URI. Many existing servers, proxies, and user agents will log the request URI in some place where it might be visible to third parties. Servers can use POST-based form submission instead

This behaviour is better explained here:

When going between HTTP and HTTPS the HTTP spec says that a referer header should NOT be sent (see 15.1.3 in RFC2616). The spec doesn't say what should happen between HTTPS pages however.

Your question has been tackled on StackOverflow before. See this one.
Some fixes proposed:
1) For some browsers, you could simply add a new metatag to your page: <meta name="referrer" content="always"> or <meta name="referrer" content="origin">. Learn more about this meta. Differences in browser support can be found here.
2) You could use an intermediary page which tracks the pageview while the referrer is there (http): http://page.com/reditect?url=https://page.com/finalpage.htm where /redirect will make a call to Analytics to track finalpage.htm with referrer included before redirecting there. See full explanation.
3) You could add a parameter on the 301 redirect and override the referrer information with ga('set', 'referrer', 'http://example.com');. See full explanation. This could be combined with the previous point and avoid tracking on the intermediary page, but gather the data of the referrer.


text:
Q: Typescript compiling vendor, exclude wont work I started trying TypeScript but I got a little weird issue.
I first started trying with a fresh Laravel installation and made some changes to start writing TypeScript. Everything compiled fine and I loved it.
Now I am trying to implement it in my hobby project but I got a weird issue.
I get this error when I try to compile: (and many more in vendor)
ERROR in /someLongStuff/vendor/symfony/translation/Tests/fixtures/resources.ts
It is failing cause it is trying to compile something from Symfony. This is weird cause my fresh installation should have the same issue, but it doesn't.
This is my webpack.mix.js file
// TYPESCRIPT
    .webpackConfig({
        module: {
            rules: [
                {
                    test: /\.tsx?$/,
                    loader: "ts-loader",
                    exclude: [
                        /node_modules/,
                        /vendor/ <-- try to exclude vendor
                    ]
                },
            ],
        },
        resolve: {
            extensions: ["*", ".js", ".jsx", ".vue", ".ts", ".tsx"]
        }
    })

And this is my tsconfig.json:
{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es6",
        "noImplicitAny": false,
        "sourceMap": false
    }
}

Any one?

A: Try explicitly excluding vendor in your tsconfig.json file:
"exclude": [
    "node_modules",
    "vendor",
    "**/*.spec.ts"
]


text:
Q: How to write subquery in From clause in django ORM I wnat to write this query using django orm
SELECT depname, empno, salary, enroll_date
FROM
  (SELECT depname, empno, salary, enroll_date,
          rank() OVER (PARTITION BY depname ORDER BY salary DESC) AS pos
     FROM empsalary
  ) AS ss
WHERE pos < 3;

My current ORm query
EmpSalary.objects.values('depname', 'empno', 'salary', 'enroll_date').annotate(
pos= Window(
                expression=RowNumber(),
                partition_by=[F('depname')],
                order_by=F('salary').desc(),
            )
)

The above ORM queryset roughly translates to the inner query
SELECT depname, empno, salary, enroll_date,
          rank() OVER (PARTITION BY depname ORDER BY salary DESC) AS pos
     FROM empsalary

I want to know how i can get the whole inner query in the FROM clause of the outer query.

A: Indeed, it's not possible to use a Window query inside a WHERE clause. So instead, use a Subquery:
from django.db.models import OuterRef, Subquery

top_salaries = EmpSalary.objects.filter(
    depname=OuterRef('depname')
).order_by('-salary')[:3]
result = EmpSalary.objects.filter(
    pk__in=Subquery(top_salaries.values('pk'))
).values('depname', 'empno', 'salary', 'enroll_date')


text:
Q: C# - How to align a user input plus a place holder text on right Im a noob and i want make a letter format for this im getting name,contactno  and adress and i want to show the user input with the place holder before them in the right of the screen, i tried it useing padRight but there is a issue , as im giving a fix number , when the user input is long then the remaing input shifts to the secong line
 Console.WriteLine(" ".PadRight(100) + "Name: " + name);
    Console.WriteLine(" ".PadRight(100) + "Contact No: " + contact_no);
    Console.WriteLine(" ".PadRight(100) + "Address: " + adresss);

and if there is a better way of doing this please let me know


text:
Q: Haskell `hlint`, how can I add hint for wrong indentation, trailing spaces and etc? I tried to use hlint package, but it gives no warnings or configuration for:

*

*trailing spaces

*last empty line

*spaces between arguments

*restrict tab indentation

*redundant lines

and other lint option stuff that relates to spaces/tabs and empty lines
I don't see how "Add new hint" can help me with this

A: From https://github.com/ndmitchell/hlint/issues/522:

There is currently no support in HLint for issues which are about spacing or indentation. There are a few tools that deal with such concerns, search Haskell style checker for a few. I think HLint is probably better remaining free from whitespace concerns and letting other tools deal with them - I should probably link in the README to whatever the consensus is (I'm not sure)


text:
Q: Question about Lorentz invariant theory of gravitation A generalization of Newton's law of gravitation to a Lorentz invariant version by using an analogy with electromagnetism is possible. Several slightly different ways to do it are described in wikipedia. In addition to predicting the wrong amount in the precession of Mercury's perihelion, it also fails to predict the curvature of light by a large gravitational mass. I assume somebody could have tried to introduce some additional equation or terms to the current ones that describe the interactions between the electromagnetic and gravitomagnetic fields. But I could not find any reference to attempts in this sense. Is there any obvious reason about why this is not even worth being tried?

A: The introduction to this article in wikipedia explains why alternatives to general relativity fell by the way of mainstream research:

After general relativity (GR), attempts were made either to improve on theories developed before GR, or to improve GR itself. Many different strategies were attempted, for example the addition of spin to GR, combining a GR-like metric with a space-time that is static with respect to the expansion of the universe, getting extra freedom by adding another parameter. At least one theory was motivated by the desire to develop an alternative to GR that is completely free from singularities.
Experimental tests improved along with the theories. Many of the different strategies that were developed soon after GR were abandoned, and there was a push to develop more general forms of the theories that survived, so that a theory would be ready the moment any test showed a disagreement with GR.
By the 1980s, the increasing accuracy of experimental tests had all led to confirmation of GR, no competitors were left except for those that included GR as a special case. Further, shortly after that, theorists switched to string theory which was starting to look promising, but has since lost popularity. In the mid-1980s a few experiments were suggesting that gravity was being modified by the addition of a fifth force (or, in one case, of a fifth, sixth and seventh force) acting on the scale of meters. Subsequent experiments eliminated these.
Motivations for the more recent alternative theories are almost all cosmological, associated with or replacing such constructs as "inflation", "dark matter" and "dark energy". Investigation of the Pioneer anomaly has caused renewed public interest in alternatives to General Relativity.

There are researchers who were  working on similar directions  after 1980.It certainly is not a mainstream research  path .

A: Gravitoelectromagnetism (GEM) is of some use for linearized gravity, i.e., a very weak field and slow speeds. That's because linearized gravity leads to similar equations as EM, and you can manipulate some correspondences. But really it is not of great value, linearized gravity has its own methodology and adds non-linear terms that can also be tested. That's the so called parametrized post Newtonian formalism, and is used in for instance some of the gravitational wave modeling and analysis. A 2010 summary of it for linearized gravity is at http://aforrester.bol.ucla.edu/educate/Articles/Derive_GravitoEM.pdf, but as you can see from googling GEM (spelled out) there is little new work on it.
Some alternatives to GR continue to be possible, but in almost all cases they've either been disproven as more experimental data is obtained, or they Have been theories with free parameters that at this point may be adjusted to match the same observations GR predictions match, but which have had no new predictions observed.
An example is f(R) gravity, where R is replaced by an arbitrary function of R, in essence introducing an infinite number of free parameters. Similarly antes sense and K-essence introduce more free parameters to try to explain the cosmological constant, and they can adjust them to match the fact measurements so far. One problem with other gravitational theories is that they need to match both the near earth and earth based experiments/observations, which apply to weak fields and small distances, and observations about stronger fields and longer distances such as in cosmology. So they do some contortions.
So far no strong competitor, but those remain as possible changes to GR if we find some anomalies.
The Pioneer anomaly had the Pioneer staellite being just a bit slower than all the gravitational effects predicted. But it has been explained and accepted since 2012 as having been due to recoil from thermal radiation emitted non-isotropically y from the satellite, and more in the direction to slow it down. See https://en.m.wikipedia.org/wiki/Pioneer_anomaly.
See also wiki, with all the alternatives considered for that anomaly, at https://en.m.wikipedia.org/wiki/Pioneer_anomaly.
Of course, continuing looks at any similar anomalies in other spacecraft continue here and there, but not as a 'mainstream' research activity.
A very important and serious set of results has been coming from cosmological measurements, and just started recently from LIGO (gravitational radiation). The latter, in its first detection of a gravitational wave also analyzed results to test numerical GR predictions, and they all came through well - for instance it confirmed that what was observed was consistent with the No Hair Theorem for Black Holes, a results by Hawking and others from GR. Black Holes will remain as mysteries as long as we don't have a good and accepted theory of quantum gravity to understand what really happens on the horizons and beyond.
Cosmological results have confirmed various GR effects that had not been verified before, such as the integrated Wolfe Sachs effect.
The main concern with GR and cosmological observations remain the origin of dark matter and dark energy. Both are also issues for the standard Model since it would require some new particles (for dark matter), and some undefined physics as the cause of dark energy, thought to be the vacuum energy.
See wiki's https://en.m.wikipedia.org/wiki/Alternatives_to_general_relativity
for other alternatives it's the same rference as @Anna V's first reference. The article also talks about quantum gravity which are not really alternatives, but simply a quantum gravity that most of the time people try to reduce to GR in the low energy limit. We still don't have a good quantum gravity theory that has predicted anything new that was then observed.


text:
Q: Does this proof that $2\mathbb{Z}\not\cong 3\mathbb{Z}$ work? I'm trying to show $2\mathbb{Z}\not\cong 3\mathbb{Z}$ as rings. Suppose $\phi$ is an isomorphism. Then $\phi(2+2)=\phi(2\cdot 2)$, which implies $2\phi(2)=\phi(2)\phi(2)$. Then $2=\phi(2)$, which is impossible since $2\not\in 3\mathbb{Z}$. Is it this simple, or am I over stepping something?

A: your proof is correct, here I am writing in step by step,,Suppose their is a ring isomorphism $f:2\mathbb{Z}\rightarrow 3\mathbb{Z}$.
Then $f(2)=3n$ for some in integer $n$.
Now use the ring isomomorphism property that $f(a+b)=f(a)+f(b)$ and $f(a.b)=f(a).f(b)$
so $f(4)=f(2+2)=f(2)+f(2)=3n+3n$.
Also $f(4)=f(2)f(2)=3n\times3n=9n^2$
But then comparing the two expressions we have for $f(4)$, we obtain
$3n+3n=9n^2$ but this implies $n=0$ and we have $f(2)=0$ (since $f(2)=3n$ for some $n$ as we said above), however,
we have $f(0)=0$ for ring ismorphism,so no such $f$ can exist and we must conclude that $2\mathbb{Z}$ is NOT isomorphic to $3\mathbb{Z}$.


text:
Q: SQL Server improve query performance #Temp Table, Bulk insert I am working on an old auditing stored procedure that is taking a long time to get data causing timeouts on the system. We have managed to get the time down from over 20 minutes to running just over a minute, this is still too long.
I am running on SQL Server 2008 R2.
My question is is there anything I could do to improve the speed of the query? In particular the temporary tables and the a bulk insert statement.
SELECT
    dbo.[Audit Result Entry Detail].PK_ID,
    + every other value in the table (all values required)
INTO
    #temp5
FROM
    dbo.[Audit Result Entry Detail]

An INNER JOIN then occurs on dbo.[Audit Register] another select occurs and added to another temporary table #result is created.
Result temporary table gets the old and new result values for comparison. Below I have provided what event occurs on #temp5. Note these are just snippets; the stored procedure is way too big to post everything.
SELECT
    RED.[FK_RegisterID],
    total of a 106 rows are selected here :(
FROM
    #temp5 AS RED
LEFT JOIN
    #temp5 AS OLD ON RED.IdentityColumn = OLD.IdentityColumn
LEFT JOIN
    [Audit Register] AS REG ON REG.PK_ID = RED.FK_RegisterID

SELECT MAX(PK_ID)
OVER (PARTITION BY FK_RegisterID) AS MAX_PK_ID
FROM #temp5

DROP TABLE #temp5

The second part of my question is a bulk insert into this table created at the very top of the stored procedure
DECLARE @AuditOverView TABLE
(
   FK_RegisterID INT,
   Audit_Date DATETIME,
   ContextUser NVARCHAR(30),
   Original_Value NVARCHAR(255),
   New_Value NVARCHAR(255),
   Assay NVARCHAR(200),
   Inst NVARCHAR(40),
   LotLevel NVARCHAR(3),
   Lot_ExpiryDate NVARCHAR(10),
   Lot_Number NCHAR(50),
   Audit_Type NVARCHAR(10),
   Partnumber INT,
   [Type] NVARCHAR(50),
   SubType NVARCHAR(50)
 )

The insert statement below:
INSERT INTO @AuditOverView
    SELECT DISTINCT
        t.FK_RegisterID,
        t.Audit_Date,
        t.ContextUser,
        CONVERT(NVARCHAR, Original_Date_Run, 127) AS Original_Value,
        CONVERT(NVARCHAR, New_Date_Run, 127) AS New_Value,
        t.Assay AS 'Assay',
        Instrument AS 'Inst',
        '1' AS 'LotLevel',
        Lot1_Expiry_Date AS 'Lot_ExpiryDate',
        Lot1Number AS 'Lot_Number',
        t.Audit_Type,
        part_number AS Partnumber,
        'QC Result' AS [Type],
        'Result Date' AS SubType
    FROM
        #Result AS t
    INNER JOIN
        (SELECT MAX(Audit_Date) AS DATE, FK_RegisterID
         FROM #Result
         GROUP BY FK_RegisterID) dt ON t.FK_RegisterID = dt.FK_RegisterID
                                    AND t.Audit_Date = dt.DATE
    WHERE
        RTRIM(Lot1Number) != ''
        AND (CONVERT(NVARCHAR, Original_Date_Run, 120) != CONVERT(NVARCHAR, New_Date_Run, 120)
            OR t.Audit_Type = 'i'
            OR t.Audit_Type = 'd')

This insert statement occurs about 50 times and the only line changes occur are:
'Result Date' AS SubType
CONVERT(NVARCHAR, Original_Date_Run, 120) != CONVERT(NVARCHAR, New_Date_Run, 120)

I can provide more information if needed. Any help would be much appreciated to improve performance.


text:
Q: Add existing Azure Container Instance to VNET I have an existing ACI. Can I add it to a VNET and Subnet via Azure CLI/Azure cloud shell.

A: Unfortunately, this isn't possible right now from the CLI, the az container commands don't support patching / upgrading an existing container instance or container group for the network profile property
https://learn.microsoft.com/en-us/azure/container-instances/container-instances-update#properties-that-require-container-delete
If you are interested in not loosing the traffic going to your existing ACI, you should deploy a new ACI to a private VNET/Subnet and front both your containers using an applicationGW or Load Balancer on your new VNET/Subnet.
Once ready to make the move you should be direct all traffic to your ACI running in the VNET.


text:
Q: Why do we worry about overfitting even if "all models are wrong"? I am wondering why we care so much about overfitting. We know that statistical models are tools to tell us some information, but they are not even fully accurate.

A: The quote by Box is along the lines of "All models are wrong, but some are useful."
If we have bad overfitting, our model will not be useful in making predictions on new data.

A: As others have noted, the full quote is "all models are wrong, but some are useful."
When we overfit a data set, we create a model that is not useful. For instance, let's make up some data:
set.seed(123)
x1 <- rnorm(6)
x2 <- rnorm(6)
x3 <- rnorm(6)
x4 <- rnorm(6)
y <- rnorm(6)

which creates 5 variables, each a standard normal, each with N = 6.
Now, let's fit a model:
overfit <- lm(y~x1+x2+x3+x4)

The model has $R^2$ of 0.996. x2 has a significant p value and x4 is almost sig. (at the usual level of 0.05).
Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.54317    0.08887  -6.112   0.1032
x1           2.01199    0.14595  13.785   0.0461 *
x2           0.14325    0.08022   1.786   0.3250
x3           0.45653    0.08997   5.074   0.1239
x4           1.21557    0.15086   8.058   0.0786 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.1601 on 1 degrees of freedom
Multiple R-squared:  0.9961,    Adjusted R-squared:  0.9805
F-statistic: 64.01 on 4 and 1 DF,  p-value: 0.09344

It fits the data almost perfectly e.g. try

plot(predict(overfit),y)

But it's all random noise.
If we try to apply this model to other data, we will get junk.

A:
Why do we worry about overfitting even if "all models are wrong"?

Your question appears to be a variation of the Nirvana fallacy, implicitly suggesting that if there is no perfect model, then every model is equally satisfactory (and therefore flaws in models are irrelevant).  Observe that you could just as easily ask this same question about any flaw in a model:

*

*Why do we worry about maximum likelihood estimation even if "all models are wrong"?

*Why do we worry about standard errors even if "all models are wrong"?

*Why do we worry about cleaning our data even if "all models are wrong"?

*Why do we worry about correct arithmetic even if "all models are wrong"?
The correct answer to all such questions is that we should not make the perfect the enemy of the good --- even if "all models are wrong", a model that is less wrong is still preferable to a model that is more wrong.

A: The full quote is "All models are wrong, but some are useful". We care about overfitting, because we still want our models to be useful.
If you are familiar with the Bias-variance tradeoff, the "all models are wrong" statement is roughly equivalent to saying "all models have non-zero bias". Overfitting is the issue that  while we can increase the number of parameters in a model to reduce the bias, typically the more parameters we have, the more variance there will be in our estimate. A useful model is one that balances between being flexible enough to reduce the bias, but not so flexible that the variance is too high.

A: A Citroën 2CV is, in many respects, a poor car. Slow, unrefined and cheap. But it is versatile and can operate effectively on both paved road and freshly ploughed fields.
An F1 car by comparison, is seen as the pinnacle of automotive engineering. Fast, precise and using only the finest components. I wouldn't fancy driving one across an open field though.
The 2CV has general applicability, while the F1 car only has very specific applicability. The F1 car has been overfitted to the specific problem of going round a racetrack as quickly as possible with the benefit of a team of professional engineers to monitor, assess and problem solve any issues that may arise from high performance operation.
Similarly, an overfitted model will perform well in situations it is overfit, but poorly (or not at all) elsewhere. A model with general applicaility will be more useful if it will be exposed to different environments out of your control even if it is not as good as specific models.

A: Every model has an error.  The best model is that which minimizes the error associated with its predictions.  This is why models are typically constructed using only a proportion of the data (in-sample), and then applied to the remaining 'out of sample' data set.  An over-fitted model will typically have a greater prediction error in practice than a well formulated one.  In addition, a model should be intellectually robust: there is no point constructing a model that works in one 'regime' if it does not work at all in the event of regime change.  Such a model might appear to be very well formed until such time as the regime changes because essentially such a model has been constructed 'in-sample'.  Another way of saying that is that the model's expected error must be well formulated too.  There is also the matter of 'Occam's Razor', which is a philosophical idea that essentially the model should be the simplest possible, using the least number of variables required to describe the system being modelled.  This serves as a useful guide, rather than a set-in-stone rule, but I believe that this is the idea behind using the 'adjusted R squared' rather than the R squared, to adjust for the natural improvement in fit associated with using more variables (e.g. you would have perfect fit, an R squared of 100% if you had a separate variable for every piece of data!).  It is also an idea that should be applied to modern ML techniques: throwing e.g. thousands of variables at an ML algorithm is dangerous unless you have millions of pieces of data (and even then ... you might be better off transforming your data to reduce the number of variables first).  One final point: every model requires belief.  Even our laws of Physics are based on observation, and indeed they have required modification as we moved from Newtonian physics into the realms of the very small (Quantum mechanics) and the very large (General Relativity).  We cannot say with absolute certainty that our current laws of Physics will hold in the future, or even in the past (e.g. around the time of the big bang).  But appealing to our philosophical belief in Occam's razor results in us accepting these models and ideas because they are the simplest models yet devised that fit our observations and data.
In summary, there are no hard and fast rules.  Imagine a complex (chaotic?) dynamical system, for example, the global economy.  You might construct a well-formed model that works well for a short period of time.  But 'regime change' is a very real issue: the economic system is highly complex and non-linear, and there are far more variables than you can measure, that might be of no consequence in the in-sample regime, but of huge significance in another 'regime'.  But within your short, essentially in-sample, period, you might find that linear regression works quite well.  Common sense should prevail: sometimes a very complex model is required, but it should be heavily caveated if the error associated with its predictions is unknown.
I'm sure that a proper statistician can give a much better answer than this, but since none of the above points seem to have been made yet, I thought that I would stick my neck out ...

A: All models are wrong, but some are less wrong than others.
Overfitting generally makes your model more wrong in dealing with real-world data.
If a doctor were to try to diagnose whether you have cancer, would you rather have them be wrong 50% of the time (very wrong) or 0.1% of the time (much less wrong)?
Or, let's say you give away something for free if your model predicts this will lead to the customer buying something later. Would you rather give away many things for free without this making a difference to whether customers buy things later (quite wrong) or have most customers come back to buy things later (less wrong)?
Clearly less wrong is better.


text:
Q: Unable to find user data from a windows 10 (home) disk using Knoppix Wife's laptop no longer boots after a failed windows (home x64) 10 update--bluescreen.   I'm able to boot it with a Knoppix live USB thumbdrive.  However when I mount the ntfs filesystem holding C:, I only see Default, Public, and desktop.ini in what would have been c:\Users.
I've also tried a few searches using find in that filesystem for keywords of files/directories she would have had with out any luck.
Is anyone able to point me in the right direction of where it might be hiding?
Thank you in advance


text:
Q: getting Null values in save method
Possible Duplicate:
sendemail method not working

@future(callout=true)
  public static void sendEmail(string emailcontentbody,string useremail,string Template,string subject){
   integer statuscode;
      Messaging.singleEmailMessage email1 = new Messaging.singleEmailMessage();

       list<Designer_Content_Data__c> emailcontentinfo = [select Mail_Content_Data__c from Designer_Content_Data__c where Designer__r.name =:Template ];
       system.debug('emaillidd'+Designer__c.name);
         for(Designer_Content_Data__c econtent:emailcontentinfo)
              {
                 emailcontentbody+=econtent.Mail_Content_Data__c;
              }
     system.debug('emaillll'+emailcontentbody);
       email1.setSenderDisplayName('CompanyName');
       email1.setHtmlBody(emailcontentbody);

      email1.setSubject(Subject);

       email1.setToAddresses(new string[] {useremail});

      try{
      Messaging.sendEmailResult[] res = Messaging.sendEmail(new Messaging.singleEmailMessage[]{email1});
       system.debug('resulttt'+res);
        for(Messaging.sendEmailResult result:res)
                 {
                        if(result.isSuccess()==true)
                        {
                           statuscode=0;
                        }else{
                           statuscode=1;
                        }
                 }

               }catch(EmailException e){
                    statuscode=1;
               }
     //Messaging.sendEmail(new Messaging.singleEmailMessage[] {email1});

  }

      public void Save()
       {
          if(xmlPaymentMethod.Paymenttype=='Invoice'){
 Designer_Content_Data__c emailcontentinfo = [select Mail_Content_Data__c from Designer_Content_Data__c where Designer__r.name =:Template limit 1 ];
         sendEmail(emailcontentinfo.Mail_Content_Data__c,template,billing.billingemail,'response');
            system.debug('sendemailllllll'+emailcontentinfo.Mail_Content_Data__c +template +billing.billingemail);

       }
    }

Getting all values in save method and getting exception as System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out

A: sendEmail is declared as a void return method - i.e. returns nothing.
Morever its a @future call, so it isnt in the same execution context, you can't expect a return value from a future method anyways, as it starts a new thread of execution.
If you wish to check what its doing, I'd suggest setting up Debug Logs (Setup > Monitoring > Debug Logs) and trace the flow there.


text:
Q: How to check Multiple FileType condition in S3 preSignedURL s3.createPresignedPost({
    ...
    Bucket: bucketName,
    Fields: {
      Key: fileName,
    },
    Conditions:[
      ['eq','$Content-Type',"text/csv"]
      ['eq','$Content-Type',"text/xls"]
      ['eq','$Content-Type',"text/xlsx"]
    ],
    Expires:100
    ...
})

is it a valid condition to allow uploading csv, xls and xlsx through presignedURL. if not what is the correct way to allow the multiple file types upload through presignedURL


text:
Q: Solr basic auth by collection My question is quite simple but I'm not able to make Solr Basic Authentication Plugin to run as I think it should work.
In details : I'm running a single node instance of Docker Solr 7. I've created two cores, and a "manager" role for each one (using solr API). My security.json file look like that
{
   "authentication":{
      "blockUnknown":true,
      "class":"solr.BasicAuthPlugin",
      "credentials":{
         "solr":"KzdeDy9vIPliG3IsrvZJJt5L8LJQsK+o8fyTQ4g5b8g= rNwIT3FVvt6dqfRTFzNfehMcuGXaG1uipAVVJ71zgXw=",
         "sandbox2":"Yyz547gwtwHBJkWl3AdYn5wUKZX28JMjm5J6pI4enBY= 7idFe+baqhDzjOPR5Q9N3hS/0kCrWoZFdfwEl0zD298=",
         "sandbox1":"b/my6RlkYNzh11MjU8M16aYbcXRCjU9vbXH8kUnuWw4= B3Mpuenz0JtdWlQ5FMg1wv/1TtoJ6n3IILeVhgZvga0="
      },
      "":{
         "v":0
      }
   },
   "authorization":{
      "class":"solr.RuleBasedAuthorizationPlugin",
      "permissions":[
         {
            "name":"security-edit",
            "role":"admin",
            "index":1
         },
         {
            "collection":"sandbox2",
            "role":"sandbox2_manager",
            "name":"sandbox2.manager",
            "index":2
         },
         {
            "collection":"sandbox1",
            "role":"sandbox1_manager",
            "name":"sandbox1.manager",
            "index":3
         }
      ],
      "user-role":{
         "solr":"admin",
         "sandbox2":"sandbox2_manager",
         "sandbox1":"sandbox1_manager"
      },
      "":{
         "v":0
      }
   }
}

What I want is to isolate each cores, aka : only allow sandbox1 user to use the sandbox1 core, and only allow sandbox2 user to use the sandbox2 core. But with my configuration, I'm still able to query the sandbox1 core with the sandbox2 user ... Annoying for a shared SOLR instance !
Can you help me please ?
Bes regards


text:
Q: DIP switches not working properly I am trying a project involving a DIP s0witch and a Raspberry Pi Pico, but it isn't working correctly.
When I switch all the switches to off on the DIP switch and test to see if any are still connected, switches 7, 6, 5, and 4 are still considered on. I looked around to see if there was a loose wire somewhere that was connecting the two ends, but nothing came up.
If it ends up having something to do with the internals of the switch, is there a way of opening up the switch and fixing it myself? Though it would be best if it's fixed without having to do that.
I attached some images (sorry in advance, the soldering is shoddy):


text:
Q: java iterator in a nested map (Map 2D) I would like to know: how can I iterate through a 2D map? I have a centralMap:
private final Map<String, Map<String, String>> centralMap =
    new HashMap<String, Map<String, String>>();

which contains another map:
Map<String,String> nestedMap = new HashMap<String, String>();

as Value, and the second one is created in the "put" method, so that in the constructor, i have just the centralMap. Now i want to redefine this method and to get complete entry of the map (the 2 keys and the value for each element)
public Iterator<Entry> iterator()

How should I proceed? If possible, how can I remove an element through the iterator without having a problem?

A: Iterators are meant to operate on a collection, such as the keyset of your first map, or the values (which are a collection of maps) of your nested one. You cannot expect the iterator renove method to understand your complex structure.
I would suggest that you build your own class for this, with your own convenience methods that do what you described.
Also, going on a limb here: make sure you didn't just want to have a multimap. If so, have a look, for example, at guava's HashMultimap

A: You apply the same procedure as if you were iterating over a single map, you just do it twice:
public void printNestedMap(Map<String, Map<String, String>> map)
  Iterator it = map.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pairs = (Map.Entry)it.next(); // <- pairs.getValue() is a map
        System.out.println("Key1: " + pairs.getKey());
        //print the inner Map
        printMap((Map<String, String>)pairs.getValue());
        it.remove(); // avoids a ConcurrentModificationException
    }
}

EDIT
It would actually be better to move the iteration over a single map to a different method to be called in this scenario.
public void printMap(Map<String, String>> map)
{
   Iterator it = map.entrySet().iterator();
   while(it.hasNext())
   {
      Map.Entry pairs = (Map.Entry)it.next(); // <- pairs.getValue() is a String
      System.out.println("Key2: " + pairs.getKey() + " Value2: " + pairs.getValue());
      it.remove();
   }
}

EDIT 2: Test Program
   import java.util.*;
   public class TestMap
   {
      public static void main(String[] args)
      {
         Map<String, String> innerMap              = new HashMap<>();
         Map<String, Map<String, String>> outerMap = new HashMap<>();

         innerMap.put("Key1", "Val1");
         innerMap.put("Key2", "Val2");
         innerMap.put("Key3", "Val3");
         innerMap.put("Key4", "Val4");

         outerMap.put("OuterKey1", innerMap);
         printNestedMap(outerMap);
      }

      public static void printNestedMap(Map<String, Map<String, String>> map)
      {
         Iterator it = map.entrySet().iterator();
         while (it.hasNext()) {
            Map.Entry pairs = (Map.Entry)it.next(); // <- pairs.getValue() is a map
            System.out.println("Key1: " + pairs.getKey());
            //print the inner Map
            printMap((Map<String, String>)pairs.getValue());
            it.remove(); // avoids a ConcurrentModificationException
         }
      }

      public static void printMap(Map<String, String> map)
      {
         Iterator it = map.entrySet().iterator();
         while(it.hasNext())
         {
            Map.Entry pairs = (Map.Entry)it.next(); // <- pairs.getValue() is a String
            System.out.println("Key2: " + pairs.getKey() + " Value2: " + pairs.getValue());
            it.remove();
         }
      }
   }

Output:
Key1: OuterKey1
Key2: Key2 Value2: Val2
Key2: Key1 Value2: Val1
Key2: Key4 Value2: Val4
Key2: Key3 Value2: Val3

A: If you want to get Map.Entry elements containing the two keys and the value, it will really be much more natural to create a class Pair<String, String> that combines the two keys in a single element and use that as the key in a single map rather than nesting maps.
If you do this, your main structure will be a Map<Pair<String, String>, String> and using the Map.entrySet() method will give you a Set<Map.Entry<String, String>, String> from which you can get an iterator that gives approximately what you're after.
If you need to have a Map<String, Map<String, String>> for other reasons, it is also possible to convert this into the structure described above by reasonably simple code, and this might be the most sensible way of getting the information out of it.
Edit Note:
The Pair class described above is essentially the same as Map.Entry, so you could avoid creating a new class for the key by building a Map<Map.Entry<String, String>, String>.  I think it makes the code a bit less clear, but it can certainly be made functionally equivalent.
Sample Code
In the code below, I have defined the Pair class as an inner static (for real use, you might want to extract as an independent class), and written a conversion that takes a nested map as you describe, converts it to the form I've suggested, and uses an iterator on the entries of the converted map to print the values.
The iterator could of course be used for other things, and the convert method and Pair class are generic.
import java.util.*;

public class TestMap
{
    public static void main(String[] args)
    {
        Map<String, String> innerMap1 = new HashMap<String, String>();
        Map<String, String> innerMap2 = new HashMap<String, String>();
        Map<String, Map<String, String>> outerMap = new HashMap<String, Map<String, String>>();

        innerMap1.put("InnerKey1", "Val1");
        innerMap1.put("InnerKey2", "Val2");
        innerMap1.put("InnerKey3", "Val3");
        innerMap1.put("InnerKey4", "Val4");

        innerMap2.put("InnerKey5", "Val5");
        innerMap2.put("InnerKey6", "Val6");
        innerMap2.put("InnerKey7", "Val7");
        innerMap2.put("InnerKey8", "Val8");

        outerMap.put("OuterKey1", innerMap1);
        outerMap.put("OuterKey2", innerMap2);

        Map<Pair<String, String>, String> convertedMap = convert(outerMap);
        for (Map.Entry<Pair<String, String>, String> entry: convertedMap.entrySet()) {
            System.out.println(String.format("OuterKey: %s, InnerKey: %s, Value: %s",
                    entry.getKey().getFirst(),
                    entry.getKey().getSecond(),
                    entry.getValue()
            ));
        }
    }

    private static <K1,K2,V> Map<Pair<K1, K2>,V> convert(Map<K1, Map<K2,V>> nestedMap) {
        Map<Pair<K1, K2>, V> result = new HashMap<Pair<K1, K2>, V>();
        for (Map.Entry<K1, Map<K2, V>> outerEntry: nestedMap.entrySet()) {
            final K1 outerKey = outerEntry.getKey();
            for (Map.Entry<K2, V> innerEntry: outerEntry.getValue().entrySet()) {
                final K2 innerKey = innerEntry.getKey();
                final V value = innerEntry.getValue();
                result.put(new Pair<K1, K2>(outerKey, innerKey), value);
            }
        }
        return result;
    }

    public static class Pair<T1, T2> {

        private T1 first;
        private T2 second;

        public Pair(T1 first, T2 second) {
            this.first = first;
            this.second = second;
        }

        public T1 getFirst() {
            return first;
        }

        public T2 getSecond() {
            return second;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pair pair = (Pair) o;

            if (first != null ? !first.equals(pair.first) : pair.first != null) return false;
            if (second != null ? !second.equals(pair.second) : pair.second != null) return false;

            return true;
        }

        @Override
        public int hashCode() {
            int result = first != null ? first.hashCode() : 0;
            result = 31 * result + (second != null ? second.hashCode() : 0);
            return result;
        }

    }
}

Note on Usage in context:
In your current code, you have a class with a field centralMap which is the map in your old nested form, and an integer counter for the size of the map.
This containing class has a method for adding entries that looks like this:
@Override
public String put(final String row, final String column, final String value) {
    /**
     * Second map which is contained by centralMap, that contain Strings as Keys
     * and Values.
     */
    Map<String, String> nestedMap;

    if (centralMap.containsKey(row))
        nestedMap = centralMap.get(row);
    else
        nestedMap = new HashMap<String, String>();
    if (!nestedMap.containsKey(column))
        counter++;
    centralMap.put(row, nestedMap);
    return nestedMap.put(column, value);
}

If instead of using the nested map at all, you change this field to a map of the suggested form, this method would become a bit simpler:
@Override
public String put(final String row, final String column, final String value) {
    Pair<String, String> key = new Pair(row, column);
    if (centralMap.contains(key)
        counter++;
    centralMap.put(key, value);
}

And you actually wouldn't need the counter anymore, as it will always contain the same value as centralMap.size().
Update:
From edits put in yesterday but now deleted, it's now clear to me (from edit history) that you want to build a single iterator that delegates to all the iterators of the map in correct sequence, and returns a simple structure containing both keys and the value.
This is certainly possible, and if I have time later, I might add some sample code for it.  As was noted in another response, the iterator.remove() method may be impossible or unnatural.
Meanwhile, your requirements (as noted a comment on the same other response) is rather similar to what is supplied by guava's Table.  That's open source, and looking at it may give you ideas.  You can download the source for guava here.
Specifically, in guava's StandardTable, there is an inner class CellIterator, which looks like:
  private class CellIterator implements Iterator<Cell<R, C, V>> {
    final Iterator<Entry<R, Map<C, V>>> rowIterator
        = backingMap.entrySet().iterator();
    Entry<R, Map<C, V>> rowEntry;
    Iterator<Entry<C, V>> columnIterator
        = Iterators.emptyModifiableIterator();

    @Override public boolean hasNext() {
      return rowIterator.hasNext() || columnIterator.hasNext();
    }

    @Override public Cell<R, C, V> next() {
      if (!columnIterator.hasNext()) {
        rowEntry = rowIterator.next();
        columnIterator = rowEntry.getValue().entrySet().iterator();
      }
      Entry<C, V> columnEntry = columnIterator.next();
      return Tables.immutableCell(
          rowEntry.getKey(), columnEntry.getKey(), columnEntry.getValue());
    }

    @Override public void remove() {
      columnIterator.remove();
      if (rowEntry.getValue().isEmpty()) {
        rowIterator.remove();
      }
    }
  }

You can't just copy this code as it depends on other things in guava, but it shows the basic pattern of what you have to do.


text:
Q: Receiving Undefined on XML request This is in my login.js but its receiving undefined from the server, whereas server is fetching correct data from the database when i check it manually.
request.open('GET', 'http://akshatbhargava123.imad.hasura-app.io/', true);
request.send(null);

request.onreadystatechange = function() {
    if(request.readyState === XMLHttpRequest.DONE) {
        // Take some action
        if(request.status === 200) {
            //alert('recieved');
            a = request.responceText;
            alert(a);
        }
    }
};

Here's my server's code segment:
var pool = new Pool(config);

app.get('/users' , function(req, res){
pool.query('SELECT * from users', function(err, results) {
 if(err){
     res.status(500).send(err.toString());
 }
 else{
     res.status(200).send(JSON.stringify(results.rows[0].name));
 }
});
});

When I goto myapp/users, I receive correct data, i.e. "user1"
Please help, thanks.

A: It's responseText, not responceText.


text:
Q: I'm trying to split my string with multiple symbols in split() method but it's not working I'm trying to split my regex but it's not splitting for some reason. Here's my code
String str = "sdef@srdfsrd[es[edf@edfv";
String[] arrOfStr = str.split("\\@\\[");
for (String a : arrOfStr)
{
  System.out.println(a);
}

output:
sdef@srdfsrd[es[edf@edfv

expected output:
sdef
srdfsrd
es
edf
edfv

The same problem for:
String[] arrOfStr = str.split(",:");  //not splitting the word at all

A: "\\@\\[" matches @[, which is not in your string. Change your RegEx to "[@\\[]", which is a character class - that means it will split on either @ or [.
See a demo here :)

A: Use "@|\\[ instead of \\@\\[
Note that in regex pattern, | works as OR i.e. by using "@|\\[ you are instructing the code to split the given string either on @ OR on [
Alternatively, you can use [@\\[] where [] specifies the character classes.
Demo:
public class Main {
    public static void main(String[] args) {
        String str = "sdef@srdfsrd[es[edf@edfv";
        String[] arrOfStr = str.split("@|\\[");
        for (String a : arrOfStr) {
            System.out.println(a);
        }
    }
}

Output:
sdef
srdfsrd
es
edf
edfv


text:
Q: Rails 3 Submit Radio Button Form with Jquery Remotely (without using $.post)? I'm wondering if there is a way to submit a form of radio buttons with jQuery. The problem I'm having is that I'm applying a start rating jQuery plugin to a rails form, and this plugin has it's own click callback. I'd like to simply tell the rails form to submit from within this callback.
Here is the form in rails:
<%= form_for([@contact, @contact.overall_ratings.new],
                :remote => true,
                :format => :js) do |f| %>
    <%-# TODO set these up in a loop %>
    <%= f.radio_button :rating, 1, {:class => "star"} %>
    <%= f.radio_button :rating, 2, {:class => "star"} %>
    <%= f.radio_button :rating, 3, {:class => "star"} %>
    <%= f.radio_button :rating, 4, {:class => "star"} %>
    <%= f.radio_button :rating, 5, {:class => "star"} %>

<% end %>

Here is the call to the plugin, plus the callback:
$(function(){

    $('input.star').rating({
            callback: function(value, link){
                //get parent form
                var form = $(this).parent();
                $(form).submit();

            }
    });

});

The problem with what I've got so far is that it's redirecting to the .js file. Seems like it doesn't obey the forms call to :remote => true, which doesn't surprise me because I'm calling it from the plugin callback.
Thanks for the help!

A: What about
$('input.star').click(function(){ $(this).parent().submit(); return true; });

?
This will trigger form submit after setting the value of radio input, so it will work anyway.
Also - are your sure jquery_ujs is properly referenced from application.js? Because it seems, that this form is not set as remote.
And finally - :format=>:js is not needed here IMO, as format is taken also from headers.


text:
Q: optimization, lpSolve lp.transport: computational time? I am trying to run an optimization using lp.transport from the package lpSolve in R, using the generic form

lp.transport (cost, "min", row.signs, row.rhs, col.signs, col.rhs)

The cost matrix is large, 6791 x 15594. The rows correspond to food producers and the columns to consumers, and obviously the sum of all values of row.rhs is equal to that of col.rhs.
The optimization has been running about 12 hours now (using about 30 Mb of memory, in a 64-bits R). Is there any way to estimate the time it will take? Any advice on how to modify the inputs to eventually reduce computational time?


text:
Q: How to Remove JavaScript Remnants from String in PHP I'm running the following steps in an attempt to clean-up a string which is obtained using $query_text_lower = file_get_contents(websiteURL).
What I want, is to return just words. No javascript, no random numbers, no CSS or any other kinds of scripts.
//remove javascript
$query_text_lower = preg_replace("/<script[^>]*>.*?< *script[^>]*>/i", "", $new_text);

//remove html tags
$query_text_lower2 = strip_tags($query_text_lower);

//removes any text containing links (may not be best, as some sites link useful words within the text. Does tend to remove a lot of ads though
$query_text_lower3 = preg_replace('/<a\s.*?>.*?<\/a>/s', '', $query_text_lower2);

//removes linebreaks
$query_text_lower4 = trim(preg_replace('/\s+/', ' ', $query_text_lower3));

echo $query_text_lower4;
die();

Here is an example of what I am outputting at the moment:
developing a cafe: 13 steps - wikihow /**/ /**/ messages log in log in via log in remember me forgot? create an account explore community dashboardrandom articleabout uscategoriesrecent changes help us communication an articlerequest a new articleanswer a requestmore ideas... edit edit this article home » categories » investment and business » business » buying & forming a business » hospitality businesses articleeditdiscuss wh.mergelang({ 'navlist_collapse': '- collapse','navlist_expand': '+ expand','usernameoremail': 'username or email','password': 'password' }); edit articlehow to start a cafe edited by harri, maluniu, annie, afc8871 and 1 other if you have always dreamt of management a business, then learning how to start a cafe may be the answer. with the right planning beforehand, opening a cafe can become highly profitable. your cafe can easily become a place where staff come to relax, enjoy schedule with friends or family, grab a quick bite to eat, or to work on their latest project. start a cafe business by following the steps below. ad google_ad_customer = "ca-pub-9543332082073187"; /* iframe unit - intro */ if(abtype == 2) google_ad_slot = '6354743772'; else //a or normal google_ad_slot = '8579663774'; if(abtype == 2 || abtype == 3 || abtype == 4 || abtype == 5 || abtype == 6) { google_ad_width = 671; google_ad_height = 120; google_max_num_ads = 2; } else if(abtype >= 7) { google_ad_width = 645; google_ad_height = 60; google_max_num_ads = 1; } else { google_ad_width = 671; google_ad_height = 60; google_max_num_ads = 1; } google_ad_results = 'html'; google_override_format = true; google_ad_channel = "0206790666+7733764704+1640266093+6709519645+8052511407+6822404019+7122150828" + gchans + xchannels; if( fromsearch ) { document.communication(''); } //--> edit steps 1communication your business and marketing plans. these are very important aspects of any business, as they will show your course of action for both management and marketing the business. refer to these documents often to make sure you stay on track. without these documents, you may not be able to secure funding. ad google_ad_customer = "ca-pub-9543332082073187"; /* iframe unit - first step */ if(abtype == 2) google_ad_slot = '4878010577'; else //a or normal google_ad_slot = '5205564977'; if(abtype == 2 || abtype == 3 || abtype == 4 || abtype == 5 || abtype == 6) { google_ad_width = 629; google_ad_height = 120; google_max_num_ads = 2; } else if(abtype >= 7) { google_ad_width = 600; google_ad_height = 60; google_max_num_ads = 1; } else { google_ad_width = 629; google_ad_height = 60; google_max_num_ads = 1; } google_ad_results = 'html'; google_override_format = true; google_ad_channel = "2748203808+7733764704+1640266093+6709519645+8052511407+2490795108+6822404019+7122150828" + gchans + xchannels; document.communication(''); //--> 2follow all legalities for starting a cafe business of this nature in your area. make sure you get all the necessary licenses, permits, and insurance required on federal, state, and local levels. 3secure funding for your business. in your business plan, you determined how much funding you need to start a cafe business. contact investors, apply for loans, and use whatever capital you have on hand to start the business.

A: Your javascript regex is off
you have:
$query_text_lower = preg_replace("/<script[^>]*>.*?< *script[^>]*>/i", "", $new_text);

You're not detecting </script> inside the returned document, so it's not removing the javascript code itself from the page, but when you call striptags, you are removing the  tags, so they don't appear in your final output. However, I can't see the site you're pulling this from so I can't be 100% on that one.
Let me know if that makes sense. Basically, the way it looks to me is that your first regex isn't actually matching anything.

A: You can't parse that stuff out using regular expressions.  The suggestion to parse the HTML using the existing DOM tools is the right way to go.


text:
Q: VBScript Printer Driver Install throws WMI Error -2146500025 I'm trying to install a printer driver using WMI and a VBScript but I keep getting the error code 2146500025 from the WMI AddPrinterDriver function.
What am I doing wrong? I need to install 2 drivers (1 Dell and 1 Lexmark) and both instances return the same error code. The drivers are signed and the .cat file is present with the .inf. The certificates are also valid (Expires late 2016)
Set objDriver = oWmi.Get("Win32_PrinterDriver")
objDriver.Name = DRIVERNAME
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3" 'Win2K
objDriver.FilePath = "c:\drivers\printers\Lexmark_Universal_PS"
objDriver.InfName = "c:\drivers\printers\Lexmark_Universal_PS\LMUD1n40.inf"
wmiResult = objDriver.AddPrinterDriver(objDriver)
If wmiResult<>0 Then
    wscript.echo "WMI " & wmiResult
End If
If Err.Number<>0 Then
    wscript.echo Err.Description
End If

A: Turned out that the files were tampered with prior to me receiving them. This in turn broke the signatures and prevented the drivers from installing successfully.


text:
Q: How do I loop a function if a certain element is not present in selenium? I want to loop a function in selenium.
So as long as DisplayName on the web page is not "fish", I want to the program to type in "fish" and press enter until the display name is "fish" and then I want the program to stop.
Currently, the program keeps running and typing in "fishfishfishfishfish" for the display name.
 DisplayName = driver.find_element_by_xpath("""//*[@id="DisplayName"]""")
    while (DisplayName != "fish"):
        DisplayName.send_keys("fish"")
        DisplayName.send_keys(u'\ue007')

A: Use clear method to clear the field before start typying in.
Also use a constant wait for a short time - in AJAX pages there may be some javascript fired when a field value changes, give this javascript some time to execute (I don't know how to do it in phyton, in example below i used sleep( 1 second), in Java we are using Thread.sleep( 1000 ) to sleep for a 1 second.
DisplayName = driver.find_element_by_xpath("""//*[@id="DisplayName"]""")
    while (DisplayName != "fish"):
        DisplayName.clear()
        DisplayName.send_keys("fish"")
        DisplayName.send_keys(u'\ue007')
        sleep( 1 second)