text:
Q: Split text containing numbered lines into array of sentences How can I convert this numbered paragraph into an array of sentences?
1. The best foods for your cat's diet
2. How to ensure your cat is getting enough nutrients
3. The importance of a balanced diet for cats
4. How to make sure your cat is getting enough water
5. Tips for dealing with finicky eaters
6. How to tell if your cat is overweight
7. The dangers of overfeeding your cat5

Desired output:
$sentences = [
    "The best foods for your cat's diet",
    "How to ensure your cat is getting enough nutrients",
    "The importance of a balanced diet for cats",
    "How to make sure your cat is getting enough water",
    "Tips for dealing with finicky eaters",
    "How to tell if your cat is overweight",
    "The dangers of overfeeding your cat5"
];

A: Split the text on:

*

*optional leading newline sequences (\R* or \R?)

*a number (\d+)

*a dot (\.)

*then a space ( )

Code: (Demo)
var_export(
    preg_split(
        '/\R*\d+\. /',
        $text,
        0,
        PREG_SPLIT_NO_EMPTY
    )
);


text:
Q: What is polytropic index?
*

*What is polytropic index?

*What is the connection between it and work of an adiabatic system?
I tried surfing but didn't able to find a proper answer for that.

A: The polytropic index is that defined via a polytropic equation of state of the form $P \propto \rho^{1 +1/n}$, where $P$ is pressure, $\rho$ is density, and $n$ is the polytropic index.
There is a relationship between the polytropic index and the adiabatic index. The latter is defined through
$PV^{\gamma} = $constant. If we consider adiabatic changes then $\gamma$ is the ratio of specific heats.
You can see that in this case $\gamma = 1 + 1/n$, so that $n = 1/(\gamma -1)$.
For an adiabatic change in an ideal monatomic gas $\gamma = 5/3$ and the polytropic index is $n=3/2$.
Unfortunately, whilst the above is the accepted definition of polytropic index in astrophysics, it appears from a brief www trawl that many also appear to refer to $\gamma$ as the polytropic index.

A: For a polytropic process path, one in which $pV^n$=constant along the path, n is the polytropic index.  Such a process path is typically regarded as reversible, and the temperature, volume, and pressure can be varying along the path. Also, heat exchange between the system and surroundings can be occurring.  A subset of polytropic paths are adiabatic reversible paths in which no heat exchange is occurring between the system and surroundings.  In that case, k is equal to $\gamma$, the ratio of the heat capacity at constant pressure to the heat capacity at constant volume.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to use N-channel MOSFET as high side switch (non-buck switching) I have an application with some constraints for which it feels difficult to find a solution.

*

*load current more than 10A, so N channel MOSFET is preferred;

*working voltage is a bit high, between 50-80V;

*logic switch control signal, no driving capability while expecting very fast response;

*due to some reason, high side switching is required. That is, the MOSFET will be between power source and load. The load is non-inductive like one in buck converter.
I have searched the web for high-side MOSFET driver, but all are with buck type of application, coming with external capacitor connected to source of MOSFET to get ground rail to be charged. Which I don't think it works in my application where no ground rail exists after switch-on.
I found few drivers with charge pump built-in, but below 36V.
I know a workaround that uses a battery and connects the negative of the battery to source of MOSFET, but this is not a solution as I have no way to charge the battery and so it has to be replaced regularly.

A: If the application permits, you can use an isolated power supply (12V or 15V) to create the gate driver voltage, then use an optocoupler to turn MOSFET ON or off.
You could use a photovoltaic MOSFET driver (usually used for SSR)
For example the VOM1271: VOM1271
Use a automotive high side switch (it contains MOSFET and driver protection features and diagnosis), search Infineon and ST, but honestly it might be difficult to find one that works at 80V
Another example: smart high side switches

A: The newish LTC7001 allows this functionality however comes in an annoying package.

A: You say that because 10A of current is to be switched, N-channel is to be preferred. I don't see why. There are quite a few P-channel MOSFEts that can fulfill your requirements, as this search on DigiKey shows.
Just as an example, take the following model, taken from that list:


text:
Q: Trying to run script as local user on remote machine via invoke-command with domain-admin I'm trying to find a way to run scripts on a remote machine with a local user. Optimally a user of choice but it could also be the user thats currently logged in on the machine.
Here comes the tricky part .. I HAVE to use the domain admin to establish the session via invoke-command.. local users are blocked out of remote access ... but my script NEEDS to run in the local user context:
The following is one amongst many things i tried, but they all follow a similar principle:
Invoke-Command -ComputerName $computerName -Credential $adminCred  -ScriptBlock{

    Set-ExecutionPolicy unrestricted

    [string]$userName = 'xxxxx'
    [string]$userPassword = 'yyyyy'
    [securestring]$secStringPassword = ConvertTo-SecureString $userPassword -AsPlainText -Force
    [pscredential]$credObject = New-Object System.Management.Automation.PSCredential ($userName, $secStringPassword)

    start-process powershell -ArgumentList "$powershellCode" -Credential $credObject -wait -WorkingDirectory $env:windir
}

I have tried numerous ways of passing and creating the credentials of the local users.. i have played around with all the parameters for start-process and invoke-command and I've tested the same with various forms of using PSsessions, but the resulting error is always:
This command cannot be executed due to the error: Access is denied.
+ CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

Interestingly the whole command block within the invoke-command scriptblock works just fine if I run it locally.. no matter what user im logged on with.
I never have issues with invoke-command or start-process.. I just seem to get issues with this combination.
Any Ideas why this happens or workarounds?


text:
Q: How to randomize a quiz on vbnet I'm new at visual basic programming and everything was fine until our topic shifted to arrays. I tried to understand it's code using Java. (Example: method are called functions.. .)
My prof has given us an exercise to create a Quiz program that asks the user more than 5 questions (in textbox) with choices (in buttons) and computes the score at the end (All just in one form). If the user click an a button it will tell if it's right or wrong and then proceed to change the question along with the choices.
*Required: - After the user finish the quiz the score will be displayed and there should be a restart button and all the question will be asked again randomly no pattern. - Try to make functions.
I tried searching the web since yesterday and I still have made no progress at my code.
Public Class Form1
    Dim questions(5) As String
    Dim answers(5) As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Method/Function for loading the Q&A
        loadQsAndAs()
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Me.Close()
    End Sub

    Private Sub loadQsAndAs()
        'Questions
        questions(0) = "What is 1 + 1?"
        questions(1) = "Who is the first man to walk on the Moon?"
        questions(2) = "What is the name of the main character in the movie: Yes Man! (2007)"
        questions(3) = "If I gave you three apples and you ate two, how many is left?"
        questions(4) = "What do you want in your final grade?"
        questions(5) = "What is the name of the thing(s) that you use whenever you eat?"
        'Answers
        answers(0) = "2"
        answers(1) = "Neil Armstrong"
        answers(2) = "Jim Carrey"
        answers(3) = "1"
        answers(4) = "A 4.0"
        answers(5) = "A Spoon and Fork"

        TextBox1.Text = setTheQuestion()
        Button1.Text = setTheAnswer1()
        Button2.Text = setTheAnswer2()
        Button3.Text = setTheAnswer3()
        Button4.Text = setTheAnswer4()

    End Sub

    Private Function setTheQuestion() As String
        Dim randomValue As New Random
        Dim randomQ As String = ""
        Dim i As Integer
        Dim index As Integer

        For i = 0 To 0
            index = randomValue.Next(0, questions.Length)
            randomQ &= questions(index)
        Next
        Return randomQ
    End Function

    Private Function setTheAnswer1() As String
        Dim randomValue As New Random
        Dim randomAns As String = ""
        Dim i As Integer
        Dim index As Integer

        For i = 0 To 0
            index = randomValue.Next(0, answers.Length)
            randomAns &= answers(index)
        Next

        Return randomAns
    End Function

    Private Function setTheAnswer2() As String
        Dim randomValue As New Random
        Dim randomAns As String = ""
        Dim i As Integer
        Dim index As Integer

        For i = 0 To 0
            index = randomValue.Next(1, answers.Length)
            randomAns &= answers(index)
        Next

        Return randomAns
    End Function

    Private Function setTheAnswer3() As String
        Dim randomValue As New Random
        Dim randomAns As String = ""
        Dim i As Integer
        Dim index As Integer
        For i = 0 To 0
            index = randomValue.Next(2, answers.Length)
            randomAns &= answers(index)
        Next

        Return randomAns
    End Function

    Private Function setTheAnswer4() As String
        Dim randomValue As New Random
        Dim randomAns As String = ""
        Dim i As Integer
        Dim index As Integer

        For i = 0 To 0
            index = randomValue.Next(3, answers.Length)
            randomAns &= answers(index)
        Next

        Return randomAns
    End Function

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As  System.EventArgs) Handles Button6.Click
        loadQsAndAs()
    End Sub
End Class

A: Public Class Form1
Dim questions As New ArrayList
Dim answers As New ArrayList
Dim dtQAMain As New DataTable
Dim questionsCopy As New ArrayList
Dim alAnsButton As New ArrayList 'arraylist to store all answer button.
Dim totalScore As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
    'Method/Function for loading the Q&A
    alAnsButton.Add(Button1)
    alAnsButton.Add(Button2)
    alAnsButton.Add(Button3)
    alAnsButton.Add(Button4)

    loaddtQA()
    loadQsAndAs()
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button5.Click
    Me.Close()
End Sub

Private Sub loaddtQA()
    dtQAMain = New DataTable
    dtQAMain.Columns.Add("Q")
    dtQAMain.Columns.Add("A")

    For i = 0 To 5
        questions.Add("")
        answers.Add("")
    Next

    'Questions
    questions(0) = "What is 1 + 1?"
    questions(1) = "Who is the first man to walk on the Moon?"
    questions(2) = "What is the name of the main character in the movie: Yes Man!(2007)"
    questions(3) = "If I gave you three apples and you ate two, how many is left?"
    questions(4) = "What do you want in your final grade?"
    questions(5) = "What is the name of the thing(s) that you use whenever you eat?"
    'Answers
    answers(0) = "2"
    answers(1) = "Neil Armstrong"
    answers(2) = "Jim Carrey"
    answers(3) = "1"
    answers(4) = "A 4.0"
    answers(5) = "A Spoon and Fork"

    For i = 0 To questions.Count - 1
        dtQAMain.Rows.Add(questions(i), answers(i)) 'assign QA in table for scoring purpose later
    Next
End Sub
Private Sub loadQsAndAs()
    Label1.Visible = False
    For i = 0 To alAnsButton.Count - 1
        alAnsButton(i).visible = True
    Next
    questionsCopy = New ArrayList
    questionsCopy = questions.Clone 'close a copy so we dont effect the actual question copy when randomize and eliminate asked question from arraylist
    TextBox1.Text = setTheQuestion()
    setTheAnswer()
End Sub

Private Function setTheQuestion() As String

    Dim randomValue As New Random
    Dim randomQ As String = ""
    Dim index As Integer
    If questionsCopy.Count <> 0 Then
        index = randomValue.Next(0, questionsCopy.Count - 1)
        randomQ = questionsCopy(index)
        questionsCopy.RemoveAt(index) 'asked question will be remove.

    Else ' questions are finished, show the mark
        ShowMark()
    End If

    Return randomQ

End Function

Private Sub setTheAnswer() 'randonmize the answer and assign to button

    If TextBox1.Text = "" Then Exit Sub ' if question finish exit sub
    Dim randomValue As New Random
    Dim NewIndex As Integer
    Dim temp As String
    Dim answersCopy As ArrayList = answers.Clone
    For n = answersCopy.Count - 1 To 0 Step -1
        NewIndex = randomValue.Next(0, n + 1)
        ' Swap them.
        temp = answersCopy(n)
        answersCopy(n) = answersCopy(NewIndex)
        answersCopy(NewIndex) = temp
    Next

    Dim AnswerRowCheck As Integer = questions.IndexOf(TextBox1.Text)
    Dim ActualAnswer As String = dtQAMain.Rows(AnswerRowCheck).Item("A") 'check actual answer
    Dim totalRemove As Integer = 0
    For i = answersCopy.Count - 1 To 0 Step -1
        If totalRemove = 2 Then Exit For
        If answersCopy(i) <> dtQAMain.Rows(AnswerRowCheck).Item("A") Then
            answersCopy.RemoveAt(i)
            totalRemove += 1
        End If
    Next 'remove 2 of the selection,since only 4 button for answer selection and should not take out the actual answer

    For i = 0 To alAnsButton.Count - 1
        alAnsButton(i).text = answersCopy(i)
    Next

End Sub
Private Sub ShowMark()
    For i = 0 To alAnsButton.Count - 1
        alAnsButton(i).text = "" 'clear the text, no more input receive from user.
    Next
    Label1.Visible = True
    Label1.Text = totalScore & " out of 6 are correct."
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    totalScore = 0
    loadQsAndAs() 'refresh question
End Sub

Private Sub Button4_MouseClick(sender As Object, e As MouseEventArgs) Handles Button4.MouseClick, Button3.MouseClick, Button2.MouseClick, Button1.MouseClick
    If sender.text = "" Then Exit Sub
    Dim AnswerRowCheck As Integer = questions.IndexOf(TextBox1.Text) 'search question number
    If dtQAMain.Rows(AnswerRowCheck).Item("A") = sender.text Then 'checking answer
        totalScore += 1
    End If
    TextBox1.Text = setTheQuestion() 'next question
    setTheAnswer()
End Sub
End Class

The code had cover most of the necessary comment which include the idea and how it work. Random() and arraylist are the key for this program to function, just pay more attention on it. Good luck.

A: How about trying this?
Public Class Form1

    Dim questions(5) As String
    Dim answers(5) As String

    Private Sub loadQsAndAs()
        'Questions
        questions(0) = "What is 1 + 1?"
        questions(1) = "Who is the first man to walk on the Moon?"
        questions(2) = "What is the name of the main character in the movie: Yes Man! (2007)"
        questions(3) = "If I gave you three apples and you ate two, how many is left?"
        questions(4) = "What do you want in your final grade?"
        questions(5) = "What is the name of the thing(s) that you use whenever you eat?"
        'Answers
        answers(0) = "2"
        answers(1) = "Neil Armstrong"
        answers(2) = "Jim Carrey"
        answers(3) = "1"
        answers(4) = "A 4.0"
        answers(5) = "A Spoon and Fork"

        Dim random As New Random
        Dim indices = { 0, 1, 2, 3, 4, 5 }.OrderBy(Function (n) random.Next()).ToArray()
        Dim question = random.Next(questions.Length - 1)

        TextBox1.Text = questions(indices(question))

        Button1.Text = answers(indices(0))
        Button2.Text = answers(indices(1))
        Button3.Text = answers(indices(2))
        Button4.Text = answers(indices(3))

    End Sub

End Class

That's it. Nice and simple. The key trick is creating a randomize indices array to do the lookups into the questions and answers arrays.

A: Private Dim rnd As Integer

Private Function setTheQuestion() As String
    rnd = (CInt(Math.Ceiling(Rnd() * questions.Length)) + 1)
    Return questions(rnd)
End Function

Private Function setTheAnswer1() As String
    Return answers(rnd)
End Function


text:
Q: .swf will play in IE but not Chrome I have a asp.net 3.5 page that shows a file with a .swf extension.  In IE when the page is pulled up the flash file is played and all looks normal.  When I look at it in Google Chrome their is just a white space where the file should be playing.  Is their a way to make the file play when viewing in chrome?
Here is the code:
<object width="400" height="250">
        <param name="movie" value="abc.swf">
        <embed src="../StaticPages/abc.swf" width="400" height="250" />
   </object>

A: IE 7-9 will play as long as the param value is a valid path; but Chrome and other compliant browsers require both param and embed paths to be correct.

A: The page that is showing the flash file is being loaded by a text file that has the text for the page and the tags in it to run the flash file.
Once I looked at the tags more I see where the issue was.  the src and value path were not the same so chrome could not locate the file.  When I updated the file locations to match it worked.
Thanks
Original Code
<object width="400" height="250">
    <param name="movie" value="abc.swf">
    <embed src="../StaticPages/abc.swf" width="400" height="250" />

Fixed/correct Code:
<object width="400" height="250">
    <param name="movie" value="/StaticPages/abc.swf">
    <embed src="/StaticPages/abc.swf" width="400" height="250" />

A: This is most likely to be related to way you embed your swf into your page.
Especially if it also occurs in other browsers like firefox.
You can use SWFObject for this. It is an open source javascript library that handles embedding swfs in all different browsers.
More information on why this occurs: http://livedocs.adobe.com/flex/3/html/help.html?content=wrapper_13.html
Or if you want a more fancy way to display video content on a browser, try

http://flowplayer.org/demos/installation/index.html

and

http://www.longtailvideo.com/players/jw-flv-player/

A: Could you provide the actual tags / javascript you are using to place the flash file in the page?
Have you tried opening the swf file by itself in chrome to make sure it is not just a tag issue?
As DennisJaamann points out, at least as far as firefox, there are issues with tags. Firefox won't play swfs using just the object tag without specifying the proper type.
The problem of the difference in browsers is such that if you poke at the Adobe site itself, you'll see they use a public library for embedding swfs on their own site.


text:
Q: Forge authentication failure while trying to get a token: error 404 I am trying to create a 2-legged authentication token for my forge app but I can't get anyone as I am told that the ressource doesn't exist . When I run this line in my Developer Command Prompt for VS 2019:
`curl -v "https://developer.api.autodesk.com/authentication/v1/authenticate"-X "POST"-H "Content-Type:application/x-www-form-urlencoded"-d "client_id=cRQTUv3rwWcqF00qn57W8ANNUIkV0wPo&client_secret=<edited-out>&grant_type=client_credentials&scope=data:read"`

I get the following message:
`< HTTP/1.1 404 Not Found
< Date: Fri, 17 Apr 2020 13:30:41 GMT
< Content-Type: application/json
< Content-Length: 205
< Connection: keep-alive
< Access-Control-Allow-Origin:
< Access-Control-Allow-Methods: POST,GET,OPTIONS,HEAD,PUT,DELETE,PATCH
< Access-Control-Allow-Headers: Content-Length,x-ads-ul-ctx-client-id,x-ads-ul-ctx-caller-span-
id,Content-Range,Access-Control-Allow-Origin,Authorization,x-ads-test,x-ads-ul-ctx-oxygen-id,x-ads-
acm-scopes,x-ads-ul-ctx-head-span-id,If-Match,x-ads-ul-ctx-source,Accept-Encoding,If-Modified-
Since,x-ads-acm-namespace,Access-Control-Allow-Credentials,x-ads-acm-groups,Session-Id,Content-
Encoding,x-ads-ul-ctx-scope,Range,Accept,x-ads-ul-ctx-workflow-id,x-requested-with,Expect,x-ads-acm-
check-groups,If-None-Match,Content-Type,x-csrf-token
< Access-Control-Allow-Credentials: true
< Strict-Transport-Security: max-age=31536000; includeSubDomains
<
{ "developerMessage":"The requested resource does not exist.", "moreInfo":
"https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/", "errorCode":
"org.mozilla.javascript.Undefined@0"}* Connection #0 to host developer.api.autodesk.com left intact`

I have no ideas anymore. I was first following the Autodesk tutorial https://forge.autodesk.com/en/docs/oauth/v2/tutorials/get-2-legged-token/.

A: The curl command seems malformed. All the different parameters should be separated by a whitespace, for example:
curl -v "https://developer.api.autodesk.com/authentication/v1/authenticate" -X "POST" -H "Content-Type:application/x-www-form-urlencoded" -d "client_id=cRQTUv3rwWcqF00qn57W8ANNUIkV0wPo&client_secret=<your-app-secret>&grant_type=client_credentials&scope=data:read"

Also, do not share your client app secret. Go back to your Forge app under https://forge.autodesk.com/myapps and generate a new client secret so that nobody can use the one you pasted here.


text:
Q: Advanced example of RxJS5 combination with delayed observable Hy, i faced a problem with RxJS Combination operators...
here is example object:
const userData = {
        dbKeyPath: 'www.example.com/getDbKey',
        users:[
            {name:'name1'},
            {name:'name2'},
            {name:'name3'}
        ]
    }

Make observable from them:
const userDataStream  = Rx.Observable.of(userData)
const dbKeyStream : string = this.userDataStream.mergeMap(_userData => getDbKey(_userData.dbKeyPath))
const userStream = this.userDataStream.pluck('users').mergeMap(_users=>Rx.Observable.from(_users))

My expected result is stream with combined observables:
[user[0],dbKey],[user[1],dbKey],[user[2],dbKey]...

It works pretty well with withLatestFrom operator:
const result = userStream.withLatestFrom(dbKeyStream) // [user, dbkey]

But, how can i archive same result when i apply .delay() operator to dbKeyStream ?

A: I would suggest using the mergeMap overload with the selectorFunc:

const userData = {
        dbKeyPath: 'www.example.com/getDbKey',
        users:[
            {name:'name1'},
            {name:'name2'},
            {name:'name3'}
        ]
    };

function getDbKey(path) {
  return Rx.Observable.of('the-db-key:'+path)
    .do(() => console.log('fetching db key for path: '+ path))
    .delay(1000);
}

const userDataStream  = Rx.Observable.of(userData)
  .mergeMap(
    _userData => getDbKey(_userData.dbKeyPath),
    (_userData, dbKey) => _userData.users.map(_usr => ({ user: _usr, dbKey }))
  )
.subscribe(console.log);
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/5.0.3/Rx.js"></script>

This gives you the input object and each output value to combine together as you require.


text:
Q: Problem with "append after command" and "insert path" I have an example to explain my problem but if the code compiles and if I get a good result, I don't understand why !
The idea is to split a circle node like in this question . I want to fill the node with two colors.
It's not possible to use the same code but perhaps I'm wrong.
1) first with insert path, I think I can't use \tikzlastnode because this macro is not defined. \pgf@node@name seems to be defined only for multipart node.
2) I try with append after command but the code is strange. I need to use a scope with the background layer. But
     \node[ circle,
     draw=blue,
     text=white,
     font=\bfseries,
     append after command={
       \pgfextra{%
     \pgfpointdiff{\pgfpointanchor{\tikzlastnode}{center}}%
                  {\pgfpointanchor{\tikzlastnode}{east}}%
     \pgfmathsetmacro\insiderad{\pgf@x}
     \begin{scope}[on background layer]
        \fill[orange] (\tikzlastnode.center)
                      ([xshift=\pgflinewidth]\tikzlastnode.west)  arc
                      (180:360:\insiderad-\pgflinewidth);
        \fill[red]    (\tikzlastnode.center)
                      ([xshift=-\pgflinewidth]\tikzlastnode.east) arc
                      (0:180:\insiderad-\pgflinewidth);
       \end{scope}
     }
   },text opacity=1] (last name) {big label};

gives

and if I remove the scope environment, the same code
        \fill[orange] (\tikzlastnode.center)
                      ([xshift=\pgflinewidth]\tikzlastnode.west)  arc
                      (180:360:\insiderad-\pgflinewidth);
        \fill[red]  (\tikzlastnode.center)
                    ([xshift=-\pgflinewidth]\tikzlastnode.east) arc
                    (0:180:\insiderad-\pgflinewidth);

give a bad result too :

The only code correct seems to be :
 \documentclass[11pt]{scrartcl}
 \usepackage{tikz}
 \usetikzlibrary{shapes,backgrounds,calc}

  \begin{document}

  \makeatletter
  \begin{tikzpicture}[line width=3mm]
    \node[ circle,
           draw=blue,
           text=white,
           font=\bfseries,
           append after command={
             \pgfextra{%
                \pgfpointdiff{\pgfpointanchor{\tikzlastnode}{center}}%
                             {\pgfpointanchor{\tikzlastnode}{east}}%
                \pgfmathsetmacro\insiderad{\pgf@x}
                 \fill[orange] (\tikzlastnode.center)
                               ([xshift=\pgflinewidth]\tikzlastnode.west)  arc
                               (180:360:\insiderad-\pgflinewidth);
                 \begin{scope}[on background layer]
                      \fill[red]  (\tikzlastnode.center)
                                  ([xshift=-\pgflinewidth]\tikzlastnode.east) arc
                                  (0:180:\insiderad-\pgflinewidth);
       \end{scope}
     }
 },text opacity=1] (last name) {big label};

 \end{tikzpicture}
 \end{document}

and I get :

My question is why I need to use like this the scope. A second question is to know if there is another way to get the name of the last node than \pgf@node@name and  \tikzlastnode.
Perhaps someone knows another method to get the same result.
Remark :
In the link (multipart node given above) I realized at the end  that I could remove the environment scopebut it was a surprise for me. It seems that the text is placed at the end of the construction of the shape.

A: One peculiar detail about the append after command usage is that it has to sit inside a path construction command. In other words, the node must be interrupting a path construction so that whenever it is declared the path construction can continue. But you are using it inside a node command hence things get weird.
You can place your node inside a path command while calculation of the radius can be done via a let operation. I have filled the background with a light blue color and placed the half filled node on top of it. It is still puzzling for me how we can fill the other half with a different color. This is difficult since the color is dictated by the \path[fill=red] and I don't know how to change inside a path command. Another option would be going to the lower level and using \pgfpositionnodelater type of commands to set up the whole node creation process.
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,backgrounds,calc}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\clip (0,0) circle (2.65cm);
\fill[blue!25] (-5cm,-5cm) rectangle (5cm,5cm);
\path[fill=red] node[circle,
           line width=3mm,
           minimum height=5cm,
           draw=blue,
           text=white,
           font=\bfseries,
           append after command={
               let \p1=(a.east),\p2=(a.center),\n1={veclen(\x1-\x2,0)}
                   in (a.east) arc (0:180:\n1) -- cycle
          }
          ] at (0,0) (a) {\huge big label};
\end{scope}
\end{tikzpicture}
\end{document}

It's not quite portable as it is but via defining a new style this can probably float.

A: What's causing the strange behaviour here is the fact that you are nesting path constructions.  As I'm sure you know, when TikZ constructs a path then it handles nodes in a slightly special way.  They are processed as they are encountered (since information about them is needed later) but they aren't placed until after the path has been constructed.  To do this, TikZ stores the nodes in a box, \tikz@figbox, until it is time to place them.
The append after command key sticks a bit extra in the current path after the node command has been processed.  The important thing to note is that this is before the actual node has been placed.  This is what you want since you want the two half circles to be placed behind the node.  However, what TikZ is expecting from the append after command is an extension of the current path, not a whole new path construction!  So it doesn't do anything special to protect the current path from whatever you do in the append after command code.  In this case, what you do is create a whole new path!  In fact, you create two of them.
It's the two of them that is causing the immediate problem, but I can imagine situations where even one would be problematic.  The problem is that the node box, \tikz@figbox, is being used inside the first path: TikZ thinks that the nodes from the parent path are actually nodes on the first child path.  They get used there, then the box is cleared, and the second child path is drawn therefore on top of the node.
The remedy is to protect the node box from the child paths.  Looking at the TikZ code, there are other places where this has to be done: preactions and postactions.  There, the code is:
\def\tikz@extra@preaction#1{%
  {%
    \pgfsys@beginscope%
      \setbox\tikz@figbox=\box\pgfutil@voidb@x%
      \path[#1];% do extra path
      \pgfsyssoftpath@setcurrentpath\tikz@actions@path% restore
      \tikz@restorepathsize%
    \pgfsys@endscope%
  }%
}

As you're doing a node, not a path, you probably don't need to worry about the actual path or any details of the scope (though it may be safest to put them in for a more complicated example).  All you actually need is the grouping and the \tikz@figbox declaration.  Hence the following works:
\documentclass[11pt]{scrartcl}
 \usepackage{tikz}
\usepackage{trace-pgfkeys}
 \usetikzlibrary{shapes,backgrounds,calc}

  \begin{document}
  \makeatletter
  \begin{tikzpicture}[line width=3mm]
    \node[ circle,
           draw=blue,
           text=white,
           font=\bfseries,
           append after command={
             \pgfextra{%
                \pgfpointdiff{\pgfpointanchor{\tikzlastnode}{center}}%
                             {\pgfpointanchor{\tikzlastnode}{east}}%
                \pgfmathsetmacro\insiderad{\pgf@x}
{
                             \setbox\tikz@figbox=\box\pgfutil@voidb@x
                 \fill[orange] (\tikzlastnode.center)
                               ([xshift=\pgflinewidth]\tikzlastnode.west)  arc
                               (180:360:\insiderad-\pgflinewidth);
                      \fill[red]  (\tikzlastnode.center)
                                  ([xshift=-\pgflinewidth]\tikzlastnode.east) arc
                                  (0:180:\insiderad-\pgflinewidth);
}
}
 },text opacity=1] {big label};
 \end{tikzpicture}
 \end{document}

with result:


text:
Q: How to use "easy" action share correct I have this FullImageActivity
public class FullImageActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.full_image);

        // get intent data
        Intent i = getIntent();

        // Selected image id
        int position = i.getExtras().getInt("id");
        ImageAdapter imageAdapter = new ImageAdapter(this);

        ImageView imageView = (ImageView) findViewById(R.id.full_image_view);
        imageView.setImageResource(imageAdapter.mThumbIds[position]);
        BitmapDrawable bm = (BitmapDrawable) imageView.getDrawable();
        Bitmap mysharebmp = bm.getBitmap();
        String path = Images.Media.insertImage(getContentResolver(),
                            mysharebmp, "MyImage", null);
        Uri uri = Uri.parse(path);
        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        sharingIntent.setType("image/*");
        sharingIntent.putExtra(Intent.EXTRA_STREAM, uri);
        startActivity(Intent.createChooser(sharingIntent,
                            "Share image using"));
    }
}

After pressing the picture full screen is starting and also the sharing menu appears.
But what i would like is that:
Only full screen is shown and that the menu item share is used for it like in google example.
Adding an Easy Share Action
I don´t understand how to integrate it in my code.
Thx for helping dudes
EDIT ImageAdapter
import java.lang.ref.WeakReference;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {
    private Context mContext;

    // Keep all Images in array
    public Integer[] mThumbIds = {

    //There are 100 pics at the moment i removed for the post here.
   R.drawable.angry_shaking,
                                                    R.drawable.new99

    };

    // Constructor
    public ImageAdapter(Context c){
        mContext = c;
    }

    @Override
    public int getCount() {
        return mThumbIds.length;
    }

    @Override
    public Object getItem(int position) {
        return mThumbIds[position];
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

public View getView(int position, View convertView, ViewGroup parent) {
    //This actually is a bad solution, because every time convertView is reused, you will still initialize new ImageView, which is wrong
    //ImageView imageView = new ImageView(this.mContext);
    //new BitmapWorkerTask(imageView).execute(Tattoos[position]);
    //return imageView;

    //Better solution
    ImageView imageView = null;

    if (convertView == null) {
        imageView = new ImageView(this.mContext);
        new BitmapWorkerTask(imageView).execute(mThumbIds[position]);
        //create new ImageView if it is not present and populate it with some image
    } else {
        imageView = (ImageView) convertView;
        //re-use ImageView that already exists in memory
    }// clean up your old bitmap first, if there is one.
    if(imageView.getDrawable() instanceof BitmapDrawable){
        BitmapDrawable bd = (BitmapDrawable) imageView.getDrawable();
        imageView.setImageDrawable(null);
        if(bd.getBitmap() != null){
            bd.getBitmap().recycle();
        }
        bd = null;
    }

    new BitmapWorkerTask(imageView).execute(mThumbIds[position]);

return imageView;
}

class BitmapWorkerTask extends AsyncTask<Integer, Void, Bitmap> {
        private final WeakReference<ImageView> imageViewReference;
        private int data = 0;

        public BitmapWorkerTask(ImageView imageView) {
            // Use a WeakReference to ensure the ImageView can be garbage collected
            imageViewReference = new WeakReference<ImageView>(imageView);
        }

        // Decode image in background.
        @Override
        protected Bitmap doInBackground(Integer... params) {
            data = params[0];
            return decodeSampledBitmapFromResource(ImageAdapter.this.mContext.getResources(), data, 100, 100);
        }

        // Once complete, see if ImageView is still around and set bitmap.
        @Override
        protected void onPostExecute(Bitmap bitmap) {
            if (isCancelled()) {
                bitmap = null;
            }

            if (imageViewReference != null && bitmap != null) {
                final ImageView imageView = imageViewReference.get();
                if (imageView != null) {
                    imageView.setImageBitmap(bitmap);
                    imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
                    imageView.setLayoutParams(new GridView.LayoutParams(105, 105));

                }
            }
        }
    }

    public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId,
                                                         int reqWidth, int reqHeight) {

        // First decode with inJustDecodeBounds=true to check dimensions
        final BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeResource(res, resId, options);

        // Calculate inSampleSize
        options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);

        // Decode bitmap with inSampleSize set
        options.inJustDecodeBounds = false;
        return BitmapFactory.decodeResource(res, resId, options);
    }

    public static int calculateInSampleSize(
            BitmapFactory.Options options, int reqWidth, int reqHeight) {
        // Raw height and width of image
        final int height = options.outHeight;
        final int width = options.outWidth;
        int inSampleSize = 1;

        if (height > reqHeight || width > reqWidth) {

            // Calculate ratios of height and width to requested height and width
            final int heightRatio = Math.round((float) height / (float) reqHeight);
            final int widthRatio = Math.round((float) width / (float) reqWidth);

            // Choose the smallest ratio as inSampleSize value, this will guarantee
            // a final image with both dimensions larger than or equal to the
            // requested height and width.
            inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
        }

        return inSampleSize;
    }

}

EDIT 2
 import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore.Images;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.ShareActionProvider;

public class FullImageActivity extends ActionBarActivity {

    private ShareActionProvider mShareActionProvider;

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate menu resource file.
        getMenuInflater().inflate(R.menu.menu_item_share, menu);
        // Locate MenuItem with ShareActionProvider
        MenuItem item = menu.findItem(R.id.menu_item_share);

        // Fetch and store ShareActionProvider
        mShareActionProvider = (ShareActionProvider) item.getActionProvider();

        // Return true to display menu
        return true;}

     // Call to update the share intent
        private void setShareIntent(Intent shareIntent) {
            if (mShareActionProvider != null) {
                mShareActionProvider.setShareIntent(shareIntent);
            }
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.full_image);
        Intent i = getIntent();

        // Selected image id
        int position = i.getExtras().getInt("id");
        ImageAdapter imageAdapter = new ImageAdapter(this);

        ImageView imageView = (ImageView) findViewById(R.id.full_image_view);
        imageView.setImageResource(imageAdapter.mThumbIds[position]);
        BitmapDrawable bm = (BitmapDrawable) imageView.getDrawable();
        Bitmap mysharebmp = bm.getBitmap();
        String path = Images.Media.insertImage(getContentResolver(),
                            mysharebmp, "MyImage", null);
    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    Uri uri = Uri.parse(path);
    shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
    shareIntent.setType("image/jpeg");
    startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.share_via)));;
        }
    }

Thats my new FullImageActivity with the new library it´s working :)
But when i go to full screen it´s crashing?
03-30 20:11:24.570: E/AndroidRuntime(13720): FATAL EXCEPTION: main
03-30 20:11:24.570: E/AndroidRuntime(13720): Process: com.example.mo, PID: 13720
03-30 20:11:24.570: E/AndroidRuntime(13720): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mo/skull.droid.mo.FullImageActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2248)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.app.ActivityThread.access$800(ActivityThread.java:138)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.os.Handler.dispatchMessage(Handler.java:102)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.os.Looper.loop(Looper.java:136)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.app.ActivityThread.main(ActivityThread.java:5050)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at java.lang.reflect.Method.invokeNative(Native Method)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at java.lang.reflect.Method.invoke(Method.java:515)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at dalvik.system.NativeStart.main(Native Method)
03-30 20:11:24.570: E/AndroidRuntime(13720): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:108)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:57)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at skull.droid.mo.FullImageActivity.onCreate(FullImageActivity.java:48)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.app.Activity.performCreate(Activity.java:5241)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-30 20:11:24.570: E/AndroidRuntime(13720):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
03-30 20:11:24.570: E/AndroidRuntime(13720):    ... 11 more

Do i have to use something else then my ImageAdapter or what can i do?
MainActivity
public class MainActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_main);

    GridView gridView = (GridView) findViewById(R.id.gridview);

    // Instance of ImageAdapter Class
    gridView.setAdapter(new ImageAdapter(this));

    /**
     * On Click event for Single Gridview Item
     * */
    gridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View v,
                int position, long id) {

            // Sending image id to FullScreenActivity
            Intent i = new Intent(getApplicationContext(), FullImageActivity.class);
            // passing array index
            i.putExtra("id", position);
            startActivity(i);
        }
    });
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}

/**
 * A placeholder fragment containing a simple view.
 */
public static class PlaceholderFragment extends Fragment {

    public PlaceholderFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container,
                false);
        return rootView;
    }

}

Thx dudes!
EDIT
My Manifest
 <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    android:largeHeap="true"

A: *

*Extend ActionBarActivity instead Activity.

*Create a menu XML for share

*Override onCreateOptionsMenu and inflate the share menu XML.

*Set a share intent using share action provider

A: I may be wrong, but based on your comments to Libin above, I guess you are unable to use ActionBarActivity in your project.
First of all, regarding Share Intent, which you want like, as you said example from Google  is done through ActionBar. To read more about action bar, you can refer this.
Now, as you got error ActionBarActivity cannot be resolved to a type is most probably because you had not added support library in your project. ActionBar was introduced since API 11. For use with earlier versions of Android ActionBarActivity was provided in the support package which is backward compatible to eclair.
For adding support library in your project, please read this. Rest of the steps Lipin had already mentioned in his answer. Follow those steps and you will be able to achieve what you want.


text:
Q: Parallel bit deposit / parallel bit extract on intel compiler/LLVM? For CPUs that come with BMI2 instructions, one can use parallel bit deposit (pdep) and parallel bit extract (pext) with GCC using the builtin functions :

*

*unsigned int _pdep_u32 (unsigned int, unsigned int)

*unsigned int _pext_u32 (unsigned int, unsigned int)

*unsigned long long _pdep_u64 (unsigned long long, unsigned long long)

*unsigned long long _pext_u64 (unsigned long long, unsigned long long)
What are their equivalent on the Intel compiler ? And on clang ?

A: Both, Intel and Clang provide the very same intrinsics.


text:
Q: Using scope (after where) in the model resets where condition I have a very strange behavior of Rails 5.2 and ruby 2.6
A different sequence of method chaining gives different results.
Example #1
Erp::Packing::Session::ZonePicker.where(round_id: 3084).active.to_sql

gives:
SELECT \"erp_packing_sessions\".*
FROM \"erp_packing_sessions\"
WHERE (logged_out_at IS NULL)
 AND (started_at > '2021-01-27 23:00:00')

and the scope is:
scope :active, -> { not_logged_out.where('started_at > ?', Time.current.beginning_of_day) }

scope :not_logged_out, -> { where('logged_out_at IS NULL') }

In this example where condition is lost.
Example #2 I put scope first and then where condition:
Erp::Packing::Session::ZonePicker.active.where(round_id: 3084).to_sql

gives:
SELECT \"erp_packing_sessions\".*
FROM \"erp_packing_sessions\"
WHERE (logged_out_at IS NULL)
  AND (started_at > '2021-01-27 23:00:00')
  AND \"erp_packing_sessions\".\"round_id\" = 3084

This example works as expected.
We are migrating from rails 4.2 to 5.2 and getting this strange behaviour.
Could you please point out what could be the reason and if that is covered in the documentation?
Small update: interesting, if I write it as a method:

  def self.activated
    where('started_at > ?', Time.current.beginning_of_day).where('logged_out_at IS NULL')
  end

it works as expected.
Update 2: Erp::Packing::Session::ZonePicker is the subclass of  Erp::Packing::Session::Base where the scopes are defined. Thus could be related to this question: inheritance of scopes
Update 3:
Also,
Erp::Packing::Session::ZonePicker.where(round_id: 3084).method(:active).source   =>
def #{method}(*args, &block)
  scoping { @klass.#{method}(*args, &block) }
end

Does @klass.#{method} mean that it's calling the scope on the class rather chaining?


text:
Q: Value of a bar in a graph I made a thread about this earlier although it got closed since I was unclear. I will try to be more clear now.
What I'm wondering is, if you enter my code into Rstudio, it will give you a graph. On the x-axis there are 6 bars (6 different states), and on the y-axis is the frequency 0-300. All I can see is that state 1 is somewhere in-between 0 and 50. Is there any code that can let me exactly what value state 1 and the others states have?
Here is a matrix:
spec_sim <- function(x){
  u <- runif(1)
  if(x==0){ if(u < 0.5){ y <- 3
    } else{
      y <- 5
    }
  } else if(x==1){
    if(u<0.1){
      y <- 0
    } else if(u < 0.1 + 0.1){
      y <- 1
    } else if(u < 0.1 + 0.1 + 0.4){
      y <- 3
    } else{
      y <- 5
    }
  } else if(x==2){
    if(u<0.2){
      y <- 1
    } else if(u < 0.2 + 0.2){
      y <- 2
    } else if(u < 0.2 + 0.2 + 0.3){
      y <- 3
    } else{
      y <- 5
    }
  } else if(x==3){
    if(u<0.3){
      y <- 2
    } else if(u < 0.3 + 0.5){
      y <- 3
    } else{
      y <- 5
    }
  } else if(x==4){
    if(u<0.4){
      y <- 3
    } else{
      y <- 4
    }
  } else if(x==5){
    if(u<0.4){
      y <- 4
    } else{
      y <- 5
    }
  }
  y
}

set.seed(1)
results <- numeric(1001)
for(i in 2:length(results)){
  results[i]<- spec_sim(results[i - 1])
}
results <- results[-1]

barplot(table(results), xlab="states", ylab="frequency",
        main="1000 simuleringar av en Markovkedja")

A: To identify the value in an active plotting device (window), you use ?identify.  Since the data to be plotted were from a table that was created (but not saved to an object) within the plotting command, you need to enter that for the x and labels arguments to the function.  Once you run the command, the mouse pointer will display as a plus over the plotting device.  Then you just click on the bar you want.  Consider:
identify(table(results), labels=table(results))

The value for 1 is evidently 26.
This is a very general method for getting values from a plot.  Of course, you can also just inspect the underlying data object.  That is more straightforward in this case:
table(results)
# results
#   0   1   2   3   4   5
#   4  26 112 306 296 256


text:
Q: SQL Script to enter data from another table and create a column in the source table to link another table I have a table which already have data in it.
Table -> Address:
AddressID, Address 1, Address 2, email etc...

Table -> Branches:
BranchesID, StoreName, Address 1, Address 2

Now i need a script which can copy all of the data from Branches table to Address table and create a column in Branches which has AddressID of the newly copied data so i can refer Branches Addresses using the Address Table.
Please help.
I have tried this much so far.
INSERT Address1, Address2, City, ZipCode)
OUTPUT AddressID
INTO Addresses
SELECT Address1, Address2
FROM Baranches;

BUT i dont know how to insert newly created records ID from Address Table into Braches table ...
tahnks

A: First you need to add AddressId field into Branches. I don't know what RDBMS do you use so here is an example for MSSQL but it should work for all RDBMS with a few changes:
ALTER TABLE BRANCHES ADD AddressID bigint;

Then insert addresses from branches into Address table. I guess AddressId is autoincremented PK?. WHERE statement in this query allows to avoid address duplications.
insert into ADDRESS (Address1, Address2)
select Address1, Address2
    from BRANCHES
      where
       not exists(select AddressID
                        from ADDRESS
                        where Address1=BRANCHES.Address1
                              and
                              Address2=BRANCHES.Address2 )

Now we should fill in AddressID field in the BRANCHES:
update BRANCHES SET AddressId=(select TOP 1 AddressId from Address where
                                   Address1=BRANCHES.Address1
                                    and
                                   Address2=BRANCHES.Address2 )


text:
Q: Return all the attributes(fields) in a feature layer for a PopupTemplate - ArcGis Javascript Is there a way to return all the attributes(fields) in a feature layer for a PopupTemplate, without declaring all of them in the fieldInfos object in Angular?
.ts
const template = {
        title: "{NAME} in {COUNTY}",
        content: ,
        fieldInfos : fieldInfos
      };

     const layer = new FeatureLayer({
      url: this.featureLayerUrl,
      visible: true,
      popupTemplate : template
      });

      var fieldInfos = layer.map(layer.fields, function(field){
         return {
                "fieldName": field.name,
                "label": field.alias,
                "visible": true

    webmap.add(layer);

.html

I'm using arcgis-js-api version 4.2.1.
But when I use this example it is working. (But I want to set  these fields dynamically.)
const fields = [{
  name: "NAME",
  alias: "Name",
  type: "string"
    }, {
  name: "County",
  alias: "County",
  type: "string"
}, {

const config = {
  fields: fields,
  title: "County land"
};

A: If you just want to create the default popup template (the table with all the fields), then you just need to use FeatureLayer function createPopupTemplate, it will do everything for you (ArcGIS JS API - FeatureLayer createPopupTemplate).
Now if you want to do some extra configuration, you can use the same method or popupUtils method, wich has an extra parameter.
Here is an example I made for you to show a possible use, in there all I do is to change alias values to make it look nicer.

<!DOCTYPE html>

    <meta charset='utf-8' />
    <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
    <title>FeatureLayer field and popup example - 4.21</title>

    <link rel='stylesheet' href='https://js.arcgis.com/4.21/esri/themes/light/main.css' />

The fields property of config variable in the example autocast as an instance of esri/layers/support/Field, wich is different that the fieldInfos property of PopupTemplate that is of type FieldInfo.


text:
Q: How to plot 2 subplots that share the same x-axis So currently i have a scatterplot and a kdeplot that i used seaborn library to plot out.

Here is how i plotted the graphs:
# plot a graph to see the zipcodes vs the density
plt.figure(figsize=(16,8))
sns.kdeplot(king['zipcode'], shade=True, legend=False)
plt.xlabel('Zipcode')
plt.ylabel('Density')

plt.figure(figsize=(16,8))
sns.scatterplot(king['zipcode'],king['price'])

But when i try to do a subplot, my kdeplot seems to be gone:

I tried to do in such a way:
f, axarr = plt.subplots(2, sharex=True)
sns.kdeplot(king['zipcode'], shade=True, legend=False)
sns.scatterplot(king['zipcode'],king['price'])

Is it possible to render both graph in subplots properly?

A: Yep! Credits to @DavidG, i managed to plot out the subplots properly. So i added the axes object into the respective graphs. Here it goes.
f, axarr = plt.subplots(2, figsize=(16,8), sharex=True)
sns.kdeplot(king['zipcode'], shade=True, legend=False,ax=axarr[0])
axarr[0].set_ylabel('Density')
sns.scatterplot(x=king['zipcode'],y=king['price'],ax=axarr[1])
plt.show()

And it results in this:


text:
Q: Cordova fcm notifications work on Android but not on iOS I followed the following steps for installation:

*

*Cordova plugin add cordova-plugin-fcm

*Added to project root "GoogleService-Info.plist" and "google-services.json"

*Replaced "GoogleService-Info.plist" inside platforms/ios//resources/resources with the original one. According with known bugs.

*In my JS, inside deviceready:
FCMPlugin.subscribeToTopic('common_topic');

FCMPlugin.onNotification(function(data){

if(data.wasTapped){

  alert( JSON.stringify(data) );

}else{

  alert( JSON.stringify(data) );
}

})

Now, when I send a notification on android, I see in background and foreground, but in iOS, I don't receive notification at all.
Some configuration missing?


text:
Q: Filepicker.io Objective-c Absurd Data? I am making an iOS app that uses filepicker.io's iOS SDK  and I keep running into this issue when adding large videos. I crashes the entire app almost Immediately. Here is the issue:
malloc: *** mmap(size=532119552) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
2012-12-07 23:46:56.886 App_Name[1106:1d03] *** Terminating app due to uncaught exception       'NSInvalidArgumentException', reason: '*** -[NSConcreteData initWithBytes:length:copy:freeWhenDone:bytesAreVM:]: absurd length: 4294967295, maximum size: 2147483648 bytes'
*** First throw call stack:
(0x3ac1e2a3 0x34b0d97f 0x3ac1e1c5 0x35980407 0x359877bf 0x3598777d 0x5d41d 0x6064d 0x5ffc3 0x38f1111f 0x38f14b97 0x38f17139 0x38f1591d 0x38f15ac1 0x35c7aa11 0x35c7a8a4)
libc++abi.dylib: terminate called throwing an exception

This is very peculiar and all I found about this is that it has to do with memory management. How can I fix this????


text:
Q: why entanglement entropy is important in topological phases? When mentioning interacting topological phases people always talk about entanglement entropy.
why it is important?
what is its physical meaning?

A: Entanglement entropy (EE) is a measure of how much entanglement exists between regions of a system. Very loosely, you could think of the EE as telling you how many entangled pairs of particles exist in two spatial regions, usually in the ground state of your system. For a system seperated into two sections, $A$ and $\bar{A}$, the EE is given by:
$$S_A = -Tr(\rho_A\log\rho_A)$$
Where $\rho_A$ is the reduced density matrix of the system, where we have traced out (ignored) contributions from $\bar{A}$: $$\rho_A = {Tr}_{\small\bar{A}}(\rho)$$
Topological entanglement entropy  (TEE) characterises the amount of long-range entanglement that exists in a (gapped) system, which is directly proportional to the number of states in your system with some topological order. The topological order of your system tells you how close to a critical point you are, since phase transitions must occur in order for the topological order to change. Thus, by calculating the TEE in your system, you find out something about the topological phase of your system and how close to criticality it is.
For a 2+1-d topological system, Kitaev and Preskill showed that the EE is of the form $$S_A = \alpha L - \gamma ~+ ...$$
Where $L$ is the (large) length of the boundary of the entangling region (for example a circle encompassing $A$). The first term characterises short distance entanglement arising near the boundary $L$ whereas the term $-\gamma$ is the TEE.
In addition, you can vary the Hamiltonian of your system however you wish and as long as you don't hit a critical point, the TEE will be invariant. This is how phase transitions and the TEE are related, since after a phase transition, you would expect to find a new value for the TEE.


text:
Q: Degree of T-conductor larger than zero but less than the full vector space I am from Physics background. I have been trying to figure out this proof for sometime now. Can anyone please solve it?
Let $T$ be a linear operator on a finite dimensional vector space $V$ and let $W$ be an invariant subspace of $T$. For any $\alpha\in V$ show that,
$0<max_{\alpha}\text{deg }s(\alpha;W)\leq\text{dim }V$,
where $s(\alpha;W)$ is the $T$-conductor of $\alpha$ into $W$.
For clarification of the term $T$-conductor: The set of all polynomial functions of $T$, that take a vector $\alpha$ into an invariant space $W$ forms an ideal. The minimal polynomial (i.e. least common factor) of that ideal is called $T$-conductor of $\alpha$ into $W$ and denoted by $s(\alpha;W)$. It can be found in the book of Linear Algebra by Hoffman and Kunze.
Thanks in advance.

A: Hint: Show that, as a consequence the Cayley-Hamilton theorem, the characteristic polynomial $f$ satisfies $\operatorname{deg}(f) = \dim V$ and $f \in s(\alpha;W)$ for all $\alpha \in V$.


text:
Q: Git how to access repository Windows local machine? I installed Git for Windows in order to clone and pull a project hosted on a remote Linux server.
In my repository (D:/repositories/my-project) I launch the following commands
git clone server@192.168.56.101:/var/www/web/my-project/.git

git pull origin master

So far so good. I pull the project files whenever modifications are applied on the server.
But now I'd like to pull or push from the remote server to my local repository.
I tried many things but I can't figure out how to access the repository located on my local machine.
Things like:
git pull duddy@my-pc:/d/repositories/my-project/.git master

just doesn't work, Git says:

ssh: Could not resolve hostname my-pc: Name or service not known
  fatal: Could not read from remote repository.

Can someone helps me ?

A: First things first, I would recommend you try simply running git pull.
If this doesn't work, try running git remote -v and check to make sure that the URL for your server is listed as an origin (server@192.168.56.101:/var/www/web/my-project/.git).
Your issue is that you are inputting the URL for your local repository in your attempt to git pull.
I suggest reading the git-pull documentation to learn more about how pull works.

A: Basically, you need to have some service at your workstation which serves the requests. There are following options (I did not try most of them myself, just making it up from what I know):

*

*use the windows file access. This is the easiest to setup at the windows workstation - just share the repository folder. The Linux side should somehow be able to mount windows shares (like described, for example, here: https://wiki.ubuntu.com/MountWindowsSharesPermanently). If you manage to mount your \\my-pc\repo to some /mount/my-pc-repo, then you can access it as file:///mount/my-pc-repo.

*run git daemon at windows. Set up instructions are available at SO (for example, https://stackoverflow.com/a/2275844/2303202) and it pretty straightforward, but it does not have any authentication and in most cases it is reasonable to use it only for reading, so you will not be able to push to the workstation, only fetch.

*set up ssh daemon and access through ssh authentication with read-write access. Git for windows installation contains the needed software (the sshd.exe binary, it is there at least for Git for Windows 2.6.0), probably there is a way to utilize it but I could not find it quickly.

*set up HTTP(S) service at your workstation. I don't know if it is possible to do only with Git for Windows (it might be, with some perl module which happen to be included with it), or you should use some other software.


text:
Q: PgDn and PgUp Keys in R Graphics Viewer I've never been able to figure out how to get the PgDn/PgUp keys to work in the R Graphics Viewer.
Even the demo() programs don't seem to support it.
Anyone able to point me to some code that shows how this can be implemented?

A: Dirk is right.
Another thing to look at are the following functions:
x <- recordPlot()
replayPlot(x)

From the R for Windows FAQ:
The graphics has a history mechanism. As README.R-2.9.2 says:
The History menu allows the recording of plots. When plots have been recorded they can be reviewed by  and , saved and replaced. Recording can be turned on automatically (the Recording item on the list) or individual plots can be added (Add or the  key). The whole plot history can be saved to or retrieved from an R variable in the global environment. The format of recorded plots may change between R versions. Recorded plots should not be used as a permanent storage format for R plots.
There is only one graphics history shared by all the windows devices.
The R console and graphics windows have configuration files stored in the RHOME\etc directory called Rconsole and Rdevga; you can keep personal copies in your HOME directory. They contain comments which should suffice for you to edit them to your preferences. For more details see ?Rconsole. There is a GUI preferences editor invoked from the Edit menu which can be used to edit the file Rconsole.

A: As I recall you have to turn 'recording' or 'History' on. This is platform-specific and I am not near a Windows machine.

A: On a mac, one can use the command key with the back arrow (and forward arrow) to cycle through plots.
Make sure you've plotted at least two plots to the same quartz device, then with the plotting window in focus, hit ⌘ ← to see the previous plot.


text:
Q: How do I display the Data from this API using Vanilla JavaScript into the HTML? I am trying to use an AJAX call to retrieve data from a movie API on the web. Here is my HTML code:

        <meta charset=utf-8>
        <title>Movie Database</title>

Movie Database

            <select id="genre"  class="filterButton">

           </select>

            <select id="releaseDate"  class="filterButton">

           </select>

           <input type="text" value="Enter Release Date YYYY-MM-DD">

           <button id="search">SEARCH</button>

Here is my JS file:
/* THIS IS THE JS FILE FOR THE www.themoviedb.org WEBSITE API */

// MY GLOBAL VARIABLES
var title;
var genre;
var releaseYear;
var summary;
var actors;
var languages; // What languges is the movie in?
var status; // Is this movie releases or still in production?

/* ======================= HERE ARE MY EVENT LISTENERS ==================*/

var myList = document.getElementById("getList");

var myYear = document.getElementById("getRelease");

var getGenre = document.getElementById("genre");

var getYear = document.getElementById("releaseDate");

/* ======================= End of my Event Listeners =================== */

/* =========This is the function to display the data in the HTML ======= */

function displayData(results, title, poster_path, overview)
{
   var div = document.createElement('div');
   div.setAttribute('results', Results);
   div.innerHTML = Title + '
' + Poster + Overview;
   document.body.appendChild(div);
}

/* ============================ End function ========================= */

/* ============This is how the data from the genre is loaded ========== */

function loadMyData() {

    var data = "{}";

var xhr = new XMLHttpRequest();
xhr.withCredentials = false;
console.log(xhr);
xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    //console.log(this.responseText);

        var sourceData = JSON.parse(xhr.responseText);
        console.log(sourceData);
      displayData(results, title, poster_path, overview);

        var source = document.getElementById("genre");

        for (var i = 0; i < sourceData.genres.length; i++) {
            console.log(i);

                optionID = sourceData.genres[i].id;
                var optionName = sourceData.genres[i].name;

                var option = document.createElement("option");
                option.innerHTML = optionName;
                option.setAttribute("value", optionID);
                option.setAttribute("name", optionName);
                source.appendChild(option);

            //displayData(results, title, poster_path, overview);
           //console.log(optionName);

            }
        }
    });

xhr.open("GET", "https://api.themoviedb.org/3/genre/movie/list?language=en-US&api_key=**************");

xhr.send(data);
}

    // loads the year from the Discover part of the API
    function loadYear() {
        var data = "{}";

var newxhr = new XMLHttpRequest();
newxhr.withCredentials = false;
        console.log(newxhr);

newxhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);

      var sourceData = JSON.parse(newxhr.responseText);
        //console.log(sourceData);

        var source = document.getElementById("releaseDate");

        for (var i = 0; i < sourceData.results.length; i++) {
            console.log(i);

                optionID = sourceData.results[i].id;
                var optionName = sourceData.results[i].release_date;

                var option = document.createElement("option");
                option.innerHTML = optionName;
                option.setAttribute("value", optionID);
                option.setAttribute("name", optionName);
                source.appendChild(option);

            console.log(optionName);
        }
  }

});

    newxhr.open("GET", "https://api.themoviedb.org/3/discover/movie?page=1&include_video=false&include_adult=false&sort_by=popularity.desc&language=en-US&api_key=*****************");

newxhr.send(data);
    }

/* --------------------------------------------- On click show the data ------------------------------------------------ */

document.getElementById("search").addEventListener("click", displayData);

LoadMyData() loads the data for the genre. I suppose I should rename it. LoadYear() of course loads the date of the movie.
DisplayData() is supposed to display the data from the JSON file once the user clicks the button.
Can someone please give me an idea as to how to use plain javascript and html to show the JSON data? Right now I get an error telling me this:
myScript4.js:55 Uncaught ReferenceError: results is not defined
    at XMLHttpRequest. (myScript4.js:55)
Line 55 is here: displayData(results, title, poster_path, overview);
Any help would be appreciated :) I've also gotten rid of the API Key for security reasons. I know you're not supposed to give them away.
Here is a snippet of the outputted JSON file for the loadYear() function:
{
  "page": 1,
  "total_results": 328130,
  "total_pages": 16407,
  "results": [
    {
      "vote_count": 2039,
      "id": 346364,
      "video": false,
      "vote_average": 7.4,
      "title": "It",
      "popularity": 745.88068,
      "poster_path": "/9E2y5Q7WlCVNEhP5GiVTjhEhx1o.jpg",
      "original_language": "en",
      "original_title": "It",
      "genre_ids": [
        12,
        18,
        27
      ],
      "backdrop_path": "/tcheoA2nPATCm2vvXw2hVQoaEFD.jpg",
      "adult": false,
      "overview": "In a small town in Maine, seven children known as The Losers Club come face to face with life problems, bullies and a monster that takes the shape of a clown called Pennywise.",
      "release_date": "2017-09-05"
    },

As you can see "results" is in the JSON file. This is the bit that was undefined in the JavaScript file. How do I define it?

A: At this part of the code:
var sourceData = JSON.parse(xhr.responseText);
console.log(sourceData);
displayData(results, title, poster_path, overview);

'results' is not yet defined. I don't know where or what you expect 'results' to be, but I'm going to make a guess that it's just an object inside the json of responseText, so you should add this line before your displayData call:
var results = sourceData.results; If results is not a property of sourceData then obviously make var results equal to whatever, in the response, you need it to be.

A:
Javascript is case a sensitive language

so your displayData function seems to have some incorrect variables, should be like this:
function displayData(results, title, poster_path, overview)
{
  var div = document.createElement('div');
  div.setAttribute('results', results);
  div.innerHTML = title + '
' + poster_path + overview;
  document.body.appendChild(div);
}


text:
Q: I use .bind(this) but it keeps been undefined on the imported function? Javascript React I have a really big class with a lot of handlers, and the document it's starting to be illegible, I want to define the handlers methods outside my class and grouped on a document by type (all the tools have different handlers, so I catch the event and depending on the selectedTool I redirect it to the correct handler), then import those methods/functions and call them from another method like they were normal methods.

The first log, returns this correctly, but for some reason, the log from inside handleSelectorMouseDown returns "undefined" even tho i use .bind(this)

A: Try this:
handleSelectorMouseDown.bind(this)(e)
This will first bind the imported function to the correct scope, and then execute the function.
Another option is to bind the function in the class constructor and use it later:
class MyComponent {
    constrctor() {
      this.handleSelectorMouseDown = handleSelectorMouseDown.bind(this);
    }
}

Now you just need to call this.handleSelectorMouseDown(e)

A: You're using bind wrong, you have to first bind then call, I would create a reference at the class level for your binded handlers:
constructor() {
  this.onSelectorMouseDown = handleSelectorMouseDown.bind(this);
}

then you can call them as you like:
this.onSelectorMouseDown(e);


text:
Q: perl: changing between line by line and as a whole I'm starting to work with perl and I need to edit some text. Sometimes I need that perl read the input line by line and sometimes I need perl read the input as a whole. I know that this can be set with something like:
$/ = undef;

or with something like:
{
        local $/;
        $myfile= <$MYFILE>;
}

But Im not sure how I have to do if, in the same script, I want to change the reading from "whole" to "line by line" or viceversa. That is, imagine a script with starts as:
use warnings;
use strict;
my $filename = shift;
open F, $filename or die "Usa: $0 FILENAME\n";
while(<F>) {
}

And I make some replaces (s///;). And then I need that go on with my edition but reading as a whole. So I write:
{
        local $/;
        $filename = <F>;
}

But then I need to go on reading line by line....
Somebody can explain me the logic behind this in order to learn how to 'change' from one mode to another, always keeping the last edited version of the input? Thanks

Ok, sorry. I will try to focus on Y instead of X. For instance, I need to edit a text and make a replacement only on a portion of the text which is delimited by two words. So imagine I want to replace all the forms of "dog" to "cat", but only on those "dogs" which are bewtween the word "hello". My input:
hello
dog
dog
dog
hello
dog
dog

My output:
hello
cat
cat
cat
hello
dog

My script:
use warnings;
use strict;
my $file = shift;
open my $FILE, $file or die "Usa: $0 FILENAME\n";
{
local $/;
$file = <$FILE>;
do {$file =~ s{dog}{cat}g} until
($file =~ m/hello/);
}
print $file;

But I get replaced all "dogs"
I tried other stratagey:
use warnings;
use strict;
my $file = shift;
open my $FILE, $file or die "Usa: $0 FILENAME\n";
{
local $/;
$file = <$FILE>;
while ($file =~ m{hello(.*?)hello}sg) {
my $text = $1;
$text =~ s{dog}{cat}g;
}
}
print $file;

But in this case I get no replacement...

A: You don't have to resort to slurping and multi-line regexes to solve this. Simply use a variable to track the state of the current line, i.e. whether you're inside or outside your delimiters:
#!/usr/bin/perl

use strict;
use warnings;
use 5.010;

my $in_hello;
while (<DATA>) {
    chomp;
    $in_hello = ! $in_hello if $_ eq 'hello';
    s/dog/cat/ if $in_hello;
    say;
}

__DATA__
hello
dog
dog
dog
hello
dog
dog

Output:
hello
cat
cat
cat
hello
dog
dog

A: Default, line by line, mode is back again outside code block:
{
    local $/;
    $filename = <F>;
}

$/ is global variable which is dynamically scoped in this example.


text:
Q: how to access XML subnodes using javascript I want to use javascript to get information from a xml file loaded into a webpage.
The below given is the xmlfile(a.xml) i am using.
a.xml
<?xml version="1.0"?>

<Step rID="T6">
  <Obj ><![CDATA[Get Data Table - Passed]]></Obj>
  <![CDATA[]]>
  <Time><![CDATA[7/5/2018 - 13:16:26]]></Time>
  <TimeTick>1530810986</TimeTick>
  <NodeArgs eType="User" icon="5" nRep="9" >
    <Disp><![CDATA[Get Data Table - Passed]]></Disp>
  </NodeArgs>
</Step>
<Step rID="T7">
  <Obj ><![CDATA[GetDataTable - Successful]]></Obj>
  <![CDATA[Toral Row get:65534]]>
  <Time><![CDATA[7/5/2018 - 13:16:26]]></Time>
  <TimeTick>1530810986</TimeTick>
  <NodeArgs eType="User" icon="5" nRep="10" status="Passed" >
    <Disp><![CDATA[GetDataTable - Successful]]></Disp>
  </NodeArgs>
</Step>

I want to access nodes under a specific node in xml using java script?
That is i want to access Time node after i access step node.
And the below given is the index.html page to which i want to load the xml data
index.html

    <title>Report</title>

Results of  Test cases

In the above code I am trying to access the Time  subnode under the  step node.
and I have used arrays in the above example as the xml page i am using have lots of Step subnodes , and i want to access the Time subnodes under Step for each one of them.
thanks,
Any help is appreciated

A: You have the option of iterating over the xml nodes directly, employing one of the XPath processing APIs. It basically suffices to rewrite your showTheList function. What follows is a complete standalone solution, however:

    <title>Report</title>

Results of  Test cases

Code has been tested.
Note
The sample xml provided in the question is not well-formed since it lacksa unique root element. The solution would still work but only consider the first Stepelement.
Update
To allow for xml from an external source, the ajax code needs to be reintroduced:
function getData() {
    let oXHR = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
    oXHR.onreadystatechange = function() {
        if (oXHR.readyState == 4 && oXHR.status == 200) {
            showTheList(oXHR);
        }
    };
    oXHR.open("GET", "state_data.xml", true); // ...or whatever else
    oXHR.send();
} // getData

Lacking local data, it makes no longer sense to register showTheList as an onLoad handler.


text:
Q: Debug build of my app is working fine but not the release build signed version My project appears to work fine in the debug variant but crashes when I try to use the release build signed version. The same problem is occurring with some other apps I have created.
My logcat :
08-11 14:46:08.142 3809-3809/com.example.android.courtcounter W/System:     ClassLoader referenced unknown path: /data/app/com.example.android.courtcounter-1/lib/x86
08-11 14:46:08.342 3809-3809/com.example.android.courtcounter W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
08-11 14:46:08.919 3809-3829/com.example.android.courtcounter D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
[08-11 14:46:08.923  3809: 3809 D/         ]
HostConnection::get() New Host Connection established 0xaa3dbfb0, tid 3809
[08-11 14:46:08.980  3809: 3829 D/         ]
HostConnection::get() New Host Connection established 0xae3c7330, tid 3829
08-11 14:46:09.012 3809-3829/com.example.android.courtcounter I/OpenGLRenderer: Initialized EGL, version 1.4
08-11 14:46:15.091 3809-3809/com.example.android.courtcounter D/AndroidRuntime: Shutting down VM
08-11 14:46:15.091 3809-3809/com.example.android.courtcounter E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.courtcounter, PID: 3809
java.lang.IllegalStateException: Could not find method point2A(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatButton
    at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.resolveMethod(AppCompatViewInflater.java:327)
    at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:284)
    at android.view.View.performClick(View.java:5198)
    at android.view.View$PerformClick.run(View.java:21147)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.android.courtcounter.MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:padding="16dp"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:textColor="#616161"
                android:fontFamily="sans-serif-medium"
                android:padding="0dp"
                android:text="Team A"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/scoreA"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:textColor="#000000"
                android:padding="16dp"
                android:fontFamily="sans-serif-light"
                android:text="0"
                android:textSize="56sp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginRight="8dp"
                android:layout_marginLeft="8dp"
                android:onClick="point2A"
                android:text="+2 Points" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginRight="8dp"
                android:layout_marginLeft="8dp"
                android:onClick="point3A"
                android:text="+3 Points" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginRight="8dp"
                android:layout_marginLeft="8dp"
                android:onClick="freeThrowA"
                android:text="Free Throw" />

        </LinearLayout>
        <View
            android:layout_width="1dp"
            android:layout_height="match_parent"
            android:background="#666666"/>
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:padding="16dp"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:paddingBottom="0dp"
                android:textColor="#616161"
                android:fontFamily="sans-serif-medium"
                android:text="Team B"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/scoreB"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:padding="16dp"
                android:fontFamily="sans-serif-light"
                android:textColor="#000000"
                android:text="0"
                android:textSize="56sp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginRight="8dp"
                android:layout_marginLeft="8dp"
                android:onClick="point2B"
                android:text="+2 Points" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginRight="8dp"
                android:layout_marginLeft="8dp"
                android:onClick="point3B"
                android:text="+3 Points" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginRight="8dp"
                android:layout_marginLeft="8dp"
                android:onClick="freeThrowB"
                android:text="Free Throw" />

         </LinearLayout>

    </LinearLayout>

    <Button
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="Reset"
         android:layout_margin="4dp"
         android:onClick="reset"
         android:layout_alignParentBottom="true"
         android:layout_centerHorizontal="true"/>

</RelativeLayout>

MainActivity.java
package com.example.android.courtcounter;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity
{
    int pointsA=0, pointsB=0;
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    //Team A Methods//

    void point2A(View view)
    {
        pointsA+=2;
        displayA();
    }

    void point3A(View view)
    {
        pointsA+=3;
        displayA();
    }

    public void freeThrowA(View view)
    {
        pointsA+=1;
        displayA();
    }

    public void displayA()
    {
        TextView scoreView = (TextView) findViewById(R.id.scoreA);
        scoreView.setText(String.valueOf(pointsA));
    }

    //Team B methods//

    void point2B(View view)
    {
        pointsB+=2;
        displayB();
    }

    void point3B(View view)
    {
        pointsB+=3;
        displayB();
    }

    public void freeThrowB(View view)
    {
        pointsB+=1;
        displayB();
    }

    public void displayB()
    {
        TextView scoreView = (TextView)
        findViewById(R.id.scoreB);
        scoreView.setText(String.valueOf(pointsB));
    }

     //Reset//

    void reset(View view)
    {
        pointsA=0;
        pointsB=0;
        displayB();
        displayA();
    }
}

A: Try to add public before all of your methods.


text:
Q: Extreme points of a compact set, not compact. This is a problem from chapter 3, Convexity of Rudin's "Functional Analysis".
The problem says:
Let $$ be the smallest convex set in $\mathbb{R}^3$ that contains the points $(1,0,1)$,$(1,0,−1)$ and $(cos\phi,sin\phi,0)$, for $0\leq\phi\leq 2\pi$. Show that $$ is compact but that the set of all extreme points of  is not compact. Does such an example exist in $\mathbb{R}^2$
This question is also here: Compact set and its extreme points, but the answers given did not satisfy me and the post is inactive, so I decided to ask this problem again.
I have already shown that $K$ is compact. For me it is really clear that $ext(K)$ has all the original points except for one in the circle, and hence it is clear that $K$ is not compact. But I do not know how to do this formally. It is easy to show that $(1,0,0)$ is not an extreme points but I do not know how to prove that the rest of the original points are extreme points.
I think that in $\mathbb{R}^2$ this can not happen, because, as someone says in the post Compact set and its extreme points, the open segments will be open in $\partial K$, and hence the extreme points will be closed in $\partial K$. This idea is really intuitive for me but again I do not know how to formalize it.
I would be grateful for any idea.

A: I am not sure exactly what your question is. It's pretty routine to analyze the double cone in Rudin's exercise. If you want a proof of the fact that if $K$ is closed in $\mathbb R^2,$ the set $\hat K$ of its extreme points is closed, here is a sketch:
Suppose $x\notin \hat K.$
$1).\ $If $x\notin K$ then since $K$ is closed, there is an open set containing $x$ disjoint from $K$, hence from $\hat K$.
$2).\ $If  $x\in K$, there exist $y\neq z\in K$ such that $x=(1-t)z+ty$ for some $0<t<1.$ If any point on this segment is in $\text{int}\ K,$ then $x\in \text{int}\ K$, so there is an open set $U\subseteq K$ containing $x$ and clearly $U\cap \hat K=\emptyset.$
$3).\ $ If the segment $(1-t)z+ty$ is contained in $\partial K$, then (here is where we use the fact that we are working in $\mathbb R^2$) we may choose a point $w\in \text{\int}\ K$ and an open triangle $T$ with vertices $w, A, B$ such that $A$ lies on the line segment that extends the segment passing through $\overline{wz}$ and $B$ lies on the line segment that extends the segment passing through $\overline{wy}.\ T\cap \hat K=\emptyset$ by construction.
It follows that $x$ lies in an open set disjoint from $\hat K$ and so $\hat K$ is closed because its complement is open.


text:
Q: PHP 5.6 mcrypt.so extension in El Capitan I've installed mcrypt and mcrypt-php5.6 on el capitan with homebrew with
brew install homebrew/php/php56-mcrypt
brew install mcrypt

and mcrypt -v shows me
Mcrypt v.0.9.9 (i386-apple-darwin15.0.0)
Linked against libmcrypt v.2.5.8
Copyright (C) 1998-2002 Nikos Mavroyanopoulos (nmav@gnutls.org)

but when I try to create new laravel project I get

Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php56/5.6.21/lib/php/extensions/no-debug-non-zts-20131226/mcrypt.so' - dlopen(/usr/local/Cellar/php56/5.6.21/lib/php/extensions/no-debug-non-zts-20131226/mcrypt.so, 9): image not found in Unknown on line 0

Also as  php_info() represents,  mcrypt installed completely but I have gotten the top error in composer.


text:
Q: Find/Remove in @DBref list items in MongoDB for Spring What would be the best approach to find and update nested list items as @DBRef in MongoDB for Spring?
I have a AppliedApplication class:
@Document(collection = "applied_application")
public class AppliedApplication {

    @Id
    private String id;
    @Field("program")
    @DBRef
    private List<Program> programList;

    // getters and setters

}

With a Program class as @DBRef:
@Document(collection = "program")
    public class Program {

        @Id
        private String id;
        @Field("program_name")
        private String programName;

        // getters and setters

    }

I'm looking for a way to find and update the nested list items using the following queries:
Query used for finding a Program object by It's Id from AppliedApplication collection:
Query query = new Query();
     query.addCriteria(Criteria.where("id").is(applicationId)
      .and("program.$id").is(new ObjectId(programId)));

Program program = mongoTemplate.findOne(query, Program.class);

Query used for removing list item from AppliedApplication:
Update update = new Update().pull("program", new BasicDBObject("program.$id", new ObjectId(programId)));

mongoTemplate.updateMulti(new Query(), update, AppliedApplication.class);

None of them are working and I'm completely clueless.

A: Find:
Use positional operator/$elemMatch for finding the matching Program DBRef in the AppliedApplication.
Using $positional projection
Query query = new Query();
query.addCriteria(Criteria.where("id").is(new ObjectId(applicationId)).and("program.$id").is(new ObjectId(programId)));
query.fields().position("program", 1);
AppliedApplication application = mongoTemplate.findOne(query, AppliedApplication.class);
Program program = application.getProgramList().get(0);

Using $elemMatch projection
Query query = new Query();
query.addCriteria(Criteria.where("id").is(new ObjectId(applicationId)));
query.fields().elemMatch("program", Criteria.where("$id").is(new ObjectId(programId)));
AppliedApplication application = mongoTemplate.findOne(query, AppliedApplication.class);
Program program = application.getProgramList().get(0);

Remove:
Use $pull to remove the DBRef from list of program DBref's.
Query query = Query.query(Criteria.where("$id").is(new ObjectId(programId)));
Update update = new Update().pull("program", query);
mongoTemplate.updateMulti(new Query(), update, AppliedApplication.class);

Add
Use $push to add new programs to the list.
Query query = new Query();
query.addCriteria(Criteria.where("id").is(new ObjectId(applicationId)));
Update update = new Update().push("program", new DBRef("program", new ObjectId(programId));
mongoTemplate.updateMulti(query, update, AppliedApplication.class);

A: First Query would run if you return the AppliedApplication
Query query = new Query();
        query.addCriteria(Criteria.where("id")
            .is(new ObjectId(applicationId))
            .and("program.$id")
            .is(new ObjectId(programId)));
AppliedApplication  application = this.mongoOperations.findOne(query, AppliedApplication .class);

And then use application object to get the program.
For the second query you need to change ,
 Update update = new Update().pull("program", new BasicDBObject("$id", new ObjectId(programId)));

 mongoTemplate.updateMulti(new Query(), update, AppliedApplication.class);

Replace --> abc.$id  to $id


text:
Q: Search for user files in relative and absolute path I have cript which search for user files in absolute path, but now I need to add for relative also.  How can I do this?
#!/usr/local/bin/bash
if [ $# -eq 2 ]; then
        DIR=$1
        USERNAME=$2
        while [ ! $(id -g $USERNAME) ]; do
                echo "non-existing username, please add again "
                read USERNAME
        done
        while [ ! -d "/home/$DIR" ]; do

                echo "non-existing '$DIR' directory, please add again "
                read DIR
        done
        echo "variable username is now $USERNAME"
        echo "variable DIR is now $DIR"
        echo -e "username group   file"
        ls -1Apl /home/$DIR | grep -v /\$ | awk -v user=${USERNAME} '$3==user{print}{}' | tr -s ' ' | cut -d ' ' -f3 -f4 -f9
else
        echo "bla"
fi

A: i don't need damn abolute and relative path with freakin' ls :/
so
while [ ! -d "$DIR" ]; do

and
ls -1Apl $DIR | grep -v /\$

and it is working


text:
Q: PROTÉGÉ SPARQL QUERY TAB: cannot query for ontology-specific classes I am using SPARQL Query tab in Protege 5 to query an OWL ontology I have been constructing. I succeded in many kinds of queries, but when I use some specific class of my ontology inside the very same queries (that are apparently well formed) they return no results. Following, two of the problematic queries - assuming "Event" as one of the concepts of the ontology (http://www.semanticweb.org/ontologies/2014/5/MyOnto#Event):
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX onto: <http://www.semanticweb.org/ontologies/2014/5/MyOnto#>

SELECT ?a  WHERE { ?a rdfs:subClassOf onto:Event }

and, with the same prefixes
SELECT ?a  WHERE { ?a rdfs:range onto:Event }

Both return no results. However, if I substitute "onto:Event" for, let's say, ?b, both return a long list of results - inclunding Event as a match for ?b.
Is it something I'm misusing or forgetting (although I've seen this pattern in several links on internet with people claiming to have got results) or is it a limitation of SPARQL or some issue of the Protege tab?

A: The problem is that, in fact, although the URI of the ontology is:
<http://www.semanticweb.org/ontologies/2014/5/MyOnto#>

in the OWL document, the prefix used before class names is the IRI:
<http://www.semanticweb.org/ontologies/2014/2/untitled-ontology-662#>

Thus, replacing the old onto: by
PREFIX onto: <http://www.semanticweb.org/ontologies/2014/2/untitled-ontology-662#>

solves the issue.
(Thanks to @Csongor from Protégé Project mail list, who found the answer.)
P.S.: It's also worthy to note that it can't be taken for granted that all the terms in the ontology will be <current_ontology_URI#term> - e.g. if one includes some terms in the ontology and then changes ontology URI, these terms will be identified as <previous_ontology_URI#term> and the new ones as <current_ontology_URI#term> (which was exactly the cause of the problem above).

A: I had the same problem, whenever using an ontology specific class there were no results although there should have been. My ontology (pizza.owl) was loaded from a local file.
I found that it is required to add the file name in the PREFIX.
PREFIX : <http://www.co-ode.org/ontologies/pizza/pizza.owl#>

After that I got the information that I expected.