text:
Q: 8 branches for try with resources - jacoco coverage possible? I've got some code that uses try with resources and in jacoco it's coming up as only half covered. All the source code lines are green, but I get a little yellow symbol telling me that only 4 of 8 branches are covered.

I'm having trouble figuring out what all the branches are, and how to write code that covers them. Three possible places throw PipelineException. These are createStageList(), processItem() and the implied close()

*

*Not throwing any exceptions,

*throwing an exception from createStageList()

*throwing an exception from processItem()

*throwing an exception from close()

*throwing an exception from processItem() and close()
I can't think of any other cases, yet I still only have 4 of 8 covered.
Can someone explain to me why it's 4 of 8 and is there anyway to hit all 8 branches? I'm not skilled with decyrpting/reading/interpreting byte code, but maybe you are... :) I've already seen https://github.com/jacoco/jacoco/issues/82, but neither it nor the issue it references help very much (other than noting that this is due to compiler generated blocks)
Hmm, just as I finish writing this I had a thought on what case(s) might not be not tested by what I mention above... I'll post an answer if I got it right. I'm sure this question and it's answer will help someone in any case.
EDIT: Nope, I didn't find it. Throwing RuntimeExceptions (not handled by the catch block) didn't cover any more branches

A:
I can cover all 8 branches, so my answer is YES. Look at the following code, this is only a fast try, but it works (or see my github: https://github.com/bachoreczm/basicjava and the 'trywithresources' package, there you can find, how try-with-resources works, see 'ExplanationOfTryWithResources' class):
import java.io.ByteArrayInputStream;
import java.io.IOException;

import org.junit.Test;

public class TestAutoClosable {

  private boolean isIsNull = false;
  private boolean logicThrowsEx = false;
  private boolean closeThrowsEx = false;
  private boolean getIsThrowsEx = false;

  private void autoClose() throws Throwable {
    try (AutoCloseable is = getIs()) {
        doSomething();
    } catch (Throwable t) {
        System.err.println(t);
    }
  }

  @Test
  public void test() throws Throwable {
    try {
      getIsThrowsEx = true;
      autoClose();
    } catch (Throwable ex) {
      getIsThrowsEx = false;
    }
  }

  @Test
  public void everythingOk() throws Throwable {
    autoClose();
  }

  @Test
  public void logicThrowsException() {
    try {
      logicThrowsEx = true;
      everythingOk();
    } catch (Throwable ex) {
      logicThrowsEx = false;
    }
  }

  @Test
  public void isIsNull() throws Throwable {
    isIsNull = true;
    everythingOk();
    isIsNull = false;
  }

  @Test
  public void closeThrow() {
    try {
      closeThrowsEx = true;
      logicThrowsEx = true;
      everythingOk();
      closeThrowsEx = false;
    } catch (Throwable ex) {
    }
  }

  @Test
  public void test2() throws Throwable {
    try {
      isIsNull = true;
      logicThrowsEx = true;
      everythingOk();
    } catch (Throwable ex) {
      isIsNull = false;
      logicThrowsEx = false;
    }
  }

  private void doSomething() throws IOException {
    if (logicThrowsEx) {
      throw new IOException();
    }
  }

  private AutoCloseable getIs() throws IOException {
    if (getIsThrowsEx) {
      throw new IOException();
    }
    if (closeThrowsEx) {
      return new ByteArrayInputStream("".getBytes()) {

        @Override
        public void close() throws IOException {
          throw new IOException();
        }
      };
    }
    if (!isIsNull) {
      return new ByteArrayInputStream("".getBytes());
    }
    return null;
  }
}

A: No real question, but wanted to throw more research out there.  tl;dr = It looks like you can achieve 100% coverage for try-finally, but not for try-with-resource.
Understandably, there's a difference between old-school try-finally and Java7 try-with-resources.  Here's two equivalent examples showing the same thing using alternate approaches.
Old School example (a try-finally approach):
final Statement stmt = conn.createStatement();
try {
    foo();
    if (stmt != null) {
        stmt.execute("SELECT 1");
    }
} finally {
    if (stmt != null)
        stmt.close();
}

Java7 example (a try-with-resource approach):
try (final Statement stmt = conn.createStatement()) {
    foo();
    if (stmt != null) {
        stmt.execute("SELECT 1");
    }
}

Analysis: old-school example:
Using Jacoco 0.7.4.201502262128 and JDK 1.8.0_45, I was able to get 100% line, instruction and branch coverage on the Old School example using the following 4 tests:
*

*Basic grease path (statement not null, and execute() is exercised normally)

*execute() throws exception

*foo() throws exception AND statement returned as null

*statement returned as null
Jacoco indicates 2 branches inside the 'try' (on the null check) and 4 inside the finally (on the null check).  All are covered fully.
Analysis: java-7 example:
If the same 4 tests run against the Java7 style example, jacoco indicates 6/8 branches are covered (on the try itself) and 2/2 on the null-check within the try.  I tried a number of additional tests to increase coverage, but I can find no way to get better than 6/8.  As others have indicated, the decompiled code (which I did also look at) for the java-7 example suggests that the java compiler is generating unreachable segments for try-with-resource.  Jacoco is reporting (accurately) that such segments exist.
Update: Using Java7 coding style, you might be able to get 100% coverage IF using a Java7 JRE (see Matyas response below).  However, using Java7 coding style with a Java8 JRE, I believe you will hit the 6/8 branches covered.  Same code, just different JRE.  Seems like the byte code is being created differently between the two JREs with the Java8 one creating unreachable pathways.

A: Four years old, but still...

*

*Happy path with non-null AutoCloseable

*Happy path with null AutoCloseable

*Throws on write

*Throws on close

*Throws on write and close

*Throws in resource specification (the with part, e.g. constructor call)

*Throws in try block but AutoCloseable is null

Above lists all 7 conditions - the reason for the 8 branches is due to repeated condition.
All branches can be reached, the try-with-resources is fairly simple compiler sugar (at least compared to switch-on-string) - if they cannot be reached, then it is by definition a compiler bug.
Only 6 unit tests are actually required (in the example code below, throwsOnClose is @Ingored and branch coverage is 8/8.
Also note that Throwable.addSuppressed(Throwable) cannot suppress itself, so the generated bytecode contains an additional guard (IF_ACMPEQ - reference equality) to prevent this).  Luckily this branch is covered by the throw-on-write, throw-on-close and throw-on-write-and-close cases, as the bytecode variable slots are reused by the outer 2 of 3 exception handler regions.
This is not an issue with Jacoco - in fact the example code in the linked issue #82 is incorrect as there are no duplicated null checks and there is no nested catch block surrounding the close.
JUnit test demonstrating 8 of 8 branches covered
import static org.hamcrest.Matchers.arrayContaining;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.sameInstance;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

import java.io.IOException;
import java.io.OutputStream;
import java.io.UncheckedIOException;

import org.junit.Ignore;
import org.junit.Test;

public class FullBranchCoverageOnTryWithResourcesTest {

    private static class DummyOutputStream extends OutputStream {

        private final IOException thrownOnWrite;
        private final IOException thrownOnClose;

        public DummyOutputStream(IOException thrownOnWrite, IOException thrownOnClose)
        {
            this.thrownOnWrite = thrownOnWrite;
            this.thrownOnClose = thrownOnClose;
        }

        @Override
        public void write(int b) throws IOException
        {
            if(thrownOnWrite != null) {
                throw thrownOnWrite;
            }
        }

        @Override
        public void close() throws IOException
        {
            if(thrownOnClose != null) {
                throw thrownOnClose;
            }
        }
    }

    private static class Subject {

        private OutputStream closeable;
        private IOException exception;

        public Subject(OutputStream closeable)
        {
            this.closeable = closeable;
        }

        public Subject(IOException exception)
        {
            this.exception = exception;
        }

        public void scrutinize(String text)
        {
            try(OutputStream closeable = create()) {
                process(closeable);
            } catch(IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        protected void process(OutputStream closeable) throws IOException
        {
            if(closeable != null) {
                closeable.write(1);
            }
        }

        protected OutputStream create() throws IOException
        {
            if(exception != null) {
                throw exception;
            }
            return closeable;
        }
    }

    private final IOException onWrite = new IOException("Two writes don't make a left");
    private final IOException onClose = new IOException("Sorry Dave, we're open 24/7");

    /**
     * Covers one branch
     */
    @Test
    public void happyPath()
    {
        Subject subject = new Subject(new DummyOutputStream(null, null));

        subject.scrutinize("text");
    }

    /**
     * Covers one branch
     */
    @Test
    public void happyPathWithNullCloseable()
    {
        Subject subject = new Subject((OutputStream) null);

        subject.scrutinize("text");
    }

    /**
     * Covers one branch
     */
    @Test
    public void throwsOnCreateResource()
    {
        IOException chuck = new IOException("oom?");
        Subject subject = new Subject(chuck);
        try {
            subject.scrutinize("text");
            fail();
        } catch(UncheckedIOException e) {
            assertThat(e.getCause(), is(sameInstance(chuck)));
        }
    }

    /**
     * Covers three branches
     */
    @Test
    public void throwsOnWrite()
    {
        Subject subject = new Subject(new DummyOutputStream(onWrite, null));
        try {
            subject.scrutinize("text");
            fail();
        } catch(UncheckedIOException e) {
            assertThat(e.getCause(), is(sameInstance(onWrite)));
        }
    }

    /**
     * Covers one branch - Not needed for coverage if you have the other tests
     */
    @Ignore
    @Test
    public void throwsOnClose()
    {
        Subject subject = new Subject(new DummyOutputStream(null, onClose));
        try {
            subject.scrutinize("text");
            fail();
        } catch(UncheckedIOException e) {
            assertThat(e.getCause(), is(sameInstance(onClose)));
        }
    }

    /**
     * Covers two branches
     */
    @SuppressWarnings("unchecked")
    @Test
    public void throwsOnWriteAndClose()
    {
        Subject subject = new Subject(new DummyOutputStream(onWrite, onClose));
        try {
            subject.scrutinize("text");
            fail();
        } catch(UncheckedIOException e) {
            assertThat(e.getCause(), is(sameInstance(onWrite)));
            assertThat(e.getCause().getSuppressed(), is(arrayContaining(sameInstance(onClose))));
        }
    }

    /**
     * Covers three branches
     */
    @Test
    public void throwsInTryBlockButCloseableIsNull() throws Exception
    {
        IOException chucked = new IOException("ta-da");
        Subject subject = new Subject((OutputStream) null) {
            @Override
            protected void process(OutputStream closeable) throws IOException
            {
                throw chucked;
            }
        };

        try {
            subject.scrutinize("text");
            fail();
        } catch(UncheckedIOException e) {
            assertThat(e.getCause(), is(sameInstance(chucked)));
        }

    }
}

Caveat
Though not in OP's sample code, there is one case that can't be tested AFAIK.
If you pass the resource reference as an argument, then in Java 7/8 you must have a local variable to assign to:
    void someMethod(AutoCloseable arg)
    {
        try(AutoCloseable pfft = arg) {
            //...
        }
    }

In this case the generated code will still be guarding the resource reference.  The syntatic sugar is updated in Java 9, where the local variable is no longer required: try(arg){ /*...*/ }
Supplemental - Suggest use of library to avoid branches entirely
Admittedly some of these branches can be written off as unrealistic - i.e. where the try block uses the AutoCloseable without null checking or where the resource reference (with) cannot be null.
Often your application doesn't care where it failed - to open the file, write to it or close it - the granularity of failure is irrelevant (unless the app is specifically concerned with files, e.g. file-browser or word processor).
Furthermore, in the OP's code, to test the null closeable path - you'd have to refactor the try block into a protected method, subclass and provide a NOOP implementation - all this just get coverage on branches that will never be taken in the wild.
I wrote a tiny Java 8 library io.earcam.unexceptional (in Maven Central) that deals with most checked exception boilerplate.
Relevant to this question: it provides a bunch of zero-branch, one-liners for AutoCloseables, converting checked exceptions to unchecked.
Example: Free Port Finder
int port = Closing.closeAfterApplying(ServerSocket::new, 0, ServerSocket::getLocalPort);

A: Well I can't tell you what the exact problem with Jacoco is, but I can show you how Try With Resources is compiled. Basically, there are a lot of compiler generated switches to handle exceptions thrown at various points.
If we take the following code and compile it
public static void main(String[] args){
    String a = "before";

    try (CharArrayWriter br = new CharArrayWriter()) {
        br.writeTo(null);
    } catch (IOException e){
        System.out.println(e.getMessage());
    }

    String a2 = "after";
}

And then disassemble, we get
.method static public main : ([Ljava/lang/String;)V
    .limit stack 2
    .limit locals 7
    .catch java/lang/Throwable from L26 to L30 using L33
    .catch java/lang/Throwable from L13 to L18 using L51
    .catch [0] from L13 to L18 using L59
    .catch java/lang/Throwable from L69 to L73 using L76
    .catch [0] from L51 to L61 using L59
    .catch java/io/IOException from L3 to L94 using L97
    ldc 'before'
    astore_1
L3:
    new java/io/CharArrayWriter
    dup
    invokespecial java/io/CharArrayWriter <init> ()V
    astore_2
    aconst_null
    astore_3
L13:
    aload_2
    aconst_null
    invokevirtual java/io/CharArrayWriter writeTo (Ljava/io/Writer;)V
L18:
    aload_2
    ifnull L94
    aload_3
    ifnull L44
L26:
    aload_2
    invokevirtual java/io/CharArrayWriter close ()V
L30:
    goto L94
L33:
.stack full
    locals Object [Ljava/lang/String; Object java/lang/String Object java/io/CharArrayWriter Object java/lang/Throwable
    stack Object java/lang/Throwable
.end stack
    astore 4
    aload_3
    aload 4
    invokevirtual java/lang/Throwable addSuppressed (Ljava/lang/Throwable;)V
    goto L94
L44:
.stack same
    aload_2
    invokevirtual java/io/CharArrayWriter close ()V
    goto L94
L51:
.stack same_locals_1_stack_item
    stack Object java/lang/Throwable
.end stack
    astore 4
    aload 4
    astore_3
    aload 4
    athrow
L59:
.stack same_locals_1_stack_item
    stack Object java/lang/Throwable
.end stack
    astore 5
L61:
    aload_2
    ifnull L91
    aload_3
    ifnull L87
L69:
    aload_2
    invokevirtual java/io/CharArrayWriter close ()V
L73:
    goto L91
L76:
.stack full
    locals Object [Ljava/lang/String; Object java/lang/String Object java/io/CharArrayWriter Object java/lang/Throwable Top Object java/lang/Throwable
    stack Object java/lang/Throwable
.end stack
    astore 6
    aload_3
    aload 6
    invokevirtual java/lang/Throwable addSuppressed (Ljava/lang/Throwable;)V
    goto L91
L87:
.stack same
    aload_2
    invokevirtual java/io/CharArrayWriter close ()V
L91:
.stack same
    aload 5
    athrow
L94:
.stack full
    locals Object [Ljava/lang/String; Object java/lang/String
    stack
.end stack
    goto L108
L97:
.stack same_locals_1_stack_item
    stack Object java/io/IOException
.end stack
    astore_2
    getstatic java/lang/System out Ljava/io/PrintStream;
    aload_2
    invokevirtual java/io/IOException getMessage ()Ljava/lang/String;
    invokevirtual java/io/PrintStream println (Ljava/lang/String;)V
L108:
.stack same
    ldc 'after'
    astore_2
    return
.end method

For those who don't speak bytecode, this is roughly equivalent to the following pseudo Java. I had to use gotos because the bytecode doesn't really correspond to Java control flow.
As you can see, there are a lot of cases to handle the various possibilities of suppressed exceptions. It's not reasonable to be able to cover all these cases. In fact, the goto L59 branch on the first try block is impossible to reach, since the first catch Throwable will catch all exceptions.
try{
    CharArrayWriter br = new CharArrayWriter();
    Throwable x = null;

    try{
        br.writeTo(null);
    } catch (Throwable t) {goto L51;}
    catch (Throwable t) {goto L59;}

    if (br != null) {
        if (x != null) {
            try{
                br.close();
            } catch (Throwable t) {
                x.addSuppressed(t);
            }
        } else {br.close();}
    }
    break;

    try{
        L51:
        x = t;
        throw t;

        L59:
        Throwable t2 = t;
    } catch (Throwable t) {goto L59;}

    if (br != null) {
        if (x != null) {
            try{
                br.close();
            } catch (Throwable t){
                x.addSuppressed(t);
            }
        } else {br.close();}
    }
    throw t2;
} catch (IOException e) {
    System.out.println(e)
}

A: Jacoco has recently fixed this issue, Release 0.8.0 (2018/01/02)
"During creation of reports various compiler generated artifacts are filtered out, which otherwise require unnecessary and sometimes impossible tricks to not have partial or missed coverage:

*

*Part of bytecode for try-with-resources statements (GitHub #500)."

http://www.jacoco.org/jacoco/trunk/doc/changes.html

A: i had a similar issue with something like this:
try {
...
} finally {
 if (a && b) {
  ...
 }
}

it complained that 2 of 8 branches weren't covered. ended up doing this:
try {
...
} finally {
 ab(a,b);
}

void ab(a, b) {
 if (a && b) {
...
 }
}

no other changes and i now reached 100%....


text:
Q: Trying to edit a form purchased with a template but I cant seem to get it to function I've edited the HTML, JS, and PHP. The edited form is on http://lataeviaberry.com/donate.html. After populating the form and clicking submit it just refreshes the page and displays this URL "http://lataeviaberry.com/donate.html?name=test&address=test&city=test&state=test&zip=12356" The unedited form works on "LaTaeviabery.com" with the original fields, but I need this donate page form to accept addresses.
I have added my code below, thanks in advance for your help!
HTML

                    <form id="ajax-contact-form2">
                        <input type="text" name="name" class="form-text wow fadeInUp" value="" placeholder="Your name" />
                        <input type="text" name="address" class="form-text wow fadeInUp" value="" placeholder="Address" />
                        <input type="text" name="city" class="form-text wow fadeInUp" value="" placeholder="City" />
                        <input type="text" name="state" class="form-text wow fadeInUp" value="" placeholder="State"/>
                        <input type="text" name="zip" class="form-text wow fadeInUp" value="" placeholder="Zip"/>
                        <input type="submit" class="form-button wow fadeInUp" value="SEND"/>
                    </form>

JavaScript
$("#ajax-contact-form2").submit(function() {
        var str = $(this).serialize();
        $.ajax({
            type: "POST",
            url: "php/donatecontact-form.php",
            data: str,
            success: function(msg) {
                if(msg == 1) {
                    result = '
Your message has been sent. Thank you!
';
                    $("#ajax-contact-form2").hide();
                } else {result = msg;}
                $('#form-message').hide();
                $('#form-message').html(result);
                $('#form-message').fadeIn("slow");
                $('html, body').animate({
                    scrollTop: $('#form-message').offset().top - 130
                },1500);
            }
        });

PHP
    <?
// Field Name
$name = $_POST['name'];
if(iconv_strlen($name) < 2){echo '
Please enter your name.
';exit();}

// Field Address
$address = $_POST['address'];
if(iconv_strlen($address) < 2){echo '
Please enter your address.
';exit();}
// Field City
$city = $_POST['city'];
if(iconv_strlen($city) < 3){echo '
Please enter your city.
';exit();}
// Field State
$state = $_POST['state'];
if(iconv_strlen($state) < 3){echo '
Please enter your state.
';exit();}
// Field Zip
$zip = $_POST['zip'];
if(iconv_strlen($zip) < 5){echo '
Please enter your zip.
';exit();}

$headers = "From: $name \r\n";
mail('hello@lataeviaberry.com', $address, 'Name:'.$name."\n\nAddress: ".$address."\n\nCity: ".$city."\n\nState: ".$state."\n\nZip: ".$zip, $headers);
echo "1";
?>

A: In your JavaScript, change
$("#ajax-contact-form2").submit(function() {

to this:
$("#ajax-contact-form2").submit(function(e) {
    e.preventDefault();
    // the rest stays the same

Otherwise your form will be submitted in a default fashion before the AJAX call is even triggered. Another way to stop this behaviour is to add return false; to the end of the submit() handler.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Going down theorem with modification. Going-down Thm: Let $A\subseteq B$ be an integral extension. Assume that $B$ is an integral domain and that $A$ is integrally closed. Then going down holds for the above extension.
Question1: Can we remove the hypothesis that $B$ is a domain and replace it with $B$ is reduced.
Question2: if not, can someone give me a counterexample?
Thanks.

A: I find it easier to think geometrically, so I'll argue that way. Suppose that $B$ is reduced and Noetherian, so that Spec $B$ is the union of finitely many irreducible components Spec $B_i$, each of which is reduced and irreducible, i.e. integral.   Suppose also that each component of Spec $B$ dominates Spec $A$.  (In ring-theoretic terms, suppose that each of the induced maps $A \to B_i$ is injective.)
Each of the maps $f_i:$ Spec $B_i \to$ Spec $A$ is also finite, because it is the composite of the closed immersion Spec $B_i \hookrightarrow $ Spec $B$ and the map $f:$ Spec $B \to $ Spec $A$, which is finite by assumption.  Thus going down holds for each of the maps Spec $B_i \to$ Spec $A$.
Now any point $x$ of Spec $B$ belongs to one of the Spec $B_i$, and so given $y' \in $ Spec $A$ generalizing $y = f_i(x)$, going down gives $x' \in$ Spec $B_i$ generalizing $x$ such that $y' = f_i(x')$.  Now think of $y$ just as an element of Spec $B$, and recall that $f_i$ is nothing but the restriction of $f$ to Spec $B_i$.  We thus see that $f(y') = x'$, and so going down holds for the map $f$.
(You can easily convert this argument into pure commutative algebra: the point is that $B$ embeds into the product $\prod_i B_i$ of the domains $B_i$, and so any prime ideal of $B$ is pulled back from a prime ideal of one of the $B_i$.  so going down for the $B_i$ implies going down for $B$.  I leave the details to you.)

Note that it is crucial to assume that each Spec $B_i$ dominates Spec $A$, not just that Spec $B$ dominates Spec $A$.  Otherwise we could just take Spec $B$ to be the disjoint union of Spec $B_1$ dominating Spec $A$, and some Spec $B_2$ which does not dominate Spec $A$; since going down does not hold for the map Spec $B_2 \to $ Spec $A$, it won't hold for the disoint union.  This is what happens in wxu's counterexample: it is the disjoint union of a line and a plane mapping to a plane.

A: I think it is not right.
Let $A=k[x,y]$, $B=k[x,y]\times k[x]$. The map $A\to B$ is sending $f(x,y)$ to $(f(x,y),f(x,0))$. So $A\to B$ is injective and $B$ is integral over $A$.
Let $\mathfrak{p}_1=(y)\subset A$ and $\mathfrak{q}_1=k[x,y]\times (0)\subset B$, then $\mathfrak{q}_1\cap A=\mathfrak{p}_1$. Let $\mathfrak{p}_2=(0)\subset A$. Then there is no prime $\mathfrak{q}_2\subset \mathfrak{q}_1$ of $B$ such that $\mathfrak{q}_2\cap A=\mathfrak{p}_2$.
EDIT: In this example, it is clear $B$ is integral over $A$. For $(a,0)\in B$, $(a,0)^2-(a,a)(a,0)=0$. For $(0,b)\in B$, $(0,b)^2-(b,b)(0,b)=0$.


text:
Q: Android : Firebase dynamic link always goes to playstore URL even if the app is installed I am trying to integrate Firebase dynamic link into Android app but the problem is that even if the app is installed the dynamic link is taking me to play store page to download the App from play store.
I sent email with dynamic link. Then at Android smartphone, I opened the email and clicked the dynamic link, it goes to play store always..
Did anybody face the same problem and have solution for the same.
When I tested at https://firebase.google.com/docs/app-indexing/android/test
the dynamic link goes to the app well. Because the app was installed.
I added SHA-1, SHA-256 key to my app.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.chillingchat.android">

<uses-permission android:name="android.permission.INTERNET" />

<application
    android:allowBackup="true"
    android:icon="@drawable/adv"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    >
    <activity
        android:name="io.chillingchat.android.view.MainActivity"
        android:label="@string/app_name">

    </activity>

    <activity
        android:name="io.chillingchat.android.view.AuthActivity">

        <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <data
                android:host="chillingchat.io"
                android:scheme="https"/>
            <data
                android:host="chillingchat.io"
                android:scheme="http"/>
        </intent-filter>
    </activity>

</application>

actionCodeSettings = ActionCodeSettings.newBuilder()
            // URL you want to redirect back to. The domain (www.example.com)
            // URL must be whitelisted in the Firebase Console.
            .setUrl("https://chillingchat.page.link/in")
            // This must be true
            .setHandleCodeInApp(true)
            .setAndroidPackageName(
                    "io.chillingchat.android",
                    true, /* installIfNotAvailable */
                    "16"    /* minimumVersion */)
            .build();

A: Finally I have solve this terrible problem.
In actionCodeSetting,
.setAndroidPackageName(
                "io.chillingchat.android",
                true, /* installIfNotAvailable */
                "16"    /* minimumVersion */)

change to
.setAndroidPackageName(
                "io.chillingchat.android",
                false, /* installIfNotAvailable */
                "16"    /* minimumVersion */)

but I don't know why change true to false the * installIfNotAvailable * option makes working..


text:
Q: Ant SSHExec task does not return when calling Tomcat startup.sh From my (Windows) desktop or the (Windows or Unix) Jenkins server (which I believe uses the same underlying JSch technology), I can't seem to call the startup.sh script in the Tomcat bin dir as I want to. Tomcat (7) lives on a Solaris 9 server. I have rather basic Unix knowledge.
It executes successfully (Tomcat starts fine) but never returns until the Tomcat process is killed. I imagine other similar scripts would have the same behavior.
Example ant task (the commands are the same as I would put in Jenkins "Execute shell script on remote host" build task)
<?xml version="1.0" encoding="UTF-8"?>
<project name="remote-tomcat-controls" basedir=".">
    <property name="hostname">someserver</property>
    <property name="username">someuser</property>
    <property name="password">somepassword</property>
    <property name="port">22</property>
    <property name="tomcathome">~/tomcat</property>
    <target name="start-tomcat">
        <sshexec   host="${hostname}" port="${port}" username="${username}"
            password="${password}" trust="true"
            command=". ~/.profile; cd ${tomcathome}/bin; ./startup.sh" />
    </target>
</project>

This starts Tomcat successfully but the task never returns unless/until the Tomcat process is killed on the server:
start-tomcat:
  [sshexec] Connecting to someserver:22
  [sshexec] cmd : . ~/.profile; cd ~/tomcat/bin; ./startup.sh

There are 3 commands involved:

*

*Import users profile so Java is in the path

*Change to the tomcat bin dir so relative paths to log files work

*Start Tomcat

I have tried moving these commands into a new script on the server, and have the Ant task simply call that, same results.
I have tried prepending the command with nohup and ending with &, no luck either.
Results you get when running the startup.sh script during an interactive ssh session:
$ ./startup.sh
Using CATALINA_BASE:   /home/ebiztest/tomcat-datasheets
Using CATALINA_HOME:   /home/ebiztest/tomcat-datasheets
Using CATALINA_TMPDIR: /home/ebiztest/tomcat-datasheets/temp
Using JRE_HOME:        /home/ebiztest/jdk1.6.0_34
Using CLASSPATH:       /home/ebiztest/tomcat-datasheets/bin/bootstrap.jar:/home/ebiztest/tomcat-datasheets/bin/tomcat-juli.jar
$

Control is returned immediately.
Any ideas? Thanks!
In response to the answer from 'aa vv'
Using commandResource instead of command let me point to a local file that contains the commands to run (added more commands for demonstration):
pwd
. ~/.profile;java -version
pwd
java -version
pwd
cd ~/tomcat-datasheets/bin;pwd
pwd
 ./startup.sh

Output:
start-tomcat:
  [sshexec] Connecting to servername:22
  [sshexec] cmd : pwd
  [sshexec] /home/ebiztest
  [sshexec] cmd : . ~/.profile;java -version
  [sshexec] java version "1.6.0_34"
  [sshexec]
  [sshexec] Java(TM) SE Runtime Environment (build 1.6.0_34-b04)
  [sshexec]
  [sshexec] Java HotSpot(TM) Server VM (build 20.9-b04, mixed mode)
  [sshexec]
  [sshexec] cmd : pwd
  [sshexec] /home/ebiztest
  [sshexec] cmd : java -version
  [sshexec] java version "1.4.2_04"
  [sshexec]
  [sshexec] Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
  [sshexec] Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
  [sshexec]
  [sshexec] cmd : pwd
  [sshexec] /home/ebiztest
  [sshexec] cmd : cd ~/tomcat-datasheets/bin;pwd
  [sshexec] /home/ebiztest/tomcat-datasheets/bin
  [sshexec] cmd : pwd
  [sshexec] /home/ebiztest
  [sshexec] cmd :  ./startup.sh
  [sshexec] ksh: ./startup.sh:  not found

It seems commands on separate lines are run entirely separately from eachother, only semicolon separated commands on the same line execute sequentially.

A: It looks like with 'command' option, you have execute a command/set of commands ( 2 cases : either ; seperated commands is not supported for running single command line OR script call is not supported ).
<sshexec   host="${hostname}" port="${port}" username="${username}"
            password="${password}" trust="true"
            commandResource="wrapper_script" outputproperty="wrapper.output.prop"/>

 <echo message="${wrapper.output.prop}"/>

Instead of command use commandResource as specified in ant manual: http://ant.apache.org/manual/Tasks/sshexec.html to see if that helps.
wrapper_script
. ~/.profile
cd ${tomcathome}/bin
./startup.sh

A: Try to chain the commands like that :
command=". ~/.profile && cd ${tomcathome}/bin && ./startup.sh"


text:
Q: Rotate object around arbitrary axis in Three.js,just like the moon around the Earth. I have tried many solutions of the question,but the object
still around his own axis without any translate.

A: You might want to add the object as the child of another object, and rotate that object instead...

var renderer = new THREE.WebGLRenderer();
var w = 300;
var h = 200;
renderer.setSize( w,h );
document.body.appendChild( renderer.domElement );

var scene = new THREE.Scene();
   var camera = new THREE.PerspectiveCamera(
 45,  // Field of view
 w/h, // Aspect ratio
 0.1,  // Near
 10000  // Far
);
camera.position.set( 15, 10, 15 );
camera.lookAt( scene.position );
controls = new THREE.OrbitControls(camera, renderer.domElement);

var light = new THREE.PointLight( 0x808080 );
light.position.set( 20, 20, 20 );
scene.add( light );
var light1 = new THREE.AmbientLight( 0x101010 );
light1.position.set( 20, 20, 20 );
scene.add( light1 );
var light2 = new THREE.PointLight( 0x808080 );
light2.position.set( -20, 20, -20 );
scene.add( light2 );
var light3 = new THREE.PointLight( 0x808080 );
light3.position.set( -20, -20, -20 );
scene.add( light3 );
var mkBody=(rad,color)=>{
var sphereGeom = new THREE.SphereGeometry(rad,16,16);
var material = new THREE.MeshLambertMaterial( { color: color } );
var mesh = new THREE.Mesh( sphereGeom, material );
return mesh;
}
var sun = mkBody(2,0xffee00)
scene.add( sun )
sun.material.emissive.set(0x808000)
var b1 = mkBody(0.7,0x80ffff)
b1.position.set(6,0,0)
sun.add( b1 )
var b2 = mkBody(0.2,0xeeeeee)
b2.position.set(1.1,0,0)
b1.add( b2 )
sun.onBeforeRender = function(){
    this.rotation.y+=0.01
}
b1.onBeforeRender = function(){
    this.rotation.y+=0.1
}
renderer.setClearColor( 0x404040, 1);

(function animate() {
    requestAnimationFrame(animate);
    controls.update();
    renderer.render(scene, camera);
})();
<script src="https://threejs.org/build/three.min.js"></script>
<script src="https://cdn.rawgit.com/mrdoob/three.js/master/examples/js/controls/OrbitControls.js"></script>

Another option is to transform the geometry itself...

var renderer = new THREE.WebGLRenderer();
var w = 300;
var h = 200;
renderer.setSize( w,h );
document.body.appendChild( renderer.domElement );

var scene = new THREE.Scene();
   var camera = new THREE.PerspectiveCamera(
 45,  // Field of view
 w/h, // Aspect ratio
 0.1,  // Near
 10000  // Far
);
camera.position.set( 15, 10, 15 );
camera.lookAt( scene.position );
controls = new THREE.OrbitControls(camera, renderer.domElement);

var light = new THREE.PointLight( 0x808080 );
light.position.set( 20, 20, 20 );
scene.add( light );
var light1 = new THREE.AmbientLight( 0x101010 );
light1.position.set( 20, 20, 20 );
scene.add( light1 );
var light2 = new THREE.PointLight( 0x808080 );
light2.position.set( -20, 20, -20 );
scene.add( light2 );
var light3 = new THREE.PointLight( 0x808080 );
light3.position.set( -20, -20, -20 );
scene.add( light3 );
var mkBody=(rad,color)=>{
    var sphereGeom = new THREE.SphereGeometry(rad,16,16);
    var material = new THREE.MeshLambertMaterial( { color: color } );
    var mesh = new THREE.Mesh( sphereGeom, material );
    return mesh;
}
var sun = mkBody(2,0xffee00)
scene.add( sun )
sun.material.emissive.set(0x808000)
var b1 = mkBody(0.7,0x80ffff)
b1.position.set(6,0,0)
sun.add( b1 )
b1.updateMatrixWorld();
b1.geometry.applyMatrix(b1.matrixWorld); //Transform the actual geometry...
scene.add(b1); //Now reparent it to the scene
b1.position.set(0,0,0); //And reset its position...

sun.onBeforeRender = function(){
    this.rotation.y+=0.01
}
b1.onBeforeRender = function(){
    this.rotation.y+=0.1
}
renderer.setClearColor( 0x404040, 1);

(function animate() {
    requestAnimationFrame(animate);
    controls.update();
    renderer.render(scene, camera);
})();
<script src="https://threejs.org/build/three.min.js"></script>
<script src="https://cdn.rawgit.com/mrdoob/three.js/master/examples/js/controls/OrbitControls.js"></script>


text:
Q: Cognos 11.0.13 DMR crosstab, how to set the drill through for the correct year when there are two facts -- Current Year Sales and Prev Year Sales How can I pass the correct year in the drill through?
When using a list - each column can have it's own drill
In a crosstab, the drill through appears to be the same for all cell values (showing metrics)
In this example, the crosstab has two metrics -- current sales and prior year sales
They are stitched by company and year
The join for prior year sales is based on Year -1, this way the Report can show a specific Year (like 2019) and the facts adjust accordingly (i.e.  Current year sales is for 2019 and prior year sales 2018, even though the crosstab shows 2019 for the year).  The metrics display correctly
Because of this approach (using a crosstab), the facts share the same drill through
How can I pass the correct year in the drill through?
I have the drill through using the Year and sales rep.  Because of this the drill through shows the selected year, EVEN when selecting the metric for prior year
Crosstab looks like this
     |   Year  (like 2019     |
     |   Month (like 9)       |

         |Sales|Prior Year Sales  |
Sales Rep|456  |   123            |
         |523  |     0            |
         |623  |   123            |
Drill through pass data item -- Sales Rep, Year (which works)
However, when selecting prior year, the drill through is passing 2019
Reminder, in a list, each column has a separate drill through
Btw: If I try to change the list to a crosstab, I lose the drill through definitions

A: So I can't say I fully understand how you are getting your prior year, I fear with 2019-1 and stitching joining items, you maybe getting out of MDX(DMR) functionality and in to SQL(Relational) contexts.
If you are using DMR and have the current Year projected on an edge,  you could get the previous year via the lag function, more complex dynamic functions such as parallel period also exists.
Does the drill behavior change if you project the 2019 member and a calc of lag(2019) projected next to it?


text:
Q: Convert JSON to Java Object, how to parse BadgerFish convention with Jackson Using an API I receive JSON like this (which are now saved to file):
[{
    "LEI": {
        "$": "549300Q82NZ9NYNMZT63"
    },
    "Entity": {
        "LegalName": {
            "$": "United Nerds in Collaboration of Random Nerdiness AB"
        },
        "LegalAddress": {
            "Line1": {
                "$": "BOX 155"
            },
            "City": {
                "$": "Alingsas"
            },
            "Region": {
                "$": "SE-O"
            },
            "Country": {
                "$": "SE"
            },
            "PostalCode": {
                "$": "44123"
            }
        },
        "HeadquartersAddress": {
            "Line1": {
                "$": "BOX 155"
            },
            "City": {
                "$": "Alingsas"
            },
            "Region": {
                "$": "SE-O"
            },
            "Country": {
                "$": "SE"
            },
            "PostalCode": {
                "$": "44123"
            }
        },
        "BusinessRegisterEntityID": {
            "@register": "SE001",
            "$": "5568557184"
        },
        "LegalJurisdiction": {
            "$": "SE"
        },
        "LegalForm": {
            "$": "PRIVATA AKTIEBOLAG"
        },
        "EntityStatus": {
            "$": "ACTIVE"
        }
    },
    "Registration": {
        "InitialRegistrationDate": {
            "$": "2016-06-23T01:48:45.025Z"
        },
        "LastUpdateDate": {
            "$": "2016-06-23T01:48:44.945Z"
        },
        "RegistrationStatus": {
            "$": "ISSUED"
        },
        "NextRenewalDate": {
            "$": "2017-06-21T06:32:03.821Z"
        },
        "ManagingLOU": {
            "$": "EVK05KS7XY1DEII3R011"
        },
        "ValidationSources": {
            "$": "PARTIALLY_CORROBORATED"
        }
    }
}]

I would like to get Java Object out of these. I have already created the Java Objects out of an xsd file provided. The code I'm running is:
public static void toJava() {
    ObjectMapper mapper = new ObjectMapper();
    try {
        File json = new File("C:\\temp\\JSON.json");
        LEIRecordType[] type = mapper.readValue(json, LEIRecordType[].class);
    } catch (JsonEOFException ex) {
        ex.printStackTrace();
    } catch (JsonMappingException ex) {
        ex.printStackTrace();
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}

Which creates these Exceptions:
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "LEI" (class   org.leiroc.data.schema.leidata._2014.LEIRecordType), not marked as ignorable (5 known properties: "lei", "registration", "entity", "nextVersion", "extension"])
 at [Source: (File); line: 3, column: 14] (through reference chain: java.lang.Object[][0]->org.leiroc.data.schema.leidata._2014.LEIRecordType["LEI"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:60)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:822)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1152)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1567)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1545)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:293)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:195)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:21)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2890)
at Test.JSONParser.toJava(JSONParser.java:38)
at Test.JSONParser.main(JSONParser.java:29)

LEIRecordType looks like this:
package org.leiroc.data.schema.leidata._2014;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "LEIRecordType", propOrder = {"lei", "entity", "registration", "nextVersion", "extension"})
public class LEIRecordType {

    @XmlElement(name = "LEI", required = true)
    protected String lei;

    @XmlElement(name = "Entity", required = true)
    protected EntityType entity;

    @XmlElement(name = "Registration", required = true)
    protected RegistrationType registration;

    @XmlElement(name = "NextVersion")
    protected LEIRecordNextVersionType nextVersion;

    @XmlElement(name = "Extension")
    protected ExtensionType extension;

    public String getLEI() {
        return this.lei;
    }

    public void setLEI(String paramString) {
        this.lei = paramString;
    }

    public EntityType getEntity() {
        return this.entity;
    }

    public void setEntity(EntityType paramEntityType) {
        this.entity = paramEntityType;
    }

    public RegistrationType getRegistration() {
        return this.registration;
    }

    public void setRegistration(RegistrationType paramRegistrationType) {
        this.registration = paramRegistrationType;
    }

    public LEIRecordNextVersionType getNextVersion() {
        return this.nextVersion;
    }

    public void setNextVersion(LEIRecordNextVersionType paramLEIRecordNextVersionType) {
        this.nextVersion = paramLEIRecordNextVersionType;
    }

    public ExtensionType getExtension() {
        return this.extension;
    }

    public void setExtension(ExtensionType paramExtensionType) {
        this.extension = paramExtensionType;
    }
}

I understand that the problem is that jackson is locking for an Java Object called LEI, with an variable called "$". But there is none. The organisations help service says:
"The "$" object always reproduces the simple content (i.e. not the attributes, child nodes etc.) of the corresponding XML element.
The "$" object should always be typed as a JSON string where applicable."
But as I understand this is not JSON standard.
My question is: Is there any way to get jackson to parse this as LEI = "549300Q82NZ9NYNMZT63" etc. instead of and object LEI with an variable "$"?
Have been stuck on this for the better part of a day.
@UPDATE
This JSON format is apparently called "The BadgerFish convention", accoring to customer services.

A: As the $ object is always a String, you can create a custom deserializer for Strings that handles the BadgerFish wrapper objects.
This deserializer checks if there is a BadgerFish wrapper object around a String value and unwraps it. Normal String values are deserialized as usual.
public class BadgerFishDeserializer extends StdDeserializer<String> {

    private static final long serialVersionUID = 1L;

    private static final SerializedString BADGER_FISH_FIELD_NAME = new SerializedString("$");

    public BadgerFishDeserializer() {
        super(String.class);
    }

    @Override
    public String deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        // do we have a wrapper object?
        if (jp.isExpectedStartObjectToken()) {
            // check if first field name is equal to '$'
            if (!jp.nextFieldName(BADGER_FISH_FIELD_NAME)) {
                ctxt.reportInputMismatch(String.class, "Expected BadgerFish field name '$', but got '%s'", jp.getCurrentName());
            }
            jp.nextValue();  // proceed to the actual value
            String value = jp.getValueAsString();  // read value as string
            jp.nextToken();  // consume END_OBJECT of wrapper object
            return value;
        }
        // else: just return string value
        return jp.getValueAsString();
    }

}

Finally register the module on your Jackson ObjectMapper instance:
SimpleModule module = new SimpleModule();
module.addDeserializer(String.class, new BadgerFishDeserializer());
mapper.registerModule(module);

Note: If you only want some properties to be unwrapped, you could create a custom annotation and use a BeanDeserializerModifier to check for the annotation and then provide a deserializer that handles the wrapper objects.
Some food for thought:

*

*Create annotation

*Modify the deserializer to always expect wrapper objects (fail on plain Strings)

*Create a DeserializerModifier

*Register the DeserializerModifier on ObjectMapper
The difficult part:
public class BadgerFishDeserializerModifier extends BeanDeserializerModifier {

    @Override
    public BeanDeserializerBuilder updateBuilder(DeserializationConfig config, BeanDescription beanDesc, BeanDeserializerBuilder builder) {
        Iterator<SettableBeanProperty> props = builder.getProperties();
        while (props.hasNext()) {
            SettableBeanProperty prop = props.next();
            if (prop.getAnnotation(MyAnnotation.class) != null) {
                builder.addOrReplaceProperty(prop.withValueDeserializer(new BadgerFishDeserializer()), true);
            }
        }
        return builder;
    }

}

A: This has been very helpful! I ended up having to do a special deserializer for both String and XMLGregorianCalendar aswell. But the problem does not stop there. BadgerFish takes the @XMLAttributes from the generated classes and sets them as @value instead of "value". As for example:
"BusinessRegisterEntityID": {
        "@register": "SE001",
        "$": "5568557184"
    }

So is their any way to also custom the field name back to the original? Currently I now get this exception:
Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "@register" (class leigen.BusinessRegisterEntityIDType), not marked as ignorable (2 known properties: "value", "register"])
at [Source: (File); line: 44, column: 27] (through reference chain: java.lang.Object[][0]->leigen.LEIRecordType["Entity"]->leigen.EntityType["BusinessRegisterEntityID"]->leigen.BusinessRegisterEntityIDType["@register"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:60)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:822)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1152)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1567)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1545)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:293)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:287)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:287)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:195)
at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:21)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2890)
at Test.JSONParser.toJava(JSONParser.java:47)
at Test.JSONParser.main(JSONParser.java:28)

I'm able to bypass this by putting a "ignore" (DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES )in the config like in my now current code here:
    public static LEIRecordType[] toJava(File json) throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper();
    SimpleModule module = new SimpleModule();
    module.addDeserializer(String.class, new BadgerFishStringDeserializer());
    module.addDeserializer(XMLGregorianCalendar.class, new BadgerFishXMLGregorianCalendarDeserializer());
    module.addDeserializer(NameType.class, new BadgerFishNameTypeDeserializer());
    mapper.registerModule(module);
    mapper.registerModule(new JaxbAnnotationModule()); // To be able to read JAXB annotations.

    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    return mapper.readValue(json, LEIRecordType[].class);
}

But this only sets the values starting with @ as null. Is there another way to solve this? Otherwise I would have to write a custom deserializer for all my generated classes, which is about 25 (and there could always be more in the next version). I have already done one for NameType, but for other example more are needed.

A: I think the clear solution is using @JsonProperty("$"):
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
List<LEIModel> leiList = Arrays.asList(mapper.readValue(response.toString(), LEIModel[].class));

The LEIModel class:
public class LEIModel {
   @JsonProperty("Entity")
   private Entity entity;

   public Entity getEntity() {
       return entity;
   }

   public void setEntity(Entity entity) {
       this.entity = entity;
   }
}

The Entity class:
public class Entity {
   @JsonProperty("LegalName")
   private LegalName legalName;

   public LegalName getLegalName() {
       return legalName;
   }

   public void setLegalName(LegalName legalName) {
       this.legalName = legalName;
   }
}

The LegalName class:
public class LegalName {
   @JsonProperty("$")
   private String value;

   public String getValue() {
       return value;
   }

   public void setValue(String value) {
       this.value = value;
   }
}


text:
Q: Applet v/s Servlet Whats the difference between Applet and Servlet in JAVA

A: A Java Applet is a Java class which is run on the client's JVM (via a Browser Plugin).
A Java Servlet is run on the server-side in a Servlet container, like Apache Tomcat and the client recieves the results in the form of plain old HTML.
The key difference is that where as one runs on the client side, the other on the Server side.

A: Applet runs on the client, servlet runs on the server. It's as simple as that.
More specifically, that applet is downloaded to the client, and executes in a JRE inside the browser, and can display whatever it wants to display within the applet frame. The servlet instead runs on the server and (generally) produces a HTML page which is displayed in your browser.

A: applet is the Desktop application and the Servlet is the web Application
Applet is run on the Clients machine and the Servlet is run the Server Machine And produce
the html page on the client browser with the help of the Request And Response Parameter in
the Java.servlet.*;
Package


text:
Q: How to share the variable between two threads in java? I have a loop that doing this:
            WorkTask wt = new WorkTask();
            wt.count = count;
            Thread a = new Thread(wt);
            a.start();

When the workTask is run, the count will wt++ ,
but the WorkTask doesn't seems change the count number, and between the thread, the variable can't share within two thread, what did I wrote wrong? Thanks.

A: Without seeing the code for WorkThread it's hard to pin down the problem, but most likely you are missing synchronization between the two threads.
Whenever you start a thread, there are no guarantees on whether the original thread or the newly created thread runs first, or how they are scheduled.  The JVM/operating system could choose to run the original thread to completion and then start running the newly created thread, run the newly created thread to completion and then switch back to the original thread, or anything in between.
In order to control how the threads run, you have to synchronize them explicitly.  There are several ways to control the interaction between threads - certainly too much to describe in a single answer.  I would recommend the concurrency trail of the Java tutorials for a broad overview, but in your specific case the synchronization mechanisms to get you started will probably be Thread.join and the synchronized keyword (one specific use of this keyword is described in the Java tutorials).

A: Make the count variable static (it looks like each thread has its own version of the variable right now) and use a mutex to make it thread safe (ie use the synchronized instruction)

A: From your description I came up with the following to demonstrate what I perceived as your issue. This code, should output 42.  But it outputs 41.
public class Test {
static class WorkTask implements Runnable {
    static int count;
    @Override
    public void run() {
        count++;
    }
}
public static void main(String... args) throws Exception {
    WorkTask wt = new WorkTask();
    wt.count = 41;
    Thread a = new Thread(wt);
    a.start();
    System.out.println(wt.count);
}
}

The problem is due to the print statement running before thread had a chance to start.
To cause the current thread ( the thread that is going to read variable count ) to wait until the thread finishes, add the following after starting thre thread.
a.join();

A: If you are wishing to get a result back from a thread, I would recommend you to use Callable
interface and an ExecutorSercive to submit it. e.g:
    Future future = Executors.newCachedThreadPool().submit
    (new Callable<Interger>()
    {
        int count = 1000;

        @Override public Integer call() throws Exception
        {
            //here goes the operations you want to be executed concurrently.
            return count + 1;   //Or whatever the result is.
        }
    }

    //Here goes the operations you need before the other thread is done.

    System.out.println(future.get());    //Here you will retrieve the result from
    //the other thread. if the result is not ready yet, the main thread
    //(current thread) will wait for it to finish.

this way you don't have to deal with the synchronization problems and etc.
you can see further about this in Java documentations:
http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/package-summary.html


text:
Q: Show $D = \delta_1 +\cdots+ \delta_m$ is in the center of the group ring $RG$ .
Let $\Delta$ = {$ \delta_1,\dots, \delta_m$} be a conjugacy class in a finite group $G$. Prove that the element $D = \delta_1 + \cdots + \delta_m$ is in the center of the group ring $RG$ .

Hint: Check that $g^{-1}Dg = D$ for all $g \in G$.
Attempt proof: Let $X = \Sigma_{j = 1}^n r_jg_j$ and $D =\Sigma_{i = 1}^m \delta_i$.
$g^{-1}Dg = g^{-1}(\Sigma_{i = 1}^m \delta_i)g = \Sigma_{i = 1}^m(g^{-1}\delta_i g) = \Sigma_{i = 1}^m \delta_i = D$.
Then suppose $X = \Sigma_{j = 1}^n r_jg_j$ is an element of $Z(RG)$. Then we need to show $DX = XD$.
Then for any $X \in RG$, we have
$$DX = (\Sigma_{i = 1}^m \delta_i) (\Sigma_{j = 1}^n r_jg_j) = \Sigma_{i = 1}^m \Sigma_{j = 1}^n \delta_ir_jg_j = \Sigma_{j = 1}^n \Sigma_{i = 1}^m \delta_ir_jg_j = \Sigma_{j = 1}^nr_j(\Sigma_{i = 1}^m \delta_i)g_j = \Sigma_{j = 1}^nr_jDg_j = \Sigma_{j = 1}^n (r_jg_j)D = (\Sigma_{j = 1}^n r_jg_j)D = XD,$$
so $D \in Z(RG)$.
Can someone please verify this? Any suggestions or better approach will be appreciated it. Thanks!

A: Yes that's fine. You can unclutter it by removing indices for one:
$$g Dg^{-1}=g\left(\sum_{\delta\in\Delta}\delta\right)g^{-1}=\sum_{\delta\in\Delta} g\delta g^{-1}=\sum_{\delta\in g\Delta g^{-1}}\delta=\sum_{\delta\in\Delta}\delta=D. $$
Also when going on to prove $D$ is central, there's no need to write out $D$:
$$DX=D\left(\sum_{g\in G}x_gg\right)=\sum_{g\in G}x_g(Dg)=\sum_{g\in G}x_g(gD)=\left(\sum_{g\in G}x_gg\right)D=XD. $$


text:
Q: can not use ggplot in pycharm but spyder can from ggplot import *
import pandas as pd
y_name = 'y'
df = pd.DataFrame({"x":[1,2,3,4],y_name:[4,5,6,7]})
p =ggplot(df, aes(x='x', y='y'))+geom_point()

Then my PyCharm collapse, no photo and I have to restart python consol. But this code work in spyder.
Also when I do:
from ggplot import *

in PyCharm, it warns me that:
from ggplot import *
Backend Qt5Agg is interactive backend. Turning interactive mode on.
C:\Anaconda3\lib\site-packages\ggplot\utils.py:81: FutureWarning: pandas.tslib is deprecated and will be removed in a future version.
You can access Timestamp as pandas.Timestamp
  pd.tslib.Timestamp,
C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py:20: FutureWarning: The pandas.lib module is deprecated and will be removed in a future version. These are private functions and can be accessed from pandas._libs.lib instead
  module = self._system_import(name, *args, **kwargs)
C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py:20: FutureWarning: The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.
  module = self._system_import(name, *args, **kwargs)

this would not show up in spyder.


text:
Q: Apache2 Error : Either the vistor clicked on the 'Stop' button in the web browser Im getting this in my apache2 error logs
  $[ pid=1388 thr=140670179071840 file=ext/apache2/Hooks.cpp:789 time=2012-03-30 18:44:52.209 ]: Either the vistor clicked on the 'Stop' button in the web browser, or the visitor's connection has stalled and couldn't receive the data that Apache is sending to it. As a res$

My site freezes after a short period and this is the error being shown.
Any ideas?

A: By a short time, what do you mean?  Seconds, minutes?  Under 30 seconds?  And is it consistent? Do you see the exact same delay each time?  Are you using unicorn? I know I am asking a lot of questions but at each layer there is a timeout that could be causing this issue.
I suggest upping the timeout on each layer.


text:
Q: How can I fix ValueError: Too many values to unpack" in Python? I am trying to populate a dictionary with the contents of my text file ("out3.txt").
My text file is of the form:
vs,14100

mln,11491

the,7973

cts,7757

...and so on...
I want my dictionary answer to be of the form:
answer[vs]=14100

answer[mln]=11491

...and so on...
My code is:
import os
import collections
import re
from collections import defaultdict

answer = {}
answer=collections.defaultdict(list)
with open('out3.txt', 'r+') as istream:
    for line in istream.readlines():
        k,v = line.strip().split(',')
        answer[k.strip()].append( v.strip())

But, I get:

ValueError: too many values to unpack

How can I fix this?

A: Your solution doesn't give your desired output. You'll have (assuming it worked), answer['vs'] = [14100], the below does what you intended:
import csv

with open('out3.txt') as f:
  reader = csv.reader(f, delimiter=',')
  answer = {line[0].strip():line[1].strip() for line in reader if line}

A: You do not need the collections here. Plain old dict is enough:
answer = {}
with open('out3.txt', 'r+') as f:
    for line in f:
        lst = line.split(',')
        if len(lst) == 2:
            k = lst[0].strip()
            v = lst[1].strip()
            answer[k] = v

print(answer['mln'])
print(answer.get('xxx', 'not available'))

Notice the answer.get() is similar to answer[] but you can supply the defaul value.
You should not use .readlines() in the loop. Even the empty line contains the newline character. This way the test if line: does not detects the empty lines. Or you have to strip (or rstrip) it first, or you can split the line to the list and test the number of elements.

A: You have empty lines in your input file and I suspect one of the lines that you have not shared with us has too many commas in it (hence "too many values to unpack").
You can protect against this, like so:
import collections

answer = collections.defaultdict(list)
with open('out3.txt', 'r+') as istream:
    for line in istream:
        line = line.strip()
        try:
            k, v = line.split(',', 1)
            answer[k.strip()].append(v.strip())
        except ValueError:
            print('Ignoring: malformed line: "{}"'.format(line))

print(answer)

Note: By passing 1 into str.split(), everything after the first comma will be assigned to v; if this is not desired behaviour and you'd prefer these lines to be rejected, you can remove this argument.


text:
Q: Xamarin.Forms. Android.Views.InflateException I have recently migrated code to support AndroidX and new versions of Xamarin.Forms ()Im trying to show a scanner activity which holds surface view in a linear layout, but it crashes on  SetContentView, the Inner exception says - Binary XML file line #18 in com.dmi.ocuityaiqa:layout/select_dialog_multichoice_material: Error inflating class android.widget.CheckedTextView
  --- End of managed Android.Views.InflateException stack trace ---
android.view.InflateException: Binary XML file line #18 in com.dmi.ocuityaiqa:layout/select_dialog_multichoice_material: Error inflating class android.widget.CheckedTextView
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    at android.view.LayoutInflater.createView(LayoutInflater.java:858)
    at android.view.LayoutInflater.createView(LayoutInflater.java:780)
    at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:934)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:954)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1008)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:663)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
    at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:533)
    at android.app.Activity.setContentView(Activity.java:3589)
    at crc6456e73fe34cc28457.ScanBarcodeActivity.n_onCreate(Native Method)
    at crc6456e73fe34cc28457.ScanBarcodeActivity.onCreate(ScanBarcodeActivity.java:45)
    at android.app.Activity.performCreate(Activity.java:8290)
    at android.app.Activity.performCreate(Activity.java:8270)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4009)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4201)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8663)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 17: TypedValue{t=0x2/d=0x7f030174 a=-1}
    at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:783)
    at android.view.View.<init>(View.java:5838)
    at android.widget.TextView.<init>(TextView.java:1264)
    at android.widget.CheckedTextView.<init>(CheckedTextView.java:102)
    at android.widget.CheckedTextView.<init>(CheckedTextView.java:98)
    at android.widget.CheckedTextView.<init>(CheckedTextView.java:94)
    ... 32 more

How to fix this I verified if supporting packages for AndroidX migration are added, everything is in place. Thank you!
Please Find Below Code -
[Activity(Label = "Scan Barcode/QR Code",Theme = "@style/MainTheme.Base")]
public class ScanBarcodeActivity : Activity, ISurfaceHolderCallback, IProcessor
{
    SurfaceView cameraPreview;
    CameraSource cameraSource;
    const int RequestCameraPermissionID = 1001;
    ScanType scanType;

    public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] AndroidContentPM.Permission[] grantResults)
    {
        switch (requestCode)
        {
            case RequestCameraPermissionID:
                {
                    if (grantResults[0] == AndroidContentPM.Permission.Granted)
                    {
                        if (ActivityCompat.CheckSelfPermission(ApplicationContext, Manifest.Permission.Camera) != Android.Content.PM.Permission.Granted)
                        {
                            //Request permission
                            ActivityCompat.RequestPermissions(this, new string[]
                            {
                               Manifest.Permission.Camera
                            }, RequestCameraPermissionID);
                            return;
                        }
                        cameraSource.Start(cameraPreview.Holder);
                    }
                }
                break;
        }
    }

    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

        CrossScanningService.Current.ScanCompleted += Current_ScanCompleted;

        this.scanType = (ScanType)Enum.Parse(typeof(ScanType), Intent.GetStringExtra("ScanType"));

        this.Title = this.scanType == ScanType.Barcode ? "Scan Barcode or QR Code" : "Scan OCR";

        SetContentView(Resource.Layout.ScanBarcodeLayout);

        cameraPreview = FindViewById<SurfaceView>(Resource.Id.cameraPreview);
        var cancelButton = FindViewById<Button>(Resource.Id.cancelScanButton);
        cancelButton.Click += CancelButton_Click;

        switch (this.scanType)
        {
            case ScanType.Barcode:

                BarcodeDetector barcodeDetector = new BarcodeDetector.Builder(this)
            .Build();


text:
Q: How to prevent push notifications to app after reinstallation? Since iOS 9 application changes apns token after reinstallation of an application.
But  iOS 8 and 7 doesn't do it.
How can I distinguish next situation using iOS 8 and iOS 7?

*

*User installed an app.

*User launched app and allowed push notifications in the app. (I getted some token)

*User logged in/registered. (I connected token with registered user).

*User deleted the app.

*User installed the app, launched it once and allowed push notifications. (getted the same token, )

After these actions, this unregisterd user will get notifications about some actions in his account without needs to log in.
If it were a bank/finance app, it would influence the security of registered user.
How to prevent this?

A: You can call
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
in
-application:didFinishLaunchingWithOptions: method. Then, when user logs in, register for remote notifications.
But anyway, if app is uninstalled and installed again, it will not receive push notifications until -registerForRemoteNotifications get called, and you must call this method ONLY after user authentication. Even if token is same as previous one, it will associated with this new user, and your server should handle that.


text:
Q: Class-level event handler in WPF HEllo,
can someone explain me what class-level event handler is in WPF? I use routed events in WPF but currently I read a book and I found the author mentions about class-level event handler. What is the practical use of this technique?

A: Think of class handlers as static event handlers for a routed event. You might want to register such a handler if you want, for example, handle all mouse down events without any particular instance of the object involved. You would typically register it in a static constructor of a class:
static MyWindow()
{
    EventManager.RegisterClassHandler(typeof(MyWindow), PreviewMouseLeftButtonDownEvent, new RoutedEventHandler(OnMouseLeftButtonDown));
}

See also:
http://msdn.microsoft.com/en-us/library/ms597875.aspx
http://karlshifflett.wordpress.com/2008/04/22/wpf-sample-series-eventmanagerregisterclasshandler/


text:
Q: PHPExcel Render html tags inside cell not as plain text Is the current PHPExcel can now format HTML tags inside excel cell?
This is like question here
I have a table from database that has field that contains string with html tags
i.e.  hello
and I want it to output in excel not as a plain text but something like this hello
Is there any php to excel library that can do this? any idea? thanks in advance

A: No! PHPExcel doesn't have any built-in logic to do this; and nor does any other library that I'm aware of.
You'd need to write some code yourself to handle the conversion from HTML to a Rich Text Run.... there's some logic inside the HTML Reader that you might be able to use as the basis for this.
EDIT
Since this answer was written, a helper class has been added to the PHPExcel library that will take a basic block of simple html markup and convert it to a rich text object that can be set as a cell value. This is the PHPExcel_Helper_HTML class, with it's toRichTextObject() method, that takes an argument of a block of html and returns a Rich Text Object. There are examples demonstrating its use in Examples/42richText.php
$html = '

My very first example of rich text
generated from html markup

This block contains an italicized word;
while this block uses an underline.

I want to eat healthy food pizza.

';

$wizard = new PHPExcel_Helper_HTML;
$richText = $wizard->toRichTextObject($html);

While not all markup is supported, and it doesn't use stylesheets, and only a limited set of inline style elements, it works well enough with basic markup elements.

A: I have spent a lot of time on this thing. But i am not getting goal. Thier is a no way write like this and get data as our wish. I apperitiate with Mark answer, Try with your own script.


text:
Q: How to schedule a cron task for every 24 hours and 15 minutes I can't for the life of me wrap my head around cron notation. I've been playing around with crontab calculators for about 20 minutes trying to make it work out.
I need to run my task every 24 hours and 15 minutes. Can anyone help me figure this out?
Thanks!

A: NO idea why you want this.
Create a shell script:

*

*Read a file

*check the number stored in it

*execute whatever if the counter % 97 == 0 or increment counter by 1

*on execution you might want to reset your number to 0 as well

*cron job that executes every 15 minutes and calls the script

If your server ever goes down you get a shift in your execution by the downtime occurred.
Have a read here: https://unix.stackexchange.com/a/10650 as well, they detail small Perl scripts with while true __something__ sleep and the watch approach as well as other methods.
@Edit as response to EdHeals comment:
This approach will have an additional sliding time due to 97 script executions a day - script execution time is quite fast (opening file, inspecting number, increment/null it + save file should be well below 1s) - still, its 97*x a day sliding time.
Cron executions may also slide, it only guarantee is that your job will start no sooner than the specified time.


text:
Q: Embed DWG file in HTML I want to ask how to embed DWG file in HTML Page.
I have tried using  tag with Volo Viewer but this solution run only in IE not in Firefox and Chrome.

A: Dwgview-x can do that, but it will need to be installed as a plug-in on client computers so that anyone  can view the dwg file that you embed online.

A: There may be third party ActiveX controls that you could use, but I think ultimately you will find that it's not practical for drawing files of even average complexity. I recommend to create DWF (if you need vector format) or PNG files on demand (using e.g. the free DWG TrueView from http://usa.autodesk.com/design-review/ ) and embed those instead.

A: I use DWG Browser. Its a stand alone program that is used for reporting and categorizing drawings with previews. It saves exports in html too.
They have a free demo download available.
http://www.graytechnical.com/software/dwg-browser/

A: You'll find what I think is the latest information on Autodesk's labs site here: http://labs.blogs.com/its_alive_in_the_lab/2014/01/share-your-autodesk-360-designs-on-company-web-sites.html
It looks like a DWG can be embeded there is an example on this page, but clearly DWF is the way to go.

A: You can embed DWG file's content in an HTML page by rendering the file's pages as HTML pages or images. If you find it an attractive solution then you can do it using GroupDocs.Viewer API that allows you to render the document pages as HTML pages, images, or a PDF document as a whole. You can then include the rendered HTML/image pages or whole PDF document in your HTML page.
Using C#
ViewerConfig config = new ViewerConfig();
config.StoragePath = "D:\\storage\\";

// Create HTML handler (or ViewerImageHandler for rendering document as image)
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);

// Guid implies that unique document name
string guid = "sample.dwg";

// Get document pages in html form
List<PageHtml> pages = htmlHandler.GetPages(guid);

// Or Get document pages in image form using image handler
//List<PageImage> pages = imageHandler.GetPages(guid);

foreach (PageHtml page in pages)
{
    // Get HTML content of each page using page.HtmlContent
}

Using Java
// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
// Set storage path
config.setStoragePath("D:\\storage\\");

// Create HTML handler (or ViewerImageHandler for rendering document as image)
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);

String guid = "Sample.dwg"

// Get document pages in HTML form
List<PageHtml> pages = htmlHandler.getPages(guid);

for (PageHtml page : pages) {
     // Get HTML content of each page using page.getHtmlContent
}

Disclosure: I work as a Developer Evangelist at GroupDocs.


text:
Q: Can't get udev rule to work I'm trying to run a script when my mouse connects.
#!/bin/sh

echo New mouse speed applied
id=17
speed=1
xinput set-prop $id "Coordinate Transformation Matrix" $speed, 0, 0, 0, $speed, 0, 0, 0, 1
firefox #Starting this so I'll see instantly if it worked

The udev rule:
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idProduct}=="0405", ATTRS{idVendor}=="145f", RUN+="/home/matthes/.mousespeed.sh"

The script works, I tested it manually.
$ udevadm info -a -p /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1/0003:145F:0405.001A/input/input43/mouse4

looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3':
    KERNELS=="1-3"
    SUBSYSTEMS=="usb"
    [...]
    ATTRS{idProduct}=="0405"
    ATTRS{idVendor}=="145f"
    [...]
    ATTRS{product}=="Trust Gaming Mouse"
    [...]

idProduct and idVendor are correct too, I can't figure out why it won't work. Thanks for any help!


text:
Q: Importing Angular library into Lotus Domino db I'm experimenting with using Angular and so am looking to import the standard library angular.min.js into a Domino database with Domino designer.
However when I do this, I get zillions of javascript errors in the imported file.
I have tried:

*

*Pasting in as a javascript script library

*Importing directly as a Resource file

*Importing as WebContent via Package Explorer.

The version of angular.min.js I am using is straight from the Angular website, and works just fine if included in a locally run html file.
The symptoms are that firstly including the file doesn't work (generates script errors in browser) and if I look at the resource / script lib etc I see loads of red markers for syntax errors.
The odd part is that the same method(s) to include jquery seem to work fine.
Has anyone else managed this?  Surely they must have.. I bet I'm doing something impressivley stupid
In case it's relevant, this is eventually for use in an xpage.

A: Here are some interesting links for starting with angular and domino:
http://hasselba.ch/blog/?p=1458
http://hasselba.ch/blog/?p=1485
http://hasselba.ch/blog/?p=1525
http://hasselba.ch/blog/?cat=50
http://xomino.com/2014/06/01/angular-js-in-xpages-6-a-people-manager-crud-application/
I hope this helps...

A: First: forget about opening the Angular JS file in Designer. It will throw errors because it uses JavaScript syntax that isn't supported by the built-in editor. The file is (probably) just fine.
Next, I'm not sure where you're loading the file exactly, but if you want to do it in an XPage: here's a simple example I just created and that works:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
    xmlns:xp="http://www.ibm.com/xsp/core">
    <xp:this.attrs>
      <xp:attr
        name="ng-app"
        value="myApp">
     </xp:attr>
    </xp:this.attrs>

<xp:this.resources>
    <xp:script
        src="angular/angular.min.js"
        clientSide="true">
    </xp:script>
</xp:this.resources>

<div ng-controller="MyController">
    {{hello}} this
</div>

<xp:scriptBlock
    id="scriptBlock1">
    <xp:this.value><![CDATA[var app = angular.module('myApp', []);

app.controller('MyController', function($scope) {

  $scope.hello = 'world';

});
]]></xp:this.value>
</xp:scriptBlock>

</xp:view>


text:
Q: Checking if a positive integer is a power other than a first power On page 43 of the pdf given as reference 2 at http://en.wikipedia.org/wiki/AKS_primality_test, the authors mention that this can be done in almost cubic time with Newton's method, although I can't figure out how this would work.
I do know about almost-linear time multiplication.
(this is theoretical enough that I'm guessing it goes here rather than on stackoverflow)

A: A fast way of calculating $\sqrt{N}$ is the following iteration. Set $c_1=N$, then $c_{n+1}=\frac{c_n+N/c_n}{2}$. It is easy to see that $c_n>\sqrt{N}$ and the error is halved in each step, so we get $\lceil\sqrt{N}\rceil$ in linear time. If its square is $N$, then $N$ is a square, otherwise not. This is the Newton iteration for the function $f(x)=\sqrt{x}$. The corresponding thing must be done for the $k$-th root for each $k\leq\log(N)$.

A: I don't know how to do it in cubic time, but I suppose that, to use Newton's Method, you could do the following:
Find floor(log2n), and this is the largest "power" that it can be.  Then, define:
$f_k(x) = x^k - n$ where n is your number and k is the floor value, and iterate Newton's Method until you get a number whose floor is m that fits any of the following:
1) mk < n && (m+1)k > n
2) mk > n && (m-1)k > n
3) mk == n
If the third is true, congrats, you've found yourself a root!  Otherwise, reduce k by 1 and try again.
The problem with this is that I don't know how long it'll take for such a value of m to be found.  Wikipedia says Newton's Method has a quadratic convergence, and you're making a fixed number of operations each iteration of the Method, so I guess its running-time would be pretty fast.


text:
Q: Procedure or function Proc_PIP_Employee has too many arguments specified I am getting error

Procedure or function Proc_PIP_Employee has too many arguments specified

when trying to call procedure Proc_PIP_Employee from C# code. The count of parameters checked and those are same. Also datatypes are same. Even after that getting the same error.
C# code is
public int Add_Record(Employee emp)
{
    try
    {
        if (con.State != ConnectionState.Open)
            con.Open();

        using (SqlCommand cmd = con.CreateCommand())
        {
            SqlParameter RETURN_VALUE_OUTPUT = new SqlParameter();
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "dbo.Proc_PIP_Employee";

            cmd.Parameters.Add("@Flag", SqlDbType.Int).Value = 1;
            cmd.Parameters.Add("@Empid", SqlDbType.Int).Value = 0;
            cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = emp.Name ;
            cmd.Parameters.Add("@Designation", SqlDbType.VarChar).Value = emp.Designation;
            cmd.Parameters.Add("@Department", SqlDbType.VarChar).Value = emp.Department;
            cmd.Parameters.Add("@DateofJoin", SqlDbType.DateTime).Value = emp.Dateofjoin;
            cmd.Parameters.Add("@Phone", SqlDbType.VarChar).Value = emp.Phone;
            cmd.Parameters.Add("@Isactive", SqlDbType.Int).Value = emp.IsActive;
            cmd.Parameters.Add("@LoginUser", SqlDbType.NVarChar).Value = "admin";

            RETURN_VALUE_OUTPUT = cmd.Parameters.Add("@ReturnId",SqlDbType.Int);
            RETURN_VALUE_OUTPUT.Direction = ParameterDirection.Output;

            cmd.ExecuteNonQuery();

            ReturnID = Convert.ToInt32(RETURN_VALUE_OUTPUT.Value.ToString());
        }
    }
    catch (SqlException ex)
    {
    }

    return ReturnID;
}

The stored procedure is:
ALTER PROCEDURE [dbo].[Proc_PIP_Employee]
    @Flag int,
    @Empid int,
    @Name varchar(500),
    @Designation varchar(200),
    @Department varchar(200),
    @DateofJoin datetime,
    @Phone varchar(3000),
    @Isactive int,
    @LoginUser nvarchar(500)
AS
BEGIN
    SET NOCOUNT ON ;

    DECLARE @errorMessage VarChar(8000),
            @errorSeverity Int,
            @errorState Int,
            @ReturnId Int,
            @AlCode varchar(50),
            @AlDesc varchar(1000),
            @AlOp varchar(50),
            @AlStatus varchar(50)

    BEGIN TRY
    BEGIN TRANSACTION
        IF (@Flag = 1)
        BEGIN
            IF EXISTS (SELECT 1 FROM dbo.PIP_Employee
                       GROUP BY Name, Phone

A: You're adding an OUTPUT parameter for this stored procedure to your C# code - but there's no @ReturnId OUTPUT parameter in your stored procedure interface:
SqlParameter RETURN_VALUE_OUTPUT = new SqlParameter();
RETURN_VALUE_OUTPUT = cmd.Parameters.Add("@ReturnId",SqlDbType.Int);
RETURN_VALUE_OUTPUT.Direction = ParameterDirection.Output;

If you attempted to capture the return value - then use ParameterDirection.ReturnValue instead
SqlParameter RETURN_VALUE_OUTPUT = new SqlParameter();
RETURN_VALUE_OUTPUT = cmd.Parameters.Add("@ReturnId",SqlDbType.Int);
RETURN_VALUE_OUTPUT.Direction = ParameterDirection.ReturnValue;


text:
Q: Twitter search API: "Unauthorized" through HTTParty but successful via Curl Working on our Rails application, I'm trying to retrieve tweets using the search API v1.1 through HTTParty. I've carefully gone through all steps and unit tested our code with the Twitter examples to setup the right OAuth authorization, so I'm very confident all code is working properly. However, no matter what I try, I keep getting a "{"errors":[{"message":"Could not authenticate you","code":32}]}"" response.
Using the OAuth Tool, I generated the request that I need. I pasted the nonce and timestamp into my code, to replicate the exact same request in our application. This is the resulting log:
opening connection to api.twitter.com...
opened
<- "GET /1.1/search/tweets.json?q=from:plindelauf&include_entities=true HTTP/1.1\r\nAuthorization: OAuth oauth_consumer_key=\"DOP3re9nlTPeyemlmcqg\", oauth_nonce=\"05d29110d282b24e516dae1ae2b54e1a\", oauth_signature=\"k9gHhrHD86D5sB7zAlXCKsaeNZ8%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1370691632\", oauth_token=\"288762088-DfqCgEIVvM56MSMZWjLuLl6oo3oaVkI0Z8ATKu3f\", oauth_version=\"1.0\"\r\nConnection: close\r\nHost: api.twitter.com\r\n\r\n"
-> "HTTP/1.1 401 Unauthorized\r\n"
-> "content-length: 63\r\n"
-> "content-type: application/json; charset=utf-8\r\n"
-> "date: Sat, 08 Jun 2013 11:41:41 UTC\r\n"
-> "server: tfe\r\n"
-> "set-cookie: guest_id=v1%3A137069170192515887; Domain=.twitter.com; Path=/; Expires=Mon, 08-Jun-2015 11:41:41 UTC\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "Connection: close\r\n"
-> "\r\n"
reading 63 bytes...
-> ""
-> "{\"errors\":[{\"message\":\"Could not authenticate you\",\"code\":32}]}"
read 63 bytes
Conn close

Note that even though the above dump does not show it, I have verified that the request is sent via https.
Then executing the CURL command from the OAuth Tool works just fine:
curl --get 'https://api.twitter.com/1.1/search/tweets.json' --data 'include_entities=true&q=from%3Aplindelauf' --header 'Authorization: OAuth oauth_consumer_key="DOP3re9nlTPeyemlmcqg", oauth_nonce="05d29110d282b24e516dae1ae2b54e1a", oauth_signature="k9gHhrHD86D5sB7zAlXCKsaeNZ8%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1370691632", oauth_token="288762088-DfqCgEIVvM56MSMZWjLuLl6oo3oaVkI0Z8ATKu3f", oauth_version="1.0"' --verbose
* About to connect() to api.twitter.com port 443 (#0)
*   Trying 199.16.156.8...
* connected
* Connected to api.twitter.com (199.16.156.8) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
*    subject: C=US; ST=California; L=San Francisco; O=Twitter, Inc.; OU=Twitter Security; CN=api.twitter.com
*    start date: 2013-04-08 00:00:00 GMT
*    expire date: 2013-12-31 23:59:59 GMT
*    subjectAltName: api.twitter.com matched
*    issuer: C=US; O=VeriSign, Inc.; OU=VeriSign Trust Network; OU=Terms of use at https://www.verisign.com/rpa (c)09; CN=VeriSign Class 3 Secure Server CA - G2
*    SSL certificate verify ok.
> GET /1.1/search/tweets.json?include_entities=true&q=from%3Aplindelauf HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: api.twitter.com
> Accept: */*
> Authorization: OAuth oauth_consumer_key="DOP3re9nlTPeyemlmcqg", oauth_nonce="05d29110d282b24e516dae1ae2b54e1a", oauth_signature="k9gHhrHD86D5sB7zAlXCKsaeNZ8%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1370691632", oauth_token="288762088-DfqCgEIVvM56MSMZWjLuLl6oo3oaVkI0Z8ATKu3f", oauth_version="1.0"
>
< HTTP/1.1 200 OK
< cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
< content-length: 14040
< content-type: application/json;charset=utf-8
< date: Sat, 08 Jun 2013 11:42:20 GMT
< expires: Tue, 31 Mar 1981 05:00:00 GMT
< last-modified: Sat, 08 Jun 2013 11:42:20 GMT
< pragma: no-cache
< server: tfe
< set-cookie: lang=en
< set-cookie: guest_id=v1%3A137069174010710877; Domain=.twitter.com; Path=/; Expires=Mon, 08-Jun-2015 11:42:20 UTC
< status: 200 OK
< strict-transport-security: max-age=631138519
< x-access-level: read
< x-frame-options: SAMEORIGIN
< x-rate-limit-limit: 180
< x-rate-limit-remaining: 179
< x-rate-limit-reset: 1370692640
< x-transaction: 4b4022555f454e2b
< x-xss-protection: 1; mode=block
...[the whole response body with all found tweets]...

I've also tried to see if it makes a difference when I send the query parameters separately, but that does not seem to be the case, since this curl command works just fine as well:
curl --get 'https://api.twitter.com/1.1/search/tweets.json?include_entities=true&q=from%3Aplindelauf' --header 'Authorization: OAuth oauth_consumer_key="DOP3re9nlTPeyemlmcqg", oauth_nonce="05d29110d282b24e516dae1ae2b54e1a", oauth_signature="k9gHhrHD86D5sB7zAlXCKsaeNZ8%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1370691632", oauth_token="288762088-DfqCgEIVvM56MSMZWjLuLl6oo3oaVkI0Z8ATKu3f", oauth_version="1.0"' --verbose

This has been driving me crazy for many days now! Can someone please help?!

A: I found the problem! I did not percent encode the query parameters in my HTTP request, like I did when creating the signature. Note that I was sending the query string q=from:plindelauf&include_entities=true. This needed to explicitly be include_entities=true&q=from%3Aplindelauf. Darn!


text:
Q: Android: Force Crash with Uncaught Exception in Thread I'm developing an app, and every once in a while one of my background worker threads will have an uncaught exception of one sort or another. These exceptions crash that thread, but since it's not on the UI thread the App keeps running. How can I force these uncaught exceptions in the background threads to crash the whole app? It would be nice if the same contextual crash information (such as the stack trace) were available.
I want to do this so that when I release the app to my testers it doesn't become unresponsive. Instead, when the background thread has an uncaught exception the App will go to it's crash handler and send me a report (I'm using ACRA, but that shouldn't matter). That's better than an app that silently fails.

A: Late answer, but I was asking myself the same question.
We use Crashlytics in Production, but if the app is build for development, some assertion are enabled, and logging an error actually throws it, so that we developer can detect any incorrect behavior.
But as you remarked, throwing an error in a background thread doesn't crash the app.
To ensure the app crashes immediately when build for development we simply use an Handler on the main looper to throw the exception on the main thread.
It looks a bit like this :

public static void assertTrue(boolean condition, String msg) {
    if (condition) {
        return;
    }

    final IllegalStateException e = new IllegalStateException(message);
    if (BuildConfig.RELEASE) {
        Crashlytics.logException(e);
        return;
    }

    Log.e("ASSERT", message, e);
    if (Looper.getMainLooper() != Looper.myLooper()) {
        mMainThreadHandler.post(new Runnable() {
            @Override
            public void run() {
                throw e;
            }
        });
    }

    throw e;
}

A: Original version below
Actually, after further testing I have found that you can simplify your code by just handing the exception to your main thread directly.
public static <T extends Exception> void throwOnMainThread(T exception) {
    Thread mainThread = Looper.getMainLooper().getThread();
    mainThread.getUncaughtExceptionHandler().uncaughtException(mainThread, exception);
}

This will crash the main thread from anywhere and is safe to call even without setting a custom UncaughtExceptionHandler.
Original answer:
Consider the following static method for crashing the main thread from a background thread:
public static <T extends Exception> void throwOnMainThread(final T exception) {
    Handler mainThreadHandler = new Handler(Looper.getMainLooper());
    mainThreadHandler.post(new Runnable() {
        @Override
        public void run() {
            Thread currentThread = Thread.currentThread();
            currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, exception);
        }
    });
}

First we get a Handler for the Main Thread via the main Looper. Then we post a Runnable which will invoke the UncaughtExceptionHandler of that thread and hand it our exception.
Put this into a utils class and you will be able to throw exceptions on the main thread from basically anywhere.
Crashing the main thread could then be achieved by using
ThreadUtils.throwOnMainThread(new RuntimeException());

for example.

A: you can catch your uncaught exception in class that implement java.lang.Thread.UncaughtExceptionHandler.

*

*create a class that implements the UncaughtExceptionHandler and put the behavior you want in uncaughtException overidden function.
you can do in this function any behavior you want like send logs to server, show custom crash dialog to user etc.

*in your activity/thread add Thread.setDefaultUncaughtExceptionHandler(); and give an instance of your exception handler class.


text:
Q: Using Microsoft word fonts in latex I have a document written in Microsoft Word where the following languages were used:
Greek, Coptic and Hebrew in addition to Arabic and Hieroglyph languages as well as Syriac.
I used Unicode fonts to write the document, such fonts include:
Coptic: FreeSerifAvvaShenouda - Antinoou
Greek: Palatino linotype
Syrian: Setro Jerusalim
arabic: Simplified Arabic
Hebrew: Ezra SIL
I need a way to convert the document to LaTeX without re-writing the body text.
The issue is to re-write the text written in Coptic language as well as Hieroglph and syrian. Is there a way to convert a MS-fonts to latex fonts.
"So the main issue is how to use MS-unicode/non-unicode fonts in altex - HOw to convert a MS word document to LAtex without re-writing the body text"
Find attached a sample of the text used


text:
Q: Perform http health check on backend servers with haproxy Is it possible to perform HTTP healthcheck on individual backend servers and load balance among active backend servers.
This works fine with single backend server when we mention host name in httpchk (option httpchk GET  /info HTTP/1.1 Host:\ abc.mysrv1.com)
However i am unable to successfully configure it with multiple backend servers as i can't give individual host name on httpchk command and with below backend configuration getting http 400 error -

backend svc.op
    balance roundrobin
    mode http
    http-send-name-header Host
    option httpchk GET  /info HTTP/1.1
    http-check send-state
    http-request set-uri /test/abcService
    server abc.mysrv1.com abc.mysrv1.com:80 check
    server abc.mysrv2.com  abc.mysrv2.com:80 check

[WARNING] 115/162226 (4788) : Server svc.op/abc.mysrv1.com is DOWN, reason: Layer7 wrong status, code: 400, info: "Bad Request: missing required Host header", check duration: 1ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[WARNING] 115/162227 (4788) : Server svc.op/abc.mysrv2.com is DOWN, reason: Layer7 wrong status, code: 400, info: "Bad Request: missing required Host header", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 115/162227 (4788) : backend ' svc.op' has no server available!

$ ./haproxy -version
HA-Proxy version 1.6.7 2016/07/13
UPDATE:
I didn't pursue this but someone suggested following  -
backend h_a01
    mode http
    option httpchk GET /health HTTP/1.1\r\nHost:\ a01\r\n
    http-check expect rstatus ^200
    http-request set-uri /hello/world
    http-request set-header Host a01
    server a01 a01 check

backend h_a02
    mode http
    option httpchk GET /health HTTP/1.1\r\nHost:\ a02\r\n
    http-check expect rstatus ^200
    http-request set-uri /hello/world
    http-request set-header Host a02
    server a02 a02 check

backend a
    mode http
    option forwardfor
    http-send-name-header Host
    http-request set-uri /hello/world
    server a1 a1 track h_a01/a01
    server a2 a2 track h_a02/a02