text:
Q: How to place all objects in all cells at the same distance from the borders Currently I'm trying to make a tool to optimize the process of creating new planograms, layouts. The file has many pictures, now I'm placing and resizing them equally one to another manually, but it still has some difference.
https://i.stack.imgur.com/hChgm.png
How can I place them in the right order with the right size (they should be placed in the middle of the cell with a small indent from below)?

A: Tip 1: Dragging a shape whilst holding down the alt-key causes Excel to snap to the cell grid.
Tip 2: control-click the shapes to select them all and then use Align, Top from the contextual ribbon tab. Then you can drag all of them to the right vertical location.
This macro will align all shapes the same as the one you have currently selected when you run it. It also updates the width and height of all of them. To use it: Position one picture the way you like it, including the size. Select that picture and then run the code. Make sure you save the file first in case you don't like the end result so you can close the file without saving and open the just saved copy.
Sub AlignAndSizeAllShapes()
    Dim dLeftOffset As Double
    Dim dTopOffset As Double
    Dim dHeight As Double
    Dim dWidth As Double
    Dim oShp As Shape
    dLeftOffset = Selection.Left - Selection.TopLeftCell.Left
    dTopOffset = Selection.Top - Selection.TopLeftCell.Top
    dHeight = Selection.Height
    dWidth = Selection.Width
    For Each oShp In ActiveSheet.Shapes
        oShp.Left = oShp.TopLeftCell.Left + dLeftOffset
        oShp.Top = oShp.TopLeftCell.Top + dTopOffset
        oShp.Width = dWidth
        oShp.Height = dHeight
    Next
End Sub


text:
Q: How to search a cell for a comma and perform one of two actions based on whether a comma was found or not? I have an excel worksheet of about 7,000 rows, each of which has a column with names that can be in various forms ([firstname lastname], [lastname, firstname], etc). I need to take all of those names and separate them into two separate columns, a first name and a last name column.
So what I want to do is write some code that will …

*

*search for a comma in the string

*if there is a comma, take all of the characters leading up to the comma and put them in the last name column. Then take all the characters after the comma and put them in the first name column

*if there is no comma, just put the first string (first name) in the first name column and the second string (the last name) in the last name column.

It's been a while since I have messed around with visual basic code but I am thinking I can use some sort of find() method for the first step but after that I am completely lost. Any help would be appreciated.

After many edits....
Here is where I am at so far.
Sub WhatsInAName()
Dim N As Long, i As Long, v As String, M As Long, X As Long
N = Cells(Rows.Count, "G").End(xlUp).Row
For i = 2 To N
    v = Cells(i, "G").Value
    M = InStr(1, v, ",")
    X = InStr(1, v, "@")
    If M > 0 Then
        Cells(i, "H").Value = LTrim(Mid(v, M + 1))
        Cells(i, "I").Value = Left(v, M - 1)
    ElseIf X > 0 Then
        Cells(i, "H").Value = "email"
    Else
        M = InStr(1, v, " ")
        Cells(i, "H").Value = Left(v, M - 1)
        Cells(i, "I").Value = Mid(v, M + 1)
    End If
Next i

    End Sub
Edit #?
Ok so this is what I've essentially ended with. After seeing the data parsed out, it turns out there were a bunch of rows with 3 names or extra jibberish next to their name. For those I will just have to use Text-To-Columns until I figure out how to make my code more advanced to handle those issue. Thanks guys! This was a fun learning experience

A: Well, not the best solution, but you can do this with normal formulas and then later on paste values.
You posted you have a column with names and you want to separate into 2 columns. I made something like this:

In cell B2 my formula is:
=IF(LEN(A2)-1=LEN(SUBSTITUTE(A2;" ";""));IF(IFERROR(SEARCH(",";A2);0)=0;TRIM(MID(A2;1;SEARCH(" ";A2)-1));TRIM(MID(A2;SEARCH(",";A2)+1;99)));"Manual fix")

In cell C2 my formula is:
=IF(LEN(A2)-1=LEN(SUBSTITUTE(A2;" ";""));IF(IFERROR (SEARCH(",";A2);0)=0;TRIM(MID(A2;SEARCH(" ";A2)+1;99));TRIM(MID(A2;1;SEARCH(",";A2)-1)));"Manual fix")

Some observations:

*

*The formula will return Manual Fix if there are 2 or more spaces in the name (composed names)

*The formula only works with 2 cases: case lastname, firstname and firstname lastname. Any other case will cause an error/unexpected result

*If there are extra spaces at end or start of names, it will be counted as 2 or more spaces, so the formula will return Manual Fix
As you can see in the image, Michael Jackson and Jackson, Michael is splitted correctly. Jean Claude Van Dame returns Manual Fix due to being a composed name.
Try to adapt this to your needs.
UPDATE: Uploaded a file sample to GDrive in case you want to check the formulas on live. https://drive.google.com/file/d/17Agd57sclLlNuUbhdyaHmQgKUHcRd7hO/view?usp=sharing

A: Consider:
Sub WhatsInAName()
    Dim N As Long, i As Long, v As String, M As Long
    N = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To N
        v = Cells(i, "A").Value
        M = InStr(1, v, ",")
        If M > 0 Then
            Cells(i, "B").Value = LTrim(Mid(v, M + 1))
            Cells(i, "C").Value = Left(v, M - 1)
        Else
            M = InStr(1, v, " ")
            Cells(i, "B").Value = Left(v, M - 1)
            Cells(i, "C").Value = Mid(v, M + 1)
        End If
    Next i
End Sub

For example:

This assumes that each cell contains either a comma or a space and the parsing is based on the first occurrence of the separator.  Also assumes:

*

*input data in column A

*no header row (data starts in row #1)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is changing the system hostname on a server with a running MySQL / MariaDB service harmful? I want to change the hostname of a running CentOS 7 server which is running MySQL (mysql  Ver 15.1 Distrib 10.0.33-MariaDB, for Linux (x86_64) using readline 5.1). Although I can't find any sources specifically referencing this, the following question just to be sure:
Is changing the system hostname on a server with a running database service harmful? Is it better to shut down the service, then change the hostname, and then start it again?


text:
Q: Cross-thread operation not valid while listening to a COM port
Possible Duplicate:
Getting Cross-thread operation not valid
Cross-thread operation not valid

I am trying to listen to COM port so that I create new handler for SerialPort.DataReceived event. The logic is simple - I write something to TextBox1, press Button1 and my text should show it self in Label1. But my application don't want to run, becouse it throws 'Cross thread operation not valid' error.
I did some searching and found Invoke object - how can I use it in my example? Why do I need to include Invoke logic?
namespace WindowsApplication1
{
public partial class Form1 : Form
{
    SerialPort sp = new SerialPort();

    public Form1()
    {
        InitializeComponent();
        sp.DataReceived += MyDataReceivedHandler;
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private void MyDataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
    {
        try
        {
            //sp.PortName = "COM3";
            //sp.Open();
            Label1.Text = sp.ReadLine();
        }
        catch (Exception exception)
        {
            RichTextBox1.Text = exception.Message + "\n\n" + exception.Data;
        }
        finally
        {
            sp.Close();
        }
    }

    private void button1_Click(object sender, EventArgs e)
    {
        try
        {
            sp.PortName = "COM3";
            sp.Open();
            sp.WriteLine(TextBox1.Text);
        }
        catch (Exception exception)
        {
            RichTextBox1.Text = exception.Message + "\n\n" + exception.Data;
        }
        finally
        {
            sp.Close();
        }
    }
}

}

A: My guess is that MyDataReceivedHandler is running on a different thread than the GUI. In order to fix that, you need to invoke the Text setters on the correct thread. This is a sample of doing so:
public void SetControlText(Control control, string text)
{
    if (this.InvokeRequired)
    {
        this.Invoke(new Action<Control,string>(SetControlText), new object[] { control, text });
    }
    else
    {
        control.Text = text;
    }
}

private void MyDataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
{
    try
    {
        //sp.PortName = "COM3";
        //sp.Open();
        SetControlText(Label1, sp.ReadLine());
    }
    catch (Exception exception)
    {
        SetControlText(RichTextBox1, exception.Message + "\n\n" + exception.Data);
    }
    finally
    {
        sp.Close();
    }
}

If you are using .NET Framework 2.0, the above Action<T1, T2> delegate is not available, so you will have to define your own one:
private delegate void SetControlTextHandler(Control control, string text);

public void SetControlText(Control control, string text)
{
    if (this.InvokeRequired)
    {
        this.Invoke(new SetControlTextHandler(SetControlText), new object[] { control, text });
    }
    else
    {
        control.Text = text;
    }
}

The SetControlText method can be made shorter (and even static) like this (this works in both 2.0 and 3.5):
public static void SetControlText(Control control, string text)
{
    ´control.Invoke((MethodInvoker)delegate { control.Text = text; });
}

Then you don't need to do the check of InvokeRequired each time, but you will on the other hand wrap the call in a delegate even if it is not needed. I think that in a GUI method like this any performance difference between those two is neglectible so I tend to use the shorter form, simply because it is less code to write.

A: You can also do the following whenever accessing a UI control from a different thread than the one it was created on:
(.NET 3.5)
myControl.BeginInvoke(new MethodInvoker( () => myControl.whatever = whatever; ));

or
(.NET 2.0)
myControl.BeginInvoke(new MethodInvoker( delegate { myControl.whatever = whatever; ));

edit> Sometimes using Invoke for a long running operation can/will still hang the ui, using BeginInvoke obviously performs that operation asynchronously, and the ui will not hang.


text:
Q: RecyclerView not showing in ConstraintLayout I'm trying to show a RecyclerView ("mapRecyclerView") below another ConstraintLayout ("clientData) inside a ConstraintLayout but it presents a strange behavior: RecyclerView ("mapRecyclerView") has a Top Constraint to the bottom of another ConstraintLayout ("clientData"), if this ConstraintLayout has width as specific dp the recyclerview shows fine but if the ConstraintLayout has a width of "match_constraint" the RecyclerView is not visible anymore and the "afterMeasured" event of the RecyclerView is never called, here is the XML of the layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto"
                                                   xmlns:tools="http://schemas.android.com/tools"
                                                   xmlns:android="http://schemas.android.com/apk/res/android"
                                                   android:layout_width="match_parent"
                                                   android:layout_height="match_parent">

    <androidx.appcompat.widget.Toolbar
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/toolbar"
            android:layout_width="0dp"
            android:layout_height="?attr/actionBarSize"
            android:minHeight="?attr/actionBarSize"
            android:background="@android:color/white"
            android:elevation="4dp" app:layout_constraintStart_toStartOf="parent"
            android:fontFamily="@font/gotham_rounded_book"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent" android:theme="@style/custom_toolbar"/>

    <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@+id/toolbar"
            app:layout_constraintStart_toStartOf="parent"
            android:id="@+id/clientData" android:background="@color/white"
            app:layout_constraintEnd_toEndOf="parent">

        <TextView
                android:text="1"
                android:layout_width="35dp"
                android:layout_height="35dp"
                android:id="@+id/activeServiceNumber"
                android:background="@drawable/button_yellow_round_border" android:textAlignment="center"
                android:textSize="18sp"
                app:layout_constraintTop_toTopOf="@+id/name" android:layout_marginStart="8dp"
                app:layout_constraintStart_toStartOf="parent"
                android:fontFamily="@font/gotham_rounded_medium"
                android:paddingTop="6dp" android:textColor="@color/white" android:layout_marginTop="8dp"/>
        <TextView
                android:text="TextView"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:id="@+id/name"
                app:layout_constraintStart_toEndOf="@+id/activeServiceNumber" android:layout_marginStart="8dp"
                android:fontFamily="@font/gotham_rounded_medium" android:textColor="@color/colorPrimaryText"
                android:textSize="16sp" android:layout_marginEnd="8dp"
                android:layout_marginBottom="8dp" app:layout_constraintBottom_toTopOf="@+id/client"
                app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="8dp"
                app:layout_constraintEnd_toStartOf="@+id/directionsBtn"/>
        <TextView
                android:text="TextView"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:id="@+id/client"
                app:layout_constraintStart_toEndOf="@+id/activeServiceNumber" android:layout_marginStart="8dp"
                android:fontFamily="@font/gotham_rounded_light" android:textSize="15sp" android:layout_marginEnd="8dp"
                android:layout_marginBottom="8dp"
                app:layout_constraintBottom_toTopOf="@+id/address"
                app:layout_constraintEnd_toStartOf="@+id/directionsBtn"/>
        <TextView
                android:text="TextView"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:id="@+id/address"
                app:layout_constraintStart_toEndOf="@+id/activeServiceNumber" android:layout_marginStart="8dp"
                android:fontFamily="@font/gotham_rounded_light" android:textSize="13sp" android:layout_marginEnd="8dp"
                android:layout_marginBottom="8dp"
                app:layout_constraintBottom_toTopOf="@+id/phone"
                app:layout_constraintEnd_toStartOf="@+id/directionsBtn"/>
        <TextView
                android:text="TextView"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:id="@+id/phone"
                app:layout_constraintStart_toEndOf="@+id/activeServiceNumber" android:layout_marginStart="8dp"
                android:textSize="13sp" android:fontFamily="@font/gotham_rounded_light" android:layout_marginEnd="8dp"
                app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="16dp"
                app:layout_constraintEnd_toStartOf="@+id/directionsBtn"/>
        <Button
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:id="@+id/directionsBtn"
                app:layout_constraintEnd_toEndOf="parent"
                android:text="Mostrar \nRuta"
                android:drawableTop="@drawable/ic_go_to_route" android:textAllCaps="false"
                android:background="@color/white"
                android:padding="10dp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintTop_toTopOf="parent"/>

    </androidx.constraintlayout.widget.ConstraintLayout>

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              android:id="@+id/ongoingServiceMap"
              android:name="com.google.android.gms.maps.SupportMapFragment"
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:clickable="true"
              app:layout_constraintStart_toStartOf="parent"
              app:layout_constraintEnd_toEndOf="parent"
              tools:context="com.cargamos.cargamosdriver.views.service.OngoingServiceActivity"
              app:layout_constraintHorizontal_bias="0.0"
              app:layout_constraintBottom_toBottomOf="parent" android:focusable="true"
              app:layout_constraintTop_toBottomOf="@+id/clientData"/>

    <androidx.recyclerview.widget.RecyclerView
            android:layout_width="wrap_content"
            android:layout_marginTop="32dp"
            android:layout_marginBottom="32dp"
            app:layout_constraintStart_toStartOf="@+id/ongoingServiceMap"
            android:layout_marginStart="8dp"
            android:id="@+id/mapRecyclerView"
            android:background="@color/white"
            app:layout_constraintBottom_toTopOf="@+id/confirmArrivalSlider"
            android:layout_height="0dp"
            app:layout_constraintTop_toBottomOf="@+id/clientData"/>

    <com.ncorti.slidetoact.SlideToActView
            android:id="@+id/confirmArrivalSlider"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            app:text="Confirmar llegada"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:slider_height="60dp"
            app:area_margin="4dp"
            app:outer_color="@color/colorPrimary" app:text_style="bold" app:text_size="18dp"
            android:layout_marginStart="32dp" android:layout_marginBottom="24dp" android:layout_marginEnd="32dp"/>

</androidx.constraintlayout.widget.ConstraintLayout>

A: Depending on what items you have in your RecyclerView, you probably want to set the width of the RecyclerView to match_parent.
By the way, I can't reproduce the problem you describe in the preview


text:
Q: Spring hateoas and java 8: am I forced to throw exception? I just want to add links to my response, so the following code in java 7 is perfectly fine:
for(PetModel pet : pets){
    pet.add(linkTo(methodOn(PetController.class).getPetById(pet.getId())).withSelfRel());
}

This one forces me to handle the exception that getPetById could throw, even though it will never do that in this snippet:
pets.forEach( (pet) -> pet.add(linkTo(methodOn(PetController.class).getPetById(pet.getId())).withSelfRel()));

why is that?


text:
Q: BeautifulSoup Parses Table Incorrectly Having trouble getting Beautiful Soup to process a large table of play-by-play basketball data properly. Code:
import urllib.request
from bs4 import BeautifulSoup

request = urllib.request.Request('http://www.basketball-reference.com/boxscores/pbp/201611220LAL.html')
result = urllib.request.urlopen(request)
resulttext = result.read()
soup = BeautifulSoup(resulttext, "html.parser")

pbpTable = soup.find('table', id="pbp")

If you run this example yourself, you will find that the table is not fully parsed- all we get out is this:

Play-By-Play Table

1st Q

The problem is in the parsing itself printing the soup variable gives (among other things)

Play-By-Play

  Jump to: 1st | 2nd | 3rd | 4th
 scoring play tie lead change

Play-By-Play Table

1st Q

Most importantly, a /table tag appears out of nowhere. Viewing the page source of the relevant link we can see that the table is not closed there- it goes on for a while. Is there any fix for this besides implementing my own HTML parsing code?

A: Use "lxml" or "html5lib" instead of "html.parser" in
soup = BeautifulSoup(resulttext, "lxml")`

and you get more data.
But you may have to install lxml or html5lib if you don't have yet.
pip install lxml

pip install html5lib

lxml may need C/C++ compiler, libxml library (libxml.dll on Windows), etc.


text:
Q: esb mule passing the parameters to the method via http I have a test method:
@Test
    public void testHello_with_muleXmlConfig() throws Exception {

        MuleClient client = new MuleClient("mule-config-test.xml");
        client.getMuleContext().start();

        MuleMessage result = client.send("http://127.0.0.1:8080/hello", "some data", null);
        assertNotNull(result);

        assertNull(result.getExceptionPayload());
        assertFalse(result.getPayload() instanceof NullPayload);

        assertEquals("hello", result.getPayloadAsString());
    }

Here (client.send("http://127.0.0.1:8080/hello", "some data", null)), I'm passing the parameter/data = 'some data'.
And I have a class:
public class HelloWorld {
    public String sayHello() {
        return "hello";
    }
}

which is exposed as spring bean in mule-config.xml:
<spring:bean id="helloWorld" class="org.mule.application.hello.HelloWorld"/>

<flow name="HelloWorld">
        <inbound-endpoint address="http://127.0.0.1:8080/hello"/>
        <invoke method="sayHello" object-ref="helloWorld"/>
    </flow>

What I should do to pass the parameter 'hello' into the 'sayHello()' method. If just changing it to 'sayHello(String text)' - it will not work.

A: You need to add this to the invoke element:
methodArguments="#[message.getPayload()]" methodArgumentTypes="java.lang.String"

A: Not sure about how/if invoke works: I suggest you use component instead.
If you change your method to accept a String, like for example:
public String sayHello(final String text)
{
    return "hello:" + text;
}

then you also need to use an object-to-string-transformer to deserialize the inbound input stream to a String:
<flow name="HelloWorld">
    <inbound-endpoint address="http://127.0.0.1:8080/hello" />
    <object-to-string-transformer />
    <component>
        <spring-object bean="helloWorld" />
    </component>
</flow>

A: Try This :

*

*add this in your flow :

<invoke object-ref="helloWorld" method="sayHello" methodArguments="#[message.inboundProperties.'http.query.params'.name]" doc:name="Invoke" />

*

*and this is the invoked method :
public String sayHello(String name) {
        return String.format("Hello %s!", name);
    }


text:
Q: Estender classes com construtor privado Porque não posso estender classes com construtor privado?
Consirando as classes A:
public class A {
    private A(){}
    public static void limao(){}
}

e B:
public class B extends A {
    private B(){}
    public static void banana(){}
}

Por que B não pode estender A?
There is no default constructor available my.package.name.A
Meu objetivo é ter algumas classes que contém apenas membros estáticos e gostaria de garantir que elas sejam utilizadas da maneira correta (sem instâncias) mas que também herdam de outras classes por terem métodos em comum. Atualmente faço isso em C# atráves de classes estáticas mas não consigo aplicar algo parecido no meu projeto Android.

A: Porque isto vai contra a definição formal de proteção de métodos da teoria de orientação a objetos clássica. Se um membro é private, ele não pode ser acessado por nenhuma outra classe que não a própria classe.
Para este caso, use protected para que o construtor possa ser acessível pelas classes que extendem sua classe A.

A: Se todos os métodos são estáticos, para que herdar da classe? Você pode simplesmente, na classe B, importar todos os métodos de A de modo que você continue podendo chamá-los sem precisar ficar usando A.metodo.
B.java
import static meu.pacote.A.*;

public class B {
    private B(){}
    public static void banana(){
        limao();
    }
}

Se for mesmo necessário herdar, use um construtor protected como sugerido por @Cigano Morrison Mendez. Ou, se as classes estiverem no mesmo pacote, um "package protected" (i.e. sem modificador) - pois isso evita que qualquer classe fora do pacote herde de A. Você pode ainda marcá-la como abstract (impedindo a instanciação) ou talvez lançar uma exceção no construtor (impedindo a instanciação de subclasses), se achar necessário tornar seu código "à prova de idiotas". Fica a seu critério...

A: Porque o construtor foi declarado como privado em A e o B não consegue acessar membros privados, apenas public ou protected. Quando você declara um construtor como privado nenhum outra classe vai enxerga-lo sendo impossível herdar da mesma ou instancia-la em outra classe.


text:
Q: Extract column names & combine them with delimiter if value =1 (binary values) and put it in new column I have a dataframe with binary values post performing get_dummies using pandas
df=
Values  A1  A2  B1  B2  B3  B4  C1  C2  C3
10      1   0   1   0   0   0   1   0   0
12      0   1   0   0   1   0   0   1   0
3       0   1   0   1   0   0   0   0   1
5       1   0   0   0   0   1   1   0   0

I want a new column which has combination of all columns which has 1's in it
Expected output:

Values  A1  A2  B1  B2  B3  B4  C1  C2  C3  Combination
10      1   0   1   0   0   0   1   0   0   A1~~B1~~C1
12      0   1   0   0   1   0   0   1   0   A2~~B3~~C2
3       0   1   0   1   0   0   0   0   1   A2~~B2~~C3
5       1   0   0   0   0   1   1   0   0   A1~~B4~~C3

Actual matrix can be 25000+ rows*1000+columns
There is a similar solution found in R but i need it in Python bcoz all other dependencies are in python and R is new to me.
Extract column names with value 1 in binary matrix
Codes in R below, & need similar one or any other code in python which can help me to arrive at my expected output
Solution 1 :
as.matrix(apply(m==1,1,function(a) paste0(colnames(m)[a], collapse = "")))

Solution 2:
t <- which(m==1, arr.ind = TRUE)
as.matrix(aggregate(col~row, cbind(row=rownames(t), col=t[,2]), function(x)
                                                    paste0(colnames(m)[x], collapse = "")))

how could something similar or arrive at my expected output in Python?

A: df["Combination"] = df.iloc[:, 1:].dot(df.add_suffix("~~").columns[1:]).str[:-2]

We select columns except for Values with iloc and then form a dot product where the second operand is respective columns of df with ~~ added to the end. Result gives ~~ for the very end as well, so we chop it with .str[:-2]
to get
   Values  A1  A2  B1  B2  B3  B4  C1  C2  C3 Combination
0      10   1   0   1   0   0   0   1   0   0  A1~~B1~~C1
1      12   0   1   0   0   1   0   0   1   0  A2~~B3~~C2
2       3   0   1   0   1   0   0   0   0   1  A2~~B2~~C3
3       5   1   0   0   0   0   1   1   0   0  A1~~B4~~C1

A: You can try apply with str.join:
df["Combination"] = df.drop("Values", axis=1).apply(lambda x: "~~".join(x[x != 0].index), axis=1)

print(df)
#    Values  A1  A2  B1  B2  B3  B4  C1  C2  C3 Combination
# 0      10   1   0   1   0   0   0   1   0   0  A1~~B1~~C1
# 1      12   0   1   0   0   1   0   0   1   0  A2~~B3~~C2
# 2       3   0   1   0   1   0   0   0   0   1  A2~~B2~~C3
# 3       5   1   0   0   0   0   1   1   0   0  A1~~B4~~C1

Explanations:

*

*For calculating the  Combination, ignore Values column. Several approach are possible (see this topic). Here I use drop: df.drop("Values", axis=1).

*Apply a custom function over each row using apply and axis=1

*In the function, filter values different from 0 using x[x != 0]

*Select column name (here there are index of the Serie) using .index

*Use str.join to match desired output: "~~".join(x[x != 0].index)

Full illustration:
# Step 1
print(df.drop("Values", axis=1))
#    A1  A2  B1  B2  B3  B4  C1  C2  C3
# 0   1   0   1   0   0   0   1   0   0
# 1   0   1   0   0   1   0   0   1   0
# 2   0   1   0   1   0   0   0   0   1
# 3   1   0   0   0   0   1   1   0   0

# Step 3
print(df.drop("Values", axis=1).apply(lambda x: x[x != 0], axis=1))
#     A1   A2   B1   B2   B3   B4   C1   C2   C3
# 0  1.0  NaN  1.0  NaN  NaN  NaN  1.0  NaN  NaN
# 1  NaN  1.0  NaN  NaN  1.0  NaN  NaN  1.0  NaN
# 2  NaN  1.0  NaN  1.0  NaN  NaN  NaN  NaN  1.0
# 3  1.0  NaN  NaN  NaN  NaN  1.0  1.0  NaN  NaN

# Step 4
print(df.drop("Values", axis=1).apply(lambda x: x[x != 0].index, axis=1))
# 0    Index(['A1', 'B1', 'C1'], dtype='object')
# 1    Index(['A2', 'B3', 'C2'], dtype='object')
# 2    Index(['A2', 'B2', 'C3'], dtype='object')
# 3    Index(['A1', 'B4', 'C1'], dtype='object')

# Step 5
df["Combination"] = df.drop("Values", axis=1).apply(lambda x: "~~".join(x[x != 0].index), axis=1)
print(df)
#    Values  A1  A2  B1  B2  B3  B4  C1  C2  C3 Combination
# 0      10   1   0   1   0   0   0   1   0   0  A1~~B1~~C1
# 1      12   0   1   0   0   1   0   0   1   0  A2~~B3~~C2
# 2       3   0   1   0   1   0   0   0   0   1  A2~~B2~~C3
# 3       5   1   0   0   0   0   1   1   0   0  A1~~B4~~C1

A: You can use the .dot function of pandas after dropping your values column to get the column names you want and then process the output with list comprehensions to obtain the right A1~~B1~~C1 format.
Here's what it looks looks like:
tmp = [list(i) for i in list(df.dot(df.columns))]
df['combination'] = ['~~'.join(i) for i in tmp]

print(df)

    A   B   C   D   combination
0   1   1   0   0   A~~B
1   0   1   1   0   B~~C
2   0   0   1   0   C


text:
Q: Как правильно перевести техзадание с английского? Slick Slider Не могу до конца понять, что значит эта строка:
Use Slick slider for hero section + relative slick slider for posts.
Буквально я понял:
"Используйте Slick Slider для hero (главный, действующий) секции + relative (родственный, взаимный, релятивный) слайдер для сообщений ниже.
Это что 2 слайдера должны быть или по очереди нижние сообщения должны подниматься в слайдер? Дайте ссылку на похожий слайдер по возможности.
Фото части макета прилагаю:

A:
Не могу до конца понять, что значит эта строка "Use Slick slider for hero section + relative slick slider for posts".

Используйте Slick Slider для "hero" секции, плюс, взаимоотносящиеся к hero-слайдеру, дополнительные SlickSlider'ы для постов.
В документации приведен пример синхронизации нескольких слайдеров.
Под Hero подразумевается самый большой и широкий (960 x 270) блок сверху.


text:
Q: Run Load Tests during build within Visual Studio Online I've created a Web Performance and Load Test Project which, for the moment, performs a couple of simple tests on our Dynamics CRM 2013 solution using Visual Studio Online. (Tests will be expanded at a later time)
(The Load Test solution itself resides in a on-premises TFS along with all our other projects)
When I run my Load Tests on my local machine it all works like a charm.
My goal now is to run these Load Tests during the build of the solution.
It seems I have to use MSTest as Visual Studio Test Runner doesn't support Load Tests.
So I have modified my Build Template to use MSTest, with a little help of this post: https://social.msdn.microsoft.com/Forums/vstudio/en-US/93c8634f-b6d6-4d8a-8c8c-b6eb6c1fad06/tfs-2013-and-webtests-and-load-tests?forum=tfsbuild
This is were I run into a problems. As I don't see an option where I can direct my Load Test to use a specific VSO account, let alone the credentials for this account.
My questions are:

*

*Is MSTest the best solution to start Load Tests during a build in Visual Studio Online? Is there a better one?

*If so, how do I tell MSTest to use a specific VSO account?

A: You should not be running load tests, or any sort of tests that require an instance of your application, on a build server.
You should have an environment that you deploy your bits to and then run there. Microsoft have a tool specifically for this purpos called Release Manager.
http://nakedalm.com/create-release-management-pipeline-professional-developers/
Release Manager Online is available with your account and you can easily call out to the load test or other capabilities...


text:
Q: Is it bad practice to use Negative Margins or Padding in CSS Take for example this image below of a project I am working on...
The Blue background is a DIV that is inside of another DIV that wraps all that sidebar contact section together.  To get the Blue BG DIV to have the round border and not have a gap because of the parents margin/padding I had to use negative margins
margin: -9px -2px 8px -6px;
So the question is, is it bad practice to use Negative Margins or Padding?

A: No; it's not bad practice, so long as you're aware of the fact you're using negative margins, and that this necessarily 'pulls'/'moves' elements from their otherwise-'normal' position.
Why would you even worry about this?

A: Negative margins are a great way to negate the padding inside of an element for headings etc. I have found no negative results (pardon the pun) of using negative margins. E.g:

Full width heading

 The content of the div which is now padded in by ten pixels.

I was worried about negative margins when I first discovered them but have found them to be very useful is so many layout areas- actually reducing div counts and cleaning up layout code.


text:
Q: AngularJS -- See which character was deleted by the backspace or delete key without comparing I am creating an application that needs to take user input from a text input. If, at any point, the character that was inputted was incorrect (ie: a number when it should only be a-z), the input box will become invalid. I then take that character and place it in an array of "bad characters" that are in the input. The input box should become valid again if the character is deleted.
I am aware that I can take the input with every new key press and check that, but then that is going through each character to make sure it is allowed.
I am curious if there is anyway to see what character was deleted with a backspace press.
I cannot post my code, I'm sorry.
I am using ng-keydown and mg-model in html. When the confirm button is pressed, the input should be valid from the ng-model.
Thanks -- I am teaching myself Angularjs, so I am not the best with it yet.

A: To get the deleted characters you can use plain old javascript:
var caret_get_position = function(element){
    var pos    = 0;
    var posEnd = 0;
    if('selectionStart' in element){
        pos    = element.selectionStart;
        posEnd = element.selectionEnd;
    }else if('selection' in document){
        element.focus();
        var Sel       = document.selection.createRange();
        var SelLength = document.selection.createRange().text.length;
        Sel.moveStart('character', -element.value.length);
        pos    = Sel.text.length-SelLength;
        posEnd = Sel.text.length;
    }
    // return both selection start and end;
    return [pos, posEnd];
};
//get deletet character
element.addEventListener('keydown', function(event){
    var keycode      = ('which' in event)?event.which:event.keyCode;
    caret_positions  = caret_get_position(element);
    var val = this.value;
    if(keycode == 8){
        if(caret_positions[0] == caret_positions[1]){
            if(caret_positions[0] == 0){
                deleted = '';
            }else{
                deleted = val.substr(caret_positions[0]-1, 1);
            }

        }else{
            deleted = val.substring(caret_positions[0], caret_positions[1]);
        }
    }else if(keycode == 46){
        if(caret_positions[0] == caret_positions[1]){
            if(caret_positions[0] === val.length){
                deleted = '';
            }else{
                deleted = val.substr(caret_positions[0], 1);
            }
        }else{
            deleted = val.substring(caret_positions[0], caret_positions[1]);
        }
    }
});

So the hell am i doing here:
caret_get_position is pretty much self-explanatory. It will get the current position of the caret (the blinking line in your inputfield). Even with a selected range (this blue stuff) if you select more than one character.
In the keydown event it will check the pressed key and some more checks where the caret is.
In the end the deleted characters are in the variable deleted. This is from my code so you need to adjust it for your needs.


text:
Q: What's wrong with my locked post? I wrote a solution which had 2 upvotes last time I checked. Now it has 4 downvotes and it's been locked and deleted by the community. Why is that? I got around -200 reputation because of this and I don't know what's wrong with my post.
My Post:

Not. You can't do that.

if(4 <= $a <= 44) is equivalent to if((4 <= $a) <= 44) this may be

if(false <= 44) or if(true <= 44) two
  options is a bullshit.

EDIT: Problem solved by the Bill The Lizard. Thanks.

A: I cleaned up the post, undeleted, and unlocked it.  Your choice of words may not be offensive in all parts of the world, but it is in many.  Just be careful what you say.
Update: Apparently the flags are still in the system, even though they don't show up on the dashboard.  I'm looking in to how to clear them.
2nd Update: After reading @S.Mark's answer on my other post, I undeleted the post without unlocking it and that seems to have appeased the Community process.  I'll go back and unlock it after the flags have had time to clear.

A: "... two options is a bullshit."
Probably it got 6 flags as "offensive" and got deleted automatically.
Plus, you've lost 100 rep points, right?

A: If the bullshit had been grammatical, I, for one, would not have flagged. The presence of 'bullshit' in apparent word salad pushed me over the edge for a flag.


text:
Q: Pass method to function using method name from string variable I have a class with a constructor, two other methods, and a member list with the names of the two methods.
class Foo():
    def __init__(self):
        self.methods = ["self.foo", "self.bar"]
    def foo(self):
        print("foo")
        return 0
    def bar(self):
        print("bar")
        return 0

I have a function that takes a function as an argument, like this.
myFunction(func)

The function has global scope and would be used like this.
myFunction(self.foo)

I want to iterate through the items in the self.methods list and make a call to the function for each method name, but, as expected, a string is passed rather than the method itself. How do I pass the method like the above example, so like self.foo not "self.foo"?

A: From what I understand you can try this.
class Foo():
    def __init__(self):
        self.method=['foo','bar']
    def foo(self):
        print('foo')
    def bar(self):
        print('bar')
    def run_all(self):
        for m in self.method:
            getattr(self,m)()

a=Foo()
a.run_all() # iterating through self.method and executing them
# foo
# bar

A: You want somwthing like this?
class Foo():
    def __init__(self):
        self.methods = [self.foo(), self.bar()]
    def foo(self):
        print("foo")
        return 0
    def bar(self):
        print("bar")
        return 0

foo_obj = Foo()

A: What about:
class Foo():
    def __init__(self):
        self.methods = self.foo, self.bar

    def run_methods(self):
        for method in self.methods:
            print('Running method {}'.format(method.__name__))
            method()

    def foo(self):
        print("foo")
        return 0

    def bar(self):
        print("bar")
        return 0

So, you can run your methods by calling run_methods. If you want to access their names as well, you can always do that via their respective __name__ methods, as above.
f = Foo()
f.run_methods()

# Output:
#
# Running method foo
# foo
# Running method bar
# bar

EDIT: As another person suggested, you should edit your question to describe in more detail what myFunction(fun) does. But inded, you should probably use a different approach than passing the actual names as strings.


text:
Q: Animation with Sass and hover doesn't work? I'm stuck on :hover doesn't work. I suspect the absolute and float position but don't have any clear idea. I'm a beginner user of Sass and the css animation. Any help ?

    .menus {
    cursor: pointer;
    &:hover >.box {
        transform: scale(0) translateX(300px);
        .check {
            transform: rotate(0deg);
        }
    }
}
.box {
    float: right;
    position: absolute;
    top: 0;
    right: 0;
    width: 20%;
    height: 100%;
    background-color: yellow;
    border-radius: 4px;
    color: green;
    transform: scale(1) translateX(0);
    transition: transform 330ms ease-in-out;
    .check {
        display: block;
        float: right;
        position: absolute;
        right: 30%;
        top: 35%;
        transform: rotate(-360deg);
        transition: transform 500ms ease-in-out;
    }
}

Citrus Squid Carpaccio

with orange zest

A: The problem lies here :
.menus {
    cursor: pointer;
    &:hover + .box {

Your selector  &:hover + .box selects the .box elements that are siblings of .menus, and not children. You can use &:hover .box if you want to select all boxes children and grand children of .menus, or &:hover>.box to select direct .box children.
Here's a link with all the css selector that might be useful in the future: https://www.w3schools.com/cssref/css_selectors.asp


text:
Q: Invalid argument error when reading file from Amazon s3 using paperclip and rails I'm having an issue reading an XML file after it is uploaded to amazon S3 via paperclip. I've checked and I can access the link using the URL given in the error, all access permissions appear to be fine.
Here's the code I'm using to open the file, which is where the error occurs;
f = File.open(@asset.file.url)

And the error is Errno::EINVAL - Invalid Argument
I've tried searching for a solution but most seem to be regarding images and not text files.
The S3 bucket is in Ireland region if that makes any difference.

A: You are not reading the file from your local disk you are reading the file from remote location. Your code should be like this:
require 'open-uri'
url_data = open(@asset.file.url).read()


text:
Q: Why spyder can't import tensorflow I have installed tensorflow with anaconda in Windows, but I can't import tensorflow in spyder IDE?

A: The reason Spyder is unable to import Tensorflow is that Anaconda does not store the tensorflow package in the same environment.
One solution is to create a new separate environment in Anaconda dedicated to TensorFlow and containing Python with its own Spyder and then install tensorflow into that environment


text:
Q: hardcoding primarykey value in applications Hi I came to this situation working in my project, where people hardcode the value of a primarykey column in an application. Is it a good practice. while dealing with environments the value of that record might change but how about using identity inserts to other environments.

A: While this is obviously a very poor practice, I hesitate to reject anything like this without decent information on the reasoning.  I usually give my colleagues the benefit of the doubt and assume they have thought about the problem and come to a reasonable conclusion, and I simply need to learn to understand their reasoning.
There are certain very rare cases where hardcoded identities can be an OK solution, for example if your installation package also creates the database and the schema and seeds certain domain lookup values so they are the same on every system.  In cases like these, the identity column is defined with a seed that is a little higher than usual (e.g. IDENTITY(100,1)) and the system values are always placed below the seed (in this case, 100).
For example, maybe you have a domain table for PhoneType and values 1-3 are reserved for "Primary," "Billing," and "Contact."  Meanwhile values 100 and up are allowed for end users to define their own phone types.
It is definitely a poor practice to insert hardcoded identity values during run-time proper, e.g. in response to user input.  In that case it is probably better to find a natural key, use a GUID, or develop your own identity tracking system.

A: Typically I've seen this where there are constants in the code base (like enums for some kind of basic system types which are fundamental to the application) that are also in the database (as lookup tables).  There are some better ways to handle this, but ultimately, something is always going to get hardcoded in these cases, even if it isn't the primary key.  A primary key might be a natural key, for instance.
Typically you would only see this being acceptable for very fundamental entities.  Perhaps a type of organization or entity in a program like: TYPE_USER, TYPE_GROUP.  You would not see this for lookups which are typically user-modifiable, or expecting to be extensible, or not fundamental in some way, like VEHICLE_TYPE_CAR, VEHICLE_TYPE_SUV, VEHICLE_TYPE_RV, VEHICLE_TYPE_MOTORCYCLE, etc.
In any case, it is a code smell, and it's not a practice that's a good idea unless it's a fundamental immutable enumeration in the architecture.

A: I agree with all the replies here thus far and I also face certain situations where I need to check a condition on a certain value that is based on the primary key. As Siyual has stated, checking for this condition against a more explanatory field makes more sense.
One way of dealing with this could be to add another column in the entity describing the row, and use that as a conditional check that gets mapped to an enum.
e.g. Table:
+-----+----------+-------------+
| PK  |  Status  | Enum_mapped |
+-----+----------+-------------+
| 101 | Fitted   |           1 |
| 201 | Unfitted |           2 |
| 301 | Used     |           3 |
+-----+----------+-------------+

Code:
private enum Statuses
{
    Fitted,
    Unfitted,
    Used
}

private int GetStatus(int enumstatus)
{
    return enumstatus = ctx.myStatus.Where(a => a.Enum_mapped == enumstatus).Select(a => a.PK).FirstOrDefault();
}

Call the appropriate status:
GetStatus((int)Statuses.Fitted);

Result = 101


text:
Q: Why is $\{\omega \in \Omega: \sup_n f_n>c\}=\bigcup\limits_{i=1}^{\infty}\{\omega \in \Omega: f_n>c\}$? Let $f_1,f_2,...$ are borel measurable, real-valued functions.
Why is $\{\omega \in \Omega: \sup_n f_n>c\}=\bigcup\limits_{n=1}^{\infty}\{\omega \in \Omega: f_n>c\}$?
Any help would be appreciated
Edit: Also, would this statement be true if I were to substitute > by ≥?

A: HINT: check the double inclusion: $\supseteq$ is easy, $\subseteq$ needs to exploit the $\sup$ definition.
EDIT
Let's pick $\omega\in\Omega$ such that $\sup_nf_n(\omega)>c$; now notice that $\{f_n(\omega)\}_n$ is a real sequence, thus by definition of supremum, either there exists $\bar n$ s.t. $f_{\bar n}(\omega)>c$ (and we would have finished), or $\forall\varepsilon>0\;\;\exists n_{\varepsilon}$ s.t. the $n_{\varepsilon}$-tail of our sequence is contained in the $\varepsilon$-right-nhbd of $c$, from which we conclude.


text:
Q: Completely stop gnome keyring popups After some updates to fedora in the last few years, I've been getting the following popups (one when I login and one when ever I start google-chrome)...
"Choose password for new keyring"
"An application wants access to create a new keyring called 'Default'. Choose the password you want to use for it."

(If I've then created "Default")
"Enter password for keyring 'Default' to unlock"
"An application wants access to the keyring 'Default', but it is locked."

I don't want to use a password manager and would like to never have these popups. How can I remove or disable them? I do not have root access, so I'll need some kind of per-user config I can set.
Many related questions assume I'm using ubuntu, e.g.: Why do I need to enter a password for the Default Keyring to unlock?, and I haven't found anything that works for fedora.

A: Setting this keyring to blank should let it do its thing without bothering you. If you have already set it up, trash your keyring and restart Chrome to receive the fresh prompt (where you can set it to not use a password).
Check the following locations for the keychain:

*

*~/.gnome2/keyrings/default.keyring

*~/.local/share/keyrings/*
More elaboration and links at my Unix SE post.


text:
Q: Azure Active Directory Login I am complete newbie into Azure Active Directory login and I have tried the MVC 5 app using 'cloud - single organization' authentication.
In my azure account, I've set several users in default active directory folder. Few of them added through the wizard as a 'new user in your organization', which are sourced from Windows Azure Active Directory and few of them to be sourced from actual Microsoft Account.
When I start the app and sign in as one of the sourced from Windows Azure Active Directory, I get login and the app says on the top right corner 'Hello, john.doe@domain.com'
However when I login as one sourced from Microsoft Account, I too get login, but on the top right corner the app says 'Hello, !' without the real account name. Just exclamation mark. I suppose this is not the right behaviour, right?
I am using VS2013 community edition and start the app directly from VS through IIS express.
UPDATE:
It seems that for accounts which are on Azure Active Directory listed as sourced from Microsoft Account, the application is not able to retrieve any info - therefore User.Identity.Name is empty or null. Does anyone have a clue ?
Thanks

A: I got the salution :)
Add this block in your global.asax
protected void Application_PostAuthenticateRequest(Object sender, EventArgs e)
{
    ClaimsIdentity id = ((ClaimsIdentity)User.Identity);
    Claim claim = id.FindFirst(ClaimTypes.Email);
    if (claim != null)
    {
        string email = claim.Value;
        id.AddClaim(new Claim(ClaimTypes.Name, email));
    }
}


text:
Q: APFC C.T.Position We installed on grid solar plant.
Before installation P. F. was always maintained to 0.99 by capacitor banks(APFC panel).
But after solar connection is varies and goes down up to 0.16.
APFC panel CT position is on grid only. Should it be after combination of solar and grid?


text:
Q: Google App Engine Data store vs. Firebase Database I'd like to ask for the pros and cons between choosing either Firebase or Objectify (convenience interface for Google's Data store), as storage for the backend.
I'd like to make it as general an answer as possible, but in my use case, we have a Java desktop application, that will communicate with JSPs and servlets on Google App Engine, as well as Docker instances served on Google Container/Compute Engine (GCE/GKE). We have already implemented Firebase for authentication.
Our data scheme is simple, for now. No complex class, nothing inner, nested, or what not. The bulk of what we want to store are JSON objects, as flat in nature, as possible.
We're debating whether to store in Firebase as is (JSON), or to create a POJO server-side, to store in Objectify. We've done both, and we've researched the performance and scalability of these 2 services, as well as we can.
We deem both to be adequate for our needs, but expert opinion is always desirable, especially when considering long-term growth, inter-service convenience (e.g. GAE to GCE and back) and costs. Any other sort of input, is welcome too, of course.


text:
Q: reading tomcat7 configurations from rails app I want to read a couple of Tomcat characters like maxThreads, maxConnections etc so that I can expose them through one of the API endpoints. Tomcat will be hosting my app WAR file.

A: use JMX for that (Tomcat exposes its configuration as an MBean)
... there's MBean APIs in Java which you can script using JRuby.


text: Q: Clip all polygons inside the boundary of provinces to separate and calculate every inside polygons area I need to calculate area of polygons inside every province but some of polygons are not exactly inside of one province and part of it is in one province and the other part is in another province. How can I divide these such polygons with boundary of provinces to have two or more closed polygon in each related province to calculate all polygons area for every province.


text:
Q: Have different  tag value show up in a separate div when you click each separate section long time listener, first time caller. I am trying my hand at making an NHL draft chart, as I do some player evaluation and want a fancy looking place to put it all/I'm having a bit of fun while I learn SASS for the first time (it rocks, btw).
Codepen: https://codepen.io/trjwaugh/pen/abONgLm
$desktop: 1000px;
$padding: 15px;
$borders: 15px;
$margin: 20px;
$logo-clip: polygon(70% 0, 100% 0%, 75% 100%, 40% 100%);
$colors: ( ggold: #FFB81C, gold-light: lighten(#FFB81C, 40%), //buf, cbj, edm, fla, nsh
bblue: #002654, blue-light: lighten(#002654, 40%), ragsblue: #0038A8, ragsblue-light: lighten(#0038A8, 40%), leafblue: #00205B, leafblue-light: lighten(#00205B, 40%), rred: #C8102E, red-light: lighten(#C8102E, 40%), oorange: #F74902, orange-light: lighten(#F74902, 40%), starsgreen: #006847, starsgreen-light: lighten(#006847, 40%), yotesred: #8C2633, yotesred-light: lighten(#8C2633, 40%), burg: #6F263D, burg-light: ligthen(#6F263D, 40%), black: black);
@function color($color-name) {
  @return map-get($map: $colors, $key: $color-name);
}

@mixin desktop {
  @media (max-width: #{$desktop}) {
    @content;
  }
}

body,
html {
  height: 100%;
  font-family: 'Montserrat', sans-serif;
}

img {
  margin: 0;
  display: block;
  width: 78px;
  height: 80px;
  float: right;
}

body {
  margin: 0;
  #bg {
    clip-path: polygon(30% 0, 100% 0, 70% 100%, 0 100%);
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: -1;
    @include desktop {
      //suff to change re: responsiveness
    }
  }
}

main {
  #container {
    white-space: nowrap;
    text-align: center;
  }
  section#sticky-main {
    position: -webkit-sticky;
    /* Safari */
    position: sticky;
    top: 0;
    width: 100%;
    margin: 1em auto;
    padding: $padding;
    border-radius: $borders;
    background-size: 100% 100%, 0% 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, $alpha: 0.2);
  }
  section#card {
    margin: 1em auto;
    float: right;
    padding: $padding;
    border-radius: $borders;
    width: 100%;
    background-size: 100% 100%, 0% 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, $alpha: 0.2);
    -webkit-transition: .5s ease-in;
    -moz-transition: .5s ease-in;
    -o-transition: .5s ease-in;
    transition: .5s ease-in;
    ul {
      list-style-type: none;
      margin: 0;
      padding: 0;
      margin-bottom: 20px;
      li {
        strong {
          display: inline-block;
          margin-left: max(40px);
          margin-top: 10px;
        }
        img {
          display: block;
          width: 138px;
          height: 130px;
          float: right;
          @include desktop {
            //suff to change re: responsiveness
            width: 100px;
            height: 92px;
          }
        }
      }
    }
    #report.one {
      margin: 1em auto;
      float: right;
      padding: $padding;
      margin-right: 20px;
      border-radius: $borders;
      background-size: 100% 100%, 0% 100%;
      box-shadow: 0 10px 30px rgba(0, 0, 0, $alpha: 0.2);
      width: 90%;
      background-color: white !important;
      color: black !important;
    }
    #report.one:hover {
      display: block;
    }
  }
  section#card.gold:hover {
    background-color: color(ggold);
    color: white;
    background-size: 80.1% 10%, 20% 10%;
    box-shadow: 0 10px 30px rgba(100, 0, 0, $alpha: 0.2);
  }
  section#card.blue:hover {
    background-color: color(bblue);
    color: white;
    background-size: 80.1% 10%, 20% 10%;
    box-shadow: 0 10px 30px rgba(100, 0, 0, $alpha: 0.2);
  }
  section#card.red:hover {
    background-color: color(rred);
    color: white;
    background-size: 80.1% 10%, 20% 10%;
    box-shadow: 0 10px 30px rgba(100, 0, 0, $alpha: 0.2);
  }
}

<!doctype html>

  <link rel="stylesheet" href="css/main.css">

  <link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet">
  <title>Title</title>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

                Bigname McLongnamington III

                Kitchener Rangers (OHL)

                height weight

                Bigname McLongnamington III

                Kitchener Rangers (OHL)

                height weight

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer accumsan est massa, quis hendrerit augue volutpat sed. Nam sit amet bibendum enim, eget suscipit odio. Donec risus odio, bibendum eget ipsum eget, bibendum congue est. Sed
                maximus lorem sit amet nibh condimentum viverra. Vestibulum sed quam fringilla, rhoncus eros et, imperdiet tellus. In nec nibh sollicitudin, pharetra purus vitae, consectetur mi. Curabitur laoreet finibus placerat.

                Bigname McLongnamington III

                Kitchener Rangers (OHL)

                height weight

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer accumsan est massa, quis hendrerit augue volutpat sed. Nam sit amet bibendum enim, eget suscipit odio. Donec risus odio, bibendum eget ipsum eget, bibendum congue est. Sed
                maximus lorem sit amet nibh condimentum viverra. Vestibulum sed quam fringilla, rhoncus eros et, imperdiet tellus. In nec nibh sollicitudin, pharetra purus vitae, consectetur mi. Curabitur laoreet finibus placerat.

                Bigname McLongnamington III

                Kitchener Rangers (OHL)

                height weight

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer accumsan est massa, quis hendrerit augue volutpat sed. Nam sit amet bibendum enim, eget suscipit odio. Donec risus odio, bibendum eget ipsum eget, bibendum congue est. Sed
                maximus lorem sit amet nibh condimentum viverra. Vestibulum sed quam fringilla, rhoncus eros et, imperdiet tellus. In nec nibh sollicitudin, pharetra purus vitae, consectetur mi. Curabitur laoreet finibus placerat.

If you look at the Codepen, you can see i have a bunch of sections, all will act as a card that a players draft info will appear, minus a paragraph blurb about them. There are a few things ive tried in terms of accomplishing my goal but essentially I want to be able to click on a players <section onclick="showReport()" id="card"... and have that players paragraph blurb appear in the sticky div on the left, changing based on which section card you click on. right now I have the players paragraph in a p tag within the section just for now, but im open to anything. I have a JS function on click in there for now but what I have tried so far required me to write a seperate hide() for each section (will be 31 total). Im looking for a method that will also allow me to only change the bio info and never have to adjust any code when I want to make edits to my draft chart. I hope I explained myself well enough, please tell me if I need to clarify.
Any help would be highly appreciated!

A: First, add this to each onclick on sections to get the element itself anytime you click on them.
...

...

Then, you can use this (now turned into el variable) to find the text and put into the #content element.
function showReport(el) {
  $('#content').text($(el).find('p').text());
}


text:
Q: How to get id of a button in a form with two buttons both from type submit I'm working on a React application. I have a form with two submit buttons. One button to preview and another button to save. I'm trying to figur out how to call different function when buttons gets clicked to submit the form.
Form:
<form onSubmit={load}>

    <textarea name="labels"></textarea>

    <textarea name="notes"></textarea>

<div

        <Button variant="primary" id="test1" name="preview" type="submit">Preview</Button>

        <Button variant="buy" id="test2" name="save" type="submit">Update version</Button>

</form>

the load function in onSubmit:
loadCostumeTemplate = event => {
    event.preventDefault();
    // Just not working example
    if (event.target.id) functionX?
    if (event.target.id) function Y?
    // How to get the id of the clicked button?
}

Any solution for this?

A: Submitting is happening on the form level, so you can try using ref and assign proper value on button click like below:
import React, { useRef } from "react";
import ReactDOM from "react-dom";

function App() {
  const myForm = useRef();

  const loadCostumeTemplate = event => {
    event.preventDefault();
    // Just not working example
    console.log(myForm.current.buttonId);
    if (event.target.id) alert("hi");
    if (event.target.id) alert("Bye");
    // How to get the id of the clicked button?
  };

  return (
    <form onSubmit={loadCostumeTemplate} ref={myForm}>

        <textarea name="labels" />

        <textarea name="notes" />

          <button variant="primary" id="test1" name="preview"  type="submit" onClick={e => myForm.current.buttonId=e.target.id}>
            Preview
          </button>

          <button variant="buy" id="test2" name="save" type="submit"  onClick={e => myForm.current.buttonId=e.target.id}>
            Update version
          </button>

    </form>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);


text:
Q: 'which openssl' returns nothing when trying to upgrade OpenSSL I've been working the last day or so to get openssl upgraded on my machine. I've followed the answers here and here and now I've got some pretty funny results.
When I type which openssl I get no response.
When I type openssl version I get -bash: openssl: command not found
When I type brew install openssl I get Warning: openssl-1.0.1g already installed.
Why does brew recognize an installation, but my other terminal commands suggest that nothing is installed? What do I need to do to get my system to recognize the installation that brew is seeing, or what do I need to remove to allow me to do a fresh install of openssl?
Edit: 'brew doctor' gives me the following:

Warning: Your XQuartz (2.7.4) is outdated
  Please install XQuartz 2.7.5:
   https://xquartz.macosforge.org
Warning: Python is installed at /Library/Frameworks/Python.framework
Homebrew only supports building against the System-provided Python or a
  brewed Python. In particular, Pythons installed to /Library can interfere
  with other software installs.

A: This command should show you where any openssl binaries may be located on your system:
locate openssl | grep bin/openssl
For homebrew, make sure you have /usr/local/bin and /usr/local/sbin in your $PATH. You can check your current path setting by issuing echo $PATH.

A: It looks like openssl was installed in /usr/local/Cellar/openssl/1.0.1g/bin/openssl and needed to be symlinked to the desired location. The following command accomplished that for me:
ln -s /usr/local/Cellar/openssl/1.0.1g/bin/openssl /usr/local/bin
After that command was run, 'which openssl' returned "/usr/local/bin/openssl" and 'openssl version' returned "OpenSSL 1.0.1g 7 Apr 2014"


text:
Q: How to set variables to equal what the user inputs into a JDialog? So I'm trying to get input from the user from a JDialog, here is the code within the JDialog:
public void addPipeUI(){
     Integer[] grade = {1,2,3,4,5};
     Integer[] colour = {0, 1, 2};
     float length;
     int diameter;
     boolean chemResist, innerIns, outerRein;
     GridLayout gridLayout = new GridLayout(0,2);

     JDialog dialog = new JDialog();
     dialog.setSize(400, 400);
     dialog.setLocation(250, 250);
     dialog.setTitle("Add Pipe");
     dialog.setLayout(gridLayout);
     dialog.setVisible(true);

     dialog.add(new JLabel("Grade"));
     JComboBox gradeField = new JComboBox(grade);
     dialog.add(gradeField);

     dialog.add(new JLabel("Colour"));
     JComboBox colourField = new JComboBox(colour);
     dialog.add(colourField);

     dialog.add(new JLabel("Length (Meters)"));
     JTextField lengthField = new JTextField();
     dialog.add(lengthField);

     dialog.add(new JLabel("Diameter (Inches)"));
     JTextField diameterField = new JTextField();
     dialog.add(diameterField);

     JRadioButton innerInsField = new JRadioButton("Inner Insluation");
     dialog.add(innerInsField);

     JRadioButton outerReinField = new JRadioButton("Outer Reinforcement");
     dialog.add(outerReinField);

     JRadioButton chemResistField = new JRadioButton("Chemical Resistance");
     dialog.add(chemResistField);

     JButton ok = new JButton("OK");
     dialog.add(ok);

 }

At the top you can see what information I want the user to input.
When the OK button is pressed I want to make the local variables equal what the user has input and then return those variables to my Main class to be processed.
I feel like I need a actionlistener on the OK button but when I do that the local variables cant be used and now I'm just confused. How can I make the local variables equal what the user enters?

A: You need to add an action listener to your button so that you can catch the click event
ok.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
        String length = lengthField.getText();
        System.out.println("length=" + length);
    }
});

In order to access the local variable lengthField you need to make if final:
final JTextField lengthField = new JTextField();

This is because the action listener is an anonymous inner class. The JLS states

Any local variable, formal parameter, or exception parameter used but not declared in an inner class must be declared final.

Another alternative would be to make it an instance variable of your class.


text:
Q: I want to set as a callback (in App.js) for a child Button component I thought is would be straight forward but its a level above my current React experience so any help appreciated.
App is a function, WorldMap is a class and so is Button
  import WorldMap from "./WorldMap";
  import Button from "./Button";

  function App(data) {
  ...

  {/* filterMarkers is in class comp WorldMap */}
  <WorldMap width={dimensions.widthUsed} />

  {/* i thought WorldMap.filterMarkers would work here */}
  <Button
    label="Filter by:"
    value="Brazil"
    filterBy="team1"
    groupBy="team1"
    onClickFunction={() => WorldMap.filterMarkers}
  />
  ...
  }


text:
Q: LogicApps / Graph API - delete an email from a shared mailbox as per title.
Whilst dealing with my own mailbox is fine I wish to ideally process a shared mailbox in LogicApps. I can read the emails but I want to clean-up by deleting the messages.
Logic Apps doesn't seem to offer that action and unless mistaken the graph api doesnt either?
Has anyone managed this?

A: This has been possible since the update on 6th May 2020. A number of the actions now support an Original Mailbox Address optional parameter that you can set to access the shared mailbox:

As of May 6, 2020, shared mailbox support was added for certain operations with an optional 'Mailbox address' parameter, allowing you to specify a shared mailbox address for your operation to access.

The Delete Email (V2) action supports this parameter:

You then fill in the email address of your shared mailbox:

Which will then successfully find your message id and delete the email for you:

A: For this requirement, I write a logic app sample for your reference:
Before we start, provide the whole logic app:

1. In first "HTTP" action, I request for the access token.

2. Then I add a "Parse JSON" action to parse the response from the first "HTTP" action to get the access token.

The schema should be:
{
    "properties": {
        "access_token": {
            "type": "string"
        },
        "expires_in": {
            "type": "integer"
        },
        "ext_expires_in": {
            "type": "integer"
        },
        "token_type": {
            "type": "string"
        }
    },
    "type": "object"
}

3. In the second "HTTP" action, I request for all of the messages by the access token from above steps.

4. After that, we need to use another "Parse JSON" action to parse the response from "HTTP 2".

The schema should be:
{
    "properties": {
        "@@odata.context": {
            "type": "string"
        },
        "value": {
            "items": {
                "properties": {
                    "@@odata.etag": {
                        "type": "string"
                    },
                    "bccRecipients": {
                        "type": "array"
                    },
                    "body": {
                        "properties": {
                            "content": {
                                "type": "string"
                            },
                            "contentType": {
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "bodyPreview": {
                        "type": "string"
                    },
                    "categories": {
                        "type": "array"
                    },
                    "ccRecipients": {
                        "type": "array"
                    },
                    "changeKey": {
                        "type": "string"
                    },
                    "conversationId": {
                        "type": "string"
                    },
                    "conversationIndex": {
                        "type": "string"
                    },
                    "createdDateTime": {
                        "type": "string"
                    },
                    "flag": {
                        "properties": {
                            "flagStatus": {
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "from": {
                        "properties": {
                            "emailAddress": {
                                "properties": {
                                    "address": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "type": "object"
                    },
                    "hasAttachments": {
                        "type": "boolean"
                    },
                    "id": {
                        "type": "string"
                    },
                    "importance": {
                        "type": "string"
                    },
                    "inferenceClassification": {
                        "type": "string"
                    },
                    "internetMessageId": {
                        "type": "string"
                    },
                    "isDeliveryReceiptRequested": {
                        "type": "boolean"
                    },
                    "isDraft": {
                        "type": "boolean"
                    },
                    "isRead": {
                        "type": "boolean"
                    },
                    "isReadReceiptRequested": {
                        "type": "boolean"
                    },
                    "lastModifiedDateTime": {
                        "type": "string"
                    },
                    "parentFolderId": {
                        "type": "string"
                    },
                    "receivedDateTime": {
                        "type": "string"
                    },
                    "replyTo": {
                        "type": "array"
                    },
                    "sender": {
                        "properties": {
                            "emailAddress": {
                                "properties": {
                                    "address": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "type": "object"
                    },
                    "sentDateTime": {
                        "type": "string"
                    },
                    "subject": {
                        "type": "string"
                    },
                    "toRecipients": {
                        "items": {
                            "properties": {
                                "emailAddress": {
                                    "properties": {
                                        "address": {
                                            "type": "string"
                                        },
                                        "name": {
                                            "type": "string"
                                        }
                                    },
                                    "type": "object"
                                }
                            },
                            "required": [
                                "emailAddress"
                            ],
                            "type": "object"
                        },
                        "type": "array"
                    },
                    "webLink": {
                        "type": "string"
                    }
                },
                "required": [
                    "@@odata.etag",
                    "id",
                    "createdDateTime",
                    "lastModifiedDateTime",
                    "changeKey",
                    "categories",
                    "receivedDateTime",
                    "sentDateTime",
                    "hasAttachments",
                    "internetMessageId",
                    "subject",
                    "bodyPreview",
                    "importance",
                    "parentFolderId",
                    "conversationId",
                    "conversationIndex",
                    "isDeliveryReceiptRequested",
                    "isReadReceiptRequested",
                    "isRead",
                    "isDraft",
                    "webLink",
                    "inferenceClassification",
                    "body",
                    "sender",
                    "from",
                    "toRecipients",
                    "ccRecipients",
                    "bccRecipients",
                    "replyTo",
                    "flag"
                ],
                "type": "object"
            },
            "type": "array"
        }
    },
    "type": "object"
}

5. Then use a "For each" and loop the value from "Parse JSON 2".

6. In "For each", we need to add third "HTTP" action as below screenshot:

7. Run the logic app, it will delete all of the messages in shared mailbox.
By the way:
Before run the logic app, you need to search the client_id in your azure ad app registrations to find the application and add the Mail.ReadWrite permission to it. Also don't forget grant admin consent for it.


text:
Q: Java variable not assigned in JUnit Test Class I found something strange in my project. I create a test class using JUnit to test my service layer. The service layer itself is not my question. My problem is, I don't know why after I assigned a value to an int variable in my first test method, and then when I try to use that value in the second test method, the variable value is 0
Executed in order because I use @FixMethodOrder(MethodSorters.NAME_ASCENDING)
int id;

@Test
public void firstMethodToTest() {
    id = 10;
    System.out.println(id); // here printed correctly 10
}

@Test
public void secondMethodToTest() {
    System.out.println(id); // here printed 0
}

I also try to change int to Integer but it returns null not 0 anymore.
I wonder if in JUnit Test class like this, Java variable acts differently.
Thanks.

A: Thanks to @Ivan for giving me a clue to the answer
For each test method (the method annotated with @Test), a new instance of YourTestClass will be created. This is the behavior of Junit.
So, the point is if you want to use a class member for all test methods, just declare the variable as static. In my case: static int id;


text:
Q: Empty item in Owl Carousel I have problem with Owl carousel. I have 10 items in owl, in loop, and after 10th item, there's one extra blank item. How can I get rid of that blank item?
Here is my js code for owl:
<script type="text/javascript">
    $(document).ready(function() {
        $("#owl-example").owlCarousel({

            navigation : false, // Show next and prev buttons
            pagination : false,
            loop : true,
            autoplay : false,
            slideSpeed : 300,
            paginationSpeed : 400,
            items : 1
        });
    });
</script>

A: I had this same problem. After some research and trial, I found that removing all whitespace in my HTML solved the issue.

A: Check if css files are added
    <link rel="stylesheet" href="css/owl.carousel.min.css">
    <link rel="stylesheet" href="css/owl.theme.default.min.css">

A: I had try this one and solve my issues.
#ba.owl-theme .owl-dots .owl-dot:last-child {
  display: none;
}

A: Just set loop: false and it should solve it!
Also, if you need that to loop, add rewind: true to the carousel object.

A: I too had the same problem . I fixed it by changing the position of following script
$(document).ready(function() {
  var owl = $('#banner');
  owl.owlCarousel({
    items: 1,
    loop: true,
  });
});

Initially this script was inside of the main owl carousel div (the outer div with the classes .owl-carousel and .owl-theme) .
Now i moved it to out side of that div . Currently it executes after the above mentioned div.
It worked and the issue is solved

A: Check the empty item by inspect element. Probably it contains unexpected HTML. In my case, it was some other element from somewhere in the page, that end tag was missing matching start tag.


text:
Q: How to set ADC clock in low power mode? I am measuring the voltage with the STM32L011K4 MCU. When the processor goes into low power sleep mode, I start reading the wrong values from an ADC. I think the reason is caused by the system clock settings. Because in low power mode only the LSI clock is running and the ADC is working with the MSI clock. So when the system clock changes, the ADC starts reading meaningless values. How to set the ADC before and after low power mode?

A:
Because in low power mode only the LSI clock is running and the ADC is working with the MSI clock.

Actually, in low power mode the system runs on MSI, and the ADC runs by default on HSI16. You can however change the latter with the CKMODE[1:0] bits of the ADC_CFGR2 register. See 13.4.4 ADC clock (CKMODE, PRESC[3:0], LFMEN) in the Reference Manual.


text:
Q: How do I find first row of last group in SAS, where ordering matters? I'd like to ask help in this, as I am new to SAS, but a PROC SQL approach is usable as well.
My dataset has IDs, a time variable, and a flag. After I sort by id and time, I need to find the first flagged observation of the last flagged group/streak. As in:
ID TIME FLAG
1   2    1
1   3    1
1   4    1
1   5    0
1   6    1
1   7    0
1   8    1
1   9    1
1  10    1
2   2    0
2   3    1
2   4    1
2   5    1
2   6    1
2   7    1

Here I want my script to return the row where time is 8 for ID 1, as it is the first observation from the last "streak", or flagged group. For ID 2 it should be where time is 3.
Desired output:
ID TIME FLAG
1   8    1
2   3    1

I'm trying to wrap my head around using first. and last. here, but I suppose the problem here is that I view temporally displaced flagged groups/streaks as different groups, while SAS looks at them as they are only separated by flag, so a simple "take first. from last." is not sufficient.
I was also thinking of collapsing the flags to a string and using a regex lookahead, but I couldn't come up with either the method or the pattern.

A: I would just code a double DOW loop. The first will let you calculate the observation for this ID that you want to output and the second will read through the records again and output the selected observation.
You can use the NOTSORTED keyword on the BY statement to have SAS calculate the FIRST.FLAG variable.
data have;
  input ID TIME FLAG;
cards;
1   2    1
1   3    1
1   4    1
1   5    0
1   6    1
1   7    0
1   8    1
1   9    1
1  10    1
2   2    0
2   3    1
2   4    1
2   5    1
2   6    1
2   7    1
;

data want;
  do obs=1 by 1 until(last.id);
    set have;
    by id flag notsorted;
    if first.flag then want=obs;
  end;
  do obs=1 to obs;
    set have;
    if obs=want then output;
  end;
  drop obs want;
run;

A: Loop through the dataset by id. Use the lag function to look at the current and previous value of flag. If the current value is 1 and the previous value is 0, or it's the first observation for that ID, write the value of time to a retained variable. Only output the last observation for each id. The retained variable should contain the time of the first flagged observation of the last flagged group:
data result;
 set have;
 by id;
 retain firstflagged;
 prevflag = lag(flag);
 if first.id and flag = 1 then firstflagged = time;
 else if first.id and flag = 0 then firstflagged = .;
 else if flag = 1 and prevflag = 0 then firstflagged = time;
 if last.id then output;
 keep id firstflagged flag;
 rename firstflagged = time;
run;


text:
Q: How to merge multiple JSON arrays that are present in the same JSON file to single array I am getting the below-shown example from the python script that I ran. I would like to merge all the arrays to a single array as shown in the output needed below.
Example:
[
  {
    "key": "65",
    "type": "Rug"
  },
  {
    "key": "66",
    "type": "Rug"
  }
][
  {
    "key": "52",
    "type": "A"
  }
]

Needed Ouput:
[
  {
    "key": "65",
    "type": "Rug"
  },
  {
    "key": "66",
    "type": "Rug"
  },
  {
    "key": "52",
    "type": "A"
  }

]

A: Your problem description indicates you simply want to concatenate the arrays, which can easily be done using the "slurp" command-line option:
jq -s add

Efficiency
If efficiency is an issue, which it might be if the number of input arrays is very large, then you could take advantage of the stream-oriented nature of the input:
jq -n 'reduce inputs as $in ([]; .+$in)'


text:
Q: Excel vba - save as pdf and vba ftp upload - upload looks funny Hi I really can't get my head around this. I have a code in vba that saves the active sheet as pdf. This is working the pdf looks good! Then the code goes on, and it makes a script and then uploads the pdf to the server. The upload also works but, when I then open the file on the server 99% of the text is not there. I have tried uploading the file manually, that got created from the script and that works. So what is going on? How can the ftp script just remove 99% of the text from the pdf when it uploads it? I have also tried not to use active sheet and also set a timer, in case the files was not finished with getting created. but that is not the problem. It feels like the upload converts the pdf can this be true?
Hope somebody have a good answer.
UPDATE ! - code is now working
Here is the code I use:
 '''create pdf File
ThisWorkbook.Sheets("Course_rates_print1").Select

 ActiveSheet.ExportAsFixedFormat _
    Type:=xlTypePDF, _
    Filename:="E:\Kunder-i-brug\PSC\office-software\rates-now.pdf", _
    Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, _
    OpenAfterPublish:=False

Application.Wait (Now + TimeValue("00:00:20"))

 ''''''''write script.dat and upload.dat file
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("E:\Kunder-i-brug\PSC\office-software\script.dat", True)
a.writeline "username"
a.writeline "password"
a.writeline "Binary"
a.writeline "mput E:\Kunder-i-brug\PSC\office-software\rates-now.pdf" 'file to be uploaded
a.writeline "quit"
a.Close

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("E:\Kunder-i-brug\PSC\office-software\upload.bat", True)
a.writeline "ftp -i -s:E:\Kunder-i-brug\PSC\office-software\script.dat
ftp.server" 'the ftp site
a.Close

dRetVal = Shell("E:\Kunder-i-brug\PSC\office-software\upload.bat", 0)
'upload the file
 ''''''''''end upload.bat file

Application.ScreenUpdating = True


text:
Q: React Native iOS: Could not build module 'yoga': 'algorithm' file not found I'm trying to integrate React Native into an existing Swift iOS application using this integration guide: https://facebook.github.io/react-native/docs/integration-with-existing-apps.html. The version of React Native is 0.53.0.
I have successfully installed all the required pods and now trying to build the project, but always getting the following compile error:

The error log:
While building module 'yoga' imported from ...node_modules/react-native/React/Base/RCTConvert.h:19:
In file included from <module-includes>:1:
In file included from ...ios/Vandebron/Pods/Target Support Files/yoga/yoga-umbrella.h:15:
In file included from ...node_modules/react-native/ReactCommon/yoga/yoga/YGNode.h:13:
...node_modules/react-native/ReactCommon/yoga/yoga/Yoga-internal.h:11:10: fatal error: 'algorithm' file not found
#include <algorithm>
         ^~~~~~~~~~~
1 error generated.
In file included from ...node_modules/react-native/React/Views/RCTActivityIndicatorViewManager.m:10:
In file included from ...node_modules/react-native/React/Views/RCTActivityIndicatorViewManager.h:10:
In file included from ...node_modules/react-native/React/Views/RCTViewManager.h:13:
...node_modules/react-native/React/Base/RCTConvert.h:19:9: fatal error: could not build module 'yoga'
#import <yoga/Yoga.h

A: You can put the following snippet in your Podfile to fix this and some other known problems with React Native + Cocoapods. We tested it in our own project and it worked pretty well:
# When using RN in combination with Cocoapods, a lot of
# things are broken. These are the fixes we had to append
# to our Podfile when upgrading to ReactNative@0.55.4.
#
# WARNING: Check those line numbers when you're on a different version!

def change_lines_in_file(file_path, &change)
    print "Fixing #{file_path}...\n"

    contents = []

    file = File.open(file_path, 'r')
    file.each_line do | line |
        contents << line
    end
    file.close

    File.open(file_path, 'w') do |f|
        f.puts(change.call(contents))
    end
end

post_install do |installer|

    # https://github.com/facebook/yoga/issues/711#issuecomment-381098373
    change_lines_in_file('./Pods/Target Support Files/yoga/yoga-umbrella.h') do |lines|
        lines.reject do | line |
            [
            '#import "Utils.h"',
            '#import "YGLayout.h"',
            '#import "YGNode.h"',
            '#import "YGNodePrint.h"',
            '#import "YGStyle.h"',
            '#import "Yoga-internal.h"',
            ].include?(line.strip)
        end
    end

    # https://github.com/facebook/yoga/issues/711#issuecomment-374605785
    change_lines_in_file('../../node_modules/react-native/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h') do |lines|
        unless lines[27].include?("#ifdef __cplusplus")
            lines.insert(27, "#ifdef __cplusplus")
            lines.insert(34, "#endif")
        end
        lines
    end

    # https://github.com/facebook/react-native/issues/13198
    change_lines_in_file('../../node_modules/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h') do |lines|
        lines.map { |line| line.include?("#import <RCTAnimation/RCTValueAnimatedNode.h>") ? '#import "RCTValueAnimatedNode.h"' : line }
    end

    # https://github.com/facebook/react-native/issues/16039
    change_lines_in_file('../../node_modules/react-native/Libraries/WebSocket/RCTReconnectingWebSocket.m') do |lines|
        lines.map { |line| line.include?("#import <fishhook/fishhook.h>") ? '#import "fishhook.h"' : line }
    end
end

The source code is taken from this gist: https://gist.github.com/Jpunt/3fe75effd54a702034b75ff697e47578

A: This is a cocoapods problem. Try to expose only needed headers by edit the yoga.podspec file:node_modules/react-native/ReactCommon/yoga/yoga.podspec
add this line at the end of yoga.podspec:
spec.public_header_files = 'yoga/Yoga.h', 'yoga/YGEnums.h',
Look like this:
      source_files = 'yoga/**/*.{cpp,h}'
       source_files = File.join('ReactCommon/yoga', source_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION']
       spec.source_files = source_files    spec.source_files = source_files
+
+  # Only expose the needed headers
+  spec.public_header_files = 'yoga/Yoga.h', 'yoga/YGEnums.h', 'yoga/YGMacros.h'
+
end

Ref: https://github.com/facebook/react-native/issues/17893
The actual pull request: https://github.com/facebook/react-native/pull/17764 . Look at the comment by Plo4ox.

A: For react 59 or later you need to do this
It also fixes problem of downloading react 11
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'root' do
# Uncomment the next line if you're using Swift or would like to use dynamic
 frameworks
 # use_frameworks!
 # Pods for root
  pod 'React', :path => '../node_modules/react-native'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
end

post_install do |installer|
 installer.pods_project.targets.each do |target|
  if target.name == "React"
    target.remove_from_project
  end
 end
end


text:
Q: Parsley multistep form - validate on click next step I am trying to achieve a multistep form where the next step is only shown when the current is valid.
I am trying to trigger the validation script on click on the next button. My function looks like this:
function createNextButton($form, options) {
    return $('')
        .prop('href', '#')
        .addClass('application__btn application__btnNext')
        .html('>')
        .click(function(e) {
            e.preventDefault();
            var curIndex = $('.application--stateVisible').attr('data-tab');
            if ($('.applicationJS__validate').parsley().validate({group: 'block-' + curIndex})) {
                showNextTab($form, options);
            }

        });
}

My HTML Form looks like this:
<form data-parsley-validate="data-parsley-validate" enctype="multipart/form-data" name="field" class="application applicationJS__validate" action="/" method="post" novalidate="">
<fieldset data-tab="1" class="applicationJS__fieldset _9 1 _application--stateVisible" style="display: block;">
    <legend class="_legend _application__legend">Persönliche Daten</legend>

                <input data-parsley-required="true" data-parsley-required-message="Dieses Feld muss ausgefüllt werden!" data-parsley-trigger="change" placeholder="Straße/Hausnr.*" class="_input  " id="_field_1" type="text" name="tx__pi1[field][]" value="" data-parsley-group="block-1">

        >

</fieldset>
<fieldset data-tab="2" class="applicationJS__fieldset _11 2" style="display: none;">
    <legend class="_legend _application__legend">Organisatorisches</legend>

                <select data-parsley-required="true" data-parsley-required-message="Dieses Feld muss ausgefüllt werden!" data-parsley-trigger="change" class="_select  " id="_field_2" name="tx__pi1[field][]" data-parsley-group="block-2">
                    <option value="">Üben Sie eine Nebenbeschäftigung aus?</option>
                    <option value="Nein">Nein</option>
                    <option value="Ja">Ja</option>
                </select>

        <
        >

</fieldset>

I am including my js in the footer. The application.js includes the functions with the createNextButton():

Maybe somebody has a hint for me.

A: If you are using a single form for all of the steps, then what you need to do is create validation groups, one for each step, and validate the group you are currently on.

data-parsley-group: Assign a group to a field for specific group validation. eg: data-parsley-group="signup". This way, you could only validate a portion of a form and not all the fields. Can be multiple. eg: data-parsley-group='["foo", "bar"]'

http://parsleyjs.org/doc/index.html#usage-field


text:
Q: Limit (Stationary) distribution Suppose I have linear stochastic process
$$ x_{k+1} = a x_{k} + w_{k} \quad \text{with} \quad x_0 = x.$$
Here $0 < a < 1 $ and $\{w_{k}\}$ is a sequence of i.i.d. random variables.
I am wondering if there are results for the limit or stationary distribution
of the process, i.e., the probability distribution of $x_{\infty} = \lim_{k\to\infty}x_k$. Of course if one takes $w_k$ to be Gaussian, $x_{\infty}$ will be Gaussian too. But, I'm looking for something like uniform/beta/sub-exponential $w_{k}$ and preferably something that can be constructed explicitly.
Any direction would be appreciated.

A: Maybe, you can apply the CLT?
Assume $x_0=0$. Then we have $x_k=\sum_{i=1}^k \alpha^{i-1}w_i$.
If $Var(w_i)=\sigma^2 < \infty \, \forall i$, we have for $Y_i := \alpha^{i-1}w_k$:
$Var(Y_i)=\alpha^{2i-2}\sigma^2$.
If you could proof that the Lindeberg Condition
(https://en.wikipedia.org/wiki/Lindeberg%27s_condition) holds in this case, you could I apply the CLT and get the distribution of $x_k$ converges to a gaussian distribution.


text:
Q: How to get the slug and the params using Express as Nuxt serverMiddleware This is my setting
In the nuxt.config.js
serverMiddleware: ['~/server-middleware/index.js'],

server-middleware/index.js looks like this:
const express = require('express')
const buildRouter = require('../server/router.js')

const app = express()
app.use(express.json())
buildRouter(app)

module.exports = app

server/router.js
module.exports = function (app) {
  const buildApiRoute = require('./controllers/api')
  buildApiRoute(app, '/api')
}

server/controllers/api.js
module.exports = function (app, path) {
  const { body, validationResult } = require('express-validator')

  app.get(
    path,
    body('request2').trim()
      .not().isEmpty().withMessage('required')
      .escape(),
    async function (req, res) {
      res.setHeader('Content-Type', 'application/json')

      const errors = validationResult(req)

      console.log('====================================')
      console.log(req.query)

      if (!errors.isEmpty()) {
        return res.status(400).json({ errors: 'hola' })
      }

      try {

      } catch (e) {
        console.log('error', e)
      }
    }
  )
}

The issue i'm facing is that if I access
https://localhost:3000/api/posts?ipp=5&page=5
Its not entering in the middleware but if I enter to
https://localhost:3000/api/?ipp=5&page=5
It does enter and I get the params
How can I get it to "enter" to the middleware and know the slug and the params?
I tried in server/router.js
module.exports = function (app) {
  const buildApiRoute = require('./controllers/api')
  buildApiRoute(app, '/api/:slug')
}

but not won't enter with /api/users?ipp=5
Also, I don't know how to remove body('request2') without crashing, which I don't need


text:
Q: Why do memcpy() and other similar functions use assembly? I took a look at the parts of the code behind memcpy and other functions (memset, memmove, ...) and it seems to be a lot, and a lot of assembly code.
Other stackoverflow questions on this topic mention that a reason for that may be because it contains different code for different CPU architectures.
I have personally written my own memcpy/memset functions with very few lines of C++ code and in 1 million iterations with time measured with chrono, I consistently get better times.
So the question is, why did the programmers not just write the code in C/C++ and let the compiler interpret and optimize it how it thinks is best? Why so much assembly code?

A: It's technically impossible to write memcpy in standard C++ and C as you have to rely on undefined constructs. The same is true for other standard library functions; memset and malloc are two other examples.
But that's not only reason: A C and C++ standard library implementation is, these days, so closely coupled with a particular compiler that the library writers can take all sorts of liberties that you, as a consumer, cannot. isupper, toupper, &c. stand out as good examples where a particular character encoding can be assumed.
Another good reason is that expertly handcrafted assembly can be difficult to beat for performance.

A: This "It's pointless to rewrite in assembly" is a myth. A more accurate way to express it is that few programmers have the skill required to beat the compiler. But they do exist, and especially among those who develop compilers.

A: *

*Compiler usually generates some unnecessary code (compared to hand written assembly) even on full optimization level. This wastes memory space which is not good specially on embedded systems and reduces performance.

*Are you sure your custom codes are complete and flawless? I don't think so; because when you are writing assembly, you have full control on everything, but when you compile a code, there is a possibility that compiler generates something that you don't want (and it's your fault, not compiler).

*It's almost impossible for compiler to generate code which is as complete as hand written assembly and is smaller than it at the same time.

*As mentioned in some comments, it also depends on platform.

A: The memcpy and memset as well as other function, are written in assembly to take advantage of processor specific instructions.
For example, the ARM processor has a function that can load multiple registers from successive locations with one instruction.  There is also the store multiple instruction that stores multiple registers into successive locations.  The Intel x86 has block read and write instructions.
The assembly language allows for copying 4 8-bit bytes using a single 32-bit register.
Some processors allow for conditional execution of instructions, which helps when rolling out loops.
I've written optimized memcpy and memset functions for various processors.  I've also spent a lot of time arguing (discussing) C and C++ "best" implementations with compilers.  It's a little difficult using C or C++ to try and get the compiler to use the processor instructions you want it to.

A:
Why did the programmers not just write the code in C/C++

We aren't mind readers. We don't even know what they wrote. If you need an authoritative answer, then you should ask the programmers that wrote the code.
But we can hypothesise, that they wrote what they did because it was fast, and did the right thing.