text:
Q: Are you trialling QUIC or doing A/B testing? Myself and several other colleagues have had multiple occasions over the last few weeks where we found Stack Overflow to be unavailable from our work computers.  Once this happens, it remains the case for some time - I don't have an exact time, but the it's on the scale of several minutes but not hours.  I found that disconnecting my VPN made it available again when I was working from home (we have experienced it both over VPN and from the office).
When it is down, the browser just says "The connection was reset".  Usually it's only been Stack Overflow - at least when I tried Server Fault was still available.
A curl command during the time it is unavailable showed the TLS handshake failing
$ curl -vvv https://stackoverflow.com/questions/69725545/how-to-fix-javadoc-comment-has-parse-error-details-no-viable-alternative-at-in
* Trying 151.101.1.69:443...
* Connected to stackoverflow.com (151.101.1.69) port 443 (#0)
* schannel: disabled automatic use of client certificate
* schannel: ALPN, offering http/1.1
* schannel: failed to receive handshake, SSL/TLS connection failed
* Closing connection 0
curl: (35) schannel: failed to receive handshake, SSL/TLS connection failed

My IT department investigated and it looked like the culprit might be the fact that the firewall was blocking QUIC.  They are investigating further.  However, the next time it happened I disabled QUIC in Chrome and it started working from there - although the curl command still failed in the same way.
The thing is, the firewall always blocks QUIC - so why does it work most of the time?  I wondered if you (or any hosting partner) were doing any A/B testing or similar that might mean QUIC was sometimes offered and sometimes not?
It has been pointed out that curl without the --http3 option does not use QUIC, which does challenge my analysis.  We continue testing. I should maybe have mentioned that my curl was run from a windows machine (using cygwin - but the curl command is the windows one). Version reports
$ curl --version
curl 7.79.1 (Windows) libcurl/7.79.1 Schannel
Release-Date: 2021-09-22
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS HSTS IPv6 Kerberos Largefile NTLM SPNEGO SSL SSPI UnixSockets


text:
Q: Coordinate Value not displaying after clicking on Map I am trying to create a pop-up using Open Layers which will show the coordinate values when I click on the Map. There are no errors in the console window however, whenever I click on Map it
displays : "You Clicked Here [object object]" and not the actual coordinates of the place where I click. Am attaching the code that I am using.
PS : I am very new to JS so its quite possible I might be missing something very obvious.
Code Starting
// Creating a View

var view = new ol.View({
    center : [84.2294050294863, 21.330813185563247],
    zoom :5,
    projection : 'EPSG:4326'
})

// Elements that make up the popup.

const container = document.getElementById('popup');
const content = document.getElementById('popup-content');
const closer = document.getElementById('popup-closer');

// Add a click handler to hide the popup.

closer.onclick = function () {
  overlay.setPosition(undefined);
  closer.blur();
  return false;
};

// Setting Parameters

var basemap = new ol.layer.Tile({
    source: new ol.source.OSM()
})

var layerArray = [basemap]

//Create an overlay to anchor the popup to the map.

const overlay = new ol.Overlay({
  element: container,
  autoPan: true,
  autoPanAnimation: {
    duration: 250,
  },
});

// Create Map

var map = new ol.Map({
    target : 'map',
    layers : layerArray,
    view : view,
    overlays : [overlay]
});

// Add a click handler to the map to render the popup.

map.on('singleclick', function (event) {

  const coordinate = event.coordinate;
  const hdms = new ol.coordinate.toStringHDMS(ol.proj.toLonLat(coordinate));

  content.innerHTML = '
You clicked here:
' + hdms + '';
  overlay.setPosition(coordinate);
});

A: ol.coordinate.toStringHDMS is not an object, but just function/method for formatting geographic coordinates, so you don't have to use new qualifier when calling/envoking it (see docs at https://openlayers.org/en/latest/apidoc/module-ol_coordinate.html),
It should simply be:
const hdms = ol.coordinate.toStringHDMS(ol.proj.toLonLat(coordinate));

redpajama_set_name: RedPajamaStackExchange


text:
Q: Solving time-dependent differential equations Let $a:I \to \mathbb{R}$ be a smooth path defined on the open interval $I$. The initial value problem
$$\frac{dx}{dt}(t)=a(t)x(t), x(t_0)=x_0$$
has a solution for all $t_0 \in I$, $x_0 \in \mathbb{R}$, namely
$$x(t)=x_0e^{\int_{t_0}^t a(s) \ ds}$$
because
$$\frac{dx}{dt}(t)=x_0e^{\int_{t_0}^t a(s) \ ds} \cdot \frac{d}{dt}\left(\int_{t_0}^t a(s) \ ds \right) = x(t)a(t)$$
and
$$x(t_0)=x_0 e^{\int_{t_0}^{t_0}a(s) \ ds}= x_0e^0=x_0.$$
Now instead suppose $A:I \to M(n,\mathbb{R})$ is smooth, and we wish to solve
$$\frac{dx}{dt}(t)=A(t)x(t), x(t_0)=x_0.$$
Wikipedia claims there is no closed-form solution for a differential equation of this form. What goes wrong with defining
$$x(t)=e^{\int_{t_0}^t A(s) \ ds}x_0$$
where now we use the matrix exponential? Is this not considered to be a closed-form solution?

A: Hint: Take
$$
A(t)=\begin{bmatrix}
0&0\\
1&t\\
\end{bmatrix}.
$$
Find the solution directly. Calculate matrix exponential. Compare the results.
Hint #2: To see how commutativity plays the role, take your "solution" and try to differentiate, taking into account that
$$
(A(t)B(t))'=A'(t)B(t)+A(t)B'(t).
$$


text:
Q: Reading file with reverse dict to DataFrame efficiently I've got a bunch of 20MB text files with such a structure:
{'col-1': ['data-11', 'data-12'], 'col-2': [1, 2], 'col-n': [1, 2]}
{'col-1': ['data-21', 'data-22'], 'col-2': [1, 2], 'col-n': [1, 2]}
{'col-1': ['data-31', 'data-32', 'data-33'], 'col-2': [1, 2, 3], 'col-n': [1, 2, 3]}
...

A number of records rows in each line varies.
Which I want to read as:
        col-1       col-2   col-n
0       data-11     1       1
1       data-12     2       2
2       data-21     1       1
3       data-22     2       2
4       data-31     1       1
5       data-32     2       2
6       data-33     3       3

I've already prepared such code which works just fine:
import ast
import pandas as pd
import itertools

def _eval(line: str):
    ''' Turns: {'col-1': ['data-11', 'data-12'], 'col-2': [1, 2], 'col-n': [1, 2]}
        Into: [{'col-1': 'data-11', 'col-2': 1, 'col-n': 1}, {'col-1': 'data-12', 'col-2': 2, 'col-n': 2}]
    '''
    try:
        v = ast.literal_eval(line.rstrip()) # Reads line to dict
        v = [{k: v[k][i] for k in v} for i in range(len(v['col-n']))] # Revers dict, by splitting them and rejoin
        return v

    # In case of file structure error
    except Exception as e:
        print('err', e)
        return []

def read_structure(fp):
    with open(fp) as fh:
        return pd.DataFrame(itertools.chain(*list(map(_eval, fh.readlines()))))

But there must be a better way.
With itertools and map I've already get under 5 seconds.
I want to:
A) optimize loop moment v = [{k: v[k][i] for k in v} for i in range(len(v['col-n']))]
B) know if there's already pandas method that can read such structure (I've searched and tried all read_dict and records methods with different parameters)
C) Optimize it at all.
The function is already running in threads so multithreading/processing isn't a best idea.

A: Can you try the code below:
v = {k: v for k, v in zip(d.keys(), t)} for t in zip(*d.values())]
return v

A: First, I would try to avoid readlines which loads the whole file in memory as a list of lines. Then I would try to provide a dict of lists to the Dataframe constructor:
def read_structure(fp):
    cols = 'col-1', 'col-2', 'col-n'  # declare the column names
    data = {col: [] for col in cols}  # initialize the data structure

    with open(fp) as fh:
        for i, line in enumerate(io.StringIO(t), 1):
            try:
                row = ast.literal_eval(line)
                for k, v in row.items():
                    data[k].extend(v)
            except Exception as e:
                print('Error line', i, line, e)
                raise           # unsure that we can continue after an error
    return pd.DataFrame(data)

Unsure whether it is fast, but at least it is simple


text:
Q: Redirect query string url to non query string I'm trying to redirect /cgibin/webdata_pro.pl?_cgifunction=form&_layout=jobs.pl
to
http://compliancesearch.com/compliance_jobs.html
there is usually a query string after jobs.pl.I've tried a bunch of things including:
RewriteEngine on
RewwriteRule /cgibin/webdata_pro.pl?_cgifunction=form&_layout=jobs.pl(.*) http://compliancesearch.com/compliance_jobs.html [L,R=301]

A: You can't match against the query string in a RewriteRule. You need to use the %{QUERY_STRING} variable.
RewriteEngine on
RewriteCond %{QUERY_STRING} _cgifunction=form&_layout=jobs.pl
RewriteRule ^cgibin/webdata_pro.pl http://compliancesearch.com/compliance_jobs.html? [R=301,L]

The better place to do this, however, is probably in the webdata_pro.pl script.


text:
Q: shuffle.js: position of grids move after shuffle I have a 3*3 grid layout. It should look something like this:

Then I added shuffle.js to shuffle the grids and filter them. However, the grid layout turns into this.

Why did this happen and how to fix it?? Thank you
My HTML code:

Siyan Zhao

Portfolio

About Me

Skills

Resume

All

UI/UX

Design

Research

Illustration

Firefly: A Smart Ticket

Chance

Monogram

Gestalt Composition

The Red Thread

Typographic Hierarchy

©Siyan Zhao 2014

My CSS code:
/* -------------------------------------*/
#wrapper {
background-color: #FFFfff;
width: 70%;
padding-bottom: 0px;
margin: 0 auto;
position: relative;
min-height: 100%;
overflow-x: hidden;
}

/* Left hand side menu style */
/* -------------------------------------*/
#menunav {
z-index: 20;
background-color: #ffffff;
position: fixed;
width: 210px;
padding-top: 80px;
display: block;
margin: 0px;
border-right-style: none;
border-color: rgba(0,0,0,1.00);
border-right-width: thin;
font-family: 'Droid Sans', sans-serif;;
font-weight: normal;
}

#logo {
text-align: left;
margin-bottom: 48px;
padding-top: 18px;
font-family: "Century Gothic";
font-weight: bold;
font-size:2.3em;
}

#menunav ul {
list-style-type: none;
padding: 0px 0px 0px 0px;
}

#menunav #nav a{
text-align: left;
font-size: 1em;
padding-top: 18px;
border-color: rgba(0,0,0,1.00);
border-bottom-style: solid;
border-width: thin;
-webkit-transition: padding-left 0.3s ease-in-out;
-moz-transition: padding-left 0.3s ease-in-out;
-o-transition: padding-left 0.3s3 ease-in-out;
-ms-transition: padding-left 0.3s3 ease-in-out;
transition: padding-left 0.3s ease-in-out;
}

#menunav #nav a:hover {
padding-left: 50px;
}

#menunav #nav a:active, #mainnav a:focus, #menunav #nav a.thispage{
text-decoration: none;
font-weight: bold;
/*ovrwrite hover effect for active page */
padding-left: 0;
}

/* Formatting for main page grid area*/
/* -------------------------------------*/
.bucket {
float: left;
margin: 0% 0%;
position: relative;
-webkit-transition: .5s all;
-moz-transition: .5s all;
-o-transition: .5s all;
-ms-transition: .5s all;
transition: .5s all;
width: 33.3%;

}

.grid3 .bucket:nth-of-type(3n+1) {
clear: left;
}

.bucket img {
height: auto;
width: 100%;
/*Align image to the baseline to delete white spacing*/
vertical-align: bottom;
}

/*hover over overlay effect*/
/* -------------------------------------*/
.img-overlay {
background-color: rgba(0,0,0,0.7);
bottom: 0;
left: 0;
top: 0;
opacity: 0;
overflow: hidden;
position: absolute;
width: 100%;
z-index: 1000;
transition: opacity 0.25s;
-webkit-transition: opacity 0.25s;
}

.img-overlay h5{
opacity: 1;
display: inline-block;
margin: auto;
font-weight: normal;
font-size: 1.3vw;
line-height: 1vw;
position: absolute;
top: 30%;
right: 10px;
left: 10px;
color: rgba(255,255,255,1.00);
text-align: center;
}
.img-overlay p{
opacity: 1;
display: inline-block;
margin: auto;
position: absolute;
top: 47%;
right: 10px;
left: 10px;
color: rgba(255,255,255,1.00);
text-align: center;
font-family: 'Droid Serif', serif;
font-size: 1.2vw;
line-height: 1vw;
/*vertical-align: middle;*/
}

.bucket:hover .img-overlay {
opacity: 1;
}

My Javascript
$(document).ready(function() {

/* Shuffling buckets */
var $grid3 = $('.grid3');
$grid3.shuffle({
    itemSelector: '.bucket'
});

$('#filter a').click(function (e) {
e.preventDefault();

// set active class
$('#filter a').removeClass('active');
$(this).addClass('active');

// get group name from clicked item
var groupName = $(this).attr('data-group');

// reshuffle grid
$grid3.shuffle('shuffle', groupName );
});

A: You should make sure that the container parent div are set:
#content {
    position:relative;
}

or
#content . grid3 {
    position:relative;
}


text:
Q: Using a static template constexpr with SFINAE fails I'm trying to create a class template which provides a way to check if the template was given a specific type.
#include <type_traits>

template<typename T, typename U>
class Acceptor
{
public:

    template<typename X>
    static constexpr bool accepts =
        std::is_same<T, typename std::remove_reference<X>::type>::value ||
        std::is_same<U, typename std::remove_reference<X>::type>::value;

    void set(T value) { /* some code */ }
    void set(U value) { /* some code */ }
};

I would like to use the template above in a SFINAE expression as follows:
#include <type_traits>

class Setter
{
public:
    template<typename T, typename U,
        typename std::enable_if< T::accepts<U> >::type * = nullptr>
    void set(T instance, U&& value)
    {
        instance.set(std::forward<U>(value));
    }

    template<typename T, typename U,
        typename std::enable_if< !T::accepts<U> >::type * = nullptr>
    void set(T instance, U&& value)
    {
        // Nothing to do here
    }
};

but the code doesn't compile in GCC 7.1.0 or MSVC for VS2017. The former is giving me the following error:

error: 'struct std::enable_if<(T:: accepts < )>' is not a valid type for a template non-type parameter

but I can't see the reason.


text:
Q: Rewriting a small function wrapped with a logger using fp-ts I wanted to try to rewrite some parts of my code using fp-ts and considered to refactor the following method:
export const createApiServer = () => {
    logger.info("Starting World Server API");

    const apiServer = express()
        // 3rd party middleware
        .use(helmet())
        .use(bodyParser.json())
        .use(cors())
        // Root route
        .get("/", (_, result) => result.sendStatus(httpStatusCodes.OK))
        // 404 - Not Found
        .use((_, result) => result.sendStatus(httpStatusCodes.NOT_FOUND))
        // 500 - Internal Server Error
        .use(errorLoggerMiddleware)
        .use(errorResponseMiddleware);

    logger.verbose(`Initialized World Server API in ${process.uptime().toFixed(3)} seconds`);

    return apiServer;
};

After reading about the IO type for sideffects I tried using it as follows:
const info = (message: string) => new IO(() => log.info(message));
const verbose = (message: string) => new IO(() => log.verbose(message));

const setupApiServer = () =>
    new IO(() =>
        express()
            .use(helmet())
            .use(bodyParser.json())
            .use(cors())
            .get("/", (_, result) => result.sendStatus(httpStatusCodes.OK))
            .use((_, result) => result.sendStatus(httpStatusCodes.NOT_FOUND))
            .use(errorLoggerMiddleware)
            .use(errorResponseMiddleware)
    );

export const createApiServer = () =>
    info("Starting World Server API")
        .chain(setupApiServer)
        .chain((apiServer) =>
            verbose(`Initialized World Server API in ${process.uptime().toFixed(3)} seconds`)
                .map(() => apiServer)
        )
        .run();

It feels rather weird to arbitrarily use the map method to pipe through the apiServer object in the last chain call just to log inbetween receiving it and send it further. I'd like to know whether this is correct or whether there are any different patterns for this.

A: You can use chainFirst.
With chainFirst you can refactor this
import { pipe } from "fp-ts/lib/pipeable";
import * as IO from "fp-ts/lib/IO";

declare const log: (m: string) => IO.IO<void>
declare const a: IO.IO<number>

pipe(
  a,
  IO.chain((a) => pipe(log(`Got ${a}`), IO.map(() => a)))
)

into this
pipe(
  a,
  IO.chainFirst((a) => log(`Got ${a}`))
)


text:
Q: MacDuff OpenCV -5 Bad argument in function circle I'm trying to get the example script to work with the MacDuff module
However, it's not working out of the box as it's four years old.
This is the error:
D:\LearnPython\3>py macduff.py "examples/test.jpg" "result.png" > "results.csv"
Traceback (most recent call last):
  File "macduff.py", line 526, in <module>
    out, colorchecker = find_macbeth(argv[1])
  File "macduff.py", line 495, in find_macbeth
    found_colorchecker.size)
  File "macduff.py", line 138, in draw_colorchecker
    cv.circle(image, (x, y), radius//2, expected_color.tolist(), -1)
cv2.error: OpenCV(4.5.2) :-1: error: (-5:Bad argument) in function 'circle'
> Overload resolution failed:
>  - Can't parse 'center'. Sequence item with index 0 has a wrong type
>  - Can't parse 'center'. Sequence item with index 0 has a wrong type

which points to this function:
def draw_colorchecker(colors, centers, image, radius):
    for observed_color, expected_color, pt in zip(colors.reshape(-1, 3),
                                                  expected_colors.reshape(-1, 3),
                                                  centers.reshape(-1, 2)):
        x, y = pt
        cv.circle(image, (x, y), radius//2, expected_color.tolist(), -1)
        cv.circle(image, (x, y), radius//4, observed_color.tolist(), -1)
    return image

I can't see anything wrong with that. So I'm not sure how to proceed in order to get it to work.


text:
Q: Merging the datasets into one single column by using Pandas looks like I need your help, I am trying to merge the datasets into a single dataset. By using this codes
import pandas as pd
import numpy as np
Total_Transfer = pd.read_excel('total_transfer.xlsx')
Total_Issued = pd.read_excel('total_issued.xlsx')
Total_Retirement = pd.read_excel('retirement_finalist.xlsx')
pd.merge(Total_Issued,Total_Retirement,Total_Transfer, on ='Vintage')

However it shows an error like this
    ---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-44-053aa3dcdb13> in <module>
----> 1 pd.merge(Total_Issued,Total_Retirement,Total_Transfer, on ='Vintage')

~\anaconda3\lib\site-packages\pandas\core\reshape\merge.py in merge(left, right, how, on, left_on, right_on, left_index, right_index, sort, suffixes, copy, indicator, validate)
     87         validate=validate,
     88     )
---> 89     return op.get_result()
     90
     91

~\anaconda3\lib\site-packages\pandas\core\reshape\merge.py in get_result(self)
    666             self.left, self.right = self._indicator_pre_merge(self.left, self.right)
    667
--> 668         join_index, left_indexer, right_indexer = self._get_join_info()
    669
    670         llabels, rlabels = _items_overlap_with_suffix(

~\anaconda3\lib\site-packages\pandas\core\reshape\merge.py in _get_join_info(self)
    882             )
    883         else:
--> 884             (left_indexer, right_indexer) = self._get_join_indexers()
    885
    886             if self.right_index:

~\anaconda3\lib\site-packages\pandas\core\reshape\merge.py in _get_join_indexers(self)
    860     def _get_join_indexers(self):
    861         """ return the join indexers """
--> 862         return _get_join_indexers(
    863             self.left_join_keys, self.right_join_keys, sort=self.sort, how=self.how
    864         )

~\anaconda3\lib\site-packages\pandas\core\reshape\merge.py in _get_join_indexers(left_keys, right_keys, sort, how, **kwargs)
   1326         for n in range(len(left_keys))
   1327     )
-> 1328     zipped = zip(*mapped)
   1329     llab, rlab, shape = [list(x) for x in zipped]
   1330

~\anaconda3\lib\site-packages\pandas\core\reshape\merge.py in <genexpr>(.0)
   1323     # get left & right join labels and num. of levels at each location
   1324     mapped = (
-> 1325         _factorize_keys(left_keys[n], right_keys[n], sort=sort, how=how)
   1326         for n in range(len(left_keys))
   1327     )

~\anaconda3\lib\site-packages\pandas\core\reshape\merge.py in _factorize_keys(lk, rk, sort, how)
   1993         count += 1
   1994
-> 1995     if how == "right":
   1996         return rlab, llab, count
   1997     return llab, rlab, count

~\anaconda3\lib\site-packages\pandas\core\generic.py in __nonzero__(self)
   1327
   1328     def __nonzero__(self):
-> 1329         raise ValueError(
   1330             f"The truth value of a {type(self).__name__} is ambiguous. "
   1331             "Use a.empty, a.bool(), a.item(), a.any() or a.all()."

ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

I don't understand where the ambiguity comes, but I am sure that I have change the data type in to numeric for the key value of every datasets.
I am very appreciate for your support on this one. Thanks!

A: I think this error appears because you are not using correctly pandas merge() function - you can merge only two DataFrames at a time.
Maybe it helps:
Total_Issued.merge(Total_Retirement, on ='Vintage').merge(Total_Transfer, on='Vintage')

or
pd.merge(pd.merge(Total_Issued, Total_Retirement, on = 'Vintage'), Total_Transfer, on='Vintage')


text:
Q: How to format items within a register in ConTeXt? I have some documents that use a register to keep track of items, that is then displayed in a list:
\defineregister[animals][pagenumber=no, indicator=no, before=, n=1]
\def\definegetanimal{\animals}
\define[1]\defineanimal{#1}
\starttext

    \defineanimal{cat}
    \defineanimal{pig}
    \defineanimal{sheep}

    \placeregister[animals]

\stoptext

I need to do some very simple formatting of the register, but whatever I try doesn't seem to work.
In one document, I need to display the register within a list:
\defineregister[animals][pagenumber=no, indicator=no, before=\item, n=1]
\def\definegetanimal{\animals}
\define[1]\defineanimal{#1}
\starttext

    \defineanimal{cat}
    \defineanimal{pig}
    \defineanimal{sheep}

    \startitemize[n]
        \placeregister[animals]
    \stopitemize

\stoptext

In another document, I need each item within a list to be displayed on its own on the page (i.e. a page break placed afterwards):
\defineregister[animals][pagenumber=no, indicator=no, before=, n=1, after=\pagebreak]
\def\definegetanimal{\animals}
\define[1]\defineanimal{#1}
\starttext

    \defineanimal{cat}
    \defineanimal{pig}
    \defineanimal{sheep}

    \placeregister[animals]

\stoptext

Neither of these worked, and I can't find any other \setup command that helps configure the appearance of the items appearing within the register's list.
How can I format the items within a register in ConTeXt?

A: If I get you right, you need to set \textcommand instead:
%\setuppapersize[A6]
\defineregister[animalsi]
    [pagenumber=no,
     indicator=no,
     n=1,
     before=,
     textcommand=\groupedcommand{\startitem}{\stopitem}]
\defineregister[animalsii][animalsi]
    [textcommand=\groupedcommand{}\page]
\animalsi{Ne}
\animalsi{ultra}
\animalsi{crepidam}
\animalsii{Feliz}
\animalsii{bicentenario}
\animalsii{Perú}
\starttext
\startitemize[n]
\placeregister[animalsi]
\page
\placeregister[animalsii]
\stopitemize
\stoptext

For aliases, \let<whatever macro name I choose>\animalsi and so on is shorter and more direct than a \define solution IMO.


text:
Q: How to hash an email from html input in Angular using Md5? import { Md5 } from 'ts-md5/dist/md5';
console.log(Md5.hashStr('john_doe@example.com'));

This successfully hashes provided email outside the component but I need to implement this into Angular component?
export class HasherComponent implements OnInit {

    md5 = new Md5();

   constructor() { }

   hash(str: string) {
     this.md5.hashStr(str);
   }
}

I m not really experienced with angular yet, I have used React but never Angular and this is a problem for me. So I should call this function with passed parameter from input element:
<input type="text" name="email" placeholder="Enter your email:" value="" />
<button (click)="hash()">Hash it!</button>

A: import {md5} from './md5'; //make sure it points to the folder where the md5.ts file is
let e = md5(this.email); // this.email = 'kashi_rock82@yahoo.com'

A: Try this:
import md5 in your component/service:
import {md5} from './md5';

then you can use it in your component/service:
let e = md5(this.email);

A: Import the required library:
import {md5} from './md5';

And use it in the component:
export class HasherComponent implements OnInit {

    e: string;
    constructor() {
      this.e = md5(this.email);
    }
    ngOnInit() {}
}

Or:
import {Md5} from 'ts-md5/dist/md5';

export class HasherComponent implements OnInit {

    md5 = new Md5();
    hashString: string;

    constructor() {
      this.hashString = Md5.hashStr('blah blah blah')
    }
    ngOnInit() {}
}


text:
Q: IPMI command reference? I manage a largish number of servers, and I am trying to write a bash script to inspect their BMCs using ipmitool. This is the essence of what I'm doing:
...
admin=$(ipmitool -U user -P pasw -I lanplus -H $ipmi user list | grep " user " | awk '{print $1}')
chn=$(ipmitool -U user -P pasw -I lanplus -H 10.100.10.3 channel info | grep -e '^Channel.*info:' | awk '{print $2}')
ipmitool -U user -P pasw -I lanplus -H $ipmi user priv $admin 4 $chn
ipmitool -U user -P pasw -I lanplus -H $ipmi channel setaccess $chn $admin callin=on ipmi=on link=on privilege=4
ipmitool -U user -P pasw -I lanplus -H $ipmi sol payload enable $chn $admin
ipmitool -U user -P pasw -I lanplus -H $ipmi sol set volatile-bit-rate 115.2 $chn
ipmitool -U user -P pasw -I lanplus -H $ipmi sol set non-volatile-bit-rate 115.2 $chn
ipmitool -U user -P pasw -I lanplus -H $ipmi sol looptest 1
...

It works fine until I reach the sol set ... commands, which fail:
Error setting SOL parameter 'set-in-progress': Attempt to set set-in-progress when not in set-complete state
Error: set of parameter "volatile-bit-rate" failed

Looking at sol set ... from the ipmi shell:
ipmitool -U user -P pasw -I lanplus -H $ipmi shell

I see:
ipmitool> sol set

SOL set usage:

  sol set <parameter> <value> [channel] [noguard]

SOL set parameters and values:

  set-in-progress             set-complete | set-in-progress | commit-write
  enabled                     true | false
  force-encryption            true | false
  force-authentication        true | false
  privilege-level             user | operator | admin | oem
  character-accumulate-level  <in 5 ms increments>
  character-send-threshold    N
  retry-count                 N
  retry-interval              <in 10 ms increments>
  non-volatile-bit-rate       serial | 9.6 | 19.2 | 38.4 | 57.6 | 115.2
  volatile-bit-rate           serial | 9.6 | 19.2 | 38.4 | 57.6 | 115.2

So it looks as if one can manually set it to complete - but is it as simple as that? Is there a reference manual for what these commands do?

A: The following is a description of [Set In Progress] in the IPMI specification.
This parameter is used to indicate when any of the following parameters are being updated, and when the updates are completed. The bit is primarily provided to alert software than some other software or utility is in the process of making changes to the data.
An implementation can also elect to provide a 'rollback' feature that uses this information to decide whether to 'roll back' to the previous configuration information, or to accept the configuration change.
If used, the roll back shall restore all parameters to their previous state. Otherwise, the change shall take effect when the write occurs.

If your BMC supports this feature, the order of settings is as follows:
ipmitool sol set set-in-progress set-in-progress
ipmitool sol set xxxx
ipmitool sol set set-in-progress commit-write
ipmitool sol set set-in-progress set-complete

IPMI Spec: https://www.intel.com/content/www/us/en/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html


text:
Q: XPath 1.0 date comparison with different date formats There are already several threads with similar questions but I haven't found this one: What's the best way to compare dates in XPath 1.0 when they have different formats? For example:
<?xml version="1.0" encoding="utf-8"?>
<entries>
  <entry date="2010-11-22" format="yyyy-mm-dd" />
  <entry date="12.03.2014" format="dd.mm.yyyy" />
  <entry date="09/30/14" format="mm/dd/yy" />
</entries>

I want to find all entries with a date > than 03/03/14.
Are there any tricks to split strings and reorder the chunks according to the format line and perform the translate() trick afterwards?


text:
Q: MySQL - Update rows on criteria of values of the same column I have a small data table

c1
c2
c3
c4

test_Tb

test_T
1
2
3

test_C
4
5
6

test_Mb

test_M
7
8
9

I would like to update the columns c2, c3 and c4 for rows where the values of c1 have value c1 = replace (c1, 'b', '')
in a single request, but I'm not even sure if it's possible anymore
to have finally
update test_Tb with values of row test_T, and test_Mb with values of row test_M

c1
c2
c3
c4

test_Tb
1
2
3

test_T
1
2
3

test_C
4
5
6

test_Mb
7
8
9

test_M
7
8
9

either my requests don't work, or it's too slow to complete ...
i'm lost.
Thanks for your help.

A: CREATE TABLE Data (
  c1 VARCHAR(255),
  c2 INT,
  c3 INT,
  c4 INT
);

INSERT INTO Data VALUES ('test_Tb', NULL, NULL, NULL);
INSERT INTO Data VALUES ('test_T', 1, 2, 3);
INSERT INTO Data VALUES ('test_C', 4, 5, 6);
INSERT INTO Data VALUES ('test_Mb', NULL, NULL, NULL);
INSERT INTO Data VALUES ('test_M', 7, 8, 9);

UPDATE Data AS target,
       ( SELECT * FROM Data WHERE c1 NOT LIKE '%b') AS source
   SET target.c2 = source.c2,
       target.c3 = source.c3,
       target.c4 = source.c4
 WHERE target.c1 = CONCAT(source.c1, 'b')

sqlfiddle

A: CREATE TABLE Data (
  c1 VARCHAR(255),
  c2 INT,
  c3 INT,
  c4 INT
);

INSERT INTO Data VALUES ('test_Tb', NULL, NULL, NULL);
INSERT INTO Data VALUES ('test_T', 1, 2, 3);
INSERT INTO Data VALUES ('test_C', 4, 5, 6);
INSERT INTO Data VALUES ('test_Mb', NULL, NULL, NULL);
INSERT INTO Data VALUES ('test_M', 7, 8, 9);

    UPDATE Data AS target
INNER JOIN Data AS source ON target.c1 = CONCAT(source.c1, 'b')
       SET target.c2 = source.c2,
           target.c3 = source.c3,
           target.c4 = source.c4
     WHERE target.c1 NOT LIKE '%b'

Edit: Changed WHERE clause to "target.c1 NOT LIKE '%b'". With thanks to Barmar.
sqlfiddle


text:
Q: How to display textbox tag as a value inside textbox? I want to initialy display Tag inside textbox, so I write something like this:
var resultValue0 = new TextBox()
{
    Location = new Point(x, y),
    Tag = new int[i,j],
    Text = string.Format("({0})", Tag)
};

But in result i get only "()" in this textbox. How can I display this properly?

A: EDIT:
it seems you want to store "(i,j)" inside of Text (now that I read your latest comment).
        var resultValue0 = new TextBox()
        {
            Location = new Point(x, y),
            Tag = string.Format("{0},{1}", i, j)
        };
        resultValue0.Text = string.Format("({0})", resultValue0.Tag);

Also, I didn't realized before that you were trying to set Text inside of the parameters of TextBox using another parameter (Tag). That's not possible since Tag was not set yet. If you want to set resultValue0.Text using resultValue0.Tag you'll need to set Text outside of the parameter section (as above).

A: You said   i get only "()" in this textbox. But you expect to display what ?
If you want text box display "(i,j)" and instead of i will be number :
var tb = new TextBox()
{
    Tag = new int[2,4]
};
tb.Text = string.Format("({0},{1})", ( tb.Tag as int[,]).GetUpperBound(0)+1, (tb.Tag as int[,]).GetUpperBound(1)+1);


text:
Q: tabOrder related to HTML table I have a table that BASICALLY looks like this:

    Box 1
    Box 2

However, i have a bunch of  and  elements in both. I currently have some  elements with tabOrder=0 in Box 2. Box 1 has NO elements with tabOrder defined. The only other element in the whole file with tabOrder defined is a search box with tabOrder=-1 at a higher level above this table.
So, when this page renders, the focus is on the search box, but when i tab it still goes to the first element in Box 1, even though only elements in Box 2 have this defined! Please help. I would like the elements in Box 2 to tab first after the search box. The order after that doesn't matter. thanks!

A: tabindex="0" is basically the default for any input (also link?) elements.  If you want to skip over elements when pressing tab, you'll have to set tabindex=-1 explicitly
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex


text:
Q: get the data from TableView and insert into database In javafx I have created a some buttons and a TableView with some columns.
when I click the button, it adds the product into TableView columns.
so far, no problem with that.
I have created a Product class and using this I create a product object with pID, pName, pQty, pPrice.
example:
new Product(1, "Pen", 2, 3.50);
new Product(2, "notebook", 1, 5.00);

so whenever I click a product button it adds this product in next row.
Here is the problem I face:
I want to add all these rows in TableView to database I have created.
Is there a method to get all these objects one by one from TableView and insert it to database?
Or is there a method to populate database from ObservableList?

A: Here is my solution.
Actually I was so stupid as I was keep trying to insert all these data into another database and table with the same names.
So, basically no problem of inserting. sorry for the inconvenience. and Thanks for everyone who is interested.
Also, I am putting here the code I used for insertion. In case it could be useful for someone.
String query = "INSERT INTO Product (pID, pName, pQty, pPrice) VALUES (?,?,?,?)";
            pst = conn.prepareStatement(query);

            for(int i=0; i<data.size(); i++){

                 pst.setString(1, data.get(i).getRID().toString());
                 pst.setString(2, data.get(i).getRName());
                 pst.setString(3, data.get(i).getRQty().toString());
                 pst.setString(4, data.get(i).getRPrice().toString());

                 pst.execute();

            }

I have put this inside for loop, this way I was able to iterate each object member.


text:
Q: apt update connecting to my public ip I had an issue where my Ubuntu Server 16.04 filesystem went read only last week. I rebooted and had to do an fsck which seems to have fixed the issue and it boots and I can log in fine, however I can't do an 'apt update' anymore. When I try it tries connecting to my public IP for some reason.
What's weird is that I can ping us.archive.ubunutu.com and nslookup it and it resolves correctly.
broy@broyserver:/etc/apt$ ping us.archive.ubuntu.com
PING us.archive.ubuntu.com (91.189.91.26) 56(84) bytes of data.
64 bytes from hanger.canonical.com (91.189.91.26): icmp_seq=1 ttl=57 time=6.11 ms
64 bytes from hanger.canonical.com (91.189.91.26): icmp_seq=2 ttl=57 time=4.02 ms
^C
--- us.archive.ubuntu.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 4.023/5.069/6.116/1.048 ms
broy@broyserver:/etc/apt$ nslookup us.archive.ubuntu.com
Server:         10.100.0.203
Address:        10.100.0.203#53

Non-authoritative answer:
Name:   us.archive.ubuntu.com
Address: 91.189.91.23
Name:   us.archive.ubuntu.com
Address: 91.189.91.26

I replaced my actual public IP below with MYPUBLICIP. I get my IP addresses handed out via dhcp, and I am using an internal DNS server which resolves correctly. Why would my server be trying to use my own public IP to reach out to for updates?
broy@broyserver:/etc/apt$ sudo apt update
Err:1 http://us.archive.ubuntu.com/ubuntu xenial InRelease
  Could not connect to MYPUBLICIP:80 (MYPUBLICIP), connection timed out
Err:2 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease
  Unable to connect to MYPUBLICIP:http:
Err:3 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease
  Unable to connect to MYPUBLICIP:http:
Err:4 http://ppa.launchpad.net/mythbuntu/0.28/ubuntu xenial InRelease
  Unable to connect to MYPUBLICIP:http:
Err:5 http://security.ubuntu.com/ubuntu xenial-security InRelease
  Unable to connect to MYPUBLICIP:http:
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Could not connect to MYPUBLICIP:80 (MYPUBLICIP), connection timed out
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Unable to connect to MYPUBLICIP:http:
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Unable to connect to MYPUBLICIP:http:
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Unable to connect to MYPUBLICIP:http:
W: Failed to fetch http://ppa.launchpad.net/mythbuntu/0.28/ubuntu/dists/xenial/InRelease  Unable to connect to MYPUBLICIP:http:
W: Some index files failed to download. They have been ignored, or old ones used instead.

I don't have a /etc/apt/apt.conf which may be the issue. Could someone please give me the output of what should be there so I can create it?
broy@broyserver:/etc/apt$ cat /etc/apt/apt.conf
cat: /etc/apt/apt.conf: No such file or directory
broy@broyserver:/etc/apt$

/etc/apt/sources.list
broy@broyserver:/etc/apt$ cat /etc/apt/sources.list
#

# deb cdrom:[Ubuntu-Server 15.04 _Vivid Vervet_ - Release amd64 (20150422)]/ vivid main restricted

# deb cdrom:[Ubuntu-Server 15.04 _Vivid Vervet_ - Release amd64 (20150422)]/ vivid main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ xenial universe
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu vivid partner
# deb-src http://archive.canonical.com/ubuntu vivid partner
broy@broyserver:/etc/apt$

Adding lsb-release -a
broy@broyserver:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:        16.04
Codename:       xenial

Adding hosts and resolv.conf
broy@broyserver:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 broyserver.broyuken.com broyserver
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
broy@broyserver:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.100.0.203
nameserver 8.8.8.8
nameserver 8.8.4.4
search broyuken.com
broy@broyserver:~$

Also adding output of $http_proxy and $https_proxy
broy@broyserver:~$ echo $http_proxy

broy@broyserver:~$ echo $https_proxy

broy@broyserver:~$

A: Go ahead and close this out, my security gateway was blocking apt via app control and redirecting to a usercheck page. As soon as I allowed it, things started working again


text:
Q: Computational Theory: Proof, Chomsky normal form Prove or disprove: If $G$ is a CFG in Chomsky normal form, then for any string $w \in L(G)$ of length $n\geq 1$ then exactly $2n-1$ steps are required for any derivation of $w$.
I'm stuck at where to start with this proof... When i see the $2n-1$ it leads me to believe that I should utilize the pigeon hole principle. However, i'm also thinking it would be more thorough to prove this by doing a proof by construction. Any help is appreciated.

A: It's an old post, but I'm interested in this proof. I don't find the other answer correct. Instead I found another solution. First we prove the following theorem:
Theorem 1
Consider a derivation $\mathcal{D}$ of some word $w\in L$, where $|w|\gt 0$. For any subderivation $\mathcal{D'}$ of $\mathcal{D}$ that produces a substring of $w$ with length $k>0$, $\mathcal{D'}$ uses exactly $2k-1$ production steps.
Proof: By induction on the structure of the subderivation.

*

*Case $S\to\varepsilon$: This case is irrelevant since it doesn't produce a word of length greater than 0.

*Case $A\to a$: Indeed, such a subderivation produces a string of length 1 in $1=2\cdot 1 - 1$ production steps.

*Case $A\to BC$: Let $k_B$ and $k_C$ be the lengths of the substrings of $w$ that are produced by the subderivations that start from $B$ and $C$, respectively. Obviously, $k = k_B + k_C$. Since $B\neq S$ and $C\neq S$, we have $k_B > 0$ and $k_C > 0$. By the induction hypothesis, the two subderivations use $2 k_B - 1$ and $2 k_C - 1$ production steps, respectively. Then, the whole derivation uses $(2\cdot k_B - 1) + (2\cdot k_C - 1) + 1 = 2 k - 1$.

Qed.
The statement in the question follows by instantiating $k$ with $|w|$ in the above theorem. The theorem requires that $k>0$, so we have to be careful that $|w| >0$. That's no problem, because $|w|>0$ is also a requirement of the theorem.

Edit: Theorem 1 above can be rephrased to
Theorem 1': For any derivation, $A\to\ldots\to w$ produced by the rules of some context free grammar in CNF, where $A$ is a non-terminal and $|w|>0$, that derivation uses $2|w|−1$ steps.
Then, the statement of the question follows as a corollary of Theorem 1', where we set $A$ to be specifically the starting symbol of the grammar and not just any non-terminal.


text:
Q: Add click action to countries in raphael JS world map I'm making a world map in which you click a region (North America, Asia etc. ) using raphaeljs and world.js shapes
@David Noël has opensourced a way of combining countries into one element which highlights when you rollover, which I have done succesfully.
I'm usually OK with Javascript but I can't figure out how to create a click event for these regions, so some relevant info pops up for each region. I think there may be the answer in Davids link above but I don't fully understand the documentation
You can see my progress so far here.. http://thetally.efinancialnews.com/tallyassets/mapareas/index.html

A: OK so after contacting David Noel personally he helped me out with the answer.
When initializing anywhere I made country groups using the country codes like so...
 <script src="anywhere.js"></script>
<script type="text/javascript">
  var aw = new Anywhere(
    document.getElementById('map_div'),
    {
<!--"AFRICA":["DZ","AO","SH","BJ","BW","BF","BI","CM","CV","CF","TD","KM","CG","DJ","EG","GQ","ER","ET","GA","GM","GH","GW","GN","CI","KE","LS","LR","LY","MG","MW","ML","MR","MU","YT","MA","MZ","NA","NE","NG","ST","RE","RW","ST","SN","SC","SL","SO","ZA","SH","SD","SZ","TZ","TG","TN","UG","CD","ZM","TZ","ZW","SS","CD"],-->
<!--"EUROPE":["AL","AD","AT","BY","BE","BA","BG","HR","CY","CZ","DK","EE","FO","FI","FR","DE","GI","GR","HU","IS","IE","IT","LV","LI","LT","LU","MK","MT","MD","MC","NL","NO","PL","PT","RO","RU","SM","RS","SK","SI","ES","SE","CH","UA","GB","VA","RS","IM","RS","ME"],-->
"EMEA":["AL","AD","AT","BY","BE","BA","BG","HR","CY","CZ","DK","EE","FO","FI","FR","DE","GI","GR","HU","IS","IE","IT","LV","LI","LT","LU","MK","MT","MD","MC","NL","NO","PL","PT","RO","RU","SM","RS","SK","SI","ES","SE","CH","UA","GB","VA","RS","IM","RS","ME","DZ","AO","SH","BJ","BW","BF","BI","CM","CV","CF","TD","KM","CG","DJ","EG","GQ","ER","ET","GA","GM","GH","GW","GN","CI","KE","LS","LR","LY","MG","MW","ML","MR","MU","YT","MA","MZ","NA","NE","NG","ST","RE","RW","ST","SN","SC","SL","SO","ZA","SH","SD","SZ","TZ","TG","TN","UG","CD","ZM","TZ","ZW","SS","CD"],
"NORTH AMERICA":["AI","AG","AW","BS","BB","BZ","BM","VG","CA","KY","CR","CU","CW","DM","DO","SV","GL","GD","GP","GT","HT","HN","JM","MQ","MX","PM","MS","CW","KN","NI","PA","PR","KN","LC","PM","VC","TT","TC","VI","US","SX","BQ"],
"SOUTH AMERICA":["AR","BO","BR","CL","CO","EC","FK","GF","GY","GY","PY","PE","SR","UY","VE"],
"ASIA":["AF","AM","AZ","BH","BD","BT","BN","KH","CN","CX","CC","IO","GE","HK","IN","ID","IR","IQ","IL","JP","JO","KZ","KP","KR","KW","KG","LA","LB","MO","MY","MV","MN","MM","NP","OM","PK","PH","QA","SA","SG","LK","SY","TW","TJ","TH","TR","TM","AE","UZ","VN","YE","PS"],
"PACIFIC":["AS","AU","NZ","CK","FJ","PF","GU","KI","MP","MH","FM","UM","NR","NC","NZ","NU","NF","PW","PG","MP","SB","TK","TO","TV","VU","UM","WF","WS","TL"]
},

..then my custom JS file looked like this...
// JavaScript Document

$( document ).ready(function() {

function changeChart() {

console.log('change');

if (dataSet == 1) {

var bank11 = 14
var bank12 = 74
var bank13 = 74

var bank21 = 45
var bank22 = 78
var bank23 = 111

var bank31 = 35
var bank32 = 75
var bank33 = 86

} else if (dataSet == 2) {

var bank11 = 34
var bank12 = 74
var bank13 = 124

var bank21 = 45
var bank22 = 38
var bank23 = 211

var bank31 = 35
var bank32 = 15
var bank33 = 86

}

$('.column1 .block1').animate({ 'height' : bank11 });
$('.column1 .block2').animate({ 'height' : bank12, 'bottom' : bank11 });
$('.column1 .block3').animate({ 'height' : bank13, 'bottom' : bank12+bank11  });

$('.column2 .block1').animate({ 'height' : bank21 });
$('.column2 .block2').animate({ 'height' : bank22, 'bottom' : bank21 });
$('.column2 .block3').animate({ 'height' : bank23, 'bottom' : bank22+bank21  });

}

var dataSet = 0;

eve.on('aw:click', function (identifier, groupKey) {

if (groupKey == 'EMEA'){
dataSet = 1;
}

if (groupKey == 'ASIA'){
dataSet = 2;
}

changeChart();

console.log('you clicked ' + identifier +', in '+ groupKey);

$('.'+groupKey).css({"background-color":'#345'});

});

});

A: hope that i'm not too late ^^'
well, after a little "inspect elements" i just added a click listener for path and then i take the id or the name or whenever....
just add :
  $('path').click(function() {
             console.log(this.id);
             //do what you want with the id, name...you can make an ajax
             call or anything you want
        });

If you want a full example there you go :
window.onload = function () {
    // Create canvas and define attributes shared by all paths.
    var R = Raphael("container", 620, 690),
      attr = {
      "fill": "#b9b9b9",
      "stroke": "#fff",
      "stroke-miterlimit": "4",
      "stroke-width": "1",
      "transform": "s0.06,0.06,60,0" // Scales the path to a useful size.
    };
    // Define map object.
    var africaMap = {};
    for (var nation in africaPaths) {
      // Draw a path, then apply attributes to it.
      africaMap[nation] = R.path(africaPaths[nation]).attr(attr);
      // Name the internal Raphael id after the africaPaths property name.
      africaMap[nation].id = nation;

      // Name the element id after the africaPaths property name.
      africaMap[nation].node.id = nation;
    }
    // For an example of interaction via Raphael, uncomment the line below.
   var demo1 = R.getById('tanzania').attr({"fill": "green"});
   $('path').click(function() {
             console.log(this.id);
             // here you do what you want ^^
        });

  };

Hope that this help someone, and sorry for my english.


text:
Q: shell script how to substitute variable contains newline $ ls . > /tmp/tfile.txt
$ flist=`cat /tmp/tfile.txt`
$ echo $flist
a.txt b.txt c.txt
$ echo ${flist#* }
a.txt b.txt c.txt

Why ${flist#* } cannot output b.txt c.txt? How to handle variables contain line breaks?

A: ${flist#* } expands like $flist but removes the smallest portion matched by *  (asterisk+space, where asterisk matches zero or more characters and space matches space character) from the beginning of it.
So, it removes characters up to and including the first space from the expansion. So in your case, it prints a.txt and then sees a space and exits, thereby not printing b.txt and c.txt.
if you put echo "${line#*.txt}", then the output will be:
b.txt c.txt

See this reference for understanding #* in bash.

A: Generally speaking the shell is not a great tool to process data and modify variable. (It is a great tool to work with Unix though, keep up learning and using it.) Some dialect can address this in some ways but it is still a good thing to keep in mind that complex data processing is better done outside the shell.
Most data processing is expected to be made with external tools rather than with shell primitives.
Here there is several ways to prune the first entry of the file you just read, the most idiosyncratic would be:
omit_first_line()
{
   tail -n+2 "$1"
}

flist=$(omit_first_line tfile.txt)

See how the $(…) are used instead of backticks, use of backticks is discouraged because they are hard to pair and to quote.
There is plenty of other tools that would skip the first line in a file for you, such as sed or awk.
If you are working on files, you really should consider using find and xargs, they work nicely together as in
find . -type f -print0 | xargs -0 stat

or
find . -type f -print | { while read filename; do printf 'Filename %s\n' "${filename}"; done }

Generally speaking, it is easier to compose filters than processing lists.  Instead of storing data in lists you would do it in a classical imperative language, store your data in files, each record on a separate line, and pipe your data between filters. If you are able to just print your data, you might not need to store in a file it at all.
Now if you have good reasons to process your list in the shell, you can use positional arguments:
gobble()
(
  set -- "$@"
  shift
  echo "$@"
)

flist='a.txt b.txt c.txt'
flist=$(gobble ${flist})
echo ${flist}

A: Many thaks for relies. Finally, I resolved this by re-assigning flist with flist=`echo $flist`;.


text:
Q: Select one product WooCommerce I am trying to create a div that shows up once I hover over an article on the archive-product.php page in WooCommerce.
Well the hovering and showing up of a div is working perfectly, but once I hover over ONE product, all divs are showing up for all the different products on the same page.
How can I make sure only the div specified with the information of the product I am hovering currently is showing up instead of all the windows.
Here is what I go so far:
<li <?php post_class( $classes ); ?>>

<?php do_action( 'woocommerce_before_shop_loop_item' ); ?>

<a href="<?php the_permalink(); ?>" class="product-images">

    <?php
        /**
         * woocommerce_before_shop_loop_item_title hook
         *
         * @hooked woocommerce_show_product_loop_sale_flash - 10
         * @hooked woocommerce_template_loop_product_thumbnail - 10
         */
        do_action( 'woocommerce_before_shop_loop_item_title' );
    ?>

        <?php
        /** this piece of code is specially ment for the pop-up to show
        *
        * @hooked will be specified later
        * @hooked will be specified later
        */
        ?>

<a href="<?php the_permalink(); ?>" class="button-in-popup">This is a test button

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

            <?php
                /**
                 * woocommerce_after_shop_loop_item_title hook
                 *
                 * @hooked woocommerce_template_loop_price - 10
                 */
                do_action( 'woocommerce_after_shop_loop_item_title' );
            ?>

<?php
    /**
     * woocommerce_after_shop_loop_item hook
     *
     * @hooked woocommerce_template_loop_add_to_cart - 10
     */
    do_action( 'Custom_edits_product_loop_bottom1' );
    do_action( 'Custom_edits_product_loop_bottom2' );
    do_action( 'Custom_edits_product_loop_bottom3' );
?>

And here the jQuery which works on it:
jQuery(document).ready(function() {

jQuery(".popup-product-custom").hide();

jQuery(".post-type-archive-product .product-type-simple, .archive.tax-product-cat .product-type-simple").hover(function() {
    jQuery(".popup-product-custom").slideToggle();
});

});
Thanks all for the help.

A: Nevermind, already figured out a good working solution.
Here are my jQuery changes:

I added the code in the header of this particular WooCommerce page, because jQuery was malfunctioning some other custom plug-ins out of WooCommerce inside WordPress.
Also added the following CSS code:
.post-type-archive-product .popup-product-custom {display: none;}

and
.archive.tax-product_cat .popup-product-custom {display: none;}

This seems to solve my problem :)


text:
Q: SQL - Updating field matching fields from 2 other tables Maybe the coffee hasn't kicked in but I'm having trouble wrapping my head around how to accomplish a SQL update. Essentially, I have 3 tables and I'm attempting to update a field in table1 with data in table2 based off criteria in table 3.
My 3 tables with sample data:
tblInvoiceDetail
keyID     InvoiceNumber      ItemID      Qty       Price
--------------------------------------------------------
1            200123          100001       4         400
2            200123          100002       1          10
3            200321          100001       1         100
4            200555          100002       2          20
5            200444          100003       4          20

tblInvoices
keyID      InvoiceNumber      InvoiceDate      CustomerID     InvoiceTotal
--------------------------------------------------------------------------
1            200123             3/15/19          456123           410
2            200321             5/31/19          123456           100
3            200555             6/30/19          111222           120
4            200444             6/31/19          111222            20

tblItemUpdate
keyID       OldItem        NewItem
----------------------------------
1           100001         999001
2           100002         999002
3           100003         999003

Here's an UPDATE statement that I tried but it would not update all the records I expected to.
UPDATE
    tblInvoiceDetail
SET
    tblInvoiceDetail.ItemID = tblItemUpdate.NewItem
FROM
    tblInvoiceDetail
INNER JOIN
    tblItemUpdate ON tblInvoiceDetail.ItemID = tblItemUpdate.OldItem
INNER JOIN
    tblInvoices ON tblInvoiceDetail.InvoiceNumber = tblInvoices.InvoiceNumber
WHERE
    tblInvoices.InvoiceDate < '2019-06-25'

I suspect the problem is in my JOINs so it is not matching all the records I'm wanting.
I want to change the ItemID in tblInvoiceDetail and I want it to find the match in tblItemUpdate.OldItem and change it to the value in tblItemUpdate.NewItem.  However, I only want to update the ItemID if tblInvoices.InvoiceDate is prior to 6/25/19.
So, with my sample data in tblInvoiceDetail, only keyIDs 1, 2, and 3 would need to be updated.
I have a lot of records in my live database so I can point to 1 particular thing that didn't work.  I just found several invoices that I thought should have changed but didn't.

A: The standard way to write this is by using subqueries:
UPDATE tblInvoiceDetail
SET ItemID = (SELECT NewItem FROM tblItemUpdate WHERE OldItem = tblInvoiceDetail.ItemID)
WHERE InvoiceNumber IN (
    SELECT id.InvoiceNumber
    FROM tblInvoiceDetail AS id INNER JOIN tblItemUpdate AS iu ON id.ItemID = iu.OldItem
    WHERE id.InvoiceDate < CAST('2019-06-25' AS DATE)
);

Ezlo already pointed out the problem when joining to the updated table created multiple rows.
EDIT:
Looking closer at your data I also see that you have a bigger problem matching up ItemIDs with the correct invoices. The primary key in tblInvoiceDetail is a compound of both InvoiceNumber and ItemID yet you don't appear to have that information in the list from tblItemUpdate.
Since your sample data includes an invalid date of June 31 it's natural to wonder if a string comparison issue is at play. The primary key issue would potentially rope in more invoices than intended so it wouldn't explain your problem described as fewer rows updating than expected.

A:
I want to change the ItemID in tblInvoiceDetail and I want it to find
  the match in tblItemUpdate.OldItem and change it to the value in
  tblItemUpdate.NewItem

So far:
UPDATE D SET
    ItemID = U.NewItem
FROM
    tblInvoiceDetail AS D
    INNER JOIN tblItemUpdate AS U ON D.ItemID = U.OldItem

However, I only want to update the ItemID if tblInvoices.InvoiceDate
  is prior to 6/25/19.

You can check for existence with EXISTS:
UPDATE D SET
    ItemID = U.NewItem
FROM
    tblInvoiceDetail AS D
    INNER JOIN tblItemUpdate AS U ON D.ItemID = U.OldItem
WHERE
    EXISTS (SELECT NULL FROM tblInvoices AS I WHERE
            I.InvoiceNumber = D.InvoiceNumber AND -- Link the invoice to update (D) to the invoice table (I)
            I.InvoiceDate < '2019-06-25')

Be careful with your InvoiceDate data type. It should be DATE (or DATETIME) and not VARCHAR, because it will be bring trouble whenever you compare it against a value otherwise ('6/25/19' and '2019-06-25' are both dates but they are completely different strings).
Also beware of the existence of multiple rows with the same OldItem value on tblItemUpdate, as you might be joining a particular row from tblInvoiceDetail against N from the tblItemUpdate in which case the final NewItem value that will be updated is indetermined.


text:
Q: How can you make SonarQube version 5.2 fail a Jenkins Build? Version of SonarQube = 5.2
So I noticed that my application was failing a quality gate in sonar but the build was still going green.
I googled how to make sonar fail the build and got results for a plugin called "build breaker" which has been depreciated for the version I'm using (http://docs.sonarqube.org/display/PLUG/Build+Breaker+Plugin). I cant find information on how to achieve the same build breaking behaviour in this version.
I cant seen any Jenkins plugin options that achieve this build breaking functionality ether.
Any help with this would be greatly appreciated!
Could I also suggest that someone with reputation over 1500 create a new tag for this version of sonarqube (sonarqube5.2).

A: There is no direct functionality in 5.2, either built-in or via plugins, to allow this, but it can be accomplished via web serivces, but

*

*You'll have to implement your own Jenkins plugin (or a complicated scripting step) to do it.

*In 5.2 the security implications are unattractive. They're better in 5.3

To roll your own
Take a look at the end of your analysis log. You'll see it includes a line like
[INFO] More about the report processing at http://your.sonarqube.server/api/ce/task?id=[guid]

Check the "sonar" directory created during analysis for a report-task.txt file to pick up that guid; it's the ceTaskId value.
In 5.2 If you have global admin perms you can click-through on that link to get the current processing status of the analysis report. In 5.3 you only need execute analysis perms. A "done" report looks like this:

{"task":{"id":"AVExRaJddM_jFJ3_Fp09","type":"REPORT","componentId":"c81cfb77-7bb8-4ea6-ac84-dfee43b43b99","componentKey":"org.apache.asyncweb:asyncweb-parent","componentName":"Apache
  Asyncweb
  Parent","componentQualifier":"TRK","status":"SUCCESS","submittedAt":"2015-11-22T23:17:05+0100","submitterLogin":"XXXX","startedAt":"2015-11-22T23:17:07+0100","executedAt":"2015-11-22T23:17:15+0100","executionTimeMs":7677,"logs":true}}

Once you get to status SUCCESS, you could then use web services to query the project's quality gate status.
So it's doable, but in 5.2 only if you want to configure a global-admin-level user's credentials to do it with. In 5.3 it gets better.
Edit for 6.2
6.2 adds webhooks. You can configure up to 10 global and up to 10 project-level URLs to be POSTed to after analysis report processing is complete. The post body is a JSON payload that includes project identifiers, and quality gate status.

A: A quick workaround, add a post step Execute shell script :
if [ "\`curl -sL -w %{http_code} http://sonar_host/api/qualitygates/project_status?projectKey=project_key -o /dev/null -S --quiet 2>&1 | jsawk -a 'return this.status'\`" == "ERROR" ];
then
  exit 1;
fi;

A: You can use Jenkins' Quality Gates plugin for it.
It will provide you 'Quality Gates' as a post-build option. You should then just fill in your project key from SonarQube. Remember, it will fail your Jenkins job both in cases of warning or failure on your quality gate.

A: An even quicker workaround, with only the native shell tools (jsawk must be installed extra)
#!/bin/bash
CURL='/usr/bin/curl'
RVMHTTP="http://sonar:9000/sonar/api/qualitygates/project_status?projectKey=PROJECTKEY"
CURLARGS="-u mysonaruser:mysonarpass"

# you can store the result in a variable
raw="$($CURL $CURLARGS $RVMHTTP)"

if [[ $raw = *"\"status\":\"ERROR\""* ]]; then
  exit 1
else
  exit 0
fi

The PROJECTKEY your can find out via
curl -u mysonaruser:mysonarpass http://sonar:9000/sonar/api/projects/index"

A: I'm using pipeline and I'm checking sonar in a separate stage as follows:
import groovy.json.JsonSlurperClassic

pipeline {
....
stage('Check Sonar') {
            steps {
                withMaven(maven: 'maven-3.3.9') {
                    withSonarQubeEnv('SonarQube') {
                        sh 'mvn clean install sonar:sonar -Dsonar.scm.disabled=true -Dsonar.host.url=$SONAR_HOST_URL'
                    }
                }
                timeout(1) {
                    waitUntil {
                        script {
                            fileExists('target/sonar/report-task.txt')
                        }
                    }
                    waitUntil {
                        script {
                            def taskId = readFile('target/sonar/report-task.txt').split("\n")[3].split("=")[1]
                            def task_response = httpRequest "https://sonarUrl.com/api/ce/task?id=${taskId}"
                            def task_data = new JsonSlurperClassic().parseText(task_response.content)
                            return (task_data.task.status.equals("SUCCESS"))
                        }
                    }
                }
                script {
                    def response = httpRequest "https://sonarUrl.com/api/qualitygates/project_status?projectKey=XXX"
                    def data = new JsonSlurperClassic().parseText(response.content)
                    if (data.projectStatus.status == "ERROR") {
                        error("Sonar Quality Gate not met. Check https://sonarUrl.com/overview?id=XXX")
                    }
                }
            }
        }

A: I was also facing this issue, we dont use Jenkins Pipeline jobs so using below stage was not an option for me
stage("Quality gate") {
            steps {
                waitForQualityGate abortPipeline: true
            }
        }

And I didn't want to use some custom shell script execution to check using Sonar WEB APIs as its not standard, plus I then had to configure this in multiple jobs and in future for any new Job this has to be remembered so kind of not scalable solution in my opinion.
So, I explored Jenkins plugins to solve the problem. There are few like below however both have known vulnerability of Credentials Transmitting in plain text.

*

*https://plugins.jenkins.io/sonar-quality-gates/

*https://plugins.jenkins.io/quality-gates/
So, further more analysis and I found the right way of doing it. There is a BuildBreaker plugin from SonarQube itself. Read more about this @ https://github.com/adnovum/sonar-build-breaker
This can be installed from the SonarQube market place

Once you opt to install, it will be downloaded and shown as Installation Pending as the installation would reflect on the restart of SonarQube Server
So, you have to connect to SonarQube Server and Restart the Server.
Once done it will by default break the Jenkins build with errors similar to below
10:43:54 INFO: Executing post-job 'Forbidden Configuration Breaker'
10:43:54 INFO: Executing post-job 'Quality Gate Breaker'
10:43:54 INFO: Waiting for report processing to complete...
10:44:04 INFO: Quality gate status: ERROR
10:44:04 ERROR: Reliability Rating on New Code: 3 > 1
10:44:04 ERROR: [BUILD BREAKER] Project did not meet 1 conditions
10:44:05 INFO: ------------------------------------------------------------------------
10:44:05 INFO: EXECUTION FAILURE
10:44:05 INFO: ------------------------------------------------------------------------
10:44:05 INFO: Total time: 59.701s
10:44:05 INFO: Final Memory: 86M/2627M
10:44:05 INFO: ------------------------------------------------------------------------
10:44:05 ERROR: Error during SonarQube Scanner execution
10:44:05 java.lang.IllegalStateException: Project does not pass the quality gate.

Good part is, this behaviour can be controlled by a config which goes in sonar-project.properties. If this is set to true then the build will not break. By default the build will break
sonar.buildbreaker.skip=true

So, this way is more configurable, generic and useful.


text:
Q: Hide shipping method in woocommerce if custom checkbox field is selected
So, i'm trying to hide a shipping method when a custom checkout checkbox field is checked.
The custom checkbox field is "**enabledropshipping**" and the custom shipping method i need to hide is "**shipping_method_0_flat_rate1**".
function conditionaly_hide_shipping_method( $available_methods ) {
$post_data = urldecode($_POST['post_data']);
$post_data_arr = is_string($post_data) ? explode("&", $post_data) : array();
$field_value= '';
foreach ($post_data_arr as $value) {
$value_arr = is_string($value) ? explode("=", $value) : array();
if(isset($value_arr[0]) && $value_arr[0] === 'enabledropshipping'){
$field_value = isset($value_arr[1]) ? $value_arr[1] : '';
}
}
if(is_array($available_methods) && $field_value === 'shipping_method_0_flat_rate1'){
unset( $available_methods['shipping_method_0_flat_rate1'] );
}
return $available_methods;
}
add_filter( 'woocommerce_shipping_methods', 'conditionaly_hide_shipping_method' , 10, 1 );


text:
Q: Greiner Field Quantization Mistake in Path Integral proof? I have absolutely no clue how Greiner finds that the last 3 lines (eq. 17 in my picture) are zero. He somehow substitutes for $(q'-q)/2$ a momentum space position operator, and then he acts the two operators (on the last line in my picture) on the function to the right and gets zero (which clearly isn't the case since the chain rule gives a factor of one half for the partial derivative wrt $q'$). If someone could please explain how this expression simplifies to zero that would be great.

A: Indeed, there's a factor ${1 \over 2}$ missing going from first line to second line of $(17)$. If you restore it, you then apply both derivatives and see that it gives zero. The way you get the differential operator to appear is precisely to notice that acting with it on the left gives the previous expression. Once you have the derivatives you can then integrate by parts to act on the right and conclude that it's zero.


text:
Q: How can I get cookie in Laravel? The title of my question seems duplicate, but it isn't. I've tested all existing approaches in the internet.
Here is my code:
dd($request->cookie('guarantee_ticket'));
// I also have tested this: dd(Cookie::get('guarantee_ticket'));

And the result is null, while that cookie is exists in the browser. I can see it:

Any idea how can I get the value of that cookie?

A: Here, I'm mention set and get a cookie in laravel simple example following.
First of the create a controller.
1.php artisan make:controller CookieController
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class CookieController extends Controller {

  **/* below code a set a cookie in browser */**
   public function setCookie(Request $request){
      $response = new Response('Hello World');
      $response->withCookie(cookie('name', 'Anything else'));
      return $response;
   }
  **/* below code a get a cookie in browser */**
   public function getCookie(Request $request){
      $value = $request->cookie('name');
      echo $value;
   }
}

1. Add a follwing line code in routes/web.php file (Laravel 5.4)
Route::get('/cookie/set','CookieController@setCookie');

Route::get('/cookie/get','CookieController@getCookie');

And all files add-in project than a run program easily gets a cookie.


text:
Q: Getting return value from stored procedure - C# Here is my stored procedure:
ALTER proc [Core].[up_ExternalTradeInsert]
@ExecID char(16),
@SecondaryExecID char(16),
@SecurityID int,
@SecurityIDSource int,
@LastQty int,
@LastPx decimal(12, 6),
@TransactTime datetime2(3),
@Side bit, --0 Sell 1-Buy
@OrderID char(16),
@ClOrdID char(20),
@Account int,
@SenderId int
as
begin
set nocount on

insert Core.ExternalTrade(ExecID, SecondaryExecID, SecurityID, SecurityIDSource, LastQty, LastPx, TransactTime, Side, OrderID, ClOrdID, Account)
values (@ExecID, @SecondaryExecID, @SecurityID, @SecurityIDSource, @LastQty, @LastPx, @TransactTime, @Side, @OrderID, @ClOrdID, @Account)

return @@rowcount
end

And here is how I call the sp from c#:
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["Connection"]))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("Core.up_ExternalTradeInsert", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@ExecID", execID));
                cmd.Parameters.Add(new SqlParameter("@SecondaryExecID", secondaryExecID));
                cmd.Parameters.Add(new SqlParameter("@SecurityID", securityID));
                cmd.Parameters.Add(new SqlParameter("@SecurityIDSource", securityIDSource));
                cmd.Parameters.Add(new SqlParameter("@LastQty", lastQty));
                cmd.Parameters.Add(new SqlParameter("@LastPx", lastPx));
                cmd.Parameters.Add(new SqlParameter("@TransactTime", transactTime));
                cmd.Parameters.Add(new SqlParameter("@Side", side));
                cmd.Parameters.Add(new SqlParameter("@OrderID", orderID));
                cmd.Parameters.Add(new SqlParameter("@ClOrdID", clOrdID));
                cmd.Parameters.Add(new SqlParameter("@Account", account));
                cmd.Parameters.Add(new SqlParameter("@SenderId", senderId));

                int result = cmd.ExecuteNonQuery();//.ExecuteNonQuery();
            }

The value ogf result variable is always -1, but I see that sql statement works great. When I execute the sp in MSSQl Management Studio, I see the return value as 1. Why? What am I doing wrong? I have to get the true return value from the the stored procedure.
Thanks,

A: ExecuteNonQuery returns number of rows affected, but only for 3 types of operations:

For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.

Since stored procedure execution is neither of these, you are always getting -1. To get the result of your stored procedure, I believe you need to call ExecuteScalar.

A: Expanding on what Andrei has said you should really use an OUTPUT parameter to see the number of rows affected, return value is only used to see the success/failure of the operation:
A stored procedure with an output parameter would look something like....
ALTER proc [Core].[up_ExternalTradeInsert]
@ExecID char(16),
@SecondaryExecID char(16),
@SecurityID int,
@SecurityIDSource int,
@LastQty int,
@LastPx decimal(12, 6),
@TransactTime datetime2(3),
@Side bit, --0 Sell 1-Buy
@OrderID char(16),
@ClOrdID char(20),
@Account int,
@SenderId int,
@RowCount INT OUTPUT
as
begin
set nocount on

insert Core.ExternalTrade(ExecID, SecondaryExecID, SecurityID, SecurityIDSource, LastQty, LastPx, TransactTime, Side, OrderID, ClOrdID, Account)
values (@ExecID, @SecondaryExecID, @SecurityID, @SecurityIDSource, @LastQty, @LastPx, @TransactTime, @Side, @OrderID, @ClOrdID, @Account)

  SET @RowCount =  @@rowcount;
end

And you C# code would look something like.....
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["Connection"]))
{
    conn.Open();
    SqlCommand cmd = new SqlCommand("Core.up_ExternalTradeInsert", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add("@RowCount", SqlDbType.Int).Direction = ParameterDirection.Output;
    cmd.Parameters.Add(new SqlParameter("@ExecID", execID));
    cmd.Parameters.Add(new SqlParameter("@SecondaryExecID", secondaryExecID));
    cmd.Parameters.Add(new SqlParameter("@SecurityID", securityID));
    cmd.Parameters.Add(new SqlParameter("@SecurityIDSource", securityIDSource));
    cmd.Parameters.Add(new SqlParameter("@LastQty", lastQty));
    cmd.Parameters.Add(new SqlParameter("@LastPx", lastPx));
    cmd.Parameters.Add(new SqlParameter("@TransactTime", transactTime));
    cmd.Parameters.Add(new SqlParameter("@Side", side));
    cmd.Parameters.Add(new SqlParameter("@OrderID", orderID));
    cmd.Parameters.Add(new SqlParameter("@ClOrdID", clOrdID));
    cmd.Parameters.Add(new SqlParameter("@Account", account));
    cmd.Parameters.Add(new SqlParameter("@SenderId", senderId));

    cmd.ExecuteNonQuery();//.ExecuteNonQuery();
    int RowsAffected = Convert.ToInt32(cmd.Parameters["@RowCount"].Value);
}

A: You can add a parameter with whatever name you want to give it and a Direction of ParameterDirection.ReturnValue to get the return value from your stored procedure.
Here is a sample PROC in a database named AdHoc:
CREATE PROCEDURE [dbo].[TestProc]
    @InputParam int
AS
BEGIN
    return @InputParam * 2
END

And here is a C# snippet that you can execute in LINQPad to test it:
using (var conn = new SqlConnection(@"Data Source=(local);Initial Catalog=AdHoc;Integrated Security=SSPI")) {
    conn.Open();

    var cmd = new SqlCommand("TestProc", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddWithValue("@InputParam", 21);
    cmd.Parameters.Add("@RetVal", SqlDbType.Int).Direction = ParameterDirection.ReturnValue;

    cmd.Parameters.Dump();

    cmd.ExecuteNonQuery();

    cmd.Parameters.Dump();
}


text:
Q: Composition in Laravel 5.2? Possible? Recommended? I'm about to start a Laravel project and I have doubts about how I should go about it. First of all, I'll have two types of users, the common user, and the admin. I have searched a bit and found out that having two tables is the best solution in my case. Because common users will have all the columns the admins have plus a few more.
I'll create a users_table and a common_users_table. The admins will have their data on the users_table and the common users will have their data spread across both of the tables, with a foreign key on the common_users_table referencing the users_table. This way no columns will be unused.
My problem is, I'm not sure how to accomplish that in Laravel. Should I create only 1 model? Maybe 2 models with a hasOne and belongsTo relationship? But when I make the registration forms, how will I register 2 models at once? What about authentication? There are so many things that I simply don't have the experience in Laravel to determine what is better in the long run.
So, if you are more experienced in Laravel and/or have faced a problem like this before, what is the best way to tackle this problem?
Thanks in advance.

A: Look into something like laravel's ACL and the Guards, as this would be a good thing to do: ACL in Laravel, so this would give you users and permissions,
There are also some nice little packages you could leverage.
Sorry, the link above you might need a subscription to watch, but the terms might be a good starter as well as the site for also help on the ACL stuff


text:
Q: How to compare data frame values to column names and set to NA for multiple columns I have a data frame that looks like this:
   YEAR X1990_lu X2000_lu X2010_lu     soil    water
1  1990 215.0310 215.0310 215.0310 3.588198 5.287578
2  2007 415.3221 415.3221 415.3221 8.094746 5.788305
3  1994 263.5908 263.5908 263.5908 4.680792 5.408977
4  2010 453.2070 453.2070 453.2070 8.947157 5.883017
5  2012 476.1869 476.1869 476.1869 9.464206 5.940467
6  1981 118.2226 118.2226 118.2226 1.410008 5.045556
7  1998 311.2422 311.2422 311.2422 5.752949 5.528105
8  2011 456.9676 456.9676 456.9676 9.031771 5.892419
9  1999 320.5740 320.5740 320.5740 5.962915 5.551435
10 1995 282.6459 282.6459 282.6459 5.109533 5.456615
11 2013 482.7333 482.7333 482.7333 9.611500 5.956833
12 1995 281.3337 281.3337 281.3337 5.080007 5.453334
13 2003 371.0283 371.0283 371.0283 7.098136 5.677571
14 2000 329.0534 329.0534 329.0534 6.153701 5.572633
15 1983 141.1699 141.1699 141.1699 1.926322 5.102925

I need to set any column with _lu in the name to NA if the corresponding numeric part of the column name is greater than the value of YEAR for that row. I can do this for each individual column using the code below, where I extract the numeric part of the _lu column names and make a numeric vector to compare to YEAR. But, can this be done for all the columns by using apply or possibly map statements?
## make example data
set.seed(123)
soil <- runif(15,1,10)
set.seed(123)
water <- runif(15,5,6)
set.seed(123)
X1990_lu <- runif(15,100,500)
set.seed(123)
X2000_lu <- runif(15,100,500)
set.seed(123)
X2010_lu <- runif(15,100,500)
set.seed(123)
YEAR <- as.integer(runif(15,1980,2015))

data <- data.frame(YEAR, X1990_lu, X2000_lu, X2010_lu, soil, water)

# extract the column indices of the landuse columns
lucolsind <- grep("_lu", names(data))
# remove the x from each landuse column name
colnames(data)[lucolsind] <- substring(names(data[,lucolsind]), 2)
# get the column names
lucolnms <- names(data[,lucolsind])
# get the column names as a split list
lucolnms_lst <- strsplit(names(data[,lucolsind]), c("_"))
# extract just the year indicator
luyears <- unlist(lapply(lucolnms_lst, `[[`, 1))

# set the first LU column to NA where year is less than the lu year
data[,lucolsind[1]] <- ifelse(data$YEAR < luyears[1], NA, data[,lucolsind[1]])

Here is how it looks after processing just the first _lu column
   YEAR  1990_lu  2000_lu  2010_lu     soil    water
1  1990 215.0310 215.0310 215.0310 3.588198 5.287578
2  2007 415.3221 415.3221 415.3221 8.094746 5.788305
3  1994 263.5908 263.5908 263.5908 4.680792 5.408977
4  2010 453.2070 453.2070 453.2070 8.947157 5.883017
5  2012 476.1869 476.1869 476.1869 9.464206 5.940467
6  1981       NA 118.2226 118.2226 1.410008 5.045556
7  1998 311.2422 311.2422 311.2422 5.752949 5.528105
8  2011 456.9676 456.9676 456.9676 9.031771 5.892419
9  1999 320.5740 320.5740 320.5740 5.962915 5.551435
10 1995 282.6459 282.6459 282.6459 5.109533 5.456615
11 2013 482.7333 482.7333 482.7333 9.611500 5.956833
12 1995 281.3337 281.3337 281.3337 5.080007 5.453334
13 2003 371.0283 371.0283 371.0283 7.098136 5.677571
14 2000 329.0534 329.0534 329.0534 6.153701 5.572633
15 1983       NA 141.1699 141.1699 1.926322 5.102925

A: An option is to use sapply on column's ending with _lu. This can be achieved as:
df[,grepl("_lu$",names(df))] <-
  sapply(grep("_lu$",names(df), value = TRUE), function(x){
  # Convert column names to numeric and compare with YEAR value of that row
  x = ifelse(df$YEAR < as.numeric(gsub("X(\\d+)_lu","\\1",x)), NA, df[,x])
  x
})

df
#    YEAR X1990_lu X2000_lu X2010_lu     soil    water
# 1  1990 215.0310       NA       NA 3.588198 5.287578
# 2  2007 415.3221 415.3221       NA 8.094746 5.788305
# 3  1994 263.5908       NA       NA 4.680792 5.408977
# 4  2010 453.2070 453.2070 453.2070 8.947157 5.883017
# 5  2012 476.1869 476.1869 476.1869 9.464206 5.940467
# 6  1981       NA       NA       NA 1.410008 5.045556
# 7  1998 311.2422       NA       NA 5.752949 5.528105
# 8  2011 456.9676 456.9676 456.9676 9.031771 5.892419
# 9  1999 320.5740       NA       NA 5.962915 5.551435
# 10 1995 282.6459       NA       NA 5.109533 5.456615
# 11 2013 482.7333 482.7333 482.7333 9.611500 5.956833
# 12 1995 281.3337       NA       NA 5.080007 5.453334
# 13 2003 371.0283 371.0283       NA 7.098136 5.677571
# 14 2000 329.0534 329.0534       NA 6.153701 5.572633
# 15 1983       NA       NA       NA 1.926322 5.102925

Data:
df <- read.table(text =
"   YEAR X1990_lu X2000_lu X2010_lu     soil    water
1  1990 215.0310 215.0310 215.0310 3.588198 5.287578
2  2007 415.3221 415.3221 415.3221 8.094746 5.788305
3  1994 263.5908 263.5908 263.5908 4.680792 5.408977
4  2010 453.2070 453.2070 453.2070 8.947157 5.883017
5  2012 476.1869 476.1869 476.1869 9.464206 5.940467
6  1981 118.2226 118.2226 118.2226 1.410008 5.045556
7  1998 311.2422 311.2422 311.2422 5.752949 5.528105
8  2011 456.9676 456.9676 456.9676 9.031771 5.892419
9  1999 320.5740 320.5740 320.5740 5.962915 5.551435
10 1995 282.6459 282.6459 282.6459 5.109533 5.456615
11 2013 482.7333 482.7333 482.7333 9.611500 5.956833
12 1995 281.3337 281.3337 281.3337 5.080007 5.453334
13 2003 371.0283 371.0283 371.0283 7.098136 5.677571
14 2000 329.0534 329.0534 329.0534 6.153701 5.572633
15 1983 141.1699 141.1699 141.1699 1.926322 5.102925",
header = TRUE, stringsAsFactors = FALSE)

A: A 'tidyverse' approach that uses reshaping in order to compare the values of interest with the corresponding date in the column name row by row:
dt = read.table(text = "
YEAR X1990_lu X2000_lu X2010_lu     soil    water
1  1990 215.0310 215.0310 215.0310 3.588198 5.287578
2  2007 415.3221 415.3221 415.3221 8.094746 5.788305
3  1994 263.5908 263.5908 263.5908 4.680792 5.408977
4  2010 453.2070 453.2070 453.2070 8.947157 5.883017
5  2012 476.1869 476.1869 476.1869 9.464206 5.940467
6  1981 118.2226 118.2226 118.2226 1.410008 5.045556
7  1998 311.2422 311.2422 311.2422 5.752949 5.528105
8  2011 456.9676 456.9676 456.9676 9.031771 5.892419
9  1999 320.5740 320.5740 320.5740 5.962915 5.551435
10 1995 282.6459 282.6459 282.6459 5.109533 5.456615
11 2013 482.7333 482.7333 482.7333 9.611500 5.956833
12 1995 281.3337 281.3337 281.3337 5.080007 5.453334
13 2003 371.0283 371.0283 371.0283 7.098136 5.677571
14 2000 329.0534 329.0534 329.0534 6.153701 5.572633
15 1983 141.1699 141.1699 141.1699 1.926322 5.102925
", header=T)

library(tidyverse)

dt %>%
  gather(var,value,-YEAR) %>%
  mutate(value = ifelse(YEAR < as.numeric(gsub("\\D", "", var)) & !is.na(as.numeric(gsub("\\D", "", var))), NA, value)) %>%
  group_by(YEAR, var) %>%
  mutate(id = row_number()) %>%
  spread(var, value) %>%
  select(-id) %>%
  ungroup()

# # A tibble: 15 x 6
#   YEAR  soil water X1990_lu X2000_lu X2010_lu
#  <int> <dbl> <dbl>    <dbl>    <dbl>    <dbl>
# 1  1981  1.41  5.05      NA       NA       NA
# 2  1983  1.93  5.10      NA       NA       NA
# 3  1990  3.59  5.29     215.      NA       NA
# 4  1994  4.68  5.41     264.      NA       NA
# 5  1995  5.11  5.46     283.      NA       NA
# 6  1995  5.08  5.45     281.      NA       NA
# 7  1998  5.75  5.53     311.      NA       NA
# 8  1999  5.96  5.55     321.      NA       NA
# 9  2000  6.15  5.57     329.     329.      NA
# 10  2003  7.10  5.68     371.     371.      NA
# 11  2007  8.09  5.79     415.     415.      NA
# 12  2010  8.95  5.88     453.     453.     453.
# 13  2011  9.03  5.89     457.     457.     457.
# 14  2012  9.46  5.94     476.     476.     476.
# 15  2013  9.61  5.96     483.     483.     483.


text:
Q: using Python2 library in Python3/Django1.8 web app I'm trying to use this SDK/API, but it's built for Python2 and I'm working in a Django 1.8.8 / Python 3.5.1 site. I'm sure I could trigger a Python2 script from Python3-Django, but is it safe to pass secure, web-submitted information to it? Is there a better way to handle this altogether?
I can't find anything about SecureSubmit in StackExchange, even though it seems to be huge, and I'm not finding much on using mixed Python (Python2 + Python3) libraries at all...
Heartland has been around awhile and their SecureSubmit service has APIs for many languages (PHP, .Net, Java, Ruby, Python and nodeJS). If it's better to integrate one of those with my Django site rather than launch a Python2 script, let me know! (I've contacted Heartland, too, but who knows when I'll get a response...)
Thanks!

A: I think it's great you grasped the nettle, I am sure all who use your work will appreciate the ability to use python 3 with this. I am happy to have inspired you to try.


text:
Q: Spring tries to deserialize to LinkedHashMap instead of POJO I'm creating a simple rest controller with Spring Boot and the Web dependency. I'm trying to deserialize a JSON body to a test POJO with only 3 fields, but when I attempt to make a POST request, the server responds with a 500 error and the error I get in the console is:
.w.s.m.s.DefaultHandlerExceptionResolver : Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class java.util.LinkedHashMap

All of the code I have written is as follows:
EmailApplication.java:
package com.test.email.app;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan(basePackages = { "com.test.email" })
public class EmailApplication {

    public static void main(String[] args) {
        SpringApplication.run(EmailApplication.class, args);
    }

    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
        return args -> {
            System.out.println("----- You're up and running with test-email-app! -----");
        };
    }
}

EmailController.java:
package com.test.email.controller;

import com.test.email.entity.TestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;

import java.net.URI;

@RestController
public class EmailController {
    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String index() {
        TestEntity entity = new TestEntity();
        return "test-email-app index";
    }

    @RequestMapping(value = "/poster", method = RequestMethod.POST)
    public ResponseEntity<String> poster(@RequestBody TestEntity testEntity) {
        URI location = URI.create("/poster");
        return ResponseEntity.created(location).body(testEntity.getUrl());
    }
}

TestEntity.java
package com.test.email.entity;

/**
 * An entity for serialization/deserialization testing
 */
public class TestEntity {
    public String url;
    public int count;
    public double height;

    public TestEntity() {}

    public TestEntity(String url, int count, double height) {
        this.url = url;
        this.count = count;
        this.height = height;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }
}

I'm making a POST request with Postman using only the header Content-Type: application/json and with the body:
{ "url": "http://google.com", "count": 3, "height": 2.4 }

I don't know why Spring can't convert from a LinkedHashMap to my POJO. Any help would be appreciated.
Edit:
My pom.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.test.email</groupId>
    <artifactId>test-email-app</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>test-email-app</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

A: After Analyzing your problem, I found some cases where this issue can arise.
Those are given bellow:

*

*Inner Class:

If your class TestEntity is Inner class of your endpoint.
Just transfer your TestEntity from Inner class to a separate class and run your code, it will work.

*Support Inner Class:

If you want to support inner class a RequestBody then make  TestEntity class as static, this will solve your problem.

*Spring dependency configuration:

If still not solved your problem, check your dependency on pom.xml. May be you are not adding dependency on proper way. For this you can view this answer . Or you can add jackson explicitly in your pom.xml file.
Dependencies are:
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.4.3</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.4.3</version>
</dependency>

Hope this will solve your problem :)
If still not solved your problem, check some youtube video or some blog site or download some open-source project from github.
Thanks :)
Related links:
Spring @Requestbody not mapping to inner class

A: Try to specify that your method consumes JSON. Change your annotation:
@RequestMapping(value = "/poster", method = RequestMethod.POST)
to
@PostMapping(value = "/poster",
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,
            produces = MediaType.TEXT_HTML)

The main part here that you specify that you accept your input to be JSON. Not sure what type you return but you can specify the appropriate type or remove the "produces" part. The main part is to specify what your input is

A: Ideally this code should work but give a try by adding below dependency in pom.xml
<dependency>
   <groupId>com.fasterxml.jackson.core</groupId>
   <artifactId>jackson-databind</artifactId>
   <version>2.5.0</version>
</dependency>


text:
Q: Show that that the ring $\mathbb{Z}_n$ need not have the property $a^2 \equiv a$ implies $a \equiv 0 \pmod{n}$ or $a \equiv 1 \pmod{n}$ Find an integer n that shows that the ring $\mathbb{Z}_n$ need not have the following property
$a^2 = a$ implies $a \equiv 0 \pmod{n}$ or $a \equiv 1 \pmod{n}$.
This is my proof:
We will use $n=6$ for all of these. Namely, consider $\mathbb{Z}_6 = \{0, 1, 2, 3, 4, 5\}$.
Recall that to prove that an implication "$P$ implies $Q$" fails, we need to find an example where $P$ is true and $Q$ is false. Consider $a=3$. Then $a^2 = 9 \pmod{6} \equiv 3 \equiv a$ but $3\not\equiv 0$ and $3\not \equiv 1$.
I was wondering if anybody can check my proof and see if it is correct. Thank you for your time it is greatly appreciated.

A: Your proof is correct. Notice that the property
$$a^2 = a \implies a = 0 \vee a=1$$
is true in any integral domain. In order to prove that it is false in some $\mathbb{Z}_n$ you correctly used $\mathbb{Z}_6$, which is not a domain: indeed, you found an element $a$ which is a zero divisor.

A: Your proof is correct. Viewed via CRT we see that $\,3\,$ maps to $\,(1,0)\,$ mod $\,(2,3),\,$ and clearly $\,(1,0)^2 = (1,0)\,$ is idempotent. Generally the same idea works for any composite modulus that is not a prime power, since it can be split into coprime factors $\,mn,\,$ so by CRT we can solve for $\,x\equiv (1,0)\,$ mod $ m,n\,$ to get an idempotent that's nontrivial, i.e. not $ (0,0)$ or $(1,1)$, i.e not $0$ or $1$. If you study ring theory then this will shed more light one why such idempotents are intimately connected to such (coprime) factorizations (Peirce decomposition), e.g. see here and its links.

A: To expand on Bill Dubuque's response, I'll point out that you're looking for idempotents ($a^2=a$) in a ring $R$. Any time that $R=R_1\oplus R_2\oplus\cdots\oplus R_n$, that's the ring-direct sum of the separate rings $R_i$, where you have coordinatewise addition and multiplication, any vector $(a_1,\cdots,a_n)$ in which all the $a_i$ are either zero or $1$ will be an idempotent. By Chinese Remainder Theorem, $\Bbb Z/(n)$ is the ring-direct sum of the $\Bbb Z/(p_i^{e_i})$, where $p_1^{e_1}\cdots p_n^{e_n}$ is the prime factorization of $n$. So $6$ is the first value of $n$ that gives an example.


text:
Q: Functional extrema and the Euler-Lagrange equation For a functional of the form:
$$S(q)=\int_{t_{1}}^{t_{2}}L(q,\dot{q})dt,\tag{1}$$
where $\dot{q}=\frac{\partial q}{\partial t}$, one finds that extrema are reached (to first order) for the condition:
$$0=S(q+\delta q)-S(q)=\int_{t_{1}}^{t_{2}}dt(\frac{dL(q,\dot{q})}{dq}-\frac{\partial}{\partial t}\frac{\partial L(q,\dot{q})}{\partial\dot{q}})\delta q(t).\tag{2}$$
Then it's simply stated that:
$$0=\frac{dL(q,\dot{q})}{dq}-\frac{\partial}{\partial t}\frac{\partial L(q,\dot{q})}{\partial\dot{q}}.\tag{3}$$
I could be wrong, but it seems like the integral form yields a more general set of solutions than the lattermost equation? In the particular problem I'm working on, the domain of integration is a compact space such that $t_{1}=t_{2}$, lets just say it's over a circle of some radius $R$. Then especially here, won't these two equations diverge in their solutions? Maybe I'm missing something.

A: *

*Euler-Lagrange (EL) equation (3) is a necessary condition for a stationary path for the functional $S$. This follows from localization, i.e. the fundamental lemma of calculus of variations. In particular, eq. (2) does not lead to more stationary solutions than eq. (3), as OP seems to ponder.

*OP does not mention any boundary conditions (BCs). BCs are usually needed to have a well-posed variational problem. E.g. typically for a problem where the independent variable $t$ is 1D, and where the Lagrangian $L$ depends on first-order derivatives, the EL eq. (3) becomes a 2nd-order ODE, and two BCs are often needed.

*For the periodic case that OP mentions, the solution should be periodic. The periodicity condition corresponds effectively to one BC, i.e. we are one BC short compared to the above counting.