text:
Q: "Black Hats out there are a lot craftier than you are" what is the exact meaning? Recently I've seen the sentence: Black Hats out there
are a lot craftier than you are
What is the meaning?
Thank you

A: It is not a proverb :)
Black Hats are black hat hackers.

Black hat - meanings here in the Urban Dictionary

In the computer-world, people who try to find errors in security systems, so they can get to information that is supposed to be hidden, are called hackers.
Some of those people do this to tell the owner of the system that they found a security flaw, so that it can be fixed. Those are called white hats, or white hat hackers.
Those that use the security flaws to steal (and use/abuse) the data, are called black hats.
So the sentence means that you should never think too easily that your web site or online application is completely safe, simply because you cannot break into it. There are people out there who are a lot better at breaking into your application than you are!


text:
Q: AngularJS to Mysql I must be missing something... because I'm really a noob at this.
I have this angularjs data:
$scope.todoList = [
      { text: 'Check me out' },
      { text: 'Lorem ipsum dolor sit amet, possit denique oportere at his, etiam corpora deseruisse te pro' },
      { text: 'Ex has semper alterum, expetenda dignissim' },
    ];

And I wanted to put it in a mysql table instead. I created the table and then tried to get table data:
JS:
$http({method:'POST',url:'process.php'})
          .then(
            function successCallback(response) { $scope.todoList = response.data;},
            function errorCallback(response) {$scope.todoList = "ERROR!";});

PHP:
    $sql = "SELECT * from `todolist`";
    $result = $conn->query($sql);
    $data = array();
    while ($row = mysqli_fetch_assoc($result)) {
        $data[] = array("text" => $row['text']);
    }
    echo json_encode($data);

When I manually try the PHP the output is:
[{"text":"Check me out"},{"text":"Lorem ipsum dolor sit amet, possit denique oportere at his, etiam corpora deseruisse te pro"},{"text":"Ex has semper alterum, expetenda dignissim"}]

Does someone know where the problem is?

A: I think your problem is about reading and assigning value of response data; so I've commented:

Your response data type is not valid json data type, and assigns response-string without parsing to $scope.todoList; use JSON.parse(response.data)

and suggest these topics (maybe helpful):

*

*working with JSON data array from Ajax response?

*What is the correct JSON content type?
If you have problem with Updating after AJAX call:

*

*how can refresh my scope after ajax call

*Angular controller scope not updating after jQuery ajax call
more related to this problem:

*

*How to wait till the response comes from the $http request, in angularjs?

If your problem is none of these topics, let us know to solve it.

A: I tried JSON.parse(response.data) but no success.
I'll try to elaborate a bit more:
This code worked fine:
function getRandomColor() {
  var i = Math.floor(Math.random() * (colors.length - 1));
  return colors[i];
}

$scope.todoList = [
  { text: 'Check me out' },
  { text: 'Lorem ipsum dolor sit amet, possit denique oportere at his, etiam corpora deseruisse te pro' },
  { text: 'Ex has semper alterum, expetenda dignissim' },
];

$scope.todoList.forEach(function(item) {
  item.color = getRandomColor();
});

But now this one gives an error in console:
TypeError: Cannot read property 'forEach' of undefined
function getRandomColor() {
  var i = Math.floor(Math.random() * (colors.length - 1));
  return colors[i];
}

$http({method:'POST',url:'process.php',data:{function: "todolist"}})
          .then(
            function successCallback(response) {$scope.todoList = response.data;},
            function errorCallback(response) {console.log("ERROR!");});

$scope.todoList.forEach(function(item) {
  item.color = getRandomColor();
});

It seems like it doesn't wait for the ajax results... But I don't really know.
SOLVED putting foreach function inside successCallback function.

redpajama_set_name: RedPajamaStackExchange


text:
Q: MySQL Query Cache Not Working on Certain Tables - Correct Settings I was having a issue getting MySQL query cache to work.  No matter what settings, I couldn't get the queries to cache on certain tables.
Once investigated.  It turns out that MySQL 5.5 won't cache a query that has a table with a "dash" in it like.
Select id FROM `table-name` WHERE `id` = 1;

However you will see Qcache_queries_in_cache, and  Qcache_hits works as desired when you rename your table without the dash.
Select id FROM `tablename` WHERE `id` = 1;

Underscores also works.

A: I've no idea what "Current RAM usage" means, but both MongoDB and MySQL will try to grab as much resources as they can. The best way to see what's going on is to look at the output of "top" for MySQL and MongoDB. In your "free" output, you see however that your machine has reserved 12417480 (12GB) for caches. Which is likely what the Operating System has reserved for MongoDB's memory mapped files. I don't know your query load or data access patterns so can't quite say what goes on here. You could also check in the mongodb.log file to see whether you have any slow queries.


text:
Q: How to update Highcharts data dynamically over a period of time I want to use Highcharts graph and update y axis dynamically. Actually I want to update nsw, Tas, ACT every 5 sec. How do I do it ?
Here is my code.
$(function () {
$('#container').highcharts({
                    title: {
                        text: 'Histogram',
                        x: -20 // center
                    },
                    subtitle: {
                        text: 'Source: www.trove.com',
                        x: -20
                    },
                    xAxis: {
                        categories: ['NSW', 'Tas', 'ACT','QLD','VIC','SA','WA']
                    },
                    yAxis: {
                        title: {
                            text: 'Hits'
                        },
                        plotLines: [{
                            value: 0,
                            width: 1,
                            color: '#808080'
                        }]
                    },
                    tooltip: {
                        valueSuffix: '°C'
                    },
                    legend: {
                        layout: 'vertical',
                        align: 'right',
                        verticalAlign: 'middle',
                        borderWidth: 0
                    },
                    series: [{
                        name: 'States',
                        data: [nsw, Tas, ACT,qld,vic,sa,wa]
                    }]
                });
            });

            });

A: In the Documentation you can find an example from Highcharts in jsfiddle. Check it out http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/dynamic-update/. In the example every second a new point will be added. Here comes the relevant code part:
chart: {
    type: 'spline',
    animation: Highcharts.svg, // don't animate in old IE
    marginRight: 10,
    events: {
        load: function () {

            // set up the updating of the chart each second
            var series = this.series[0];
            setInterval(function () {
                var x = (new Date()).getTime(), // current time
                    y = Math.random();
                series.addPoint([x, y], true, true);
            }, 1000);
        }
    }
},
`

A: The easiest way to do it would be to use the javascript function "setInterval()" to call it.
Here is a link where you can find a way to do it :
http://www.w3schools.com/js/js_timing.asp
If you are not really good at javascript, you might need this declaration of functions : var functionName = function() {} vs function functionName() {}

A: Use:
events: {
    load: function () {

        // set up the updating of the chart each second
        var series = this.series[0];
        setInterval(function () {
            var x = (new Date()).getTime(), // current time
                y = Math.random(),
                l = series.data.length;

            for(var i  = 0; i < l; i++) {
                series.data[i].update({
                  y: getHits(i) // or something else
                });
            }
        }, 5000); // 5 seconds
    }
}

Where index is index (count from 0) of nsw/Tas/ACT in data array.  (for nsw = 0, for Tas = 1 etc.)


text:
Q: Using ordered pairs and sequences to give a required condition for any counter-example to Legendre's Conjecture I found it very challenging to write this question.  I apologize for any ambiguity.
This is an argument that I am working on related to Legendre's Conjecture.  I appreciate any questions or any corrections.  :-)
Let:

*

*$x > 1$ be an integer

*$T(x)$ be the set of primes $p$ such that $0 < p < x$ and $p \nmid x(x+1)$

*$|T(x)|$ be the count of elements in $T(x)$

*$S_{T(x)}$ be a set of ordered pairs $(p_i,p_j)$ with the following properties:

*

*$p_i \ne p_j$

*$x^2 + x - p_i \equiv 0 \pmod {p_j}$

*$p_i,p_j \in T(x)$

Definitions:

*

*A sequence of primes $(p_1, p_2, p_3, p_4, \dots )$ is constructible from $S_{T(x)}$ if the following:

*

*the first element $c$ in the sequence can be any prime such that $c \in T(x)$

*the next element $n$ can be any prime where the ordered pair $(c,n) \in S_{T(x)}$

*the sequence consists of $2$ or more elements where for each $(p_i,p_{i+1})$, it follows that $(p_i,p_{i+1}) \in S_{T(x)}$ and for each $(\dots,p_j,p_{j+1}. \dots)$, it follows that $(p_j,p_{j+1},\dots) \in S_{T(x)}$

*

*The set $S_{T(x)}$ is said to have repeats if a sequence is constructible that includes a prime more than once.

Example 1: $x=16, T(x)=\{3,5,7,11,13\}, S_{T(x)} = \{ (5,3), (7,5), (11,3), (13,7) \}$
In this example, $S_{T(x)}$ does not have repeats
Example 2: $x=31, T(x)=\{3,5,7,11,13,17,19,23,29\}, S_{T(x)} = \{ (3,23), (5,3), (5,7), (7,5), (11,3), (13, 11), (17,3), (17,5), (17,13), (19,7), (23,3), (23,17), (23,19), (29,3) \}$
In this example, $S_{T(x)}$ has repeats since the sequence $(3,23,3)$ is constructible from $S_{T(x)}$.
Claim: If a counter example exists to Legendre's Conjecture for a given $x$, the set of ordered pairs $S_{T(x)}$ will necessarily have repeats.
(1)  Assume that for each $p \in T(x)$, there exists a $q \in T(X)$ such that $(p,q) \in S_{T(X)}$  [If this were not true, $x^2 + x - p$ would necessarily be a prime.]
(2)  Let $n = |T(x)|$ be the number of elements in $T(x)$.
(3)  We can arbitrarily order each $p \in T(x)$ up to $p_{n-1}$ in the following way:

*

*$p_1 = $ the least prime in $T(x)$.

*For each prime $p_i$, let $p_{i+1}$ be any prime where $(p_i,p_{i+1}) \in S_{T(x)}$ and $p_{i+1}$ has not yet been assigned an order.  [If it has already been assigned an order, then we have a repeat]

*Assume that we do not run out of primes (otherwise, we have reached a repeat and the argument is proven)

(4)  At $p_n$, there is no remaining unordered primes.  Since, by assumption, there exists $p_i \in T(x)$ such that $(p_n,p_i) \in S_{T(x)}$, it follows that there must be a repeat.
Does this argument hold?
Thanks.

Edit:
Great comment from John Omielan.  I have made changes to make the question less confusing.

*

*Added a definition for $x$

*Removed $2$ from examples since $2 | x^2 + x$ so it will never be an element of $T(x)$.

*Changed $p_1$ to $p_4$ in the definition of constructible to avoid any confusion.

*Add a specific $x$ value for the first example

*Removed some redundancies in the definition of $S_{T(x)}$

*Modified the title to make my question clearer.

*Updated Example 2 to make it complete

*Updated the third point in definition of constructible

A: In your Definitions: section, you wrote:

*

*A sequence of primes $(p_1, p_2, p_3, p_4, \dots )$ is constructible from $S_{T(x)}$ if the following:

*

*the first element $c$ in the sequence can be any prime such that $c \in T(x)$

*the next element $n$ can be any prime where the ordered pair $(c,n) \in S_{T(x)}$

*the sequence consists of $1$ or more elements where the first element in the sequence meets the first condition and all other elements meet the second condition.

I found this quite confusing. Your third point states the sequence consists of $1$ or more elements. However, your second point requires there to be at least $2$ elements. Also, the last part of the third point says "all other elements meet the second condition". However, the second condition uses $c$, which is defined in the first condition for the first element. This seems to imply all of the other elements, say $p_i$, must have $(p_1,p_i) \in S_{T(x)}$. However, your second example stating $(3,23,3)$ is constructible shows this is not the case.
Instead, from the context used later in your Claim, it seems the definition can be just simply stated as:

*

*A sequence of $n \ge 2$ primes $(p_1, p_2, p_3, \dots, p_n)$ is constructible from $S_{T(x)}$ if $(p_i, p_{i+1}) \in S_{T(x)} \; \forall \; 1 \le i \le n - 1$.

Assuming this is what you mean, then regarding your Claim, any counter-example to Legendre's conjecture would not have any prime $p_L$ where $x^2 \lt p_L \lt x^2 + x$, although the claim itself is for $x^2 \lt p_L \lt x^2 + 2x + 1$. As such, your first part $(1)$ must hold since, as you state, otherwise if it did not, then $p_L = x^2 + x - p$ must be a prime. This is because if it were composite, it would have at least $2$ factors, with the smaller one being less than $x$. Any prime factor of this smaller factor can't divide $x^2 + x$ (if it did, then it must also divide $p$), so it must be in $T(x)$.
The rest of your Claim only depends on your part $(1)$ since, using it, you can create an unlimited length chain of primes in multiple ways (the rest of your claim gives one method, although note $p_1$ can actually be chosen to be any prime, not necessarily the smallest one) that, since there are only a finite number of primes in $T(x)$, must eventually repeat.
In conclusion, your stated Claim is true.


text:
Q: Curl cookies storage I've coded a PHP script to simulate a Web browser. Basically, its job is to fetch an Url, store the associated cookies and parse it to get some data.
It was working well until monday in the afternoon, but unexpectedly it no longer stores cookies in the required directory. I assume my code hasn't been updated nor modified.
The directory, where the cookies are supposed to go, has CHMOD 755.
Here is the code I'm using so far:
$options = array(
   CURLOPT_URL               => $url,
   CURLOPT_RETURNTRANSFER    => 1,
   CURLOPT_HEADER            => 0,
   CURLOPT_FAILONERROR       => 1,
   CURLOPT_USERAGENT         => $this->user_agent,
   CURLOPT_CONNECTTIMEOUT    => 30,
   CURLOPT_TIMEOUT           => 30,
   CURLOPT_SSL_VERIFYPEER    => 0,
   CURLOPT_FOLLOWLOCATION    => 1,
   CURLOPT_MAXREDIRS         => 10,
   CURLOPT_AUTOREFERER       => 1,
   CURLOPT_COOKIESESSION     => $reset_cookies ? 1 : 0,
   CURLOPT_COOKIEJAR         => $this->cookies_file,
   CURLOPT_COOKIEFILE        => $this->cookies_file,
   CURLOPT_SSL_CIPHER_LIST   => 'TLSv1',
);

// Add headers
if (isset($custom_headers))
{
   $options[CURLOPT_HTTPHEADER] = $custom_headers;
}

// Add POST data
if (isset($post_data))
{
   $options[CURLOPT_POST]          = 1;
   $options[CURLOPT_POSTFIELDS]    = http_build_query($post_data);
}

// Attach options
curl_setopt_array($this->curl, $options);

// Execute the request and read the response
$content = curl_exec($this->curl);

// Handle any error
if (curl_errno($this->curl)) throw new Exception(curl_error($this->curl));

return $content;

To create the cookie file based on the current session ID, I use this code:
// Create a cookie file
$this->cookies_file = dirname(__FILE__) . '/../cookies/' . $this->session_id .'.cookie';
if (!file_exists($this->cookies_file)) file_put_contents($this->cookies_file, '');

Do you know what and why this happens ? Also, it works perfectly localy under WAMP.

A: The solution was to set the cookies directory permissions to 644.


text:
Q: Maximizing the value of an integral Let $f \colon \mathbb R^N \to \mathbb R$ be a measurable, bounded function. Let
$$
\mathcal A := \left\{ g \colon \mathbb R \to [0,+\infty): g \text{ is measurable and} \int_\mathbb R g =1\right\}.
$$

What is the value of
  $$
M:=\sup_{g \in \mathcal A} \int_{\mathbb R^N} f(x_1,\ldots , x_n) g(x_1) g(x_2) \ldots g(x_N) d\mathcal L^N(x_1, \ldots , x_N)?
$$
  Is the sup attained?

A: Consider $E=\{(x_1,...,x_n):|f(x_1,...,x_n)| <M\}$. If $\int_{\mathbb R^{N}} I_E (x_1,...,x_n) g(x_1)g(x_2)...g(x_n)\, dx_1\, dx_2...\,dx_n >0$ then $M <\|f\|_{\infty}$. If $g>0$ everywhere then this says that $M <\|f\|_{\infty}$ whenever Lebesgue measure of $E$ is positive. Condition for equality depends on $f$ as well as the  support of the measure $g(x_1)g(x_2)...g(x_n)\, dx_1\, dx_2...\,dx_n$


text: Q: Partitioning in oracle 12c Can we perform partitioning on tables in Oracle 12c R1 on existing tables? I don't want to drop the existing tables. The new feature is available in R2 but can we do it in R1?


text:
Q: C# Windows Forms - Using StringBuilder to generate a large string then using SendKeys to type it out. Often happening twice in one call? I'm almost finished writing a small add-on for League of Legends that allows players to click a checkbox in my form, and the checkbox's function clicks in the search bar (which automatically clears it.  Already a feature in the LoL Client) and types out the names of all the champions the player has assigned to that group via a 2nd form.  However, if the text is (example) 12345, I've been getting a lot of results like this:  1231234545.
What I've tried:

*

*I've tried adding in ctrl-a + backspace with sendkeys because maybe when it clicks in the search bar it isn't always deleting the stuff there!  This however did not change anything

*I then commented out the code that types out the actual string (12345) and made the checkbox ONLY type ctrl-a.  I then wrote out a string longer than the search bar that I'm typing into and pasted it, clicked a checkbox, and tried to see if it would highlight the text (meaning the text was not always being cleared when clicked).  I did this about 50 times and every single time the text was cleared

*This leads me to believe that the problem is in the code itself, not the actual integration with the LoL Client.  So maybe it's a problem with StringBuilder?  I haven't used it very often so I'm not too familiar with it.  Commented out all the stringbuilder stuff and changed to String concatenation.  Same problem

*I tried adding a boolean runningCheckboxFunction to make sure the function would only run once but still have the issue as well.

So this is where I'm at right now.  I'm pretty sure it's a problem with my code looping for some reason or the checkbox function as a whole being called twice instead of once when I click the checkbox.
My code:
private void checkboxFunction()
    {
        if (runningCheckboxFunction == true) return;

        runningCheckboxFunction = true;

        //CLICK IN THE SEARCH BAR (Automatically clears the text that WAS there)
        Process[] LolClient = Process.GetProcessesByName("LolClient"); //should only return one client (i.e. get [0])
        if (LolClient.Length < 1) return;
        ClickOnPoint(LolClient[0].MainWindowHandle, searchBarCheckPoint);

        //MAKE THE STRING TO TYPE IN THE SEARCH BAR
        StringBuilder whatToTypeInSearchBar = new StringBuilder();
        foreach (CheckBox cb in checkboxes)
        {
            if (cb.Visible == true && cb.Checked == true)
            {
                List<String> thisCheckboxsChamps = settingsForm.getChampionListForGroup(checkboxes.IndexOf(cb));
                if (thisCheckboxsChamps == null) continue;
                foreach (String champ in thisCheckboxsChamps)
                {
                    whatToTypeInSearchBar.Append("|");
                    whatToTypeInSearchBar.Append(champ);
                    whatToTypeInSearchBar.Append("$");
                }
            }
        }

        //had an issue that sometimes clicking in search bar did not automatically clear it, so select all text and backspace just in case
        //^ = ctrl -- ^A = ctrl-A (select all)
        SendKeys.Send("^A");
        //backspace
        SendKeys.Send("{BACKSPACE}");

        //TYPE IN THE SEARCH BAR
        if (whatToTypeInSearchBar.Length > 0)
        {
            //remove the first "|"
            whatToTypeInSearchBar.Remove(0, 1);
            SendKeys.Send(whatToTypeInSearchBar.ToString());
        }

        runningCheckboxFunction = false;
    }

A: Which event are you using for the check box control (CheckedChanged or CheckStateChanged)? Also, what is the value for CheckBox.ThreeState property? It is possible that the event you use fires more than once. If that is the case, you could check for a specific state before calling the function you have listed above.
Also, when you use SendKeys, try sending the keys to your own application and monitor the ActiveControl.KeyUp/ActiveControl.KeyDown/ActiveControl.KeyPress events to ensure that the string you generate is the riight sequence.


text:
Q: Google Custom Search Engine API Image Search not returning results Just setup my CSE with Image Search enabled in the Basics tab, but still ain't getting results.
If I don't use searchType=image in the query it works, if I put it back it stops working with no errors, just no results.
Any inputs?

A: Image search needs to be switched to ON at the Custom Search Setup->Basics

A: It seems there are two elements required to consume the Google search API, the configuration of the API key and credentials.
Setup the API key here https://console.developers.google.com/project
and create your own CSE here https://www.google.co.uk/cse/all
I made the mistake like a lot of people of ignoring the CSE side of the setup (it didn't seem logical to search only my own site).
You need to create a CSE though, point it to search any url (I don't think it matters greatly), and then where it says "Sites to search" chose "Search the entire web but emphasise included sites". Also then set image search to "On".
Once you've done this browse to your new CSE, the url should contain your CX code e.g. cx=014341056213260336986:v4fl8n8sabc, you then need to use this in your request query string.
Your API query should now start returning results.


text:
Q: Sent Email at regular Interval to user for Password updation I have a table created by Identity as AspNetUser.
I want to send an email to corresponding user if he did not update his password for six months. I have to send mail after 60 days and after that every 3 days. I am using .net framework 4.5.2, asp.net, mvc 5, identity2
My model
    public class IdentityUser : IUser
    {
        public IdentityUser();
        public IdentityUser(string userName);
        .
        .
        public DateTime LastUpdateDate{get;set;}
    }

My controller
public ActionResult PasswordSendMail()
{
    my code for checking six month...
}

But the mail has to be sent once at the 60th day from the LastUpdateDate and after every three days.
If i placed the code in controller, the action should be called. I have to send without calling any controller specifically.
I want to sent mail to users, whether user is logged in or not. when the time reached the mail should be sent by background process.
how to integrate the windows service with the current project. Brief answer will be helpful
Thanks in advance

A: You have two primary options here. The first and easiest is to simply not worry about notifying the user exactly at a certain interval, and just notify them upon login if it's time to change the password. You can simply add your code to check if the password is older than the defined timeframe to your login code, and then redirect them to a password change form if it's time. Or, if you really want to be fancy about it, you can create an action filter that does this check and redirects to the password change form, so the user will not be able to do anything else until they've updated their password.
If you really want to send an email on a schedule, then you need something that can run the code on a schedule. You have two options in this regard. First, you can create a console app that contains this code, and then simply use something like Task Scheduler in Windows to run it on a set schedule. Second, you can use something like Revalee to call your action on a schedule.

A: If you want to schedule actions on your server, I would recommend to create a windows service with a timer that call a url at a given moment. I tried the task scheduler and it was not reliable enough for me.
This is the most important part of your windows service
protected override void OnStart(string[] args)
        {
            LaunchTimer(MilliSecondsToNextLaunch());
        }

protected void LaunchTimer(double interval)
        {
            Timer = new Timer { Interval = interval };
            Timer.Elapsed += OnTimer;
            Timer.Start();
        }

protected override void OnTimer(object sender, ElapsedEventArgs args)
        {
            using (var client = new WebClient())
            {
                client.DownloadString(siteUrl);
            }
            SetIntervalForTimer(MilliSecondsToNextLaunch() + 1000);
        }

protected void SetIntervalForTimer(double nextInterval)
        {
            Timer.Stop();
            Timer.Interval = nextInterval;
            Timer.Start();
        }

A: You can do it by using the SQL Stored Procedure. Alter your Identity table by adding a new column LastUpdateDate.
In you Stored Procedure check for the date difference between last update date and current date, store the value in a integer variable, then use the IF-ELSE statement to check if the update value is greater than 6 months.
If true select the email addresses of those user.
Now read those email addresses in ASP.Net and send email to those users.
If you can send me the schema of your Identity table, I can help you with the code.
For any further assistance feel free to contact.

A: We already developed solution for this requirement.

*

*On the asp.net or mvc web site, add a webservice as an interface to send password

*Develop a basic console program, add service reference made in step #1, execute the service api in order to send email
if using windows service:

*register the console program as windows service using NSSM

*add a scheduler task to start/stop the service of the console program in step #3.
http://forums.asp.net/t/1758972.aspx?start+and+stop+windows+service+using+windows+task+scheduler
But windows service, imo,  is not necessary. In our case , we just use windows task scheduler to start the console program, and the console program will then call the webservice and email is sent

A: Check this solution will resolve your Issue

*

*Create Console Application in Visual C# Write your Custom logic to check your validation.

*

*After Writing Custom logic take the .exe file which is generated by Console Application and deploy on server with Windows Task Scheduler wizard.

*URL how to Use Scheduler to Schedule Windows Task http://windows.microsoft.com/en-in/windows/schedule-task#1TC=windows-7


text:
Q: Is there a way to reduce the sentence spacing? I'm using materialize css to design a website. I am currently doing a pop-up modal but there seems to be some issue with the spacing as the sentences are spaced too far apart:
I would like it to look something like this:

I followed materialize's documentation code exactly and I should be seeing a normal paragraph where the sentences are not spaced so far apart. I'm not too sure as to where the issue is. Here is my code for the modal:

Welcome Back.

                Lorem Ipsum is simply dummy text of the printing and typesetting
                industry. Lorem Ipsum has been the industry's standard dummy
                text ever since the 1500s, when an unknown printer took a galley
                of type and scrambled it to make a type specimen book. It has
                survived not only five centuries, but also the leap into
                electronic typesetting, remaining essentially unchanged. It was
                popularised in the 1960s with the release of Letraset sheets
                containing Lorem Ipsum passages, and more recently with desktop
                publishing software like Aldus PageMaker including versions of
                Lorem Ipsum.

              Agree

A: This is happening because you have given more line-height to
 tag. Keep the line-height: 1.5 of
 tage which is by default given by Materialize CSS.


text:
Q: View doesn't appear as expected Theoretically the following code should animate the table view cell of the screen to the right and bring in a dark "view" in it's place.
CGPoint location = [gesture locationInView:tableView];
NSIndexPath *swipedIndexPath = [tableView indexPathForRowAtPoint:location];
UITableViewCell *swipedCell  = [tableView cellForRowAtIndexPath:swipedIndexPath];

//code to create view
UIView *sideView;
sideView.backgroundColor = [UIColor lightGrayColor];
//set the side view frame to the same as the cell
sideView.frame = swipedCell.frame;
//add it to the tableview
[tableView addSubview:sideView];

[UIView animateWithDuration:1
                 animations:^{
                     sideView.frame = CGRectMake(0, swipedCell.frame.origin.y, swipedCell.frame.size.width, swipedCell.frame.size.height);
                     // While simultaneously moving the cell's frame offscreen

                     // The net effect is that the side swipe view is pushing the cell offscreen
                     swipedCell.frame = CGRectMake(swipedCell.frame.size.width, swipedCell.frame.origin.y, swipedCell.frame.size.width, swipedCell.frame.size.height); //move cell off
                 }];

However, only the cell moves off the screen. No gray view comes in it's place.
Is there a step I am missing? What is wrong with this code?
Video of example here

A: The big error is that you're not initializing sideView to anything.
Try UIView* sideview = [[UIView alloc] initWithFrame:swipedCell.frame];

A: It doesn't sound like a good idea to add a view in place of a cell just like that. You'd have to deal with scrolling, table view editing, and other stuff that the UITableView takes care of for you. So instead, try adding the sideView as a subview of swipedCell.contentView and then doing this animation instead:
[UIView animateWithDuration:1 animations:^{
    sideView.frame = CGRectMake(0, swipedCell.frame.origin.y, swipedCell.frame.size.width, swipedCell.frame.size.height);
    //This moves all the subviews except for the sideView off the screen
    for (UIView *subview in swipedCell.contentView.subviews)
        if (![subview isEqual:sideView])
            subview.frame = CGRectOffset(subview.frame, swipedCell.frame.size.width, 0.0);
    }];

Hope this helps!


text:
Q: Taylor Series type inequality I need to show that for $x>0$, $1+\frac{x}{2} \ge \sqrt{1+x} \ge 1+\frac{x}{2} - \frac{x^2}{8} $.
I used the geometric/arithmetic mean inequality to show that $1+\frac{x}{2} \ge \sqrt{1+x}$ is indeed true. My issue lies in the second part of this.
In trying to show that $\sqrt{1+x} \ge 1+\frac{x}{2} - \frac{x^2}{8} $, I determined that this is a partial taylor series expansion and I attempted to play around with both inequalities to show that this is true but to no avail.
I would appreciate any help in solving this. Ideally I would like to do this analytically but any solutions using more complicated theorems are welcome.

A: $$0\leq\left(1+\frac{x}{2}\right)-\sqrt{1+x}=\frac{\left(1+\frac{x}{2}\right)^2-(1+x)}{1+\frac{x}{2}+\sqrt{1+x}}\leq\frac{\frac{x^2}{4}}{2\sqrt{1+x}}\leq\frac{x^2}{8}.$$

A: By Taylor's Theorem, for each $x>0$, there is $\zeta\in (0,x)$ such that
$$ \sqrt{1+x} = 1+ \frac{1}{2}x-\frac{1}{8}x^2+ \frac{1}{16}(\zeta+1)^{-\frac{5}{2}}x^3.$$
It is clear that for $x>\zeta>0$:
$$ \frac{1}{16}(\zeta+1)^{-\frac{5}{2}}x^3 >0$$


text:
Q: How to power off programmatically a rooted phone ? I want to power of my device programically my phone is rooted  but this command not power of my device what is wrong ?
            button.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
               Process chperm;
                try {
                    chperm=Runtime.getRuntime().exec("su");
                      DataOutputStream os =
                          new DataOutputStream(chperm.getOutputStream());

                          os.writeBytes("reboot -p\n");
                          os.flush();

                         chperm.waitFor();

                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                    catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
            }
        }
    });

How do I power off device programtically ?

A: Hope it will work for you.
Intent shutdown = new Intent("android.intent.action.ACTION_REQUEST_SHUTDOWN");
    shutdown.putExtra("android.intent.extra.KEY_CONFIRM", false);
    shutdown.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    thisActivity.startActivity(shutdown);

A: this is actually an answer from stackoverflow it self in a different thread.
Programmatically switching off Android phone
try {
    Process proc = Runtime.getRuntime()
                    .exec(new String[]{ "su", "-c", "reboot -p" });
    proc.waitFor();
} catch (Exception ex) {
    ex.printStackTrace();
}

A: To use this code, you need Super User! Works on 4.0 and above!
 Intent i = new Intent("android.intent.action.ACTION_REQUEST_SHUTDOWN");
            i.putExtra("android.intent.extra.KEY_CONFIRM", false);
            i.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
            i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(i);


text:
Q: settings reset in webpshere 7 after application deployment I am using Websphere 7 to deploy a Web project. At the Enterprise Application level in Webpshere I am making some settings related to cookies. I am changing the name of the cookie and marking it as secure. I hit save, I restart the app and all is well, the changes are applied.
The problem is that after I do another deploy the settings are being reset. I understand that these settings are saved into the deployment.xml file and I can see the changes I've done when I access it on the server (it's location is in the app's ear folder), however I do not understand where this file is being originally set. I did not find it anywhere in the code of the app.
How is it being overridden with the default settings after deployment?
How can I make the settings persistent after a deploy?
Thank you

A: Any backend settings that are done at the application EAR level on Websphere get washed away when you uninstall the application.
If you check the folder where deployment.xml resides, it would be something like AppServer/profile/profileXYZ/config/cells/application/EAR.ear/deployment/deployment.xml
When you redeploy, first the earlier application gets undeployed and with this, the above application folder gets deleted alongwith the deployment.xml that you had modified.
On a subsequent deploy, a new deployment.xml gets created. It references your configurations (as done in application.xml, ibm-application-bnd.xml, etc) and creates this file. If you have to change something like class loader policy for your WAR, sadly there is no other way than to do it manually after each redeploy.

A: Are you deploying an Enhanced EAR that contains a deployment.xml?
What is the difference between an EAR file and a "WebSphere Enhanced EAR"?
If the EAR file contains the deployment.xml then when you deploy it the modified deployment.xml will be overwritten with the one from the EAR.


text:
Q: Getting no of characters fit to a Printdocument Line I am doing a winforms billing sytem using c# .I am facing a problem in setting the width of string in  the printdocument.
I want to split the Item description to multiple lines if its length Exceeds a particular length.The width of Qty,Rate,Amount is fixed,But the width of item description can very according to the page width.
 **Item Description       Qty   Rate   Amount**

  1.Item Description-     1.0   12.00   12.00
    One
  2.Item Description-     3.0   20.00   60.00
    Two

How can i get the no of string fit in a particular rectangle region,so that i can split thew item description.
Thanks in advance.

A: Would something like this do the trick?
const int AllowedCharactersPerLine = 16;
string example = "this is a very long string that we want to divide to fit to several lines";
string StringWithRows = "";
int n = 0;
for(int i = 0; i < example.Length; i++)
{
   StringWithRows += example.Substring(i, 1);
   n++;
   if (n == AllowedCharactersPerLine)
   {
       n = 0;
       StringWithRows += Environment.NewLine;
   }
}


text:
Q: SSRS: Group Totals need to be displayed together I've a report which is Grouped by Book ABC and then grouped by State to display the total of Qty.

Is it possible to display the Group totals all together at the bottom of the report ? Something like below:

Here is my Report Design:
It is a table within a table.

Thanks in advance.

A: I would do this with an Adjacent Group.
With data similar to yours (adding an extra Book):

I have a simple table, grouped by Book, which looks and acts like you'd expect:

Now, in the designer I will add an Adjacent Group, adjacent to the existing Details group, grouped on State:

Which looks like:

Now, within each Book I have two repeating groups, one that shows each detail row, then one that shows each State in that Book scope:

This seems pretty close to your requirement.


text:
Q: STM32 Read mic value (MP34DT05-A) from I2S DMA I want to read MEMS microphone (MP34DT05-A) value (in ASCII) from STM32F107 board. I'm using I2S to communicate with the microphone.
What I did:

*

*I tried simple reading with HAL_I2S_Receive_DMA(&hi2s3, i2sbuffer, 100); which uint16_t i2sbuffer[256]; and the result is random character (E⸮h2FI⸮g⸮⸮F⸮⸮⸮).

*I'm using PDM_Filter from pdm2pcm_glo.h (STM32_Audio\Addons\PDM library):

HAL_I2S_Receive_DMA(&hi2s3, pdm_buff, 16);
PDM_Filter(&cbuff[0], &pcm_buff[0], &PDM1_filter_handler);

and the result still random character (d⸮⸮l⸮巳⸮N#⸮&6⸮4q٣⸮#⸮d⸮ɻ&⸮}⸮).
Should I need conversion for the data? Or I did something wrong?

A: A PDM microphone does not output ASCII!
The PDM microphone outputs a sequence of 1-bit values.
The function PDM_Filter converts it to PCM, which is a sequence of 16-bit values, still in binary.
To print the 16 bit sequence as text, you would need to do something like:
printf("%hi,", pcm_buff[0]);
printf("%hi,", pcm_buff[1]);
...

but obviously you can use a loop.


text:
Q: Deleting a Record in a Form by C# I want to write a code with Stored Procedure in C# that when the record is found and when clicking on delete button, the record will be deleted.
I had put this Code in SellerDelete Form:
Model.DB_EstateTBEntities Obj_DB = new Model.DB_EstateTBEntities();
int GridVWID;

private void pictureBox1_Click(object sender, EventArgs e)
{
    // Delete Button:
    Obj_DB.Sp_DelByIDSeller(GridVWID);
    int Cnt3 = Obj_DB.SaveChanges();
    MessageBox.Show(" You are Deleting {0} rows!! " + Cnt3);
    dataGridView1.DataSource = Obj_DB.Tbl_SellerInfo.ToList();
 }

What should I do?
The Error:

(field) int Frm_SellerDelete.GridVWID
Argument 1: Cannot convert from 'int' to 'System.Data.Entity.Core.Objects.ObjectParameter'
Show Potential fixes (Ctrl+.)

The Stored Procedure query:
create procedure Sp_DelByIDSeller
(@ID int out)
as
begin
delete from Tbl_SellerInfo where ID=@ID
end

A: you are getting this error because you are trying to pass an id "GridVWID" while your Obj_DB is expecting an entity.
please check this article it will help you understand how to delete a record in EF
https://www.codeproject.com/Articles/363040/An-Introduction-to-Entity-Framework-for-Absolute-B


text:
Q: SQL: is there a way to count the number of values from a table if there are none? So i have 2 tables, one its "Movies"(movie,type,lenght) and one "Cast"(title_movie,id_actor) and i have to count in how many "SF" Movies every actor played.
I tried this:
SELECT id_actor, Count(type)
FROM Cast, Movies
WHERE type='SF' and  title_movie=movie
GROUP BY id_actor;

and it only shows me the actors that has at least 1 SF movie, the ones with 0 movies are not displayed. Any ideas?

A: LEFT JOIN to get all actors. To count SF movies only, use a case expression to do conditional aggregation.
SELECT id_actor, sum(case when type = 'SF' then 1 else 0 end)
FROM Cast
LEFT JOIN Movies ON title_movie = movie
GROUP BY id_actor;


text:
Q: Mathematically rigorous NLP I'm looking for resources (books/articles/whatever) that provide mathematical formalization of NLP and statistical language theory. By that I mean clear exposition of the subject in terms of probability spaces (measure spaces) and so on.
For example, many NLP books (like the Manning's one) use n-gram models which, as I see, may be modelled as Markov processes with word-states, but neither book states explicitly how the probability space for the process is constructed (I guess, there's something related to probabilities on formal languages?). I need such clear expositions. Thanks in advance.


text:
Q: Collapsible indented tree's initial state I want to make tree's initial state folded not spread, like below picture:

Not like this picture:

Which part should I fix? Should I fix the update function part? Or any other part? I can't reference my code because it is too long.
Reference : https://bl.ocks.org/mbostock/1093025

A: Since you didn't share your code, but just Bostock's one, this answer will be tailored to that bl.ocks.
What you want can be done changing the nodes at the first level, with:
root.children.forEach(function(d){
    d._children = d.children;
    d.children = null;
});

Here is the updated bl.ocks: https://bl.ocks.org/anonymous/d6844f0377a2505c70a8b2ca1777cbac/3e9614786e1b2618408fca9674b0e20818c9b980


text:
Q: How to tell search engines which is the main menu? I wanted to implement the following structure on my website:

Site Title

Section 1

Section 2

Section 3

I have several
 on the same page. So, I added
 to the
 which contains main menu and I was thinking that this will be easy for search engines to find the main menu. Many sources say that there should not be more than one
 tag on each page and
 must be different on each page. If it's true, how can I tell to search engines that the main menu is located inside of
 and not inside of some another
?
I just checked my website in Google and it shows 6 links below the title which look like section names but they are not.
Thanks.

A: it is right every page must have only one h1 and you may use h2 h3 and arrange your data for search engine
all links will be followed and archived in search engine by default except if you tell other by your robot meta tag in every page and not only the main one
you may submit sitemap xml in your website and search engine will submit all your pages.
my advice is to think in search engines in every page with it's content not the whole website, search engines archive and rank website pages, so the good pages friendly to search engine will appear in first results in searching about a content in this pages.
My Regards


text:
Q: I made a marketing research - VS - I did a marketing research Make VS do
I made a marketing research - VS - I did a marketing research
Marketing Research= a written business report most of the time printed and delivered to people in business meetings
Do you use "make" or "do" in regards an activity that is intangible but it produces something tangible like a written report?

A: The verb here would be to do, so did is the past participle you would use here. However, as comments have pointed out, research is an uncountable noun so you would not do a marketing research but would do marketing research.
Also, typically research into the state of a market, which is what sounds like you are saying would be called market research rather than marketing research.
Marketing research may discuss the activities or methods of a company's marketing department, marketing or advertising methods or alternatives,how to sell something, advertising choices, etc.
Market research may discuss what people are buying, what products exist (or not), if there may be a demand for a product, what gaps exist in the market, etc.


text:
Q: Alternativa ao Absolut Layout Vi que o AbsoluteLayout foi descontinuado por questões de padrões em diferentes telefones. Uso atualmente o RelativeLayout, mas se por ele manter os objetos em posições relativas, se eu mudo um, o resto todo é alterado.
Existe algum substituto do AbsoluteLayout que deixe que eu mexa livremente nos componentes sem alterar a posição dos demais?

A: Fala Gustavo,
Quando você usa o RelativeLayout, você deve especificar qual item fica em cima de qual, por exemplo:
<TextView
    android:id="@+id/name_dias"
    android:text="Leonardo Dias"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

<TextView
    android:id="@+id/name_rotondo"
    android:text="Gustavo Rotondo"
    android:layout_below="@id/name_dias"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

Eu tenho dois TextView, sendo que o Gustado Rotondo, ficará abaixo do Leonardo Dias.
E assim você vai controlando, existem outras opções também:

*

*android:layout_toRightOf="@id/name_dias" (esquerda)

*android:layout_toLeftOf="@id/name_dias" (direita)

*android:layout_above="@id/name_dias" (acima)

E você também pode usar o LinearLayout, quando você define ele, obrigatóriamente você deve especificar uma orientação, vertical ou horizontal, e os próprios items vão se encaixando:
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

Assim, todos os items vão se encaixando um abaixo do outro.
Espero ter conseguido explicar da melhor forma.
Abraços.

A: Gustavo, você pode continuar usando o RelativeLayout e setar a margem do componente para posicionar ele onde você quiser, é a única alternativa em relação ao AbsoluteLayout onde você fixava no lugar que queria.
Mas não é recomendado que você trabalhe com posições fixas de view, pois elas não serão posicionados do mesmo jeito em dispositivos com tamanhos de telas diferentes.


text:
Q: CFWheels not adding automatic validatesPresenceOf to NOT NULL field I added a couple columns to a table in MySQL:

*

*totalSavings DOUBLE NOT NULL DEFAULT 0

*totalDebt DOUBLE NOT NULL DEFAULT 0
There are several other columns in the table configured in a similar manner, and CFWheels is appropriately adding a validatesPresenceOf validation to those properties.
But my new ones are not being picked up as required by CFWheels automatic validations. Why is that?

A: As it turns out, CFWheels will skip the validatesPresenceOf automatic validation if there is a DEFAULT value set on the column.
I needed to add the DEFAULT 0 to the column initially so records would be set with that default. But then removing the default fixed the issue with the validation.


text:
Q: Router CLI command to change LAN IP What are the possible router CLI command on changing LAN IP? I am currently setting up my load balance router with 3 ISPs. The 2 modems having the same IP. I know how to do it on GUI but I am limited access but have full access using terminal.
BTW, modem is Huawei BM622i


text:
Q: Local links in a fancybox div not working Hidden div for Fancybox (v2) usage:

You Can't Use That Yet

That's the special stuff.

New to the Site?

Get Started Today

Already Registered?

Log In

Various links elsewhere in the page with a class of authctrl should open the fancybox...
Special Stuff
Some Other Special Stuff

... using this function:
$('.authctrl').click(function(e){
    e.preventDefault();
    $('#embargomsg').fancybox({
    closeClick : false
    }).trigger('click');
});

... but when either of the .authctrl links are clicked, the Fancybox seems to just quickly close and reopen. I tried adding closeClick: false to no avail.

A: Does $('#embargomsg') have an href?
$('.authctrl').click(function(e){
    e.preventDefault();
    $('#embargomsg').trigger('click');
});

$('#embargomsg').fancybox({
    closeClick : false
});

provide some markup please.


text:
Q: Count all amount from object in a List I have this Java object stored in a List:
public class ExpressCheckout
{
    String currency;
    float amount;
    int quantity;
    String name;
    String description;
.......
}

How I can count all amount value into List from every Object?

A: do something like:
public float sumAmounts(List<ExpressCheckout> myList){
  float total = 0.0f;
  for(ExpressCheckout item : myList){
    total += item.getAmount();
  }
  return total;
}

just put them inside a for or a foreach and sum amounts

A: If you are using Java 8 a very simple technique with streams is:
list.stream().mapToDouble(ExpressCheckout::getAmount).sum();

A: Caveat , I use Java 8 and logically assuming when you have multi currency you cannot simply sum them all. You may need to group by currency and sum. This gives you a fair idea on that
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class SomeClass {
    protected class ExpressCheckout {
        public String getCurrency() {
            return currency;
        }

        public void setCurrency(String currency) {
            this.currency = currency;
        }

        public float getAmount() {
            return amount;
        }

        public void setAmount(float amount) {
            this.amount = amount;
        }

        public int getQuantity() {
            return quantity;
        }

        public void setQuantity(int quantity) {
            this.quantity = quantity;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        String currency;
        float amount;
        int quantity;
        String name;
        String description;

        public ExpressCheckout(String currency, float amount, int quantity, String name, String description) {
            this.currency = currency;
            this.amount = amount;
            this.quantity = quantity;
            this.name = name;
            this.description = description;
        }
    }

    public static void main(String[] args) {
        List<ExpressCheckout> expressCheckouts = new ArrayList<ExpressCheckout>();
        ExpressCheckout co1 = new SomeClass().new ExpressCheckout("USD", 20.01f, 2, "Item1", "Some item");
        ExpressCheckout co2 = new SomeClass().new ExpressCheckout("USD", 2.0f, 2, "Item1", "Some item");

        ExpressCheckout co3 = new SomeClass().new ExpressCheckout("INR", 100.01f, 2, "Item1", "Some item");

        ExpressCheckout co4 = new SomeClass().new ExpressCheckout("INR", 100.01f, 2, "Item1", "Some item");

        ExpressCheckout co5 = new SomeClass().new ExpressCheckout("INR", 200.01f, 2, "Item1", "Some item");
        expressCheckouts.add(co1);
        expressCheckouts.add(co2);
        expressCheckouts.add(co3);
        expressCheckouts.add(co4);
        expressCheckouts.add(co5);
        System.out
                .println(expressCheckouts.stream().collect(Collectors.groupingBy(SomeClass.ExpressCheckout::getCurrency,
                        Collectors.summingDouble(SomeClass.ExpressCheckout::getAmount))));

    }

}


text:
Q: How many elements can a Stack store in Java? Is there a maximum number of elements that can be stored in a stack? Is the only limitation the amount of storage available to the system?
For clarity, I'm referring to java.util.Stack.

A: If you are taling about java.util.Stack, then the limit is Integer.MAX_VALUE which is about 2 billion. However if you let it grow naturally, you get an exception if you add more than about 1.3 billion (10 * 2^28) as it will try to grow the underlying array to a size larger than is allowed.
IMHO Stack is a legacy class replaced in Java 1.2 (1998) I don't suggest you use it.

A: The storage capability is normally limited by memory available, either heap memory for stack data structures or stack memory for the call stack.


text:
Q: Exclude specific dependency from only one flavor I have many flavors (5 for example) and all of them uses common dependency.
I know how to compile library only for one flavor (flavorImplementation "org.sample:lib:1.0").
But now I need exclude this dependency for one of flavors. I've overrode dependency packages with stubs in flavor, but dependency still compiles for this flavor.


text:
Q: Scribus .eps file export is unsatisfactory In Scribus 1.4.5, I exported my .sla file into the Encapsulated PostScript format:
File -> Export -> Save as EPS
Indeed, Scribus created an .eps file.  I verified that the font was embedded (subsetted in this case) by looking inside of it:
less myfile.eps
The problem with myfile.eps is that the 500 point font (that's a big size) has jagged edges when viewed in a typical viewing app, such as GwenView.  You don't see the jagged edges until you zoom into the font.  And so here is my question: How do I tell the Scribus EPS export function to create even more resolution within the embedding?
Thank You.

A: Scribus' main export target is PDF.
All other export formats are there for your comfort (and because once you have the EPS import, the EPS export might be easy to create).
If you're not happy with the result, you should really export a PDF from Scribus and then convert that PDF into whatever your final target is.
Also -- as far as I know -- Scribus' EPS export, is using Ghostscript (GS): if you have some degree of programming literacy, you can have a look at the parameters Scribus is passing to GS and see if there is anything you can do to improve the EPS export.
On the other side, from you description of the problem, I fear a mismatch between the curves Scribus is providing to the exporter and the ones GS can define for EPS... Which would be harder to fix. But it's not easy to say anything without seeing your files and eventually having checked the code involved.


text:
Q: Disable Cypress from automatic scrolling I am testing my application where I have very long side menu and I have a code like that:
cy.get('tab').click({force: true})

The automatic scroll happens between get and click and then selected tab is not visible since the top menu has possition fixed. I found many solutions but none of them worked. So far I tried .click({force: true}) and .click(scrollBehaviour: false}) also .scrollIntoView() between get and click.
Is there any other way to solve this issue?

A: You can set the scrollBehavior globally or per test(-suite).
I'm disabling it on a per tests basis like so:
it('check something w/ autoscroll disabled', { scrollBehavior: false }, () => {
  cy.get('.tab').click();
  // do something else ...
});

Docs: https://docs.cypress.io/guides/references/configuration#Actionability

A: Did you try using scrollBehaviour: 'top' ?
You can find more details regarding the ScrollBehaviour here:
https://docs.cypress.io/guides/core-concepts/interacting-with-elements#Scrolling
https://docs.cypress.io/guides/references/configuration#Actionability
https://docs.cypress.io/api/commands/click#Arguments

A: Did you try to type "scrollBehavior": false in cypress.json file? Because it worked for me.

A: Depends on how the auto-scroll is implemented, you can try adding this at the top of the test
cy.window().then(win => win.scrollTo = cy.stub())

which attempts to stub out the native scrollTo function. I haven't tried it, it may fail if win.scrollTo is read-only.
Here's the reference page Window.scrollTo(), to can see in the notes some other variations to try if the app is using those instead.


text:
Q: Does arcpy.AggregatePoints_cartography create multiple polygons? Does this function allow you to put in an array of points, which may, or may not, be representative of many polygons, and create many polygons from it, or just the one, linked?

A: According to the help file:

Polygons are created around clusters of three or more points within the aggregation distance.
Point aggregation may introduce
  polygon holes or areas where adjacent
  polygon boundaries meet at one vertex.

Which would suggest that your aggregation distance will determine whether more than one polygon appears.  Note, that an ArcInfo license is required


text:
Q: reusing controller actions from various other places in website The common situation when developing a website is to have one index action that lists and creates multiple different resources.
For example, lets say that you have transactions controller that lists both payments and expenses on same page (where expense is an auto-calculated group of payments).
On transactions index action, there are two forms: one for creating new expense, and the other for creating new payment. Both of these forms point to submits to their respective controllers create action. If the data is invalid, it should redirect back to transactions#index and display error messages.
This is just a general discussion, it is not related to specific problem, so lets assumpt the following:

*

*No AJAX will be used

*We cannot generalize expenses and payments into shared base

The problem is that while we can submit data to different controller, we can't get response from it. We can redirect back, but then we'll loose our data and validation errors. There are some 'hackish' solutions to this, but I would like to keep this simple.
One way of solving this would be to implement specific actions on transactions controller (like create_expense and create_payment). It would work, but it would cause code duplication and breaking of REST and I dont like it.
The real question is: how can we re-use controller actions from various other places in website, and make it feel like a natural process?

A: You could include a hidden_field :redirect_back_to => transactions_path in your forms, and then just post the forms to their respective controllers, and let the controllers redirect back to params[:redirect_back_to] if it's present.
This might seem a bit hacky, but I think it's the easiest solution if you don't want to use AJAX.


text:
Q: Trouble with convolution integral (sums of two i.d. uniform random variables) I'm reading Ross' A First Course in Probability and I've hit a roadblock. I don't understand how the author goes from
$$f_{X+Y}(a)=\int_0^1f_{X}(a-y)dy$$
to $$f_{X+Y}(a)=\int_0^ady=a$$ for the interval $0\leq a\leq1$
and
$$f_{X+Y}(a)=\int_{a-1}^1dy=2-a$$ for the interval $1<a<2$.
This probably is a dumb question but I've stared at the book for 10 minutes and no avail. Help would be appreciated.


text:
Q: Is it better to croak() or to die() when something bad happens in Perl? perlcritic complaints that the following code, some boilerplate DBI stuff that works perfectly fine, should croak instead of die:
# Connect to database
my $db_handle = DBI->connect( $url, $user, $password ) or die $DBI::errstr;

All this, while die seems to work fine for me.
I would think for a samurai Perl warrior, croak is less honorable than actually die when things go awry. Jokes apart
Why should I croak instead of die?
What are the consequences of not heeding perlcritic's advice?

A: I usually use the following:

*

*die "string" for fatal messages you want to directly communicate to the user. I mostly do this in scripts.

*die $object for full blown exception objects, although most exception classes will have throw method doing that for you. This is for when your caller should be able to tell what kind of error you throw, and maybe even extract information out of it. If you're using Moose, check out Throwable and Throwable-X

*croak "message" like Adrian said is for when your user has done something wrong, and you want to report the error at whatever called your code. Functions and API level methods are usual cases for this.

*confess "message" for library errors where I don't see the usefulness of an exception yet. These are usually runtime errors you assume to be a mistake, rather than an exceptional condition. It can make sense to use exceptions for these, especially if you have a large project that uses exceptions already. But it's a good, nice and easy way to get a stacktrace with the error.

A: If we called the die and croak outside the function there is no
difference between these functions.
We can only find difference when we call die and croak within any
other function.
croak will gives information about the caller such as function name
and line number..etc.
die will give error and gives the line number where the error has occured.

A: From http://www.perlmonks.org/?node_id=685452

You use die when the error is something you or your code didn't do right. You use croak when it's something your caller isn't doing right. die "error: $!" indicates the error is on the line where the error occured. croak "error: $!" indicates the error is on the line where the caller called your code.

In this case, the error (connection error to DB) has nothing to do with the caller and everything to do with the line making the connection, so I would use die.

A: It's not necessarily wrong to use die() but croak() gives you or your user a lot more information about what went wrong. There's also variables that can be set in the Carp namespace that can change this output to get more or less information.
It's equivalent to die() but with more information and control.

A: Still. This example may want to use croak if the connection parameters came directly from the inputs to the function as others pointed out.
If you write a test for yourself that triggers the exception then you will be your own client and appreciate which is better.
If it is very hard to test error condition it may be a case for die over croak. But any parameter validating errors should use croak.

A:
The Carp routines are useful in your own modules because they act like die() or warn(), but with a message which is more likely to be useful to a user of your module.

https://perldoc.perl.org/Carp


text:
Q: integration testing in react native for dynamic dropdown list using testing-library/react-native I Have wrote test case dropdown list its working fine when data of dropdown list is static
but its fails on dynamics data
so i called that api using rest.get(baseURL + /location/getstates, (req, res, ctx) and then i set response manually
still i getting error
any suggestion ? Where i went wrong ?

import React from 'react';
import {
  fireEvent,
  render,
  waitFor,
  cleanup,
} from '@testing-library/react-native';
import {rest} from 'msw';
import {setupServer} from 'msw/node';
import {act, renderHook} from '@testing-library/react-hooks';
import EditProfile from '../Profile/ProfilEdit/InvestmentPreference';
import '@testing-library/jest-dom';
import {store} from '../../redux/store';
import {Provider} from 'react-redux';
import '@testing-library/jest-dom/extend-expect';
import {NavigationContainer} from '@react-navigation/native';
import {baseURL, postApi} from '../../helpers/api';
import AddProperty from '../Property/AddProperty';

const server = setupServer(
  rest.post(baseURL + `/property`, (req, res, ctx) => {
    console.log('res', req.body);
    return res(ctx.json({data: {data: {_id: '123'}}}));
  }),
  rest.get(baseURL + `/location/getstates`, (req, res, ctx) => {
    console.log('res', res);
    return res(
      ctx.json({
        data: {
          data: [
            {_id: '602fa607441edd89c26a9f82', name: 'Delhi'},
            {_id: '602fab68441edd89c26a9fe5', name: 'Gujarat'},
            {_id: '600977053d18389683c8babd', name: 'Karnataka'},
            {_id: '60097b65314a69997cf5593f', name: 'Maharashtra'},
            {_id: '602fab86441edd89c26a9fe6', name: 'Tamil Nadu'},
            {_id: '60097d1b314a69997cf55940', name: 'Telangana'},
            {_id: '602fab54441edd89c26a9fe4', name: 'West Bengal'},
          ],
        },
      }),
    );
  }),
);

beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());

function renderWithRedux(component) {
  return {
    ...render(
      <Provider store={store}>
        <NavigationContainer>{component}</NavigationContainer>
      </Provider>,
    ),
  };
}

describe('AddProperty Screen', () => {
  it('should validate form', async () => {
    const callback = jest.fn();
    const navigation = {navigate: callback};
    const {getByTestId, getByPlaceholderText, getByText, getByDisplayValue} =
      renderWithRedux(
        <AddProperty navigation={navigation} route={{params: {id: '123'}}} />,
      );

    const PropertyName = getByPlaceholderText('Property Name');
    const Khata = getByPlaceholderText('Khata');
    const ROI = getByPlaceholderText('Enter ROI');
    const EnterAmount = getByPlaceholderText('Enter Amount');
    const PropertySize = getByPlaceholderText('Enter Property Size');
    const BuildupArea = getByText('Buildup Area');
    const propertyStatus = getByText(new RegExp('Add Property Status', 'g'));
    fireEvent.press(propertyStatus);
    fireEvent.press(getByText(new RegExp('For Sale', 'g')));

    const propertyCurrentStatus = getByText(
      new RegExp('Add Property Position', 'g'),
    );
    fireEvent.press(propertyCurrentStatus);
    fireEvent.press(getByText(new RegExp('Rented', 'g')));

    const states = getByText(new RegExp('Select State', 'g'));
    fireEvent.press(states);
    fireEvent.press(getByText(new RegExp('Delhi', 'g')));

    expect(PropertyName).toBeDefined();
    expect(Khata).toBeDefined();
    expect(ROI).toBeDefined();
    expect(BuildupArea).toBeDefined();
    expect(EnterAmount).toBeDefined();
    expect(PropertySize).toBeDefined();

A: For async functions we have to use findByText instead of getByText. The following code will solve the issue, and please check the documentation for more information https://testing-library.com/docs/example-findbytext/
const states = await findByText(new RegExp('Select State', 'g'));


text:
Q: Check mark to disable row swift Sorry Im new to Swift and I wanted to add a check mark functionality to my mock app. How can I add a check mark that would disable the selected row and then enable it when the check mark is deselected? Disable as in the row is visible but not tap-able.

A: You can do something like this.
I used a button instead your checkbox.
import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var checkButton: UIButton!
    @IBOutlet weak var textField: UITextField!
    var enable = true;

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
    }

    @IBAction func touchButton(_ sender: Any) {
        if enable {
            checkButton.setTitle("Disable", for: .normal)
            textField.isEnabled = false
            enable = false
        } else {
            checkButton.setTitle("Enable", for: .normal)
            textField.isEnabled = true
            enable = true
        }
    }
}


text:
Q: Please help with my basic java implementation of Conway's game of life I have spent quite a while trying to write a program to implement Conway's game of life - Link with more info.  . I am following some online guides and was given the majority of the functions. I wrote the "next" and "neighbours" methods shown below. Could anyone tell me if these are good implementations, and how they could be made better please ?
The point of the exercise was to not modify or change any of the other methods and just write the next method ! :)
import java.io.*;
import java.util.Random;

public class Life {

private boolean[][] cells;

public static void main( String[] args ) {
  Life generation = new Life( );
  for (int i = 0; i != 10; i++) {
    System.out.println( generation );
    generation.next( );
  }
}
// Constructors

public void next (){

  int SIZE;
  SIZE=cells.length;
  boolean[][] tempCells = new boolean [SIZE] [SIZE];

  for( int i=0; i<SIZE; i++ ) {
 for( int j=0; j<SIZE; j++ ) {
  tempCells[i][j] = cells[i][j];
 }
  }
  for (int row = 0; row < cells.length ; row++)
  {
    for (int col = 0 ; col < cells[row].length ; col++)
    {
      if ( neighbours(row, col) > 3  ||  neighbours(row, col) < 2 )
      {
        tempCells[row][col] = false;
      }
      else if (neighbours(row, col) == 3 )
      {
        tempCells[row][col] = true;
      }

    }

  }
  cells = tempCells;

}

public int neighbours (int row, int col) {
  int acc=0;
  for ( int i = row -1; i <= row + 1 ; i++)
    {
     for (int j = col -1 ; j <= col + 1 ; j++)
       {
       try {
         if (cells[i][j]==true && (i != row || j!=col))
         {
           acc++;
         }
       } catch ( ArrayIndexOutOfBoundsException f)
       {continue;}
     }
  }
  return acc;
}

// Initialises 6 * 6 grid with Glider pattern.
public Life( ) {
final int SIZE = 8;
// Arguably, this should have been a class (static) array.
final int[][] pairs = {{2,4},{3,3},{1,2},{2,2},{3,2}};
cells = new boolean[ SIZE ][ ];
for (int row = 0; row < SIZE; row ++) {
cells[ row ] = new boolean[ SIZE ];
}
for (int pair = 0; pair < pairs.length; pair ++) {
final int row = pairs[ pair ][ 0 ];
final int col = pairs[ pair ][ 1 ];
cells[ row ][ col ] = true;
}
}
 // Initialise size * size grid with random cells.
//public Life( int size ) {
//final Random rand = new Random( );
//cells = new boolean[ size ][ ];
//for (int row = 0; row < size; row ++) {
//cells[ row ] = new boolean[ size ];
//for (int col = 0; col < size; col ++) {
//cells[ row ][ col ] = (rand.nextInt( 2 ) == 0);
//}
//}
//}
// Public methods and helper methods.

@Override
public String toString( ) {
String result = "";
for (int row = 0; row < cells.length; row ++) {
final boolean[] column = cells[ row ];
for (int col = 0; col < column.length; col ++) {
result = result + (column[ col ] ? "x" : ".");
}
result = result + "\n";
}
return result;
}
}

A: You don't need to copy the contents of cells to tempCells (the first nested loop in next). Instead, you can add one extra clause to the if-else in the next loop. Also, storing the result from neighbours may be a good idea for both speed and clarity.
for (int row = 0; row < cells.length ; row++)
    for (int col = 0 ; col < cells[row].length ; col++) {
       int n = neighbours(row,col);

       if (n > 3  ||  n < 2)
           tempCells[row][col] = false;
       else if (n == 3)
           tempCells[row][col] = true;
       else
           tempCells[row][col] = cells[row][col];
    }

(Apart from that, looks fine, but I haven't run and tested your code.)

A: Don't use ArrayIndexOutOfBoundException to compute out-of-boundary (OOB) conditions. It kills performance. Better use the wrap-around mechanism to treat your array like a sphere so that you don't encounter OOBs at all. You could try something like this:
public Cell[] getNeighbours(int i, int j) {
int i2 = i - 1, i3 = i + 1, j2 = j - 1, j3 = j + 1;
if (i2 == -1) i2 = board.length - 1;
if (i3 == (board.length)) i3 = 0;
if (j2 == -1) j2 = board[i].length - 1;
if (j3 == (board[i].length)) j3 = 0;
return new Cell[]{board[i2][j2], board[i2][j], board[i2][j3], board[i][j2], board[i][j3], board[i3][j2], board[i3][j], board[i3][j3]};

}
Then you can loop through the returned array and check how many of those are alive and return that count.


text:
Q: To which word does "all" belong? (in my case) In the following sentence, to which word (rescuers or hope) does 'all' belong?
"Rescuers had abandoned all hope of finding any more survivors."
If it belongs to the rescuers, why doesn't it appear just after the word 'Rescuers'?
and if it belongs to 'hope', why isn't it 'hopes'?

A: Firstly, all is used for hope and not rescuers.
Secondly, the construction all hope [singular] is okay. As Damkerng says in his comment, hope is also an uncountable noun. as used here. So, all with hope is okay.
There's also a song All Hope is Gone.

A: "All hope" is a literal translation of "ogni speranza" from Dante's Divine Comedy.  According to the Divine Comedy, the following words are written on the gates of Hell:

Per me si va nella città dolente,
per me si va nell'eterno dolore,
per me si va tra la perduta gente.
Giustizia mosse il mio alto fattore,
fecemi la divina potestate,
la somma sapienza e il primo amore.
Dinanzi a me me non for cose create,
se non eterne, ed io eterno duro:
lasciate ogni speranza, voi, ch'entrate.

"Lasciate ogni speranza" means "Abandon all hope".


text:
Q: Retrofit 2: Async download many images and store in Android folder I need to download 20 images from remote server and store in Android folder.
Here my code:
Interface:
@GET
Call<ResponseBody> downloadFile(@Url String url);

In fragment:
  private void downloadImagesList(List<Image> imagesList) {
    for (Image image : imagesList) {
        final String imageSourceUrl = imageSource.getUrl();
            Call<ResponseBody> call = RestClientFactory.getRestClient().downloadFile(imageSourceUrl);
            call.enqueue(new DefaultRestClientCallback<ResponseBody>() {
                @Override
                public void onSuccess(Response<ResponseBody> response) {
                    Toast.makeText(context, "Success download from url: " + imageSourceUrl, Toast.LENGTH_LONG).show();
                    // code to write downloaded image to Android's local folder
                }
            });
        }
    }

As you can see I iterate loop and call call.enqueue() for every image.
Is it good solution? Is this can perform my android app?

A: You can use dependencies like Glide , Pissaco etc for downloading images from remote server. Because these provide better caching and error handling. Have a look at the code below. It is using Pissaco to load the image
First add the Pissaco dependency in your build.gradle

compile 'com.squareup.picasso:picasso:2.5.2'

Picasso.with(context)
  .load(url)
  .resize(50, 50)
  .centerCrop()
  .into(imageView)


text:
Q: Error: Command 'java -version' exited with code 20
*

*I run the android automation test from eclipse it throws

Encountered internal error running command: Error: Command 'java -version' exited with code 20
Appium Logfile:

`[BaseDriver] Event 'newSessionRequested' logged at 1519716463353
(12:57:43 GMT+0530 (IST)) [Appium] Merged W3C capabilities
{"desiredCapabilities":{"app":"/Users/sathish/S... into
desiredCapabilities object
{"app":"/Users/sathish/Sathish/CASA/Automation ... [Appium] Creating
new AndroidDriver (v1.39.0) session [Appium] Capabilities: [Appium]
app: /Users/sathish/Sathish/CASA/Automation
Test/EndlessAisleAutomationTest/app/app-qa-debug.apk [Appium]
appActivity: tech.ajira.endlessAisle.activities.TenantLoginActivity
[Appium]   appPackage: tech.ajira.endlessAisle [Appium]
deviceName: Google Nexus 9 [Appium]   platformName: android
[BaseDriver]  [BaseDriver] W3C capabilities [] and MJSONWP desired
capabilities  were provided [BaseDriver] Expected W3C "capabilities"
to be a JSON Object but was provided with: [] [BaseDriver] Falling
back to MJSONWP desired capabilities [BaseDriver] Session created
with session id: e1e27d58-611a-4877-b8fc-8e7e98351be1
[AndroidDriver] Getting Java version [AndroidDriver] Shutting down
Android driver [AndroidDriver] Called deleteSession but bootstrap
wasn't active [MJSONWP] Encountered internal error running command:
Error: Command 'java -version' exited with code 20
    at ChildProcess. (/Applications/Appium.app/Contents/Resources/app/node_modules/teen_process/lib/teen_process.js:97:19)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:194:7)
    at maybeClose (internal/child_process.js:899:16)
    at Socket. (internal/child_process.js:342:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at Pipe._handle.close [as _onclose] (net.js:510:12) [HTTP] <-- POST /wd/hub/session 500 41 ms - 180`
     Please help me to fix this issue. Thank you

A: Seems Appium is not able to connect to the running emulator. Try setting correct values for deviceName and platformVersion capabilities to find the connected device.
In command prompt try running adb devices to get the device name.


text:
Q: Can you efficiently change a lower level Docker container, without rebuilding all the apps that rely on it? I've seen that you can layer Docker containers.  As an example, lets say we had a set up with a Java container at the base, say running Java 6, a Tomcat container running on top of the Java container, and say 400 unique application containers running on top of the Tomcat container.
Is there a way to switch to Java 7, replace the Java 6 container with a Java 7 container, and not have to rebuild 400 applications? and then deploy 400 applications? and then shut down the original 400 applications?
Basically I'm looking for the best way to make a low level change to every application running in your environment.
Thanks,
Paul


text:
Q: Give role to user from direct message I want to make a discord help bot, which take questions to users. If the users can answer all questions correct, the bot give them a role on the server.
How could I do that, the bot give role to user on the server?
I wrote in javascript, with discord.js module.
client.on("message", (datas) => {
    if (datas.author.bot) { return; }

    let messageArray = datas.content.split(" ");
    let command = messageArray[0];
    let args = messageArray.slice(1);

    if (datas.channel.type === "dm") {
        [...]
        if (usersInTest[datas.user] !== undefined) {
            [...]
            } else if (usersInTest[datas.user][0] < testQuestions.length) {
                if (Number(datas.content) && Number(datas.content)>=1 && Number(datas.content)<=3) {
                    if (testQuestions[usersInTest[datas.user][0]][4] === Number(datas.content)) {
                        if (usersInTest[datas.user][0]+1 >= testQuestions.length) {
                            datas.channel.send("You successfully complete the test!");
//give role to user
                            [...]
                            return;
                        }
                        [...]
                    } else {
                        [...]
                    }
                } else {
                    [...]
                }
            }
        }
    }
});

function sendQuestion(channel, user) {
    if (usersInTest[user] !== undefined || channel !== undefined) {
        channel.send(testQuestions[usersInTest[user][0]][0]+"\n\n(1) " + testQuestions[usersInTest[user][0]][1] + "\n(2) " + testQuestions[usersInTest[user][0]][2] + "\n(3) " + testQuestions[usersInTest[user][0]][3] + "\n Type the answer to continue.");
    }
}

A:
client.on("message", (client, datas) => {
    if (datas.author.bot) { return; }

    let messageArray = datas.content.split(" ");
    let command = messageArray[0];
    let args = messageArray.slice(1);
    let guild = client.guilds.get("Guild ID");
    let member = message.guild.member(datas.author.bot);
    if (datas.channel.type === "dm") {
        [...]
        if (usersInTest[datas.user] !== undefined) {
            [...]
            } else if (usersInTest[datas.user][0] < testQuestions.length) {
                if (Number(datas.content) && Number(datas.content)>=1 && Number(datas.content)<=3) {
                    if (testQuestions[usersInTest[datas.user][0]][4] === Number(datas.content)) {
                        if (usersInTest[datas.user][0]+1 >= testQuestions.length) {
                            datas.channel.send("You successfully complete the test!");
                             member.addRole("Role Id")
                            [...]
                            return;
                        }
                        [...]
                    } else {
                        [...]
                    }
                } else {
                    [...]
                }
            }
        }
    }
});

First of all you need to find the guild which i made like let guild = client.guilds.get("Guild ID");, after you need to verify if the user is member of the guild let member = message.guild.member(datas.user); and on the end you just add it to the member member.addRole("Role Id").


text: Q: NetBIOS ping issues I am having an issue with NetBIOS Pinging. When I ping a PC/Server on the network with its NetBIOS Name I am finding that the PC/Server is getting associated with an IP address outside my network (IP 92.242.140.21 to be specific) and this will continue to do so until I do ipconfig /renew on the pinging machine. I am at a loss as to why this is happening. I'm thinking this is a DNS issue but when I look at the DNS records the machines all show the correct FDQN associated with a network IP assigned to the machine. Please provide some avenues for me to troubleshoot this issue.


text:
Q: Why didn't Húrin answer Morwen as she was dying? In The Children of Húrin by Tolkien (and edited by his son), Húrin was bound by the power of Morgoth to a stone chair on a high place on Thangorodrim. He is later released after both Niënor and Túrin commit suicide, Niënor by casting herself over Cabed-en-Aras into the river Teiglin, and Túrin falling on his sword Gurthang.
In the final scene of the book, Húrin finds Morwen near the grave of Túrin. She knows she's dying, and she asks Húrin how Túrin found Niënor, but Húrin doesn't answer. Why not?

'Almost,' she said. 'I am spent utterly. I shall go with the sun. They
  are lost.' She clutched at his cloak. 'Little time is left,' she said.
  'If you know, tell me! How did she find him?'
But Húrin did not answer, and he sat beside the stone with Morwen in
  his arms; and they did not speak again. The sun went down, and Morwen
  sighed and clasped his hand and was still; and Húrin knew that she had
  died.

A: It's possible this is a remnant from an earlier version of the text. In The War of the Jewels, "The Wanderings of Húrin" Christopher explains that originally Húrin didn't come to his wife before her death and she died alone in front of the tombstone, less tormented than Húrin:

It is said by some that Morwen on a time came... to that stone and read it, and died afterwards, though haply she did not understand the tale that it told, and in that was less tormented than Húrin... [Written in the margin later: Some fate of Morwen must be devised. Did Morwen and Húrin meet again?]
The War of the Jewels, Part Three: The Wanderings Of Húrin

It would seem that from the beginning Tolkien felt Morwen should be less tormented than Húrin during her death. However, later Tolkien entertained the idea that Morwen and Húrin may meet.
In a later plot synopsis, Tolkien introduces the idea the Húrin encounters Morwen:

Húrin comes to the Stone and there finds Morwen, who dies.
ibid.

The conversation at this point has not been fleshed out. However a later manuscript, titled "The Wanderings of Húrin", Tolkien expands on the idea of the conversation between Morwen and Húrin and is near identical to that in The Children of Húrin.

'Almost,' she said. 'I am spent utterly. I shall go with the sun. They are lost.' She clutched at his cloak. 'Little time is left,' she said. 'If you know, tell me! How did she find him?'
But Húrin did not answer, and he sat beside the stone with Morwen in his arms; and they did not speak again. The sun went down, and Morwen sighed and clasped his hand and was still; and Húrin knew that she had died.
ibid.

While the conclusions in the comment/other answer may be correct, I find it more likely to be a remnant of the idea from a much earlier writing that Morwen died less tormented than Húrin.

A: To expand on @Nolimon's excellent comment: You have finally found your long-lost wife but only as she is dying. You're sitting there next to her, having been released from decades of torture, and knowing that your children were both suicides after committing incest. How likely is it you would want your last interaction with your beloved to be one of crushing whatever happiness remains to her?
The text reads:

...Sitting in the shadow of the stone there was a woman, bent over her knees; and as Hurin stood there silent she cast back her tattered hood and lifted her face. Grey she was and old, but suddenly her eyes looked into his, and he knew her; for though they were wild and full of fear, that light still gleamed in them that long ago had earned for her the name Eledhwen, proudest and most beautiful of mortal women in the days of old.
'You come at last,' she said. 'I have waited too long.'
'It was a dark road. I have come as I could,' he answered.
'But you are too late,' said Morwen. 'They are lost.'
'I know it,' he said. 'But you are not.'
But Morwen said 'Almost. I am spent I shall go with the sun. Now little time is left if you know, tell me! How did she find him?'
But Hurin did not answer, and they sat beside the stone, and did not speak again; and when the sun went down Morwen sighed and clasped his hand, and was still; and Hurin knew that she had died. He looked down at her in the twilight and it seemed to him that the lines of grief and cruel hardship were smoothed away. 'She was not conquered,' he said; and he closed her eyes, and sat unmoving beside her as the night drew down.

Unless Morwen knew (or guessed) that you knew the details and demanded them -- and there's no hint of that in the text -- there is simply no reason to tell her for her benefit.
Arguably for Hurin there's the benefit in that he might unload some of his troubles on another, but not only would that be cruel, but by letting her die this way he could at least gain some solace that 'She was not conquered'.


text:
Q: Access S3 from lambda using assume role I am trying to create a simple infrastructure using terraform.Terraform should create the lambda and s3 bucket, lambda is triggered using API gateway which is again created terraform.
I have created a role and assigned that to lambda so that lambda can put objects in s3 bucket.
My lambda is written in java, since I am assigning role to lambda to access S3, how do I use that role in my code?
I came across another article which suggested accessing S3 using the below code. I assumed the token generation would be taken care of this.
var s3Client = AmazonS3ClientBuilder.standard()
         .withCredentials(InstanceProfileCredentialsProvider(false))
        .withRegion("ap-southeast-2")
        .build()

I am confused as to how to access s3, do I need to use the role created by terraform in my code or is there a different way to access S3 from java code?

A: You don't need to assume the role inside the Lambda function. Instead, simply configure the Lambda function to assume the IAM role. Or add the relevant S3 policy to the Lambda's existing IAM role.
You don't typically have to supply credentials or region explicitly in this case. Simply use:
AmazonS3 s3Client = new AmazonS3Client();

See the Terraform basic example of creating both an IAM role and a Lambda function, and configuring the Lambda function to assume the configured role.

A: Jarmods answer is correct that you can configure the role of the Lambda directly - but there are particular use cases where you may need to be first in one account, than the other. If you need to assume a role in the middle of your code, then use the STS functionality of your SDK. STS is the library in the aws sdk that controls assuming a role's credentials through code.


text:
Q: Issue using Distinct within a list of objects when I'm trying to remove duplicates from a list of custom objects,
the following are my failed attempt:
1-
model.DatesList = model.DatesList .Distinct().ToList();

2 -
List<DateTimeMask> newDates = new List<DateTimeMask>();
foreach (DateTimeMask _date in DatesList)
{
   if (!newDates.Contains(_date)) newDates.Add(_date);
}
DatesList = newDates;

3 -
model.DatesList = model.DatesList.Select(x=> new DateTimeMask
                                  {
                                    DayOfTheWeek = x.DayOfTheWeek,
                                    DateToString = x.DateToString,
                                    DateTallinn = x.DateTallinn,
                                  }).Distinct().ToList();

What am I doing wrong?
thanks for the help
edit: this is how the object look like
public class DateTimeMask
{
   public string DayOfTheWeek { get; set; }
   public string DateToString { get; set; }
   public DateTime DateTallinn { get; set; }
}


text:
Q: I need to convert date from the format " 02/Jan/2015:08:07:32 " to a normal timestamp format in pandas dataframe? I tried using the following code
     dataframe_access_logs['reciept_time'] = pd.to_datetime(dataframe_access_logs['reciept_time'])

But it gives me an error as "Unknown string format". I thought maybe some dates are written wrong in the data, so I added coerce in the above statement and all my dates are now 'Nat'
Now how do I convert
  02/Jan/2015:08:07:32

to
      2015/01/02 :08:07:32
Thank you for your help

A: You can send a strptime-like format to pd.to_datetime to instruct pandas to parse the date and time correctly:
In [52]: pd.to_datetime('02/Jan/2015:08:07:32', format='%d/%b/%Y:%H:%M:%S')
Out[52]: Timestamp('2015-01-02 08:07:32')


text:
Q: Will creating a Messaging Service within Twilio to connect to Salesforce affect a pre-existing Zoho implementation? Working on an implementation moving from Zoho to Salesforce. As part of the build for the Salesforce integration, we are required to build a Messaging Service in Twilio (this was not needed in Zoho). Will the creation of the Messaging Service impact the pre-existing Zoho implementation?

A: Be aware, of these two configuration aspects:
Messaging Services Defer to Sender's Webhook Option now available
https://www.twilio.com/changelog/messaging-services-defer-to-senders-webhook-option-now-available
Do I have to use a Messaging Service?
https://www.twilio.com/docs/sms/a2p-10dlc/onboarding#do-i-have-to-use-a-messaging-service


text:
Q: How to make complete masonry box clickable - Wordpress I have a site: http://weltreise.inomex.ch/
I have three columsn Monsonry. I'm trying to make the complete each box clickable to complete post. Currently, only read more takes me to complete article. Any idea how to do it?
Thanks

A: How are you running the loop that delivers content to the blocks (plugin, custom template, etc.)
You need to make sure the link tags are being placed around the entire block, not just the "read more" link.

A: Author won't change theme just for you. It is also bad practice to change php file code by yourself, because of all updates and stuff. I would suggest that you add custom javascript(jQuery) (it is dirty solution, but it should work). Also be careful. Even if you wrap masonry brick with anchor(a), you should remove links that are inside that brick -> you should change anchor(a) with something else (span).


text:
Q: Simulating behaviour of a browser while reading gz files from a web server I am trying to read a gz file from a webserver through a python script. The size of the source file is 60Mb or more. I dont want to wait for the whole file to be read to decompress and read the contents. Rather I want to decompress information as and when I receive a few bytes.
I tried doing that, but I get turned off by errors like "CRC check failed ". I am using gzip module , as the server returns the content-encoding as "gzip". I have also tried my luck with zlib, but no fruit.
I have seen Mozilla Firefox or Google Chrome doing the above without any issues . I watched the HTTP headers , and I see that the content is not received all at once, but the browser is able to show decompressed partial data as and when it receives it. How do they do it ? Any help is appreciated.

A: use zlib.decompressobj with the wbits parameter 31.  Then deobj.decompress() will allow you to decompress gzip input a piece at a time.
The 31 does not mean 31 bits.  It is really 15 + 16, where 15 represents the maximum size of the sliding window of 2^15 bytes, and the 16 is an option to request gzip format decoding.  Without adding 16, the zlib format will be decoded, which will reject gzip input.


text:
Q: Prime ideals of the ring of rational functions Let $A$ be a commutative ring with identity. If $f = a_0 + a_1 x + \cdots + a_n x^n \in A[x]$ is a polynomial, define $c(f) = A a_0 + A a_1 + \cdots + A a_n$ the ideal of $A$ generated by the coefficients of $f$. Consider $S$ the subset of $A[x]$ made up of primitive polynomials, i.e. polynomials $f \in A[x]$ such that $c(f) = A$. It is not difficult to prove that $S$ is a multiplicative subset of $A[x]$. Consider the ring
$$
A(x) = S^{-1} (A[x]).
$$
It is easy to show that $S$ does not contain zero-divisors of $A[x]$, hence $A \subseteq A[x] \subseteq A(x)$. If $I$ is an ideal of $A$ then $(I \cdot A(x)) \cap A = I$. If $\mathfrak{p}$ is a prime ideal of $A$ then $\mathfrak{p} \cdot A(x)$ is a prime ideal of $A(x)$. The map $\phi \colon \mathrm{Spec} A(x) \to \mathrm{Spec} A$ defined by $\phi(P) = P \cap A$ is surjective, because a right-inverse is $\mathfrak{p} \mapsto \mathfrak{p} \cdot A(x)$. It is clear that $\dim A \leq \dim A(x) \leq \dim A[x]$.

*

*If $M$ is a maximal ideal of $A(x)$, then does there exist a maximal ideal $\mathfrak{m}$ of $A$ such that $M = \mathfrak{m} \cdot A(x)$?

*Is the map $\phi \colon \mathrm{Spec} A(x) \to \mathrm{Spec} A$ injective? If $A$ is noetherian, then $\dim A(x) = \dim A$?

*If $A$ is a normal domain, then is $A(x)$ a normal domain?

A: The answer to (1) is yes. Let us first show

If $I$ is an ideal of $A[x]$ such that $I\cap S=\emptyset$, then $I$ is contained in $\mathfrak m A[x]$ for some maximal ideal $\mathfrak m$ of $A$.

Proof. Note that
$$I\subseteq \sum_{f\in I} c(f)A[x].$$
So if $I$ is not contained in any $\mathfrak mA[x]$, then $A=\sum_{1\le i\le n} c(f_i)$ for some $f_i\in I$. Fix an $m$ big enough and write
$$f_i(x)=a_{i0}+a_{i1}x+...+ a_{im}x^m$$
($a_{im}$ could be zero) and an identity
$$1=\sum_{i\le n, j\le m} \alpha_{ij}a_{ij}, \quad \alpha_{ij}\in A.$$
Consider the polynomial
$$f=\sum_{i,j}\alpha_{ij}f_i(x)x^{m-j} \in I.$$
The term of degree $m$ in $f$ has coefficient equal to $1$. So $f\in S$. Contradiction.
As any $\mathfrak m A[x]$ is prime and has empty intersection with $S$, the above result implies immediately (1).
(2) The map $\phi$ is clearly surjective (consider $\mathfrak qA[x]$ for any $\mathfrak q\in\mathrm{Spec} A$) but is not injective in general. Consider $A=k[t,s]$ over a field $k$. Then $f(x):=t+sx$ generates a prime ideal $\mathfrak p$ of $A[x]$ which doesn't meet $S$ and we have $\mathfrak pS^{-1}A[x]\cap A=\{0\}$. So the generic fiber of $\phi$ has at least two points (in fact infinitely many points).
Note however that $\phi$ is always injective over any maximal ideal $\mathfrak m$ because $\phi^{-1}(\mathfrak m)=\mathfrak mS^{-1}A[x]$.
The argument for the surjectivity of $\phi$ also shows that $\dim S^{-1}A[x]\ge \dim A$. We also have $\dim S^{-1}A[x]\le \dim A[x]=\dim A +1$ when $A$ is noetherian. I don't know whether the equality is possible.
Update: We have $\dim S^{-1}A[x]=\dim A$ when $A$ is noetherian: let $\mathfrak p_0\subset ... \subset \mathfrak p_n$ be a chain of prime ideals of $A[x]$ contained in $A[x]\setminus S$. By (1), we have $\mathfrak p_n\subset \mathfrak mA[x]$ for some maximal ideal $\mathfrak m\subset A$. Then
$$ \mathfrak p_0\subset ... \subset \mathfrak p_n\subset \mathfrak mA[x]+xA[x]$$
is a chain of prime ideals of $A[x]$. Thus $\dim S^{-1}A[x]\le \dim A[x] -1=\dim A$. Your homework is not so easy :).


text:
Q: why this would result in long integer overflow I checked the document that long= int64 has range more than 900,000,000,000,000
Here is my code:
int r = 99;
long test1 = r*r*r*r*r;

at runtime it gives me 919,965,907 instead of the correct 9,509,900,499.
another test
long test2 = 99*99*99*99*99;

It refuses to compile, saying integer overflow.
But if i do this
long test3 = 10100200300;

This works fine.

A: It's using integer multiplication :
long r = 99;
long test1 = r*r*r*r*r;

A: The problem is that the literal "99" is being treated as an int.  If you add "L" it will treat it as a long.  To fix your compilation problem:
long test2 = 99L * 99L * 99L * 99L * 99L;

And to fix the "incorrect result" caused by integer overflow:
long r = 99;
long test1 = r * r * r * r * r;

The key point is that the expression to the right of the "=" is evaluated before the assignment to long r is done.
There are other literal suffixes you might be interested in:
Type    Suffix    Example
uint    U or u    100U
long    L or l    100L
ulong   UL or ul  100UL
float   F or f    123.45F
decimal M or m    123.45M

@m.edmonson, regarding your question about why it comes out to 919965907.  What's happening, is that the value is "wrapping" around int.MaxValue.  You can see this with a little test program:
int i = 99; // 99
i *= 99;    // 9801
i *= 99;    // 970299
i *= 99;    // 96059601
i *= 99;    // 919965907        should be 9509900499 but comes out to 919965907
            //                      which is (9509900499 % int.MaxValue)

long k = 9509900499 % int.MaxValue;

What is meant by "wrapping around"?  When you exceed int.MaxValue by 1, the value "goes back" to int.MinValue.
int j = int.MaxValue;
j++;

bool isNowMinValue = (j == int.MinValue);   // true, the value has "wrapped around"

This is a bit simplistic; if you search for "integer overflow" you will get a better explanation.  It's worth understanding how integers (and other numeric types) are represented with 32 bits:
http://en.wikipedia.org/wiki/Signed_number_representations

A: As the other have said, but:
long test2 = 99L * 99 * 99 * 99 * 99;

This will give you the correct result with less L around :-)
This happens because the first 99L is a long, so all the multiplications are done in the long "field" and all the other integers are upcasted to long before the multiplication (clearly the multiplication is always between 2 numbers and it's from left to right, so it's like (((99L * 99) * 99) * 99) * 99 and each "partial" result is a long and causes the next operand to be converted to long.)

A: Your second test fails because each 99 is an integer; replace it with the following and it compiles.
long test2 = 99L * 99L * 99L * 99L * 99L;

See the MSDN Long Documentation for details.

A: The compiler is looking at 99 as integers, even though the final result will be long.
This will work.
long test2 = 99L*99L*99L*99L*99L;