text:
Q: genymotion BSOD windows 10 I am new to android development, following a tutorial i downloaded android studios and genymotion. whenever i press start on genymotion  my computer instantly crashes.
I have posted below the minidump from the crash.
any help is greatly appreciated
specs
windows 10
genymotion 5.1.22
SYSTEM_SERVICE_EXCEPTION (3b)
An exception happened while executing a system service routine.
Arguments:
Arg1: 00000000c0000096, Exception code that caused the bugcheck
Arg2: ffffc58204c408b3, Address of the instruction which caused the bugcheck
Arg3: ffffc581ffd36c70, Address of the context record for the exception that
caused the bugcheck
Arg4: 0000000000000000, zero.

Debugging Details:
------------------

TRIAGER: Could not open triage file :
e:\dump_analysis\program\triage\modclass.ini, error 2

EXCEPTION_CODE: (NTSTATUS) 0xc0000096 - {EXCEPTION}  Privileged instruction.

FAULTING_IP:
+92760
ffffc582`04c408b3 0f22e0          mov     cr4,rax

CONTEXT:  ffffc581ffd36c70 -- (.cxr 0xffffc581ffd36c70)
rax=0000000000000274 rbx=ffffc582035ee340 rcx=0000000000000000
rdx=ffffc582035ee340 rsi=0000000000000000 rdi=0000000000000000
rip=ffffc58204c408b3 rsp=ffffc581ffd37678 rbp=0000000000000000
 r8=0000000000024cc0  r9=ffffc582035ee000 r10=0000000000000000
r11=ffffd9099d23a020 r12=0000000000000206 r13=000000000022821c
r14=ffffd9099b61a140 r15=0000000000000030
iopl=0         nv up di pl nz na po nc
cs=0010  ss=0018  ds=002b  es=002b  fs=0053  gs=002b             efl=00000006
ffffc582`04c408b3 0f22e0          mov     cr4,rax
Resetting default scope

CUSTOMER_CRASH_COUNT:  1

DEFAULT_BUCKET_ID:  CODE_CORRUPTION

BUGCHECK_STR:  0x3B

PROCESS_NAME:  VBoxHeadless.e

CURRENT_IRQL:  0

LAST_CONTROL_TRANSFER:  from ffffc58204c40732 to ffffc58204c408b3

STACK_TEXT:
ffffc581`ffd37678 ffffc582`04c40732 : 00000000`00000010 fffff802`f8125166
ffffc581`00000000 fffff802`f8192760 : 0xffffc582`04c408b3
ffffc581`ffd37680 00000000`00000010 : fffff802`f8125166 ffffc581`00000000
fffff802`f8192760 00000000`000004df : 0xffffc582`04c40732
ffffc581`ffd37688 fffff802`f8125166 : ffffc581`00000000 fffff802`f8192760
00000000`000004df 00000000`00000000 : 0x10
ffffc581`ffd37690 ffffc581`00000000 : fffff802`f8192760 00000000`000004df
00000000`00000000 00000000`03fa4c10 : VMMR0+0x25166
ffffc581`ffd37698 fffff802`f8192760 : 00000000`000004df 00000000`00000000
00000000`03fa4c10 00000000`00000000 : 0xffffc581`00000000
ffffc581`ffd376a0 00000000`000004df : 00000000`00000000 00000000`03fa4c10
00000000`00000000 ffffc581`00000003 : VMMR0+0x92760
ffffc581`ffd376a8 00000000`00000000 : 00000000`03fa4c10 00000000`00000000
ffffc581`00000003 fffff802`f589c64c : 0x4df

MODULE_NAME: memory_corruption

IMAGE_NAME:  memory_corruption

FOLLOWUP_NAME:  memory_corruption

DEBUG_FLR_IMAGE_TIMESTAMP:  0

MEMORY_CORRUPTOR:  LARGE

STACK_COMMAND:  .cxr 0xffffc581ffd36c70 ; kb

FAILURE_BUCKET_ID:  X64_MEMORY_CORRUPTION_LARGE

BUCKET_ID:  X64_MEMORY_CORRUPTION_LARGE

Followup: memory_corruption

A: Disable Hyper-V in Windows man ... Worked here


text:
Q: Can Python be invoked against a script file with a parameter-name for the script filepath? Does anyone know if the python3 command on Linux can have some sort of SOME_NAMED_OPTION=filename.py after it rather than just calling python3 filename.py?
I have a job scheduling tool I'd like to execute a Python script with that's kind of dumb.
It can only run Linux CLI commands commandname param1 param2 param3 or as commandname AAA=param1 BBB=param2 CCC=param3.
There's an existing business convention of putting filename.py as param #1 and then just making sure your script has a lot of comments about what the subsequent numerically ordered sys.argv list members mean, and you set the scheduling tool into its first mode, so it runs python3 filename.py world mundo monde, but it'd be awesome to be able to name the scheduling tool's parameters #2+ so I can write more human-friendly Python programs.
With python3 -h I'm not finding a way to give a parameter-name to filename.py, but I thought I'd see if anyone else had done it and I'm just missing it.
It'd be cool if I could have my scheduling tool run the a command more like python3 --scriptsource=filename.py --salut=monde --hola=mundo --hello=world and then write filename.py to use argparse to grab hola's, hello's, and salut's values by name instead of by position.

A: You can create a python file to be executed as a script like in the example bellow:
    #!/usr/bin/python3  # path to python in your system

    print('This is a script!')

If your python file is named test.py you can execute as ./test.py if the file has permission to be executed. To grant execution permission to your file use the command chmod +x test.py

A: Using the Shebang as suggested by @daniboy000 is the preferred method for doing this, but if for some reason you can't do that, you should be able to do python3 mycommand --arg1 --arg2=x

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why do I have a mpicc installation error? Hi I am trying to use an mpi program. To compile it, I need mpi compiler but when I am installing it I have an error.
sudo apt-get install openmpi-bin openmpi-common libopenmpi-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  ibverbs-providers libfabric1 libhwloc-dev libhwloc-plugins libhwloc5
  libibverbs-dev libibverbs1 libnl-route-3-200 libnuma-dev libnuma1
  libopenmpi3 libpmix2 libpsm-infinipath1 libpsm2-2 librdmacm1
  ocl-icd-libopencl1
Suggested packages:
  libhwloc-contrib-plugins openmpi-doc opencl-icd
Recommended packages:
  libcoarrays-openmpi-dev
The following NEW packages will be installed:
  ibverbs-providers libfabric1 libhwloc-dev libhwloc-plugins libhwloc5
  libibverbs-dev libibverbs1 libnl-route-3-200 libnuma-dev libopenmpi-dev
  libopenmpi3 libpmix2 libpsm-infinipath1 libpsm2-2 librdmacm1
  ocl-icd-libopencl1 openmpi-bin openmpi-common
The following packages will be upgraded:
  libnuma1
1 upgraded, 18 newly installed, 0 to remove and 252 not upgraded.
Need to get 5 271 kB/5 624 kB of archives.
After this operation, 22,4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err:1 http://archive.ubuntu.com/ubuntu cosmic-updates/main amd64 libnuma1 amd64 2.0.11-2.2ubuntu0.1
  404  Not Found [IP: 91.189.88.152 80]
...

Thanks for your cooperation.

A: Per https://wiki.ubuntu.com/CosmicCuttlefish/ReleaseNotes

Ubuntu 18.10 was supported for 9 months until July 2019. If you need
  Long Term Support, it is recommended you use Ubuntu 18.04 LTS instead.

Your best bet is to upgrade to a newer distro (or downgrade to 18.04).
You might also be able to find some mirrors and use them to install the missing packages.

A: You need to update your sources.list and use a different mirror.
As described in this post, you should replace in your /etc/apt/sources.list all urls with http://archive.ubuntu.com/… by http://old-releases.ubuntu.com/….
Then you run sudo apt update, and you can install your packages again.
Note that you really should consider to upgrade while it's still not too much of a pain.


text:
Q: Python Multiprocessing of parallel cases I have sets of simulations that each uses MPI to run in parallel (they are CFD simulations). However, I would like to create a pool of tasks in Python and run that in parallel. I used the multiprocessing library as follows:
import itertools
import multiprocessing

def Run_Cases(params):
    run_each_mpi_simulation

a = range(1,len(U)); b = range(len(R))
paramlist = list(itertools.product(a,b))
pool = multiprocessing.Pool()
pool.map(Run_Case,paramlist)

so basically, the code creates the pool of tasks (simulation instances) and assign them to each processors to run. However, it does not take into account that each simulation requires lets say 2 processors as each case is a parallel (MPI) simulation. This result in significant performance drop in the simulations.
Hereby, I was wondering if it is possible to somehow define the number of processors that get assigned to each task in Python multiprocessing package?
Any comments is highly appreciated.
Kind regards
Ashkan
EDIT/UPDATE:
Thank you so much @AntiMatterDynamite for your answer.
I tried your approach and the performance and work load distribution on the processors improved a lot but it seems there are 2 issues:
1) I get the following message although everything continues
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 1073, in run
    self.function(*self.args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/PyFoam/Execution/FoamThread.py", line 86, in getLinuxMem
    me=psutil.Process(thrd.threadPid)
  File "/usr/local/lib/python2.7/dist-packages/psutil/__init__.py", line 341, in __init__
    self._init(pid)
  File "/usr/local/lib/python2.7/dist-packages/psutil/__init__.py", line 381, in _init
    raise NoSuchProcess(pid, None, msg)
NoSuchProcess: psutil.NoSuchProcess no process found with pid 8880

I would highly appreciate your comments.
Many thanks again
Ashkan
EDIT/UPDATE:
I believe the message was because the number of processes were less than the list of processors. As I had two cases/simulations with each using 2 processors, when I was using hyper-threading I had 8 processors so getting the message. It was resolved using 4 processors or having larger pool of simulations.

A: multiprocessing.Pool accepts the number of processes to create as its first argument.
you can use multiprocessing.cpu_count() to get the number of logical cpu cores then create half as many processes in the pool (so each gets 2)
 multiprocessing.Pool(multiprocessing.cpu_count()/2)

this assumes that your cpu count devides by 2 which for almost any cpu out there is true...
note that this solution does not account for SMT (or hyperthreading) since multiprocessing.cpu_count() counts logical cores so it might report double your physical cores. for most cpu intensive tasks SMT is a performance boost, you run double the tasks but at more than half the speed, if you do have SMT you need to decide whether or not its good for your simulation
lastly you could also set the affinity of each process so that it can only run on 2 cores
but there is no straightforward standard way to do this since multiprocessing doesn't expose the PID of the processes it opens. here's some rough complete code that can set the affinities for each process:
import multiprocessing
import psutil
import itertools

cores_per_process = 2
cpu_count = multiprocessing.cpu_count()

manager = multiprocessing.Manager()
pid_list = manager.list()  # trick to find pid of all the processes in the pool

cores_list = range(cpu_count)
it = [iter(cores_list)] * cores_per_process  # this is a python trick to group items from the same list together into tuples
affinity_pool = manager.list(zip(*it))  # list of affinity

def Run_Case(params):
    self_proc = psutil.Process()  # get your own process
    if self_proc.pid not in pid_list:
        pid_list.append(self_proc.pid)  # found new pid in pool
        self_proc.cpu_affinity(affinity_pool.pop())  # set affinity from the affinity list but also remove it so other processes can't use the same affinity
    #run simulation

a = range(1, len(U))
b = range(len(R))
paramlist = list(itertools.product(a, b))
pool = multiprocessing.Pool(cpu_count/cores_per_process)  # decide on how many processes you want
pool.map(Run_Case, paramlist)


text:
Q: How can I share a folder with Samba on a NTFS drive on startup? On startup, I want a certain folder on an automounted NTFS drive (mounted on /media/Data), of which I've got ownership, to be shared with Samba. It should grant access to guests, but they shouldn't be able to edit or delete the files in there.
What is the best way to share a folder with this configuration on Samba on startup?

A: Not really sure why you've assumed terminal commands are the way to share folders with Samba. They are not.
What you need to do, assuming samba is already installed, is edit /etc/samba/smb.conf, a samba config file, and add the share to the bottom.
Example:
[some_name]
    path = /media/Data/folder_name
    writeable = no
    guest ok = yes

Hope that helps.


text:
Q: Custom style listdivider I'm trying to style the default ListView list divider to have margins of whitespace on both sides. I already tried to set the margins of the entire ListView but that didn't create the desired result.
What i have:

What i'm trying to make (notice the margins on both sides of the dividers):

What would be the best way of doing this? Thanks in advance!

A: use <include layout="@layout/divider" /> and custom layout for line. like this:
main.xml :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

<ListView android:id="@+id/listview"
    android:layout_width="wrap_content"
    android:divider="@layout/divider"
    android:dividerHeight="3sp"
    android:layout_height="wrap_content" />
</LinearLayout>

divider.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <gradient
        android:startColor="#00000000"
        android:centerColor="#FFFFFF"
        android:endColor="#00000000" />
    <corners
        android:radius="4dp" />
</shape>

AndroidlistviewdividerActivity.class
public class AndroidlistviewdividerActivity extends Activity {
    /** Called when the activity is first created. */
    private ListView lv;
    private String listview_array[] = { "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX",
                                    "SEVEN", "EIGHT", "NINE", "TEN" };
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        lv = (ListView) findViewById(R.id.listview);
        lv.setAdapter(new ArrayAdapter<String>(this,
        android.R.layout.simple_list_item_1, listview_array));
        lv.setTextFilterEnabled(true);
        lv.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                long arg3) {
                // TODO Auto-generated method stub
                 AlertDialog.Builder adb = new AlertDialog.Builder(
                        AndroidlistviewdividerActivity.this);
                 adb.setTitle("ListView OnClick");
                 adb.setMessage("Selected Item is = "
                    + lv.getItemAtPosition(arg2));
                 adb.setPositiveButton("Ok", null);
                 adb.show();
            }
      });
    }
}

A: I would suggest creating your own ListAdapter and setting it into your ListView.  Then in its getView method you can style individual list items in any way you want.


text:
Q: How do I access my usb keyboard firmware in ubuntu? I bought a mechanical keyboard recently and im trying to access the firmware just to poke around and mess with it. However, Im unable to figure out how exactly go about this. I've looked at some other posts that tell me to access /lib/udev/rules.d but that didn't help. I'm trying to access the keyboard's firmware and see if I can change key-press values and mess with the LED on my keyboard. Some help with this would be appreciated.

A: I think you meant driver. Your keyboard is able to handle usb commands and they should be detailed into a datasheet and a subset of those used in the keyboard host driver so ubuntu can receive input from the keyboard.
A good idea would be to look for example code from the manufacturer/hobbyists, but this does not need to be into the ubuntu driver: I had an Alienware computer with LEDs on the keyboard and Alienware supplied example C project to compile and use the driver to do whatever you want.


text:
Q: Optimization by perturbing variable My main script contains following code:
%# Grid and model parameters
nModel=50;
nModel_want=1;
nI_grid1=5;
Nth=1;
nRow.Scale1=5;
nCol.Scale1=5;
nRow.Scale2=5^2;
nCol.Scale2=5^2;

theta = 90; % degrees
a_minor = 2; % range along minor direction
a_major = 5; % range along major direction
sill = var(reshape(Deff_matrix_NthModel,nCell.Scale1,1)); % variance of the coarse data matrix of size nRow.Scale1 X nCol.Scale1

%#  Covariance computation

% Scale 1
for ihRow = 1:nRow.Scale1
    for ihCol = 1:nCol.Scale1
        [cov.Scale1(ihRow,ihCol),heff.Scale1(ihRow,ihCol)] = general_CovModel(theta, ihCol, ihRow, a_minor, a_major, sill, 'Exp');
    end
end

% Scale 2
for ihRow = 1:nRow.Scale2
    for ihCol = 1:nCol.Scale2
        [cov.Scale2(ihRow,ihCol),heff.Scale2(ihRow,ihCol)] = general_CovModel(theta, ihCol/(nCol.Scale2/nCol.Scale1), ihRow/(nRow.Scale2/nRow.Scale1), a_minor, a_major, sill/(nRow.Scale2*nCol.Scale2), 'Exp');
    end
end

%# Scale-up of fine scale values by averaging
[covAvg.Scale2,var_covAvg.Scale2,varNorm_covAvg.Scale2] = general_AverageProperty(nRow.Scale2/nRow.Scale1,nCol.Scale2/nCol.Scale1,1,nRow.Scale1,nCol.Scale1,1,cov.Scale2,1);

I am using two functions, general_CovModel() and general_AverageProperty(), in my main script which are given as following:
function [cov,h_eff] = general_CovModel(theta, hx, hy, a_minor, a_major, sill, mod_type)
% mod_type should be in strings

angle_rad = theta*(pi/180); % theta in degrees, angle_rad in radians
R_theta = [sin(angle_rad) cos(angle_rad); -cos(angle_rad) sin(angle_rad)];
h = [hx; hy];
lambda = a_minor/a_major;
D_lambda = [lambda 0; 0 1];
h_2prime = D_lambda*R_theta*h;
h_eff = sqrt((h_2prime(1)^2)+(h_2prime(2)^2));

if strcmp(mod_type,'Sph')==1 || strcmp(mod_type,'sph') ==1
    if h_eff<=a
        cov = sill - sill.*(1.5*(h_eff/a_minor)-0.5*((h_eff/a_minor)^3));
    else
        cov = sill;
    end
elseif strcmp(mod_type,'Exp')==1 || strcmp(mod_type,'exp') ==1
    cov = sill-(sill.*(1-exp(-(3*h_eff)/a_minor)));
elseif strcmp(mod_type,'Gauss')==1 || strcmp(mod_type,'gauss') ==1
    cov = sill-(sill.*(1-exp(-((3*h_eff)^2/(a_minor^2)))));
end

and
function [PropertyAvg,variance_PropertyAvg,NormVariance_PropertyAvg]=...
    general_AverageProperty(blocksize_row,blocksize_col,blocksize_t,...
    nUpscaledRow,nUpscaledCol,nUpscaledT,PropertyArray,omega)
% This function computes average of a property and variance of that averaged
% property using power averaging

PropertyAvg=zeros(nUpscaledRow,nUpscaledCol,nUpscaledT);

%# Average of property
for k=1:nUpscaledT,
    for j=1:nUpscaledCol,
        for i=1:nUpscaledRow,
            sum=0;
            for a=1:blocksize_row,
                for b=1:blocksize_col,
                    for c=1:blocksize_t,
                        sum=sum+(PropertyArray((i-1)*blocksize_row+a,(j-1)*blocksize_col+b,(k-1)*blocksize_t+c).^omega); % add all the property values in 'blocksize_x','blocksize_y','blocksize_t' to one variable
                    end
                end
            end
            PropertyAvg(i,j,k)=(sum/(blocksize_row*blocksize_col*blocksize_t)).^(1/omega); % take average of the summed property
        end
    end
end

%# Variance of averageed property
variance_PropertyAvg=var(reshape(PropertyAvg,...
    nUpscaledRow*nUpscaledCol*nUpscaledT,1),1,1);

%# Normalized variance of averageed property
NormVariance_PropertyAvg=variance_PropertyAvg./(var(reshape(...
    PropertyArray,numel(PropertyArray),1),1,1));

Question: Using Matlab, I would like to optimize covAvg.Scale2 such that it matches closely with cov.Scale1 by perturbing/varying any (or all) of the following variables
1) a_minor
2) a_major
3) theta
I am aware I can use fminsearch, however, how I am not able to perturb the variables I want to while using this fminsearch.

A: I won't pretend to understand everything that you are doing. But it sounds like a typical minimization problem. What you want to do is to come up with a single function that takes a_minor, a_major and theta as arguments, and returns the square of the difference between covAvg.Scale2 and cov.Scale1. Something like this:
function diff = minimize_me(a_minor, a_major, theta)
    ... your script goes here
    diff = (covAvg.Scale2 - cov.Scale1)^2;
end

Then you need matlab to minimize this function. There's more than one option here. Since you only have three variables to minimize over, fminsearch is a good place to start. You would call it something like this:
opts = optimset('display', 'iter');
x = fminsearch( @(x) minimize_me(x(1), x(2), x(3)), [a_minor_start a_major_start theta_start], opts)

The first argument to fminsearch is the function you want to optimize. It must take a single argument: a vector of the variables that will be perturbed in order to find the minimum value. Here I use an anonymous function to extract the values from this vector and pass them into minimize_me. The second argument to fminsearch is a vector containing the values to start searching at. The third argument are options that affect the search; it's a good idea to set display to iter when you first start optimizing, so that you can get an idea of well the optimizer is converging.
If your parameters have restricted domains (e.g. they must all be positive) take a look at fminsearchbnd on the file exchange.
If I have misunderstood your problem, and this doesn't help at all, try posting code that we can run to reproduce the problem ourselves.


text:
Q: Store Two Integer Multiplication Result not using int,Long,Double,String,BigDecimal in Java So Question was like there is an method that is taking two int values as an parameters and we have to store the multiplication of those two integers but not in int,Long,Double,BigDecimal,String. The range of the result(multiplication) would be beyond from Integer range.
---- method(int a,int b){
      return a*b;
   }

So dashes in method signature denotes the desired return type that interviewer was exactly looking for.

A: You could either use long primitive type or return java.lang.Number object type (which is supertype of all numeric boxed types in java):
public Number method(int a, int b){
    return (long)a * b;
}

Just note that you must cast either one of the variables to long.
Attention: This solution requires that the body of the method be modified!

A: you could probably use the following snippet:
public boolean[] method(int a, int b){
    boolean[] bits = new boolean[64]; // max amount of long bits
    for(long l = 0, bit = 1; l < bits.length; l++){
        bits[(int) l] = (((long) a * b) & bit) == bit;
        bit <<= 1;
    }
    return bits;
}

This piece of code uses simple bit operations, to fill a boolean array which represents the product as bits. (true for 1, false for 0)
As you're never allowed to store the calculation anywhere. You need to calculate it everytime.


text:
Q: O que é parameter sniffing? Já ouvi falar de parameter sniffing. Alguma coisa a ver com SQL Server, stored procedures, e parametros. Mas o que é exatamente?

A: Quando uma stored procedure vai ser executada pela primeira vez, o SQL Server compila o procedimento e gera um plano de ação, que fica armazenado no cache, e é utilizado nas chamadas subsequentes à essa mesma procedure.
Isso é feito dessa forma para evitar que o processo de compilar a procedure seja repetido a cada chamada, por ser uma tarefa que consome muitos recursos da CPU.
Porém, há um detalhe importante: nesse processo de compilação da procedure, o SQL Server busca montar o melhor plano de ação possível. O plano de ação ótimo. Na montagem desse melhor plano, o compilador considera o valor dos parâmetros - é aí que está o parameter sniffing: é o compilador de procedures do SQL Server espiando o contéudo dos parâmetros enviados para a procedure a fim de elaborar e montar o melhor plano de ação a ser armazenado em cache e reutilizado depois.
Isso descreve como o SQL Server opera normalmente.
A questão do parameter sniffing torna-se importante quando ocorre que o "melhor plano de ação" para uma determinada procedure difere consideravelmente de acordo com o valor do parâmetro. Isso tem o potencial de gerar a desagradável situação: na primeira chamada, quando a compilação acontece, pode ser utilizado um parâmetro que gera uma plano de ação que pode ser ótimo para aquele parâmetro. Porém, numa chamada posterior, pode acontecer de que um valor diferente para o parâmetro tenha uma performance terrível usando aquele plano de ação que foi o melhor para o outro valor do parâmetro, passado anteriormente.
O desenvolvedor precisa conhecer esse mecanismo do parameter sniffing para se precaver da situação mencionada. Ou seja, é um mecanismo que a princípio serve para otimizar a performance, mas que pode vir a resultar no seu oposto, prejudicando a performance.
Fonte: https://www.simple-talk.com/sql/t-sql-programming/parameter-sniffing/
(Na matéria usada como fonte, as soluções para evitar os problemas gerados pelo parameter sniffing são abordadas.)


text:
Q: Queuing with impatience I am considering simple M/M/1 queue with customer impatience. Customer waits and leaves the system if the delay before service is more than an exponential
wait time. Arrival rate is $\lambda$, service rate is $\mu$, and abandonment rate due to delay is $\lambda_W$.
I assume state probabilities $p_n$ are known.
My problem is to find expected wait time given that customer receives service.
My approach to the problem is very simple:

*

*if customer finds one customer in the system average queueing delay is  $E[S_1 | S_1 < W]$ = $\frac{1}{\mu + \lambda_w}$, where $S_1$ is the random variable of service time (~exp($\mu$)), and $W$ is the exponential delay.

*Similarly, if customer finds 2 customer in the system average queueing delay is the conditional expectation $E[S_1 + S_2 |S_1 + S_2 < W ] = \frac{1}{\mu + \lambda_w} + \frac{1}{\mu + 2\lambda_w}$

*If customer finds $n$ customer  in queue and successfully receives service, total queuing delay until service time begins is the sum of $n$ independent exponentials with rates $\mu +\lambda_w$, $\mu+2\lambda_w$, $\mu +3\lambda_w$...$\mu+n\lambda_w$. Thus, the expectation of queueing delay is $\frac{1}{\mu +\lambda_w}+...+\frac{1}{\mu + n \lambda_w}$
Thus, average delay $\overline{W}_q$  conditioning on states is
$\overline{W}_q = \sum_{i=1}^{\infty} E[S_n| S_n <W] p_n $.
The result I obtained from this approach does not agree with simulation results. I don`t know where I am doing wrong?

A: So, to begin with, your expectations are shifted over by one: $\frac{1}{\mu + \lambda_w}$ is the expected waiting time, given that a customer doesn't leave, when there were no other customers in line. $\frac{1}{\mu + \lambda_w} + \frac{1}{\mu + 2\lambda_w}$ is the expected waiting time, given that a customer doesn't leave, when there was one other customer in line, and so on. But that's a minor error.
The real killer is that if we adjust for this, we get the final expression $$\sum_{n=0}^\infty \left(\frac{1}{\mu + \lambda_w} + \cdots + \frac{1}{\mu + (n+1)\lambda_w}\right) p_{n} \tag{1}$$ which is still wrong: instead of $p_n$, you should have the conditional probability that there are $n$ customers, given that the next customer to arrive gets served. These are not independent events: the next customer to arrive is much more likely to get impatient first if there are 100 customers already in line.
So you'll need to explicitly figure out the probability (call it $q_n$) that a customer that's behind $n$ others in line will be served before getting impatient. This is not too hard: we have $q_0 = \frac{\mu}{\mu + \lambda_w}$, and more generally, $q_n = \frac{\mu + n \lambda w}{\mu + (n+1) \lambda_w} \cdot q_{n-1} = \frac{\mu}{\mu + (n+1)\lambda_w}$. Then we can find the overall probability that a customer is served: $q = \sum_{n=0}^\infty p_i q_i$.
Finally, to make $(1)$ correct, we should replace $p_{n}$ by the conditional probability, which is (via Bayes's formula) $\frac{p_{n} q_{n}}{q}$.


text:
Q: Is there a way to explicitly detatch an implicitly linked DLL? This is not for production code, this is for a unit test.
We have a legacy DLL which frees resources on a DLL_PROCESS_DETACH event. We had a crash scenario in the static destruction phase of an executable because the destructor of a static variable was trying to access resources unmapped by the DLL (dangling reference).
I'd like to reproduce this crash scenario in a unit test so I can prove I've fixed it.

A: You may be able to get a handle to the module with GetModuleHandle(LPCTSTR lpModuleName), and pass that to FreeLibrary().
The documentation for GetModuleHandle() states:

The GetModuleHandle function returns a handle to a mapped module without incrementing its reference count. However, if this handle is passed to the FreeLibrary function, the reference count of the mapped module will be decremented. Therefore, do not pass a handle returned by GetModuleHandle to the FreeLibrary function. Doing so can cause a DLL module to be unmapped prematurely.

Despite the warning not to do so, that sounds like it is exactly what you are looking to do. This should be fairly easy to test in your scenario, to verify that it does what you want.


text:
Q: Allow applications to access online meetings on behalf of a user The functions described in the following article do not exist in any of the powershell packages that I can find for Teams/Skype.
https://learn.microsoft.com/en-us/graph/cloud-communication-online-meeting-application-access-policy
New-CsApplicationAccessPolicy
Grant-CsApplicationAccessPolicy
Looking for a way to Allow applications to access online meetings on behalf of a user - anyone have suggestions here?

A: It won't be any part of existing package of your powershell installation. You need an administrator or owner level user of your subscription to import it.
Have your admin user follow the below steps:

*

*Open Powershell in admin mode

*type Install-Module MicrosoftTeams

*type Y

*type Set-ExecutionPolicy -ExecutionPolicy AllSigned -Scope CurrentUser

*type
Import-Module MicrosoftTeams
$sfbSession = New-CsOnlineSession
Import-PSSession $sfbSession

After that, your admin person can run the New-CsApplicationAccessPolicy and Grant-CsApplicationAccessPolicy for you.


text:
Q: Where are 'wine' program execution logs stored? Or how I can start *.exe with wine in console?
Run with wine menu item gives such result:
nothing happens and no errors.

A: If you need error logs for an application that crashes with a graphics anomaly that leaves you unable to view the terminal output (as happened to me) simply redirect the output to a file that you can examine later as I did.
wine /path/to/program.exe > wine.error.log
Edit:
If you want a log created every time you launch a program with wine alias can help you do this.
alias wine='wine 2>wine.error.log' will create a log in the directory where the executable is stored every time. The 2 specifies that stderr will be redirected to the log file specified. If for some reason you want to store this file where your other logs are kept (not recommended) you can adjust the output path accordingly as in  alias wine='wine 2>/var/log/wine.error.log If you want to locate all the wine error logs so that you can review them find is useful for this:
find $HOME -iname *.error.log 2>/dev/null
This launches find starting in your home directory. the -iname switch tells it to ignore case (you could use -name instead which matches case but force of habit on my part) *.error.log is the filename we are looking for (you could use wine.error.log instead but I don't want to type that much.) And finally here >2/dev/null is redirecting stderr to the bit bucket (/dev/null) so that we ignore any "Permission denied" output we may have otherwise received.
Note: I have not tested this in scenarios where wine is launched with parameters other than just the program to be launched.

A: The wine run logs are hidden typically, they're not stored anywhere.
To get the Wine logs for a specific executable, you need to run it via the terminal with the wine command.
wine /path/to/program.exe

Note you need the full path here, or you need to first cd into the directory where the .exe is stored.


text:
Q: How to store post id in local storage from Single.php file The following code in Single.php file is not working as expected. $post->ID and is_user_logged_in()   are getting null values. If all works fine i can have the post id as array in local storage.
<script>
    window.onload = function() {
        var logged_in='<?php echo is_user_logged_in() ?>';
        if (logged_in==false || logged_in==0) {

                var myArray =  JSON.parse(localStorage.getItem('articles') )|| [];
                var article_postid='<?php echo $post->ID ?>';

                //check already read? if not push into array
                index = is_exist.call(myArray, article_postid);
                if(!index){
                    myArray.push(article_postid);
                    localStorage.setItem('articles', JSON.stringify(myArray));
                }
        }
    }
    var is_exist = function(article_postid) {
        // Per spec, the way to identify NaN is that it is not equal to itself
        var findNaN = article_postid !== article_postid;
        var indexOf;
        if(!findNaN && typeof Array.prototype.indexOf === 'function') {
            indexOf = Array.prototype.indexOf;
        } else {
            indexOf = function(article_postid) {
                var i = -1, index = -1;
                for(i = 0; i < this.length; i++) {
                    var item = this[i];
                    if((findNaN && item !== item) || item === article_postid) {
                        index = i;
                        break;
                    }
                }
                return index;
            };
        }
        return indexOf.call(this, article_postid) > -1;
    };
    </script>

A: Please try this code.
Add this code to your activated theme's functions.php file and check.
function add_js_code_to_footer(){

    if( is_singular( 'post' ) ){
    global $post;
    ?>
        <script>
            window.onload = function() {
                var logged_in='<?php echo is_user_logged_in() ?>';
                if (logged_in==false || logged_in==0) {

                        var myArray =  JSON.parse(localStorage.getItem('articles') )|| [];
                        var article_postid='<?php echo $post->ID ?>';

                        //check already read? if not push into array
                        index = is_exist.call(myArray, article_postid);
                        if(!index){
                            myArray.push(article_postid);
                            localStorage.setItem('articles', JSON.stringify(myArray));
                        }
                }
            }
            var is_exist = function(article_postid) {
                // Per spec, the way to identify NaN is that it is not equal to itself
                var findNaN = article_postid !== article_postid;
                var indexOf;
                if(!findNaN && typeof Array.prototype.indexOf === 'function') {
                    indexOf = Array.prototype.indexOf;
                } else {
                    indexOf = function(article_postid) {
                        var i = -1, index = -1;
                        for(i = 0; i < this.length; i++) {
                            var item = this[i];
                            if((findNaN && item !== item) || item === article_postid) {
                                index = i;
                                break;
                            }
                        }
                        return index;
                    };
                }
                return indexOf.call(this, article_postid) > -1;
            };
        </script>

    <?php
    }

}
add_action("wp_footer","add_js_code_to_footer");


text:
Q: KendoUI grid edit popup, how to hide field Is there a way to hide a field in edit popup that should still be visible in the grid itself?
I have tried setting it to hidden:true, but kendo seems to ignore it.
When editable is set to false, it hides the textbox but field label is still shown. Is it possible to get rid of both label and textbox?
My datasource:
schema: {
    total: "Total",
    data: "Data",
    model:{
        id:"Id",
        fields:{
            Id:{ visible: false, editable:false },
            Name:{ editable:true },
            NumberOfUsers:{ hidden:true, editable:false }
        }
    }
}

A: To hide a field simply add this to the view model:
[ScaffoldColumn(false)]
public int Id { get; set; }

And if you want to keep the filed and just be hidden, do like this:
@(Html.Kendo().Grid<ViewModel>()
.Name("grid")
.Columns(columns =>
{
    columns.Bound(m => m.Id).Hidden()
    columns.Bound(m => m.Name)
}))

A: Similar solution worked for me:
edit: function(e) {
    e.container.find("label[for=yourFieldName]").parent("div .k-edit-label").hide();
    e.container.find("label[for=yourFieldName]").parent().next("div .k-edit-field").hide();
},

A: If you are using UI for ASP.NET MVC, You can use the following approach where you can not only hide control itself but also hide FirstParent div which is occupying space on front-end.
Add Event handler
Html.Kendo().Grid<ProductDTO>()
        .Name("GRVProducts")
        .Columns(c =>
            {
                c.Bound(p => p.ProductID);
                c.Bound(p => p.Name);
                c.Bound(p => p.Price);
            }
        )
        .Events(events=> events.Edit("HideGridFields"))

Add Javascript
<script type="text/javascript">
    function HideGridFields(e)
    {
        HideControl("ProductID", e); //Hide ProductID control with Label and parent tag. No space occupied ;)
    }

    function HideControl(fieldName, e)
    {
        var cont = $(e.container);
        HideFieldLabel(cont.find("label[for='"+fieldName+"']"));
        HideFieldField(cont.find("#" +fieldName));
    }

    function HideFieldLabel(control)
    {
        control.parent(".editor-label").hide();
    }

    function HideFieldField(control) {
        control.parent(".editor-field").hide();
    }
</script>

Hide ProductID control with Label and Parent tag. No space occupied on frond-end ;)

A: for exemple have field PK_:
 edit: function(e) {

    e.container.find("input[name='PK_']").hide();
    e.container.find("label[for='PK_']").hide();
}

A: Similar solution worked for me:
edit: function(e) {
    e.container.find(".k-edit-label:first").hide();
    e.container.find(".k-edit-field:first").hide();
},

A: There is no such option as "hidden: true" and this is why it is being ignored. You can use the edit event of the grid to hide some element from the popup window:
$("#grid").kendoGrid({
  edit: function(e) {
     e.container.find("input:first").hide();
  }
});

A: If you are using Html.Kendo().Grid<>() for ASP.NET MVC, you should do this:
Add Edit event handler to .Events in your control attributes like this:
.Events(e => e.Edit("hideIdField"))

Where "hideIdField" is your js event handler function.
In EventHandlers.js, add this function:
function hideIdField(e) {
    $("#ProductID").hide();
    $("label[for='ProductID']").hide();
}

Where ProductID is the name of your Id field from your source model.

A: I like the answer @jfl gives, and it's useful to take that idea and extend it to a nice, reusable setup.
Why? There's a brittleness to keeping track of what the ordinal of the column is that you need to hide. That is, @jfl's answer only works for the first fieldset/column, and even the version in my quick comment requires that the order and potentially number of columns doesn't change.
Instead, you can standardize how you hide columns by placing a property in the columns' declaration, and then check for it in the edit event handler that is invoked after the popup is displayed. You get a reference to the full columns declaration in the edit event, so we've got a lot of flexibility.
I've got a full example at this fiddle, but here it is in brief:
I've added a hideMe property in the column declarations:
columns: [
    { field: "name" },
    { field: "position" },
    {
        field: "age",
        hideMe: true              // <<< This is new.
    },
    { command: "edit" }
],

Then, building on the answer & comment mentioned earlier, I have this in my edit handler:
e.sender.columns.forEach(function (element, index /*, array */) {
    if (element.hideMe) {
        e.container.find(".k-edit-label:eq(" + index + "), "
            + ".k-edit-field:eq( " + index + ")"
        ).hide();
    }
});

No more column ordinal tracking needed. You can add columns, change orders, hide new ones, whatever just by changing what has hideMe on it. (Looking back, I probably should've called that hideMeOnEdit, but you get the point.)

A: As an alternative to using the loop's index as displayed in the answer given by ruffin, it is also a possibility to acquire the column's corresponding label index by searching for the for attribute matching the iterated column's field. Kendo's default template automatically generates
a for attribute for all editor labels.
var labels = e.container.find('.k-edit-label');

e.sender.columns.forEach(function (element) {
    if (element.hideMe) {
        var index = labels.find('label[for="' + element.field + '"]').parent().index();
        if (index !== 0) //Prevent a potential zero division
            index = index / 2;

        e.container.find(".k-edit-label:eq(" + index + "), " + ".k-edit-field:eq( " + index + ")").hide();
    }
});

A: Create a function like this:
function noEditor(container, options) {
    container.prevObject.find("div[data-container-for='" + options.field + "']").hide();
    container.prevObject.find("label[for='" + options.field + "']").parent().hide();
}

And then in your field, set the editor property as follows:
columns: [
    { field: "Field1", title: "Field 1", editor: noEditor },
    { field: "Field2", title: "Field 2" },
    { field: "Field3", title: "Field 3" },
    { field: "Field4", title: "Field 4", editor: noEditor }
]

This way you can easily hide more than one field in the popup editor.  In this case, Field1, Field2, Field3 and Field4 will be displayed in the grid, but Field1 and Field4 will not be displayed in the popup editor.

A: Don't forget the option of using the data annotation on the model:
[HiddenInput(DisplayValue = false)]

(if your model is based on ASP.NET MVC)

A: Extending the answer given by ruffin for Typescript 1.x
in the grid edit event:
 , edit: function (e) {
         e.sender.columns.forEach((element, index) => {
               var ele: any = element;
               if (ele.attributes != undefined) {
                    if (ele.attributes.hideMe) {
                        e.container.find(".k-edit-label:eq(" + index + "), "
                        + ".k-edit-field:eq( " + index + ")"
                       ).hide();
                    }
               }
         });
     }

and in the column add the hideMe element as attribute:
  columns: [
             {
                field: "Id",
                title: "", width: 1,
                attributes: { hideMe: true }
             },
   ...

This is necessary because typescript report as an error one column field that it is not declared.

A: Answer is here:
Kendo-ui MVC PopUp editor: How to hide fields
and here:
http://www.telerik.com/forums/editing-grid-via-popup-mode-hide-fields

A: *

*set in datamodel class " [ScaffoldColumn(false)] " like this
public class studentdata
{
           [ScaffoldColumn(false)]
           public int Id { get; set; }
           public string Name { get; set; }
    }

this will hide an id in the popup.
this is for UI for ASP.NET MVC

A: Similar to the answers provided by ruffin and Danny Bogers, we have been using the hideMe property, and in the edit event, calling the following function.
As you can see, this allows you to hide fields from any edit, from only new items, or only existing items.
// Code to look for 'hideMe', 'hideOnNew' or 'hideOnEdit' attribute on a column.
// Call from within kendoGrid({edit:function(e)})
function hideNonEditColumns(e) {
    let nonFieldColCount = 0;
    e.sender.columns.forEach(function (element, index) {
        if (!element.field) {
            nonFieldColCount++; //Count number of command elements to skip at beginning of the grid
        }
        let adjIndex = Number(index) - Number(nonFieldColCount);

        if (element.hideMe
            || (element.hideOnNew && e.model.isNew())
            || (element.hideOnEdit && e.model.isNew() == false)) {
            e.container.find(".k-edit-label:eq(" + adjIndex + "), .k-edit-field:eq( " + adjIndex + ")").hide();
        }
    });
}


text:
Q: Typescript: how to setup a button that clears score? In my index.html I have this button:
<button class="restart-current-game">Restart current game</button>
And I have this code in my game.ts file:
 restartCurrentGame() {
    score = 0;
    alert("Score is back to 0");
  }

How can I call this function by clicking the button?

A: Attach an event listener to the on click event  of the button, then connect that button to your restartCurrentGame() function.
Your typescript won't be accepted by the browser by default since it only understands javascript so you will need to to transpile your typescript into javascript or use a package manager (like node.js) to install a package like typescript-compile to run that code directly in a script tag.
EDIT:
I see that you've completely changed the question. Make a seperate post in the future.

A: You may listen to dblclick event:

document.querySelector('.player-name').addEventListener('dblclick', function () {
  this.outerHTML = `<input value="${this.innerHTML}">`
})
 Player one

A: You may have an input with a display none style. the b element will appear will have a double click event attached to it.
When the element will be doubled click, we will change the b element style to display none and the input style to display block.

function onDblClick(e) {
  e.currentTarget.style.display = 'none';
  document.querySelector('#hidden-input').style.display = 'block';
}
 Player one
 <input id="hidden-input" style="display:none;" type="text" />

A: I suggest you to read more about Typescript meaning because it's just a way to write javascript with a strict syntax but it's compiled to javascript so to execute it you need a compiler.
Using b tag
Playground: https://jsfiddle.net/youdede/2fjhqyav/45/
If you are forced to use the b tag you can use the attribute contenteditable:
Player ID

and your javascript function can be like this:
let changeName = (id)=>{
    let el = document.getElementById(id);
  el.focus();
  el.contentEditable = (el.contentEditable === 'false') ? "true" : "false";
}

Using input instead of b tag
Playground: https://jsfiddle.net/youdede/2fjhqyav/23/
This is the best solution in my opinion. You can use an input tag with readonly attribute and on ondblclick listener:
<input type="text" class="player-name" id="player-ID" value="Player N" ondblclick = "changeName('player-ID')" readonly>

Your ondblclick function (I called changeName(id)) can be like this:
let changeName = (id)=>{
  let readonly = document.getElementById(id).readOnly;
  document.getElementById(id).readOnly = !readonly;
}

To better display the 2 statuses of your input, you can define your css like this:
.player-name[readonly]{
  border:none;
  outline:none;
}


text:
Q: Edit title-tag in wp_head with yoast seo I want to manipulate the html-title tag, so <title> these not the content of the title-tag!
I use child-themes and it's inevitable, because the template have to be easy to update.
So I have to use the functions.php or the header.php in the child-folder.
At moment I try it with the functions.php
At moment I have following situation:

<title>My awesome title-content</title>
<meta name="robots" content="noindex,follow,noodp,noydir"/>
<link rel="canonical" href="WEBSITE" />
<meta property="og:locale" content="de_DE" />

and I want to have these situation:
The focus are on the title-tag

<title itemprop="name" id="company_name">My awesome title-content</title>
<meta name="robots" content="noindex,follow,noodp,noydir"/>
<link rel="canonical" href="WEBSITE" />
<meta property="og:locale" content="de_DE" />

my current try in the functions.php in the child-folder are:
add_action('get_header', 'blog_template_add_ob_start');
add_action('wp_head', 'blog_template_add_ob_end_flush', 100);
function blog_template_add_ob_start() {
    ob_start('blog_template_add_filter_wp_head_output');
}
function blog_template_add_ob_end_flush() {
    ob_end_flush();
}
function blog_template_add_filter_wp_head_output($output) {

    if (is_single()) {
        $output = preg_replace('/<title>(.*?) - (.*?)<\/title>/', '<title>$2 » $1</title>', $output);
        #$output = str_ireplace('<meta property="og:url" content="' . $url . '" />', '<meta     property="og:url" content="' . esc_attr(esc_url($altUrl)) . '" />', $output);
    }
    return $output;
}

my first try was these:
first:
function add_itempromp_to_title( $str )
{
    #$str = preg_replace('/<title>(.*?) - (.*?)<\/title>/', '<title>$2 » $1</title>', $str);
    return $str;
}
add_filter( 'wp_head', 'add_itempromp_to_title', 99 );

I had try these:
Manipulating wp_head content
but isn't work anymore.
Does anyone have an idea?
The Yoast-Plugin-Version are 1.5.3.3
The WP-Version are 3.8.3

A: I don't think adding  to the <title> is a good idea... If you can not use any existing tags like
 for that, you may consider adding meta tag: <meta itemprop="name" content="Company Name">. You can add this using wp_head, but keep in mind it should be within itemscope.
If you really going after changing title tag, Yoast SEO has it's own filter 'wpseo_title', so you need to call that one.

add_filter('wpseo_title', 'filter_title');
function filter_title($title) {
    // do something to the $title here
    return $title;
}

A: I still don't know why you're trying to pass the item property through the head tag.  I have a gut feeling you're trying to tell Google abut a particular item.  For example:

*

*itemprop is brown_shoes

*itemprop is red_hat

In each of these cases, you want Google to know that you sell brown shoes or a red hat.
This would be better suited if you created a wp_products table in your database, and in that table, put the following:

*

*product_id - This will be the Primary Key

*product_desc - Description

*product_image - URL to image

*product_price - Price

*product_keywords - These will be keywords that you can pass to the meta tag

Create a ProductPage Template, using a Custom WP_Query and this Plugin, URL Params, to pass the product_id field to every page.  In the HEAD SECTION of the template add:
<meta name="keywords" content="<? php echo $product_keywords; ?>"
Since PHP completes the WP_Query before rendering the page, this is perfectly acceptable.


text:
Q: How to import Google Tests xml results to VSTS We use Google Test (gtest) for tests in our C++ based solution.
We build it in VSTS to run on Windows.
When we run test .exe it produces test_detail.xml file with results of the test run:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1152" failures="0" disabled="0" errors="0" time="8.57" name="AllTests">
  <testsuite name="testTrim" tests="10" failures="0" disabled="0" errors="0" time="0.041">
    <testcase name="trimEmptyString" status="run" time="0" classname="testTrim" />
...

How to import this file to VSTS?
It would be ideal if gtests are recognized and displayed on build Summary page, even if it's just pass\fail, no details of the errors.

A: Turned out that the format of test_detail.xml (report produced by gtest) is JUnit, so it's very easy to import into VSTS, as described here:
https://www.visualstudio.com/en-us/docs/test/continuous-testing/getting-started/continuous-test-java


text:
Q: Rails: image exists but is not rendered in production even though rendered in development There are similar questions like this, this, this, and this, but they don't address the problem.
We have a locally stored image that is rendered in the development environment.
In production, however, the image doesn't render. Accessing the image URL from the browser gets redirected to the 404 page because the image isn't found for some reason. Other images in the same directory are rendered without issue.
Details :-

*

*Image 1 URL: https://test.com/designs/thumbnails/foo/bar1.jpg

*Image 2 URL: https://test.com/designs/thumbnails/foo/bar2.jpg

*Entering both image URLs directly into the browser yields different results. Image 1 will render, but image 2 won't. Image 2 redirects to the 404 page.

*This isn't a caching issue, rendering in incognito fails.

*Both images exist in the directory.

*This seems to occur for new images, though the pattern isn't clear (i.e., some new images render but not all do).

*Image rendering code: <img class="thumbnail" src="<%= design["thumbnailURL"] %>"> where design["thumbnailURL"] is an relative URL to the image (which, yes, does exist).

*We use Rails 3.2 and Cloudflare.

*Server stack:

*

*Passenger AppPreloader Version: 6.0.2

*Instance: ElIQgS48 (nginx/1.15.8 Phusion_Passenger/6.0.2)

*Ruby version: ruby 2.1.2p95

*Operating system: CentOS Linux release 7.6.1810 (Core)

*PHP 7.0.33

*Server version: 5.5.60-MariaDB MariaDB Server

*Postfix mail_version = 2.10.1

*Dovecot version: 2.2.36 (1f10bfa63)

A: If you host your files in public folder and don't use assets pipeline, it is often the job of the HTTP webserver (apache, nginx ...) to serve static files directly. They do that well and fast.
Please give more details about your production hosting setup (webserver, config etc), as well as the urls generated by Rails for your pictures. I'll update the answer accordingly, with relevant webserver config so that your static files get served directly.

A: I just looked at you example https://www.test.com/designs/thumbnails/foo/bar1.jpg and then I inspected yout image tag and I saw  I was able to update it to  and I was able to see your logo.
you can update your erb from <img class="thumbnail" src="<%= design["thumbnailURL"] %>"> to <img class="thumbnail" src="/<%= design["thumbnailURL"] %>"> or you can make sure to inclue the "/" in the value for the design["thumbnailURL"] I hope that this is of help

A: Do you use assets pipeline?
if yes, do precompile first by
RAILS_ENV=production rails assets:precompile

then try
# attempt 1
<img class="thumbnail" src="<%= 'assets/' + design["thumbnailURL"] %>">
# because the images would be compiled and under public/assets/
# I don't know exactly what's design["thumbnailURL"] contain, so I list this attempt

# attempt 2
<%= image_tag design["thumbnailURL"], alt: '...', class: 'thumbnail' %>
# image_tag will also append SHA256 suffix in the filename
# in production environment, all the assets will be appended a SHA256 to let the browser know its the latest assets, ex: aaa.jpg will be aaa-908e25f4bf641868d8683022a5b62f54.jpg, it may be the cause the browser cannot find the right one and return 404

# attempt 3
# if you don't want the images being precomiled, just put original images under public/ rather than app/assets/images/
# design["thumbnailURL"] should be the relative path to public/
# and you can remain your  same in view
# however, if you update the image, the users who already have been to your site would cache the old image and your new image will not be shown on their browser

deploy the new code and see if it works


text:
Q: For every finitely generated ideal $I\subset A$ the map $I\otimes_A M\rightarrow A\otimes_A M$ is injective, then $M$ is flat. In the book I'm reading, there haven't been given any proof for the following theorem, since it's "obvious". I'm trying to prove it myself, but seem to have a bit of troubles.

Let $A$ ring and $M$ an $A$-module. If for every finitely generated
  ideal $I\subset A$ the map $I\otimes_A M\rightarrow A\otimes_A M$ is
  injective, then $M$ is flat.

So I know, what I have to prove is, that given an exact sequence $\ldots\rightarrow N'\rightarrow N \rightarrow N''\rightarrow \ldots $, I want to show that $\ldots\rightarrow N'\otimes_A M\rightarrow N \otimes_A M \rightarrow N''\otimes_A M\rightarrow \ldots $ is exact. I know that you can split long exact sequences into short exact sequences, and that tensor product is right exact. So I guess it would be enough to show that given $N\rightarrow N'$ injective, then $N \otimes_A M\rightarrow  N'\otimes_A M$ should be injective?
I'd also say that submodules of $A$ are ideals of $A$, hence we have injective $N \otimes_A M\rightarrow A \otimes_A M\cong M$ and $N'\otimes_A M\rightarrow A\otimes_A M\cong M$. However this is where I'm stuck.

A: Note that the hypothesis is that for every finitely generated ideal $I$ of $A$,
$\mathrm{Tor}_1^A(A/I,M) = 0$. Indeed, from the exact sequence
$0\to I\to A\to A/I\to 0$ we get the exact sequence
$$0\to \mathrm{Tor}_1^A(A/I,M)\to I\otimes_A M\to A\otimes_A M \to A/I \otimes_A M\to0$$
since $A$ is flat. Thus $\mathrm{Tor}_1^A(A/I,M)$ is the kernel of your map, and hence zero iff it is injective. Now I claim that

*

*Since every ideal is the filtered colimit of its f.g. ideals, tensor products commute with these, and filtered colimits are exact, your hypothesis holds for every ideal.

*Every module is the filtered colimit of its cyclic submodules, which are all isomorphic to $A/I$ for some ideal $I$.

*Because $\otimes_A M$ commutes with filtered colimits, so does $\mathrm{Tor}_1^A(?,M)$, which means that for any module $M'$,
$$\mathrm{Tor}_1^A(M',M) = \mathrm{colim}_{I} \mathrm{Tor}_A^1(A/I,M) = 0$$

*Finally, since $\mathrm{Tor}_1^A(?,M)$ vanishes identically, this means that $M$ is flat.

Certainly you would have to prove $1$ (which is not hard), $2$ follows from this, while $3$ follows by the LES of a SES, in a similar way as the first part of this answer.

A: Hint:
First, as any ideal of $A$ is the union of its finitely generated sub-ideals and the direct limit is an exact functor which commutes with tensor products, the same hypothesis is true foe any ideal.
Next, any finitely generated $A$-module is a quotient of a finitely generated free module. So you can try to prove that, if $K$ is a submodule of a finitely generated free module $L$ of rank $n$, then
$$K\otimes_A M\longrightarrow L\otimes_A M$$
is injective. This can be done  by induction on the rank $n$.
For the case $n=2$, consider a submodule $K$ of $A^2$. Denote $K_1$ the intersection of $K$ with the first factor  $A\times\{0\}$ of $A^2$, and $M_K2$ the canonical projection of $M$ onto the second factor  $\{0\}\times A$.
Then do some diagram hunting in the commutative diagram:
\begin{alignat}6
K_1&\otimes_A M&{}\longrightarrow{}& &K&\otimes_A M&{}\longrightarrow {} K_2&\otimes_A M\\
&\downarrow &&&&\downarrow &&\downarrow\\[-0.5ex]
L_1&\otimes_A M&{}\longrightarrow{}& &A^2&\otimes_A M&\longrightarrow  L_2&\otimes_A M
\end{alignat}


text:
Q: Magento 2.2.6 Anchor setting (ON / OFF) does not work in category setting Magento 2.2.6 Anchor setting (ON / OFF) does not work in category setting.
Please check the screenshot below.

I have not found a solution.
Could you please help me?
nice to meet you.

A: Try Reindexing manually and clear cache
php bin/magento indexer:reindexall
php bin/magento cache:flush

A: I found a solution.
However, it is a but a substitution.
Remove the filter navigation from the back end with custom layout for each category.
<referenceContainer name="catalog.leftnav" remove="true" />

Probably, it seems to be a malfunction that exists from the beginning of Magento 2.
The following is a problem that has been submitted to the Magento 2 project.
https://github.com/magento/magento2/issues/7765


text:
Q: Can I add values to a MySQL table via a form based on a match between values in a textbox and values in a column in the table? I have a MySQL table with a number of columns, including one called 'Name'.
I would like to design a form for a webpage which consists of two textboxes, A and B. In textbox A the user would be required to enter their name, and in textbox B some other information.
I would like the PHP script to check if the Name in Textbox A matches a value already in the Name column in the MySQL table, and if it does, add the value in Textbox B to another column in this table.  If the name is not found, I would like the script to return an error, along the lines of "Your booking was not found on our database".
Is it possible to do this using PHP/MySQL and if it is, how would I go about this?
CURRENT CODE
$row_count = count($_POST['name']);

mysql_select_db($database, $connection);

if ($row_count > 0) {

$values = array();

 for($i = 0; $i < $row_count; $i++) {
     // variable sanitation...
     $name = mysql_real_escape_string(ucwords($_POST['name'][$i]));
     $workshop = mysql_real_escape_string($_POST['workshop'][$i]);

     $query = "SELECT * FROM conference WHERE Name = '$name' ";
     $result = mysql_query($query);

     if ($result) {
     $rowcount = mysql_num_rows($result);

     if ($rowcount == 0) {echo "no bookings found"; }
     else {
     $row = mysql_fetch_row($result);
     $sql = "UPDATE conference SET Workshop = '$workshop' WHERE Name = '$name'";
     mysql_query($sql);
     }

     }
}

}

A: This should get you started.
//Get the value from the textbox
$name = mysql_real_escape_string($_POST['name']);
//Select all rows with the name
$query = "SELECT other_info FROM table1 WHERE name = '$name' ";
$result = mysql_query($query);
if ($result) {
  $rowcount = mysql_num_rows($result);
  //No rows found
  if ($rowcount == 0) {echo "no bookings found"; }
  else {
    //process the data.
    $row = mysql_fetch_row($result);
    $other_info = $row['other_info'];
    echo "other_info = ".hmtlentities($other_info);

See here: http://php.net/manual/en/book.mysql.php
Comments on the code
$row_count = count($_POST['name']);
if ($row_count > 0) {

  mysql_select_db($database, $connection);
  //$values = array();
  $name = array();
  $workshop = array()
  $replace = array()

  for($i = 0; $i < $row_count; $i++) {
    // variable sanitation...
    $name[i] = mysql_real_escape_string(ucwords($_POST['name'][$i]));
    $workshop[i] = mysql_real_escape_string($_POST['workshop'][$i]);
    //if you use option 2
    $replace[i] = "('".$name[i]."','".$workshop[i]."')";
  }
  $names = "'".implode("','",$name)."'";
  $query = "SELECT 1 FROM conference WHERE Name IN $names ";
  $result = mysql_query($query);

  if ($result) {
    $rowcount = mysql_num_rows($result);

    if ($rowcount == 0) {
      echo "<HTMLCODE HERE>"."no bookings found"."<MORE HTML>";
    //OPTION 1
    } else {
      for($i = 0; $i < $row_count; $i++) {
        //$row = mysql_fetch_row($result);
        $sql = "UPDATE conference SET Workshop = '$workshop[i]'
                WHERE Name LIKE '$name[i]'";
        mysql_query($sql);
      }
    }
    //OPTION2
    } else {
      $replacement = implode(",",$replace);
      $sql = "REPLACE INTO conference (names, workshop) VALUES $replacement "
      mysql_query($sql);
    }
  }
}


text:
Q: setVisibility(View.Gone) with SwipeyTabs I'm a beginner android programmer, and I'm trying to figure out how to work with SwipeyTabs. First of all, is this a good way to find the view:
rb2 = (RadioButton) getView().findViewById(R.id.rb2);
rb2.setOnClickListener(this);
My second question is about how to set the visibility of a TextView or an EditText with SwipeyTabs. I've made a simple application without SwipeyTabs, and there I use the code:
tvPlayer1.setVisibility(View.GONE);
Once I use this same line of code within SwipeyTabs, it crashes. Can someone explain me why I can't get this to work?
Thank you in advance!

A: Turned out I had a grammar mistake in my line of code.
etPlayer1 = (TextView) getView().findViewById(R.id.etPlayer1);
had to be:
etPlayer1 = (EditText) getView().findViewById(R.id.etPlayer1);


text:
Q: I'm tailing a file in python for any changes and it is not picking up a change to the file Here is my script:
def tail(file, delay=0.5):
    f = open(file, 'r')
    f.seek(0, 2)
    while True:
        line = f.readline()
        print 'line: ' + line
        if not line:
            time.sleep(delay)
        else:
            print 'line found!'

When i open the file and add some lines to it, this script is not picking it up.  I am doing this on linux.

A: use open('filename', 'a') instead of open('filename', 'r') for adding lines to the file ... I think you actually want to append to the file rather than reading it.

A: The code looks fine so there is likely a buffering issue.  Try using f.read(100) instead of readline so that you read whatever is available rather than searching for line endings.


text:
Q: Unable to fetch actual value from Web SQL database; it's returning undefined Check my code:
var db = openDatabase("Despesas", "1.0", "Despesas DB", 2000000);
        db.transaction(createTbl, errorCB, successCB);

        function errorCB(err){
            alert('Error : ' + err.code);
        }
        function successCB(){
            console.log('DB CREATED!');
            db.transaction(queryDB, errorCB);
        }
        function createTbl(tx){
            tx.executeSql('DROP TABLE IF EXISTS ENTRIES');
            tx.executeSql('CREATE TABLE IF NOT EXISTS ENTRIES (id integer primary key autoincrement, entry TEXT NOT NULL)');

        }

        function callPopulate(){
            db.transaction(
                function populateDB(tx){
                    var userInput = document.getElementById('user').value;
                    tx.executeSql('INSERT INTO ENTRIES (entry) VALUES (?)', [userInput]);
                    //tx.executeSql('INSERT INTO ENTRIES (entry) VALUES ("'+ userInput + '")');
                    //alert('Input ok');
                }, errorCB, successCB);

                }

        function queryDB(tx){
            tx.executeSql('SELECT * FROM ENTRIES',[], querySuccess, errorCB);
        }

function querySuccess(tx, results) {

    document.getElementById('list').innerHTML = '';
    var len = results.rows.length;
    console.log("ENTRIES table: " + len + " rows found.");
    for (var i=0; i<len; i++){
        item = results.rows.item(i);
        console.log("Row = " + i + " ID = " + results.rows.item(i).id + " Data =  " + results.rows.item(i).data);
        document.getElementById('list').innerHTML += '<li>' + item.data + '</li>';
        console.log(item);
    }
}

I log item to the console, but it prints the Object stored.  I tried console.log(item.data), but it doesn't seem to give me the result I expect.  How am I supposed to fix this and return the real value?  I am using Chrome.

A: It looks like you don't have a column called "data" in your table, or you are not selecting it.


text:
Q: In PySpark when writing the dataframe with nested schema to file in JSON format how to set the missing values of the nested columns to null? In PySpark, I was consuming the data from kafka topic which produces the messages in JSON format. But the issue is all records doesn't have the unified schema. Later in our pipeline google cloud DLP is being used to de-identify the sensitive information in which record-type transformation is being applied which requires the data in structured format and unified schema. Hence to mitigate this, I was enforcing the schema when consuming the data from kafka topic.
dataToWrite = data.select(from_json(col("value").cast(StringType()), schema).alias("dataBody")).select("dataBody.*")

In above code data is the streaming dataframe.
For instance, if schema is
schema = StructType([StructField('id', IntegerType(), True),
                     StructField('name', StringType(), True),
                     StructField('nestedColumn', StructType([StructField(column1, StringType(), True),
                                                             StructField(column2, StringType(), True)]),True),
                     StructField('record_created_time', TimestampType(), True)])

Records produded by Kafka:-
{"id":1, "name":"ravi", "record_created_time":"2022-08-07 22:43:42"}
{"id":2, "name":"suresh","nestedColumn":{"column1":"value1","column2":"value2"}, "record_created_time":"2022-08-07 22:43:42"}
{"id":3, "name":"mohan", "record_created_time":"2022-08-08 22:41:42"}
{"id":4, "name":"mahesh","nestedColumn":{"column1":"value1}, "record_created_time":"2022-09-07 22:43:42"}
When I was trying to write the dataframe to file in JSON format after enforcing schema on it, I got records in file as below
{"id":1, "name":"ravi","nestedColumn":null, "record_created_time":"2022-08-07 22:43:42"}
{"id":2, "name":"suresh","nestedColumn":{"column1":"value1","column2":"value2"}, "record_created_time":"2022-08-07 22:43:42"}
{"id":3, "name":"mohan","nestedColumn":null, "record_created_time":"2022-08-08 22:41:42"}
{"id":4, "name":"mahesh","nestedColumn":{"column1":"value1,"column2":null}, "record_created_time":"2022-09-07 22:43:42"}
Expected records:-
{"id":1, "name":"ravi","nestedColumn":{"column1":null,"column2":null}, "record_created_time":"2022-08-07 22:43:42"}
{"id":2, "name":"suresh","nestedColumn":{"column1":"value1","column2":"value2"}, "record_created_time":"2022-08-07 22:43:42"}
{"id":3, "name":"mohan","nestedColumn":{"column1":null,"column2":null}, "record_created_time":"2022-08-08 22:41:42"}
{"id":4, "name":"mahesh","nestedColumn":{"column1":"value1,"column2":null}, "record_created_time":"2022-09-07 22:43:42"}
As you can see for the record with id=1 nestedColumn was missing in data produced by kafka. Hence spark was writing it by setting it to null. But I need those nested fields(column1,column2) also to be written as null.
Is this achievable by making any tweaks in options of dataframewriter? If not, how can this be achieved?
I tried to set the option ignoreNullFields to False in dataframewriter. But couldn't achieve the result I was expecting.


text:
Q: can we invoke the processor during global state store restoration? I read Kafka streams use cases for add global store
this stackover flow discuss and come to know that global-state store skip processor during the restoration.
is there any way to force global state store not to skip processor.
because input topic doesn't have any key inside the processor we are constructing the key and put in state store.
i seen many solution to create a custom change log topic that will be use as a source topic for global state store.
but i want how i can force global state store to run processor during restoration with processor api.

A:
This is currently not supported until https://issues.apache.org/jira/browse/KAFKA-7663 and https://issues.apache.org/jira/browse/KAFKA-8037 are resolved.

Compare: Kafka Streams Global Store - Adding change log topic


text:
Q: Convert SQL to LINQ with group by I'm stumped trying to convert the following sql to linq:
SELECT t.* FROM(SELECT mwfieldid,MAX([TimeStamp]) AS MaxValue, BatchDocumentID
   FROM mw_BatchField
   GROUP BY mwfieldid,BatchDocumentID) x
  JOIN mw_BatchField t ON x.mwfieldid = t.mwfieldid
   AND x.MaxValue = t.TimeStamp
   and x.BatchDocumentID = t.BatchDocumentID

So far I had to convert it to a stored proc to get it to work. I'd rather know how to write this correctly in linq. I tried using a sql to linq converter (http://www.sqltolinq.com/) which produced this code that had errors in it: (Are these converters any good? It didn't seem to produce anything useful with a few tries.)
From x In (
    (From mw_BatchFields In db.mw_BatchFields
    Group mw_BatchFields By
      mw_BatchFields.MWFieldID,
      mw_BatchFields.BatchDocumentID
     Into g = Group
    Select
      MWFieldID,
      MaxValue = CType(g.Max(Function(p) p.TimeStamp),DateTime?),
      BatchDocumentID)
    )
Join t In db.mw_BatchFields
      On New With { .MWFieldID = CInt(x.MWFieldID), .MaxValue = CDate(x.MaxValue), .BatchDocumentID = CInt(x.BatchDocumentID) }
  Equals New With { .MWFieldID = t.MWFieldID, .MaxValue = t.TimeStamp, .BatchDocumentID = t.BatchDocumentID }
Select
  BatchFieldID = t.BatchFieldID,
  BatchDocumentID = t.BatchDocumentID,
  MWFieldID = t.MWFieldID,
  TimeStamp = t.TimeStamp,
  value = t.value,
  DictionaryValue = t.DictionaryValue,
  AutoFilled = t.AutoFilled,
  employeeID = t.employeeID

Seems like a lot of code for such a simple query, and it doesn't compile.

A: So for every combination of mwfieldid and BatchDocumentID you want all columns of the row with the highest TimeStamp? This is something which is much easier to express in LINQ than SQL so I'm not surprised that an automated converter is making a meal of it.
You should be able to do:
Mw_BatchFields.GroupBy(x => new { x.Mwfieldid, x.BatchDocumentId })
    .SelectMany(x => x.Where(y => y.TimeStamp == x.Max(z => z.TimeStamp)))

This (like your SQL) will return multiple rows per grouping key if there is more than one row in the group that shares the same maximum TimeStamp. If you only want row per key, you could use:
Mw_BatchFields.GroupBy(x => new { x.Mwfieldid, x.BatchDocumentId })
    .Select(x => x.OrderByDescending(y => y.TimeStamp).First())

Edit:
Sorry, just twigged that you're working in VB, not C#, so not quite what you were looking for, but if you can live with the lambda syntax style, I think the above can be translated as:
Mw_BatchFields.GroupBy(Function(x) New With {x.Mwfieldid, x.BatchDocumentId}).Select(Function(x) x.OrderByDescending(Function(y) y.TimeStamp).First())

and:
Mw_BatchFields.GroupBy(Function(x) New With {x.Mwfieldid, x.BatchDocumentId}).SelectMany(Function(x) x.Where(Function(y) y.TimeStamp = x.Max(Function(z) z.TimeStamp)))


text:
Q: Attaching Two Discs Along the Boundary Let $A := \mathbb{S}^1 \subset \overline{\mathbb{B}^2}$, and let $f : A \hookrightarrow \overline{\mathbb{B}^2}$ be the inclusion map. Consider the adjunction space $\overline{\mathbb{B}^2} \cup_f \overline{\mathbb{B}^2}$ of $\overline{\mathbb{B}^2}$ to $\overline{\mathbb{B}^2}$ along $f$. I wish to prove that $\overline{\mathbb{B}^2} \cup_f \overline{\mathbb{B}^2}$ is homeomorphic to $\mathbb{S}^2$.
Notation: $\mathbb{S}^1$ is the unit circle, $\mathbb{S}^2$ is the unit sphere, $\overline{\mathbb{B}^2}$ is the closed unit ball; the adjunction space is defined as the quotient
$$
X \cup_f Y := \dfrac{X \sqcup Y}{a \sim f(a), \quad \forall a \in A \subseteq Y}
$$
for the attaching map $f : A \to X$.
My attempt: construct an explicit quotient map to $\mathbb{S}^2$ and conclude by uniqueness of quotients. Specifically, let $X := \overline{\mathbb{B}^2}$ and $Y := \overline{\mathbb{B}^2}$, where $A$ is now sitting in $Y$ and is embedded into $X$ via $f : A \hookrightarrow X$. I identify $X$ and $Y$ with actual closed balls $\{(x,y) \in \mathbb{R}^2 ~|~ x^2 + y^2 \leq 1\}$, and I define a map
$$
\varphi : X \sqcup Y \longrightarrow \mathbb{S}^2
$$
$$
(x,y) \in X \longmapsto \left(x,y, + \sqrt{1 - (x^2 + y^2)}\right),
$$
$$
(x,y) \in Y \longmapsto \left(x,y, - \sqrt{1 - (x^2 + y^2)}\right).
$$
In other words, send one disc to the upper hemisphere, and the other to the lower hemisphere. Clearly $\varphi$ is surjective; it moreover makes the same identifications as $\sim$. It is therefore a quotient map, completing the proof by uniqueness of quotients.
Uniqueness of Quotients: If $\pi_1 : X \to Y_1$ and $\pi_2 : X \to Y_2$ are two quotient maps that make the same identifications (i.e. $\pi_1 (p) = \pi_1 (q) \iff \pi_2(p) = \pi_2(q)$), then there is a homeomorphism between $Y_1$ and $Y_2$.
Question 1: Are my deductions correct?
Question 2: Is there an easier way of doing this, i.e. without introducing explicit co-ordinates and maps?
Note: cannot use any homology theory, homotopy theory, etc..

A: The homemorphism between $Y_1$ and $Y_2$ is not unique (you can easily find other homeomorphisms). However, there exists a unique homeomorphism $\phi: Y_1 \to Y_2$ such that $\phi\circ\pi_1 = \pi_2$. Other than that (nitpicking) your proof is perfectly fine!
I cannot think of a way to do this without writing out explicit maps. Maybe you could have used some relationship between the mapping cone and the reduced suspension to get the homeomorphism immediately. However, the only way I know to prove that the reduced suspension of the $n$-sphere is the $(n+1)$-sphere is by working with coordinates and maps similar to yours.


text:
Q: ant-input-group-addon with non-input elements like ant-select / ant-btn How can I use ant-input-group-addonwith non-input elements like ant-select and ant-btn? I'm looking for styling HTML/CSS solution, but not React one.

A:
ant-input-group-compact did the trick:

 ant-input-group-addon

<input type="button" class="ant-btn ant-btn-sm" value="Button 1" style="width: 20%;">

<input type="button" class="ant-btn ant-btn-sm active" value="Button 2" style="width: 30%;">

<Select class="ant-select ant-select-selection ant-input-group">
<Option value="Select">Select</Option>
</Select>


text:
Q: Upload gravatar in WP profile? I'm interested in the theory of a user being able to register/upload a gravatar directly in their user account within a hosted WP system.
Is this feasible?

A: Try the Simple Local Avatars Plugin. It works exactly as advertised!

A: If you are looking to connect your sites sign-up with Gravatar then you simply can't, since Gravatar don't have a sing-up api you can use.
But if you are just looking to let your users upload there own photos the either Simple Local Avatars Plugin that Chip suggested or one I've used a lot before is User Photo will do the job just fine.
But the better part of User Photo plugin is that it has an overwrite function  get_avatar which will get the user photo if exists or the gravatar if not.

A: Mark Jaquith a WP core developer wrote a plugin called Gravatar Signup which checks if the user has a Gravatar when the leave comments (and maybe when the first signup) and if not shows a link to the gravatar site. They would still need to sign up at Gravatar.com but this may be a simple fix to your problem.
Personally I try to stay away from plugins that allow users to upload their own author pics but that's just personal preference.

A: There's also Gravatar Box which I wrote. It's handy for a comments form, to increase Gravatar awareness.


text:
Q: How to add embedded mounting hole screw for the NVMe ssd in a PCB? I am designing a PCB for CM4 where an NVMe SSD M.2 2280 will be used. I need to add the screw terminal/mounting hole fused into the PCB (ref the image: https://www.corsair.com/corsairmedia/sys_master/productcontent/blog_InstallingMP500-Content-3.jpg I am referring that 42, 60, 80 and 110. In our case it is 80, however, all the 42, 60, 80 and 110 are the same just the position varies depending on the SSD variant). How to add that in KiCAD? Please guide me on this along with the part number for the same if any.

A: You can use standoffs, the easiest kind would be classified as SMT (they do go through the board but the "through hole" kind screws in the other side vs. soldering in).
You can find them on Mouser or Digikey, you just need one for a M2 screw (the screw is M2x3) in the height required by your connector. Wurth makes some nice ones in that range. The datasheet will show you the footprint, they can be soldered my machine too (if that's your assembly plan).
Edit: as Hearth pointed out, these are actually press fit broaching nuts with a threaded standoff, not a SMT standoff. Edited my answer to clarify that SMT standoffs are an easy option, not the exact match. The exact match is probably something more like this: http://www.npfasteners.com/broaching/cbn.htm


text:
Q: Killing Subprocess in Ubuntu NOT the Parent? I want to kill a process in Ubuntu.
I have Java installed and Running JBOSS & Tomcat at background. I need to kill Tomcat after deployment but when I kill it JBOSS is going too.
I had to use
kill -9 pidofjava
killall tomcat

But status is still same.
What I need to do to kill a process attribute? I mean subprocess?

A: You can loop  through the process list, identifying children
with the same parent and kill them one by one.
Attribution: http://www.unix.com/17901-post4.html
#!/bin/sh
while true
do
  echo "Enter parent process id  [type quit for exit]"
  read ppid

  if [ $ppid -eq "quit" -o $ppid -eq "QUIT" ];then
     exit 0
  fi

  for i in `ps -ef| awk '$3 == '$ppid' { print $2 }'`
  do
      echo killing $i
      kill $i
  done
done

You can also kill by session id but that get's the parent and the
children.
https://serverfault.com/questions/40303/how-do-you-kill-a-process-tree-in-linux
ps -eo pid,ppid,sess,cmd -u ppetraki  | grep whoami
pkill -9 -s SESS_ID
Using the information from the later, you could build a simpler
tool that targeted only children.

A: Usually processes check whether their subprocesses are still alive and might shut down themselves if one of the subprocesses is aborted.


text:
Q: Convert multiple PARTITION BY to LINQ EF Core does not have a SqlQuery() method yet (epic fail) so I have no way to run a query/stored proc on my database to get "summary" data.  Here is a summary query I have with multiple PARTITION BYs that I need to convert to LINQ:
SELECT
    s.Name,
    SUM(CASE WHEN pc.WorkflowStateId <> 99 THEN 1 ELSE 0 END)
        OVER (PARTITION BY s.SiteId) 'RegisteredCount',
    SUM(CASE WHEN pc.WorkflowStateId = 99 THEN 1 ELSE 0 END)
        OVER (PARTITION BY s.SiteId) 'ScreenFailedCount'
FROM Sites s
JOIN Patients p ON p.SiteId = s.SiteId
JOIN PatientCycles pc ON pc.PatientId = p.PatientId

Sites, Patients, and PatientCycles are DbSets.
How can I convert this to a C# LINQ query?
UPDATE
This is the solution I came up with:
var summaries = from site in context.Sites
                let registered = (from pc in context.PatientCycles
                                    where site.SiteId == pc.Patient.SiteId && pc.WorkflowStateId != WorkflowStateType.Terminated
                                    select pc).Count()
                let terminated = (from pc in context.PatientCycles
                                    where site.SiteId == pc.Patient.SiteId && pc.WorkflowStateId == WorkflowStateType.Terminated
                                    select pc).Count()
                select new SiteSummary { Site = site, RegisteredCount = registered, ScreenFailedCount = terminated };

A: Well an alternative in Linq would be something like this:
var query= from s in context.Sites
           join p in context.Patiens on s.SiteId equals p.SiteId
           join pc in context.PatientCycles on p.PatiendId equals p.PatiendId
           group pc.WorkflowStateId by new{s.SiteId,s.Name} into g
           select new {Name=g.Key.Name,
                       RegisteredCount=g.Sum(e=>e!=99?1:0),
                       ScreenFailedCount=g.Sum(e=>e==99?1:0)
                      }

Update
To avoid that kind of problem use nav. properties:
var query= from s in context.Sites
           select t new SiteSummary
            {
                SiteId = s.SiteId,
                Name = s.Name,
                Code = s.Code,
                RegisteredCount =s.Patiens.SelectMany(e=>e.PatientCycles.Select(y=>y.WorkflowStateId ))
                                          .Sum(x => x!= WorkflowStateType.Terminated ? 1 : 0),
                ScreenFailedCount = s.Patiens.SelectMany(e=>e.PatientCycles.Select(y=>y.WorkflowStateId ))
                                             .Sum(x => x== WorkflowStateType.Terminated ? 1 : 0)
            };

Also I suggest to initialize the collection navigation properties in entity constructors:
public class Sites
{
  //...
  public virtual ICollection<Patient> Patients{get;set;}
  public Sites()
  {
    Patients=new List<Patient>();
  }
}