text:
Q: How to use RecyclerView into another RecyclerView's adapter in Android? In my application i have one list and into this this i have another list!(I know this is bad idea for UI but i should develop this!)
For show this lists i used RecyclerView and initialize other RecyclerView into previous RecyclerView adapter!
Activity codes:
class DashboardCardsActivity : BaseActivity(), DashboardCardsContracts.View {

    @NonNull
    private lateinit var presenter: DashboardCardsPresenterImpl
    private var context: Context = this
    private lateinit var recyclerView: RecyclerView
    private lateinit var adapter: DashboardCardsAdapter
    private lateinit var layoutManager: LinearLayoutManager
    private val modelList: MutableList<UserPackageOrderResponse.Res.UserPackageOrder> = mutableListOf()
    private var isLoadingFlag = false
    private var isHasLoadedAll = false
    private var nextPage = 1
    //Token
    private var token = GoodPrefs.getInstance().getString(PrefsKey.USER_JWT_TOKEN.name, "")

    override var layoutId: Int = R.layout.activity_dashboard_cards

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //Initialize
        context = this
        presenter = DashboardCardsPresenterImpl(context, this)
        layoutManager = LinearLayoutManager(context)
        adapter = DashboardCardsAdapter(context, modelList)
        //Init recyclerView
        recyclerView = dashboardCards_pullList.recyclerView
        recyclerView.initRecyclerView(layoutManager, adapter)
        //Set image to loader
        dashboardCards_pullList.setColorSchemeResources(R.color.colorAccent)
        //Init toolbar
        toolbarBase_toolbar.title = getString(R.string.basketCard)
        toolbarBase_toolbar.setToolbarBackWithFinish(this)
        //Call api
        getLazyPullLoader()
    }

I write below codes :
class DashboardListAdapter constructor(
    val context: Context, val model: MutableList<UserPackageOrderResponse.Res.UserPackageOrder>
) : RecyclerView.Adapter<DashboardCardsAdapter.ViewHolder>() {

    private var expansionlayout: ExpansionLayoutCollection = ExpansionLayoutCollection()
    private lateinit var registerTimeUtil: TimeUtils
    private var registerDateSplit: List<String> = emptyList()
    private var registerDate: List<String> = emptyList()
    private var orderState: String = ""
    private var layoutManager: LinearLayoutManager? = null
    private var adapter: DashboardCardsOrderAdapter
    private val orderModelList: MutableList<UserPackageOrderResponse.Res.UserPackageOrder.Order> = mutableListOf()

    init {
        expansionlayout.openOnlyOne(true)
        layoutManager = object : LinearLayoutManager(context) {
            override fun canScrollVertically(): Boolean {
                return false
            }
        }
        adapter = DashboardCardsOrderAdapter(orderModelList)
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val inflater = LayoutInflater.from(parent.context)
        return ViewHolder(inflater.inflate(R.layout.row_dashboard_card_list, parent, false))
    }

    override fun getItemCount(): Int {
        return model.size
    }

    @SuppressLint("SetTextI18n")
    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        expansionlayout.add(holder.getExpansions())
        //header
        holder.orderNumber.text = model[position].hashcode
        holder.rowNumber.text = "${position + 1}"
        //Set date
        registerDateSplit = model[position].createdAt.split(" ")
        registerDate = registerDateSplit[0].split("-")
        registerTimeUtil = TimeUtils(registerDate[0].toInt(), registerDate[1].toInt(), registerDate[2].toInt())
        holder.orderRegisterDate.text = registerTimeUtil.getIranianDate()
        //Order state
        orderState = model[position].status
        holder.setViewWithState(orderState, context)
        //Content prices
        holder.finalPrice.text = "${model[position].price.moneySeparating()} ${context.getString(R.string.toman)}"
        holder.paymentPrice.text = "${model[position].price.moneySeparating()} ${context.getString(R.string.toman)}"
        holder.postPrice.text = "${model[position].postFee.moneySeparating()} ${context.getString(R.string.toman)}"
        holder.discountPrice.text = "${model[position].discount.moneySeparating()} ${context.getString(R.string.toman)}"
        //init order list
        orderModelList.clear()
        orderModelList.addAll(model[position].orders)
        layoutManager?.let {
            holder.orderList.initRecyclerView(it, adapter)
        }
    }
}

But when running application show me ForceClose error and show me below message in logCat :
java.lang.IllegalArgumentException: LayoutManager com.app.android.ui.home.fragments.dashboard.activities.carts_list.DashboardCardsAdapter$1@d33c634 is already attached to a RecyclerView: androidx.recyclerview.widget.RecyclerView{5a76c5d VFED..... ......ID 0,0-682,178 #7f080089 app:id/dashboardCard_orderList}, adapter:com.app.android.ui.home.fragments.dashboard.activities.carts_list.DashboardCardsOrderAdapter@83ba9d2, layout:com.app.android.ui.home.fragments.dashboard.activities.carts_list.DashboardCardsAdapter$1@d33c634, context:com.app.android.ui.home.fragments.dashboard.activities.carts_list.DashboardCardsActivity@79c2f05
        at androidx.recyclerview.widget.RecyclerView.setLayoutManager(RecyclerView.java:1340)
        at com.app.android.utils.ExtensionsKt.initRecyclerView(Extensions.kt:74)
        at com.app.android.ui.home.fragments.dashboard.activities.carts_list.DashboardCardsAdapter.onBindViewHolder(DashboardCardsAdapter.kt:77)
        at com.app.android.ui.home.fragments.dashboard.activities.carts_list.DashboardCardsAdapter.onBindViewHolder(DashboardCardsAdapter.kt:22)
        at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6781)
        at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6823)

But after change my code with below case not show me any error, but scrolling is very slowly and show lag!
//init order list
orderModelList.clear()
orderModelList.addAll(model[position].orders)
layoutManager = object : LinearLayoutManager(context) {
    override fun canScrollVertically(): Boolean {
        return false
    }
}
layoutManager?.let {
    holder.orderList.initRecyclerView(it, adapter)
}

I initialized layoutManager in onBindView(), then not show me error but show me many lag when scrolling on items!
How can i fix this?

A: You have defined this:
private var layoutManager: LinearLayoutManager? = null

Define another one say,
private var layoutManager1: LinearLayoutManager? = null

Assign that to your second RecyclerView and run it. It should work.
P.S: Not familiar with Kotlin, in Java we use
recyclerview.setLayoutManager(new LinearLayoutManager(MyActivity.this));


text:
Q: get day difference between two date using carbon I am using laravel and carbon package.I have two date. Now I want to get date difference from my given date.
$start_Date='2016-06-02 18:00:13';
$end_Date='2016-06-06 18:00:13';
$start = Carbon::parse($start_Date);
$end = Carbon::parse($end_Date);
$now = Carbon::now();
$length = $start->diffInDays($now);
$lengthFromEnd = $end->diffInDays($now);

if now() == 2016-06-07 then
$length  will be 5 days and
$lengthFromEnd will be -1 days.
but my code return abnormal result

A: you can also try this way.
$difference = $start_date->diff($end_date)->days;

A: For negative result, you need a add parameter, like this:
$absolute = false;
$end->diffInDays($now, $absolute);

A: This usually works perfectly but recently I had faced some problems finding the difference between to date where my date format was
 12-02-2020
$endDate = Carbon::createFromFormat('d-m-Y', $data['enddate']);
$left = Carbon::parse(Carbon::now())->floatDiffInDays($endDate, false);

If the date is expired then $left will be negative and number of days it has passed otherwise it will be a positive number

A: Your code is correct. Only problem is you are getting unexpected results.
When you said now() == 2016-06-07, you forgot to consider the time. Actually, now must be something like this 2016-06-07 15:47:47.
Since,
$start_Date='2016-06-02 18:00:13';
$end_Date='2016-06-06 18:00:13';

you will get $length = 4 and $lengthFromEnd = 0.
When the $now becomes 2016-06-07 18:00:13, then you'll get $length = 5 and $lengthFromEnd = 1.
Note that you won't get $lengthFromEnd = -1 as Carbon gives difference in positive numbers.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Surjective morphism from $X$ to itself is finite Let $X$ be a projective variety. Why is any surjective morphism from $X$ to itself finite?

A: Let $f$ be your surjective endomorphism; it is generically finite, say of degree $d$. Then  $f_*:H^*(X,\mathbb{Q})\rightarrow H^*(X,\mathbb{Q})$ is surjective, because $\ f_*f^*=d.\mathrm{Id}\ $ (use $\mathbb{Q}_\ell$ instead of  $\mathbb{Q}$ in characteristic $p$). Therefore $f_*$ is bijective. But then $f$ cannot contract any positive dimensional subvariety $Z$, because we would have $f_*[Z]=0$.


text:
Q: Convert folder and file names to camel case I have a list of folders and files whose names contain spaces. How can I change the names into camel case?
for oldname in *
do
  newname=`echo $oldname | sed -e 's/ /_/g'`
  if [ "$newname" = "$oldname" ]
  then
    continue
  fi
  if [ -e "$newname" ]
  then
    echo Skipping "$oldname", because "$newname" exists
  else
    mv "$oldname" "$newname"
  fi
done

I have found this but it changes the spaces into underscores.

A: Try this Shellcheck-clean Bash code:
#! /bin/bash -p

lowers=abcdefghijklmnopqrstuvwxyz
uppers=ABCDEFGHIJKLMNOPQRSTUVWXYZ

for oldname in *; do
    [[ $oldname == *[[:space:]]* ]] || continue
    read -r -d '' -a parts <<<"$oldname"
    newname=''
    for p in "${parts[@]}"; do
        char1=${p:0:1}
        if [[ $lowers == *"$char1"* ]]; then
            tmp=${lowers%"$char1"*}
            uchar1=${uppers:${#tmp}:1}
            newname+=${uchar1}${p:1}
        else
            newname+=$p
        fi
    done
    if [[ -e $newname ]]; then
        printf "Skipping '%s', because '%s' exists\\n" "$oldname" "$newname" >&2
    else
        echo mv -v -- "$oldname" "$newname"
    fi
done

*

*The code is intended to work with (the now ancient) Bash 3 because my understanding is that that is still the current version of the standard Bash on macOS.  The code for uppercasing the first letter of filename parts is much more complicated than it would be with later versions of Bash (which have built-in mechanisms for case conversion).  See How to convert a string to lower case in Bash? for information about changing case in various ways in various versions of Bash.

*The code just prints the mv command that would be run.  Remove the echo to make it actually do the mv.

*See the accepted, and excellent, answer to Why is printf better than echo? for an explanation of why I replaced echo with printf for the "Skipping" message.

For comparison, this is Bash 4+ code:
#! /bin/bash -p

for oldname in *; do
    [[ $oldname == *[[:space:]]* ]] || continue
    read -r -d '' -a parts <<<"$oldname"
    newname=''
    for p in "${parts[@]}"; do
        newname+=${p^}
    done

    if [[ -e $newname ]]; then
        printf "Skipping '%s', because '%s' exists\\n" "$oldname" "$newname" >&2
    else
        echo mv -v -- "$oldname" "$newname"
    fi
done

A: You can use the regular expression aptitude to deal with upper and lower case translations, regarding your current local collation (LC_ALL, check with the locale command).
If your filename's "words" are separated with a space and are all in lower case, you can use a simple shell script like this :
#!/bin/sh
while read -r FILENAME ; do
  NEWNAME="`echo \"${FILENAME}\" | sed 's/  *\([^ ]\)/\u\1/g'`"
  if [ ! "${NEWNAME}" ] ; then
    NEWNAME="${FILENAME}";
  fi
  if [ "${FILENAME}" = "${NEWNAME}" ]; then
    printf "No change : %s\\n" "${FILENAME}" >&2;
  else
    if [ -e "${NEWNAME}" ] ; then
      printf "Already changed : %s => %s\\n" "${FILENAME}" "${NEWNAME}" >&2;
    else
      echo "mv \"${FILENAME}\" \"${NEWNAME}\"";
    fi
  fi
done

Remove the echo on echo "mv \"${FILENAME}\" \"${NEWNAME}\""; to do the mv.
Note that it should work fine with accented letters or any unicode letter having lower and upper code.
The script takes the file list to operate from stdin, so to use it "as is", you can use something like the following examples :

*

*find . -type 'f' | theScript.sh
For a whole tree of files.
For folders, you'll have to operate them separately. List them and sort them in a descending order.

*ls -1 | theScript.sh
For files in the current folder.
If your files may have all or partial upper cases at start and you look to force them entirely to camel case, you can change the line :
  NEWNAME="`echo \"${FILENAME}\" | sed 's/  *\([^ ]\)/\u\1/g'`"

With:
  NEWNAME="\`echo \"${FILENAME}\" | sed 's/\(.*\)/\l\1/;s/  *\([^ ]\)/\u\1/g'\`"

A: If you have rename installed, then all you need to do is :
rename 's/ /_/g' *


text:
Q: pass nested classes of a specific class as an argument in java/android I have a class M, inside the class I have three nested classes namely Class A, Class B, Class c.
I need to pass any of the nested class (A/B/C) objects to a method namely doSomething(***class A/B/C object***).
So my question is how to pass different objects of nested classes of Class M to a method outside class M?
Should I use generic class? if yes, Can you help me with the parameter?
CLARIFICATION :
I want a single method where instances of M.A,M.B,M.C can be passed as argument and method has to be outside M.
More Clarification
Let me tell you what I'm trying to achieve through the code.
I have a class M which in turn have 3 nested classes - A, B, C.
I create objects/instances of A, B, C by
M.A a = (new M()).new A();
M.B b = (new M()).new B();
M.C c = (new M()).new C();

Now to manipulate on values stored by A,B,C I have a function doSomething().
I want to pass a,b,c to doSomething() at different times like
`doSomething(a);`
`doSomething(b);`
`doSomething(c);`

What I meant by the question is, how to declare function doSomething() such that I can pass a, b, c ?
In real project, nested classes are around 20 and I dont want to write same functionality of doSomething() again and again for operating on these instances of nested classes.
And dosomething() is outside of class M.
Thanks.

A: class M {
    static class A implements I {
        public void whatever(){}
    }
    static class B implements I {
        public void whatever(){}
    }
    static class C implements I {
        public void whatever(){}
    }
    interface I {
        void whatever();
    }
}

class C {
    void doSomething(Class<I> clazz){}

    void doSomething(I i){}

    public static void main(String[] args){
        doSomething(M.A.class);
        doSomething(new M.B());
    }
}


text:
Q: GWT upload samples not working? because i want to have smarter upload in my site, i downloaded gwtupload-samples-0.6.1 from http://code.google.com/p/gwtupload/
and i imported the war file to eclipse IDE.
then i added the GWT configuration to the project and now it's a GWT project.
but the project want run, and still i see errors like "GWTCBox cannot be resolved to a type" and "GWTCPopupBox cannot be resolved to a variable" .
i think i should import more libraries , but i don't know what should i import!
any body can help me pleas ?

A: As maneesh wrote, the key is gwtchismes. What you have is a problem with the libraries your project uses.
You have to visit GWT-Chismes dowload area and get this library's JAR file: http://gwtchismes.googlecode.com/files/gwtchismes-0.9.7.jar
After that, you have to copy this file to the lib directory of your project and update your classpath to include it.
After this, these warnings should go away.
No additional import needed. Btw, you are never forced to use any import. Imports are not intended to "pull" some libraries to your project (the classpath is intended for this); imports are only compilation-time features of a language like Java that ease your life by shortening class names inside the source code of your programs. But they are not required. You can do certain things if you use them, but you don't lose any privilege of using any object if you don't use them (you'll just have to write more).

A: GWTCBox is from gwtchismes http://code.google.com/p/gwtchismes/


text:
Q: "Copy link" button doesn't work in responsive mobile Safari A recent update added a "copy link" button when the share menu is open on posts. However, in the responsive site on mobile Safari, this button doesn't work. This could be fixed if a different method were used (maybe Clipboard.js, which works on mobile Safari).

A: It works now! I don't know what changed—it is either Safari in iOS 13 changed or the devs changed this to another system. Either way, here's a screenshot:


text:
Q: AppHarbor updating project changes I made some bigger changes to my MVC4 project file which includes adding in some nuget packages.
Currently, all I do is commit the changes in visual studio, launch GIT bash, and run the command-> git push appharbor master.  This seems to work with smaller changes that do not include adding new packages.  However, I added new packages to my project.
If I run the same command, Will this update the nuget packages I added or do I need to do more?
Also, is there a way to check whether these packages were installed on appharbor?

A: If you set your packages to create a local copy, then the package will be part of your project (most of the time it is located in project/packages). If you are committing this folder to your Appharbor repository then you should be able to use the same command to update any changes. If your site is not working in Appharbor then it could be that you have those file types as part of your .gitignore file.


text:
Q: Portfolio gallery with filtering categories I tried edit Portfolio gallery with filtering categories from

https://www.w3schools.com/howto/howto_js_portfolio_filter.asp

I wanted to add animation by choosing category but I failed.
Here is my code:
/*Portfolio-gallery*/
/* Add padding BETWEEN each column (if you want) */
.row,
.row > .column {
}

/* Create three equal columns that floats next to each other */
.column {
    float: left;
    width: 398px;
    display: none; /* Hide columns by default */
    -webkit-transition: all 600ms cubic-bezier(0.645, 0.045, 0.355, 1);
    transition:         all 600ms cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* Clear floats after rows */
.row:after {
    content: "";
    display: table;
    clear: both;
    -webkit-transition: all 600ms cubic-bezier(0.645, 0.045, 0.355, 1);
    transition:         all 600ms cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* Content */
.content {
    background-color: white;
    padding: 10px;
    -webkit-transition: all 600ms cubic-bezier(0.645, 0.045, 0.355, 1);
    transition:         all 600ms cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* The "show" class is added to the filtered elements */
.show {
    display: block;
    -webkit-transition: all 600ms cubic-bezier(0.645, 0.045, 0.355, 1);
    transition:         all 600ms cubic-bezier(0.645, 0.045, 0.355, 1);
}

A: transition attribute will not work on display attribute.
But you can add the transition by setting below CSS using height and visibility
/* Create three equal columns that floats next to each other */
.column {
    float: left;
    width: 33.33%;
    visibility: hidden;
    height: 0px;
    -webkit-transition: all 600ms cubic-bezier(0.645, 0.045, 0.355, 1);
    transition:         all 600ms cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* The "show" class is added to the filtered elements */
.show {
  visibility: visible;
  height: 325px;
}

But here you must define the height of the card that being shown here.

A: i can't comment so i had to do it this way.
i used this code for my portfolio and worked great!
HTML

      All Categories
      Web Templates
      Logos
      Drawings
      UI Elements

CSS
 body {
  font-family: Arial;
}

a:focus {
  outline: none;
}

.portfolioFilter {
  padding: 15px 0;
}

.portfolioFilter a {
  margin-right: 6px;
  color: #666;
  text-decoration: none;
  border: 1px solid #ccc;
  padding: 4px 15px;
  border-radius: 50px;
  display: inline-block;
}

.portfolioFilter a.current {
  background: #1e1e1e;
  border: 1px solid #1e1e1e;
  color: #f9f9f9;
}
.portfolioContainer{
  border: 1px solid #eee;
  border-radius: 3px;
}
img {
  margin: 5px;
  max-width:100%;
}

.isotope-item {
  z-index: 2;
}

.isotope-hidden.isotope-item {
  pointer-events: none;
  z-index: 1;
}

.isotope,
.isotope .isotope-item {
  /* change duration value to whatever you like */
  -webkit-transition-duration: 0.8s;
  -moz-transition-duration: 0.8s;
  transition-duration: 0.8s;
}

.isotope {
  -webkit-transition-property: height, width;
  -moz-transition-property: height, width;
  transition-property: height, width;
}

.isotope .isotope-item {
  -webkit-transition-property: -webkit-transform, opacity;
  -moz-transition-property: -moz-transform, opacity;
  transition-property: transform, opacity;
}

JS
$(window).load(function(){
    var $container = $('.portfolioContainer');
    $container.isotope({
        filter: '*',
        animationOptions: {
            duration: 750,
            easing: 'linear',
            queue: false
        }
    });

    $('.portfolioFilter a').click(function(){
        $('.portfolioFilter .current').removeClass('current');
        $(this).addClass('current');

        var selector = $(this).attr('data-filter');
        $container.isotope({
            filter: selector,
            animationOptions: {
                duration: 750,
                easing: 'linear',
                queue: false
            }
         });
         return false;
    });
});

hope it will help you, good luck!


text:
Q: Delete a file on iCloud drive automatically To delete a file on the local filesystem without any dialog box is straightforward. But if you want to delete a file on iCloud drive you get an alert box, you have to quit.Because I want, that this happens automatically, I tried this:
tell application "Finder"
activate
set folderList to get items of folder "System:Users:user1:exampleFolder"
set deleteItem to item 1 of folderList
delete deleteItem
tell application "System Events"
    tell process "Finder"
        key code 36
    end tell
 end tell

It doesn't work. Is there an other way to quit the warning box?

A: I don't use icloud but System Events, rather than Finder, will usually delete files without a prompt.
If that doesn't work you can try:
Be careful with the following command. You can erase more than you want if you misplace the *.
set folderPath to "System:Users:user1:exampleFolder"
do shell script "rm  -r " & (quoted form of folderPath's POSIX path) & "/*"


text:
Q: I/flutter ( 8545): type 'int' is not a subtype of type Iterable Class details
class AccountInfo
{
  final int total;
  final int loan;

  AccountInfo( this.total,this.loan);
}

My function is
Future<List<AccountInfo>> _getUsers() async {

    var url = "http://abcwebtest.com/book/accounts.php";
    var para = {'mid': "1"};

    var response = await http.post(url, body: json.encode(para));
    if(response.statusCode ==200) {
      var jsonData = json.decode(response.body);
      List<AccountInfo> accinfo_list = [];

      for (var u in jsonData) {
        AccountInfo usr_acc = AccountInfo( u["total"], u["loan"]);
        accinfo_list.add(usr_acc);

      }

      return  accinfo_list;
    }else{
      throw Exception('Failed to load ..........');
    }
  }

which will fetch loan and total from table balance. both the fields are int. but I am getting an error as
I/flutter ( 8545): type 'int' is not a subtype of type 'Iterable'
Please let me help to find solution.

A: You are trying to iterate the stuff that comes back from the server. It's not an array:
for (var u in jsonData) {
  AccountInfo usr_acc = AccountInfo( u["total"], u["loan"]);
  accinfo_list.add(usr_acc);
}

Instead, do this:
Map<string, dynamic> res = json.decode(response.body);
AccountInfo usr_acc = AccountInfo( res["total"], u["loan"]);
accinfo_list.add(usr_acc);


text:
Q: So many problems with my bibliography! I'm sorry because I have yet more questions but you all seem to understand LaTeX way better than me! So I have a couple of problems with my bibliography - it's nothing major but it is bugging me.
1 - The page number on the first page of the bibliography is centred bottom whereas the rest of the pages are at the right-hand bottom. In my other chapters, I have managed to get around this by including \thispagestyle{style2} for the first page and then \pagestyle{style1} for the remainder of the pages (this may be superfluous but it's what I found worked in order to get the first page to have no header and a right-hand bottom number and the rest of the pages with a header and a right-hand bottom number). However, this won't work on the bibliography because it isn't classified as a chapter - so does anyone have any ideas what I can do? []
This is my pre-amble:
\usepackage{fancyhdr}
\fancyhead{}
    \fancyfoot[R]{\textbf{\thepage}}
\usepackage{lastpage}
\pagestyle{fancy}
\fancyhf{}
\rhead{\leftmark}
\renewcommand{\headrulewidth}{0.7pt}
\setlength{\headheight}{15pt}
\fancyfoot[R]{\thepage}
\rfoot{\thepage}

\fancypagestyle{style1}
{\fancyhf{}
\rhead{\leftmark}
\renewcommand{\headrulewidth}{0.7pt}
\setlength{\headheight}{15pt}
\fancyfoot[R]{\thepage}
\rfoot{\thepage}}

\fancypagestyle{style2}
{\fancyhf{}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0pt}}

In the reference.bib file:
@article{Maes2019Taxonomy2018,
    title = {{Taxonomy of the order Bunyavirales: second update 2018}},
    year = {2019},
    journal = {Archives of Virology},
    author = {Maes, Piet and Adkins, Scott and Alkhovsky, Sergey V. and Av{\v{s}}i{\v{c}}-{\v{Z}}upanc, Tatjana and Ballinger, Matthew J. and Bente, Dennis A. and Beer, Martin and Bergeron, Éric and Blair, Carol D. and Briese, Thomas and Buchmeier, Michael J. and Burt, Felicity J. and Calisher, Charles H. and Charrel, Rémi N. and Choi, Il Ryong and Clegg, J. Christopher S. and de la Torre, Juan Carlos and de Lamballerie, Xavier and DeRisi, Joseph L. and Digiaro, Michele and Drebot, Mike and Ebihara, Hideki and Elbeaino, Toufic and Erg{\"{u}}nay, Koray and Fulhorst, Charles F. and Garrison, Aura R. and G{\={a}}o, George Fú and Gonzalez, Jean-Paul J. and Groschup, Martin H. and G{\"{u}}nther, Stephan and Haenni, Anne-Lise and Hall, Roy A. and Hewson, Roger and Hughes, Holly R. and Jain, Rakesh K. and Jonson, Miranda Gilda and Junglen, Sandra and Klempa, Boris and Klingstr{\"{o}}m, Jonas and Kormelink, Richard and Lambert, Amy J. and Langevin, Stanley A. and Lukashevich, Igor S. and Marklewitz, Marco and Martelli, Giovanni P. and Mielke-Ehret, Nicole and Mirazimi, Ali and M{\"{u}}hlbach, Hans-Peter and Naidu, Rayapati and Nunes, Márcio Roberto Teixeira and Palacios, Gustavo and Papa, Anna and Paw{\c{e}}ska, Janusz T. and Peters, Clarence J. and Plyusnin, Alexander and Radoshitzky, Sheli R. and Resende, Renato O. and Romanowski, Víctor and Sall, Amadou Alpha and Salvato, Maria S. and Sasaya, Takahide and Schmaljohn, Connie and Sh{\'{i}}, Xiǎohóng and Shirako, Yukio and Simmonds, Peter and Sironi, Manuela and Song, Jin-Won and Spengler, Jessica R. and Stenglein, Mark D. and Tesh, Robert B. and Turina, Massimo and W{\`{e}}i, Tàiyún and Whitfield, Anna E. and Yeh, Shyi-Dong and Zerbini, F. Murilo and Zhang, Yong-Zhen and Zhou, Xueping and Kuhn, Jens H.},
    number = {3},
    month = {3},
    pages = {927--941},
    volume = {164},
    url = {http://link.springer.com/10.1007/s00705-018-04127-3},
    isbn = {2163684814},
    doi = {10.1007/s00705-018-04127-3},
    issn = {0304-8608},
    pmid = {30663021}
}

2 - I keep getting this error message because there's too many authors in two of the references. I'm using natbib because the agsm bibliography style gives me the closest to the referencing style that I need.
Preamble:
\usepackage[nottoc]{tocbibind}
\usepackage[round,authoryear]{natbib}
\usepackage{har2nat}
\bibliographystyle{agsm}

Error message:
BibTeX you've exceeded 250, the entry-string-size, for entry Maes2018Taxonomy2018b

3 - Finally this one really doesn't matter, but I would prefer the Bibliography to be called References instead but I don't know how to change it. I've included the entire pre-amble of my report in case you need to see it?
\documentclass[oneside,a4 paper, 12pt]{report}

\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{1ED3}{\`{\^{o}}}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[labelfont=bf]{caption}
\usepackage[font={small}]{caption}

\usepackage{mathcomp}
\usepackage{geometry}
\newgeometry{top=20mm,bottom=20mm,outer=20mm,inner=40mm}

\usepackage{rotating}
\usepackage[table]{xcolor}
\usepackage{array}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{lscape}

\usepackage{fancyhdr}
\fancyhead{}
    \fancyfoot[R]{\textbf{\thepage}}
\usepackage{lastpage}
\pagestyle{fancy}
\fancyhf{}
\rhead{\leftmark}
\renewcommand{\headrulewidth}{0.7pt}
\setlength{\headheight}{15pt}
\fancyfoot[R]{\thepage}
\rfoot{\thepage}

\fancypagestyle{style1}
{\fancyhf{}
\rhead{\leftmark}
\renewcommand{\headrulewidth}{0.7pt}
\setlength{\headheight}{15pt}
\fancyfoot[R]{\thepage}
\rfoot{\thepage}}

\fancypagestyle{style2}
{\fancyhf{}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0pt}
\usepackage{graphicx}
\usepackage{array}
\graphicspath{/Figures/}
 \usepackage{placeins}
\usepackage{blindtext}

\usepackage[raggedright]{titlesec}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\raggedright}{\chaptertitlename~\thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{-10pt}{-20pt}{40pt}
\titlespacing*{name=\chapter,numberless}{0pt}{-20pt}{10pt}
\usepackage{setspace}
\setstretch{1.5}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0.5em}

\DeclareCaptionJustification{nohyphen}{\hyphenpenalty=100000}
\captionsetup{justification=nohyphen}
\usepackage[nottoc]{tocbibind}
\usepackage[round,authoryear]{natbib}
\usepackage{har2nat}
\bibliographystyle{agsm}

Sorry for so many questions (and probably too much information) but I am still getting to grips with LaTeX... I'd gladly accept any suggestion of improvements too :)
Thanks,
Amelia

A: I have cleaned your .tex snippets for the header and footer and made new  additions. Below is the full MWE which should solve your queries.
\documentclass[oneside,a4paper, 12pt]{report}

\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{1ED3}{\`{\^{o}}}

\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[labelfont=bf]{caption}
\usepackage[font={small}]{caption}

\usepackage{mathcomp}
\usepackage[top=20mm, bottom=20mm, outer=20mm, inner=40mm]{geometry}
% \newgeometry{top=20mm,bottom=20mm,outer=20mm,inner=40mm}

\usepackage{rotating}
\usepackage[table]{xcolor}
\usepackage{array}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{lscape}

%------------------HEADERS & FOOTERS (cleaned + new addition)-----------
\usepackage{fancyhdr}
\usepackage{lastpage}

\pagestyle{fancy}
\fancyhf{}
%
\fancyhead[R]{\leftmark}
\fancyfoot[R]{\thepage}

%---------------------------------------
\fancypagestyle{plain}{%
    %
    \renewcommand{\headrulewidth}{0pt}%
    \fancyhf{}%
    \fancyfoot[R]{\thepage}%
}
% --------------------------------------------

\usepackage[raggedright]{titlesec}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\raggedright}{\chaptertitlename~\thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{-10pt}{-20pt}{40pt}
\titlespacing*{name=\chapter,numberless}{0pt}{-20pt}{10pt}
%
%
\usepackage{setspace}
\setstretch{1.5}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0.5em}
%
%
\DeclareCaptionJustification{nohyphen}{\hyphenpenalty=100000}
\captionsetup{justification=nohyphen}
%
%
\usepackage[nottoc]{tocbibind}
\usepackage[round,authoryear]{natbib}
\usepackage{har2nat}
% % \bibliographystyle{agsm}  % used below

%-----------
\usepackage{lipsum} % to add random texts
%-------------------------------------

\begin{document}

\chapter{Right-hand bottom Page Number}
\lipsum[1-3]

\cite{Maes2019Taxonomy2018, Greener2020, M19, Na2020}

More \cite{green20} % added few extra references to show 2 (two) pages of References

% ---------------New addition-------------------

\renewcommand{\bibname}{References} %<---this would change the name 'Bibliography' to 'References'

\bibliographystyle{agsm} %
\bibliography{biblio} % reference bib file

\end{document}

Save the references in a file biblio.bib. To note, in the bib file, I have added few extra references, apart from the one you have provided, to show 2 (two) pages of References.
@Article{Maes2019Taxonomy2018,
author={Maes, Piet and Adkins, Scott and Alkhovsky, Sergey V. and Av{\v{s}}i{\v{c}}-{\v{Z}}upanc, Tatjana
and Ballinger, Matthew J. and Bente, Dennis A. and Beer, Martin and Bergeron, {\'E}ric and Blair, Carol D. and Briese, Thomas and Buchmeier, Michael J. and Burt, Felicity J. and Calisher, Charles H. and Charrel, R{\'e}mi N. and Choi, Il Ryong and Clegg, J. Christopher S. and de la Torre, Juan Carlos and de Lamballerie, Xavier and DeRisi, Joseph L. and Digiaro, Michele and Drebot, Mike and Ebihara, Hideki and Elbeaino, Toufic and Erg{\"u}nay, Koray and Fulhorst, Charles F. and Garrison, Aura R. and G{\={a}}o, George F{\'u} and Gonzalez, Jean-Paul J. and Groschup, Martin H. and G{\"u}nther, Stephan and Haenni, Anne-Lise and Hall, Roy A. and Hewson, Roger and Hughes, Holly R. and Jain, Rakesh K. and Jonson, Miranda Gilda and Junglen, Sandra and Klempa, Boris and Klingstr{\"o}m, Jonas and Kormelink, Richard and Lambert, Amy J. and Langevin, Stanley A. and Lukashevich, Igor S. and Marklewitz, Marco and Martelli, Giovanni P. and Mielke-Ehret, Nicole and Mirazimi, Ali and M{\"u}hlbach, Hans-Peter and Naidu, Rayapati and Nunes, M{\'a}rcio Roberto Teixeira and Palacios, Gustavo and Papa, Anna and Paw{\k{e}}ska, Janusz T. and Peters, Clarence J. and Plyusnin, Alexander and Radoshitzky, Sheli R. and Resende, Renato O. and Romanowski, V{\'i}ctor and Sall, Amadou Alpha and Salvato, Maria S. and Sasaya, Takahide and Schmaljohn, Connie and Sh{\'i}, Xi{\v{a}}oh{\'o}ng and Shirako, Yukio and Simmonds, Peter and Sironi, Manuela and Song, Jin-Won and Spengler, Jessica R. and Stenglein, Mark D. and Tesh, Robert B. and Turina, Massimo and W{\`e}i, T{\`a}iy{\'u}n and Whitfield, Anna E. and Yeh, Shyi-Dong and Zerbini, F. Murilo and Zhang, Yong-Zhen and Zhou, Xueping and Kuhn, Jens H.},
title={Taxonomy of the order Bunyavirales: second update 2018},
journal={Archives of Virology},
year={2019},
month={Mar},
day={01},
volume={164},
number={3},
pages={927-941},
abstract={In October 2018, the order Bunyavirales was amended by inclusion of the family Arenaviridae, abolishment of three families, creation of three new families, 19 new genera, and 14 new species, and renaming of three genera and 22 species. This article presents the updated taxonomy of the order Bunyavirales as now accepted by the International Committee on Taxonomy of Viruses (ICTV).},
issn={1432-8798},
doi={10.1007/s00705-018-04127-3},
}

@article{Greener2020,
   title={SDSS-IV MaNGA: spatially resolved dust attenuation in spiral galaxies},
   volume={495},
   ISSN={1365-2966},
   url={http://dx.doi.org/10.1093/mnras/staa1300},
   DOI={10.1093/mnras/staa1300},
   number={2},
   journal={Monthly Notices of the Royal Astronomical Society},
   publisher={Oxford University Press (OUP)},
   author={Greener, Michael J and Aragón-Salamanca, Alfonso and Merrifield, Michael R and Peterken, Thomas G and Fraser-McKelvie, Amelia and Masters, Karen L and Krawczyk, Coleman M and Boardman, Nicholas F and Boquien, Médéric and Andrews, Brett H and et al.},
   year={2020},
   month={May},
   pages={2305–2320}
}

@article{Na2020,
   title={The deep Chandra survey in the SDSS J1030+0524 field},
   volume={637},
   ISSN={1432-0746},
   DOI={10.1051/0004-6361/202037914},
   journal={Astronomy \& Astrophysics},
   publisher={EDP Sciences},
   author={Nanni, R. and Gilli, R. and Vignali, C. and Mignoli, M. and Peca, A. and Marchesi, S. and Annunziatella, M. and Brusa, M. and Calura, F. and Cappelluti, N. and et al.},
   year={2020},
   month={May},
   pages={A52}
}

@article{M19,
   title={The SDSS-HET Survey of Kepler Eclipsing Binaries. Description of the Survey and First Results},
   volume={884},
   ISSN={1538-4357},
   DOI={10.3847/1538-4357/ab3793},
   number={2},
   journal={The Astrophysical Journal},
   publisher={American Astronomical Society},
   author={Mahadevan, Suvrath and Bender, Chad F. and Hambleton, Kelly and Fleming, Scott W. and Deshpande, Rohit and Conroy, Kyle and Matijevič, Gal and Hebb, Leslie and Roy, Arpita and Ak, Hasan and et al.},
   year={2019},
   month={Oct},
   pages={126}
}

@misc{green20,
    title={Spectroscopic and Photometric Periods of Six Ultracompact Accreting Binaries},
    author={Matthew J. Green and Thomas R. Marsh and Philip J. Carter and Danny Steeghs and Elmé Breedt and V. S. Dhillon and S. P. Littlefair and Steven G. Parsons and Paul Kerry and Nicola P. Gentile Fusillo and R. P. Ashley and Madelon C. P. Bours and Tim Cunningham and Martin J. Dyer and Boris T. Gänsicke and Paula Izquierdo and Anna F. Pala and Chuangwit Pattama and Sabrina Outmani and David I. Sahman and Boonchoo Sukaum and James Wild},
    year={2020},
    eprint={2005.12616},
    archivePrefix={arXiv},
    primaryClass={astro-ph.SR}
}


text:
Q: Error with 'NoneType Error' with SQLAlchemy: I am a beginner in Flask. I have created an sqlite database defined by my models.py and I have populated it with values. I wanted to print all that is there in the back-end database-table: line_info using the search_var.html file. However, I am getting an error, kindly help
My models.py
from app  import db
class line_info(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    EUSOL_id = db.Column(db.VARCHAR (255), nullable=True)
    acc_id = db.Column(db.VARCHAR (255), nullable=True)
    acc_name=db.Column(db.String(20), nullable=True)
    reasons = db.Column(db.String(100), nullable=True)
    genbank = db.Column(db.String(100), nullable=True)

    def __init__(self, EUSOL_id,acc_id,acc_name,reasons,genbank):
        self.EUSOL_id= EUSOL_id
        self.acc_id = acc_id
        self.acc_name = acc_name
        self.reasons = reasons
        self.genbank = genbank

I have added some dummy values from the Python shell to test:
from app import db, app
from app.models import line_info

l = line_info(EUSOL_id='abcdeg', acc_id='asgd', acc_name='tomato_name', reasons='wild', genbank='NA')
db.app = app
db.init_app(app)
db.create_all()
db.session.add(l)
db.session.commit()
line_info.query.all()
[<line_info 1>]

My routes.py
from flask import render_template
from app import app

@app.route('/')
def search_func():
    line_info = None
    line_info = line_info.query.all()
    return render_template("search_var.html", line_info=line_info)

if __name__ == '__main__':
    app.run(debug = True)

My 'search_var.html'
{% extends "layout.html" %}
{% block title %}Search{% endblock %}
{% block main %}

Lines

    {% for line in line_info %}

{{line_info.id}}

    {% endfor %}

{% endfor %}

Error:
Traceback (most recent call last):
  File "/home/workstation1/flask_beta/my_venv/lib/python3.6/site-packages     /flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/workstation1/flask_beta/my_venv/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/workstation1/flask_beta/my_venv/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/workstation1/flask_beta/my_venv/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/home/workstation1/flask_beta/my_venv/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/workstation1/flask_beta/my_venv/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/workstation1/flask_beta/app/routes.py", line 9, in search_func
    line_info = line_info.query.all()
AttributeError: 'NoneType' object has no attribute 'query'

My directory tree
/flask_beta
|__/app
|     |__models.py
|     |__routes.py
|     |__/templates
|                |__search_var.html
|__app.db
|__run.py
|__config.py

A: It is because of initializing line_info with None instead of import it from models file.
I hope that the following code will work.
from flask import render_template
from app import app

from models import Line_info

@app.route('/')
def search_func():
    line_info = Line_info.query.all()
    return render_template("search_var.html", line_info=line_info)

if __name__ == '__main__':
    app.run(debug = True)

A: You can't name your model line_info then use that same name for the list of instances. line_info is now a local variable, it can't also be a global name, which is why you get a UnboundLocalError exception when you remove your line_info = None line.
Use a different name for the line_info.query.all() result. You do not need to set anything to None first:
from flask import render_template
from app import app
from model import line_info

@app.route('/')
def search_func():
    lines = Line_info.query.all()
    return render_template("search_var.html", line_info=lines)

You can still use line_info in the template, although that's not really recommended either.
Instead, I recommend you rename your model to follow the Python naming conventions; Use CamelCase, with uppercase initials, no _ underscores:
class LineInfo(db.Model):
    # ...

Now it is much easier to distinguish from local variables.


text:
Q: Set ggvis scale dynamically after filtering with input_select() This is a followup to dynamic filtering with input_select() using ggvis in R .
What's wrong with this attempt to dynamically set the domain of the y scale based on the filtered data?
CYLINDER_CHOICES <- unique(mtcars$cyl)

mtcars %>%
  ggvis(~wt, ~mpg) %>%
  filter(cyl == eval(input_select(choices = CYLINDER_CHOICES))) %>%
  scale_numeric("y", domain = c(0, 10 * scales:::precision(~mpg)))

Error in min(x, na.rm = na.rm) : invalid 'type' (list) of argument

Neither ~mpg, nor .(mpg), nor .$mpg works.

A: Make sure to load dplyr first:
    library(dplyr)


text:
Q: Is there an expected performance regression with True Image? Is there an expected notable performance regression with Acronis True Image in daily business? Daily business means, I run my computer and do not perform a backup right now.
At my machine TI 2014 seems to affect the system's performance. From my observations I can tell, that I sometimes see the task TrueImageMonitor on top of my task manager (CPU load), but it is not obviously doing something (at least not a backup).
I have disabled the True Image service as a test, the monitor is gone with no obvious difference regarding True Image's functionality. There seems to be a performance improvement on my laptop with TrueImageMonitor gone. So what is this monitor good for, is it safe to disable the service?
In the past there used to be something like Non-Stop-Backup, but in Acronis TI 2014 I can not find it anymore, means I cannot disable it.
Any hints how I can my machine's performance with True Image 2014? All my backup tasks are non-scheduled but manually triggered.

A: I have been using ATI for the last 6 months and noticed no slow downs, I recommend you should reinstall True Image, and I believe that the nonstop backup feature does take up more resources than the normal backup schedule, so that might be a factor to consider, other than that, it could be just a weird issue that a reinstall should solve


text:
Q: eval for parsing JSON giving undefined I am working on Grails framework. I have 2 domain classes Country and City with one-to-many relationship. My idea is when the page is loaded the gsp will have two select boxes, one populating the countries and when any country selected the cities of that country are populated in second select box. here i am using grails ajax (jquery).
import grails.converters.JSON

class CountryController {

    def index() { redirect action: 'getCountries' }

    def getCountries() {
            def countries = Country.list()
            render view:'list', model:[countries:countries]
    }

    def getCities() {
        def country = Country.get(params.id)
        render country?.city as JSON
    }
}

When getCities action is fired i am getting the JSON as below:
[
   {
      "class":"com.samples.City",
      "id":3,
      "country":{
         "class":"Country",
         "id":2
      },
      "description":"California",
      "name":"California"
   },
   {
      "class":"com.samples.City",
      "id":4,
      "country":{
         "class":"Country",
         "id":2
      },
      "description":"Dalls",
      "name":"Dalls"
   }
]

But from my gsp page when evaluating JSON with eval function, its returning "undefined".
<g:select name="countrySelect" from="${countries}"
    optionKey="id" optionValue="name"
    noSelection="[null:'Select Country']"
    onchange="${
           remoteFunction(action: 'getCities',
               update: message,
               params: '\'id=\' + this.value',
           onSuccess:'updateCity(data)')
          }"/>
    <br/>
    City :: <g:select name="city" id="city" from=""></g:select>

Following code in  tag
<head>

    <g:javascript library="jquery"></g:javascript>
    <g:javascript>
        function updateCity(data) {
            alert('done');
            var cities = eval("(" + data.responseText + ")")    // evaluate JSON
            alert(cities)
            var rselect = document.getElementById('city')

            // Clear all previous options
            var l = rselect.length
            while (l > 0) {
                l--
                rselect.remove(l)
            }

            //build cities
            for(var i=0; i < cities.length; i++) {
                var opt = document.createElement('option');
                opt.text = cities[i].name
                opt.value = cities[i].id
                try{
                    rselect.add(opt,null) //For Non IE
                }catch(ex){
                    rselect.add(opt) //For IE
                }
            }

        }
    </g:javascript>
    <r:layoutResources />
</head>

Can anyone help me finding out where is the problem?

A: I got it solved by using JQuery each method on JSON data.
<g:javascript>
        function updateCity(data) {

            var rselect = document.getElementById('city')
            $.each(data, function(index, element) {
                //alert(element.name);

                var opt = document.createElement('option');
                if(element.name !== undefined){
                    opt.text = element.name
                    opt.value = element.id

                    try{
                        rselect.add(opt,null) //For Non IE
                    }catch(ex){
                        rselect.add(opt) //For IE
                    }
                }
             });

        }
    </g:javascript>


text:
Q: Sourcemap to original SCSS file I'm using Webpack 4 with the plugins MiniCssExtractPlugin and OptimizeCSSAssetsPlugin to extract SCSS files and minify the main.css file in production. I have source mapping enabled in my config file like so:
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");

module.exports = {
    devtool: "source-map",
    entry: {
        style: './src/scss/main.scss'
    },
    output: {
        path: path.resolve(__dirname, "dist"),
        filename: '[name].bundle.js'
    },
    module: {
        rules: [
            {
                 test: /\.css$/,
                 use: [
                     MiniCssExtractPlugin.loader,
                     { loader: 'css-loader', options: { url: false, sourceMap: true } }
                 ]
             },
             {
                 test: /\.scss$/,
                 use: [
                     'style-loader',
                     MiniCssExtractPlugin.loader,
                     {
                         loader: 'css-loader',
                         options: {
                             url: false, sourceMap: true
                         }
                     },
                     {
                         loader: 'sass-loader',
                         options: {
                             sourceMap: true
                         }
                     }
                 ]
             }
        ]
    },
    plugins: [
        new MiniCssExtractPlugin({
            sourceMap: true,
            filename: "main.css"
        }),
        new UglifyJsPlugin({
            sourceMap: true,
            test: /\.js($|\?)/i,
        }),
        new OptimizeCSSAssetsPlugin({
            cssProcessorOptions: {
                map: {
                    inline: true
                }
            }
        }) ,
        new webpack.DefinePlugin({
            'process.env.NODE_ENV': JSON.stringify('production')
        })
    ]
}

In the console, it does give the line where a CSS rules originates from, but in the bundled main.css file, rather than invididual scss files i.e. _layout.scss, _buttons.scss.
Question
What configuration do I add in order to display where the CSS rule originates from, rather then where it is located in the bundled main.css file?

A: As i can see on your sass-loader configuration, you're already getting the source maps for yous scss files (to verify that you need to have a file with the same name as you css, but with a .map on its name), so the only thing you will need is to peroperly configure your browser to load and use the source maps. This example uses Google Chrome:

*

*Open dev tools

*Click the gear icon or three dots to open settings (top right corner)

*Under General (or Preferences), look for the "Sources" section. In that section, select "Enable CSS source maps".

*Make sure the accompanying "Auto-reload generated CSS" is also enabled (if available). This last step helps to reload the CSS when it changes. Think of it like a live reload feature for the CSS alone.

*Navigate to your localhost server, inspect any element on your page.

*In the developer tools, choose the Sources tab.

*In the file tree on the left hand side, right-click your stylesheet and select "Map to file system resource…". This will bring up the file search dialog. Select the appropriate file (your stylesheet). In some newer versions of Chrome, the file should be loaded automatically using the /*# sourceMappingURL=style.css.map */ reference

*Restart the developer tools.

That should work. Let me know. Otherwise i will fine tune the quick tutorial.


text:
Q: Cross tabulation with a dataframe in python I am new to python pandas programming and trying to explore more on the cross tabulation. I have a requirement where I need to generate a cross table for multiple variables but with one constant variable. i.e. side as multiple variables and top one variable.
I have searched the web for my requirement however I could only find the cross tabulation among 2 or 3 variables only.
Coming to my requirement I have a dataset in data.csv file which I am reading as a dataframe
df = pd.read_csv('C:\Users\Desktop\data.csv')

Now I want to cross tabulate the dataframe (df) with one of the variable within this dataframe.
Like…  pd.crosstab(df, df.age, margins=True)
example,

So could anyone help in solving this issue. Many thanks for the feedback.

A: Do you know pd.pivot_table() ?
In [139]: df
Out[139]:
       a    b    c    d
0    5.1  3.5  1.4  0.2
1    4.9  3.0  1.4  0.2
2    4.7  3.2  1.3  0.2
3    4.6  3.1  1.5  0.2
4    5.0  3.6  1.4  0.2

then
In [138]: pd.pivot_table(df, index=['a','b','c'])
Out[138]:
               d
a   b   c
4.3 3.0 1.1  0.1
4.4 2.9 1.4  0.2
    3.0 1.3  0.2
    3.2 1.3  0.2
4.5 2.3 1.3  0.3
4.6 3.1 1.5  0.2
    3.2 1.4  0.2
    3.4 1.4  0.3


text:
Q: Couchbase subquery on WHERE clause So I am trying to run a query on my db that will grab the username's info based on a username and password but both are on the same table. When I run the code:
SELECT subscriberRef
FROM csp
WHERE username = "ville" AND pass = "ppp"

I get the correct reference which is "S:1" but when I subquery it in a WHERE clause like this:
SELECT *
FROM csp
WHERE META(csp).id = (SELECT subscriberRef
                     FROM csp as csp1
                     WHERE username = "ville" AND pass = "ppp")

It returns [].
WHY?????????

A: When you are getting the result from the first query you get an array of JSONs, which cannot be equivalent to a simple String.
for example for that query
SELECT  subscriberRef
FROM webinar as w
WHERE username = "ppp" AND `password` = "vvv"

you will get that result:
[
  {
    "subscriberRef": "person::1"
  }
]

the best way I can think of to solve it is to use the raw keyword, to get a simple JSON array of the values only.
SELECT  raw subscriberRef
FROM webinar as w
WHERE username = "ppp" AND `password` = "vvv"

result:
[
  "person::1"
]

and from here you can build you query:
select *
from myBucket
where meta().id in (
SELECT raw subscriberRef
FROM myBucket as w
WHERE username = "ppp" AND `password` = "vvv")

now I won't use "=" but "in" because this is an array of data (having 1 value)

A: I think it's because the result of the the subquery isn't a string, but it's an object with one field. E.g. "foo" is not the same as { "bar" : "foo"}.
I don't know if there's a way around that (there probably is), but have you considered using a JOIN to go in the other direction instead? Something like:
SELECT csp.*
FROM `default` csp1
JOIN `default` csp ON KEYS csp1.subscriberRef
WHERE csp1.username = "ville" and csp1.pass = "ppp"


text:
Q: Kafka records-lag-max variation vs records-consumed-rate Regarding Apache Kafka, would it make sense for the records-lag-max metric variation equal the records-consumed-rate metric, when we only have a single consumer of the topic?

A: Answer is no.
Frome doc, records-lag-max describes

The maximum lag in terms of number of records for any partition in this window

It is a maximum value.
records-consumed-rate describes

The average number of records consumed per second


text:
Q: Why is a figure not produced when I use the Savitzky-Golay filter and matplotlib? I have had this issue for a few years now but never tried to resolve it. I'm using python for data processing and occasionally I want to use a Savitzy-Golay filter to smooth out my data. At the same time I want to plot those results and I like using the Latex computer modern font for figure labels, etc. The problem occurs when I simultaneously use the Savitzy-Golay filter:
from scipy.signal import savgol_filter
y_filt = savgol_filter(y,51,2)

and the Latex font:
rc('font',**{'family':'serif','serif':['Helvetica']})
rc('text',usetex=True)

The script "freezes" and no plot is produced. If I comment out rc('text',usetex=True), the script runs normally and the figure is produced; however, not with the font style I want. Also, if I comment out y_filt = savgol_filter(y,51,2) and leave rc('text',usetex=True) uncommented (and use a different data smoothing algorithm), the figure is produced. Finally, the script runs fine if I don't use any plot commands. Below are the plot commands I typically use:
from matplotlib import pyplot as plt
from matplotlib import rc
import matplotlib.gridspec as gridspec

rc('font',**{'family':'serif','serif':['Helvetica']})
rc('text',usetex=True)

figx = 2
figy = 4
fig = plt.figure()
ax1 = plt.subplot2grid((1,1),(0,0))
ax1.plot(x,y_filt,color='k',lw=1)
fig.set_size_inches(figx,figy)
fig.savefig(dirFigs+'A1_extracted.pdf',dpi=600,bbox_inches='tight')

I'm at a loss as to why the script freezes when savgol_filter and rc are used. I'm running Python 3.8.3 through Anaconda on macOS 11.6.1.
Thank you in advance.


text:
Q: How to avoid the pitfalls of static analysis I'm working at a company that would score 11 on Joel Test - at least on paper.
In practice, however, nothing works quite as well as expected, and the project has been on DEFCON 1 for half a year. Now, most of my peers are happy if they can go back home at 6pm - on Sunday.
One of the apparently good practices that struck me as not working is the use of static analysis tools. The project both tracks gcc -Wall warnings and a proprietary and very expensive "C/C++" tool.
Gcc warnings do more often than not point to real(if most of the time inoffensive) bugs.
The proprietary tools, however, list things such as implicit casts and sizeof'ing a string literal. Implicit casts are also blacklisted on their stylebook.
The standard practice is that people is pressed to make every single warning shut up. Note that this does exclude warnings that are predominantly false positives, this is not the problem.
The result is:

*

*People add type casts to every rvalue and to every argument hiding real problematic type mismatches in the process.

*People introduce off by one bugs, or use a different problematic language feature.(strlen instead of sizeof, strncpy instead of strcpy, etc.)

*The warnings are silenced.

*The bug reports start rolling in.

The main point is the original code was working and written by people who were playing safe within their language abilities whereas the fixes were not.
Now, I don't really think this company can be saved. However, I would like to know if there is a better, preferably working, way to use the "pro" tools or if I should just avoid using them altogether in case I am the one making the decision in the future.
A solution which doesn't assume all programmers are geniuses that can't err. Because well, if they are, then there is no need to use the tools in the first place.

A: It is not clear whether you are asking how to fix the problem, or how you could have avoided it in the first place.  I'm assuming the latter.
It sounds like you have been relying on static analysis as your primary means of detecting and avoiding bugs.  Maybe you would have been better off focussing more on unit tests, and dynamic tools ... such as memory checkers.
It is a bad idea to rely on a tool that generates lots of false positives, especially if you can't suppress those false positives.  It encourages tired / overworked (or lazy) programmers to make "fixes" to make the warnings go away.  If you can't selectively suppress false positives (e.g. with comments) or tailor the ruleset, then you need a better tool.  Or at least, you should only use it sparingly.
It sounds like you have a problem with people being careless and / or making mistakes due to overwork.  Maybe you should have spent more time / effort in code reviews.  This directly addresses your observation that programmers are not geniuses.
Finally, it sounds like you may have been suffering under unrealistic deadlines, poor people resourcing and / or shifting requirements.  This is a management problem, and has to be addressed at that level ... or else there is a significantly elevated risk of project failure, and long-term damage to staff productivity and morale.

A: In addition to user29079's excellent answer, I would like to add one more deficiency of the C language which adds to the problem.  I was not aware of this deficiency until I moved on to Java.
The purpose of a warning is to bring to the attention of the writer and future readers of the code the fact that there is something fishy going on.  That, as a concept, is perfectly fine: the more warnings you have enabled, more fishy things you discover.
What is dead wrong, is the notion that every single little fishy thingy must be fixed at all costs, by changing code. That is what caused the problem that the OP is describing: the botched attempts to hastily make warnings go away by altering code which is working just fine.
At the same time, we don't want our code spewing out hundreds of warnings every time we compile, because pretty soon warnings become meaningless, and nobody pays any attention to new warnings anymore.
So, this seems to be a case of conflicting goals; a contradiction.
A very good solution to this seemingly impossible quandary is to be able to selectively suppress a certain warning on a statement by statement basis, so that we can suppress it precisely there where we want to indicate that we do really know what we are doing, without having to alter any code.
Java has a nice solution to this, with the @SuppressWarnings( "" ) annotation.  If you are making, say, a so-called unchecked conversion in java, the compiler issues a warning to bring this to your attention, you examine it, you determine that this is one more of those cases where you know what you are doing, so you precede the offending statement with a @SuppressWarnings( "unchecked" ) annotation which affects only the statement which immediately follows it, and you proceed with your life.
So, the warning goes away, the code remains unaltered, and the suppression annotation stands there, colored green by syntax highlighting, to document the fact that an iffy conversion is taking place, but the author promises is good. (*)  Everyone is happy.
In java you can even prefix individual parameters to functions with @SuppressWarnings(), so as to disable a specific warning which may be issued on that specific parameter only.
However, as far as I know, C never supported any standard mechanism for selectively suppressing warnings on statements, and certain compilers that implemented their own proprietary mechanisms did so in a shrewd fashion, for example the #pragma warning (nnn:N) directives of Microsoft C.  The problem with these directives is that you need two lines of directives in order to both suppress a warning for a single statement and leave that warning enabled for statements that follow.  Therefore, C programmers are highly unlikely to pick up the habit of suppressing a warning on an individual statement basis, even when they know that this particular warning on this particular statement is okay.

(*) someone might argue that if you allow this, then every programmer in the house will be suppressing warnings without giving them any thought; the answer to this is that you may do everything you can to help the programmers do their job better, but there is nothing you can do if they actively decide to sabotage you.

A: I'd say (without knowing the details) that your company has made more significant mistakes and this is just the symptom: it failed to properly determine the domain of the software produced, to manage the team properly and to define reasonable goals.
If the software your team is writing is something critical that human lives depend on, static analysis tools are important and useful. Since the "cost" of a bug, measured in money (ignoring how cynical that is) is high, there are special tools required for the job. There are guidelines for both C and C++ for safely using the language features (read what to avoid and how far to go in avoiding it).
However, in such a situation having employees work on Sunday is a very bad idea, moreover from the context you've provided, I extrapolate that sloppy work is not infrequent. So if this is the case, the problem is very very big, and your management is trying to solve it by using "better" tools. Unfortunately, that's not how things work. If I'm even close to correct, I'd go as far as suggesting that you start looking for a different job. Mission-critical software done bad is something that can haunt you and ruin your professional reputation, not to mention lawsuit prospects.
If, on the other hand, your team is writing something that is far less critical, 'static analysis' tools with a high false-positive rate will only slow you down, and, as you've noted, people usually react to this by finding the local maximum in their effectiveness, in this case by simply cheating their way around the warnings, instead of trying to fix the underlying reason. So in your situation, using these tools may actually deteriorate the quality of the source code, and they should generally be avoided.
If you need to manage a software team that is writing some C or C++ code, I'd say first determine what are the main project goals. If writing bug-free code is of utmost importance (e.g., the new super awesome social app for iOS and Android doesn't fit this), then use static analysis, maybe even go as far as formal specification and formal verification. But if this is the case, choosing good programmers and having them work in a sane environment with adequate workload and proper 40 hour week is far more important.
People cannot work responsibly if they're treated like slaves (and someone occupying my holidays is exactly this) and good programmers will simply refuse to do this on a regular basis, unless they know no better (and if they're good, chances are they do).
Bottom point: Figure your goals, then determine the tools and the process you use, don't let the available tools define the process (ergo the goals) as (bad) management might want to force you.

A:
In practice, however, nothing works quite as well as expected, and the
  project has been on DEFCON 1 for half a year. Now, most of my peers
  are happy if they can go back home at 6pm - on Sunday.

This is certainly a good chunk of your problem. A software engineer cannot work productively for more than 40hours/week. If you go above that, you do serious damage to your capacity to work- to the point at which even working 80 hours/week brings very little of value to the project, and sometimes, projects can even regress because the team introduces more errors than they can fix. If you've been doing 60 hours/week or more for half a year, then your whole team needs a good long break, and to come back at 40hours/week. You can't solve anything with a workforce that's hardly capable of bashing on the keyboard because they're so overworked.

The proprietary tools, however, list things such as implicit casts and
  sizeof'ing a string literal. Implicit casts are also blacklisted on
  their stylebook.

You really need to either just drop the tool entirely, or reconfigure/replace it. Warning on every implicit cast is far too much for anyone to deal with.

A:
I'm working at a company that would score 11 on Joel Test - at least on paper.

That test is just mildly relevant to software companies. I don't understand the hype about it. You can score 12 and still have 100% crap programmers. People matter far more than tools.

The proprietary tools, however, list things such as implicit casts and sizeof'ing a string literal. Implicit casts are also blacklisted on their stylebook. The standard practice is that people is pressed to make every single warning shut up. Note that this does exclude warnings that are predominantly false positives, this is not the problem.

This is the largest problem with all static analysers: too many false positives. The only way to handle this is to learn in detail why the tool was set to give a warning for a certain issue. Only then can you make qualified assumptions of whether a warning is false or not.
For the specific cast of implicit typecasts, it is there because of some very common, subtle and dangerous bugs in the C language, caused by the two (moronic) implicit type promotion rules in C. They are formally known as the integer promotion rules and the usual arithmetic conversions. I think less than one in ten of all professional C programmers can explain what these two rules do, and what they don't do. And yet these rules are extremely fundamental and applied thousands of times between the lines in any normal C program.
The MISRA-C standard devoted a whole chapter to explain these dangerous implicit conversion rules, and then they added numerous fairly complex rules for how to avoid bugs caused by implicit conversion. This had quite some impact on all static analysers in the market.
I would recommend any C programmer to read that MISRA-C chapter, or at the very least Google the two promotion rules I mentioned and read as much about them as you can. You can only ignore the static analyser when you know everything there is to know about these rules.

Now, I don't really think this company can be saved. However, I would like to know if there is a better, preferably working, way to use the "pro" tools or if I should just avoid using them altogether in case I am the one making the decision in the future.
A solution which doesn't assume all programmers are geniuses that can't err. Because well, if they are, then there is no need to use the tools in the first place.

There is no easy way around it. The real problem is actually not the tool, but the obscure C language. It may seem to be an easy language at a brief glance, but there are plenty of illogical and strange mechanisms going on between the lines. And there are also hundreds of cases of undefined/unspecified/impl.specific behavior in the language. Most of them you must learn and avoid.
So you must either become a veteran C programmer that understands all these obscure warnings, or you must be in a team with at least one such person. Companies that only hire a bunch of junior programmers with no veteran in the team should not use these tools, nor should they work with high-integrity software development.

A: As stated in k.steff's answer, static analysis tools for 'C' are useful if you are building software in critical situation (airplane software) and they must be used from day one (not after months of development when a un-reproducible bug occurs).
Using these kinds of tools late in the development process is usually a sign of bad design choices early in the process.
In non-critical software, these kinds of tools are useful to:
-reassure management, make them feel useful (we have done something, we have spent a lot of money to fix the software). It gives them actions that are easy to fulfill in their powerpoint reportings).
-Keep the 'toxic' developers busy. Let them configure the tool and analyze the tool results, so that you can have time to fix their nasty bugs.
-enforce coding rules. In that case it must be used from day one. But a good code review tool may be better choice.
So my opinion is you must avoid these kinds of expensive, time-consuming tools or use them to keep the 'toxic' people busy.

A:
I'm working at a company that would score 11 on Joel Test - at least on paper.

Validation by the Joel Test is not a measure of good practices; Invalidation by the Joel Test is a measure of bad/missing practices though. In other words, it can be seen as necessary, but not sufficient.

Now, most of my peers are happy if they can go back home at 6pm - on Sunday.

It looks like you have a management problem. Systematic overtime is not a solution to getting things done; if anything, it is a solution to making things look like they are working and accumulating technical debt.

Now, I don't really think this company can be saved. However, I would like to know if there is a better, preferably working, way to use the "pro" tools or if I should just avoid using them altogether in case I am the one making the decision in the future.

Yes, there is a way to use static code analysis in a sane manner.
They can, and usually do provide a lot of value. You just have to remember that, (like compiler warnings) a static analysis tool can (at most) provide hints of something going wrong - not bug reports, and no certainty whatsoever.
It sounds like your decisions makers confuse static analysis flags with application defects.

Implicit casts are also blacklisted on their stylebook.

This sounds like a management competence problem, not a static analysis problem.

The result is:
People add type casts to every rvalue and to every argument hiding real problematic type mismatches in the process.
People introduce off by one bugs, or use a different problematic language feature.(strlen instead of sizeof, strncpy instead of strcpy, etc.)
The warnings are silenced.
The bug reports start rolling in.

All these are ways to make the periodic reports look good, not ways to fix the problems in the code (it looks like you have a management competence problem, again).


text:
Q: Composite C1 - Language / Localization in Blog module I have added a second language, French, to a Composite C1 site (System/Languages/Add Language).
It works fine for content pages when I select the language (bottom right).
However - blogs do not have this option. How can I add languages to blog posts?

A: First of all, enable localization on the Blog's data types:

*

*Composite.Community.Blog.Authors

*Composite.Community.Blog.Tags

*Composite.Community.Blog.Entries

For this:
In the Data perspective:

*

*select each of the data types

*click Enable Localization on the tool bar

*and follow the wizard to finish the task

Next, translate tags and athors:
In the Content perspective / Website Items / Blog Settings:

*

*select data items below Authors and Tags

*click Translate on the toolbar to create a language copy of the item

*Then translate it

Finally, translate the blog posts likewise

*

*Expand the blog page, then Blog entries, then the date folder

*select a blog post

*cick Translate on the toolbar

*then actually translate the post to your language


text:
Q: Always show packet loss metric In Dota 2 if you input the command -ping you'll get an more accurate ping measure and also a packet loss percentage.
Is possible within the source engine to always display the packet loss just like  net_graph?

A: It's still net_graph ... here are the settings I use in my autoexec.cfg that fit my resolution:
//show net_graph properly in top right corner of screen.
net_graph 1
net_graphinsetbottom 437
net_graphinsetright -80
net_graphproportionalfont 0

A: net_graph isn't an option anymore , there is dota_hud_netgraph 1 nowadays


text:
Q: Algorithm for tricoloring a knot I have just started studying knot theory, and read about tricolorability of knots. Two knots are equivalent iff they are tricolorable. While trying to color a variety of complex knots, I tried a backtracking approach of starting with an arbitrary arc to color, coloring upto a point where there is no possibility of doing a valid coloring and then backtracking to the last point where I made a choice of color to continue with a different choice of color from there.
I wished to know if there is a standard algorithm for coloring knots.

A: For Fox $n$-colorings in general, one colors the arcs with elements from $\{0,1,\dots,n-1\}$ constrained to a certain linear equation at each crossing.  For $3$-colorings, the equation is

The reduction is using the fact that $1\equiv -2\pmod{3}$. One can check that $a+b+c\equiv 0\pmod{3}$ means that either all three variables have the same value or all have different values.
For example, here is a figure-eight knot along with the associated linear system and its matrix:

I asked Mathematica to compute the nullspace of this matrix modulo $3$ with
NullSpace[{{1, 0, 1, 1}, {1, 1, 1, 0}, {1, 1, 0, 1}, {0, 1, 1, 1}}, Modulus -> 3]

and it gave back {{1,1,1,1}}, signifying that the only tricolorings are trivial.  Therefore the figure-eight knot is not nontrivially tricolorable.
On the other hand, here is the trefoil knot:

According to Mathematica,
In[108]:= NullSpace[{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}, Modulus -> 3]

Out[108]= {{2, 0, 1}, {2, 1, 0}}

Thus the space of tricolorings is two-dimesional.  One nontrivial one is given by $a=2$, $b=0$, and $c=1$.
(To calculate the nullspace yourself, you do Gaussian elimination modulo $3$.  Then you can read off a basis for the nullspace like you would usually do in linear algebra.  It's just all done modulo $3$.)

Something I didn't mention with the above systems is that, because it turns out tricolorings are linear, you can subtract off the trivial component, letting you assume one of the variables is $0$.  You can cross off any column of the matrix to effect this assumption.  Secondly, there is a linear dependence on the rows, so you can cross off any row.  Hence, given an $n$-crossing knot, you can create an $(n-1)\times(n-1)$ matrix through this process.  The nonzero elements in the nullspace of this matrix is exactly the collection of nontrivial tricolorings.  (In one of my comments on the question, this is the matrix whose determinant is divisible by $3$ iff the knot is tricolorable.)


text:
Q: Separate a column into new columns based on the number of leading spaces These reports are coming from quickbooks, downloaded as Excel files. Notice that the left column is this nested hierarchy based on the left spacing.
I need to separate Description column into separate columns based on the number of leading spaces on the left.
As I've been working with financial reports recently, these are super common and extremely difficult to work with. Is there a package or function for importing this type of data?

Here is example reproducible input dataframe:
df1 <- structure(list(Description = c("asset", " current asset", "   bank acc",
                                      "    banner", "    clearing",
                                      "   total bank accounts",
                                      " total current assets"),
                 Total = c(NA, NA, NA, 10L, 20L, 30L, 30L)),
            .Names = c("Description", "Total"),
            class = "data.frame",
            row.names = c(NA, -7L))

A: You can try tidyxl and unpivotr for these Excel wrangling tasks. Here are the docs:

*

*unpivotr: https://github.com/nacnudus/unpivotr

*tidyxl: https://nacnudus.github.io/tidyxl/
Here's a nice tutorial: https://blog.davisvaughan.com/2018/02/16/tidying-excel-cash-flow-spreadsheets-in-r/

A: I think the real question is:

*

*"How do I treat number of leading spaces to indicate nth column?"
If so, then try this example, code could be improved, but the idea is every leading space indicates nth column.
# example input, we will have similar input after reading in
# the Excel sheet into R.
df1 <- data.frame(x = c("x1", " x2", " x2", "  x3", "x1", " x2"),
                  y = c(NA,      22,    33,      44,   55,   66),
                  stringsAsFactors = FALSE)

library(dplyr)

cbind(
  bind_rows(
  lapply(df1$x, function(i){
    x <- data.frame(t(strsplit(i, split = " ")[[1]]), stringsAsFactors = FALSE)
    colnames(x) <- paste0("col", 1:ncol(x))
    x
    })
  ),
  df1[, "y", drop = FALSE])

#   col1 col2 col3  y
# 1   x1 <NA> <NA> NA
# 2        x2 <NA> 22
# 3        x2 <NA> 33
# 4             x3 44
# 5   x1 <NA> <NA> 55
# 6        x2 <NA> 66


text:
Q: Is it feasible to extract persons associated to named entity organizations? I am new to text extraction and I would like to extract company names from a text and people associated to the company. I'm thinking of using Spacy to extract these individual parts but I'm not sure whether I'll be able to find the associations, since multiple companies and people will be mentioned within the same text. For example, from the following text:
Wozniak left Apple in 1983 due to a diminishing interest in the day-to-day running of Apple Computers. Jobs then hired PepsiCo's John Sculley to be president. However, this move backfired and after much controversy with Sculley, Jobs left in 1985 and went on to new and bigger things. He founded his own company NeXT Software and he also bought Pixar from George Lucas
I would like to pull out companies and people to make the associations (at the very least):
Apple - Wozniak,
PepsiCo - John Sculley,
Jobs - NeXT Software, Pixar - George Lucas.
Any guidance would be appreciated, thank you.

A: It depends on how insidious your data are. I would start first with a heuristic using Spacy and match PERS entities with the closest ORG entity. This might get already good results.
If this does not work good enough. I would recommend manually fixing outputs of this algorithm and try to train a classifier using BERT (with the transformers package, it is easier than you might think). But for that, you would need several hundreds of annotated pairs.


text:
Q: How to rebuild condition with associative array to enum Hello guys is have a condition and its works, but I need rebuild it to enum and enum does not work with my old condition. p.s. teamlead said

*

*My working case is:
        const basketAccepts = {
        0: ['Values'],
        1: ['Rows', 'Columns']
      }

const basketAcceptValues = isOver && visualType === 'matrix' && !basketAccepts[Number(!dragItem.Measure)].includes(basketName)

When I hover some div some css things are happening

*

*basketName - string (Values, Rows, Columns) can be all or one depend of visualType

*dragItem.Measure = boolean

So I need it rebuild for same case but for enum.
enum basketAccepts {
'Values' = 0,
'Rows' = 1,
'Columns' = 1,

}

A: I used the ternary operator to decide the value of each enum property as if it's cointained or not at index zero of basketAccepts being one or zero respectively. So this logic assumes that all those 3 conditions will appear on the other set [1] if they are not contained in the first one.
I actually couldn't verify it because I'm not used to TypeScript. Please let me know if it worked.

const basketAccepts = {
    0: ['Values'],
    1: ['Rows', 'Columns']
};

enum basketAccepts {
  //use value 0 if 'Values' appears in basketAccepts[0] otherwise 1
  'Values' = basketAccepts[0].includes('Values') ? 0 : 1,
  //use value 0 if 'Rows' appears in basketAccepts[0] otherwise 1
  'Rows' = basketAccepts[0].includes('Rows') ? 0 : 1,
  //use value 0 if 'Columns' appears in basketAccepts[0] otherwise 1
  'Columns' = basketAccepts[0].includes('Columns') ? 0 : 1
}

console.log(basketAccepts);

A: Not sure why your after using enums,  enums in TS are none standard, and were implemented before the Dev's decided to strictly follow ES proposals, so personally I would avoid them.
But if you must still use them then this might help.
If you look at what TS converts your enum into ->
{
  "0": "Values",
  "1": "Columns",
  "Values": 0,
  "Rows": 1,
  "Columns": 1
}

What we could do then is use Object.entries and Array.some.
eg..
enum basketAccepts {
  'Values' = 0,
  'Rows' = 1,
  'Columns' = 1,
}

const basketName = 'Rows';
const measure = true;

console.log(
   Object.entries(basketAccepts).
      some(([k,v ]) =>
         k == basketName && Boolean(v) == measure)
);

A: Thanks guys for help, any way I remade it in a bit other way. Hope it help to some one.
export enum FieldType {
  Dimension,
  Measure
}

 const fieldCompatibilities = {
    [FieldType.Dimension]: ['Columns', 'Rows'],
    [FieldType.Measure]: ['Values']
 }

const basketAcceptValues = isOver && visualType === 'matrix' && !fieldCompatibilities[Number(dragItem.Measure)].includes(basketName)


text:
Q: Azure Broker Service and SqlTableDependency I am trying to use SqlTableDependency in an MVC application, but I get the following error:
"Invalid object name 'sys.login_token'."
The connection string used by SqlTableDependency is correct as I also use it for the entire application.

A: To enable SQL SERVER Service Broker on Azure, you need to have a SQL Managed Instance Object instead of SQL Database on Azure. to more detail take a look at this link.


text:
Q: How to get MAC address of client System in Javascript? I am getting answer in PHP but its not working because of session.
//Get the ipconfig details using system commond
system('ipconfig /all');
// Capture the output into a variable
$mycomsys=ob_get_contents();
// Clean (erase) the output buffer

$find_mac = "Physical"; //find the "Physical" & Find the position of Physical text
$pmac = strpos($mycomsys, $find_mac);
// Get Physical Address
$macaddress=substr($mycomsys,($pmac+36),17);
ob_clean();
//Display Mac Address
exec("/sbin/ifconfig eth0 | grep HWaddr", $output);
print_r( $output);die();

This fulfils my requirement but not running for my applications, So I am in need of the same in JavaScript.


text:
Q: Mutate multiple variables based on a given condition I have the following data:
  library(dplyr)

     d <- data_frame(
      region = c('all', 'nj', 'rkl', 'all'),
      figures= c(5, 7, 4, 8),
      figures2 = c(3, 5, 6, 7))

I would like to use dplyr to say when 'region' = 'all' then turn 'figures' and 'figures2' to 'x'. I don't want to use mutate to create new variables, I want to change the values in the variables that already exist. So the data would look like this:
  d2 <- data_frame(
          region = c('all', 'nj', 'rkl', 'all'),
          figures= c(x, 7, 4, x),
          figures2 = c(x, 5, 6, x))

I think I need something like this:
 d %>% mutate_at(vars(1:3), funs(ifelse(region = 'all', 'x', .)))

However, this doesn't quite work.

A: You were on the right path with mutate_at:
d %>%
  mutate_at(vars(2:3), list(~ ifelse(region == 'all', 'x', .)))

Output:
# A tibble: 4 x 3
  region figures figures2
  <chr>  <chr>   <chr>
1 all    x       x
2 nj     7       5
3 rkl    4       6
4 all    x       x

You can just replace 'x' with a number if needed.
EDIT.

*

*I also think that replace is a better alternative, you could just do d %>%
mutate_at(vars(2:3), list(~ replace(., region == 'all', 'x'))) as well;

*Moreover, as noted by @Moody_Mudskipper, no need for list with newest dplyr version, so mutate_at(2:3, ~ ifelse(region == 'all', 'x', .)) would do the job as well.

A: One way with mutate and replace:
d %>%
  mutate(figures = replace(figures, region == 'all', 10)) %>%
  mutate(figures2 = replace(figures2, region == 'all', 10))

# A tibble: 4 x 3
  region figures figures2
  <chr>    <dbl>    <dbl>
1 all         10       10
2 nj           7        5
3 rkl          4        6
4 all         10       10

I am using 10 here as your x

A: An option would be be also to use case_when
library(dplyr)
d %>%
   mutate_if(is.numeric, list(~ case_when(region == "all" ~ 'x',
                                         TRUE ~ as.character(.) )))
# A tibble: 4 x 3
#  region figures figures2
#  <chr>  <chr>   <chr>
#1 all    x       x
#2 nj     7       5
#3 rkl    4       6
#4 all    x       x

A base R compact option would be
d[d$region == "all", -1] <- "x"


text:
Q: Can somebody help me to find the problem? MySQL/sub query I'm trying to insert a 'rank' data derived by users' point. But every time I insert using sub query, it returns NULL value.
create table rank_info(
rank_num INT,
min_point INT,
max_point INT,
primary key(rank_num)
);

create table user(
    num INT,
    name varchar(45),
    point INT,
    user_rank INT,
    primary key(num),
    foreign key(user_rank) references rank_info(rank_num)
);

    insert into rank_info values (1, 200, 300);
insert into rank_info values (2, 100, 199);
insert into rank_info values (3, 0, 99);
insert into user values(1, 'jake', 150,
(select rank_num from (
(select rank_num from rank_info, user
 where  user.point between min_point and max_point))
 a ));

<< This is where I'm stuck at.
Thank you, always.

A: You should use an update with join  (and not an insert )
 update  user  u
 inner join  rank_info  r on u.point between r.min_point and r.max_point
 set u.rank_num = = r.rank_num


text:
Q: email-inline.css in Magento Transactional emails not working I have a question regarding Magento transactional emails.
The problem is with email-inline.css:
 {{inlinecss file="email-inline.css"}}

They just do not work.
Everything is alright when I sent emails locally but when I push the Code and send from live shop, they don't work.
I have checked everything and I have no clue what can be the problem.
Have anyone maybe the same problem and maybe a solution?
Thank you

A: External css file doesn't work in most email provider, because most webmail clients will block links to external stylesheets for security considerations.
You have to write the css inline, like
Title
, that works for me.
Some css grammar may not work in some email clients, so you have to test the email as many different email clients as you can possibly get access to.

A: Probably the permissions for the file are not set correctly. I had similar issue.

email-inline.css


text:
Q: Omitting a digit in a string using grepl in R I'm using the grepl function to try and sort through data; all the row numbers are different survey respondents, and each number in the "ANI_type" string represents a different type of animal - I need to sort these depending on animal type. For example, the "2"s under ANI_type represent cats. I thought I had it figured out with the following, but it's not only including the "2", but any digit that contains a "2" as well. How can I get this to work so that it ONLY includes "2"?
Thanks so much, I'm incredibly new at this!
> animals$cats <- as.numeric(grepl("2", animals$ANI_type))
> animals
                                                    ANI_type dogs cats repamp
1                              1,2,5,12,13,14,15,16,18,19,27    1    1   TRUE
2                                                          2    0    1  FALSE
3                                             20,21,22,23,26    1    1   TRUE
4                                                20,21,22,23    1    1   TRUE
5                                                         13    1    0   TRUE
6                                                          2    0    1  FALSE
7                                                   20,21,22    1    1   TRUE
8                                                20,21,22,23    1    1   TRUE
9                                                   20,21,22    1    1   TRUE
10                                             5,20,21,22,27    1    1   TRUE
11                                              1,2,20,21,22    1    1   TRUE
12                                       5,18,20,21,22,23,26    1    1   TRUE
13                                                     20,21    1    1   TRUE
14                                                        21    1    1   TRUE
15                                                     20,21    1    1   TRUE
16                                                  20,21,26    1    1   TRUE
17                                                         2    0    1  FALSE
18                                                       1,2    1    1   TRUE
19                                                         2    0    1  FALSE
20                                                       3,4    0    0  FALSE

Furthermore, I need to group some of the digits in the strings into categories. For example, digits 6,7,8,9,10,11 all need to be placed in the animals$pock object. How would I go about that using the grep function? Just use alot of the boundary tokens?

A: You can use the boundary token (\\b):
grepl("\\b2\\b", animals$ANI_type)

But intead of relying on regex you may want to structure the data so that each animal is on its own row.  You can use tidyr::separate_rows() for this:
library(tibble)
library(tidyr)

animals %>%
  rowid_to_column(var = "id") %>%
  separate_rows(ANI_type, sep = ",", convert = TRUE)


text:
Q: Usage "reason for the" or "reason of the"? When you want to know why someone is requesting for something when writing an email, which should be used?

May I know the reason of/for the request?

Is there a difference between the two? Thanks.

A: X of Y expresses a relationship - X is part of Y; Y is a "container" and X is in it.
X for Y expresses a purpose/answers the question why? - Y is X's purpose/destiny.

May I know the reason of the request?

This sounds like the request is written on a form, and one of the lines on that form is "Reason: ______" and you want to know what that is.

May I know the reason for the request?

This is equivalent to saying "May I know why this request was made?"
Do both arrive at the same meaning?  Yes, they are practically equivalent ... but the first one sounds much more formal as of implies the request was a "container" that possibly had several things that needed to be specified/known/committed before becoming an official request.


text:
Q: Extract tweets and the users only from a particular location using R I want to compare the brand knowledge (Ex : Sony) in Dublin and London. How will you select the tweets only from those locations with the user name who tweeted it? I tried for the London one with the geocode option, But it returned zero. This is my code:
tweets <- searchTwitter(
    "@Sony", n = 1000, since = "2014-01-01",
    lang = "en", geocode = "51.5074, 0.1278"
)

Is there a better way to do this?

A: You need to remove the spaces in the geocode parameter, and you also need to specify a distance representing a radius against the lat/long point you specify.  For example, if you wanted a radius of 50km, you would use this:
tweets <- searchTwitter(
    "@Sony", n = 1000, since = "2014-01-01",
   lang = "en", geocode = "51.5074,0.1278,50km"
)

From the twitteR documentation:

geocode - If not NULL, returns tweets by users located within a given radius of the given latitude/longitude.

and

For the geocode argument, the values are given in the format latitude,longitude,radius, where the radius can have either mi (miles) or km (kilometers) as a unit. For example geocode='37.781157,-122.39720,1mi'.

Notice carefully that there are no spaces in the geocode parameter.


text:
Q: Moved PHP Site behind Nginx Reverse Proxy I have moved the websites running from a standard Apache server config to a Docker container based platform with everything sat behind a (primary container) Nginx reverse proxy. Mostly this has been simple & seamless.
However, I am now troubleshooting the outlier cases. The current one is PHP sessions within another web server container...
All I have done is to create a docker container using the "php:7.2-apache" and enabling the mysqli extension. This container is pointed to the same source html/php location.
The site has a simple login function, using PHP sessions, that previously worked. The login.php page has a form that submits to itself. If user/pass variables are in the $_SESSION variable, and matches up against a database query, it should redirect the user to the actual "hidden" edit.php page. But it never gets there! Watching the log files (I have suppressed Warnings logging due to another issue to resolve...) doing the above produces a return 200 of the login.php page.
Trying to debug putting print_r($_SESSION) statements, $_SESSION is empty.
Is there something else I need to do or change to get my previous behaviour back? What else occurs / behaves differently behind an Nginx reverse proxy?
login.php code:
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Website</title>
    <!-- Bootstrap -->
    <link href="../css/bootstrap.css" rel="stylesheet">
    <link href="../css/bootstrap-theme.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <script>
        $(document).ready(function(){
            $('[data-toggle="popover"]').popover();
        });
    </script>
</head>
<body>
    <?php
        if(empty($_SESSION)){
            print("empty");
        }

        if(isset($_POST['submit'])){
            $theuser = $_POST['username'];
            $thepassword = $_POST['password'];
        }

        if(!empty($_POST)){
            $mysqli = new mysqli('mysqlhost','user','pass','db_name');
            $query = "SELECT username, password FROM users WHERE username = '$theuser'";

            $results = $mysqli->query($query);
            $login_ok = false;

            while($row = $results->fetch_assoc()) {
                if($thepassword === $row['password']){
                    session_start();
                    $_SESSION['user'] = $row;
                    $login_ok = true;
                }
            }
            $results->close();
            $mysqli->close();

            if ($login_ok) {
                header("Location: https://www.website.com/edit.php");
            }
            else{
                print("Login Failed.");
                $submitted_username = htmlentities($_POST['username'], ENT_QUOTES, 'UTF-8');
            }
        }
    ?>
<div class="container">
    more html stuff....
</div>
</body>

At the top of the edit.php file, I have:
<?php
    session_start();
    include 'functions.php';
    print_r($_SESSION);

    if(empty($_SESSION['user']))
    {
        header("Location: login.php");
        die("Redirecting to login.php");
    }
?>

But I don't think that I am even hitting this page, as there is nothing in the logs... All I see is the return 200 from login.php:

w.x.y.z - - [04/Aug/2018:09:09:09 +0000] "POST /login.php HTTP/1.1"
  200 889 "https://www.website.com/login.php" "Mozilla/5.0 (Macintosh;
  Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko)
  Version/11.1 Safari/605.1.15"

The IP address in the line above (w.x.y.x) is the internal Docker network range, if this matters(?). PHP's $_GET & $_POST variables work as expected and contain appropriate values.
EDIT: ADDED TROUBLESHOOTING / DIAGNOSTICS...
Following details found on other pages and threads, I have also checked some other aspects. As my session.save_path variable is set to "no value", it writes to /tmp within the container. I have connected to the console session and verified this directory exists and there are files within it. What other checks could or should I do, if there might be issues with this?
What other testing can I perform? Logging I can enable? etc.


text:
Q: extracting row specified by a dictionary using pandas I have a large dictionary where each key corresponds to a list. For example
dictionary = {'1':[391,183,117,193,971],'2':[8817,38103,6163,173],'3':[8173,137,984,9173]}

And I have a dataframe with 1837391 rows in total. My dataframe looks like as follows:
ID    start      end      name
1      29        120      Peter
2      130       200      Sarah
3      10        20       Nikki

Now I want to count all those rows where the values fall in the intervals as specified by start and end column for each of the key separately.
For example for key 1 117,183,193 falls in the interval so it should return 3. Because 117 will be found in row 1 of my dataframe and 183 and 193 in row 2. How can I achieve that? Insights will be appreciated.

A: Use dict comprehension
{
    k: sum(1 for i in v if i >= df.start.min() and i <= df.end.max())
    for k, v in dictionary.items()
}

Output
{'1': 3, '2': 1, '3': 1}