text:
Q: How to tidy exported html file's source code? Using VBA, I export an Excel spreadsheet as a web page.
The source code of the exported html file is quite messed up. There are multiple line breaks in between. For eg:
 Select X
  and Y
Hello World
 and my country

How can I tidy up the html source code, like:
Select X and Y
Hello World and my country

A: This might help or simply CTRL + H then search <*> and replace with " " (blank)
:
'PURPOSE: Find & Replace a list of text/values throughout entire workbook from a table
'SOURCE: www.TheSpreadsheetGuru.com/the-code-vault, I used
 to
 in the table
Dim sht As Worksheet
Dim fndList As Integer
Dim rplcList As Integer
Dim tbl As ListObject
Dim myArray As Variant

'Create variable to point to your table
  Set tbl = Worksheets("Sheet1").ListObjects("Table1")

'Create an Array out of the Table's Data
  Set TempArray = tbl.DataBodyRange
  myArray = Application.Transpose(TempArray)

'Designate Columns for Find/Replace data
  fndList = 1
  rplcList = 2

'Loop through each item in Array lists
  For x = LBound(myArray, 1) To UBound(myArray, 2)
    'Loop through each worksheet in ActiveWorkbook (skip sheet with table in it)
      For Each sht In ActiveWorkbook.Worksheets
        If sht.Name <> tbl.Parent.Name Then

          sht.Cells.Replace What:=myArray(fndList, x), Replacement:=myArray(rplcList, x), _
            LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
            SearchFormat:=False, ReplaceFormat:=False

        End If
      Next sht
  Next x

End Sub


text:
Q: Color the space under the ploted line in a pgfplot I have plotted some values on a pgfplot and I wish to color in red the part under the line. Some suggestion about a package or what I need to look into would be great. In this case googling it did not help me too much
My graph:

my code:
\documentclass{article}

\begin{document}
\usepackage{pgfplots}
\usetikzlibrary{datavisualization}
\usepackage{tikz}
\begin{tikzpicture}
\datavisualization [school book axes, visualize as smooth line]
    data {
       x, y
    -1.9,0.001
-1.8,0.001
-1.7,0.002
-1.6,0.001
-1.5,0.01
-1.4,0.004
-1.3,0.005
-1.2,0.008
-1.1,0.01
-1,0.014
-0.9,0.029
-0.8,0.037
-0.7,0.056
-0.6,0.119
-0.5,0.187
-0.4,0.391
-0.3,0.667
-0.2,1.062
-0.1,1.648
0,2.418
0.1,2.454
0.2,1.829
0.3,1.243
0.4,0.809
0.5,0.537
0.6,0.319
0.7,0.178
0.8,0.101
0.9,0.06
1,0.035
1.1,0.019
1.2,0.018
1.3,0.014
1.4,0.019
1.5,0.004
1.6,0.004
1.7,0.002
1.8,0.003
1.9,0.001
2,0.003
2.1,0.001
2.2,0.002
2.3,0.001
2.4,0.001
};
\end{tikzpicture}

\end{document}

I want it to look something like this:

A: This can be done using e.g. PGFPlots fillbetween library. Please also have a look at the corresponding section in the PGFPlots manual or at other questions here on TeX.SX with the tag fillbetween.
% used PGFPlots v1.16
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
    \usepgfplotslibrary{fillbetween}
    \pgfplotsset{
        /pgf/declare function={
            % normal distribution where \mean = mean and \stddev = sd}
            gauss(\mean,\stddev) = 1/sqrt(2*pi*\stddev^2) * exp(-((\x-\mean)^2)/(2*\stddev^2));
            % define xmin and xmax only once here and reuse them later
            xmin=-2;
            xmax=2;
        },
    }
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        axis x line=bottom,
        axis y line=middle,
        axis on top,
        xmin=xmin,
        xmax=xmax,
        domain=xmin:xmax,
        samples=100,
    ]
        \path[name path=axis] (axis cs:xmin,0) -- (axis cs:xmax,0);

        \addplot [
            thick,
            name path=gauss,
        ] {gauss(0.1, 0.25)};
        % instead of using a function here you could also give table values or read a (table) file
       % \addplot table {<table> or <file name>};

        \addplot [
            fill=black!10,
        ] fill between [
            of=axis and gauss,
        ];
    \end{axis}
\end{tikzpicture}
\end{document}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Store data across viewers I have a countdown that every 30 seconds restarts the countdown.
    var interval = 31000;

    function reset() {
localStorage.endTime = +new Date + interval;
    }

    if( ! localStorage.endTime ) {
reset();
    }

    setInterval( function() {
var remaining = localStorage.endTime - new Date;
if( remaining >= 0 ) {
    $('#timer').text( Math.floor( remaining / 1000 ) );
} else {
    reset();
}
    }, 100 );

I need to find a way to countdown across the whole server. So every viewer will experience the same countdown. Any ideas?

A: You can put that code in IIF in separate js file and inslude it on every page of your site and it should work cause local storage variables are available in every page in you site.
(function(){ /*... your code ...*/ })();

If you want to implement it on server side, so you can do it same way but instead of only setting value in local variable you also have to post it on server and retrieve when IIF invokes for first time (using AJAX).
(function(){ /*get variable end time and
   in callback set it to local storage ... your code ...
   in reset function post new value of end time on server */
})();


text:
Q: modify weka source code in netbeans i wanna use weka source code (not jar file!)and i download weka-src.jar from this address
http://www.java2s.com/Code/Jar/w/Downloadwekadev379sourcesjar.htm
and i wanna have weka project in netbeanes in windows .i do step by step this site instruction
http://weka.wikispaces.com/Netbeans+6.0+%28weka-src.jar%29
when i extract jar file into src directory in my project,it give me a lot of error
such as:
package java_cup.runtime does not exist
and a lot of other error.
anyone can tell me how can i do that without any error ?? i am working on this problem for a week and i'm so tired.
please help me if you can.

A: you have to download java-cup.jar file And add this jar to your classpath
if you didn't find java-cup.jar then you can download jflex.jar jflex also contain java-cup classes so you can download jflex.jar from link below
click on this link


text:
Q: How do I linking page sections to other page sections with react Am trying to link these card items

to this page

in such a way that when I click ground on services it takes me to ground section on the logistics page, air card at services screen to air section at the logistics page, sea card at services screen to sea section at the logistics page
our services section
import React from 'react'
import { Link } from 'react-router-dom'
import './HomeService.css'

const HomeService = () => {
    return (

Our Services

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

                <Link to="/logistics#transport"  className="home-service-content-cards">

 Ground

We offer cargo transport services within East and Central Africa for containerized...Find out more

                </Link>

                <Link to="/logistics#air"  className="home-service-content-cards">

 Air

Bloomstar Logistics enjoys strategic partnerships with over ten different air carriers...Find out more

                </Link>

                <Link to="/logistics#ocean"  className="home-service-content-cards">

 Sea

We work with an established network of over ten different ocean carrier partners...Find out more

                </Link>

    )
}

export default HomeService

the logistics
import React from 'react'
import './Air.css'
import Plane from '../../../assets/plane.jpg'

const Air = () => {
    return (

Air

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

                        For time-sensitive shipments we're ready to offer a complete range of one-stop-shop for airfreight services.
                        Bloomstar Logistics enjoys strategic partnerships with over ten different air carriers in each region to ensure that
                        we can offer you many airfreight options. With this broad selection of air services, we give you an end-to-end logistics
                        management solution that reduces transportation costs, improves communication among all parties and accelerates
                        decision-making.

                            Partnerships with an exclusive network of partners worldwide to offer end to end services

                            Competitive rates – we utilize hundreds of airline flights daily and you don't have to be limited
                            to designated pickup or delivery times;

                            Door-to-door, Airport-to-Door, Airport-to-Airport;

    )
}

export default Air

How do I achieve this functionality and is it possible to use ids?

A: You can use react-router-hash-link package  for this.

*

*Install react-router-hash-link

npm i react-router-hash-link

*Import the link component from this package.

import { NavHashLink } from 'react-router-hash-link';

*Use the NavHashLink instead of Link
<NavHashLink to="/logistics#transport">...Your html here....</NavHashLink>

*Or you can import NavHashlink as Link to continue using Link tag

import { NavHashLink as Link } from 'react-router-hash-link';
<Link to="/logistics#transport">...Your html here...</Link>

Here's a codesandbox demo
For more information you can check this link


text:
Q: Classification of same rows in 2D numpy  Hi i want to classify indexes of same rows in 2D numpy array. Is there any function to do it ?
Something like this :
 a= [[1,2,3] , [2,3,4] , [5,6,7] ,[1,2,3] ,[1,2,3] , [2,3,4]]
then f(a) returns same row indexes [[0,3,4],[1,5],[2]]
 I would appreciate for your solutions

A: Here's one to output list of arrays of row indices -
def classify_rows(a):
    sidx = np.lexsort(a.T)
    b = a[sidx]
    m = ~(b[1:] == b[:-1]).all(1)
    return np.split(sidx, np.flatnonzero(m)+1)

If you need a list of lists as output -
def classify_rows_list(a):
    sidx = np.lexsort(a.T)
    b = a[sidx]
    m = np.concatenate(( [True], ~(b[1:] == b[:-1]).all(1), [True]))
    l = sidx.tolist()
    idx = np.flatnonzero(m)
    return [l[i:j] for i,j in zip(idx[:-1],idx[1:])]

Sample run -
In [78]: a
Out[78]:
array([[1, 2, 3],
       [2, 3, 4],
       [5, 6, 7],
       [1, 2, 3],
       [1, 2, 3],
       [2, 3, 4]])

In [79]: classify_rows(a)
Out[79]: [array([0, 3, 4]), array([1, 5]), array([2])]

In [80]: classify_rows_list(a)
Out[80]: [[0, 3, 4], [1, 5], [2]]


text:
Q: reusing same port in a tcp application under different namespaces on linux VM i have a linux VM with 2 interfaces, eth0 has mgmt IP and eth1 has configuration as below
ip netns exec eng51 ifconfig
eth1.51   Link encap:Ethernet  HWaddr 52:54:00:bd:68:c3
          inet addr:51.51.1.10  Bcast:51.51.1.255  Mask:255.255.255.0
ip netns exec eng52 ifconfig
eth1.52   Link encap:Ethernet  HWaddr 52:54:00:bd:68:c3
          inet addr:51.51.2.10  Bcast:51.51.2.255  Mask:255.255.255.0
ip netns exec eng522 ifconfig
eth1.522  Link encap:Ethernet  HWaddr 52:54:00:bd:68:c3
          inet addr:51.51.2.10  Bcast:51.51.2.255  Mask:255.255.255.0
ip netns exec eng511 ifconfig
eth1.511  Link encap:Ethernet  HWaddr 52:54:00:bd:68:c3
          inet addr:51.51.1.10  Bcast:51.51.1.255  Mask:255.255.255.0
So I have a script which uses tcp protocol and i need to simultaneously send traffic
from eng51[51.51.1.10 vlan-id 51] to eng52[ 51.51.2.10 vlan-id 52]
and i use same script to send traffic from eng52[ 51.51.1.10 vlan-id 511] to eng522 [51.51.2.10 vlan-id 522]
I run the script under name different namespaces:
ip netns exec eng51 python client.py 51.51.2.10
ip netns exec eng511 python client.py 51.51.2.10
inside client.py i bind the source port to be always 63999 and i have a HTTPserver running on port 8000 for both namespaces eng52 and eng522
     sock.bind(('0.0.0.0',63999))
the reason i am binding source port to 63999 is I need source-Address,destination,address,source port, destination port and protocol to be same
in both traffic sessions
the problem I face is even though I run this script under different namespaces, the source port is not considered unique. I am unable to run the script under different namespaces at the same time[ due to usage of same port 63999]

A: So I got this working by simply using multiple interfaces, mapping each interface of a VM to a namespace. And then I was able to use source port 63999 at the same time in 2 simultaneous sessions
ip netns eng51 ifconfig eth1.51 Link encap:Ethernet HWaddr 52:54:00:bd:68:c3 inet addr:51.51.1.10 Bcast:51.51.1.255 Mask:255.255.255.0
ip netns exec eng52 ifconfig eth2.52 Link encap:Ethernet HWaddr 52:54:00:bd:68:c3 inet addr:51.51.2.10 Bcast:51.51.2.255 Mask:255.255.255.0
ip netns exec eng522 ifconfig eth3.522 Link encap:Ethernet HWaddr 52:54:00:bd:68:c3 inet addr:51.51.2.10 Bcast:51.51.2.255 Mask:255.255.255.0
ip netns exec eng511 ifconfig eth4.511 Link encap:Ethernet HWaddr 52:54:00:bd:68:c3 inet addr:51.51.1.10 Bcast:51.51.1.255 Mask:255.255.255.0


text:
Q: how to pass extra input parameter in tensorflow in iOS? I am sending parameter to tensorflow as following:
 std::string input_layer = "input_node";
    std::string output_layer = "output_node";
    std::string dropout_layer = "keep_prob"; //--- extra parameter

    Status run_status = session->Run({{input_layer, resized_tensor}},
                                       {output_layer}, {}, &outputs);
      if (!run_status.ok()) {
        LOG(ERROR) << "Running model failed: " << run_status;
        return -1;
      }

I tried as
 tensorflow::Status run_status = session->Run({{input_layer,dropout_layer, image_tensor}},{output_layer},{}, &outputs);

but it is not accepting extra parameter
How can i send extra input parameter ?


text:
Q: Swift XCTAssertEqual() for Date values - how to set part accuracy? Inside my Unit Test for Dates
let day = StockMarketDay(year: 2022, month: 1, day: 4)
    let formatter = ISO8601DateFormatter()      // no timezone
    formatter.formatOptions = [.withFullDate]
    let targetDate = formatter.date(from: "2022-01-04")!
    let timeAccuracy = TimeInterval(60*60*24)
    let dateAccuracy = Date(timeIntervalSince1970: timeAccuracy)
    print("dateAccuracy - \(dateAccuracy)")
   // XCTAssertEqual(day!.date, targetDate, accuracy: dateAccuracy) // Error
    XCTAssertEqual(day!.date, targetDate, accuracy: timeAccuracy) // Error

I get error: No exact matches in call to global function 'XCTAssertEqual'
It appears that the generic AssertEqual function must have a matching Type (e.g. Date) for the Accuracy parameter.  But I don't seem to guess at creating a proper accuracy date to pass in.
Anyone know of a way to Unit Test Dates with a specified accuracy?

A: It might be worth trying to use TimeIntervals instead of dates, so change the XCTAssertEqual to this:
XCTAssertEqual(day!.date.timeIntervalSince1970, targetDate.timeIntervalSince1970, accuracy: timeAccuracy)


text:
Q: Don't call popup if another one is already on the page There is a popup (1) that should be called after 15 seconds of being on the page.
But if the user opened some other popup(2), then don't call the first one.
popup(1);
mounted() {
 this.openModal();
},

// methods
openModal() {
  setTimeout(() => {
    this.isModalVisible = true;
  }, 15000);
},

How to do it?
Perhaps need to stop setTimeOut?

A: Maybe something like following snippet:

new Vue({
  el: '#demo',
  data() {
    return {
      isModalVisible: false,
      isModalOther: false
    }
  },
  methods: {
    openModal() {
      setTimeout(() => {
        if(!this.isModalOther) this.isModalVisible = true;
      }, 5000);
    },
    openOtherModal() {
      this.isModalVisible = false
      this.isModalOther = true;
    },
  },
  mounted() {
   this.openModal();
  },
})

popup1

popup2

  <button @click="openOtherModal">open popup2</button>

A: To cancel a timeout, all you need to do is call clearTimeout(TimeoutID);. A timeoutID is a returned by the setTimeout() method automatically, so just save it in a variable
let timer = setTimeout(...);

then, when you call popup(2), just add
this.clearTimeout(timer);

and the first popup won't show


text:
Q: IronPython WPF project cannot find ICO file at run-time Using IronPython and WPF in VS2017:
I have added an icon located in my code source directory to the XAML Window tag. I've also included the file in the project in the solution explorer. If I use the full file C: drive file path, it works. But, I need to use a relative path because it will be run on other computers.
If I try Icon="../xxx.ico" the file isn't found (squiggly line, "Cannot find...).
If I try Icon="xxx.ico" the file IS found while editing, however at run-time I get an exception

Exception: Failed to create a 'Icon' from the text 'xxx.ico'.

It seems that the Python interpreter cannot locate it.
What do I need to do so that it is found at run-time?

A: Ran into this same issue myself and have found a solution, albeit a little late!
It does indeed seem that IronPython interprets the field as text unless it determines a valid uri is present.
We can get around this via code, a bit of reading into c# and how it handles icons was needed here;

*

*Dynamically setting our path and file
location at runtime.

*Create a BitmapImage
after casting our file location as a c# Uri

*Update our xaml to give our window an x:Name=""

*Set our window.Icon to the BitmapImage we defined earlier

XAML
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xml:lang="en-AU"
    x:Name="window">
</Window>

Code behind
import os
import clr

clr.AddReference('System')

from System import Uri
from System.Windows.Media.Imaging import BitmapImage

class Application(Window):

    def __init__(self):

        ## Set our icon file path dynamically based off working directory ##
        icon = os.path.join(os.getcwd(), 'app-logo.ico')

        ## Define BitmapImage from Uri(filepath) ##
        self.icon = BitmapImage(Uri(icon))

        ## Load our wpf component, defined under self.ui to allow easy access ##
        self.ui = wpf.LoadComponent(self, 'application.xaml')

        ## Set our XAML x:Name="window"'s Icon field to our BitmapImage
        self.ui.window.Icon = self.icon

Thats it! Our Icon is now set and working as intended.
Taskbar:

Application Icon:


text:
Q: Fresh install of 64bit Ubuntu needs flash but adobe doesn't have a version for me I need flash to watch YT videos. YT said "You need to upgrade your Adobe Flash Player to watch this video." with a link to download flash. I'm running 10.04 so I see possible choices for myself: 1) a .deb file for Ubuntu 8.04+ or APT (whats this??) for Ubuntu 9.04. I downloaded the deb file and when I opened it in the installer it said that I have the wrong architecture. Anyone have an idea about how to work around this?

A: Ok I found it. I have to use synaptic to install flashplugin-installer. Its works now!

A: If you enable Canonical's partner repository, you'll also find the packages adobe-flashplugin and adobeair in your package manager.
To enable this extra repository:

*

*Open System > Administration > Software Sources

*Go to the "Other Software" tab

*Check the box next to this line:
http://archive.canonical.com/ubuntu lucid partner
Now you'll need to update/refresh your package manager (sudo aptitude update on the commandline, or the Reload button in Synaptic), and these packages will be available.


text:
Q: Sobel edge-detection, weird output I´m trying to implement a Sobel algorithm for edge-detection for a YUV camera stream. Initially it seems quite easy but I´m not sure if this approach is correct:

*

*I´m applying the filter just to the Y pixel component and doing U and V = 0 (black and white image).

*After, and in order to check the result, I´m sending frames through the serial port, but before I convert the image from YUV to jpg.

The black and white image works perfectly and I can see it on the PC application which I wrote, but when I´m applying the Sobel filter to Y component I´m getting this:

the code:
    #define index(xx, yy)  ((yy * width + xx) * 2) & 0xFFFFFFFE  // address multiple of 2

(...............)

for (y=1, y < height-1; y++){
    for (x=1, y < width-1; y++){
        pixel_valueY_h=0.0;
        pixel_valueY_v=0.0;
      for (j= -1; j<2; j++){
         for (i= -1; i<2; i++){

            offset= index(x+1, y+1);
            pixel_valueY_h += (sobel_h[j + 1][i + 1])* input[offset+1]; //offset+1=> Y component
            pixel_valueY_v += (sobel_v[j + 1][i + 1])* input[offset+1];

         }
      }
        offset = index(x,y);
        pixel_value= sqrt1((pixel_valueY_h * pixel_valueY_h)+(pixel_valueY_v * pixel_valueY_v));

        if (pixel_value > 255) pixel_value=255;
        if (pixel_value < 0) pixel_value=0;

        //output frame
        output[offset] &=0x00; //U and V components = 0
        output[offset+1] &=(255- (unsigned char)pixel_value );
    }
}

(...............)

Any clue about what is happening?
Thanks in advance.

A: Finally I've got it working, the problem was the memory addressing using the macro: #define index(xx, yy)  ((yy * width + xx) * 2) & 0xFFFFFFFE which for some reason was giving incorrect addresses.
Instead  I added the line ( ((yy * width + xx) * 2) & 0xFFFFFFFE) in the code and like that (without modifications) is working perfectly.
Thanks.


text:
Q: Copying contents of text file using file handling I created a text file named "test.txt" and then executed this program to copy the contents of "test.txt" to "file.txt". But it is showing an error while opening the file itself, i.e., fr==NULL is true.
What is wrong with the program?
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
   int i,count=0;
   char ch;
   FILE *fw,*fr;
   fw = fopen("file.txt", "a+");
   fr = fopen("test.txt", "r+");
   fseek(fr,0,SEEK_SET);
   if(fr==NULL)
   {
     printf("Error while opening the file.\n");
     exit(0);
   }
   while((ch=getc(fr))!=EOF)
   {
     putc(ch,fw);
   }
   fclose(fw);
   fclose(fr);
   return 0;
}

A: If fopen returns NULL, check the value of errno, e.g. by including <errno.h> and using the perror("Error while opening the file"); instead of the printf statement.


text:
Q: Intent.ACTION does not dial after first # sign I am trying to make a call with a long number that looks something like this.
tel:883994555,,,32343#,,,#
with code that looks like this.
        Intent intent = new Intent(Intent.ACTION_CALL);
        Uri uri = Uri.parse(number);
        intent.setData(uri);
        startActivity(intent);

What I see is that, the phone does not dial after the first '#' sigh. Any one knows how to make this to work.
Thanks.

A: How I got this to work was to use ';' (semicolon) for the hard wait instead of the 'w', and ',' (comma) for the pause, and then encode the phone number first, like this -
Uri.parse(String.format("tel:%s", Uri.encode(number)))

A: Uri.parse(String) parses an RFC 2396-compliant, encoded URI.
RFC 2396 says:

The character "#" is excluded because
  it is used to delimit a URI from a
  fragment identifier in URI references.


text:
Q: package animate: How to convert a pdf animation created with transparencies to gif? I wrote a pdf animation with the animate package using transparencies.

To be able to show this gif, on S.E, I created not transparencies but images and I could convert it into gif with imagemagick in this way:
convert -delay 10 -loop 0 -background white -alpha remove thepdf.pdf result.gif

But I wrote it with transparencies in the animateinline environment of the animate package and the pdf file is animated.
\documentclass{standalone}
\usepackage{tikz}
\usepackage{animate}

% creation of the ove.txt timeline file
\newwrite\Fichier
\immediate\openout\Fichier=ove.txt
\foreach \n in {0,1,...,6}{
\immediate\write\Fichier{::\n x0}
}

\immediate\closeout\Fichier% always close the file

\newcommand{\Debut}{% Systematic start of drawing
\begin{tikzpicture}
\useasboundingbox (-2.5,-2.5) rectangle (4,2.5);}
\newcommand{\Fin}{\end{tikzpicture} }% Systematic end of drawing
\begin{document}
\begin{animateinline}[autoplay,begin={\Debut},end={\Fin},timeline=ove.txt]{1.5}
    % perpendicular straight - transparent 0
    \draw[thick] (-2.5,0)--(4,0);
    \draw[thick] (0,-2.5)--(0,2.5);
\newframe% circle - transparent 1
    \draw[thick] (0,0) circle (2cm);
\newframe%  half-line 1 - transparent 2
    \draw[thick] (0,-2)--(3,1);
\newframe%  half-line 2 - transparent 3
    \draw[thick] (0,2)--(3,-1);
\newframe%  arc 1 - transparent 4
    \draw[thick](0,2)arc[start angle=90,end angle=45,radius=4cm];
\newframe%  arc 2 - transparent 5
    \draw[thick](0,-2)arc[start angle=-90,end angle=-45,radius=4cm];
\newframe%  arc 3 - transparent 6
    \draw[thick]([xshift=2cm]45:1.171573cm)arc[start angle=45,end angle=-45,radius=1.171573cm];
\end{animateinline}

\end{document}

I tried to convert these animated pdf into a gif and I didn't succeed.
Is it possible to convert an animated pdf file created with transparencies in this way to gif? If so, how?

A: As of animate version [2018/08/22], producing multipage output from animation frames is easily done by setting export as a class option to standalone or as a package option to animate. Use the conversion program of your choice (e. g. convert) to make an animated GIF from the PDF output.
This also works for animations that make use of package animate's timeline feature (as requested by the OP):

\documentclass[export]{standalone}
\usepackage{tikz}
\usepackage{animate}

% creation of the ove.txt timeline file
\newwrite\Fichier
\immediate\openout\Fichier=ove.txt
\foreach \n in {0,1,...,6}{
\immediate\write\Fichier{::\n x0}
}

\immediate\closeout\Fichier% always close the file

\newcommand{\Debut}{% Systematic start of drawing
\begin{tikzpicture}
\useasboundingbox (-2.5,-2.5) rectangle (4,2.5);}
\newcommand{\Fin}{\end{tikzpicture} }% Systematic end of drawing
\begin{document}
\begin{animateinline}[autoplay,begin={\Debut},end={\Fin},timeline=ove.txt]{1.5}
    % perpendicular straight - transparent 0
    \draw[thick] (-2.5,0)--(4,0);
    \draw[thick] (0,-2.5)--(0,2.5);
\newframe% circle - transparent 1
    \draw[thick] (0,0) circle (2cm);
\newframe%  half-line 1 - transparent 2
    \draw[thick] (0,-2)--(3,1);
\newframe%  half-line 2 - transparent 3
    \draw[thick] (0,2)--(3,-1);
\newframe%  arc 1 - transparent 4
    \draw[thick](0,2)arc[start angle=90,end angle=45,radius=4cm];
\newframe%  arc 2 - transparent 5
    \draw[thick](0,-2)arc[start angle=-90,end angle=-45,radius=4cm];
\newframe%  arc 3 - transparent 6
    \draw[thick]([xshift=2cm]45:1.171573cm)arc[start angle=45,end angle=-45,radius=1.171573cm];
\end{animateinline}

\end{document}

A: An alternative of @samcarters elegant proposal is based on @samcarter's nice answer. It is fairly easy to produce animated gifs from beamer animations. In this case you only have to replace \newframe by \pause. Unfortunately, I could not make crop work with an animated frame (without \pause it works), so I had to mess around with dimensions. It would be great if some beamer expert could fix that, I would be more than happy to remove that proposal then, especially if that beamer expert is the one mentioned above. ;-) UPDATE: I found this very nice answer whose votes I just doubled, which uses tricks of this great answer. No more cropping by hand!
\documentclass[beamer,tikz,preview,multi]{standalone}
\let\myshipout\shipout
\begin{document}
\let\shipout\myshipout

\begin{standaloneframe}
\begin{tikzpicture}
\useasboundingbox (-2.5,-2.5) rectangle (4,2.5);
    % perpendicular straight - transparent 0
    \draw[thick] (-2.5,0)--(4,0);
    \draw[thick] (0,-2.5)--(0,2.5);
\pause% circle - transparent 1
    \draw[thick] (0,0) circle (2cm);
\pause%  half-line 1 - transparent 2
    \draw[thick] (0,-2)--(3,1);
\pause%  half-line 2 - transparent 3
    \draw[thick] (0,2)--(3,-1);
\pause%  arc 1 - transparent 4
    \draw[thick](0,2)arc[start angle=90,end angle=45,radius=4cm];
\pause%  arc 2 - transparent 5
    \draw[thick](0,-2)arc[start angle=-90,end angle=-45,radius=4cm];
\pause%  arc 3 - transparent 6
    \draw[thick]([xshift=2cm]45:1.171573cm)arc[start angle=45,end angle=-45,radius=1.171573cm];
\end{tikzpicture}
\end{standaloneframe}
\end{document}

And here is why I think this is an interesting possibility. For beamer there exist a number of tools that can help one with animations, IMHO the most notable example is given by aobs-styles. Here is an example based on the post that has lead to that super useful library.
\documentclass[beamer,tikz,preview,multi]{standalone}
\tikzset{semivisible on/.style={alt={#1{opacity=0.5,text opacity=0.5}{}}}}
\usetikzlibrary{overlay-beamer-styles}
\usetikzlibrary{mindmap}
\let\myshipout\shipout
\begin{document}
\let\shipout\myshipout

\begin{standaloneframe}
% example based on https://tex.stackexchange.com/a/55849/121799
\begin{tikzpicture}[mindmap, concept color=gray!50, font=\sffamily, text=white]

  \tikzset{level 1 concept/.append style={font=\sf, sibling angle=90,level
  distance = 30mm}}
  \node[concept,scale=0.7] {beings}
    [clockwise from=135]
        child[concept color=red, visible on=<1>,semivisible on=<{4,2}>]{
        node[concept,scale=0.7]{ducks} }
        child[concept color=blue, visible on=<2>,semivisible on=<{1,3}>]{
        node[concept,scale=0.7]{marmots} }
        child[concept color=orange, visible on=<3>,semivisible on=<{2,4}>]{
        node[concept,scale=0.7]{koala bears} }
        child[concept color=green!50!black, visible on=<4>,semivisible on=<{3,1}>]{
        node[concept,scale=0.7]{squirrels} };
\end{tikzpicture}
\end{standaloneframe}
\end{document}


text:
Q: Socket.io Server can't send data to the client I'm trying to send data to the client via Socket.io.
If the connection is established, I'll receive a message. But outside of the socket.on('connection') the client doesn't get anything.
UPDATE!
CLIENT.JS
import io from 'socket.io-client'

const socket = io('http://192.168.178.54:3000', {
  transports: ['websocket', 'polling'],
})
socket.on('connection', data => socket.emit('recruiter_id', recruiter_id)) // TOP
socket.on('update_contact', data => console.log) // FLOP
socket.on('connection', data => console.log) // FLOP
socket.on('haha', data => console.log) // FLOP

SERVER.JS
this.io = require('socket.io')(this.server, {transports : ['polling', 'websocket']});
this.io.on('connect', (socket) => {
    console.log('connected');
    socket.emit('update_contact', {bla: "hi"});
    socket.emit('connection', {'michael' : 'ist doof'});
    socket.emit('haha', "hi");    // This will be emitted
    socket.on('recruiter_id', (id) => {
        this.socketMap.set(id, id);
        socket.emit('update_contact', {bla: "hi"});
    })
    socket.emit('update_contact', {bla: "hi"});
});

The server is running on a different machine.

A: Your client does not listen to connection because the arrow function is never executed. You should listen to connect, not connected. Try this:
CLIENT.JS
socket.on('connect', () => console.log('client connected'));
socket.on('connection', (data) => console.log('connection:', data));

A: Removing transports from client and server was the solution.


text:
Q: Joining list with comma i want to join my list with comma to separate each itemlist from a class but it just can't giving me access to that class property
(i'm sorry i'm not good at explaning this, but i hope with this code sample you will understand)
public class CategoryDetail
{
    public string id { get; set; }
    public string title { get; set; }
    public string href { get; set; }
    public string type { get; set; }
    public string icon { get; set; }
}

public class RootObjectDetail
{
    public List<CategoryDetail> categories { get; set; }

    public string categoryList
    {
        get
        {
            return string.Join<CategoryDetail>(",", categories.ToArray());
        }
    }
}

so this is my code that i use for retrieving data from json, and what i want is that in my xaml i will bind it into categoryList and it will showing categoryDetail title property that separated by comma

A: You don't need to specify generic parameter type - it can be inferred from usage. Also you need to project categories to sequence of titles:
public string categoryList
{
    get
    {
        return String.Join(",", categories.Select(c => c.title));
    }
}


text:
Q: I have created my own package. I get the following error: "No module name *" I have a problem I have tried to fix. I have created my own package called ReunionLog I can create my package and install it successfully (I think) but when trying to use the functions I get all sort of errors in another file Main.py.
I get following error for AttributeError: module 'ReunionLog' has no attribute 'Get_Data_Name' when i do this following code:
import requests
import os
import json
import ReunionLog as RL
publicURL = "https://www.warcraftlogs.com/api/v2/client"

def main():
    jsonName = RL.Get_Data_Name(RL.Retrieve_Headers(), publicURL, code = "LfF6BzVgpraHdb1G")
    with open(".nameReport.json", mode = "w+", encoding= "utf-8") as f:
            json.dump(jsonName, f)
if __name__ == "__main__": main()

I get this error: ModuleNotFoundError: No module named 'ReportAbilities' when I have this code:
import requests
import os
import json
import Report as RP
import OAuth as AU

publicURL = "https://www.warcraftlogs.com/api/v2/client"

def main():
    jsonName = RP.Get_Data_Name(AU.Retrieve_Headers(), publicURL, code = "LfF6BzVgpraHdb1G")
    with open(".nameReport.json", mode = "w+", encoding= "utf-8") as f:
            json.dump(jsonName, f)
if __name__ == "__main__": main()

This is my source directory:
ReunionLog
├── LICENCE
├── pyproject.toml
├── README.md
├── setup.cfg
└── src
    ├── OAuth
    │   ├── Authentication.py
    │   └── __init__.py
    └── Report
        ├── __init__.py
        ├── ReportAbilities.py
        ├── ReportEventsDamageDone.py
        ├── ReportEventsDeath.py
        ├── ReportEventsInterrupts.py
        └── ReportNames.py

This is my setup.cfg
[metadata]
name= ReunionLog
version = 0.1.3.59
author= nickgismokato
author_email= nickvillumlaursen@gmail.com
url= https://github.com/nickgismokato/ReunionLog
#packages= ['OAuth', 'Report']
license= MIT License
description= A small package to access and use WarcraftLogs API
long_description= A small package that can use the WarcraftLogs api and from there call function to retrive data fram WarcraftLogs
#install_requires=[
#    "gql-query-builder >= 0.1.7"
#]
keywords= python, WarcraftLogs-API, package
classifiers=
    Development Status :: 2 - Pre-Alpha
    Intended Audience :: End Users/Desktop
    Intended Audience :: Other Audience
    Programming Language :: Python :: 3
    Operating System :: OS Independent

[options]
zip_safe = False
packages = find:
include_package_data = True
python_requires = >= 3.8
package_dir =
    =src

[options.packages.find]
where=src

My pyproject follow standard convention. My __init__.py in report is on the following form:
import ReportAbilities.
import ReportEventsDamageDone
import ReportEventsDeath
import ReportEventsInterrupts
import ReportNames

"""
#Abilities
from .ReportAbilities import Get_AbilityList
from .ReportAbilities import Get_Data_Ability
#Damage Done
from .ReportEventsDamageDone import Get_Data_EventDamageDone
#Death
from .ReportEventsDeath import Get_Data_EventDeath
#Interrupts
from .ReportEventsInterrupts import Get_Data_EventInterrupts

#Names
from .ReportNames import Get_Data_Name
from .ReportNames import Get_NameList
"""

There has been some trial and error as you can see.
My __init__.py in OAuth is as follows:
#import Authentication
from Authentication.Retrive_headers import Retrieve_Headers

My .py files just have some imports and have some functions. I just can't seem to solve this problem. I hope it's just a case of my being an idiot.
Tried to change my init files and also went from setup.py to pyproject.toml to see if that solved my problem.
EDIT
I followed the advice of both @sinoroc and @USR . I still get an error. My new dic tree is:
.
├── LICENCE
├── README.md
├── pyproject.toml
├── setup.cfg
└── src
    ├── ReunionLog
    │   ├── OAuth
    │   │   └── Authentication.py
    │   └── Report
    │       ├── ReportAbilities.py
    │       ├── ReportEventsDamageDone.py
    │       ├── ReportEventsDeath.py
    │       ├── ReportEventsInterrupts.py
    │       └── ReportNames.py
    └── __init__.py

where my __init__.py has the following code:
from ReunionLog.OAuth.Authentication import Retrieve_Headers
from ReunionLog.Report.ReportAbilities import Get_AbilityList
from ReunionLog.Report.ReportAbilities import Get_Data_Ability
from ReunionLog.Report.ReportEventsDamageDone import Get_Data_EventDamageDone
from ReunionLog.Report.ReportEventsDeath import Get_Data_EventDeath
from ReunionLog.Report.ReportEventsInterrupts import Get_Data_EventInterrupts
from ReunionLog.Report.ReportNames import Get_Data_Name
from ReunionLog.Report.ReportNames import Get_NameList

The full error I get is as follow:
nickgismokato@Nick-PC:/mnt/c/Users/nicka/OneDrive/BjLog$ python3 Main.py
Traceback (most recent call last):
  File "Main.py", line 28, in <module>
    if __name__ == "__main__": main()
  File "Main.py", line 13, in main
    jsonName = RL.Get_Data_Name(RL.Retrieve_Headers(), publicURL, code = "LfF6BzVgpraHdb1G")
AttributeError: module 'ReunionLog' has no attribute 'Get_Data_Name'

This is for the file Main.py where the code is:
import requests
import os
import json
import ReunionLog as RL

publicURL = "https://www.warcraftlogs.com/api/v2/client"

def main():
    jsonName = RL.Get_Data_Name(RL.Retrieve_Headers(), publicURL, code = "LfF6BzVgpraHdb1G")
    with open(".nameReport.json", mode = "w+", encoding= "utf-8") as f:
            json.dump(jsonName, f)

if __name__ == "__main__": main()

EDIT 2 (Answer)
The answer can be found in the comments made by @sinoroc My new dic tree is:
.
├── LICENCE
├── README.md
├── pyproject.toml
├── setup.cfg
└── src
    └── ReunionLog
        ├── OAuth
        │   ├── Authentication.py
        │   └── __init__.py
        ├── Report
        │   ├── ReportAbilities.py
        │   ├── ReportEventsDamageDone.py
        │   ├── ReportEventsDeath.py
        │   ├── ReportEventsInterrupts.py
        │   ├── ReportNames.py
        │   └── __init__.py
        └── __init__.py

My __init__.py in Report and OAuth is empty and my __init__.py in ReunionLog is as described in EDIT

A: First of all, you do not necessarily need to import all the other submodules in your __init__.py. second of all, there is a little "." in line 1 of your __init__.py right here: import ReportAbilities..
Also, it would be quite helpful to have the entire error messages (wich file causes the error, and in what line is it caused)


text:
Q: STORM: storm-hdfs hdfs blolt failing after 24hrs My storm topology which reads from kafka and writes to hadoop hdfs is failing exactly after 24hrs!!
I suspect the problem is, topology was not able to renew the tokens/not finding the keytabs to renew. Please share your thoughts and help me fix the issue.
Please find the code used to configure hdfs bolt..
Config object:
//building a 'map' with hdfs related configuration for key tab
Map<String, Object> hdfsSecConfigMap = new HashMap<String, Object>();
hdfsSecConfigMap.put("hdfs.keytab.file", ktPath);
hdfsSecConfigMap.put("hdfs.kerberos.principal", ktPrincipal);

//building a 'map' with hbase related configuration
Map<String, Object> hbaseConfigMap = new HashMap<String, Object>();
hbaseConfigMap.put("hbase.rootdir", hbaseRootDir);
hbaseConfigMap.put("storm.keytab.file", ktPath);
hbaseConfigMap.put("storm.kerberos.principal", ktPrincipal);

Config configured = new Config();
configured.setDebug(true);
configured.put(hdfsConfKey, hdfsSecConfigMap);
configured.put(hbaseConfKey, hbaseConfigMap);
configured.setNumWorkers(2);
configured.setMaxSpoutPending(300);
configured.setNumAckers(30);
configured.setMessageTimeoutSecs(1200);

configured.put(HdfsSecurityUtil.STORM_KEYTAB_FILE_KEY, ktPath);
configured.put(HdfsSecurityUtil.STORM_USER_NAME_KEY, ktPrincipal);

configured.put(HBaseSecurityUtil.STORM_KEYTAB_FILE_KEY, ktPath);
configured.put(HBaseSecurityUtil.STORM_USER_NAME_KEY, ktPrincipal);

Retrieving hdfs bolt
HdfsBolt hdfsbolt = new HdfsBolt()
        .withFsUrl(hdfsuri)
        .withRecordFormat(recFormat)
        .withFileNameFormat(fileNameWithPath)
        .withRotationPolicy(fileRotationSize)
        .withSyncPolicy(syncPolicy)
        .withConfigKey(secBypassConfigKey);

TopologyBuilder setup below
builder.setBolt("hdfsBolt", avroHDFSBolt, 1)
        .setNumTasks(1)
        .shuffleGrouping("kafka-spout");

Exception facing is below:
java.io.IOException: IOException flush:java.io.IOException: Failed on local exception: java.io.IOException: javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)]; Host Details : local host is: "**********"; destination host is: "***************":8020;
        at org.apache.hadoop.hdfs.DFSOutputStream.flushOrSync(DFSOutputStream.java:2082) ~[stormjar.jar:?]
        at org.apache.hadoop.hdfs.DFSOutputStream.hsync(DFSOutputStream.java:1969) ~[stormjar.jar:?]
        at org.apache.hadoop.hdfs.client.HdfsDataOutputStream.hsync(HdfsDataOutputStream.java:95) ~[stormjar.jar:?]
        at org.apache.storm.hdfs.bolt.HdfsBolt.execute(HdfsBolt.java:100) [stormjar.jar:?]
        at backtype.storm.daemon.executor$fn__3697$tuple_action_fn__3699.invoke(executor.clj:670) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
        at backtype.storm.daemon.executor$mk_task_receiver$fn__3620.invoke(executor.clj:426) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
        at backtype.storm.disruptor$clojure_handler$reify__3196.onEvent(disruptor.clj:58) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
        at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:125) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
        at backtype.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:99) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
        at backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
        at backtype.storm.daemon.executor$fn__3697$fn__3710$fn__3761.invoke(executor.clj:808) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
        at backtype.storm.util$async_loop$fn__544.invoke(util.clj:475) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
        at clojure.lang.AFn.run(AFn.java:22) [clojure-1.6.0.jar:?]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]

A: I was able to fix this issue, after re-building my code/application against the correct version of hadoop used in our hadoop cluster.
The issue is observed due to versions mismatch, and fixed after re-build with correct versions!!


text:
Q: How to upcast `byref<'t>` to `byref` in F#? I try to call JsonConverter<'t>.Read using reflection
static member ConvertRead (readInfo: MethodInfo, converter: JsonConverter, reader: byref<Utf8JsonReader>, typeToConvert: Type, options: JsonSerializerOptions) =
    readInfo.Invoke(converter, [| box reader; box typeToConvert; box options |])

and get FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL


text:
Q: How to get 2 month facebook page token when I have 2 month facebook user token? How to get 2 month facebook page token when I have 2 month facebook user token ?
That's just it.
I haven't managed to do it.
IS there a way to do it using just graph explorer ?
Thanx.

A: You can get these access tokens by querying /me/accounts. You must have the manage_pages permission in order to receive the access tokens.


text:
Q: Best unbiased estimator for a location family Mainly for pedagogical reasons, I'm considering the "simple" one dimensional model:
$$x=\theta+\epsilon$$
where $\epsilon$ has a known distribution $p$ that is independent of $\theta$. This distribution can be anything, just assuming some regularity conditions, compact support... something that leaves a lot of freedom for the choice of $p$. Somehow I'm looking for properties that hold for "almost any $p$", ignoring special cases with strong underlying algebraic properties (like in an exponential family).
Consider an independent sample $X=(x_1,x_2,x_3,...,x_n)$.
I'm looking for a general way to construct the best unbiased estimator if it exist. Not asymptotically I mean but for fixed finite $n$. It happens to be a bit more than difficult I thought. The questions I face are:

*

*what is a minimal sufficient statistics (is it just reordered $X$)?

*the MLE has a constant bias (see note), is debiased MLE the best unbiased estimator?

*how to use an ancillary statistics to find the best unbiased estimator? Would it yield the same estimator?

I guess I'm not the first person on earth to ask myself these questions. Have you done this kind of analysis, do you know results, the "right" method, or do you know of an article that studied something like it?
Note: proof that MLE $\hat\theta$ has constant bias:
$E_\theta(\hat\theta)=E_\theta(\arg\max_t \prod_ip(x_i-t))=E_\theta(\arg\max_t \prod_ip(\epsilon_i-(t-\theta)))\\=E_\theta(\arg\max_u \prod_ip(\epsilon_i-u)+\theta)=E_0(\hat\theta)+\theta=c+\theta $
When $p$ is symetric around 0, this bias is 0: since $-\epsilon$ has the same distribution as $\epsilon$: $E_0
(\hat\theta)=E_\theta(\arg\max_t \prod_ip(-\epsilon_i-t))\\=E_\theta(\arg\max_t \prod_ip(\epsilon_i+t))=E_\theta(-\arg\max_u \prod_ip(\epsilon_i-u))=-E_0(\hat\theta)$

A: First, if the distribution $p$ is unspecified (or does not belong to an extended exponential family as, e.g., the location Cauchy distributions), the order statistic is indeed the minimal sufficient statistic. (See my answer to an earlier X validated question and Lehmann and Casella (1998).)
As pointed out in an answer to an earlier X'ed question, there is no reason for the MLE of the parameter $\theta$ to be unbiased [except, as updated by the OP, when the density $p$ is symmetric]. There is further no reason for the bias to be constant for all $\theta$'s across all $p$'s [if constant for a given $p$]. And there is further² no reason for an UNMVUE to exist. Actually, since the order statistic is minimal sufficient, it cannot be complete: $X_{(i)}-X_{(j)}$ is for instance ancillary $(i\ne j)$, hence does not allow for Lehmann-Scheffé to apply. (Although there also exist settings when the UNMVUE exists while a complete sufficient statistic does not.)

An example taken from Lehmann (1983, p.76) goes as follows:  take
  $X$ with support $\{-1,0,1,\ldots\}$ with probabilities $(0<p<1)$
  $$\mathbb{P}(X=-1)=p,\quad\mathbb{P}(X=k)=(1-p)^2p^k\quad
> k=0,1,\ldots$$ Finding the minimum variance unbiased estimator of $p$
  for $p=p_0$ amounts to minimising$$\sum_{k=-1}^\infty
> \mathbb{P}(X=k)[\mathbb{I}_{-1}(k)-ak]^2$$which returns the solution
  $$a^\star=-p_0\Bigg/\left[ p_0+(1-p_0)^2\sum_{k=1}^\infty k^2p_0^k
> \right]$$ which depends on $p_0$, hence prohibits the existence of a
  uniformly minimum variance unbiased estimator.

In the case of a location parameter $\theta$, Lehmann and Scheffé (1950) showed that the Uniform $\mathcal{U}[\theta-1,\theta+1]$ does not allow for an UMVUE, apart from constant functions of $\theta$. (This perfectly fits the setting of the question.)
Most interestingly, when the distribution $p$ is unknown (with mean zero), $\bar{X}_n$ is the best unbiased estimator, as stated in Lehmann (1983):

To answer more specifically the question about the (possibly recentred) MLE, it should be compared to the Pitman best equivariant estimator, which dominates the original (and equivariant) MLE and the recentred and also equivariant MLE, in terms of mean square error. As later pointed out by the OP in a comment [and also found in Lehmann (1983, Lemma 3.1.3)], the Pitman best equivariant estimator of the location parameter is always unbiased and hence dominates the recentred MLE. However, in the specific case of the Cauchy location parameter, there exist no UMVUE for the location parameter. This completes a paper by Bondesson (1975) where he proves the non-existence of a UMV-estimator of θ, provided that the tail of the density tends to zero rapidly enough.

A: As pointed by Xi'an, an example where no best unbiased estimator exists is $x\sim\mathcal{U}[θ−1,θ+1]$. The proof is very technical and it might be interesting to extend it to "almost any $p$" which may be very difficult.
However the model here has a strong invariance property under translation. It makes sense looking only at equivariant estimators $S$ who are those such as:
$$S(X+(t,t,....t))=S(X)+t$$
Intuitively: when you shift the whole data, you shift the estimator just the same which sounds pretty natural. While there may be no best unbiased estimator, there is a unique best equivariant estimator.
Equivariant estimators have constant MSE simply because their distribution just shifts with $\theta$. As a consequence they can be compared with a total order and you can simply evaluate their MSE under $\theta=0$. Note that they all have constant bias and can always be recentred to improve them. Thus the best equivariant estimator is necesserely unbiased.
To construct the best equivariant estimator, just write the ancillary statistics $\Delta=(X_2-X_1,X_3-X_1,...,X_n-X_1)$. It is easy to see that the equivariant estimators are those such as:
$$S(X)=X_1-f(\Delta)$$
Now the best $f$ is the one such as the MSE is the smallest (for example under $\theta=0$), it minimize $E_0((X_1-f(\Delta)^2)$ and the unique solution is $f(\Delta)=E_0(X_1|\Delta)$ : the projection of $X_1$ onto the space of $\Delta$-measurable variables. Note that other ancillary statistics could be used and would yield the same estimator.
Thus the best equivariant estimator is:
$$\hat\theta = X_1-E_0(X_1|\Delta)$$
For the general theory of equivariant estimators see: Invariant estimation. This estimator is known as the Pitman equivariant estimator.
Other equivariant estimators include:

*

*recentered (debiased) MLE

*Bayesian $E(\theta|X)$ with uniform prior on $\theta$

We can be sure they are not better. But in fact our Pitman estimator is the same as the Bayesian one (see the reference). MLE however is generally less good. See Xi'an answer for an example for the Cauchy distribution.


text:
Q: CTE to get all children and nested children of every parent I'm stuck in a problem that continuously hammering in my mind to find the solution.
I have a users table with 6k of rows and they are related as parent-child. The problem is that I want results not only at a single level parent-child relationship but at all levels (until the last child) for every userid.
I have this data in my users table.
UserID | ParentID
1        NULL
2        1
3        1
4        2
5        2
6        5
7        6
8        6
9        NULL

I want this data as the output of CTE.
ParentID  |  UserID
1            1
1            2
1            3
1            4
1            5
1            6
1            7
1            8
2            2
2            4
2            5
2            6
2            7
2            8
3            3
4            4
5            5
5            6
5            7
5            8
6            6
6            7
6            8
7            7
8            8
9            9

Note: The ParentID includes not only its children but also children of its children and itself too. I'm using MSSQL 2019.

A: In first part of cte select all the rows with ownid as root id. Then in second part (after union all) select parentid as rootid.
Schema and insert statements:
 create table users (UserID int,  ParentID int);
 insert into users values (1,        NULL);
 insert into users values (2,        1);
 insert into users values (3,        1);
 insert into users values (4,        2);
 insert into users values (5,        2);
 insert into users values (6,        5);
 insert into users values (7,        6);
 insert into users values (8,        6);
 insert into users values (9,        NULL);

Query:
 with cte as
 (
   select userid rootid, userid, parentid from users
   union all
   select cte.rootid rootid, users.userid, users.parentid from users
   inner join cte on users.parentid=cte.userid
 )
 select rootid parentid,userid from cte
 order by rootid ,userid
 option (maxrecursion 0)

Output:

parentid
userid

1
1

1
2

1
3

1
4

1
5

1
6

1
7

1
8

2
2

2
4

2
5

2
6

2
7

2
8

3
3

4
4

5
5

5
6

5
7

5
8

6
6

6
7

6
8

7
7

8
8

9
9

db<fiddle here


text:
Q: Netbeans Symfony : The "--xml" option does not exist. I am trying to make a first Symfony project (LoginProject) in Netbeans. But I don't get too far. The tutorial tells me:
- to right-click the project
- symfony > run command
then I am getting no available commands in the screen, and I get the error message:
     [Symfony\Component\Console\Exception\RuntimeException]
  The "--xml" option does not exist.

list [--raw] [--format FORMAT] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<namespace>]

I have xampp installed, and the LoginProject is under de htdocs, nothing special.
How can i overcome this error?

A: It would be nice to know wich tutorial you are following.
if your Symfony project is not created it is perfectly normal that there are no available commands.
Anyways you should create your project with symfony new command of the Symfony installer or composer create-project symfony/framework-standard-edition and run your commands from the console with php app/console.Don't rely too much on (the unreliable) netbeans.
Here is the tutorial you should be following since it is what Symfony recommends: http://symfony.com/doc/current/setup.html
Regarding the error, when you

right-click the project - symfony > run command

netbeans tries to execute a command to show you the available commands in your project.
To do that it calls the command with the --xml option so that the output is in xml and netbeans can parse it.
So either the command it is trying to execute does not have the --xml option or there is just no such command.


text:
Q: Why are details not being returned for spring health indicator? I am currently using spring boot 2.1.4 and jackson 2.9.8
When hitting the health endpoint the details are not displayed.
{
  status: "UP"
}

I have added the following property to my configuration.
management.endpoint.health.show-details=always

When I look at the environment management.endpoint.health.show-details it is set.
When I monitor org.springframework.boot.actuate.health.HealthWebEndpointResponseMapper.HealthWebEndpointResponseMapper(HealthStatusHttpMapper, ShowDetails, Set<String>) it is showing that ALWAYS is in fact being used, and details is not being stripped out.
However, when it gets to com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector it doesn't add details, because the method getDetails has not been annotated in org.springframework.boot.actuate.health.Health like it has with getStatus (being @JsonWrapped)
How do I get details to be serialized by Jackson, so they can be returned via the health endpoint?
EDIT: This appears to be getting caused by a custom ObjectMapper that is being injected into the spring environment at startup which sets both AUTO_DETECT_GETTERS and AUTO_DETECT_IS_GETTERS to disabled. While this may of worked in spring 4, it no longer appears to work in spring 5.


text:
Q: Google Charts API problems I'm using PHP to make a call to Yahoo Finance's API for various financial markers.  I've been graphing these using Google's Chart API.  I have 4 charts which have always shown up until a few days ago.  I can't figure out what's going on.  It will only show one graph at a time.  All of the data is being loaded successfully for all 4 graphs, but only show one graph.  Any advice would be appreciated!

A: Solution is easy U will make only one callback.Dont write function for every chart. do it all in one function.
    google.load('visualization', '1.1', {packages: ['line']});
google.setOnLoadCallback(drawChart);
function drawChart() {
  var data = new google.visualization.DataTable();
  data.addColumn('number', 'Day');
  data.addColumn('number', 'Stock Index(%)');
  data.addRows([
    <?=$stockIndex?>
  ]);

  var options = {
    chart: {
      title: 'Stock Index',
    },
    width: 1100,
    height: 900
  };
  var chart = new google.charts.Line(document.getElementById('stocks'));
  chart.draw(data, options);

  var data2 = new google.visualization.DataTable();
  data2.addColumn('number', 'Day');
  data2.addColumn('number', 'Stock Index(%)');
  data2.addColumn('number', '12-Day EMA');
  data2.addColumn('number', '26-Day EMA');

  data2.addRows([
    <?=$stockTwelveTwentySix?>
  ]);

  var options2 = {
    chart: {
      title: 'Stock Index w/12-day and 26-day EMA',
    },
      width: 1100,
    height: 900
  };

  var chart2 = new google.charts.Line(document.getElementById('twelvetwentysixday'));
  chart2.draw(data2, options2);

  var data3 = new google.visualization.DataTable();
  data3.addColumn('number', 'Day');
  data3.addColumn('number', 'Stock Index(%)');
  data3.addColumn('number', '12-Day EMA');

  data3.addRows([
    <?=$stockTwelve?>
  ]);

  var options3 = {
    chart: {
      title: 'Stock Index w/12-day EMA',
    },
     width: 1100,
    height: 900
  };
  var chart3 = new google.charts.Line(document.getElementById('twelvetwentyday'));
  chart3.draw(data3, options3);

  var data4 = new google.visualization.DataTable();
  data4.addColumn('number', 'Day');
  data4.addColumn('number', 'Stock Index(%)');
  data4.addColumn('number', 'Lower BB');
  data4.addColumn('number', 'Upper BB');

  data4.addRows([
    <?= $bb ?>
  ]);

  var options4 = {
    chart: {
      title: 'Stock Index w/Bollinger Band Comparisons',
    },
     width: 1100,
    height: 900
  };
  var chart4 = new google.charts.Line(document.getElementById('Bollinger'));
  chart.draw(data4, options4);
  }

do it somthing like that .


text:
Q: Python error "No numeric types to aggregate" when trying to use df.resample Hello everyone I am running a code that takes minute data for a month and averages it into hourly.  The code works on some of my files, but not others. I get a very large error and it says "No numeric types to aggregate".  The error is coming from the df = df.resample('1H').mean() line.
Here is the data I am using.
https://www.dropbox.com/s/k8c77572an2pk8n/OCTTEST.csv?dl=0

Here is the code I am using.
import pandas as pd

df = pd.read_csv("octtest.csv", index_col="DateTime", parse_dates=True, low_memory=False)
df = df.resample('1H').mean()
df = df.reindex(pd.date_range(df.index.min(), df.index.max(), freq="1H"))
df.to_csv('output.csv', index=True, index_label="DateTime")

A: There is problem NaN values are Null, what is not default value of parameter na_values, so need add it docs:
df = pd.read_csv("octtest.csv",
                  index_col="DateTime",
                  parse_dates=True,
                  na_values='Null',
                  keep_default_na=False)


text:
Q: Javascript/XML - Getting the node name I need to get the the name of the tag "myChild" and the "content".
This is simple, but i am stuck, sleepy and here is what I get with my tests:
XML:
...
<myParent>
  <myChild>content</myChild>
</myParent>
<myParent>
  <myChild>content</myChild>
</myParent>
...

JS:
var x=xmlDoc.getElementsByTagName("myParent");
alert(x[1].childNodes[0].nodeName); //returns "#text" - "myChild" needed
alert(x[1].childNodes[0].nodeValue); //returns "" - "content" needed

A: You want tagName, which is the name of the element. (Sorry about that, for Elements, tagName and nodeName are the same.)
The problem is that the first child of your myParent element isn't the myChild element, it's a text node (containing whitespace). Your structure looks like this:

*

*Element "myParent"

*

*Text node with a carriage return and some spaces or tabs

*Element "myChild"

*

*Text node with "content"

*Text node with a carriage return and some spaces or tabs

*Element "myParent"

*

*Text node with a carriage return and some spaces or tabs

*Element "myChild"

*

*Text node with "content"

*Text node with a carriage return and some spaces or tabs

You need to navigate down to the actual myChild element, which you can do with getElementsByTagName again, or just by scanning:
var x=xmlDoc.getElementsByTagName("myParent");
var c = x[1].firstChild;
while (c && c.nodeType != 1) { // 1 = ELEMENT_NODE
    c = c.nextSibling;
}
alert(c.nodeName); // "myChild"

Note that Elements don't have a meaningful nodeValue property; instead, you collect their child text nodes. (More in the DOM specs: DOM2, DOM3.)
Also note that when indexing into a NodeList, the indexes start at 0. You seem to have started with 1; ignore this comment if you were skipping the first one for a reason.

Off-topic: It's always best to understand the underlying mechanics of what you're working with, and I do recommend playing around with the straight DOM and referring to the DOM specs listed above. But for interacting with these trees, a good library can be really useful and save you a lot of time. jQuery works well with XML data. I haven't used any of the others like Prototype, YUI, Closure, or any of several others with XML, so can't speak to that, but I expect at least some of them support it.

A: Try x[1].getElementsByTagName('*')[0] instead.
(This is only trustable for index 0, other indexes may return elements that are not child-nodes, if the direct childs contain further element-nodes. )


text:
Q: c# get parent from chlid instance I try to get the parent Type of a instance.
How can I do ?
Example :
public class a
{
     public b { get; set; }
}

public class b
{

}

var a = new a();
a.b = new b();

var parentType = a.b.??GetParentInstanceType()??

A: You can't.
You'd need to add a property to the child manually to keep track of the parent:
Here is one way:
public class A
{
    public B<A> Child { get; set; }
}

public class B<T>
{
    public T Parent { get; set; }
}

A a = new A();
a.Child = new B<A>();
a.Child.Parent = a;

Type parentType = a.Child.Parent.GetType();

Of course the problem here is that nothing stops you from forgetting to set Parent or setting the wrong Parent.


text:
Q: Fail to grep by first character I'm trying to list all files and select only certain from them.
ls -1 return me the list
abc
abcd
rm_0818-051752-753-06

after that I want to select only by this criteria to return the 3rd line so I do:
ls -1 | grep -E "^rm_.*"
but I get nothing.
I'm trying to recognize the first character of 3rd line in this way:
var=$(ls -1 | grep -E "rm_")
echo $var //returns rm_0818-051752-753-06
echo ${var:0:1} //returns some strange symbol 001B in square

Can you explain me this behavior and how could I grep by first character ^? Thanks

A: ls -1 | grep -E "^rm_.*" looks good and should work. Possible reason why it doesn't work is alias bound to ls command in your profile.
To ensure, try
/bin/ls -1 | grep -E "^rm_.*"

A: It sounds like you have grep aliased to grep --color=always or similar. You can check this by running type grep. I can reproduce a similar behavior:
$ var=$(ls -1 | grep --color=always "^rm")
$ echo ${var:0:1}
## Weird boxed character appears here

To see what's happening a bit better, we can pass $var through od:
$ echo "$var" | od -c
0000000 033   [   0   1   ;   3   1   m 033   [   K   r   m 033   [   m
0000020 033   [   K   _   0   8   1   8   -   0   5   1   7   5   2   -
0000040   7   5   3   -   0   6  \n
0000047

The 033   [   0   1   ;   3   1   m 033   [   K are ANSI color escapes, and that's what's breaking here. You can avoid that by using an unaliased version of grep:
/bin/grep '^rm_'

or
\grep '^rm_'

Even better, don't parse ls since that often leads to other problems. A safer and simpler way of doing what you want is:
$ var="rm*"
$ echo $var
rm_0818-051752-753-06
$ echo ${var:0:1}
r

A: Why grep, why not just:
ls -1 rm_*


text:
Q: Google maps : Possible to add multiple businesses with co-ords not postcode? We're keen to get our database of businesses onto googlemaps' own database by uploading a data file here : http://www.google.com/local/add/analyticsSplashPage?hl=en-gb&gl=gb
our address data is in co-ords format but it looks like it only works with a postcode - is there a method for using co-ordinates instead?

A: If you're storing latitude/longitude values, you can convert them into postal codes (reverse geocoding).
There's an example in Google maps docs:
http://code.google.com/apis/maps/documentation/services.html#ReverseGeocoding


text:
Q: Remove Grub safely a long time ago, I installed GRUB with ubuntu boot loader. Today, I am not using Ubuntu anymore, I came back on Windows 10 (which is my main OS). I saw many tutorials on internet to remove GRUB (and maybe Ubuntu), but I don't know which one to trust. Can you tell me what to do to simply and safely delete (not just hide/disable/etc...) GRUB from my computer?

A: What I did (and it was a really bad idea), is to remove ubuntu partition. Then, at startup, GRUB will show but nothing else happen. So you have to go in boot menu (F12 for my laptop ACER) and boot Windows. Then follow this tutorial Uninstall Grub and use Windows bootloader


text:
Q: CoreFoundation.h' file not found when active scheme is the device I wanted to update an old app for the ios6 and retina 5 inch!
The app works fine on simulator but when setting the active scheme as my device it fails. Trying to fix the problem in two hours and no luck! Any tips?

A: Go to Projects->Target->Build Phases->Link Binary with Libraries, and make sure the CoreFoundation.framework is there.

A: SET Always Search User Paths = YES worked for med


text:
Q: Como implementar um reduce para transformar um array em um objeto // 30) Escreva um algoritmo que percorre um vetor de inteiros e defina o maior e menor valor dentro do vetor.
const maiorEMenorValor = (vetor) => {
  return vetor.reduce((prev, current) => {
    if(prev.maiorValor < current) {
      return prev.maiorValor = current
    }else if(prev.menorValor > current) {
      return prev.menorValor = current
    }
  },{menorValor: 0, maiorValor: 0})
}
const vetor2 = [20, 16, 3, 12, 5, 34, 6, 13, 71, 178, 24332, 1, 88]
console.log(maiorEMenorValor(vetor2))

A: No fim das contas basta retornar o objeto a cada iteração do reduce no array...
const maiorEMenorValor = (vetor) => {
  return vetor.reduce((acc, el) => {
    let novoMaiorValor
    let novoMenorValor
    if(acc.maiorValor < el) {

      novoMaiorValor = el
      novoMenorValor = acc.menorValor

    }else if(acc.menorValor > el) {

      novoMaiorValor = acc.maiorValor
      novoMenorValor = el

    }
    return {
      maiorValor: novoMaiorValor ? novoMaiorValor : acc.maiorValor,
      menorValor: novoMenorValor ? novoMenorValor : acc.menorValor
    }
  },{ maiorValor: 0, menorValor: vetor[0]})
}
const vetor2 = [20, 16, 3, 12, 5, 34, 6, 13, 71, 178, 242, 1, 88]

console.log(maiorEMenorValor(vetor2))


text:
Q: SQLAlchemy: How to order query results (order_by) on a relationship's field? [revisited] This is a duplicate of this question, but I don't understand the answer. I think it is flawed, because this query:
session.query(Base).join(Base.owner).order_by(Player.name)

results in duplicate joins:

*

*joins coming from relationships (lazy='joined') specified on Base class

*joins specified in the query

Base table is joined with 5 copies of Player table. This does not look too efficient!
At least this is the way it seems to work in SQL Alchemy 0.9.1.
Does anyone have a better answer to that question?

A: This is on purpose and is documented here: http://docs.sqlalchemy.org/en/rel_0_9/orm/loading.html?highlight=eagerload#contains-eager
Populating relationships is separate from joining for filtering by default.  To cut down on the duplicate joins, you can use query.options(contains_eager(Base.owner) to make the join populate the relationship.
Since you say there are five joins appearing, I assume you have other relationships with lazy='joined', those will by definition need a join one way or another.  contains_eager just cuts down on duplicates in some situations.  Another solution is to set lazy='select' (or not have it at all) to make the relation lazy.


text:
Q: Webpack - optimizarion node_modules & import Configuring webpack I was wondering something for the optimization. I have two JS files index.js and helper.js. I import helper.js in index.js like that:
import * as helper from 'helper.js';

In these two JS files, I import some node_modules.
Regarding this, to prevent duplication code and caching you can do that:
  const path = require('path');
  const { CleanWebpackPlugin } = require('clean-webpack-plugin');
  const HtmlWebpackPlugin = require('html-webpack-plugin');

  module.exports = {
    entry: {
      index: './src/index.js'
    },
    output: {
      filename: '[name].[contenthash].js',
      path: path.resolve(__dirname, 'dist')
    },
    optimization: {
      runtimeChunk: 'single',
      splitChunks: {
        cacheGroups: {
          vendor: {
            test: /[\\/]node_modules[\\/]/,
            name: 'vendors',
            chunks: 'all'
          }
        }
      }
    }
  };

*

*If I understand well for the optimization, it's only created one vendor file from the folder node_modules ? It will import everything from the folder node_modules even if I don't use everything (for example the devDependencies) ?

*Does it take in account the import of helper.js done in index.js in the vendor ?

*Why do they use runtimeChunk in the link provided ?
Or should I do just something like that:
optimization: {
  splitChunks: {
    chunks: 'all'
  }
}

Hope you could help me

A: You don't need the test as it defaults to node_modules. It will only compile the ones you use. Remember to include that file first before your app one(s) when including them from your html.
It will split all vendor modules out regardless of what file they are included from.
It's worth noting though that since you're importing helper.js into index.js and creating one bundle, webpack will already not duplicate the node_modules but share them, so long as helper.js is not a third party module compiled as a non-es6 module.
In other words webpack will automatically tree shake stuff in your own source files, and es2016 modules in node_modules (not CJS/UMD modules which is the most common).
You only need to split to a vendor bundle if:
a) Your vendor bundle changes with a lot less frequency than your src code (not that common if you're often running npm update)
b) You're producing multiple output files and you want them to share vendor.js / you don't want to declare them as external and make the consumer install them (e.g. a library of components)
P.S. Not exactly sure what runtimeChunk is for but personally I would not specify it (leave it as default) unless you have a good reason.


text:
Q: mysql select COUNT join is failing to return records that don't match I'm using the current sql:
SELECT
    applications.*,
    COUNT(pricingplans.PricingPlanID) AS PricingPlanCount

FROM
    applications

LEFT OUTER JOIN pricingplans ON
    pricingplans.ApplicationID = applications.ApplicationID

The problem is that one application has 1 pricing plan to link to... The other does not, so I only get results back for the one that could satisfy the join.. whereas I really want it to say 0 if an application could not satisfy the join...
What am I doing wrong... I thought LEFT OUTER JOIN was for that specific reason?
applications table:
contains 2 applications.
pricingplans table:
contains 1 pricing plan that links to 1 of the above applications
my query:
returns only 1 result because only 1 of the JOINS could be satisfied... I want to actually have both applications come back but the count would say 0 coz it couldn't do a join.

A: Have you tried anything like..
SELECT
    applications.*,
    COUNT(pricingplans.PricingPlanID) AS PricingPlanCount

FROM
    applications

LEFT JOIN pricingplans ON
    pricingplans.ApplicationID = applications.ApplicationID

GROUP BY
    applications.ApplicationID


text:
Q: Doxygen: automatically generate list of references to different classes I have a project which contains several interface to other programs. These interfaces are defined as classes and spread out over the project.
I wonder whether it is possible that I can set a marker in the class description and doxygen later generates a list of links to all the markers.
e.g:
 /** \marker interface **/
   class Interface_01
  {
  }
/** \marker interface **/
class Interface_02
{
}

In a different doxygen file:
\listmarker interface

Which should then lead to something like this in the output:
* Interface_01
* Interface_02

A: This problem looks a bit like a problem for \xrefitem.
In the documentation:

*

*the paragraph Aliases with arguments (http://doxygen.nl/manual/custcmd.html#custcmd_complex).

*the command \xrefitem (http://doxygen.nl/manual/commands.html#cmdxrefitem)


text:
Q: How many dragon souls do I need to unlock all shouts? There are 20 shouts in Skyrim, each with 3 levels of power. However, some of these shouts require dragon souls to unlock, and others are simply given to the player as gifts / quest rewards. (e.g., Clear Skies, Call Dragon, Call of Valor et al)
My question is:
What is the minimum number of dragons you must kill to be able to possess all 20 shouts at their full power?

A: From what I see here it looks like 18 are learned without requiring dragon souls, though I'm extrapolating a bit since I haven't reached the end of the main quest yet, myself.
Fuzzy math:
Animal Allegiance     3 Souls
Aura Whisper          3 Souls
Become Ethereal       3 Souls
Call Dragon           0 Souls*
*I'm making the assumption that this works a bit like Unrelenting Force
Call of Valor         0 Souls
Clear Skies           0 Souls
Disarm                3 Souls
Dismay                3 Souls
Dragonrend            0 Souls
Elemental Fury        3 Souls
Fire Breath           2 Souls
Frost Breath          3 Souls
Ice Form              3 Souls
Kyne's Peace          3 Souls
Marked for Death      3 Souls
Slow Time             3 Souls
Storm Call            3 Souls
Throw Voice           3 Souls
Unrelenting Force     1 Soul
Whirlwind Sprint      2 Souls

So...3+3+3+0+0+0+3+3+0+3+2+3+3+3+3+3+3+3+1+2 = 44


text:
Q: Dealing with floating point point inaccuracy in very small numbers efficiently The program I am working with takes OpenStreetMap data to render a map. The data consists of 4 coordinates, that make up the bounds of the data.
I am drawing lines, that sometimes exceed these bounds - I want to make the lines stop at the exact point of the bounds, when a line consisting of a point inside & and outside the bounds occur. Since I have knowledge of the points of the bounds, and the point inside and outside the bounds - I can calculate the intersection between these two lines, but the inaccuracy is very inconsistent. In the
first picture attached, you can see, where the intersection is on the line. On the second picture attached, you can see where the intersection is supposed to be between - this is the worst case I have experienced.
These are the coordinates I am working with:

*

*Point one: x: 7.040283679962158, y: -55.59856033325195

*Point two: x: 7.04131555557251, y: -55.5977783203125

*Point three: x: 6.991822718617924, y: -55.5984

*Point four: x: 7.2029868530932735, y: -55.5984

*Intersection point: x: 7.039072513580322, y: -55.5984001159668

*Wolfram alpha suggests that x should be approx. 7.0405.
As the numbers are very small and the calculations are many, I suppose that there is a lot of loss inbetween the calculations, this is the code, that does the calculations - sorry for forcing you to read this discount-ghetto-code. OSMNode contain longitude and latitude coordinates - so they act as Point2D in this sense.
private OSMNode calculateIntersectionNode(OSMNode line1Node1, OSMNode line1Node2, OSMNode line2Node1, OSMNode line2Node2) {
    double lon1 = line1Node1.getLon();
    double lon2 = line1Node2.getLon();
    double lon3 = line2Node1.getLon();
    double lon4 = line2Node2.getLon();
    double lat1 = line1Node1.getLat();
    double lat2 = line1Node2.getLat();
    double lat3 = line2Node1.getLat();
    double lat4 = line2Node2.getLat();
    double intersectionLon = ( ( (((lon1*lat2) - (lat1*lon2)) * (lon3-lon4)) - ((lon1-lon2) * ((lon3*lat4) - (lat3*lon4))) ) / ( ((lon1 - lon2) * (lat3 - lat4)) - ( (lat1 - lat2) * (lon3 - lon4)) ) );
    double intersectionLat = ( ( (((lon1*lat2) - (lat1*lon2)) * (lat3-lat4)) - ((lat1-lat2) * ((lon3*lat4) - (lat3*lon4))) ) / ( ((lon1 - lon2) * (lat3 - lat4)) - ( (lat1 - lat2) * (lon3 - lon4)) ) );
    return new OSMNode(intersectionLon, intersectionLat);
}

Do I throw more precision at the code somehow? Do I change the way that I calculate the intersection or something third - I am currently empty inside my head.
Thanks in advance!

A: As suspected, the fault was my own - the issue was an index error, which was extremely hard to spot, due to  working with a function returning exclusive index-values, while I was working with inclusive in the rest of the class.
I don't know what tradition is around here - do I close the question or delete it?


text:
Q: iOS 10 message effects send to phone number but not email address If I send an iMessage to my son using his phone number, the new message effects work without issue.  If I send an iMessage to him using his email address (still in Messages), they do not work and show the parenthetical text ("Sent with xxxx effect") when he receives the message.  When I send it, I see the desired effect.  Neither of us have reduce motion or anything of the sort turned on.  Note that they are both "blue" iMessage conversations.
I've tried deleting the conversation where it was failing (to his email) and that didn't change anything.
Is there a reason why he would see the effects if I send to his phone number vs. his email address?

A: This may sound bizarre but you obviously have searched and checked and/or corrected the most common reasons of why it does not work correctly.
There is one thing that I am seeing a lot of on forums that you have not mentioned.

I fixed this by going to Settings/Messages, then turning iMessage on
  and off.


text:
Q: Avoid automatically connecting to wireless network on windows 7 I have a internet connection with a Wi-Fi router. I use my Dell laptop to connect to it and it automatically connects to this network whenever it is available. This is just fine for me, However, sometimes one more wireless network becomes visible in my range and it seems my laptop tries to automatically connect to that network also. This causes a momentatry loss of network which is very irritating. Is there any where to configure windows not to try to connect to other networks than the one I use?

A: You can open the Network and Sharing Center.  On the upper left, click "manage wireless networks".  right click the wireless network that is giving you trouble, and choose properties.  Uncheck the "Connect automatically when this network is in range".
Do you use a common SSID name, like "home" or "linksys"?  Wireless can be rather dumb.  We have a person that has a home network called "linksys".  when she is in the office, her computer sees a wireless network called "linksys" and connects.  However, that network is the building across the street, so she can't get to our network stuff.
We had her rename her how SSID to something much less likely to be duplicated, and that has fixed her problem.

A: Are you using an Intel Wireless Adapter? If so your wireless adapter has been set to connect to free hotspot automatically. To disable, open Intel PROSet/Wireless Tools (you can do that by searching it on your start menu), under "Intel Wifi Hotspot Assistant" click "Settings" and untick "Automatically Connect to Free Wifi hotspots"


text:
Q: Why does this regex not match in Python? I have the regular expression
(GET|POST) (/api/\w+) (HTTP/1\.\d)(?:.*\\r\\n\\r\\n)(\S+)?

which I'm trying to match against HTTP GET and HTTP POST requests. I'm using the helpful regex101.com website to format my regular expression, and according to it, the regular expression should match both the formats I'm seeking.
Here's my regular expression on regex101.com.
However, when I input into Python itself and call re.split(), (on an input of strings), it doesn't split the POST request. It only splits the GET request. I thought it had something to do with the way regex101 parses \r\n (CRLF) versus how Python does it, so I double-checked and made sure that in Python, I actually type in \r\n\ inside the regex, and not \\r\\n, as I did in regex101. Yet it still doesn't work.
How can I get the regular expression to work inside Python?

A: Your'e just missing an additional \r\n after HTTP/1.0. This will work:
'POST /api/gettime HTTP/1.0\r\n\r\nContent-Length: 13\r\n\r\n100000+200000'


text:
Q: reloading tableView of one view controller from a pushed view controller I've got a Parse background block that uploads some data. This occurs in a view controller (lets call it addDataViewController) that was pushed onto another view controller (where my table view is, lets call that tableViewController). I need to reload that tableView when the data finishes uploading. Ive got a navigation controller embedded in my storyboard so ive tried doing
//In addDataViewController
//when the data finishes uploading
self.navigationController.viewControllers objectAtIndex:0];

but for some reason the viewController stack was nil.
Then I tried referencing tableViewController as a property of the addDataViewController in prepare for segue of tableViewController. I added a tableViewController property to my h file of addDataViewController
//in prepare for segue of tableViewController
dataViewController.tableViewController = self;

then referenced that objects tableView and called reloadData, but nothing seemed to happen
[self.tableViewController.tableView reloadData];

I thought for sure that would have worked, but it didnt. Any ideas?

A: one approach is to use notifications. in your addDataViewController you would fire a notification, when the update is done:
[[NSNotificationCenter defaultCenter] postNotificationName:@"UpdateDone" object:nil];

in your tableViewController you would subscribe to the notification in viewDidLoad:
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(doSomething)
                                             name:@"UpdateDone"
                                           object:nil];

and then:
-(void)doSomething {
    [self.tableView reloadData];
}

A: If you are importing view controller then you must use [self.addChildViewController:tableViewController.view];
hope this will help.


text:
Q: iPhone 6 Plus Touch ID Sensor developing oily-like "rainbow colors" on its surface I've bought my iPhone 6 Plus back in September 2014 and it's Touch ID sensor has been developing "oily-like" rainbow colors lately. I've tried cleaning it with water, screen cleaners etc. but it's not going away. Here is a picture of it:

It's not oily or anything, but it appears so. However, Touch ID is working perfectly, it's just a visual artifact affecting its look, not its operation.
Is there a way to get rid of that "layer", or should it get it replaced under warranty?

A: There is a layer between the sensor and the glass that covers it, sometimes liquids can get in depending on pressure. It looks like an oily substance has seeped in between the sensor and the glass and no cleaning agent will therefore work (I was going to suggests isopropyl alcohol).
Try your warranty first, it's a cheap replacement at your local shaman otherwise.


text:
Q: :not(:target) Selector Css I am making a basic slide demo and i got a problem with :not(:target) selector
i want to have my base slide at first. but when i try this code i got a blank page.
here my code and my css file.
thanks in advance.
<!DOCTYPE html>

<meta charset="UTF-8">
<title>order form</title>

<link href="slide.css" rel="stylesheet" type="text/css">

Θέμα ενότητας

Σκυλος :

next

Setter

 next

Ευχαριστώ!

Closing credits

*csss
a.button {
    -webkit-appearance: button;
    -moz-appearance: button;
    appearance: button;

    text-decoration: none;
    color: initial;
}

:not(:target){
    display:none;
}

:first-of-type:not(:target) {display:block;}

A: You get a blank page because the :not(:target) applies to all elements.
You probably want article:not(:target) (the same goes for the :first-of-type rule)
Keep in mind though that if you make an overriding rule to display your first slide, it will always remain active.

To use this technique you will have to place your first slide as the last one (in the DOM). This way you can target it with article:last-of-type to show it at start and then use the more specific article:target ~ article:last-of-type to hide it when another one is active.
Something like this

a.button {
    -webkit-appearance: button;
    -moz-appearance: button;
    appearance: button;

    text-decoration: none;
    color: initial;
}

article,
article:target ~ article:last-of-type{
    display:none;
}

article:target,
article:last-of-type{display:block;}

Θέμα ενότητας

Setter

    next

Beagle

    start

Σκυλος :

    next

Ευχαριστώ!

Closing credits


text:
Q: setTimeout not delaying function call in $.each I several divs on my site, I'd like to update one by one. In order not to spam the server with 200+ requests at once, I'd like to delay them by 1s each.
What I tried:
var $tourBox = $('.tour-box');
$tourBox.each(function () {
    var $box = $(this);
    setTimeout(function () {
        getUpdate($box);
    }, 1000);
});

The update function:
function getUpdate($box) {

    var $so = $box.attr('data-so');
    var $url = $('#ajax-route-object-status').val();
    $.get($url, {
        so: $so
    }).success(function (data) {
        var $bg = 'bg-gray';
        if (data.extra.isStarted === true && data.extra.isFinished === false) {
            $bg = 'bg-orange'
        }
        if (data.extra.isStarted === true && data.extra.isFinished === true) {
            $bg = 'bg-green'
        }
        if (data.extra.isLate === true && data.extra.isFinished === false) {
            $bg = 'bg-red'
        }
        $box.removeClass('bg-gray').removeClass('bg-green').removeClass('bg-orange').removeClass('bg-red').addClass($bg);
    });
}

In Chrome Dev--> Network it shows the all loaded as pending and then loads them one by one, but w/out the delay:

As you can see between 3907 and 3940, there is merely half a second delay. This doesn't change even if I have a timeout of 5000.

A: Back in 2008 I wrote a slowEach() plugin for jQuery that does what you're looking for. It's basically a drop-in replacement for $.each() and $(...).each() that takes a time interval, so the callback is called with that amount of delay for each element:
jQuery.slowEach = function( array, interval, callback ) {
    if( ! array.length ) return;
    var i = 0;
    next();
    function next() {
        if( callback.call( array[i], i, array[i] ) !== false ) {
            if( ++i < array.length ) {
                setTimeout( next, interval );
            }
        }
    }
};

jQuery.fn.slowEach = function( interval, callback ) {
    jQuery.slowEach( this, interval, callback );
};

With that code, you can then do:
$('.tour-box').slowEach( 1000, function() {
    getUpdate( $(this) );
});

One thing to note about this code is that it uses only a single timer at a time, instead of making hundreds of setTimeout() calls to fire up multiple timers at once. This makes it much easier on system resources.

A: Your for each is calling all of the timeouts at once. It is not waiting one second in between calling each time out. So you have thousands of objects that are being scheduled to call getUpdate($box); after one second.
What you can do is increase the timeout in each iteration.
var $tourBox = $('.tour-box');
var delay = 1000;
$tourBox.each(function () {
    var $box = $(this);
    setTimeout(function () {
        getUpdate($box);
    }, delay);
    delay += 1000;
});

This will cause your first timeout to be fired after 1 second, and your second after two seconds and so on.

A: Calling one by one could be another solution to avoid spam like request.
In that case, this could be a solution:
$(document).ready(function(){

    var $tourBox = $('.tour-box'),
        curIndex = 0,
        totalBox = $tourBox.length,
        url = $('#ajax-route-object-status').val(),

    function getUpdate(){

        var $box = $tourBox.get( curIndex );

        if ( typeof $box === 'undefined'){
            // No more box to process
            return; // exit
        }

        var $so = $box.attr('data-so');

        $.get($url, {
            so: $so
        }).success(function (data) {
            var $bg = 'bg-gray';
            if (data.extra.isStarted === true && data.extra.isFinished === false) {
                $bg = 'bg-orange'
            }
            if (data.extra.isStarted === true && data.extra.isFinished === true) {
                $bg = 'bg-green'
            }
            if (data.extra.isLate === true && data.extra.isFinished === false) {
                $bg = 'bg-red'
            }
            $box.removeClass('bg-gray').removeClass('bg-green').removeClass('bg-orange').removeClass('bg-red').addClass($bg);
        }).always(function(){

            // Increment index to process
            curIndex++;

            // Finished either with success or failed
            // Proceed with next
            getUpdate();
        });
    }
});


text:
Q: REST API - Automatically make requests by clicking submit I have this script but I don't know how to run it automatically when I click submit button

This is the form
<form method="" action="">
    Full Name:
    <input type="text" name="full_name" id="full_name">

    <input type="submit" value="Send">
</form>

I would like to know how do I run the script automatically and get a success message (true or false)

A: Try this:
<form method="" action="" onSubmit="callApi()">
    Full Name:
    <input type="text" name="full_name" id="full_name">

    <input type="submit" value="Send">
</form>

function callApi() {

  //Get access token
      $.post(
         "https://" + cbIntegrationId + ".caspio.com/oauth/token",{
          grant_type: "client_credentials",
          client_id: clientId,
          client_secret: clientSecret
          },
        function(cbAuth){
//Run POST call
$.ajax({
  url: "https://" + cbIntegrationId + ".caspio.com/rest/v2/tables/" + tableName + "/records?response=rows",
  type: 'POST',
  'data': JSON.stringify({"UniqueID":"34","Full_Name": "Name_Value"}), //Define record values
  headers: {
    "Authorization": "Bearer " + cbAuth.access_token, //Extracts the access token from the initial authorization call
    "Content-Type": "application/json", //Required, otherwise 415 error is returned
    "Accept": "application/json"
  },
  dataType: 'json',
  success: function (data) {
    console.log(data.Result); //Check the console to view the new added row
  },
  error: function(data) {
    console.log(data.responseJSON); //Check the console to view error message if any
  }
  });
   }
);

}
    </script>

Maybe you need to change UniqueID and Full_Name. If Full_Name is the user input on the form, you can get like this:
$('input[name="full_name"]').val()


text:
Q: Random sprite generation? Currently I'm making a simple shooter game where each time a sprite is pressed it will increment the hitcount and allow for a high score. Currently the sprite will enter from the left and will increment each time making it enter lower down the screen each time unless it has reached the bottom where it will start again from the top. What I want to do is change it so that the y coordinate will generate a random number but when I tried to make y = random.nextInt() the sprite just didn't load so I'm not sure what to do, any help would be appreciated at all thanks.
 package cct.mad.lab;

import java.util.Random;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;

public class Sprite {

//x,y position of sprite - initial position (0,50)
private int x = 0;
private int y = 50;
private int xSpeed = 17;//Horizontal increment of position (speed)
private int ySpeed = 5;// Vertical increment of position (speed)
private GameView gameView;
private Bitmap spritebmp;
//Width and Height of the Sprite image
private int bmp_width;
private int bmp_height;
// Needed for new random coordinates.
private Random random = new Random();

public Sprite(GameView gameView) {
      this.gameView=gameView;
      spritebmp = BitmapFactory.decodeResource(gameView.getResources(),
              R.drawable.sprite);
      this.bmp_width = spritebmp.getWidth();
      this.bmp_height= spritebmp.getHeight();
 }
//update the position of the sprite
public void update() {
    x = x + xSpeed;
    y = y + ySpeed;
    wrapAround(); //Adjust motion of sprite.
}

public void draw(Canvas canvas) {

    //Draw sprite image
    canvas.drawBitmap(spritebmp, x , y, null);
}

/* Checks if the Sprite was touched. */
public boolean wasItTouched(float ex, float ey){
    boolean touched = false;
    if ((x <= ex) && (ex < x + bmp_width) &&
        (y <= ey) && (ey < y + bmp_height)) {
            touched = true;
    }
    return touched;
}//End of wasItTouched

public void wrapAround(){
    //Code to wrap around
    if (x < 0) x = x + gameView.getWidth(); //increment x whilst not off screen
    if (x >= gameView.getWidth()){ //if gone of the right sides of screen
            x = x - gameView.getWidth(); //Reset x
    }
    if (y < 0) y = y + gameView.getHeight();//increment y whilst not off screen
    if (y >= gameView.getHeight()){//if gone of the bottom of screen
        y -= gameView.getHeight();//Reset y
    }
}

}


text:
Q: Reference request : manifolds and transitive lie group actions I would like to show that any manifold $M$ with a transitive ation from a Lie group $G$ is diffeomorphic to $G/H$ where $H$ is the stabilizer of an element in $M$.
Do you know any reference where I could find at best a detailed proof or at least a sketch of the proof? Thanks.

A: There is a detailed proof in
Lee, J. M., Introduction to smooth manifolds, Second Edition, Springer (2013).
The result you are looking for is Theorem 21.18 on page 552.


text:
Q: Possible to partition five elements by median with six comparisons? Given five random elements, it's possible to find the median using just six comparisons. But I have an extra requirement in that the following condition is also satisfied:
a < c && b < c && c < d && c < e
It is NOT required for a < b or d < e.
I've been able to satisfy this condition using seven comparisons, but not six. This is my code, which should be self explanatory:
void medianSort(int[] arr)
{
    assert(arr.length == 5);

    void sortPair(ref int a, ref int b)
    {
        if(a > b) swap(a, b);
    }

    sortPair(arr[0], arr[1]);
    sortPair(arr[3], arr[4]);
    sortPair(arr[0], arr[3]);
    sortPair(arr[1], arr[4]);
    sortPair(arr[2], arr[3]);
    sortPair(arr[1], arr[2]);
    sortPair(arr[2], arr[3]);
}

I have a quick sort that I wish to enhance by using a median of five to choose the pivot. By satisfying that condition, five elements are already sorted.
Is it possible to accomplish this in six comparisons, or is seven the best I can do?

A: I grinded away at the problem for two hours, but I found a solution. The important thing is to keep track of the comparisons made, which I've done in great detail with the comments. The function is written in D.
void medianSort(alias pred = "a < b", T)(ref T a, ref T b, ref T c, ref T d, ref T e)
{
    alias binaryFun!pred less;
    bool greater(T a, T b){ return !less(a, b); }

    if(greater(a, b)) swap(a, b); // #1
    // a<b
    if(greater(d, e)) swap(d, e); // #2
    // a<b d<e

    if(less(a, d)) // #3
    {
        // a<d<e a<b
        // eliminate a
        // d<e
        if(greater(b,c)) swap(b,c); // #4
        // b<c d<e
    }
    else // if(less(d, a))
    {
        // a<b d<a d<e
        // d<a<b   d<e
        swap(a, d);
        // a<d<b   a<e
        // eliminate a
        // d<b
        swap(d, b);
        // b<d
        if(greater(c, e)) swap(c, e); // #4
        // b<d c<e
        swap(c, d);
        // b<c d<e
    }

    // b<c d<e
    if(less(b, d)) // #5
    {
        // b<c b<d d<e
        // b<c b<d<e
        // eliminate b
        // d<e
    }
    else
    {
        // b<c d<e d<b
        // d<b<c d<e
        swap(b, d);
        // b<d<c b<e
        // eliminate b
        // d<c
        swap(c, e);
        // d<e
    }

    // d<e
    // median is smaller of c and d
    if(greater(c, d)) swap(c, d); // #6
}

Python: http://pastebin.com/0kxjxFQX

A: Ok, so here is a proof that you need at least 6 comparisons.
First of all, note that all the information we obtain is based only on comparisons. We can do swapping in the very end based on what transpired during the comparisons steps. Also note that our comparisons can be based only on comparisons done previously. For example, the first step in the algorithm will be always the same as no comparisons have been done previously; the second comparison already can depend on the first, etc.
Let's "name" the elements according to their magnitude - 1,2,3,4,5. They can appear in the input in any order. Now, we need at least four comparisons to order the elements correctly. They are:
3 > 2           [1]
3 > 1 OR 2 > 1  [2]
3 < 4           [3]
3 < 5 OR 4 < 5  [4]

Any other comparison is extra. Also, if we can't avoid both comparisons in [2] or both comparisons in [4] - those also become extra.
As the initial permutation can be anything, we immediately get one extra comparison: 1 < 5 (this is important to understand: as our algorithm always takes the same first two elements according to how they are presented in the input, say a and b, there is always a possibility that a = 1 and b = 5).
Now, there are two cases to consider for the second step:
Case 1: we compare two elements other than 1 and 5. As we can't distinguish among 2,3, and 4 at this stage we immediately get the second extra comparison: 2 < 4. So we are up to 6 comparisons.
Case 2: we compare 1 or 5 with one of 2,3, or 4. Without loss of generality let's assume that we are comparing 1. As we can't distinguish among 2,3, ant 4 we get our second extra comparison: 1 < 4. QED


text:
Q: Legend with series dash type type in Kendo chart I have a Kendo Dataviz chart with six series, 2 series with solid line, 2 series with dashed line and 2 series with dotted lines, i have used only two colors for series, now i want to show the legend with series dash type to differentiate the series in legend, is it possible.

A: The Kendo Chart doesn't support this feature yet and there is no workaround for this issue.