text:
Q: Anaconda installed but can't launch Navigator in Window 10 I installed Anaconda on my Dell laptop. I am able to use anaconda promt but unable to launch anaconda-navigator.
I tried it launching via icon, command line. It shows anaconda icon with Initializing message on it and then disappears.
I tried launching it via command promt with admin privilege. It opened and then disappeared in a few seconds.
No error comes on screen.
I searched for different solutions on Github and stack overflow but nothing worked.
Check it in following images.
checking everything is up to date or not
launched anaconda
disappeared

A: you can reinstall anaconda on your machine because any file missing then happened and Anaconda prompt into you can try below command.
jupyter notebook


text:
Q: text fields are empty when retriving data from firebase to recycler view I am trying to build an android application which retrieve data from Firebase real time database. I have coded to display data from Firebase to a recyclerview in fragments. Project was successfully build but its not showing when i run the app, text fields are empty and some of them shows text values that i given for reference. I have looked in Firebase Adapter for any change in code and search over internet for solutions.

XML

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:backgroundTint="@color/txtcolor"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/recycler_design"
        android:layout_margin="10dp"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="3dp"
            android:orientation="horizontal">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/worker_name"
                android:textSize="16sp"
                android:text="Name:  "
                android:textColor="@color/black"/>

            <TextView
                android:id="@+id/debit_workerName"
                android:layout_width="225dp"
                android:layout_height="wrap_content"
                android:textColor="@color/black"
                android:textSize="16sp" />

            <TextView
                android:id="@+id/debit_date"
                android:layout_width="96dp"
                android:layout_height="wrap_content"
                android:textAlignment="textEnd"
                android:textColor="@color/black"
                android:textSize="14sp" />

        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/white"/>

        <LinearLayout
            android:layout_width="392dp"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <LinearLayout
                android:layout_width="180dp"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/billNumber"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Bill Number:  "
                    android:textColor="@color/black"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/debit_billNumber"
                    android:layout_width="94dp"
                    android:layout_height="match_parent"
                    android:textColor="@color/blue"
                    android:textSize="14sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="202dp"
                android:layout_height="match_parent"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/commi"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Comm:  "
                    android:textColor="@color/black"
                    android:textSize="18sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/Rs"
                    android:textColor="@color/black"
                    android:textSize="18sp" />

                <TextView
                    android:id="@+id/debit_commission"
                    android:layout_width="123dp"
                    android:layout_height="match_parent"
                    android:textColor="@color/selected_red"
                    android:textSize="18sp" />
            </LinearLayout>

        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/white"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:padding="3dp"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/billAmt"
                android:textSize="14sp"
                android:text="Bill Amount:  "
                android:textColor="@color/black"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="14sp"
                android:text="@string/Rs"
                android:textColor="@color/black"/>

            <TextView
                android:id="@+id/debit_billAmount"
                android:layout_width="280dp"
                android:layout_height="wrap_content"
                android:textColor="@color/greentxt"
                android:textSize="14sp" />

        </LinearLayout>
    </LinearLayout>

</RelativeLayout>

Model class

public class modelDebit {

    public String wName, bill_no,bill_amt,date,comm;

    public String getwName() {
        return wName;
    }

    public void setwName(String wName) {
        this.wName = wName;
    }

    public String getBill_no() {
        return bill_no;
    }

    public void setBill_no(String bill_no) {
        this.bill_no = bill_no;
    }

    public String getBill_amt() {
        return bill_amt;
    }

    public void setBill_amt(String bill_amt) {
        this.bill_amt = bill_amt;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getComm() {
        return comm;
    }

    public void setComm(String comm) {
        this.comm = comm;
    }

    public modelDebit(String wName, String bill_no, String bill_amt, String date, String comm) {
        this.wName = wName;
        this.bill_no = bill_no;
        this.bill_amt = bill_amt;
        this.date = date;
        this.comm = comm;
    }

    public modelDebit() {

    }
}

Logcat

 --------- beginning of system
2019-03-18 20:22:10.572 1600-2206/? I/ActivityManager: START u0 {cmp=......./.Transaction} from uid 10081
2019-03-18 20:22:10.578 5039-5070/V/FA: Recording user engagement, ms: 14804
2019-03-18 20:22:10.582 5039-5070/ V/FA: Connecting to remote service
2019-03-18 20:22:10.585 5039-5070/ V/FA: Activity paused, time: 1230916
2019-03-18 20:22:10.613 5039-5070/ D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=14804, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-657156986720031714}]
2019-03-18 20:22:10.654 5039-5070/ V/FA: Connection attempt already in progress
2019-03-18 20:22:10.654 5039-5039/ V/FA: onActivityCreated
2019-03-18 20:22:10.749 5039-5070/ D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=MainActivity, firebase_previous_id(_pi)=-657156986720031714, firebase_screen_class(_sc)=Transaction, firebase_screen_id(_si)=-657156986720031713}]
2019-03-18 20:22:10.793 1400-1453/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
2019-03-18 20:22:10.802 1400-1453/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
2019-03-18 20:22:10.805 5039-5070/ V/FA: Connection attempt already in progress
2019-03-18 20:22:10.807 5039-5070/ V/FA: Connection attempt already in progress
2019-03-18 20:22:10.807 5039-5070/ V/FA: Activity resumed, time: 1231049
2019-03-18 20:22:10.815 1400-1453/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
2019-03-18 20:22:10.849 5039-5077/ D/EGL_emulation: eglMakeCurrent: 0xa17055a0: ver 2 0 (tinfo 0xa1703510)
2019-03-18 20:22:10.872 1600-1621/? I/ActivityManager: Displayed /.Transaction: +294ms
2019-03-18 20:22:10.878 5039-5070/ D/FA: Connected to remote service
2019-03-18 20:22:10.879 5039-5077/ D/EGL_emulation: eglMakeCurrent: 0xa17055a0: ver 2 0 (tinfo 0xa1703510)
2019-03-18 20:22:10.882 5039-5070/ V/FA: Processing queued up service tasks: 4
2019-03-18 20:22:10.888 5039-5077/ D/EGL_emulation: eglMakeCurrent: 0xa17055a0: ver 2 0 (tinfo 0xa1703510)
2019-03-18 20:22:10.902 5039-5046/ I/zygote: Do full code cache collection, code=243KB, data=173KB
2019-03-18 20:22:10.903 5039-5046/I/zygote: After code cache collection, code=239KB, data=134KB
2019-03-18 20:22:10.918 2208-5079/? V/FA-SVC: Logging event: origin=auto,name=user_engagement(_e),params=Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=14804, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-657156986720031714}]
2019-03-18 20:22:10.936 2208-5079/? V/FA-SVC: Saving event, name, data size: user_engagement(_e), 68
2019-03-18 20:22:10.937 2208-5079/? V/FA-SVC: Event recorded: Event{appId='FA......', name='user_engagement(_e)', params=Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=14804, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-657156986720031714}]}
2019-03-18 20:22:10.938 2208-5079/? V/FA-SVC: Upload scheduled in approximately ms: 2445285
2019-03-18 20:22:10.938 2208-5079/? V/FA-SVC: Cancelling job. JobID: 812057698
2019-03-18 20:22:10.943 2208-5079/? V/FA-SVC: Scheduling upload with GcmTaskService
2019-03-18 20:22:10.943 2208-5079/? V/FA-SVC: Scheduling task with Gcm. time: 2445285
2019-03-18 20:22:10.950 2208-5079/? V/FA-SVC: Background event processing time, ms: 33
2019-03-18 20:22:10.961 2208-5079/? V/FA-SVC: Logging event: origin=auto,name=screen_view(_vs),params=Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=MainActivity, firebase_previous_id(_pi)=-657156986720031714, firebase_screen_class(_sc)=Transaction, firebase_screen_id(_si)=-657156986720031713}]
2019-03-18 20:22:10.967 2208-5079/? V/FA-SVC: Saving event, name, data size: screen_view(_vs), 96
2019-03-18 20:22:10.967 2208-5079/? V/FA-SVC: Event recorded: Event{appId='FA...', name='screen_view(_vs)', params=Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=MainActivity, firebase_previous_id(_pi)=-657156986720031714, firebase_screen_class(_sc)=Transaction, firebase_screen_id(_si)=-657156986720031713}]}
2019-03-18 20:22:10.968 2208-5079/? V/FA-SVC: Upload scheduled in approximately ms: 2445255
2019-03-18 20:22:10.970 2208-5079/? V/FA-SVC: Cancelling job. JobID: 812057698
2019-03-18 20:22:10.973 2208-5079/? V/FA-SVC: Scheduling upload with GcmTaskService
2019-03-18 20:22:10.973 2208-5079/? V/FA-SVC: Scheduling task with Gcm. time: 2445255
2019-03-18 20:22:10.975 2208-5079/? V/FA-SVC: Background event processing time, ms: 14
2019-03-18 20:22:11.169 5039-5039/ W/ClassMapper: No setter/field for time found on class .modelCredit
2019-03-18 20:22:11.169 5039-5039/ W/ClassMapper: No setter/field for Cname found on class .modelCredit
2019-03-18 20:22:11.204 5039-5039/ W/ClassMapper: No setter/field for time found on class FA.modelDebit
2019-03-18 20:22:11.204 5039-5039/ W/ClassMapper: No setter/field for Cname found on class .modelDebit
2019-03-18 20:22:11.207 5039-5046/ I/zygote: Do partial code cache collection, code=240KB, data=149KB
2019-03-18 20:22:11.208 5039-5046/ I/zygote: After code cache collection, code=240KB, data=149KB
2019-03-18 20:22:11.208 5039-5046/ I/zygote: Increasing code cache capacity to 1024KB
2019-03-18 20:22:11.227 5039-5039/ W/ClassMapper: No setter/field for time found on class FA.modelDebit
2019-03-18 20:22:11.227 5039-5039/ W/ClassMapper: No setter/field for Cname found on class FA.modelDebit
2019-03-18 20:22:11.251 5039-5039/ W/ClassMapper: No setter/field for time found on class ......modelDebit
2019-03-18 20:22:11.251 5039-5039/... W/ClassMapper: No setter/field for Cname found on class ........modelDebit
2019-03-18 20:22:11.271 5039-5039/..... W/ClassMapper: No setter/field for time found on class ........modelDebit
2019-03-18 20:22:11.271 5039-5039/....... W/ClassMapper: No setter/field for Cname found on class .......modelDebit
2019-03-18 20:22:11.288 5039-5039/....... W/ClassMapper: No setter/field for time found on class .........modelDebit
2019-03-18 20:22:11.288 5039-5039/....... W/ClassMapper: No setter/field for Cname found on class ..........modelDebit
2019-03-18 20:22:11.303 5039-5039/......... W/ClassMapper: No setter/field for time found on class ............modelDebit
2019-03-18 20:22:11.303 5039-5039/.......... W/ClassMapper: No setter/field for Cname found on class ............modelDebit
2019-03-18 20:22:11.316 5039-5039/.......... W/ClassMapper: No setter/field for time found on class ........modelDebit
2019-03-18 20:22:11.316 5039-5039/........ W/ClassMapper: No setter/field for Cname found on class ........modelDebit
2019-03-18 20:22:11.319 5039-5046/.......... I/zygote: JIT allocated 56KB for compiled code of void android.view.View.<init>(android.content.Context, android.util.AttributeSet, int, int)
2019-03-18 20:22:11.350 5039-5039/........... I/TextView Start: here it start adding values to text feild

Freagment Class

[import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.firebase.ui.database.FirebaseRecyclerOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

public class Debit extends Fragment {

    private View debitView;
    private RecyclerView debitRecyletList;
    private DatabaseReference debitRef;
    private FirebaseAuth firebaseAuth;

    public Debit() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        debitView= inflater.inflate(R.layout.fragment_debit, container, false);

        firebaseAuth=FirebaseAuth.getInstance();

        debitRecyletList = (RecyclerView) debitView.findViewById(R.id.debit_recyclerView);
        debitRecyletList.setHasFixedSize(true);
        debitRecyletList.setLayoutManager(new LinearLayoutManager(getContext()));
        debitRef = FirebaseDatabase.getInstance().getReference("debit");
        debitRef.keepSynced(true);

        return debitView;
    }

    @Override
    public void onStart() {
        super.onStart();

        FirebaseRecyclerOptions options1 = new FirebaseRecyclerOptions.Builder<modelDebit>()
                .setQuery(debitRef, modelDebit.class)
                .build();

        FirebaseRecyclerAdapter<modelDebit, debitViewHolder> adapter1 = new FirebaseRecyclerAdapter<modelDebit, debitViewHolder>(options1) {
            @Override
            protected void onBindViewHolder(@NonNull final debitViewHolder holder1, int position, @NonNull modelDebit model1) {

                debitRef.addValueEventListener(new ValueEventListener() {
                    @Override
                    public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                        if(dataSnapshot.exists()) {

                            String workerNmeDebit1 = dataSnapshot.child("wName").getKey().toString();
                            String billDateDebit1 = dataSnapshot.child("date").getKey().toString();
                            String billNoDebit1 = dataSnapshot.child("bill_no").getKey().toString();
                            String billAmntDebit1 = dataSnapshot.child("bill_amt").getKey().toString();
                            String workerComsnDebit1 = dataSnapshot.child("comm").getKey().toString();

                            Log.i("TextView Start","here it start adding values to text feild");

                            holder1.bill_amtD.setText(billAmntDebit1);
                            holder1.bill_NoD.setText(billNoDebit1);
                            holder1.dateD.setText(billDateDebit1);
                            holder1.nameD.setText(workerNmeDebit1);
                            holder1.commD.setText(workerComsnDebit1);

                        }
                        else {
                            Toast.makeText(getContext(), getString(R.string.error_msg), Toast.LENGTH_LONG).show();
                        }
                    }

                    @Override
                    public void onCancelled(@NonNull DatabaseError databaseError) {

                    }
                });

            }

            @NonNull
            @Override
            public debitViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup1, int i) {

                View view1 = LayoutInflater.from(viewGroup1.getContext()).inflate(R.layout.debitdesign, viewGroup1, false);
                debitViewHolder viewHolder1 = new debitViewHolder(view1);
                return viewHolder1;

            }
        };

        debitRecyletList.setAdapter(adapter1);
        adapter1.startListening();

    }

    public static class debitViewHolder extends RecyclerView.ViewHolder{

        TextView nameD, dateD, bill_amtD,  bill_NoD, commD;

        public debitViewHolder(@NonNull View itemView1) {
            super(itemView1);

            nameD = itemView1.findViewById(R.id.debit_workerName);
            dateD = itemView1.findViewById(R.id.debit_date);
            bill_amtD = itemView1.findViewById(R.id.debit_commission);
            bill_NoD = itemView1.findViewById(R.id.debit_billNumber);
            commD = itemView1.findViewById(R.id.debit_commission);

        }
    }
}

database view

A: From your database, you seem don't put the Cname, time, in the model class.
I already updated your model class.
public class modelDebit {

private String wName;
private String bill_no;
private String bill_amt;
private String date;
private String comm;
private String Cname;
private String time;

public modelDebit() {
}

public modelDebit(String wName, String bill_no, String bill_amt, String date, String comm, String cname, String time) {
    this.wName = wName;
    this.bill_no = bill_no;
    this.bill_amt = bill_amt;
    this.date = date;
    this.comm = comm;
    Cname = cname;
    this.time = time;
}

public String getwName() {
    return wName;
}

public void setwName(String wName) {
    this.wName = wName;
}

public String getBill_no() {
    return bill_no;
}

public void setBill_no(String bill_no) {
    this.bill_no = bill_no;
}

public String getBill_amt() {
    return bill_amt;
}

public void setBill_amt(String bill_amt) {
    this.bill_amt = bill_amt;
}

public String getDate() {
    return date;
}

public void setDate(String date) {
    this.date = date;
}

public String getComm() {
    return comm;
}

public void setComm(String comm) {
    this.comm = comm;
}

public String getCname() {
    return Cname;
}

public void setCname(String cname) {
    Cname = cname;
}

public String getTime() {
    return time;
}

public void setTime(String time) {
    this.time = time;
}
}

After that, change the your databaseReference from this:
 debitRef = FirebaseDatabase.getInstance().getReference("debit");

become this:
 debitRef = FirebaseDatabase.getInstance().getReference().child("debit");

Next, change the FirebaseRecyclerAdapter to this.
 FirebaseRecyclerAdapter<modelDebit, debitViewHolder> adapter1 = new FirebaseRecyclerAdapter<modelDebit, debitViewHolder>(options1) {
            @Override
            protected void onBindViewHolder(@NonNull final debitViewHolder holder1, int position, @NonNull modelDebit model1) {

            String workerNmeDebit1 = model1.getwName();
            String billDateDebit1 = model1.getDate();
            String billNoDebit1 = model1.getBill_no();
            String billAmntDebit1 = model1.getBill_amt();
            String workerComsnDebit1 = model1.getComm();

            holder1.bill_amtD.setText(billAmntDebit1);
            holder1.bill_NoD.setText(billNoDebit1);
            holder1.dateD.setText(billDateDebit1);
            holder1.nameD.setText(workerNmeDebit1);
            holder1.commD.setText(workerComsnDebit1);

        }
    }

redpajama_set_name: RedPajamaStackExchange


text:
Q: Bazel build with Jackson annotations for ser/Deser and generate Java classes So, we have been trying to xploring bazel as a build system for our organization, since we have a huge monorepo.
One of the problems I'm facing is, we have some code-gen classes which use Jackson's annotation processors to generate immutable copies of some file types.
Eg :
@JsonSerialze
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@Value.Immutable
@JsonDeserialize(as=ImmutableABC.class)
Public abstract class ABC {
...
}

So, for this , I include a java_plugin tag in bazel build file for this module as follows :
Java_plugin(
        name="abcgen",
        srcs=["src/.../ABC.java"],
        Deps=[ {jackson-deps go here}],
        processor_class = "org.immutables.processor.ProxyProcessor",
)

This always fails , saying cannot find the ImmutableABC.class file which is referenced in the annotation.
Any ideas? Am I missing the processor class for the Jackson annotations, and also is it possible to include multiple processor classes?

A: For anyone facing issues as such, ensure generates_api = 1 for your plugin, if the generated classes are used in the library, as for the jackson part, that wasn't really the problem


text:
Q: How to supply user arguments for a script invoked via Custom Ribbon from within Excel? I have a python script that needs to run on my linux server with some arguments:
e.g.
python testprogram.py --arg1=abc --arg2==xyz

I have a custom Ribbon implemented in my Excel file (on windows desktop client). How can I implement some kind of pop-up so that when I click on the ribbon, it launches the pop-up to allow the user to specify input arguments arg 1 & arg2 and then invoke the python script that can run remotely on the linux server? I need to accomplish this while leaving the excel workbook open, hence I am using the custom ribbon. Not sure if there is a better way to do this.
Any suggestions?
Thanks.

A: Set it up such that when you click on a button in the ribbon, a userform appears (google how to trigger a userform)(will need to trigger this userform with an event...like a button click). Then, on the userform, put a couple input boxes and a button. Add code for the userform such that on the button_click(), the program will collect the user input and call the python program w those arguments (google how to call python program from excel VBA)


text:
Q: Extract distinct row values from a sheet to another sheet based on max dates per unique rows I want to extract rows based on max date or max B per unique values of col A and col c. Doesn't matter if it is vba or excel formula. Help please.
Old Sheet

New Sheet
[2

A: You can find the solution / answer here : https://www.youtube.com/watch?v=qICltTRvEbE


text:
Q: How to automatically sort on article id? I'm trying to automatically sort with JQuery plugin TinySort ( http://tinysort.sjeiti.com/ ), but without success. I want to reverse the standard order: newest comments on top.
This is what I have:

          <time datetime="2014-05-19T15:46:31+02:00">19 May 2014 at 15:46</time>

First comment

          <time datetime="2014-05-20T15:48:57+02:00">20 May 2014 at 15:48</time>

Second comment

Then I use TinySort:
$('.gui-blog-commentlist > li').tsort('article', { order: 'desc', attr: 'id' });

What am I doing wrong?
Thanks for your help, it's my first question here.

A: I think, you need to use the forceStrings
$('.gui-blog-commentlist > li').tsort('article', {
    order: 'desc',
    attr: 'id',
    forceStrings: true
});

Demo: Fiddle


text:
Q: How to make the carriage for UILabel I need to make a view that will be changing a UILabel font-size (as on a picture below), for example when I touch right top corner and dragging to the top UILabel must changes it font-size.. please help me

A: I am not sure if I understand your question correctly. You can try setting the initial font size to a high value and myLabel.adjustsFontSizeToFitWidth = YES;. That way the font size will be automatically scaled down if the label is too small for the text the fit.

A: If what you need is a resizable UIView. You can take a look at SPUserResizableView for iOS
Then, I'm sure that handling the size of a UILabel is done by setting the adjustsFontSizeToFitWidth property to YES like Adrian said.

A: I am not sure exactly what you are wanting to do, but maybe this will get ya started:
Make sure you have a UILabel (I named mine myLabel) wired up correctly (User Interaction Enabled) must be checked) and then in the parent class:
In viewDidLoad:
UIPinchGestureRecognizer *recognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self
                                            action:@selector(twoFingerPinch:)];

[myLabel addGestureRecognizer:recognizer];

- (void)twoFingerPinch:(UIPinchGestureRecognizer *)recognizer {
    //  Modify this to suit your needs
    if (recognizer.scale > 1.5) {
        self.myLabel.font = [UIFont systemFontOfSize:recognizer.scale *10];
    } else {
        self.myLabel.font = [UIFont systemFontOfSize:14];
    }
}

There are several different gesture recognizers out there and maybe tapGestureRecognizer might suit you better.  This one will resize as the user pinches/zooms.


text:
Q: Is there a bash script to parse the output of smaps I need to parse the output of "proc/pid/smaps" on a linux system. Running a perl/python script on this system is not an option.
I was looking to see if there's a bash script to do the same.
Alternately, it would also be OK is there's a script (any script) which takes in output from /proc/pid/smaps in text format, and parses the information and dumps in human readable format :-)

A: A pretty high-level explanation of the content of /proc/pid/smaps is explained here: http://linux.die.net/man/5/proc.  Search for 'smaps'.
The Linux kernel source can also be consulted, though that'll probably be more confusing unless you're familiar with the kernel.
In response to your comment, each 'section' is a Virtual Memory mapping, which could be to parts of a file, such as the executable .text section, data area of a shared library, stack, etc.
Executable part of the loader:
b7f5d000-b7f77000 r-xp 00000000 08:05 2746096    /lib/ld-2.7.so
The processes' stack
bf84a000-bf85f000 rw-p bffeb000 00:00 0          [stack]


text:
Q: Mongoose allow empty array while each element is unique I have a problem with indexes, what I am trying to achieve is have every element in array to be unique and still allow that array to be empty. Currently if I have element inside array and try to remove it I get 11000 duplicate error and cannot remove it from array.
orders: [
      {
        ref: 'order',
        unique: true,
        type: mongoose.Schema.Types.ObjectId,
      },
    ],

I have read about partial and sparse indexes but I didn't had luck to find actual implementation. It is not clear to me how to set that up.
Thanks!


text:
Q: Duplicate dataset with millions of rows using pyspark I am trying to duplicate a dataset which has 30 rows to around 600 Million rows. I am currently using a for loop to iterate and perform union but it is taking a lot of time. Is there any better way to create duplicate rows in pyspark to this huge volume?
Thank you.


text:
Q: javascript regexp greediness and groups I have a string of the form
'some text1some text2some text3some text4some text5some text6'

I'm trying to turn it to:
line='some text1


text:
Q: FileHelper library - custom error messages I am use the FileHelper to parse CSV files. Error messages encountered when parsing the file are displayed to the end user. The end user may not be able to make sense of the technical error message. Not too many clerks know what an Int32 is or Class: UploadFooDto.
I would like to customize the error messages so they are more user friendly. Something like:

*

*Line 1. Column 2. A string (a) was entered instead of a number

*Line 2. Column 3. '13-14-15' is not a valid date

I cannot find anything in the API that would allow me to customize the error messages. The most I have so far are some extension methods to clean up the errors:
public static class FileHelperExceptionExtensions
{
    public static string BuildMessage(this ErrorInfo error)
    {
        if (error.ExceptionInfo is ConvertException)
        {
            return ((ConvertException)error.ExceptionInfo).BuildMessage();
        }

        if (error.ExceptionInfo is BadUsageException)
        {
            var message = error.ExceptionInfo.Message;
            var readTo = message.IndexOf("Class:");
            return message.Substring(0, readTo);
        }

        return string.Format("Line: {0}. An unspecific error occured.", error.LineNumber);
    }

    public static string BuildMessage(this ConvertException exception)
    {
        return string.Format("Line: {0}. Column: {1}. Field: {2}. Cannot convert '{3}' to type: '{4}'", exception.LineNumber, exception.ColumnNumber, exception.FieldName, exception.FieldStringValue, exception.FieldType.Name);
    }
}

but these extensions still leave a lot to be desired. Is it possible to customize the error messages?

A: It's hard to improve on your extension methods without it being more hassle than it's worth.
You cannot subclass the default converters (e.g., FileHelpers.ConvertHelpers.Int32Converter since they are internal and sealed). You could create your own custom converter for each type (and base it on the corresponding source code from FileHelpers, e.g., Int32Converter). Then you can raise an alternative to ConvertException (also sealed so you cannot subclass) which would format the message differently.


text:
Q: Unable to write to Google Sheets ((400) Bad Request) I'm attempting to write to a private Google Sheets document using the API and PowerShell web requests. I know I have handled the authentication correctly as I can read from a sheet just fine using the following code:
$read = Invoke-WebRequest -Uri "https://sheets.googleapis.com/v4/spreadsheets/$sheet/values/Sheet1!A1:B2?access_token=$($token.access_token)"

The issue arises when I attempt to write to that same sheet (after clearing all content from the cells):
$json = @"
{
  "range": "Sheet1!A1:D2",
  "majorDimension": "ROWS",
  "values": [
    ["Door", "15", "2", "3/15/2016"],
    ["Engine", "100", "1", "3/20/2016"]
  ]
}
"@

Invoke-WebRequest -Uri "https://sheets.googleapis.com/v4/spreadsheets/$sheet/values/Sheet1!A1:D2:append?valueInputOption=USER_ENTERED&access_token=$($token.access_token)" -Method Post -Body $json

I get:
Invoke-WebRequest : The remote server returned an error: (400) Bad Request.

What am I doing wrong?

A: Your Invoke-WebRequest is missing the ContentType parameter, which is necessary when your Method is set to a verb for sending data (such as Post).

The purpose of the Content-Type field is to describe the data contained in the body fully enough that the receiving user agent can pick an appropriate agent or mechanism to present the data to the user, or otherwise deal with the data in an appropriate manner.

The Content-Type Header Field

In your case, the parameter will be -ContentType "application/json". For example:
Invoke-WebRequest -Uri "https://sheets.googleapis.com/v4/spreadsheets/$sheet/values/Sheet1!A1:D2:append?valueInputOption=USER_ENTERED&access_token=$($token.access_token)" -Method Post -ContentType "application/json" -Body $json

Invoke-WebRequest ContentType Documentation


text:
Q: Hard drives with existing data to NAS my old d-link 2 failed (hard drives are ok, just the enclosure stopped powering up), so I upgraded to a later product, D-Link DNS-325.  But I am told it can't read existing drives, it will always erase the contents fist.
How can I make D-Link work with existing drives?


text:
Q: Computing capability of GTX 870M I was trying to run tensorflow-gpu on an ASUS laptop with a GTX 870M card on Ubuntu 16.40, but got an error message
018-10-07 16:54:50.537324: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1482] Ignoring visible gpu device (device: 0, name: GeForce GTX 870M, pci bus id: 0000:01:00.0, compute capability: 3.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
However, GTX 870M's computing capability is listed as 5.0 (Maxwell).  My questions are (1) what is GTX 870M's computing capability, and (2) Can I run tensorflow-gpu (latest or nightly) with GTX 870M?  Thanks, CC.

A: I have a Razer Blade 14 2014 with the same GPU on Windows and run on the same problems. Unfortunately the CUDA compute capability is listed as 3.0 for this GPU.
In the context on Linux you have an advantage, for computing capability of 3.0 you can build the code from source using the official instructions, they recommend docker when doing this: https://www.tensorflow.org/install/source
A post I found a post where the problem is solved can help as well.
Please let me know if you could make it work, I will try to install it using latest stable Ubuntu Mate 18.04.2 LTS.


text:
Q: Google Maps API: Travel time with current traffic I am wondering if anyone has a way, using the google APIs (I'm not picky on version) to find out the time of a route with current traffic. I know that the total time of travel with out traffic is available, but I only need that one number.

A: Purchase a business-license, and you'll be able to get these informations(when available) by setting the durationInTraffic -option of the directionsRequest to true.

A: You can use the googlemaps client API to get the driving duration in traffic using google directions API, . For python API, refer github page
Sample code
import googlemaps as gmaps
import datetime
import os

SRC = FROM_ADDRESS
DEST = TO_ADDRESS
CLIENT_KEY = os.getenv('GOOGLE_API_KEY')  # Set your directions api key as an env variable
gmaps_client = gmaps.Client(CLIENT_KEY)

now = datetime.datetime.now()
directions = gmaps_client.directions(SRC, DEST, mode="driving",departure_time=now)

# debug
# print(directions)

directions = directions[0].get('legs')[0].get('duration_in_traffic').get('text')
print(directions)


text:
Q: How to replace static "query" way of working by dynamic "queries"? In this other question, I asked how to handle the situation where a table might be defined or not. The proposed solution I'm trying to follow, is working with dynamic "queries" instead of static ones. Unfortunately I have no idea how to do this, can anybody help me with this? Let me give you an example:
Static way of working:
FIND Table1 WHERE Table1.field1          = 123
                AND Table1.field2        = Current-Table.field2
                AND UPPER(Table1.field3) = "Constant-string"
                AND Table1.field4        = temp-table.field4 NO-ERROR.
IF NOT AVAILABLE Table1
  THEN DO:
           CREATE Table1.
           ASSIGN Table1.field1 = 123
                  Table1.field2 = Current-Table.field2
                  Table1.field3 = "Constant-string"
                  Table1.field4 = temp-table.field4.
           RELEASE Table1.
       END.

Dynamic way of working:
CREATE BUFFER h-Table1 FOR TABLE "Table1" NO-ERROR.
IF VALID-HANDLE(h-Table1)
THEN DO:
         L-Found = h-Table1:FIND-FIRST("WHERE Table1.field1 = " + STRING(123) +
                                         "AND Table1.field2   = " + STRING(Current-Table.field2) +
                                         "AND UPPER(Table1.field3) = 'Constant-string'" +
                                         "AND Table1.field4 = " + temp-table.field4) NO-ERROR.
         IF NOT L-Found
         THEN DO:
                  h-Table1:BUFFER-CREATE("").
              END.
         ELSE MESSAGE "FOUND".
     END.

Is it BUFFER-CREATE or some other method, how should I fill in the parameters (like ASSIGN Table1.Field1 = 123), ...?

A: Use:
def var hb as handle no-undo.

create buffer hb for table "mytable".
hb:buffer-create().
assign
   hb::myfield = 123
   hb::another = "ok"
   .
hb:buffer-release()

finally:
   delete object hb no-error.
end finally.

Note that hb::myfield is shorthand for
hb:buffer-field('myfield'):buffer-value

And also beware that when using dynamic objects, you are responsible for garbage collection. If you create it, you need to delete it.
Dynamic find-unique part:
def var hb     as handle  no-undo.
def var lfound as logical no-undo.

create buffer hb for table 'Table1'.

lfound = hb:find-uniqe(
            'where field1 = 123'
            +  ' and field2 = ' + quoter( current-table.field2 ) )
            +  ' and upper( field3 ) = "constant-string"'
            +  ' and field4 = ' + quoter( temp-table.field4 )
         ) no-error.

or using a substitute:
lfound = hb:find-unique(
            substitute(
               'where field1 = &1':u
               +  ' and field2 = &2':u
               +  ' and upper( field3 ) = &3':u
               +  ' and field4 = &4':u,
               123,
               quoter( current-table.field2 ),
               quoter( 'constant-string' ),
               quoter( temp-table.field4 )
            )
         ) no-error.

You will soon want to create a query builder class / function to handle creating queries and possibly also handling run-time validation which you are now also responsible for.


text:
Q: Clarification on First Normal Form For the most part, I understand first, second, and third normal form. I would just like clarification on a few normalization examples I found on the net. The first example is as follows:
UNF
Supplier: supplier_id, supplier_name, prod_code, prod_desc, cost, markup, dept_cd

1NF:
Supplier:  supplier_id, supplier_name
supplier_product:  supplier_id, prod_code, prod_desc, cost, markup, dept_cd

2NF:
Supplier:  supplier_id, supplier_name
supplier_product:  supplier_id, prod_code
product:  prod_code, prod_desc, cost, markup, dept_cd

3NF:
Supplier:  supplier_id, supplier_name
Product:  prod_code, prod_desc, dept_cd (FK), supplier_id (FK), cost, markup
dept:  dept_cd, dept_name, aisle_no

Source: http://cs.mvnu.edu/twiki/bin/view/Main/Lab8DB2013
When moving from UNF to 1NF, are we simply moving the values that make up repeating groups to the new entity along with the primary key from the original entity? In the above example, products and departments are considered repeating groups. Thus, both are moved to the second entity.
This can also be demonstrated in the following example:
0NF
ORDER(order#, customer#, name, address, orderdate(product#, description, quantity, unitprice))
1NF
ORDER(order#, customer#, name, address, orderdate)
ORDER_LINE(order#, product#, description, quantity, unitprice)
2NF
ORDER(order#, customer#, name, address, orderdate)
ORDER_LINE(order#, product#, quantity)
PRODUCT(product#, description, unitprice)
3NF
ORDER(order#, customer#, orderdate)
CUSTOMER(customer#, name, address)
ORDER_LINE(order#, product#, quantity)
PRODUCT(product#, description, unitprice)

Source: http://www4.comp.polyu.edu.hk/~cstyng/data.98/tutorials/norm5.html
In this case, only products are considered to be a repeating group, not customers. Therefore, customer attributes are left in the original entity. Do I understand this correctly?
EDIT: An additional Example
A software contract and consultancy firm maintain details of all the various projects in which its employees are currently involved. These details comprise:  Normalize this data to Third Normal Form.
•   Employee Number
•   Employee Name
•   Date of Birth
•   Department Code
•   Department Name
•   Project Code
•   Project Description
•   Project Supervisor
 Assume the following and normalize this data into 3NF:
•   Each employee number is unique.
•   Each department has a single department code.
•   Each project has a single code and supervisor.
•   Each employee may work on one or more projects.
•   Employee names need not necessarily be unique.
•   Project Code, Project Description, and Project Supervisor are repeating fields.
UNF
Employee Number, Employee Name, Date of Birth, Department Code, Department Name, Project Code, Project Description, Project Supervisor
1NF
Employee Number, Employee Name, Date of Birth, Department Code, Department Name
Employee Number, Project Code,  Project Description, Project Supervisor

2NF
Employee Number, Employee Name, Date of Birth, Department Code, Department Name
Employee Number, Project Code,
Project Code, Project Description, Project Supervisor

3NF
EmployeeNumber,Employee Name, Date of Birth, *Department Code
Department Code, Department Name
Employee Number, Project Code
Project Code,  Project Description, Project Supervisor


text:
Q: HDFS replication and data distribution I have a Hadoop cluster with 4 DataNodes. I am confused between the two issues : data replication and data distribution.
Suppose that I have a 2 GB file and my replication factor is 2 & block size is 128 MB. When I put this file into hdfs, I see that 2 copies of each 128 MB blocks are created and they are placed in datanode3 and datanode4. But datanode2 & datanode1 are not used. The data is replicated because of the replication factor but I expect to see some data blocks in datanode1 and datanode2. Is something wrong?
Let's say that I have 20 DataNodes and replication factor is 2. If I put a file (2 GB) on HDFS, I again expect to see two copies of each 128 MB but also expect to see these 128 MB blocks are distributed between 20 DataNodes.

A: Ideally, the 2GB file should get distributed among all the available DataNodes.
File Size: 2GB = 2048MB
Block Size: 128MB
Replication Factor: 2

With above configuration you should have: 2048 / 128 * 2 blocks i.e. 32 blocks. And these blocks should get distributed almost equally between all DataNodes. Considering you have 4 DataNodes, each of them should have around 8 blocks.
The reason I could think of for not having above situation is if the DataNodes are down. Check if all the DataNodes are up: sudo -u hdfs hdfs dfsadmin -report


text:
Q: IntelliJ IDEA code inspection - external usages of - taking so long I run Analyze -> Inspect code. But it runs so long - for few hours. Most of the time (i think about 99%) progress bar says 'Processing external usages of xxx' where xxx stands for I guess, some getter/setters or fields. I would like to ask what this exactly do, what is a result of this long process, and how to disable this.

A: "Inspect Code" is static code analysis. It tries to detect some simple bugs and other issues in your code without running it. Basically, it need to go through all your source codes. If you have lots of codes, it may take a long time to finish this task. So select the inspection scope carefully. Please check the following link for details of Code Inspections & Fixes.
Code Inspections & Fixes
There are some inspection settings may cause idea print "Processing external usages of" message. The most common is "Unused declaration". If it is checked, idea is trying to search if any other class is using a declared symbol, such as, a class, a field or a method. It will prompt a warning if a symbol is not used at all. So it may take a long time if you have a large code base. Maybe you can uncheck it if it is useless for you.


text:
Q: Why is Git Bash not using the correct Java path as defined in the PATH environment variable? In an instance of Git Bash, typing in java -version gives me:
Error: could not open 'C:\Program Files (x86)\Java\jre7\lib\i386\jvm.cfg'
However, my actual Java path is in D:\Program Files\Java\jdk1.8.0_45\bin. This is shown in my %PATH% variable if I type in either echo $PATH or env | grep PATH.
Where is Git Bash getting this nonexistent Java path from?
P.S.
To add on to this, running java -version in the Command Prompt gives me the correct output:
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

A: Check if you have some old java.exe, javaw.exe, javaws.exe in the c:/windows/system32 folder, as mentioned in "Java path..Error of jvm.cfg".
I just checked with Git 2.6.3 on Windows, where I don't have anything in c:/windows/system32, and the result is consistent between:
git bash:
vonc@bigvonc MINGW64 /
$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

and CMD:
C:\prgs\git\PortableGit-2.6.3-64-bit>java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

Both report the same java at the same spot:
vonc@bigvonc MINGW64 /
$ which java
/c/prgs/jdk/jdk-7u51-windows-x64/bin/java

C:\prgs\git\PortableGit-2.6.3-64-bit>which java.exe
C:\prgs\jdk\jdk-7u51-windows-x64\bin\java.exe

Conclusion: upgrade to the latest git for windows.

A: If you are trying to manually set JDK, then please check if you haven't missed the Oracle Java (C:\ProgramData\Oracle\Java\javapath) in Path Environment Variable under System Variables, remove it and java -version should work just fine.

A: Check the PATH variable in your .bash_profile file to make sure it reflects the correct version of java. The file is usually in your home directory C:\Users\\{HOME}\\.bash_profile

A: It will happen when you have running an IDE with another set of JDK instances. The better way to resolve this is set you JDK home in path and make it available in last row. This is working for me.


text:
Q: How can I filter this array to eliminate duplicates of properties? I have an array of contacts. These contacts have an NSSet of Phone objects and each phone object has a phoneNumber string. I want to display all these contacts, but I don't want contacts with duplicate numbers to show up. The issue now is some contacts have duplicate numbers, but may also have an additional number. In other words, one user may have 555-555-5555 and another may have 555-555-5555 plus 666-666-6666. How can I add just the contact with the two numbers to the new contacts array? Is there a way to filter the array with NSPredicate or any other elegant way or do I have to just use a bunch of for loops?
I know I could just put the phone numbers into an NSSet, but I also want to be able to display the contact name, which is in the Contact object.
To put it more simply, I want to be able to filter out any subsets, or just take the largest set containing that phone.

A: You should be able to do something like this: https://stackoverflow.com/a/7491851/1009087.
Iterate over the array of all contacts, adding values to an NSMutableSet. If the value already exists in the set, remove it from your array of contacts.
You have to iterate over the whole list of contacts but each step is constant time. Just set your identifier to be the combination of properties that make each contact unique, name and phone number.


text:
Q: Can I run/emulate my Ionic app on my own device? Is it possible to emulate/run my ionic app on my own device (iOS) without using an Ionic view?
If so, how can I do it? Can I do it with android too?
I'm developing on windows btw.

A: First of all if you need develop for iOS then you need to do it in iMac. Read the link below:
http://ionicframework.com/docs/guide/testing.html
https://ionicframework.com/docs/v2/cli/emulate/


text:
Q: Es6 - sorting by boolean property and then in descending order I have an array of objects
 myArray= [{"FName":"",
            "LastName":"",
            "data" :[{
                      active:true,
                      times: 50
         },{
                      active: false,
                      times:450
         }

         ]}]

 myArray.map(x => x.data = x.data.sort((y,z) => y.times > z.times))

But how do I sort so that Initially I ihave the data whose active field is TRUE, and then sort by Times ?
Thank you.

A: The Array.sort()  compareFunction(a, b) function should return a number:

*

*Negative number - a should come before b.

*0 - a and b have the same priority.

*Positive number - b should come before a.

In your case the logic is find the order by active, and if both have the same active value, check the times. We can use simple subtraction, since booleans are treated as numbers (0 | 1):
z.active - y.active || z.times - y.times

Notes:

*

*Since you are using Array.map(), return clones of the objects, and arrays to prevent changes to the originals. If you want to change the original, use Array.forEach() instead. I clone the objects and arrays using the spread syntax.

*In sort, if two items have the same value (comparator result 0), the order is not guaranteed, and depends on the browser's implementation.

Example:

const myArray = [{"FName":"","LastName":"","data":[{"active":true,"times":50},{"active":false,"times":450},{"active":false,"times":50},{"active":true,"times":450}]}]

const result = myArray.map(x => ({
  ...x,
  data: [...x.data].sort((y,z) => z.active - y.active || z.times - y.times)
}))

console.log(result)

A: use a custom sorter
var sorter = function(a, b) {
   if (a.active || b.active) {
       return 1
   }
   return 0
}

var array = [{active: false, name: 'one'},
 {active: true, name: 'two'},
 {active: true, name: 'three'},
 {active: false, name: 'four'}]
array.sort(sorter).map((obj) => {console.log(obj)})

Works :D

A: You can first sort the data array on times. Then add one more sort function on data to sort by active flag;

myArray= [
  {
    "FName": "",
    "LastName": "",
    "data": [
      {
        "active": true,
        "times": 50
      },
      {
        "active": false,
        "times": 450
      },
      {
        "active": true,
        "times": 20
      },
      {
        "active": true,
        "times": 350
      },
      {
        "active": true,
        "times": 200
      },
      {
        "active": false,
        "times": 100
      }
    ]
  }
]

myArray.map(x => {
  x.data = x.data.sort((y,z) => y.times > z.times).sort((y,z) => y.active < z.active);
});

console.log(myArray)


text:
Q: MaterialUI: how to align button in x-axis end of the axis? I have a navbar component that looks like
<AppBar position="static" color="inherit">
<Toolbar className={classes.toolbar}>
  <IconButton edge="start" color="inherit" aria-label="menu" onClick={toggleDrawer(true)}>
    <MenuIcon />
  </IconButton>

  <Link href="#" color="primary" underline="none" variant="h5" className={classes.brand}>
    {brand}
  </Link>
  <Button variant="contained" color="secondary" className={classes.primaryAction}>{content['primary-action']}</Button>
</Toolbar>

However the <Button variant="contained> is placed before the Link, how can I place the button all the way to the end of the x axis?
This is the styles
const useStyles = makeStyles((theme: Theme) => ({
  toolbar: {
    minHeight: 200
  },
  brand: {
    lineHeight: 1,
    position: 'absolute',
    left: '50%',
    top: '50%',
    transform: 'translate(-50%, -50%)'
  },
  primaryAction: {
    justifySelf: 'end'
  },
  iconWrapper: {
    minWidth: 40,
  },

}));

A: Try to apply flexGrow: 1 on the link and align it right:
<AppBar position="static" color="inherit">
<Toolbar className={classes.toolbar}>
  <IconButton edge="start" color="inherit" aria-label="menu" onClick={toggleDrawer(true)}>
    <MenuIcon />
  </IconButton>

  <Link href="#" color="primary" underline="none" variant="h5" sx={{ flexGrow: 1, textAlign: 'right' }}>
    {brand}
  </Link>
  <Button variant="contained" color="secondary" className={classes.primaryAction}>{content['primary-action']}</Button>
</Toolbar>

A: Try using CSS flex to place the buttons and link inside the toolbar.
Here's a working CodeSandbox. (Note that if you want the Link to come after the Button, just move the component below the Button in the code as per the comment I left).
Here's the JSX:
<AppBar position="static" color="inherit">
      <Toolbar className={classes.toolbar}>
        <IconButton
          edge="start"
          color="inherit"
          aria-label="menu"
          onClick={toggleDrawer(true)}
        >
          <MenuIcon />
        </IconButton>

        <div className={classes.verticalCenter}>
          {/* Just move this link to come after the Button below to change the order */}
          <Link
            href="#"
            color="primary"
            underline="none"
            variant="h5"
            className={classes.brand}
          >
            {brand}
          </Link>

          <Button
            variant="contained"
            color="secondary"
            className={classes.primaryAction}
          >
            {content["primary-action"]}
          </Button>
        </div>
      </Toolbar>
    </AppBar>

And the CSS:
const useStyles = makeStyles((theme) => ({
  toolbar: {
    minHeight: 200,
    display: "flex",
    justifyContent: "space-between"
  },
  brand: {
    lineHeight: 1,
    padding: 16
  },
  primaryAction: {
    justifySelf: "flex-end"
  },
  iconWrapper: {
    minWidth: 40
  },
  verticalCenter: {
    display: "flex",
    alignItems: "center"
  }
}));


text:
Q: Copy everything from one schema to another in Oracle, but only the first n rows I want to recreate the complete structure of multiple very large schemas (size in GB/TB) in another schema, but when filling the tables I only want the first n rows.
Right now I am using the following statement to copy the tables but this works only if there are no foreign key constraints.
create table DEV_OWN.mytable as select * from TEST_OWN.mytable where rownum < 10

I want to make a script that loops through all tables and copies the first n rows or maybe more or less if it is dependent on a foreign key, and also the indexes, views, packages, stored procedures and preferrably everything else so that the resulting schema is a replica of the originial but with only a limited number or records.
Since I have to run this script often I would like it to be as optimal as possible.

A: As @Aleksej has suggested, you can export the schema and then import it again
Alternatively, you can use Execute immediate to do this.
you can access the system views, such as
ALL_TABLES, all_indexes, all_triggers.
This will allow you to build dynamic sql instructions that you can execute with execute immediate command, but this way is more complicated the to Export and Import the hole schema.
Here is a simple example for creating and filling the table
declare
  v_new_schema varchar2(100) := 'DEV_OWN';
begin
  for rec in (select * from all_tables)
  loop
    execute immediate ('create table '||v_new_schema||'.'|| rec.table_name ||' as select * from '||rec.owner||'.'|| rec.table_name ||' where rownum < 10');
  end loop;
end;
/

In this example, only the tables without contraint, triggers, or anything else belonging to it are created.
If you need it all, then it's actually easier to dump a Schema.

A: I think best solution for your case is make an expdp with a where clause and then make an impdp.


text:
Q: Poker game winning conditions only executing first if statement I am making a basic poker game with my own type of winning conditions but my if statements for the function keeps only outputting the first condition even if the condition hasn't been met. Also sorry about the mess of a function, but I have tried everything and nothing works so tidiness is the last thing on my mind.
#include <string>
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <bits/stdc++.h>
using namespace std;

/*  Functions
                */

//Create Deck, Shuffle and print shuffled deck Function
void shuffle(string suits[4], string ranks[13], int deck[52])
{
    //Initialise seed with starting value for random generator
    srand(time(0));

    //Loop to create new unique deck
    for(int i=0;i<52;i++)
    {
        deck[i] = i;
    }

    //This loop will swap each index i with a random index
    for(int j=0;j<52;j++)
    {
        int k = rand() % 52; //Initialse and declare variable equals to random number generator
        int temp = deck[j]; //Initialise a temporary variable to be replaced by random index

        deck[j] = deck[k];
        deck[k] = temp;
    }

    //Determines what suits go with what ranks in the 52 shuffled deck
    cout << "Shuffling cards in deck..." << endl;
    for(int q=0;q<52;q++)
    {
        int s = deck[q]/13; //Determines suit by dividing number by 13 as there is 13 cards in each suit
        int r = deck[q]%13; //Type of card is determined with number by modulus 13
        //cout << ranks[r] << " " << suits[s] << endl; /*This displays the whole shuffled deck*/
    }
}

//Function for drawing 5 cards from shuffled deck for player and computer
void draw(string userName, int deck[52], string suits[4], string ranks[13])
{
    //Initialise array variables for player and computer
    //Players cards
    int suit1[5];
    int rank1[5];

    //Computers Cards
    int suit2[5];
    int rank2[5];

    cout << userName << "'s Cards" << endl;
    cout << "-------------------------------" << endl;

    //Loops for drawing players 5 cards from shuffled cards in deck
    for(int i=0;i<5;i++)
    {
        suit1[i] = deck[i] / 13;
        rank1[i] = deck[i] % 13;
    }

    for(int j=0;j<5;j++)
    {
        cout << ranks[rank1[j]] << " " << suits[suit1[j]] << endl;
    }

    cout << "-------------------------------" << endl;
    cout << "Computer's Cards" << endl;
    cout << "-------------------------------" << endl;
    //Loops for drawing computers 5 cards from shuffled cards in deck
    for(int k=5;k<10;k++)
    {
        suit2[k] = deck[k] / 13;
        rank2[k] = deck[k] % 13;
    }

    for(int z=5;z<10;z++)
    {
        cout << ranks[rank2[z]] << " " << suits[suit2[z]] << endl;
    }
    cout << "-------------------------------" << endl;
}

int winner(string userName, int rank1[5], int rank2[5], int score1, int score2, string ranks[13], int deck[52])
{
    for(int k=0;k<5;k++)
    {
        if((ranks[rank1[k]].compare(ranks[0])))
        {
            cout << userName << " got 2 points for having rank 2 in their cards!" << endl;
            score1 += 2;
            return score1;
        }
        if((ranks[rank1[k]].compare(ranks[1])))
        {
            cout << userName << " got 3 points for having rank 3 in their cards!" << endl;
            score1 += 3;
            return score1;
        }
        if((ranks[rank1[k]].compare(ranks[2])))
        {
            cout << userName << " got 4 points for having rank 4 in their cards!" << endl;
            score1 += 4;
            return score1;
        }
        if((ranks[rank1[k]].compare(ranks[3])))
        {
            cout << userName << " got 5 points for having rank 5 in their cards!" << endl;
            score1 += 5;
            return score1;
        }
        if((ranks[rank1[k]].compare(ranks[4])))
        {
            cout << userName << " got 6 points for having rank 6 in their cards!" << endl;
            score1 += 6;
            return score1;
        }
        if((ranks[rank1[k]].compare(ranks[5])))
        {
            cout << userName << " got 7 points for having rank 7 in their cards!" << endl;
            score1 += 7;
            return score1;
        }
        if((ranks[rank1[k]].compare(ranks[6])))
        {
            cout << userName << " got 8 points for having rank 8 in their cards!" << endl;
            score1 += 8;
            return score1;
        }
        if((ranks[rank1[k]].compare(ranks[7])))
        {
            cout << userName << " got 9 points for having rank 9 in their cards!" << endl;
            score1 += 9;
            return score1;
        }
        if((ranks[rank1[k]].compare(ranks[8])))
        {
            cout << userName << " got 10 points for having rank 10 in their cards!" << endl;
            score1 += 10;
            return score1;
        }
        if((ranks[rank1[k]].compare(ranks[9])))
        {
            cout << userName << " got 11 points for having a Jack in their cards!" << endl;
            score1 += 11;
            return score1;
        }
        if((ranks[rank1[k]].compare(ranks[10])))
        {
            cout << userName << " got 12 points for having an Ace in their cards!" << endl;
            score1 += 12;
            return score1;
        }
        if((ranks[rank1[k]].compare(ranks[11])))
        {
            cout << userName << " got 13 points for having a King in their cards!" << endl;
            score1 += 13;
            return score1;
        }
        if((ranks[rank1[k]].compare(ranks[12])))
        {
            cout << userName << " got 14 points for having a Queen in their cards!" << endl;
            score1 += 14;
            return score1;
        }
    }

    cout << "" << endl;

    for(int i=0;i<5;i++)
    {
        if((ranks[rank2[i]].compare(ranks[0])))
        {
            cout << "The dealer got 2 points for having rank 2 in their cards!" << endl;
            score1 += 2;
            return score2;
        }
        if((ranks[rank2[i]].compare(ranks[1])))
        {
            cout << "The dealer got 3 points for having rank 3 in their cards!" << endl;
            score1 += 3;
            return score2;
        }
        if((ranks[rank2[i]].compare(ranks[2])))
        {
            cout << "The dealer got 4 points for having rank 4 in their cards!" << endl;
            score1 += 4;
            return score2;
        }
        if((ranks[rank2[i]].compare(ranks[3])))
        {
            cout << "The dealer got 5 points for having rank 5 in their cards!" << endl;
            score1 += 5;
            return score2;
        }
        if((ranks[rank2[i]].compare(ranks[4])))
        {
            cout << "The dealer got 6 points for having rank 6 in their cards!" << endl;
            score1 += 6;
            return score2;
        }
        if((ranks[rank2[i]].compare(ranks[5])))
        {
            cout << "The dealer got 7 points for having rank 7 in their cards!" << endl;
            score1 += 7;
            return score2;
        }
        if((ranks[rank2[i]].compare(ranks[6])))
        {
            cout << "The dealer got 8 points for having rank 8 in their cards!" << endl;
            score1 += 8;
            return score2;
        }
        if((ranks[rank2[i]].compare(ranks[7])))
        {
            cout << "The dealer got 9 points for having rank 9 in their cards!" << endl;
            score1 += 9;
            return score2;
        }
        if((ranks[rank2[i]].compare(ranks[8])))
        {
            cout << "The dealer got 10 points for having rank 10 in their cards!" << endl;
            score1 += 10;
            return score2;
        }
        if((ranks[rank2[i]].compare(ranks[9])))
        {
            cout << "The dealer got 11 points for having a Jack in their cards!" << endl;
            score1 += 11;
            return score2;
        }
        if((ranks[rank2[i]].compare(ranks[10])))
        {
            cout << "The dealer got 12 points for having an Ace in their cards!" << endl;
            score1 += 12;
            return score2;
        }
        if((ranks[rank2[i]].compare(ranks[11])))
        {
            cout << "The dealer got 13 points for having a King in their cards!" << endl;
            score1 += 13;
            return score2;
        }
        if((ranks[rank2[i]].compare(ranks[12])))
        {
            cout << "The dealer got 14 points for having a Queen in their cards!" << endl;
            score1 += 14;
            return score2;
        }
    }
}

//Associated Variables
string userName;
int deck[52];
string suits[4] = {"Clubs", "Hearts", "Diamonds", "Spades"};
string ranks[13] = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Ace", "King", "Queen"};
int rank1[5];
int suit1[5];
int rank2[5];
int suit2[5];
int score1;
int score2;

I also tried if(ranks[rank1[i]] == "2") and if(rank1[i] == 2) but both had the same error as the method above where it would only execute the first if statement even when the condition has not been met.


text:
Q: Variance of a List of Arrays Suppose x is a list of arrays.
a <- array(1,c(2,3,4));
b <- array(2,c(2,3,4));
c <- array(3,c(2,3,4));

x <- list(a=a,b=b,c=c)

My desired output is the following array:
   array(var(c(1,2,3)),c(2,3,4))

This is quietly same as the following page, but change the sum to the variance.
Ref: Sum a list of arrays

Edit for comments of @akrun
Thank you @akrun.
His answer is the following;
    apply(
     array(unlist(x),append( dim(x[[1]]), length(x) )  ),
     1:length(dim(x[[1]])),
     var
)

where x is the following list of arrays:
a <- array(1,c(2,3,4));
b <- array(2,c(2,3,4));
c <- array(3,c(2,3,4));
d <- array(4,c(2,3,4));
x <- list(a=a,b=b,c=c,d=d)

A: One option would be to unlist the list, create an array and use apply to get the variance
apply(array(unlist(x), c(2, 3, 4, 3)), 1:3, var)


text:
Q: Reset Windows Updates There is a neat guide on resetting updates here: https://support.microsoft.com/en-us/help/971058/how-do-i-reset-windows-update-components
I have tried to create a script to automate this process, but now when checking for updates, no updates are found. Checking for updates completes (does not get stuck), but only 2 optional updates are found.
What am I missing?
@echo off
CHOICE /C Y /M "Press Y and Enter to reset Windows Updates or close this command prompt."
pause
@echo on
net stop bits
net stop wuauserv
net stop appidsvc
net stop cryptsvc
del "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
Ren %systemroot%\system32\catroot2 catroot2.bak
sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
cd /d %windir%\system32
@echo off
regsvr32.exe /s atl.dll
regsvr32.exe /s urlmon.dll
regsvr32.exe /s mshtml.dll
regsvr32.exe /s shdocvw.dll
regsvr32.exe /s browseui.dll
regsvr32.exe /s jscript.dll
regsvr32.exe /s vbscript.dll
regsvr32.exe /s scrrun.dll
regsvr32.exe /s msxml.dll
regsvr32.exe /s msxml3.dll
regsvr32.exe /s msxml6.dll
regsvr32.exe /s actxprxy.dll
regsvr32.exe /s softpub.dll
regsvr32.exe /s wintrust.dll
regsvr32.exe /s dssenh.dll
regsvr32.exe /s rsaenh.dll
regsvr32.exe /s gpkcsp.dll
regsvr32.exe /s sccbase.dll
regsvr32.exe /s slbcsp.dll
regsvr32.exe /s cryptdlg.dll
regsvr32.exe /s oleaut32.dll
regsvr32.exe /s ole32.dll
regsvr32.exe /s shell32.dll
regsvr32.exe /s initpki.dll
regsvr32.exe /s wuapi.dll
regsvr32.exe /s wuaueng.dll
regsvr32.exe /s wuaueng1.dll
regsvr32.exe /s wucltui.dll
regsvr32.exe /s wups.dll
regsvr32.exe /s wups2.dll
regsvr32.exe /s wuweb.dll
regsvr32.exe /s qmgr.dll
regsvr32.exe /s qmgrprxy.dll
regsvr32.exe /s wucltux.dll
regsvr32.exe /s muweb.dll
regsvr32.exe /s wuwebv.dll
@echo on
netsh winsock reset
net start bits
net start wuauserv
net start appidsvc
net start cryptsvc
@echo off
CHOICE /C Y /M "Press Y and Enter to restart your computer or close the command prompt (require manual restart)."
pause
shutdown.exe /r /t 00

A: I don't believe you are missing anything. It looks like you did everything the website says to. It is possible that your computer only has 2 optional updates available and that is why it could be saying that. I would check the control panel to see if there are more available. If there isn't than you did it right. To check that you would go to (Control Panel > All Control Panel Items > Windows Update) than click on Check for updates.


text:
Q: Return any matching text from another column I'm trying to ask to Excel to return any text from one column that matches the text from another column (not just a "yes" or "no").
For example: Cell A1 contains "Dog" Cell B1 contains "Dog Bird Cat" I would like Excel to give me the words from B1 that match A1 (Dog) in cell C1 and the words from B1 that do not match A1 (Bird Cat) in cell D1.
I have a lot of rows-- so I need a formula that can return the actual words that match/do not match and can be applied to many rows at once.
Thanks so much!

A: Please try:
in C1: =IFERROR(IF(SEARCH(A1,B1)>0,A1),"")
in D1: =IFERROR(TRIM(IF(SEARCH(A1,B1)>0,SUBSTITUTE(B1,A1,""),"")),"")
copied down to suit.


text:
Q: Scroll view with an embedded stack view programmatically failing I want to get the following structure programmatically (and am currently failing...):

*

*View

*

*Scroll View

*

*Vertical Stack View

I was able to get what I wanted in Interface Builder, but cannot seem to figure out how to achieve this in code. In IB, it looks like this (please click on the picture to see it fully):

The settings of the stack view look like this:

Now, this is my attempt to mirror that in code:
import UIKit

class ScrollViewController: UIViewController {

    lazy var scrollView: UIScrollView = {
        let s = UIScrollView()
        s.contentMode = .scaleToFill
        s.backgroundColor = .gray
        s.accessibilityIdentifier = "scroll_view"
        s.translatesAutoresizingMaskIntoConstraints = false
        return s
    }()

    lazy var stackView: UIStackView = {
        let s = UIStackView()
        s.axis = .vertical
        s.alignment = .fill
        s.distribution = .equalSpacing
        s.spacing = 10
        s.contentMode = .scaleToFill
        s.accessibilityIdentifier = "stack_view"
        return s
    }()

    // See helper method at bottom
    lazy var textField1 = self.createTextField(placeholder: "Textfield 1")
    lazy var textField2 = self.createTextField(placeholder: "Textfield 2")
    lazy var textField3 = self.createTextField(placeholder: "Textfield 3")
    lazy var textField4 = self.createTextField(placeholder: "Textfield 4")
    lazy var textField5 = self.createTextField(placeholder: "Textfield 5")
    lazy var textField6 = self.createTextField(placeholder: "Textfield 6")

    override func loadView() {
        view = UIView()
        view.backgroundColor = .white

        view.addSubview(scrollView)
        scrollView.addSubview(stackView)

        stackView.addArrangedSubview(textField1)
        stackView.addArrangedSubview(textField2)
        stackView.addArrangedSubview(textField3)
        stackView.addArrangedSubview(textField4)
        stackView.addArrangedSubview(textField5)
        stackView.addArrangedSubview(textField6)

        NSLayoutConstraint.activate([
            scrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 20),
            scrollView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 20),
            scrollView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -20),
            scrollView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -20),

            stackView.widthAnchor.constraint(equalTo: scrollView.contentLayoutGuide.widthAnchor),
            stackView.trailingAnchor.constraint(equalTo: scrollView.contentLayoutGuide.trailingAnchor),
            stackView.topAnchor.constraint(equalTo: scrollView.contentLayoutGuide.topAnchor),
            stackView.leadingAnchor.constraint(equalTo: scrollView.contentLayoutGuide.leadingAnchor),
            stackView.bottomAnchor.constraint(equalTo: scrollView.contentLayoutGuide.bottomAnchor)
        ])
    }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        scrollView.contentSize = stackView.frame.size
    }

    func createTextField(placeholder: String) -> UITextField {
        let t = UITextField()
        t.translatesAutoresizingMaskIntoConstraints = false
        t.borderStyle = .roundedRect
        t.clearButtonMode = .whileEditing
        t.text = placeholder
        t.placeholder = placeholder
        t.accessibilityIdentifier = placeholder
        return t
    }
}

I am quite obviously missing something, but even after spending several hours of trying and googling, I still haven't found a solution...
What I do realize is that all the text fields' and the stack view's frames are (0, 0, 0, 0), so quite obviously, I am missing some constraints, right?

A: for stackView, you are not defining stackView.translatesAutoresizingMaskIntoConstraints = false


text:
Q: CSS not applying to body tag I have the most basic PHP code with just these 13 lines:
<!DOCTYPE html>
<html>
<head>
    <link href="design/faq.css" media="display" rel="stylesheet" type="text/css" />
    <script src="js/jquery.main.js" type="text/javascript"></script>
</head>
<body>
<?php
    print_r( $_GET );
    echo "hey";
?>
</body>
</html>

When I am opening this page as: faq.php?code=sth; The PHP code is getting executed correctly, but the CSS is not working at all(in any browser). Since I primarily use Opera, here are screenshots:

*

*Parsed Page

*Code

*The faq.css

What I tried

*

*My first instinct was to check if the faq.css was accessible or not. Yes, the file has write property as 0644 same as all other files.

*Then I checked if the path was not getting parsed correctly, but that is not the case either, as I later tried it with full path too.
Trouble
I am completely stumped at such a behavior from the least troublesome of languages as CSS. What could be the problem here? The CSS file contains only these 4 lines.
body {
    background-color: #DC2826;
    margin-top: 0px;
}

A: You're using media="display". This is not a valid type for the media attribute.
See this link for valid types of devices (all, aural, braille, handheld, projection, print, screen, tty, tv).


text:
Q: Diagram for homotopy I need to construct with tikZ a diagram like here https://en.wikipedia.org/wiki/Homotopy_category_of_chain_complexes. I tried a lot of time but it doesn't work.

A: \documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}[row sep=1.5cm,column sep=1.5cm]
\cdots \arrow[r,"d_A^{n-2}"] & A^{n-1}\arrow[dl,"h^{n-1}" description]
\arrow[r,"d_A^{n-1}"] \arrow[d,"~f^{n-1}",xshift=-1mm] \arrow[d,swap,"g^{n-1}~",xshift=1mm]
& A^{n} \arrow[dl,"h^{n}" description,swap]
\arrow[r,"d_A^{n}"] \arrow[d,"~f^{n}",xshift=-1mm] \arrow[d,swap,"g^{n}~",xshift=1mm]
& A^{n+1} \arrow[dl,"h^{n+1}" description,swap]
\arrow[r,"d_A^{n+1}"] \arrow[d,"~f^{n+1}",xshift=-1mm] \arrow[d,swap,"g^{n-1}~",xshift=1mm]
& \arrow[dl,"h^{n+2}" description,swap]\cdots\\
\cdots \arrow[r,"d_A^{n-2}"] &  B^{n-1}\arrow[r,"d_B^{n-1}"] & B^{n}
\arrow[r,"d_B^{n}"] & B^{n+1}
\arrow[r,"d_B^{n+1}"] & \cdots
\\
\end{tikzcd}\]
\end{document}

A: for exercise (i still learn tikz-cd) and fun:

*

*based on marmot answer with (very) small changes

*defined is style for diagonal arrows (DAS) for shorter code

*used ' for swap function: for example \arrow[d,"g^{n-1}" ', instead of \arrow[d,"g^{n-1}",swap,

*displacement of down arrows is interchanged in comparison to marmot answer

*tried to prettify code in editor

\documentclass[12pt,margin=3mm]{standalone}
\usepackage{tikz-cd}

\begin{document}
\[
    \begin{tikzcd}[
   row sep = 1.5cm,
column sep = 1.5cm,
 DAS/.style = {% Diagonal Arrow with Sloped labels
              dl, swap, sloped, pos=0.3}
                    ]
\cdots \arrow[r,"d_A^{n-2}"]
    & A^{n-1}\arrow["h^{n-1}",DAS]
             \arrow[r,"d_A^{n-1}"]
                \arrow[d,"g^{n-1}" ',xshift=-1mm]
                \arrow[d,"f^{n-1}",xshift=1mm]
        & A^{n} \arrow["h^{n}",DAS]
                \arrow[r,"d_A^{n}"]
                    \arrow[d,"g^{n}" ',xshift=-1mm]
                    \arrow[d,"f^{n}",xshift=1mm]
            & A^{n+1}   \arrow[dl,"h^{n+1}",DAS]
                        \arrow[r,"d_A^{n+1}"]
                            \arrow[d,"g^{n-1}" ',xshift=-1mm]
                            \arrow[d,"f^{n+1}",xshift=1mm]
                & \arrow["h^{n+2}",DAS]\cdots    \\
\cdots \arrow[r,"d_A^{n-2}"]
    &  B^{n-1}  \arrow[r,"d_B^{n-1}"]
        & B^{n} \arrow[r,"d_B^{n}"]
            & B^{n+1} \arrow[r,"d_B^{n+1}"]
                & \cdots
\end{tikzcd}
\]
\end{document}


text:
Q: Time invariance of diffusion Let us assume that we have a diffusion problem in 1D that can be modelled with Brownian Motion. The diffusion is coefficient $D$, and the particle is starting at $x=0$.
Then, the probability that we find the particle at $x=x_1$ at time $t$ is
$$
f{(x_1, t)}=\frac{1}{(4\pi Dt)^{1/2}}\exp\left(-\frac{x_1^2}{4Dt}\right).
$$
If the particle is at $x_1$ at $t_1$, the probability that it will be at $x_2>x_1$ at $t$ becomes
$$
f{(x_2-x_1, t)}=\frac{1}{(4\pi D(t-t_1))^{1/2}}\exp\left(-\frac{(x_2-x_1)^2}{4D(t-t_1)}\right).
$$
So, I assume that $f(x_1,t)\ast f(x_2-x_1,t)=f(x_2,t)$, because

*

*It can't reach $x_2$ before it reaches $x_1$

*The time it takes for the particle to reach $x_2$ from $x_1$ is only dependent of $x_2-x_1$, not individual $x_1$ and $x_2$.

*Probability that it reaches $x_2$ at time $t$ if it is at $x_1$ at $t_1$ is independent of $t_1$ and only dependent of $t-t_1$.

Thus, it carries all of the hallmarks of a time invariant system. It would also be linear if we initially have $N$ particles and look for concentration rather than probability.
But in a simulation environment, I cannot verify $f(x_1,t)\ast f(x_2-x_1,t)=f(x_2,t)$.
My approach is to find a time discretised $f_{\Delta{t}}=f(i\Delta{t})\Delta{t}$ and then convolve the appropriate $f_{\Delta{t}}$s. Either I make a horrendous mistake during discretisation or I am miserably wrong about the possible LTI properties of diffusion.
So, which one is it? Can I assume diffusion to be a linear time invariant system and use convolution? Or do I not approach it correctly?
The python code I use is attached.
import numpy as np

def diffusion_function_1D(D,t,x):
    return (4*np.pi*D*t)**(-.5)*np.exp(-x**2/(4*D*t))

def linear_dif_con(t,x1,x2,D,length):
    res=t/length
    t_array=np.linspace(res/2,t-res/2,length) #choosing sample points at the midpoints of bins
    dt=t_array[1]-t_array[0]
    c1_array=np.asarray(list(map(lambda t1: diffusion_function_1D(D,t1,x1)*dt,t_array))) #from 0 to x_1
    c2_array=np.asarray(list(map(lambda t1: diffusion_function_1D(D,t1,x2-x1)*dt,t_array))) #from x_1 to x_2
    c3_array=np.asarray(list(map(lambda t1: diffusion_function_1D(D,t1,x2)*dt,t_array))) #directly from 0 to x_2
    cf=diffusion_function_1D(D,t,x2)*dt
    cn=np.convolve(c1_array,c2_array)[:length]
    #Taking convolution by hand, in case np.convolve acts weird
    tot=0
    for i in range(len(c1_array)):
        tot+=c1_array[i]*c2_array[len(c1_array)-i-1]
    print(tot,c3_array[-1], cn[-1]) #correct convolution, different value

t=3
x1=1
x2=3
D=1
linear_dif_con(t,x1,x2,D,10000)

A: The equation you're thinking of is called the Chapman-Kolmogorov equation for a Markov process, but I think it is slightly different from what you said (although your notation is slightly ambiguous really).
The equation (not in full generality) says
$$f_{X_t \mid X_0}(x_2 \mid 0)=\int f_{X_t \mid X_s}(x_2 \mid x_1) f_{X_s \mid X_0}(x_1 \mid 0) dx_1.$$
In the case of a time and space homogeneous process like Brownian motion, you can replace $X_t \mid X_s$ by $X_{t-s} \mid X_0$ and $x \mid y$ by $x-y \mid 0$, which gives
$$f_{X_t \mid X_0}(x_2 \mid 0)=\int f_{X_{t-s} \mid X_0}(x_2-x_1 \mid 0) f_{X_s \mid X_0}(x_1 \mid 0) dx_1.$$
This gives the convolution structure that you seem to have expected, as this can be rewritten as $\left ( f_{X_s \mid X_0}(\cdot \mid 0) * f_{X_{t-s} \mid X_0}(\cdot \mid 0 \right )(x_2)$.


text:
Q: Generate an edge list from a pandas dataframe Suppose I have a pandas dataframe like this:
    Fruit_1   Fruit_2  Fruit_3
0   Apple     Orange   Peach
1   Apple     Lemon    Lime
2   Starfruit Apple    Orange

Reproducible form:
df = pd.DataFrame([['Apple', 'Orange', 'Peach'],
                   ['Apple', 'Lemon', 'Lime'],
                   ['Starfruit', 'Apple', 'Orange']],
                  columns=['Fruit_1', 'Fruit_2', 'Fruit_3'])

I want to generate an edge list, which consists of:
Apple, Orange
Apple, Peach
Orange, Peach
Apple, Lemon
Apple, Lime
Lemon, Lime
Starfruit, Apple
Starfruit, Orange
Apple, Orange

How do I do it in Python?

A: I don't know pandas but you could use itertools.combinations on the rows
itertools.combinations(row, 2)

this creates an iterator which you can simply convert to a list of pairs.
Joining these lists after collecting them into a list can be done using a flat list comprehension
[pair for row in collected_rows for pair in row]

Or use the typically much faster numpy way
data[:, np.c_[np.tril_indices(data.shape[1], -1)]]

If you want a flat list
data[:, np.c_[np.triu_indices(data.shape[1], 1)]].reshape(-1,2)

Note that triu_indices lists the vertices in order while tril_indices lists them the other way round. They are normally used to get the indices of the upper or lower triangle of a matrix.

A: Here is a Pandas solution:
In [118]: from itertools import combinations

In [119]: df.apply(lambda x: list(combinations(x, 2)), 1).stack().reset_index(level=[0,1], drop=True).apply(', '.join)
Out[119]:
0        Apple, Orange
1         Apple, Peach
2        Orange, Peach
3         Apple, Lemon
4          Apple, Lime
5          Lemon, Lime
6     Starfruit, Apple
7    Starfruit, Orange
8        Apple, Orange
dtype: object

A: I might be a little late for this post,but recently I had the necessity to do exactly what you are asking. I managed to avoid the usage of itertools with something of this kind. If this is your DataFrame:
df = pd.DataFrame([['Apple', 'Orange', 'Peach'],
               ['Apple', 'Lemon', 'Lime'],
               ['Starfruit', 'Apple', 'Orange']],
              columns=['Fruit_1', 'Fruit_2', 'Fruit_3'])

you simply call a function:
>>> edgelist = get_edgelist(df)

      ID1        ID2
0   Apple     Orange
1   Apple      Peach
2  Orange      Peach
3   Apple      Lemon
4   Apple       Lime
5   Lemon       Lime
6   Apple     Orange
7   Apple  Starfruit
8  Orange  Starfruit

defined as:
def fast_combinations(row : list, self_loops = False) -> np.array:

try:

        if self_loops:

            comb = np.unique(np.sort(np.array(np.meshgrid(row, row)).T.reshape(-1,2)), axis=0)

        else:

            comb = np.unique(np.sort(np.array(np.meshgrid(row, row)).T.reshape(-1,2)), axis=0)
            comb = np.delete(comb, np.where(comb[:,0] == comb[:,1]), axis=0)

        return comb

    except:

        return [[None, None]]

def get_edgelist(df, **kwargs):

    cols = df.columns
    df['combined'] = df[df.columns].values.tolist()

    # Clear space
    df.drop(cols, axis=1, inplace=True)

    arrays = []

    for row in range(len(df.index)):

        arrays.append(fast_combinations(df.loc[row, 'combined'], kwargs))

    return pd.DataFrame(np.concatenate( arrays, axis=0 ), columns=['ID1', 'ID2']).replace('nan', None).dropna().reset_index(drop=True)

I removed the descriptions from the functions to make it easier to read, but you can find them here https://gist.github.com/Stefano314/607db3ffc53d680d60de61d09ca39a08.
I used this on a 2.5 milion rows dataframe, from which I got 45 milions associations, and it took me ~48 minutes on an i7-3770.


text:
Q: Swift cache base64 string UIImage data I'm trying to cache UIImage that images come from service(I'm using Alamofire). Service sends me a base64 string and I'm converting base64 to data then print in tableviewcell with
cell.imageview.image = UIImage(data: imageDatas[indexPath.row])

I searched lots of libraries like Kingfisher , AlamofireImage but they are caching URL image can't find anyway to cache image with base64 string.So I find a similar example and try this :
  private let cache = NSCache<NSNumber, UIImage>()
  private let utilityQueue = DispatchQueue.global(qos: .utility)

   private func loadImage(data : Data , completion: @escaping (UIImage?) -> ()) {
       utilityQueue.async {

           let image = imageDataDecodingClass.imageDataDecoding(imageData: data)

           DispatchQueue.main.async {
               completion(image)
           }
       }
   }

in cell :
       let itemNumber = indexPath.section * 2 + 1
       let imageData =  (showcaseDatas[indexPath.section * 2 + 1].Document?.Document!)!
       if let cachedImage = self.cache.object(forKey: NSNumber(value: itemNumber)) {
           cell.showcaseImage.image = cachedImage
      } else {
          cell.addSubview(progressHUDimage)
          self.loadImage(data: imageData, completion: {ret in
              cell.showcaseImage.image = ret
              self.cache.setObject(cell.showcaseImage.image!, forKey: NSNumber(value: itemNumber))
              progressHUDimage.removeFromSuperview()
          })
    }

Its caching image perfectly but when I scroll tableview ,CPU increased a lot (%70-90) thats why tableview is not smoothing.
So , my question is , How can I cache base64 string image in tableviewcell with smoothing and without CPU increased ? Thanks

A: If you are caching base64 String or Data there will be always a hit in decoding them as an image. The only way it would be caching the UIImage itself, but this will come with trade off of memory depending on the size of your images.
I can only give you few advices:

*

*Use NSCache (it seems that you are already using it)

*Resize your images on another thread to have a perfect fit on the size that  you are rendering on screen and cache them only after they have been resized

*Be sure that the performance hit you are seeing is not due to other reasons

*Cache images by using their index path if you are using for cells

*Create your NSCache with a memory limit and a number of element limit

You can also try to create 2 caches, one for ready to go already decode images and the other one as a fallback with Data object.
The fact that your Data objects are small it doesn't means that also images are, it really depends on the compression that has been used to save the image representation.
There are also more advance technique using memory mapping on physical memory.


text:
Q: What is wrong here? Component with ternary inside     export const Date = ({ startDate, endDate, displayInUserTime }) => {
    const parsedStartDate = moment.utc(startDate).format("ll");
    const parsedEndDate = moment.utc(endDate).format("ll");
    const parsedLocalStartDate = moment(startDate).format("ll");
    const parsedLocalEndDate = moment(endDate).format("ll");

    return (
        <Content column className="col-1">
            {displayInUserTime ?
            (
{parsedStartDate}

            {parsedStartDate !== parsedEndDate &&
{parsedEndDate}
})
            :
            (
{parsedLocalStartDate}

            {parsedLocalStartDate !== parsedLocalEndDate &&
{parsedLocalEndDate}
})}
        </Content>
    );
};

Error:
Parsing error: Unexpected token, expected ","
33 |          {displayInUserTime ?
  34 |          ({parsedStartDate}

35 |          {parsedStartDate !== parsedEndDate && {parsedEndDate}})
       |          ^
    36 |          :
    37 |          ({parsedLocalStartDate}
    38 |          {parsedLocalStartDate !== parsedLocalEndDate && {parsedLocalEndDate}})}

A: You are returning multiple elements in the {} simplified code looks like bool?<one/><two/>:<three/><four/> the other answer changes the code to if statements but you could wrap your ternary in a React.Fragment: bool?<><one/><two/></>:<><three/><four/></>
Your code could be:
<Content column className="col-1">
  {displayInUserTime ? (
    <>

{parsedStartDate}

      {parsedStartDate !== parsedEndDate && (

{parsedEndDate}

      )}
    </>
  ) : (
    <>

{parsedLocalStartDate}

      {parsedLocalStartDate !== parsedLocalEndDate && (

{parsedLocalEndDate}

      )}
    </>
  )}
</Content>

A: Instead of making mind games with ternary operator how about you use if else statement
  let startDate = null;

  if(displayInUserTime) {
    startDate = <>

{parsedStartDate}

      {parsedStartDate !== parsedEndDate &&
{parsedEndDate}
}
    </>;
  }else {
    startDate = <>

{parsedLocalStartDate}

      {parsedLocalStartDate !== parsedLocalEndDate &&
{parsedLocalEndDate}
}
    </>
  }

  return (
        <Content column className="col-1">
            {startDate}
        </Content>
    );


text:
Q: react hook useffect how to trigger only when json data change? I am working on React hook and when i set dependency on useEffect it trigger all time,but it should trigger only when there will be some changes in Json API, Here is my code so far i did.How to make it that its trigger only when new changes will be in API.
Thanks
const [data, setData] = useState([]);
  useEffect(() => {
    const getdata = () => {
      fetch(config.auth.notification_list, config.head)
        .then((response) => response.json())
        .then((data) => {
          setData(data);
        });
    };

    getdata();
  }, [data]);

A: As you want to "trigger only when ... changes ...", you need to set data only if these changes happen.
Here you need to implement dataHasChanged( data ) according to your needs (you didn't specify what "API change" means exactly).
const [ data, setData ] = useState([]);
useEffect(() => {
  fetch( /*...*/ )
    .then(( data ) => {

      if( dataHasChanged( data ) ){  // <----- only set data if necessary
        setData( data );
      }

    });
}, [ data ]);

Alternatively (if appropriate for your use case), you might only fetch the new data if you know it might have changed:
const [ data, setData ] = useState([]);
useEffect(() => {

  if( !newDataNeedsToBeFetched( data ) ){ // <----- skip if no fetch necessary
    return;
  }

  fetch( /* ... */ )
    .then(( data ) => {
      setData( data );
    });
}, [ data ]);

implement hasChanged()
How to determine if data has changed in javascript is a separate question. Maybe you even don't have a problem there, otherwise please refer to other answers about that, e.g. design-pattern-to-check-if-a-javascript-object-has-changed.
You might also want to know about using useRef() to store the previous value: how-to-compare-oldvalues-and-newvalues-on-react-hooks-useeffect


text:
Q: Nginx Docker Container stops working irregularly The server:
I use Nginx as a ingress-proxy for my server. Nginx runs within a Docker container.
docker-compose.yml:
 nginx_ingress:
    image: nginx:latest
    ports:
      - "80:80"
      - "443:443"
    networks:
      front-tier: {}
      back-tier:
        ipv4_address: 172.28.1.1
    restart: always
    volumes:
      - /var/lib/my-server/config/nginx_ingress:/etc/nginx/conf.d
      - /var/lib/my-server/data/certbot/conf:/etc/letsencrypt
      - /var/lib/my-server/data/certbot/www:/var/www/certbot
    command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"

Since I manage multiple certificates with another container, I want Nginx to gracefully reload the config every 6 hours.
The idea is that I can manage all my certificates independent with another container. I don't want to have anything running on my host (no cronjob) and I don't want to combine my nginx-proxy-container with my certificate-container. I want every piece of the puzzle to run independent.
(I got the idea from this tutorial: https://pentacent.medium.com/nginx-and-lets-encrypt-with-docker-in-less-than-5-minutes-b4b8a60d3a71)
The problem:
Sometimes the proxy (nginx) stops working. While the Docker container itself keeps running.
The logs show the following:
...
2021/10/25 05:51:42 [notice] 1#1: signal 3 (SIGQUIT) received, shutting down
2021/10/25 05:51:42 [notice] 12#12: gracefully shutting down
2021/10/25 05:51:42 [notice] 12#12: exiting
2021/10/25 05:51:42 [notice] 13#13: gracefully shutting down
2021/10/25 05:51:42 [notice] 12#12: exit
2021/10/25 05:51:42 [notice] 13#13: exiting
2021/10/25 05:51:42 [notice] 13#13: exit
2021/10/25 05:51:42 [notice] 1#1: signal 17 (SIGCHLD) received from 12
2021/10/25 05:51:42 [notice] 1#1: worker process 12 exited with code 0
2021/10/25 05:51:42 [notice] 1#1: worker process 13 exited with code 0
2021/10/25 05:51:42 [notice] 1#1: exit
2021/10/25 05:51:44 [notice] 1#1: using the "epoll" event method
2021/10/25 05:51:44 [notice] 1#1: nginx/1.21.3
2021/10/25 05:51:44 [notice] 1#1: built by gcc 8.3.0 (Debian 8.3.0-6)
2021/10/25 05:51:44 [notice] 1#1: OS: Linux 5.4.0-86-generic
2021/10/25 05:51:44 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2021/10/25 05:51:44 [notice] 1#1: start worker processes
2021/10/25 05:51:44 [notice] 1#1: start worker process 9
2021/10/25 05:51:44 [notice] 1#1: start worker process 10

With sometimes I mean sometimes. I couldn't make out any pattern so far. First I thought Nginx is shutting down every 6 hours because of command. But it seems that this is not the case. I reduced the sleep time to 2 minutes and Nginx kept running fine for hours. Then I set the sleep time again to 6 hours and exactly 6 hours later Nginx stopped working (see the log above). I restarted the Docker container and since then Nginx is running (more than 24 hours have passed now). As you can see in the following logs, in most cases the Nginx reload works perfectly fine:
...
2021/10/25 11:51:44 [notice] 19#19: signal process started
2021/10/25 11:51:44 [notice] 1#1: signal 1 (SIGHUP) received from 19, reconfiguring
2021/10/25 11:51:44 [notice] 1#1: reconfiguring
2021/10/25 11:51:44 [notice] 1#1: using the "epoll" event method
2021/10/25 11:51:44 [notice] 1#1: start worker processes
2021/10/25 11:51:44 [notice] 1#1: start worker process 21
2021/10/25 11:51:44 [notice] 1#1: start worker process 22
2021/10/25 11:51:44 [notice] 10#10: gracefully shutting down
2021/10/25 11:51:44 [notice] 9#9: gracefully shutting down
2021/10/25 11:51:44 [notice] 10#10: exiting
2021/10/25 11:51:44 [notice] 9#9: exiting
2021/10/25 11:51:44 [notice] 9#9: exit
2021/10/25 11:51:44 [notice] 10#10: exit
2021/10/25 11:51:44 [notice] 1#1: signal 17 (SIGCHLD) received from 10
2021/10/25 11:51:44 [notice] 1#1: worker process 9 exited with code 0
2021/10/25 11:51:44 [notice] 1#1: worker process 10 exited with code 0
2021/10/25 11:51:44 [notice] 1#1: signal 29 (SIGIO) received
...

...
2021/10/25 17:51:44 [notice] 23#23: signal process started
2021/10/25 17:51:44 [notice] 1#1: signal 1 (SIGHUP) received from 23, reconfiguring
2021/10/25 17:51:44 [notice] 1#1: reconfiguring
2021/10/25 17:51:44 [notice] 1#1: using the "epoll" event method
2021/10/25 17:51:44 [notice] 1#1: start worker processes
2021/10/25 17:51:44 [notice] 1#1: start worker process 25
2021/10/25 17:51:44 [notice] 1#1: start worker process 26
2021/10/25 17:51:44 [notice] 22#22: gracefully shutting down
2021/10/25 17:51:44 [notice] 21#21: gracefully shutting down
2021/10/25 17:51:44 [notice] 21#21: exiting
2021/10/25 17:51:44 [notice] 22#22: exiting
2021/10/25 17:51:44 [notice] 21#21: exit
2021/10/25 17:51:44 [notice] 22#22: exit
2021/10/25 17:51:44 [notice] 1#1: signal 17 (SIGCHLD) received from 21
2021/10/25 17:51:44 [notice] 1#1: worker process 21 exited with code 0
2021/10/25 17:51:44 [notice] 1#1: signal 29 (SIGIO) received
2021/10/25 17:51:44 [notice] 1#1: signal 17 (SIGCHLD) received from 22
2021/10/25 17:51:44 [notice] 1#1: worker process 22 exited with code 0
2021/10/25 17:51:44 [notice] 1#1: signal 29 (SIGIO) received
...

My questions:

*

*Is there anything wrong with the command I use? Should the container stop as soon as Nginx stops? (maybe something wrong with the main-process?)

*Why does Nginx only stop irregularly? Why not every 6 hours? Do you see any difference between the first log and the second / third?

*Do you got any other suggestions how I could make Nginx reload itself? (as mentioned above, I don't want anything on the host + I don't want to combine nginx and certbot containers if not really necessary...)

Thank you for your help!