text:
Q: AssertionFailure: "null identifier" - FluentNH + SQLServerCE The code fails at session.Save(employee); with AssertionFailure "null identifier". What am I doing wrong?

using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using FluentNHibernate.Mapping;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;

namespace FNHTest
{
    public class Employee
    {
        public virtual int Id
        {
            get;
            private set;
        }

        public virtual string Name
        {
            get;
            set;
        }

        public virtual string Surname
        {
            get;
            set;
        }
    }

    public class EmployeeMap : ClassMap
    {
        public EmployeeMap()
        {
            Id(e => e.Id);
            Map(e => e.Name);
            Map(e => e.Surname);
        }
    }

    public class DB
    {
        private static ISessionFactory mySessionFactory = null;

        private static ISessionFactory SessionFactory
        {
            get
            {
                if (mySessionFactory == null)
                {
                    mySessionFactory = Fluently.Configure()
                        .Database(MsSqlCeConfiguration.Standard
                                    .ConnectionString("Data Source=MyDB.sdf"))
                        .Mappings(m => m.FluentMappings.AddFromAssemblyOf())
                        .ExposeConfiguration(BuildSchema)
                        .BuildSessionFactory();
                }
                return mySessionFactory;
            }
        }

        private static void BuildSchema(Configuration configuration)
        {
            SchemaExport schemaExport = new SchemaExport(configuration);
            schemaExport.Execute(false, true, false);
        }

        public static ISession OpenSession()
        {
            return SessionFactory.OpenSession();
        }
    }

    public class Program
    {
        public static void Main(string[] args)
        {
            var employee = new Employee
            {
                Name = "John",
                Surname = "Smith"
            };

            using (ISession session = DB.OpenSession())
            {
                session.Save(employee);
            }
        }
    }
}

A: There's a "bug" when using NHibernate with SQL CE identity columns. There are two workarounds that I know of:
1 - Set the connection.release_mode property to on_close in configuration:
mySessionFactory = Fluently.Configure()
    .Database(MsSqlCeConfiguration.Standard
    .ConnectionString("Data Source=MyDB.sdf"))
    .Mappings(m => m.FluentMappings.AddFromAssemblyOf())
    .ExposeConfiguration(BuildSchema)
    .ExposeConfiguration(x => x.SetProperty("connection.release_mode", "on_close"))
    .BuildSessionFactory();

2 - Perform inserts in a transaction:
    using (ISession session = DB.OpenSession())
    using (ITransaction txn = session.BeginTransaction())
    {
        session.Save(employee);
        txn.Commit();
    }

I realize the question is more than a month old but I hope this answer is still of use to you.

A: Is is still the true. Even first call to SELECT @@IDENTITY returns corect value, but seconds returns null
I use
*connection.driver_class = NHibernate.Driver.SqlServerCeDriver
dialect: NHibernate.Dialect.MsSqlCeDialect*
After adding property
*connection.release_mode: on_close*
to my NHIbernate configuration it works


text:
Q: Getting progressive distance polyline and points in QGIS In QGIS, how do I get the distance between a layer of points and a polyline layer? I have tried with a distance matrix but it does not seem to be working,
I have a layer of points and a polyline; the perpendicular to the polyline must be found and then from the point of intersection the distance to the previous vertex must be calculated not the next. Is possible to have distance automatically?
I have tried with a v.net.connect but not working as it serves me. any ideas? I post this photo. I have to find d1, d2 and d3, the distance of the vertex.

This is the example I have export the distance of all points from the left vertex. I have tried with v.net.connect but the distance are from point to point that intersect. Any ideas?

A: You can use pyqgis and closestSegmentWithContext() which for example will return closest point, next vertex nr which you can use with .distance method:
pointlyr = QgsProject.instance().mapLayersByName("points")[0] #Change to match your layer name
linelyr = QgsProject.instance().mapLayersByName("lines")[0] #Change to match your layer name

#List all features
points = [f for f in pointlyr.getFeatures()] #List all features
lines = [f for f in linelyr.getFeatures()] #List all features

d = {}
for p in points:
    sqrdist, closest_pointxy, afterVertex, _ = min([line.geometry().closestSegmentWithContext(p.geometry().asPoint()) for line in lines], key=lambda x: x[0])
    vertex_before = [v for v in lines[0].geometry().vertices()][afterVertex-1]
    dist = QgsPoint(closest_pointxy).distance(vertex_before)
    print(round(dist,0))
    d[p.id()] = dist

#Use "d" dictionary to update attribute or whatever you want to do

redpajama_set_name: RedPajamaStackExchange


text:
Q: python 3.0 tkinter, how to repeat a function that gets a returned value each button press? As you will see with the following code, I am a professional coder, but I am stuck on this very simple task.
The purpose of the code is to randomly generate a string, match that string to a string in a list, and then return the string + the attribute so then when its pulled by the button widget, it presents the card in its whole. (the name and then the story.) However, it only generates the same card. I want it to generate a new card on each button press. Yes, I am aware that the <Return> refers to the enter key, thats just an easier way to for me to confirm its not working.
import _thread
import tkinter
import tkinter.messagebox
import random
import re
import time
import subprocess
from tkinter import *

top = tkinter.Tk()

def presentcard():
    tkinter.messagebox.showinfo("this is your card", what)

thebutton = tkinter.Button(top, text = "Pull a card out.", command = presentcard)

class Allthecards:
    def __init__(self,name,story):
        self.name = name
        self.story = story

card1 = Allthecards("The Beast", "It eats things")
card2 = Allthecards("The Dog", "It barks at things")
card3 = Allthecards("The Jazz", "It hears things")
card4 = Allthecards("The Candles", "It feels things")
card5 = Allthecards("The Heat", "It burns things")

cardlist = ['card1','card2','card3','card4','card5']

def getcard():
    return(random.choice(cardlist))
thecard =  getcard()

def whichcard():
    if thecard == "card1":
        return(card1.name + " "+ card1.story)
    elif thecard == "card2":
        return(card2.name + " "+ card2.story)
    elif thecard == "card3":
        return(card3.name + " "+ card3.story)
    elif thecard == "card4":
        return(card4.name + " "+ card4.story)
    elif thecard == "card5":
        return(card5.name + " "+ card5.story)
    else:
        return thecard

what = whichcard()

thebutton.bind('<Return>',thecard)
thebutton.bind('<Return>',what)
thebutton.pack()
top.mainloop()

A: You are calling the getcard() method only once. That's reason you are seeing the same message everytime.
Change your presentcard() to the following.
def presentcard():
    global thecard
    thecard = getcard()
    what = whichcard()
    tkinter.messagebox.showinfo("this is your card", what)

It'll give what you want.
Also, if you pass a parameter to the def whichcard() function like def whichcard(thecard), you won't have to use global thecard everywhere in the program. So, the function will change to
def presentcard():
    thecard = getcard()
    what = whichcard(thecard)
    tkinter.messagebox.showinfo("this is your card", what)

Avoid using global variables like you are using in your code. It becomes hard to reuse the functions. Just pass parameters to the functions.


text:
Q: Simple Stokes Theorem problem $\renewcommand{\dd}[1]{\,\mathrm{d}#1}$Use Stokes theorem to evaluate
$$
\iint_\Sigma y \dd{y} \dd{z} + z \dd{z} \dd{x} + x \dd{x} \dd{y}
$$
where $\Sigma$ is upper half-sphere oriented outwardly. Hint:
$$
(y,z,x) = \text{Curl}(-xy, -yz, -zx)
$$

Now, I've used Stokes Theorem and the hint:
$$
\iint_\Sigma y \dd{y} \dd{z} + z \dd{z} \dd{x} + x \dd{x} \dd{y} = \oint_\Gamma -xy  \dd{x} - yz \dd{y} - zx \dd{z}
$$
but I instantly got stuck. What should I do next? I know how to calculate line integrals, but only when parametrization is given. $\Gamma$ seems to be circle with arbitrary radius R, but I can't think of any parametrization which would take z into account.
Any help appreciated.

A: The circle is used because that is the boundary of the upper-half sphere.  Because that circle is in the $xy-$ plane, $z=0$.  A parameterization of the circle could then be
$$x=\cos t$$
$$y=\sin t$$
$$z=0$$


text:
Q: d3: Adding links to nodes in hierarchical edge bundling I'm a super beginner to d3/HTML/JS and I had a question about adding links to nodes in a graph. All of my code is based on: https://gist.github.com/mbostock/7607999

I'd like to add a link that leads to another html file for each node. Is that possible given how the code is structured?

A: Here is a simple way to achieve this:
node = node
    .data(nodes.filter(function(n) { return !n.children; }))
  .enter()
  .append('a')
    .attr("xlink:href", 'http://www.google.com' /*function(d){return d.url;}*/)
  .append("text")
    .attr("class", "node")
    ...

I commented out code that would make the link based on data (i.e. you would have an url field in your input data).
Per request, example of url in data:
"children": [
{
    "name": "John Doe",
            "size": 1458,
            "url":  "http://www.johndoe.com"
            ...


text:
Q: Insertion sort invariant assertion fails In the following code at the end of the for loop I use the assert function in order to test that a[i+1] is greater than or equal to a[i] but I get the following error (after the code below). Also in c++ the assert with the following seems to work just fine but in python (the following code) it does not seem to work...anyone know why?
import random

class Sorting:
    #Precondition: An array a with values.
    #Postcondition: Array a[1...n] is sorted.
    def insertion_sort(self,a):
        #First loop invariant: Array a[1...i] is sorted.
        for j in range(1,len(a)):
            key = a[j]
            i = j-1
            #Second loop invariant: a[i] is the greatest value from a[i...j-1]
            while i >= 0 and a[i] > key:
                a[i+1] = a[i]
                i = i-1
            a[i+1] = key
            assert a[i+1] >= a[i]
        return a

    def random_array(self,size):
        b = []
        for i in range(0,size):
            b.append(random.randint(0,1000))
        return b

sort = Sorting()
print sort.insertion_sort(sort.random_array(10))

The Error:
Traceback (most recent call last):
File "C:\Users\Albaraa\Desktop\CS253\Programming 1\Insertion_Sort.py", line 27, in          <module>
  print sort.insertion_sort(sort.random_array(10))
File "C:\Users\Albaraa\Desktop\CS253\Programming 1\Insertion_Sort.py", line 16, in insertion_sort
    assert a[i+1] >= a[i]
AssertionError

A: Your code is fine. The assertion fails when i==-1. In Python, a[-1] is the last element of the list, so in this case, you are checking whether the first element (a[-1+1]) is greater or equal than the last element (a[-1]).

A: Have a close look at where you're inserting the key.

A: How about this:
import random

class Sorting:
    def insertion_sort(self,a):
        for i in range(1,len(a)):
            key = a[i]
            j = i
            while j > 0 and a[j-1] > key:
                a[j] = a[j-1]
                j-=1
            a[j] = key
        return a

    def random_array(self,size):
        b = []
        for i in range(0,size):
            b.append(random.randint(0,1000))
        print b
        return b

sort = Sorting()
print sort.insertion_sort(sort.random_array(10))

Output:
$ ./sort.py
[195, 644, 900, 859, 367, 57, 534, 635, 707, 224]
[57, 195, 224, 367, 534, 635, 644, 707, 859, 900]


text:
Q: Curvature of plane curve This is a motivation for the definition of the curvature of a plane curve:

Suppose then that $\gamma$ is a unit-speed curve in $\mathbb{R}^2$. As the parameter $t$ of $\gamma$ changes to $t+\Delta t$, the curve moves away from its tangent line at $\gamma(t)$ by a distance $(\gamma(t+\Delta t)-\gamma(t)) \cdot \vec{n}$, where $\vec{n}$ is a unit vector perpendicular to the tangent vector $\gamma'(t)$ of $\gamma$ at the point $\gamma(t)$. By Taylor's theorem, $\gamma(t+\Delta t)=\gamma(t)+\gamma'(t)\Delta t+\frac{1}{2}\gamma''(t)(\Delta t)^2+\mathrm{remainder}$, where $(\mathrm{remainder})/(\Delta t)^2$ tends to zero as $\Delta t$ tends to zero. Since $\gamma' \cdot \vec{n}=0$, the deviation of $\gamma$ from its tangent line at $\gamma(t)$ is $\frac{1}{2} \gamma''(t) \cdot \vec{n}(\Delta t)^2+\mathrm{remainder}$...

"the curve moves away by a distance" Why is $(\gamma(t+\Delta t)-\gamma(t)) \cdot \vec{n}$ the distance? If $\gamma(s)=(\gamma_1(s),\gamma_2(s))$ then the distance between $\gamma(t+\Delta t)$ and $\gamma(t)$, as points in the real plane, is $\sqrt{(\gamma_1(t+\Delta t)-\gamma_1(t))^2+(\gamma_2(t+\Delta t)-\gamma_2(t))^2}$, no? But this is off by a factor of $\cos{\theta}$ ($\theta$ being the angle between $\gamma(t+\Delta t)-\gamma(t)$ and $\vec{n}$.
I'm ok with the rest, but where and why did we divide through by $(\Delta t)^2$? I'm sure it does tend to zero, but how is that relevant to reaching the conclusion that $(\gamma(t+\Delta t)-\gamma(t)) \cdot \vec{n}=\frac{1}{2} \gamma''(t) \cdot \vec{n}(\Delta t)^2+\mathrm{remainder}$?

A: The length $\sqrt{(\gamma_1(t+\Delta t)-\gamma_1(t))^2+(\gamma_2(t+\Delta t)-\gamma_2(t))^2}$ is the distance between the point $\gamma(t + \Delta t)$ and $\gamma(t)$. This is not the distance they're talking about. The author is talking about the distance between $\gamma(t + \Delta t)$ and the tangent line to the curve at the point $\gamma(t)$.
Draw a plane curve like the one under consideration. Mark the points $\gamma(t)$ and $\gamma(t + \Delta t)$. Now draw the tangent line to the curve at $\gamma(t)$, and the unit normal vector $\vec{n}$. This vector should be drawn with its initial point at $\gamma(t)$. The vector $\vec{n}$ has length one and is orthogonal to the tangent line. Now think about the distance between the point $\gamma(t + \Delta t)$ and the tangent line. You should be able to see that this distance is the length of the projection of the vector $\gamma(t + \Delta t) - \gamma(t)$ in the direction $\vec{n}$, which is what the author is calculating.
I'm not sure what you mean in your last question.


text:
Q: How can I parse a website with PHP? I want to make a website with news just like my other site appears on the Internet.
I haven't got enough content. So I want to get content from another news website (Of course, I got permission to copy their content from their site).
For this I used Simple HTML DOM, and it's progressing very well on my other site, but as I apply my script on the release site, it doesn't work (outputs nothing).
Here is the link I want to get the data from: hesspress.com.
Code:
require_once 'simple_html_dom.php';
$lien='http://www.hesspress.com';
$html=new simple_html_dom();
$html->load_file($lien);
$k=$html->find('a',0)->href;
print_r($k);

A: This is what I would use, you can modify it for your own purposes.
It uses the built-in PHP DOM.
Code:
<?php
$url = 'http://acid3.acidtests.org';
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
$html = curl_exec($handle);
libxml_use_internal_errors(true); // Prevent HTML errors from displaying
$doc = new DOMDocument();
$doc->loadHTML($html);
$link = $doc->getElementsByTagName('a')->item(0);
echo 'Link text: ' . $link->nodeValue;
echo '<br />';
echo 'Link URL: ' . $link->getAttribute('href');
?>

A: you can't use your this code in your website you can do it if you use this link  http://php.net/manual/en/book.dom.php


text:
Q: contour integral of $\exp(iz)/z$ I want to calculate the following integral: $\int_\gamma \frac{e^{iz}}{z} dz$ on the contour $\gamma:[0,\pi] \ni \theta \mapsto \epsilon e^{i\theta}$. I'm only interested in the complex part (real part is irrelevant for me).
When I use the standard method for calculating these integrals that gives me: $$\int_0^\pi ie^{i\epsilon e^{i\theta}} d\theta$$ Which doesn't get me any further.

A: If you are interested in the limit for $\epsilon\rightarrow 0^+$, you can use Jordan's trick, that says:
let $\gamma_{\epsilon}=z_0+\epsilon e^{i\theta}$, $\theta\in[\alpha,\beta]$, with $f$ having a simple pole at $z_0$, then
$$\lim_{\epsilon\rightarrow 0^+}\int_{\gamma_{\epsilon}}f(z)dz=(\beta-\alpha)\cdot i\cdot\operatorname{Res}(f,z_0)$$
In your case,
$$\lim_{\epsilon\rightarrow 0^+}\int_{\gamma_{\epsilon}}\frac{e^{iz}}{z}dz=(\pi-0)\cdot i\cdot\operatorname{Res}\Big(\frac{e^{iz}}{z},0\Big)=\pi\cdot i\frac{e^{iz_0}}{1}=\pi\cdot i$$


text:
Q: Black screen with fglrx-updates (14.10) The way was long and painfull until here, but... You will see
The story: I wanted to upgrade my Laptop from Ubuntu 14.04 to 14.10. After applying the update I remembered the situation I was in: I had a black login screen with just a cursor. Last time I just did reinstall ubuntu, because it was the LTS version and I did not feel bad about the upcoming work (since it was an LTS version)
After I got rid of that black screen - I'm still not sure how - I had the lightdm login screen which I exchanged with the 'regular' one. After dealing with ubuntu won't let me login and resending me straight back to the login screen I had the problem that Unity (launcher and top bar) wasn't starting.
The main problem at that time was that
export DISPLAY=:0
 ccsm
did give me the compiz manager where I could select the unity-api box (which was unticked) so that the unity launcher did show up again, but whenever I restarted there was no unity launcher, no top bar no nothing (except my main desktop background).
Somehow - again not shure how - I did manage to get back the launcher and the top bar. Since I had some nasty problems with the Xserver on my system in the past I changed the GPU driver to fglrx-updates (which worked perfectly fine in 14.04 !). The download was OK and unlike the few times before when I tried to select it and it reset the ticked box to the Xserver in the ubuntu options. Now I have - at least I guess that I have - fglrx-updates installed and...
...I'm back to the black screen with the blinking cursor. Hurray for nothing :-(
So I'm not sure what I should do now. Does anybody know what has happened there? Is there a faster way of getting back to my system without spending about 6 hours of my time like I did last time?To be brutally honest: Since ubuntu is one OS on my dual boot machine I thought about removing it completely from my system. Even I somewhat like to work with it I just don't have the time to spend hours on just a black screen and - this is the 'sad' thing for me in that story - I did not ever have such problems with Windows before.
Update:
This is how I got back to a working (?) system:

*

*Press Ctrl+Alt+F1

*log in and run sudo -s to become a root (saves retiping passwords)

*sudo apt-get remove --purge fglrx*

*sudo apt-get autoremove

*sudo apt-get install --reinstall ubuntu-desktop

*sudo apt-get install --reinstall unity

*sudo apt-get install compizconfig-settings-manager

*reboot rebbots your system (now I can see at least the login screen)

*if Ubuntu does not log you in but jumps back to the login page help can be found here

*Again Ctrl+Alt+F1

*export DISPLAY=:0

*ccsm

*Make shure the Unity Plugin Box is ticked

Now I have at least a working system where I have a GUI, but I can't play games any longer (like eg. LIMBO) which is not what I want to have - I don't need an 'just browsing the web' OS! Even I updated my system, I do not want to select fglrx-updates as my display driver again, because I'm pretty shure that I will get a black screen again.
If you have any comments, found a fail in the code above or want to tell me how I get back my working system I would love to hear from you! :D
Things that I have done before on my system while trying to head to a GUI which may help you:
1)

*

*sudo apt-get install --reinstall linux-headers-generic
2)

*sudo apt-get install --reinstall lightdm
3)

*sudo apt-get install lightdm-gtk-greeter (installed the lightdm login screen)

*sudo apt-get remove --purge lightdm-gtk-greeter (removed it and - I guess - swichted back to the regular one)

Pages that helped me with this problem: 1, 2, 3, 4, 5


text:
Q: What is the correct domain for a new translation in a PrestaShop class override? Can you help me with the use of the "domain" parameter in $this->trans() function ?
In my own module I have an override for the CartRule class. My override works correctly - it is copied from my module to the override folder by Presta and the code functions.
I have a new translated string inside, and I do not know what value to give for "domain".
My code:
$this->trans('Promotion codes cannot be combined', array(), 'Shop.Notifications.Error'); \\ ID, parameters, domain

For domain I have tried:

*

*"Shop.Notifications.Error" (same as the other strings): and then looked in BO > Theme Translations > My Theme (or classic theme) > French (store language)

*"Modules.[Mymodule].Admin" (for Mymodule I used a captialized short name): and then looked in BO > Module Translations > My Module > French (store language). This approach follows the PrestaShop rules.
Each time I have not found my string.
Do you have some ideas?
N.B. other answers on SO make use of $this->l which is not available in this context.
I have also tried $this->module->trans() but "module" is not available in this context.

A: First of all in your module we have to specify which strings are translatable.
Translating for Prestashop (version 1.7.5 and older):
TPL:
    {l s='My text to translate' mod='modulename'}

PHP:
    $this->module->l('My text to translate');

Translating for Prestashop (version 1.7.6 and newer):
TPL:
    {l s='My text to translate' d='Modules.Modulename.Somefile'}

TWIG:
    {{ 'My text to translate'|trans({}, 'Modules.Modulename.Admin') }}

PHP:
    // For back-office translations we use "Admin"
    $this->trans('My text to translate', array(), 'Modules.Modulename.Admin');

    // For front-office translations we use "Shop"
    $this->trans('My text to translate', array(), 'Modules.Modulename.Shop');

Ash you can see we need to declare its a translatable string from a Module, with the Modulename (with a capital), and then define where the translatable string is located Admin, shop
Important note
Using the prestashop new translation system needs to be declared in your module. so in your main php file, mymodule.php add following code:
    public function isUsingNewTranslationSystem()
    {
        return true;
    }

PrestaShop Developer Documentation (translations)
Information about the Classic module translation system (1.7.5 and <) can be found here.
Information about the New module translation system (1.7.6 and >) can be found here.
Translating your module:
After defining all translatable strings we install our module to a Prestashop web-shop.
When our module is installed we have to go to:

*

*Back office

*International -> Translations

*Modify translations

*Type of translation -> Installed modules translations

*Select your module -> modulename

*Select your language -> Language you want to translate
This progress will generate a translation file (.php) in your module.
Translation file location: modulename/translations/isocode.php
Good to know is that when you have one translated PHP file of your module (example en.php) you can translate the same, en.php, file multiple times and save it under a different isocode for example nl.php.


text:
Q: "hello world" c cgi script crashes on server" I'm trying to execute a simple c cgi-script on a hosted webserver. I compiled this code:
#include <stdio.h>

int main(){
    printf("Content-type: text/plain\n\n");
    printf("\n");
    printf("<title>Testing CGI-Scripts</title>\n");
    printf("\n");
    printf("
Hello World
\n");
    printf("\n");
    printf("\n");
    return 0;
}

with gcc -o index.cgi index.c, uploaded the binary to the cgi-bin directory and changed the permission to 755. Yet when executing the script (url/cgi-bin/index.cgi) it causes a core-dump and I'm getting "500 Internal Server Error". Analyzing the core-dump with gdb got me "Cannot access memory at address 0x3000000000008" and the same line with "0x3000000000000".
I tried:

*

*compiling on Ubuntu 11.10 (because auf kernel 3.0)

*compiling with -static

(Analysis with gdb from the static binary:
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000401e82 in __libc_start_main ()

)
My System: Arch Linux, kernel 4.20.12 x86_64
Server: CloudLinux 7, kernel 3.10.0-962.3.2.lve1.5.24.8.el7 x86_64
I do not have shell access, unfortunately.

Edit: Solution:
Building a static binary on a virtual machine with CentOS (on which the Servers distro is based on) installed worked!

A: The libraries and linker behavior may vary widely. The two distributions in question aren't even running on the same major kernel version. It sounds like you're compiling against a significantly newer version of glibc than the one that exists on your server.
I recommend you set up cross-compilation or run CloudLinux 7 in a virtual machine and compile in the VM.


text:
Q: Tie children of one div to children of another div with jquery I have two parent divs: .inputs and .infoBoxes. Each of them have an equal number of children. When the user clicks into the first .input in .inputs, the first .infoBox in .infoBoxes should slideDown(). Same for second, third, etc. I'd like to do this without re-writing the same code for each pair. So far I have:
var $inputs = $('.inputs').children();
var $infoBoxes = $('.infoBoxes').children();

for(var i = 0; i < $inputs.length; i++ ) {
    $($inputs[i]).find('.input').focus(function() {
        $($infoBoxes[i]).slideDown();
    })
    $($inputs[i]).find('.input').blur(function() {
        $($infoBoxes[i]).slideUp();
    })
}

This isn't working but I have tried replacing i with the indexes of each div.
$($inputs[0]).find('.input').focus(function() {
    $($infoBoxes[0]).slideDown();
})
$($inputs[0]).find('.input').blur(function() {
    $($infoBoxes[0]).slideUp();
})
repeat...
repeat...
repeat...

This works but isn't very DRY. I'm looking for a better solution that won't have me repeating a bunch of code.

A: First code will not work, because you using same variable for all internal functions. You should wrap it into function, which will create local variable for index. Try following code:
var $inputs = $('.inputs').children();
var $infoBoxes = $('.infoBoxes').children();

for(var i = 0; i < $inputs.length; i++ ) {
    (function(ix) {
      $($inputs[ix]).find('.input').focus(function() {
        $($infoBoxes[ix]).slideDown();
      })
      $($inputs[ix]).find('.input').blur(function() {
        $($infoBoxes[ix]).slideUp();
      })
    })(i);
}

A: slideDown is used for showing elements. I am guessing you want to hide elements, since you are clicking on them and you cant click an hidden element. Use hide or slideUp to hide elements.

$(".input, .infobox").on("click", function() {
  var ind = $(this).index();
  $(".infobox:eq(" + ind + "), .input:eq(" + ind + ")").hide(500);
});
.input,
.infobox {
  widht: 100%;
  height: 50px;
  text-align: center;
  margin: 5px 0;
  color: white;
}
.input {
  background: red;
}
.infobox {
  background: blue;
}

1

2

3

4

5

1

2

3

4

5


text:
Q: VBScript locate specific tag quickly and get its value I wanted to get some value from remote webpage by using local VBScript.
Until now what I could do was to iterate the tag, locate it and get its value.
However, I found it was not inefficient and it took kind of long time. So is there any method to make the VBScript more efficient?
Here are my source HTML and vbscripts, I wanted to get the value 'BBBBBB'.
Source HTML:

                LittleCar

                AAAAAA

                BBBBBB

                CCCCCC

                DDDDDD

VBScript snippets:
Set objDoc = IE.Document
Set allTags = objDoc.getElementsByTagName("a")
For Each aTag in allTags
    If aTag.innerHTML = "BBBBBB"
        'dosomething
    End If
Next

Thx


text:
Q: Magento2.3 - What is the benefit of Declarative DB Schema over Traditional installation schema for DB management? At the Magento Imagine Conference, Magento announced the next noteworthy release on the Magento platform – Magento 2.3. It has enormous features, back-end enhancements, and optimizations.
So I just wonder that What is the actual use of Declarative DB Schema and how it's overcome on Traditional way to install/upgrade table and update its fields in Magento2.3.

A: Declarative schema makes it easy to install and update Magento versions. Prior to now, each time developers needed to compose database scripts in PHP for the new version of Magento.
For example, in the current version of Magento, you can change the pattern of a Magento database by composing code with UpgradeSchema and InstallSchema. However, with the new Magento 2.3, you can impact changes by utilizing a declarative database schema. This way, you can undoubtedly delete data when you uninstall a module.
you can use this link as a reference for more details on which new features in Magento 2.3.
https://www.titechglobal.com/magento-2-3-8-features-that-will-amaze-you/

A: Magento includes this feature in its Magento2.3 version. It simplifies the Magento's installation and upgrade processes.
Previously we had to write the database script for each version of the module. Various scripts were required for different operations on the database.
Declarative schema helps Magento to simplify module upgradation procedures. Natively each upgrade scripts iteratively adds changes to database blindly. Declarative Schema setup is based on database structure declarations.
Declarative Schema files declare what the database structure should be, and Magento determines the differences between the current table structure and what it should be.


text:
Q: How can I add an external Haskell package to a stack project? I would like to add req to my Stack project. I can install this on my machine with stack install req but I would like to list this in the project dependencies so it is downloaded when the project is built if it is currently not installed.
stack.yaml looks like the place to do this but I couldn't find any info on how it's done.

A: In your stack.yaml file, under the extra-deps section, add your dependency. Example:
extra-deps:
- req-1.0.0

Note that you specify the version in the extra-deps if that's not in that particular stackage resolver (the resolver is specified in the stack.yaml file in the field resolver). In case, it's present in the stackage resolver - all you have to do is specify that package name under build-depends section in your cabal file (or the package.yaml file if you are using hpack).
More documentaion is available here.


text:
Q: Electroweak theory Landau pole It is known that non-asymptotically free theories like Quantum Electrodynamics or Scalar field with quartic interactions ($\phi^4$) have a landau pole which mainly investigated through lattice simulations of these theories.
And it is generally considered that it's a sign of incompleteness in the theory.
But what about the electroweak theory, after all, it is considered that weak and electromagnetic forces merge above unification energy into one force?
Does the electroweak theory have a landau pole? Has anyone modeled the $SU(2)$ + $U(1)$ + $\phi^4$ sector?


text:
Q: What are nether fortesses and how can I find them? I have a few questions about the nether and nether fortresses:

*

*How do you find Fortress in the Nether world? I spend many hours searching, all of them ended with death. I still couldn't find any Nether Fortresses. I am starting to doubt whether they even exist or not.

*Is Nether world almost limitless in size, like overworld, or is it limited in size?

*Is there only 1 Fortress in Nether world or are there many?

A: How to find Fortress in Nether world?
They're there, and will spawn in every world (assuming you aren't using a really old version of Minecraft), though, they can sometimes be difficult to find.
There are a few "quirks" in the generation code that you can take advantage of in order to make finding the nether fortresses easier. Tips taken from The Minecraft Wiki on Nether Fortresses:

*

*Nether Fortresses tend to spawn in "strips" aligning along the Z axis (north/south) in the nether. (Tested over 200 seeds so far, the trend is strong in all tested seeds - confirmed with AMIDST.)

*If you don't see a Nether Fortress within 100 blocks or so north/south of your starting position, it's best to search diagonally or east/west. If you continue searching north/south, you may be between strips and never find one.

*On the flip side, if you've found a Nether Fortress, it's best to search north/south from there to find more.

*When trying to spot nether fortresses, a potion of nightvision can help considerably.

If you are not opposed to using external tools or mods, there are several tools which predict where structures will be generated, and create a map for you. The only one I know of off the top of my head (although there are several out there) is Amidst which creates a map of your specific seed, and should work in the nether as well. This will help you find the structures without having to create those chunks by exploring the area first.
Is Nether world almost limitless like overworld or limited size?
The Nether is exactly as limitless as the overworld! (which means, there is technically a limit several million blocks out at which point it starts overwriting old chunks, but there is no chance you can reach that limit "accidentally", you need to travel in a straight line for several real-life days without stopping.)
Is there only 1 Fortress in Nether world or many?
There are many! While there is a hard limit of three Strongholds per world, there is no limit to the number of Nether Fortresses; you can keep on traveling farther and farther, and new fortresses will keep springing up along the way.

A: If you're trying to find a nether fortress, go to settings, and then Video Settings. Just turn up the brightness all of the way and the render chunks some. Not all the way, because it can cause lots of lag for even fast computers because of the "Deepness" of the Nether. It goes along way, and its just a lot for computers to render. Mine works at about twenty, but for slower computers I'd only recommend around 15. Potions can't be used because a brewing stand required blaze rods to make, and blazed spawn in Nether Fortresses Only.

A: Go to the lava level, Y 31. you have a higher chance of finding them there. I watched this youtuber and he demonstrated you have a higher chhance of finding it down there. Also look for bridges of netherack. If you do not see one you can still find  a nether fortress. If you did, follow it and I guarteee you it will lead to a nether fortress.


text:
Q: How can I find my App's full version number from the mainBundle NSDictionary? I know I can find the bundle version from the mainBundle NSDictionary via
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];

This doesn't gives me the full version though. How do I access the object via the CFBundleShortVersionString key?

A: I think you can do something like:
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];

You're not limited to konstants!


text:
Q: Por qué no puedo usar vuejs en mi proyecto? Le he dado muchas vueltas al asunto y no hayo cual es el problema les comento, estoy usando laravel 8. vuejs "vue": "^2.6.12".
este es mi webpack.mix.js
mix.js(['resources/js/jquery-3.3.1.min.js',
'resources/js/bootstrap.min.js',
'resources/js/vue.js',
'resources/js/axios.js',
'resources/js/toastr.js',
'resources/js/app.js',
'resources/js/app2.js'
], 'public/js/app.js');

(no estoy manejando css desde aqui)

      @yield('content')

mi resource/js/app2.js:
var url = '/';
var urlClientes = url + 'vistaclientes';
const app = new Vue({
    el: '#creditos',
    data: {
      clientes: [],
      nombre: '',
    },
    methods:{
      getClientes: function (){
        axios.get(urlClientes).then(response => {
          this.clientes = response.data
        });
      }
    }
});

mi index.blade.php:
<button class="btn btn-primary" v-on:click="getClientes" >Listar</button>

            @{{item.nombre}}

mi vistaclientes:
[{"id":1,"nombre":"Jose Perez"},{"id":2,"nombre":"Juan Lopez"}]

estoy tratando de listar los clientes pero no me aparece nada al darle click en el boton listar, pero no sé por que?


text:
Q: How to rename property created by Object.defineProperty with GCC I wish to rename object property in ADVANCED_OPTIMIZATIONS mode.
Code before optimization:
/**
 * @constructor
 */
function Container() {
  var items = [];
  Object.defineProperty(this, 'items', {
    set: function(value) {
      items = value;
    },
    get: function() {
      return items;
    }
  });
}

var container = new Container();
container.items = [1,2,3];
console.log(container.items);

After optimization:
var b = new function() {
  var a = [];
  Object.defineProperty(this, "items", {set:function(c) {
    a = c
  }, get:function() {
    return a
  }})
};
b.e = [1, 2, 3];
console.log(b.e);

Closure Compiler not renamed the property name - "items".

A: As @owler correctly answered, Closure-compiler can not rename Object.defineProperty created properties because they are always quoted. Instead, use Object.defineProperties as they may be either quoted or unquoted.
/**
 * @constructor
 */
function Container() {
  var items = [];

  Object.defineProperties(this, {
    items$: {
      set: function(value) {
        items = value;
      },
      get: function() {
        return items;
      }
    }
  });
}

var container = new Container();
container.items$ = [1,2,3];
console.log(container.items$);

Note: Properties defined via Object.defineProperties are not eligible for type-based renaming and as such will only be renamed if the property is not defined on any type in the externs set. As such, my example replaces the items property with items$.

A: Closure Compiler will not rename properties that are ever referenced with a quoted string:

Whenever possible, use dot-syntax property names rather than quoted strings. Use quoted string property names only when you don't want Closure Compiler to rename a property at all.

See https://developers.google.com/closure/compiler/docs/api-tutorial3#enable-ui
Since Object.defineProperty requires a string for the property name I'm guessing there is no way to get Closure Compiler to rename it.  If you really need this, you could ask on the Closure Compiler Forum if there is some way to trick the compiler into doing that.


text:
Q: How to upload new multiple nodes with multiple auto-id Im trying to update multiple nodes with multiple auto-id by using for-loop. However it always fail. i cant see anything updated on databse.
Is there any other way to implement it?
let ref = Database.database().reference().child("kardexes").child(newKardex.id)
ref.observeSingleEvent(of: .childAdded, with: { (snapshot) in
   if (snapshot.exists()){
       for treatment in self.treatments {
            self.treatmentId = ref.child("treatments").childByAutoId().key

            var treatmentData = FirebaseDataType()

            treatmentData["name"] = treatment.name

            ref.child("treatments").child(self.treatmentId!).setValue(treatmentData){ (error, ref) in
              if let error = error {
                  Log.debug(" >>> error \(error.localizedDescription)")
                                    }
                                }

                            }
                        } else{
                                print("snapshot doesnt exist")
                            }
                        })

I expect to get the following result, but nothing get updated
kardexes
   |
-LkcSD2KJLwbCj8KAdsd
   |-treatments
        |-"-Lkc5MFEGsfbCj8KAmbo"
            |-name:"abc"
        |-"-Lk5sKCKJLwbCj8KAofj"
            |-name:"def"
        |-"-Lk5sKFOELwbCj8KAjgu"
            |-name:"ijk"

A: This question is a bit unclear but I think you're asking how to create the 'kardexes' node so it looks like the structure presented in you question.
If so, here's the code that does that
func createKardexesNode() {
    let treatmentArray = ["abc", "def", "ghi"]
    let ref = self.ref.child("kardexes").child("-LkcSD2KJLwbCj8KAdsd").child("treatments")
    for treatment in treatmentArray {
        let childRefToAdd = ref.childByAutoId()
        childRefToAdd.child("name").setValue(treatment)
    }
}

running this code generates a node in Firebase that looks like this
{
  "kardexes" : {
    "-LkcSD2KJLwbCj8KAdsd" : {
      "treatments" : {
        "-Ll2dsJivnsH9QRM6MfV" : {
          "name" : "abc"
        },
        "-Ll2dsJivnsH9QRM6MfW" : {
          "name" : "def"
        },
        "-Ll2dsJivnsH9QRM6MfX" : {
          "name" : "ghi"
        }
      }
    }
  }
}

note that self.ref is a class var that points to the root ref of my Firebase. Substitute your own.


text:
Q: Why onChange populating dropdown on 2nd attempt? I have write the code for dependent dropdown in Laravel. All is fine but I dont know why my dropdown populate on 2nd attempt. I have used a library for form repeater from Metronic theme. Here is the link for that library DubDriend.
Here is the HTML part.

                Inventory:

                                        Product:

                                    <select onchange="showModel(this)" id="productss" name="product" class="form-control m-input m-input--air m-input--pill" id="exampleSelect1" required>
                                            <option value="">Select Product</option>
                                        @foreach($product as $key => $value)
                 <option value="{{ $value->id}}">{{ $value->name}}</option>
                @endforeach
         </select>

                                            Model:

                                        <select name="productModel" onchange="showPart(this)" class="form-control m-input m-input--air m-input--pill" id="productModel" required>
                                                <option value="">Select Model</option>
                                        </select>

                                            Parts:

                                        <select name="productPart" class="form-control m-input m-input--air m-input--pill" id="productPart" required>
                                                <option value="">Select Part</option>
                                        </select>

                                            Quantity:

                                        <input name="qty" type="number" class="form-control m-input" placeholder="Enter Quantity" required>

                                    Delete

And this is Javascript function here.

function showModel(abc)
{
    var productName =   $(abc).attr("name");
    var model1 = productName.substr(0, 9);
    console.log(productName + " | " + model1);
    jQuery('select[name="' + productName + '"]').on('change',function(){
                var productID = jQuery(this).val();
                    // console.log(countryID);
               if(productID)
               {
                  jQuery.ajax({
                     url : '/pparts/models/' +productID,
                     type : "GET",
                     dataType : "json",
                     success:function(data)
                     {
                        jQuery('select[name="' + model1 + '[productModel]"]').empty();
                        $('select[name="' + model1 + '[productModel]"]').append('<option value="">Select Model</option>');
                        jQuery.each(data, function(key,value){
                           $('select[name="' + model1 + '[productModel]"]').append('<option value="'+ key +'">'+ value +'</option>');
                        });
                     }
                  });
               }
               else
               {
                  $('select[name="' + model1 + '[productModel]"]').empty();
               }
             });
}

I need to populate dropdown on first attempt.


text:
Q: The best way to convert a String to an Integer or Natural in Idris What is the best way to convert a String to an Integer or Natural in Idris?
I know the standard library is still a work in progress and so if the answer is I should add it to the standard library then that's fine I will try and do that, but before I thought I would confirm there isn't already a way.
The best I could come up with is this if I want to read an Index from the user:
indexAsString <- getLine
let indexAsInt : Integer = cast indexAsString
let items: Vect _ _ = ["shoe", "bat", "hat"]
let i = integerToFin indexAsInt $ length items
maybe (print "invalid index") (\ii => print $ index ii items) i

But this way, I get no indication of failure from cast. Not only is the fact that indexAsString might not be in format allowing it to be converted to an Integer, but on top of that it doesn't even fail at runtime, producing 0 as a result of a "bad cast".
Please tell me there is a better way and/or point me in the right direction.
As a side note, is there a particular reason there is no Read typeclass in Idris? Or has it just not made it in yet?
Thx in advance.

A: Idris has a parseInteger and parsePositive function in Data.String with the type signatures
Num a => Neg a => String -> Maybe a

and
Num a => String -> Maybe a

http://www.idris-lang.org/docs/current/base_doc/docs/Data.String.html

A: I may mistake but I try to share what I think about it. indication of failure is about parsing.
In old idris repository I can see readInt which is String -> Maybe Int but I don't know where is it now.
Howerver there is custom implementation I found here:
charToInt : Char -> Maybe Int
charToInt c = let i = cast {to=Int} c in
              let zero = cast {to=Int} '0' in
              let nine = cast {to=Int} '9' in
              if i < zero || i > nine
                then Nothing
                else Just (i - zero)

total
parse' : Int -> List Int -> Maybe Int
parse' _   []      = Nothing
parse' acc [d]     = Just (10 * acc + d)
parse' acc (d::ds) = parse' (10 * acc + d) ds

total parseInt : String -> Maybe Int
parseInt str = (sequence (map charToInt (unpack str))) >>= parse' 0

main : IO ()
main = do let r = parseInt !getLine
          putStrLn "."

It's easy to read how does it work. charToInt (probably I think it could be coded better but I don't know how) is based on cast , parse is processing Integers one by one recursive doing *10 for each new Integer from List (e.g. symbol) and parseInt maps unpacked String with charToInt and getting the result passing it to parse. ! is alike =<< in Haskell.


text:
Q: How to export to excel in windows app C#? I am new in Windows Application development, Trying to write code for exporting dataset to excel. I have read several examples on the internet regarding this but all are exporting the file to a location. I want to export file like in web (as an open asking to save as file).
Below is my code for the web app, what changes we need to run it on a window?
DataGridView grid_records = new DataGridView();
grid_records.DataSource = dset;
//grid_records.DataBind();

Response.Clear();

Response.Buffer = true;
Response.ClearContent();
Response.ClearHeaders();
Response.Charset = "";
string FileName = "UIDAI" + DateTime.Now + ".xls";
StringWriter strwritter = new StringWriter();
HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
grid_records.GridLines = GridLines.Both;
grid_records.HeaderStyle.Font.Bold = true;
grid_records.RenderControl(htmltextwrtter);
Response.Write(strwritter.ToString());
//Response.End();

Response.Flush();
Response.SuppressContent = true;
HttpContext.Current.ApplicationInstance.CompleteRequest();

A: Thanks for so many hints , Below is my final code after converting to window app
hope it will help others

   private void btn_export_Click(object sender, EventArgs e)
    {
        try
        {
            SaveFileDialog savefile = new SaveFileDialog();
            savefile.FileName = "Response.xls";
            savefile.Filter = "Excel Files|*.xls;*.xlsx;*.xlsm";
            if (dset.Tables[0].Rows.Count > 0)
            {
                if (savefile.ShowDialog() == DialogResult.OK)
                {
                    //using (StreamWriter sw = new StreamWriter(savefile.FileName))
                    //    sw.WriteLine("Hello World!");
                    StreamWriter wr = new StreamWriter(savefile.FileName);
                    for (int i = 0; i < dset.Tables[0].Columns.Count; i++)
                    {
                        wr.Write(dset.Tables[0].Columns[i].ToString().ToUpper() + "\t");
                    }

                    wr.WriteLine();

                    //write rows to excel file
                    for (int i = 0; i < (dset.Tables[0].Rows.Count); i++)
                    {
                        for (int j = 0; j < dset.Tables[0].Columns.Count; j++)
                        {
                            if (dset.Tables[0].Rows[i][j] != null)
                            {
                                wr.Write(Convert.ToString(dset.Tables[0].Rows[i][j]) + "\t");
                            }
                            else
                            {
                                wr.Write("\t");
                            }
                        }
                        //go to next line
                        wr.WriteLine();
                    }
                    //close file
                    wr.Close();
                    MetroMessageBox.Show(this, "Data saved in Excel format at location "+ savefile.FileName , "Successfully Saved", MessageBoxButtons.OK, MessageBoxIcon.Question);
                }
            }
            else
            {
                MetroMessageBox.Show(this,"Zero record to export , perform a operation first","Can't export file",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
        }
        catch (Exception ex)
        {
            MetroMessageBox.Show(this, v1.PrintExceptionDetails(ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            el.LogError(ex);
        }
        finally
        {

        }
    }

A: This example will tell you How to export Dataset to Excel, if you see the 2nd answer on this link, you'll find out how would you allow user to save the document at any location in their pc. You can open Excel file by following this link
Always search before asking a question because everything is available here whatever you'd asked.
Hope it helps!

A: While searching for windows desktop application related answers use keywords "Winforms","C#".
You need to select a file using SaveFileDialog class and use FileStream to write content to it.
You can find detailed samples msdn, here and here.


text:
Q: ARIMA modelling: identifying p, q and P, Q from ACF and PACF plots
I am conducting research using SARIMA models in my analysis. I have transformed my data to achieve stationarity (first difference and seasonal difference) and my ACF and PACF are as below. However, I have a challenge in identifying the values of p, q, P and Q. Any suggestions for these values?
The data is as follows:
Monthly Temp
25.3
25.2
25.4
23.3
22
21.5
21.4
21.1
24.2
24.8
23.2
23.8
25.8
28
26.2
23.6
22.1
20.8
21.5
23.4
23.9
26
23.1
23.3
24.4
26.6
27.6
25.1
23.6
22.2
22
22.1
25.5
26.7
24.2
25.2
25.9
26.9
26.6
24
22.7
21.8
21.5
21.5
23.1
25.4
23
23
23.8
24.3
25.9
22.7
22.6
21.1
20.4
20.7
23.3
23.9
22.7
23.5
23.8
25.8
24.2
23.4
23.5
22.2
22.2
21.2
24.6
25.3
22.8
23.1
25.5
27.7
27.2
24.7
23.1
22.7
20.7
22.3
24.8
25.9
23.6
23.3
24.8
27.2
27.1
25
23.3
22.2
21.1
20.6
23.6
24.8
22.9
23.1
22.6
23.6
25.4
25.1
24.4
21.9
21.4
22.3
24.8
25.6
23.8
23.4
25.9
26.9
26.5
24.4
22.8
22.6
21.3
21.6
24
25
22.9
23.1
24.9
26.2
24.4
24
23.2
23.3
21.1
22.3
24.4
24.5
23.6
23.3
25.7
26.8
26
24.3
23
21.3
20.7
22.5
24.7
25.9
22.8
24.3
26.5
28.1
27.2
24
22.6
21.9
21.8
23.1
25.6
23.4
22.3
22.7
23.4
25
25.2
24.7
23.3
22.3
19.7
20.2
23.7
25.6
23.5
24.9
25.9
27.4
26.1
23.5
23.2
22.6
21.6
21.8
24.1
25.4
22.9
22.3
24.7
27.2
27.1
25.4
23.8
22.4
22.2
22.8
24.5
25.9
25.4
25.5
23.3
25.4
24.9
23.5
23.1
21.8
20.8
23.2
25.2
25.4
22.8
23.6
25.5
26.9
25.1
24.4
23.3
21.9
22.8
21.5
24.6
25
23.6
23.4
25.1
27.4
27
25.9
24.8
23.4
22.7
23.3
25.1
27
24.8
25.9
25.2
25.4
26.4
24.3
23.3
21.8
23.3
23
25.4
24.5
23.3
24.2
26.3
26.9
26.6
25.1
23.4
21.3
20.7
21.6
23.9
25.3
23.6
25.4
27.4
29.4
27.7
24.8
24.6
24.4
20.7
24.9
25.1
27.6
24.1
24.7
24.2
26.1
26.1
24.8
23.1
22.6
21.1
21.4
23.5
24
23.5
24.2
25.2
25.6
25.9
23.5
22.9
21.6
20.8
22.2
24.9
24.5
24.1
25.1
25.6
25.6
27.4
25.3
23.6
23.3
21.7
22.1
25.6
24.4
24.1
24.3
24.4
25.5
24.5
24.3
23.4
21.7
21.6
22.1
24.2
25.4
22.9
24.3
25.8
28.7
26.1
27
23.7
23.6
23.5
21.6
23.9
24.2
23.6
23.9
26.2
27
28
24.5
23.2
21.6
21.6
23
24.9
25.1
23.7
23.8
25
26.2
26.1
24.4
23.3
21.7
22.9
21.5
25
26.2
24.6
23.1

A: Why don't you post your original data ? in a one column csv file. Using the ACF and PACF to identify the form of the ARIMA model requires , no pulses in the data , no level shifts in the data , no time trends in the data and no seasonal pulses in the data. Furthermore there in an implicit (to some and explicit to others !) assumption that the form of the model and parameters are invariant over time and that the residuals ( i.e. the y values adjusted for the ARIMA model and parameters ) have constant error variance. Non-constant error variance can arise from a linkage between Y and the error variance suggesting a power transform or a deterministic change at one or more points in time or even a time-varying error variance. Your data may have some of these "complications" or as I have often said some "opportunities" . The magnitude (if any) of one or more of these  complications can affect simple cutoff/decay analyses and of course severely impact any simple AIC/BIC approach no matter what some commentators preach or textbooks promote/say. Even advanced texts fail to mention these things as it often gets in the way of "selling the method" which is never a good thing (LOL).
My quick 2 cents is that you may have over-differenced .....
EDITED AFTER ANALYSIS OF DATA
I used one of my favorite toys (AUTOBOX) and obtained what appears to be a very reasonable model. I plotted the data  and AUTOBOX presented the ACF of the original series . strongly suggesting monthly seasonality. There are two different kinds of models(causes) that can generate this symptom ; 1) a seasonal ARIMA model reflecting autoprojective structure AND 2) A regression type fixed effects model with 11 seasonal(monthly) dummies . Both of these models can also include level shifts and local time trends and pulse effects. AUTOBOX concluded a fairly exhaustive search process and concluded that the dominant model for this data was the latter. The final model yilded an Actual/Fit and Forecast graph of and a graph of the forecasts here .
The model is presented here  and here  and here  relecting a hybrid of seasonal dummies , a level shift , pulses and an AR(1) component.
Thorough statsistical requires some validation that the model is sufficient thus we present a plot of the final residuals and the ACF of the model errors  . All parameters are needed (statistically significant) and test for automatically selecting a power transform yielded negative results.
Hope this helps you. By the way meteorologists "know" that weather is strongly a seasonally deterministic ( month effects) series rather than an autoprojective model . Thus these results are what night have been exepected.
Finally my guess that you were over-differencing was correct becuase (in part) the non-stationarity was due to known fixed effects and the unknown upwards level shift (slight but significant) that was detected at period 182. Any clue what might have happened at or around period 182 (15 years = 2 months ) ?


text:
Q: Regular expression for single line java comments I am new to regular expression, Am finding empty IF statements by using this if[\\s]*\\([^\\)]*\\)[\\s]*\\{((/\\*(.|[\\r\\n])*?\\*/)|\\s)*\\} and its works fine fine multi line comments with empty statements but not find single line comments. It find the below scenarios
if (true) {

        /*
         * fsdsddgd ddgdgdfg gdfgdgdfg gdfgdfg fgdfgfg
         */

        /*
         * fsdsddgd ddgdgdfg gdfgdgdfg gdfgdfg fgdfgfg
         */
    }

if (true) {

    }

Not find the below scenarios
if (true) {
        // kavi
        // kamal
        // kamal
    }

    if (true) {
        // kavi
    }

please give me valuable solutions for this.

A: Not A Great Idea, but if you have to...
As you can see in the comments I'm not terribly fond of the idea, but since you asked for it, this will work with your input (see demo):
if\s*\([^\{]*\{(?:[ \t]*//.*)?[ \t]*(?:[\r\n]*[ \t]*(?://.*)?)*[\r\n]*[ \t]*(?://.*)?}

*

*The if\s*\([^\{]*\{ gets us to the opening brace

*The (?:[ \t]*//.*)?[ \t]* gets us to the end of the line, matching an optional comment along the way

*The (?:[\r\n]*[ \t]*(?://.*)?)* matches a series of lines with optional comments

*The [\r\n]*[ \t]*(?://.*)?} gets us to the final brace.

Tokens need to be properly escaped, so try this code:
List<String> matchList = new ArrayList<String>();
try {
    Pattern regex = Pattern.compile("if\\s*\\([^\\{]*\\{(?:[ \t]*//.*)?[ \t]*(?:[\r\n]*[ \t]*(?://.*)?)*[\r\n]*[ \t]*(?://.*)?}");
    Matcher regexMatcher = regex.matcher(subjectString);
    while (regexMatcher.find()) {
        matchList.add(regexMatcher.group());
    }
} catch (PatternSyntaxException ex) {
    // Syntax error in the regular expression
}

else if
In the comments you say you may not want else if
In that case, use this:
(?<!else )if\s*\([^\{]*\{(?:[ \t]*//.*)?[ \t]*(?:[\r\n]*[ \t]*(?://.*)?)*[\r\n]*[ \t]*(?://.*)?

In code:
List<String> matchList = new ArrayList<String>();
try {
    Pattern regex = Pattern.compile("(?<!else )if\\s*\\([^\\{]*\\{(?:[ \t]*//.*)?[ \t]*(?:[\r\n]*[ \t]*(?://.*)?)*[\r\n]*[ \t]*(?://.*)?");
    Matcher regexMatcher = regex.matcher(subjectString);
    while (regexMatcher.find()) {
        matchList.add(regexMatcher.group());
    }
} catch (PatternSyntaxException ex) {
    // Syntax error in the regular expression
}

Let me know if you have questions!


text:
Q: Locally Flat Coordinates and Christoffel Symbols We know in general relativity (or rather in differential geometry) that you can have some locally flat coordinates (I think they are called Riemann normal coordinates) at a point $P$ in our manifold (space time). At this point $P$, the metric is Euclidean up to second order deviation, i.e.
$$ g_{\tau \mu} \approx \eta_{\tau \mu} + B_{\tau \mu \ ,\lambda \sigma} \ x^\lambda x^\sigma + ... $$ where $B_{\tau \mu \ ,\lambda \sigma}$ are just the Taylor coefficient terms (second order in $g$).
Now I was led to believe that the Christoffel symbols should vanish at this point $P$ in locally flat coordinates, but under the definition of them, I get
\begin{split}
\Gamma_{\rho \nu}^\lambda & \equiv \frac{1}{2} g^{\lambda \tau} (\partial_\rho g_{\nu \tau} + \partial_{\nu} g_{\rho \tau} - \partial_{\tau} g_{\rho \nu}) \\
& = \eta^{\lambda \tau}(B_{\tau \nu \ , \kappa \rho} + B_{\tau \rho \ , \kappa \nu} - B_{\rho \nu \ , \kappa \tau})\ x^\kappa + ...
\end{split}
This is a non vanishing Christoffel symbol. If I am misunderstanding, then when exactly do the symbols vanish?

A: Your expression for the Cristoffel's symbols seems to be correct. In any case, it is definitely true that they should only vanish for $x=0$. The reason is as follows:
By choosing a coordinate system, you label the different points in a piece of your manifold by a set of numbers $x^\mu$. By construction, the point $P$ has the coordinates $x=0$, and non-zero $x$ correspond to points around $P$. The statement that in Riemann normal coordinates around $P$, the Cristoffels's symbols vanish at $P$ means that the symbols vanish for $x=0$.
If the Cristoffel's symbols were to vanish for $x$ in some neighbourhood of $0$, this would mean the curvature tensor vanishes in that neighbourhood. This is only true if the manifold is actually flat at $P$.

A: In some coordinate systems they do vanish, I think, which to me makes sense as you have the freedom to choose whichever system they vanish in.
Vanishing of Christoffel Symbols

Question : Are the values of the christoffel symbols the same for all coordinate systems on a surface/manifold? I would love to see an example for the cone in two different parametrizations.
Answer : The answer is no. The reason is that the Christoffel symbols are not scalar fields, nor tensor fields, they might vanish completely in a coordinate system and yet be non-vanishing in another.
As a simple example consider the plane in cartesian coordinates: All Christoffel symbols vanish. Now consider polar coordinates, there will be some which are non-vanishing


text:
Q: Display the version number in Java Cache Viewer I'm developing an applet and I've recently added a MANIFEST file to
it for version information.
My original intent was to see the version of the applet shown in the
Java Applet Cache Viewer...
Java Control Panel -> Temporary Internet Files -> Settings... -> View Applets...

But in the cache viewer, it doesn't show the version number. What I'm doing wrong?

A: The Java Applet Cache Viewer was not designed for that.  If you wish to display the information in your own applet at user request, pop a JOptionPane with the following information.
Package pckg = this.getClass().getPackage();
String title = pckg.getImplementationTitle();
String vendor = pckg.getImplementationVendor();
String version = pckg.getImplementationVersion();

Note that the manifest information is available on a per package basis, while a Jar might contain several applets and many packages.


text:
Q: How to clear/remove shopping cart items before adding new items in magento? I tried with the following codes to remove/clear shopping cart items,it's removed all items in the shopping cart.but not adding the new product/item.
Used Code's
1.Mage::getSingleton('checkout/session')->clear();
2.Mage::getSingleton('checkout/cart')->truncate();
3.$quote = Mage::getSingleton('checkout/session')->getQuote();
$quote->delete();
4.Mage::getSingleton('checkout/cart')->truncate()->save();
5.Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
6.foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ){
    Mage::getSingleton('checkout/cart')->removeItem( $item->getId() )->save();
}
7.$cartHelper = Mage::helper('checkout/cart');
        $items = $cartHelper->getCart()->getItems();
        foreach ($items as $item)
        {
                $itemId = $item->getItemId();
                $cartHelper->getCart()->removeItem($itemId)->save();
        }

8.$quote = Mage::getSingleton('checkout/session')->getQuote();
$item = $quote->getItemByProduct($product);
$quote->removeItem($item->getId());

9.$quote->removeAllItems();

please any one suggest me the above my requirements.Thanks in advance.
Thanks
arumugam

A: here is the solution for remove as well as add products into cart
$params['qty'] = 1;
$product = $this->_initProduct($_product); // here initialize the product

$cart = Mage::getModel('checkout/cart');
$cart->truncate(); // remove all active items in cart page
$cart->init();
$cart->addProduct($product,$params);
$cart->save();

A: If you have a large number of customers quotes then deleting them by using loop might be time and resource consuming. You can clear/delete all customers cart items (all active sales quotes) by using the following SQL query:
DELETE FROM sales_flat_quote WHERE is_active = 1;
is_active = 0 means those quotes have been converted into orders, i.e. customer has placed order for those quotes.
is_active = 1 means quotes that have not been ordered, i.e. quotes present in the shopping cart of customers
Running this query will automatically delete related rows (quote items) from sales_flat_quote_item table through foreign key constraint

A: If you just want to update the quantity then check this it is solved my problem.
File Path : \app\code\core\Mage\Sales\Model\Quote
File Name : Item.php
Line number : 285
public function addQty($qty)
    {
        $oldQty = $this->getQty();
        $qty = $this->_prepareQty($qty);
    /**
     * We can't modify quontity of existing items which have parent
     * This qty declared just once duering add process and is not editable
     */
    if (!$this->getParentItem() || !$this->getId()) {
        $this->setQtyToAdd($qty);
        $this->setQty($oldQty + $qty);

    }
    return $this;
}

change to
public function addQty($qty)
    {
        $oldQty = $this->getQty();
        $qty = $this->_prepareQty($qty);
    /**
     * We can't modify quontity of existing items which have parent
     * This qty declared just once duering add process and is not editable
     */
    if (!$this->getParentItem() || !$this->getId()) {
        $this->setQtyToAdd($qty);
        //$this->setQty($oldQty + $qty);
        $this->setQty($qty);
    }
    return $this;
}


text:
Q: javascript getElementById on span I have a row of results: name, amount and I want to add a X at the end of the row allowing deletion of the entire row.
I gave only one row here, for brievity. There are many and I though of putting this in a for.
This is my html :

let lignesRecurrentes = document.getElementsByClassName('ligne_recurrente')

for (var i = 0; i < lignesRecurrentes.length; i++) {
    let ligneRecurrente = lignesRecurrentes[i]
    let id = ligneRecurrente.id.replace('ligne_','')
    let croix = document.getElementById('suppr_recurrente_'+id)

    croix.addEventListener('click', function(){
  console.log(croix.innerHTML)
  }
  )}

            Cousteau

                396,00
                €
                 X

How come croix is null? Can't add eventListerner on null?

A: This is caused by trailing space in id="suppr_recurrente_3 "
BTW, You can simplyfiy your js with wrapping rows into some div

              Cousteau

                  396,00
                  €
                   X

attach listener do this container and check if clicked element has desired class:
document.querySelector('.rows').addEventListener('click', function(e) {
    var target = e.target, id;

    if (target.classList.contains('btn-remove')) {
        id = target.parentElement.parentElement.id.replace('ligne_', '');

        console.log('line ' + id + ' should be removed');
    }
});

A: You can simply your code combing:

*

*document.querySelectorAll()

*:last-child

*.forEach()
In order to remove the entire row it's enough to use .remove() in the event handler.
The snippet:

document.querySelectorAll('.ligne_recurrente span span:last-child').forEach(function(ele) {
    ele.addEventListener('click', function(e){
        this.closest('div.ligne_recurrente').remove();
    });
})

    Cousteau

                396,00
                €
                 X


text:
Q: ASP.net render HTML nicely (Beautify) When I generate my controls in ASP.net they come out like this:

        <input id="ctl00_mainContent_ctl00" type="checkbox" name="ctl00$mainContent$ctl00" checked="checked" value="70" />Buyer1<input id="ctl00_mainContent_ctl01" type="checkbox" name="ctl00$mainContent$ctl01" value="75" />Buyer2<input id="ctl00_mainContent_ctl02" type="checkbox" name="ctl00$mainContent$ctl02" value="280" />Client3<input id="ctl00_mainContent_ctl03" type="checkbox" name="ctl00$mainContent$ctl03" value="281" />Client4<input id="ctl00_mainContent_ctl04" type="checkbox" name="ctl00$mainContent$ctl04" value="283" />Client2<input id="ctl00_mainContent_ctl05" type="checkbox" name="ctl00$mainContent$ctl05" value="289" />Client1<input id="ctl00_mainContent_ctl06" type="checkbox" name="ctl00$mainContent$ctl06" value="346" />artworker1<input id="ctl00_mainContent_ctl07" type="checkbox" name="ctl00$mainContent$ctl07" value="362" />buyer3<input id="ctl00_mainContent_ctl08" type="checkbox" name="ctl00$mainContent$ctl08" value="367" />meeeee<input id="ctl00_mainContent_ctl09" type="checkbox" name="ctl00$mainContent$ctl09" value="368" />stake

Pretty ugly and hard to understand when you view the source.  This isn't a problem usually, but my site is offering visitors resources and tutorials where looking at the source is part of the experience.
Is there any way to render these controls nicely?  Indented properly,  better id's and names etc?

A: ASP.NET WebForms HTML rendering and control markup have been improved in .NET 4.0 and this will help with the control IDs and structure of the HTML elements themselves (as mentioned in Rob Stone's answer to your question).  However, the indents and line breaks might still be less than desirable for your needs.
If the HTML source truly is part of the user experience for your application, you might consider writing an HttpModule attached to the ReleaseRequestState event.  This approach will address the actual line breaks and indentations of your HTML source.  To avoid re-inventing the wheel you could use either the .NET port of HTML Tidy or a .NET Wrapper for HTML Tidy as part of your custom filter on the response.
There is a nice example of how you might write a custom filter in an HttpModule in this blog.  The section of the code that I found most useful is as follows (slightly edited but you can get the full understanding from the blog itself):
public class CustomModule : IHttpModule
{
  public void Init(HttpApplication context)
  {
    context.ReleaseRequestState += new EventHandler(context_ReleaseRequestState);
  }

  private void context_ReleaseRequestState(object sender, EventArgs e)
  {
    HttpResponse response = HttpContext.Current.Response;
    if (string.Compare(response.ContentType,"text/html",true) == 0)
    {
      response.Filter = new CustomFilter(response.Filter,response.ContentEncoding);
    }
  }
}

and inside your CustomFilter class...
public override void Write(byte[] buffer, int offset, int count)
{
  sb = new StringBuilder(count + 1024);
  sb.Append(enc.GetString(buffer,offset,count));

  // <---- Run the sb content through HTML Tidy here ---->

  byte[] buff = enc.GetBytes(sb.ToString());
  s.Write(buff,0,buff.Length);
  }
}

A: Getting pretty output is going to be a near impossibility, because the parser does not have any concept of context when rendering controls. Many controls render more than one HTML element, and they would need to know their context to do this... as well as be able to know what kind of formatting was desired (e.g. for list controls, when to start a new line, when to indent again).
Also, not all elements in markup are actually rendered, and the layout of your markup is not always directly related to the layout of the output. For example:
<asp:PlaceHolder runat="server" />
    <asp:Panel runat="server" />
        <asp:DropDownList runat="server" />
    </asp:Panel />
</asp:PlaceHolder />

Placeholder is not rendered, so would that cause an indent in the output or not? DropDownList renders multiple HTML controls, and there's no way for it to determine the desired way of being rendered: should it indent to the same level as the first control? Should it render with no inter-element spacing? From a practical standpoint, it's more efficient to render with no spacing at all (which is what most controls do) to minimize the amount of data that needs to be sent to the client.
Finally, even in the simple cases, the actual representation when you "view source" from a browser will probably be different between browsers. They can all choose to handle spacing, line breaks, indentation in any way they choose, since inter-element spacing does not affect rendering in any way.
If you are showing "before/after" examples on your web site you really don't have much choice except to manually format the output for presentation, if this is what you want. If people want to look at the source too, that's fine, but it would be very challenging to make the source consistently look as good as your markup.
If this was really important to you, you could intercept the output stream and reformat it before sending to the client, but it won't happen directly from asp.net's rendering engine. For an example of how to do this, google "asp.net response filter" - here's one. I'm sure it's not hard to find code that formats HTML that you could apply to this concept.

A: In .NET 4.0 you can set the ClientIDMode to one of 4 options AutoID, Static, Predictable and Inherit. You're probably looking for Static as this will ensure that your controls render to the page with the IDs you've assigned to them.
You can set it at application level by adding:
<pages clientIDMode="Static">

To your web.config
There's more details on these changes here: http://beyondrelational.com/blogs/hima/archive/2010/07/16/all-about-client-id-mode-in-asp-net-4.aspx

A: Late to the party here, but I faced a similar problem. We were generating some highly complex javascript that was getting way too mangled to reasonably debug with it all jumbled in line with the rest of the markup. So I came up with this class.
public class HtmlPrettyControl : HtmlGenericControl
{
    public bool Indent { get; set; }

    public HtmlPrettyControl(string tag) : this(tag, true) { }

    public HtmlPrettyControl(string tag, bool indent) : base(tag)
    {
        Indent = indent;
    }

    protected override void Render(HtmlTextWriter writer)
    {
        // Here you can check if you are running against a production environment
        // and just do base.Render to prevent extra code execution and space in
        // your response to the client

        if (Indent)
        {
            RenderBeginTag(writer);
            writer.WriteLine();
            writer.Indent++;
            base.RenderChildren(writer);
            writer.WriteLine();
            writer.Indent--;
            RenderEndTag(writer);
        }
        else
        {
            base.Render(writer);
        }
        writer.WriteLine();
    }
}

Usage example:
var myDiv = new HtmlPrettyControl("div");
var myLabel = new HtmlPrettyControl("label", false);
myLabel.InnerText = "I'm sorry, Dave.";
myDiv.Controls.Add(myLabel)

Generates markup:

    I'm sorry, Dave.

We use a similar Render method override for the controls that aren't simple Html tags (in a different base class/inheritance chain). The only downside is that the writer passed to the Render method does not seem to be informed of the current indentation level of an ascx that your control is living on (if any). So while the hierarchy of the control and its children is nicely indented and broken up, they will reset to an indentation level of 0, breaking the overall flow from surround markup on your ascx or aspx layout files.


text:
Q: Using ArcObjects to search or to obtain count (IQueryFilter) from selection set? This only appears to be an issue with Personal Geodatabases (MS Access back end)...  I need to search within an existing selection set to populate an ICursor.  My main objective is to test whether my IQueryFilter retrieves more that one record but there is no count property over the ISelectionSet using a QueryFilter just like there is over a feature class (IFeatureCLass:FeatureCount(IQueryFilter).  So in order to test whether my QueryFilter retrieves more than one record inside a selection set I am having to use the Search method  pFeatureSelection.SelectionSet.Search(pQueryFilter, True, selCursor)  using recycling cursor for speed then advancing to next row and again to next row to find out whether more that one row has been retrieved using my QueryFilter. (This feels awfully inefficient but works when not used over PGDB FC)
This works perfectly when used with file geodatabases and shapefiles (I customize the where clause accordingly based on the workspace type of the feature class) however when I do this over personal geodatabase the ISelectionSet:Search method fails. What is strange that it only fails after it has first succeeded many times prior. The queries I assign to the WhereClause of the query filter are very simple  (i.e.  "[MASTER_ID] = '56061-UNPAT-28'")
The error I am getting is "Error HRESULT E_FAIL has been returned from a call to a COM component." Err.number -2147467259
To reiterate, the very same code works fine when used with FGDB feature class and Shapefile, it's only on PGDB (Access) that it fails this way and only after it run for a while.
I ultimately need to obtain a count within a selection set that satisfies a simple query. If there is an alternate or more efficient way of doing this please share...

A: When you're done with an ICursor or IFeatureCursor, you need to release the underlying COM object.  This can be done via ReleaseCOMObject or better yet, FinalReleaseCOMObject.  Do this repeatedly if you're inside a loop where you're passing the same ICursor reference repeatedly to ISelectionset.Search.


text:
Q: Facing screen freeze (sort of?) in IE11, WIndows 7 While using an internal web application running under IE11 compatibility mode, after clicking on a link, the link portion gets freezed & keeps showing up as topmost layer on the screen. I'm unable to find the exact word to describe it.
Refer the image below:
It persists screen lock cycles, even after cleaning IE off memory. But it gets resolved after log off, restart.
What & why could it be ?


text:
Q: How to resolve ERR_HTTP2_PROTOCOL_ERROR for static files on a first page load (SSL + Pagespeed)? I have a nginx HTTP2 + ngx_pagespeed + brotli + Wordpress W3 Total Cache setup.
On a first page load some static files that were modified by the Pagespeed fail to load, giving a ERR_HTTP2_PROTOCOL_ERROR.
Initially I thought that it's W3 Total Cache fault by after reloading cached page eveything seems to load fine. Is it Pagespeed messing something up or my SSL settings are wrong?
My site conf:
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name mywebsite.com www.mywebsite.com;

    root /srv/mywebsite.com/www/;
    index index.php index.html index.htm;
    error_log /srv/mywebsite.com/log/error.log;

    keepalive_timeout 60;

    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    ssl_certificate /etc/letsencrypt/live/mywebsite.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mywebsite.com/privkey.pem;
    ssl_dhparam /etc/nginx/ssl/dhparam.pem;
    ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
    ssl_ecdh_curve secp384r1;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_stapling on;
    ssl_stapling_verify on;

    ssl_trusted_certificate /etc/letsencrypt/live/mywebsite.com/chain.pem;
    resolver 8.8.8.8 8.8.4.4 valid=300s;
    resolver_timeout 5s;
    ssl_session_tickets off;
    ssl_prefer_server_ciphers on;
    ssl_buffer_size 4k;

    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
    add_header X-Frame-Options SAMEORIGIN;
    add_header X-Content-Type-Options nosniff;
    add_header X-XSS-Protection "1; mode=block";

    pagespeed on;
    pagespeed Domain http://mywebsite.com;
    pagespeed Domain https://mywebsite.com;
    pagespeed MapOriginDomain localhost https://mywebsite.com;
    pagespeed LoadFromFile https://mywebsite.com /srv/mywebsite.com/www/;
    pagespeed FileCachePath /var/cache/pagespeed;
    pagespeed EnableFilters prioritize_critical_css,extend_cache,rewrite_javascript,rewrite_css,convert_jpeg_to_progressive,convert_jpeg_to_webp,convert_png_to_jpeg,convert_to_webp_lossless,recompress_jpeg,recompress_png,recompress_webp,jpeg_subsampling,resize_images,strip_image_color_profile,strip_image_meta_data,inline_images;
    pagespeed PreserveUrlRelativity on;
    pagespeed XHeaderValue "Powered By ngx_pagespeed";
    pagespeed ImplicitCacheTtlMs 2592000000;
    pagespeed LoadFromFileCacheTtlMs 2592000000;

    # BEGIN W3TC Page Cache core
    set $w3tc_rewrite 1;
    if ($request_method = POST) {
        set $w3tc_rewrite 0;
    }
    if ($query_string != "") {
        set $w3tc_rewrite 0;
    }
    if ($request_uri !~ \/$) {
        set $w3tc_rewrite 0;
    }
    if ($http_cookie ~* "(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle)") {
        set $w3tc_rewrite 0;
    }
    set $w3tc_preview "";
    if ($http_cookie ~* "(w3tc_preview)") {
        set $w3tc_preview _preview;
    }
    set $w3tc_ssl "";
    if ($scheme = https) {
        set $w3tc_ssl _ssl;
    }
    if ($http_x_forwarded_proto = 'https') {
        set $w3tc_ssl _ssl;
    }
    set $w3tc_enc "";
    #if ($http_accept_encoding ~ gzip) {
    #    set $w3tc_enc _gzip;
    #}
    set $w3tc_ext "";
    if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_ssl$w3tc_preview.html$w3tc_enc") {
      set $w3tc_ext .html;
    }
    if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_ssl$w3tc_preview.xml$w3tc_enc") {
        set $w3tc_ext .xml;
    }
    if ($w3tc_ext = "") {
        set $w3tc_rewrite 0;
    }
    if ($w3tc_rewrite = 1) {
        rewrite .* "/wp-content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_ssl$w3tc_preview$w3tc_ext$w3tc_enc" last;
    }
    # END W3TC Page Cache core

    # BEGIN W3TC Page Cache cache
    location ~ /wp-content/cache/page_enhanced.*html$ {
        expires modified 3600s;
        add_header Vary "Accept-Encoding, Cookie";
        add_header Pragma "public";
        add_header Cache-Control "public";
    }
    location ~ /wp-content/cache/page_enhanced.*gzip$ {
        brotli off;
        gzip off;
        types {
            text/xml xml_gzip;
        }
        default_type text/html;
        expires modified 3600s;
        add_header Vary "Accept-Encoding, Cookie";
        add_header Pragma "public";
        add_header Cache-Control "public";
        add_header Content-Encoding gzip;
    }
    # END W3TC Page Cache cache

    location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
      add_header "" "";
    }
    location ~ "^/pagespeed_static/" { }
    location ~ "^/ngx_pagespeed_beacon$" { }

    # BEGIN W3TC Browser Cache
    pagespeed HttpCacheCompressionLevel 0;
    gzip on;
    gzip_vary on;
    gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon image/webp application/json application/vnd.ms-access video/webm application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint image/svg+xml application/x-shockwave-flash image/tiff application/x-font-ttf audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel;
    location ~ \.(css|htc|less|js|js2|js3|js4)$ {
        expires 31536000s;
        etag off;
        if_modified_since exact;
        add_header Pragma "public";
        add_header Cache-Control "public";
        try_files $uri $uri/ $uri.html /index.php?$args;
    }
    location ~ \.(html|htm|rtf|rtx|txt|xsd|xsl|xml)$ {
        expires 3600s;
        etag off;
        if_modified_since exact;
        add_header Pragma "public";
        add_header Cache-Control "public";
        try_files $uri $uri/ $uri.html /index.php?$args;
    }
    location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|rss|atom|gif|tgz|gz|rar|gzip|bz2|ico|jpg|jpeg|jpe|webp|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|webm|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|_ttf|wav|wma|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|zip)$ {
        expires 31536000s;
        etag off;
        if_modified_since exact;
        add_header Pragma "public";
        add_header Cache-Control "public";
        try_files $uri $uri/ $uri.html /index.php?$args;
    }
    add_header Referrer-Policy "";
    # END W3TC Browser Cache

    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param DOCUMENT_ROOT /srv/mywebsite.com/www/;
        fastcgi_param SCRIPT_FILENAME /srv/mywebsite.com/www$fastcgi_script_name;
        fastcgi_param PATH_TRANSLATED /srv/mywebsite.com/www$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_param HTTPS on;
        fastcgi_intercept_errors on;
        fastcgi_ignore_client_abort off;
        fastcgi_connect_timeout 60;
        fastcgi_send_timeout 180;
        fastcgi_read_timeout 180;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 8 256k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
    }
}

A: It seems that it's the send_timeout 2 that was the source of the problem.


text:
Q: Accessing vim settings values in regexp Hi I am using a vim setting to highlight columns past the column 80. This hardcoded setting is good enough for programming where I like to keep it in 79 columns. However for LaTeX, plain txt, RST, where I use different tw values it is not working for obvious reasons. Is it possible to somehow use the value of textwidth setting inside this regexp ? Or if not, how can I approach this problem ?
hi OverLength ctermbg=darkred ctermfg=white guibg=#592929
match OverLength /\%81v.\+/

A: Instead of just setting the limit, why not have a function with a bind that'll highlight characters past n columns?
nnoremap <leader>h :call ToggleOverLengthHighlight()<CR>
let g:overlength_enabled = 0
highlight OverLength ctermbg=black guibg=#212121

function! ToggleOverLengthHighlight()
    if g:overlength_enabled == 0
        match OverLength /\%79v.*/
        let g:overlength_enabled = 1
        echo 'OverLength highlighting turned on'
    else
        match
        let g:overlength_enabled = 0
        echo 'OverLength highlighting turned off'
    endif
endfunction


text:
Q: "No, I didn't see him" vs "Yes, I didn't see him" Bob didn't come to office today.
I was asked "Didn't you see Bob today?"
Should I say "Yes, I didn't see him today" or "No, I didn't see him today"?

A: This ambiguity will trip up even native speakers of English.
The question is leading to a negative answer, it expects the following sentence to start with "No." In my experience, the answer will start with "No," regardless of whether the answer confirms or denies the statement in question. Either your "No," agrees with the negative expectation of the question, or the "No," disagreeing with the expectatoin of the question.
However, in my experience, if someone just answers "No," even a native speaker will not be certain enough of that intent and will ask for clarification.
For example:

Didn't you see Bob today?
No.
'No,' you didn't see him, or 'no,' you did see him?
No, I didn't see him.

or

No, I did see him.

For this reason, native speakers will typically respond with the full intent, "No, I did not see him," or "No, I did see him," from the beginning, and avoid the back-and-forth.
Saying "Yes, I did not see him," might surprise people, as it's not the expected form, but it won't confuse. Saying "Yes, I did see him," will cause less confusion/surprise. But merely answering "Yes," here is even more ambiguous than answering just "No."

A: This reminds me of an old pun played on me by my seniors. They asked me to fill in the blank with either of two options - YES OR NO

..... , I'm not a male!

I was trapped. And, I still don't find the proper option.
But then, think for a while. When such questions are asked, we generally make it clear by adding a clause.

Did you break the glass? ~ No, I did not  Didn't you break the glass? ~ No, I did not

Both the sentences though begin in different way has the same answer. No matter what but from the conversation, it's quite clear that the person in doubt has not broken any glass.
In a similar way, it does not matter how the question is asked, you'll have to answer the way you have to!

Didn't you see Bob today ~ Yes, I did OR No, I didn't.   Did you see Bob today ~ Yes, I did OR No, I didn't.

Note that to avoid ambiguity, you have to add a clause justifying your Yes or No. Good to note as Lucian said that usually Yes is followed by an affirmation. Yes, I did not... is not logical.

A: "Didn't you see Bob today?" means that the person asking the question assumes that you saw Bob.  The negation works like a tag question, so the sentence basically means the same as "You saw Bob today, didn't you?"
So, the appropriate response should be as if the tag question were omitted.

Speaker 1: any of… "Didn't you see Bob today?" or "You saw Bob today, didn't you?" or "You saw Bob today?" (The three formulations of the question are mostly equivalent.)
Your appropriate response: "No, I didn't see him today."

A: You may simply say:

No, or
No I didn't, or
No I didn't see him today.


text:
Q: Problem mapping my JSPs in a SpringBoot app First of all , i have a header and footer set to show on all my jsp pages.
The landing page is mapped as "/".
The first link in footer is mapped as "/recrutement".
The second link in footer is mapped as "/service".
Inside recrutement.jsp (first footer link) i have a link mapped to "/annonce".
When i am on annonce.jsp the url is http://localhost:8080/recrutement/annonce. until here everything is fine.
But while on annonce.jsp , if i click the second footer link , the url ends up like http://localhost:8080/recrutement/annonce/service instead of just http://localhost:8080/service...
I think there may be an error in my mapping? or perhaps with viewResolver?
Thanks for your help
All 3 concerned Controllers:

@Controller
@RequestMapping(path = "/")
public class AccueilController {

    @GetMapping(path = "/")
    public String showAccueil(Model theModel, HttpSession session) {
        ...
        return "index";
    }
}

@Controller
@RequestMapping("/recrutement")
public class RecrutementController {

    @Autowired
    private JobOfferRepository jor;

    @GetMapping(path = "")
    public String showRecrutement(Model theModel) {
        List<JobOffer> ajo = jor.findAll();
        theModel.addAttribute("jobOfferList", ajo);
        return "recrutement";
    }

    @GetMapping(path = "/{id}")
    public String showJobOffer(Model theModel, @PathVariable int id){
        JobOffer jo = jor.findById(id).get();
        theModel.addAttribute("jobOffer", jo);
        return "recrutementAnnonce";
    }
}

@Controller
@RequestMapping("/")
public class StaticPagesController {

    @GetMapping(path = "/services")
    public String showServices() {
        return "services";
    }
}

My footer html:

 <--- opening div located at end of header

            Services Orvif

Services

            Nous contacter

Recrutement

recrutement jsp:

<%@ include file="header.jsp" %>

Carrière

    <c:forEach items="${jobOfferList}" var="career">

${career.jobTitle}

            Voir l'annonce

    </c:forEach>

<%@ include file="footer.jsp" %>

recrutementAnnonce jsp (nothing of interest in my opinion besides the included footer at bottom:

<%@ include file="header.jsp" %>

        Description du poste

${jobOffer.jobDescription}

Vos missions

        <c:forEach items="${jobOffer.jobMissionsById}" var="mission">

${mission}

        </c:forEach>

<%@ include file="footer.jsp" %>


text:
Q: How to pass a block of commands to a python subprocess? I have an external application called gmx which works like so:
gmx trjconv -f test.trr -s test.tpr -o test.xtc -center -fit progressive -ur compact << eof
1
1
0
eof

This commands creates the file test.xtc in the current directory.
I would like to call this from a python subprocess. I tried the following:
p = subprocess.Popen(
    ['gmx', 'trjconv', '-f test.trr', '-s test.tpr', '-o test.xtc', '-center', '-ur compact', '-fit progressive'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.stdin.write(b'1\n1\n0\n')
p.stdin.close()

But it fails silently in the sense that no error occurs but nothing happens. I read some posts about passing eof but I could not adapt them to my needs. Would you have any idea about how to do this ?

A: The problem was in the way my Popen was written. Rewriting it as:
p = subprocess.Popen(
        ['gmx', 'trjconv', '-f', 'test.trr', '-s', 'test.tpr', '-o', 'test.xtc', '-center', '-ur', 'compact', '-fit', 'progressive'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    p.communicate(b'1\n1\n0')

did the job.
There were at least two mistakes:

*

*the arguments list must contain the arguments one by one (e.g. not
'-f test.trr' but '-f', 'test.trr')

*using communicate when using both stdin and stdout


text:
Q: AppEngine app stops updating Firebase without error I have an AppEngine app that manipulates a Firebase DB through AppEngine cron.
Everything works well, except that after 24 hours the app stops writing to Firebase. Without any discernible error.
You can find my code on GitHub
The database object is initialized during each servlet initialization here. The database call that seems to fail is here, which is called from here on the main servlet thread.
Any help would be greatly appreciated.

A: You're using an extremely old, deprecated version of the Firebase java client SDK:
compile 'com.firebase:firebase-client-jvm:2.5.2'

You should be using the Firebase Admin SDK instead, which fixes known issues when running the Firebase SDK in App Engine.
compile 'com.google.firebase:firebase-admin:5.3.1'

Some APIs have changed, so you will need to adapt to them.


text:
Q: Writing a 4D array as a 3D vectorising 2 dimensions I have a 4D array with dimensions as follows:
In [3]: flrev.shape
Out[3]: (9, 12, 143, 144)

From this array (flrev), I want to create a 3D array (dyn) with dimensions (9,12,20306).
This array will be produced when:

*

*from flrev(:,:,0,:) I take only the first value flrev(:,:,0,0)

*from flrev[:,:,1:-1,:] I take all values, so flrev[:,:,1:-1,:]

*from fl[ff,ll,-1,:] I take only the first value flrev[ff,ll,-1,0]
I tried to do this by looping and using np.ravel function:
phys = np.empty(([flrev.shape[0],flrev.shape[1],143*142]))
for ff in range(flrev.shape[0]):
    for ll in range(flrev.shape[1]):
        for ss in range(flrev.shape[2]):
            for kk in range(flrev.shape[3]):
                if flrev[ff,ll,ss,kk] == flrev[ff,ll,0,kk]:
                    phys[ff,ll,:] = np.ravel(flrev[ff,ll,0,0])
                elif flrev[ff,ll,ss,kk] == flrev[ff,ll,1:-1,kk]:
                    phys[ff,ll,:] = np.ravel(flrev[ff,ll,1:-1,:])
                elif flrev[ff,ll,ss,kk] == flrev[ff,ll,-1,kk]:
                    phys[ff,ll,:] = np.ravel(flrev[ff,ll,-1,0])

The error that I get is:
     47       if flrev[ff,ll,ss,kk] == flrev[ff,ll,0,kk]:
     48           phys[ff,ll,:] = np.ravel(flrev[ff,ll,0,0])
---> 49       elif flrev[ff,ll,ss,kk] == flrev[ff,ll,1:-1,kk]:
     50           phys[ff,ll,:] = np.ravel(flrev[ff,ll,1:-1,:])
     51       elif flrev[ff,ll,ss,kk] == flrev[ff,ll,-1,kk]:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Any idea on how to do this would be appreciated.
Thanks in advance.