text:
Q: How do I link the route to the component using vue-router? I'm trying to use vue-router to link url's to their corresponding components.
My issue is that only the root url ('/') can link to the correct component and any other url (e.g. '/first') does not link to their component. All of them link to the component which belongs to  the '/' url.
When I use "a" tag in the vue file it will route to the right component - it's only when I input the url directly into the browser that it doesn't work
main.js:
import Vue from 'vue'
import router from './router/index.js'

Vue.use(ElementUI)

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  // components: { App },
  render: h => h(App)
})

index.js:
import Vue from 'vue'
import Router from 'vue-router'
import Hello from '../components/Hello.vue'
import First from '../components/firstPage.vue'
import Login from '../components/logIn.vue'

Vue.use(Router)

const routes =[
  {
    path: '/',
    component: Login
  },
  {
    path:'/first',
    component:Hello
  }
]
const router = new Router({
  routes
})
export default router

A: I think you can also try as below. It's works, just try it! You can add mode: 'hash', to give default # in all urls.
import Vue from 'vue';
import Router from 'vue-router'
import Hello from '../components/Hello.vue'
import First from '../components/firstPage.vue'
import Login from '../components/logIn.vue'

Vue.use(VueRouter);

const router = new VueRouter({
   mode: 'hash',
   base: '/your_base_name_if_you_want',
   linkActiveClass: 'active-tab', //if you w
   routes: [
    {
        path: '/',
        redirect: '/if_you_want_to_redirect',
        name: 'Login',  //Whatever
        component: {
            render (c) { return c('router-view'); }
        },

        children: [
            {
                path: '/',
                component: Login
                name: 'Login',
                meta: { title: 'Your title name' }
            },
            {
                path:'/first',
                component:Hello
                name: 'Hello',
                meta: { title: 'Your title name' }
            }
        ]
    }
]
})

export default router

You can also remove it from your urls using:
var router = new VueRouter({
    history: true
});

Hope this helps you!

A:
The default mode for vue-router is hash mode

This is why you can't get the 'Hello' component when your url is '/first'. Instead you can try input '/#/first'.
If you want to use history mode like '/first', set the mode attribute for your route object like this.
const router = new Router({
  mode: 'history',
  routes
})

Hope it helps you.


text:
Q: React style grid row on condition I'm using React Data Grid (https://devexpress.github.io/devextreme-reactive/react/grid/) to display data.
Everything works fine, but I would like to add custom styling (change background color) to a particular row if a value like 25 is between minNumberOfUsers and  maxNumberOfUsers as example.
I have a value like 25 users for this customer.
Now I want to see what current tier this customer is in!
I want to do that by coloring its tr background.
minNumberOfUsers has as example 10  and maxNumberOfUsers has 15 in the first row!
minNumberOfUsers has as example 20  and maxNumberOfUsers has 30 in the second row!
In that case I want the second row in another color because 25 is between 20 and 30 in the second row!
This is what I have now:
<Grid
  rows={this.state.fields.priceplan.userPriceTiers || []}
  columns={[
    { name: "minNumberOfUsers", title: "minNumberOfUsers },
    { name: "maxNumberOfUsers", title: "maxNumberOfUsers" },
    { name: "price", title: "priceuser" },
]}>
<CurrencyTypeProvider for={["price"]} />
<NumberTypeProvider for={["minNumberOfUsers", "maxNumberOfUsers"]} />

<TableHeaderRow />
</Grid>

Does anyone know how to add custom classnames or styling to a tr when a value is between a value in the column grid?
I need this to show the current pricetier of users their in.
This is what I want to achieve:

The above tier is colored yellow because I have 25 users and 25 is between 1 and 50.

A: You can pass rowComponent prop in the
 element which accepts another React Component
const TableRow = (props) => (
const valueToCheck = "25";

=props.row.minNumberOfUsers && valueToCheck<=props.row.minNumberOfUsers)?({backgroundColor: "yellow"}:({}))
    }   /> );

In this component, you can define custom styling for the rows in the style attribute.
You can read more about this in the row subheading of this url

A: or you can wrap the grid in the div with your CSS className and then in your CSS do: .my-class-name .react-data-grid {}... and then you don´t have to use !important (it is better with LESS or SASS as you don´t have to type .some-class everytime). Here is similar issue  enter link description here

     <Grid>

and in the css
.custom-style.react-data-grid {--------style-------}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Ayuda para realizar simulaciones y guardar los resultados en un archivo CSV Hace algunos días me pedían en los comentarios de otra pregunta que subiera mi código y reformulara la pregunta. Aquí va.
El siguiente código contiene una serie de variables y funciones, que definen un juego de señales según un modelo determinado. El output nos da las señales que muestra cada jugador en cada ronda.
Necesito saber cómo:

*

*Simular este juego x veces (por ejemplo 1000). He conseguido hacerlo con execfile("Mimodulo.py"), pero no es útil para ir almacenando los resultados.

*Almacenar en un archivo csv (filas (señales) y columnas (jugadores)), los resultados. Es decir, que el archivo csv contenga al final de las 1000 simulaciones la cantidad de cada tipo de señal que cada jugador ha producido en cada ronda. Esto es útil para hacer luego el análisis estadístico. Tan solo he conseguido abrir y cerrar un archivo CSV, pero me temo que estoy bloqueado.
Aquí está el código:
import random
##### Variables ######
emparejamientos= ([[1,2],[3,4],  #ronda 1 (participante 1 juega con 2 y 3 con 4)
                   [1,3],[2,4],  #ronda 2 (1 con 3 y 2 con 4)
                   [1,4],[2,3]]) #ronda 3 (1 con 4 y 2 con 3)

#Parejas de cada participante en cada ronda (empezando por la ronda 1).
pareja_part1= [2,3,4]
pareja_part2= [1,4,3]
pareja_part3= [4,1,2]
pareja_part4= [3,2,1]

#Parametros del modelo
s1=1
s2=0
s3=0
s4=0
b=0.5
x=0.5
m=0.02
round=[0,1,2,3,4,5,6] #rounds

#Senales
S1="S1"
S2="S2"
S3="S3"
S4="S4"
opciones = [S1, S2, S3, S4]

#Diccionarios de memoria
Muestra_part1 = {"S1":0,"S2":0,"S3":0,"S4":0}
Observa_part1 = {"S1":0,"S2":0,"S3":0,"S4":0}
Muestra_part2 = {"S1":0,"S2":0,"S3":0,"S4":0}
Observa_part2 = {"S1":0,"S2":0,"S3":0,"S4":0}
Muestra_part3 = {"S1":0,"S2":0,"S3":0,"S4":0}
Observa_part3 = {"S1":0,"S2":0,"S3":0,"S4":0}
Muestra_part4 = {"S1":0,"S2":0,"S3":0,"S4":0}
Observa_part4 = {"S1":0,"S2":0,"S3":0,"S4":0}

##### Funciones #####
#Almacen de senales mostradas en el diccionario de memoria Muestra_partx
def mem_mostradas(e, memoria):
    if e == S1:
        memoria[S1] +=1
    if e == S2:
        memoria[S2] +=1
    if e == S3:
        memoria[S3] +=1
    if e == S4:
        memoria[S4] +=1
    return memoria

#Almacen de senales observadas en el diccionario de memoria Observa_partx
def mem_observadas(pareja_part, memoria):
    if pareja_part == 1:
         memoria[eleccion1] +=1
    if pareja_part == 2:
         memoria[eleccion2] +=1
    if pareja_part == 3:
         memoria[eleccion3] +=1
    if pareja_part == 4:
         memoria[eleccion4] +=1
    return memoria

#Probabilidad para cada participante de mostrar una senal determinada en una ronda
def with_b(muestra, observa, s, r):
    result = ((0.98) * (1.0 - 0) * (1.0 - x) * muestra/r) + ((0.98) * (1.0 - 0) * (x) * observa/r) + ((0.98) * 0 * s) + ((m / 8))
    if not (muestra == observa == 0):
        result = ((0.98) * (1.0 - b) * (1.0 - x) * muestra/r) + ((0.98) * (1.0 - b) * (x) * observa/r) + ((0.98) * b * s) + ((m / 8))
    return result

#Funcion que arroja la opcion que cada participante elige para mostrar
from random import random
from bisect import bisect
def choice(opciones, probs):
    probAcumuladas=[]
    aux = 0
    for p in probs:
        aux += p
        probAcumuladas.append(aux)
    r = random() * probAcumuladas[-1]
    op = bisect(probAcumuladas, r)
    return opciones[op]

##### Juego #####
#RONDA 1
#Senales mostradas por cada participante en ronda 1
eleccion1=S1
eleccion2=S2
eleccion3=S3
eleccion4=S4
print "Senales mostradas en la generacion 1 \n jugador1: {0}, jugador2: {1}, jugador3: {2}, jugador4: {3}".format(S1, S2, S3, S4)

#Almacen de senales mostradas en el diccionario (memoria de senales mostradas)
Muestra_part1=mem_mostradas(eleccion1,Muestra_part1)
Muestra_part2=mem_mostradas(eleccion2,Muestra_part2)
Muestra_part3=mem_mostradas(eleccion3,Muestra_part3)
Muestra_part4=mem_mostradas(eleccion4,Muestra_part4)

#Almacen de senales observadas en el diccionario (memoria de senales observadas)
Observa_part1=mem_observadas(pareja_part1[0], Observa_part1)
Observa_part2=mem_observadas(pareja_part2[0], Observa_part2)
Observa_part3=mem_observadas(pareja_part3[0], Observa_part3)
Observa_part4=mem_observadas(pareja_part4[0], Observa_part4)

#RONDA 2
#Probabilidad para cada participante de mostrar una senal determinada en 2a ronda
Prob_S1_part1 = with_b(Muestra_part1[S1], Observa_part1[S1], s1, round[1])
Prob_S2_part1 = with_b(Muestra_part1[S2], Observa_part1[S2], s2, round[1])
Prob_S3_part1 = with_b(Muestra_part1[S3], Observa_part1[S3], s3, round[1])
Prob_S4_part1 = with_b(Muestra_part1[S4], Observa_part1[S4], s4, round[1])

Prob_S1_part2 = with_b(Muestra_part2[S1], Observa_part2[S1], s1, round[1])
Prob_S2_part2 = with_b(Muestra_part2[S2], Observa_part2[S2], s2, round[1])
Prob_S3_part2 = with_b(Muestra_part2[S3], Observa_part2[S3], s3, round[1])
Prob_S4_part2 = with_b(Muestra_part2[S4], Observa_part2[S4], s4, round[1])

Prob_S1_part3 = with_b(Muestra_part3[S1], Observa_part3[S1], s1, round[1])
Prob_S2_part3 = with_b(Muestra_part3[S2], Observa_part3[S2], s2, round[1])
Prob_S3_part3 = with_b(Muestra_part3[S3], Observa_part3[S3], s3, round[1])
Prob_S4_part3 = with_b(Muestra_part3[S4], Observa_part3[S4], s4, round[1])

Prob_S1_part4 = with_b(Muestra_part4[S1], Observa_part4[S1], s1, round[1])
Prob_S2_part4 = with_b(Muestra_part4[S2], Observa_part4[S2], s2, round[1])
Prob_S3_part4 = with_b(Muestra_part4[S3], Observa_part4[S3], s3, round[1])
Prob_S4_part4 = with_b(Muestra_part4[S4], Observa_part4[S4], s4, round[1])

probabilidades1 = [Prob_S1_part1, Prob_S2_part1, Prob_S3_part1, Prob_S4_part1]
probabilidades2 = [Prob_S1_part2, Prob_S2_part2, Prob_S3_part2, Prob_S4_part2]
probabilidades3 = [Prob_S1_part3, Prob_S2_part3, Prob_S3_part3, Prob_S4_part3]
probabilidades4 = [Prob_S1_part4, Prob_S2_part4, Prob_S3_part4, Prob_S4_part4]

#Senales que muestran los participantes en la RONDA 2. Asignadas segun las probabilidades dadas por la ecuacion de memorias
eleccion1 = choice(opciones, probabilidades1) #senal mostrada por participante 1 en ronda 2
eleccion2 = choice(opciones, probabilidades2) #senal mostrada por participante 2 en ronda 2
eleccion3 = choice(opciones, probabilidades3) #senal mostrada por participante 3 en ronda 2
eleccion4 = choice(opciones, probabilidades4) #senal mostrada por participante 4 en ronda 2

print "Senales mostradas en la generacion 2 \n jugador1: {0}, jugador2: {1}, jugador3: {2}, jugador4: {3}".format(eleccion1, eleccion2, eleccion3, eleccion4)

#Almacen de senales mostradas en el diccionario (memoria de senales mostradas)
Muestra_part1=mem_mostradas(eleccion1,Muestra_part1)
Muestra_part2=mem_mostradas(eleccion2,Muestra_part2)
Muestra_part3=mem_mostradas(eleccion3,Muestra_part3)
Muestra_part4=mem_mostradas(eleccion4,Muestra_part4)

#Almacen de senales observadas en el diccionario (memoria de senales observadas)
Observa_part1=mem_observadas(pareja_part1[1], Observa_part1)
Observa_part2=mem_observadas(pareja_part2[1], Observa_part2)
Observa_part3=mem_observadas(pareja_part3[1], Observa_part3)
Observa_part4=mem_observadas(pareja_part4[1], Observa_part4)

#RONDA 3
#Probabilidad para cada participante de mostrar una senal determinada en 3a ronda
Prob_S1_part1 = with_b(Muestra_part1[S1], Observa_part1[S1], s1, round[2])
Prob_S2_part1 = with_b(Muestra_part1[S2], Observa_part1[S2], s2, round[2])
Prob_S3_part1 = with_b(Muestra_part1[S3], Observa_part1[S3], s3, round[2])
Prob_S4_part1 = with_b(Muestra_part1[S4], Observa_part1[S4], s4, round[2])

Prob_S1_part2 = with_b(Muestra_part2[S1], Observa_part2[S1], s1, round[2])
Prob_S2_part2 = with_b(Muestra_part2[S2], Observa_part2[S2], s2, round[2])
Prob_S3_part2 = with_b(Muestra_part2[S3], Observa_part2[S3], s3, round[2])
Prob_S4_part2 = with_b(Muestra_part2[S4], Observa_part2[S4], s4, round[2])

Prob_S1_part3 = with_b(Muestra_part3[S1], Observa_part3[S1], s1, round[2])
Prob_S2_part3 = with_b(Muestra_part3[S2], Observa_part3[S2], s2, round[2])
Prob_S3_part3 = with_b(Muestra_part3[S3], Observa_part3[S3], s3, round[2])
Prob_S4_part3 = with_b(Muestra_part3[S4], Observa_part3[S4], s4, round[2])

Prob_S1_part4 = with_b(Muestra_part4[S1], Observa_part4[S1], s1, round[2])
Prob_S2_part4 = with_b(Muestra_part4[S2], Observa_part4[S2], s2, round[2])
Prob_S3_part4 = with_b(Muestra_part4[S3], Observa_part4[S3], s3, round[2])
Prob_S4_part4 = with_b(Muestra_part4[S4], Observa_part4[S4], s4, round[2])

probabilidades1 = [Prob_S1_part1, Prob_S2_part1, Prob_S3_part1, Prob_S4_part1]
probabilidades2 = [Prob_S1_part2, Prob_S2_part2, Prob_S3_part2, Prob_S4_part2]
probabilidades3 = [Prob_S1_part3, Prob_S2_part3, Prob_S3_part3, Prob_S4_part3]
probabilidades4 = [Prob_S1_part4, Prob_S2_part4, Prob_S3_part4, Prob_S4_part4]

#Senales que muestran los participantes en la RONDA 3. Asignadas segun las probabilidades dadas por la ecuacion de memorias
eleccion1 = choice(opciones, probabilidades1) #senal mostrada por participante 1 en ronda 3
eleccion2 = choice(opciones, probabilidades2) #senal mostrada por participante 2 en ronda 3
eleccion3 = choice(opciones, probabilidades3) #senal mostrada por participante 3 en ronda 3
eleccion4 = choice(opciones, probabilidades4) #senal mostrada por participante 4 en ronda 3

print "Senales mostradas en la generacion 3 \n jugador1: {0}, jugador2: {1}, jugador3: {2}, jugador4: {3}".format(eleccion1, eleccion2, eleccion3, eleccion4)

#Almacen de senales mostradas en el diccionario (memoria de senales mostradas)
Muestra_part1=mem_mostradas(eleccion1,Muestra_part1)
Muestra_part2=mem_mostradas(eleccion2,Muestra_part2)
Muestra_part3=mem_mostradas(eleccion3,Muestra_part3)
Muestra_part4=mem_mostradas(eleccion4,Muestra_part4)

#Almacen de senales observadas en el diccionario (memoria de senales observadas)
Observa_part1=mem_observadas(pareja_part1[2], Observa_part1)
Observa_part2=mem_observadas(pareja_part2[2], Observa_part2)
Observa_part3=mem_observadas(pareja_part3[2], Observa_part3)
Observa_part4=mem_observadas(pareja_part4[2], Observa_part4)

El output en una simulación ejemplo es el siguiente:
Senales mostradas en la generacion 1
 jugador1: S1, jugador2: S2, jugador3: S3, jugador4: S4
Senales mostradas en la generacion 2
 jugador1: S1, jugador2: S1, jugador3: S3, jugador4: S4
Senales mostradas en la generacion 3
 jugador1: S2, jugador2: S1, jugador3: S1, jugador4: S1

Por lo tanto, se busca ir almacenando en un archivo CSV, durante 1000 simulaciones, las señales que cada jugador ha generando en cada ronda.
Un ejemplo de cómo sería útil almacenar los resultados en un CSV para el posterior análisis estadístico es el siguiente. En el ejemplo, las columnas RONDAX muestran el número de veces que se ha elegido cada señal (los números de esta imagen no corresponden a ninguna simulación con el programa, y por eso los sumatorios son inconsistentes, pues se trata solo de un ejemplo para ilustrar el formato de la tabla).

Edición (11.01.2016):
Partiendo de la última versión del código compartido por @FJSevilla, me gustaría poder ir un poco más allá. De cara al análisis estadístico de los datos sería interesante obtener no ya 1000 simulaciones, sino x muestras de 1000 simulaciones.
Utilizando el mismo código, la tabla de resultados que en este caso se pretende obtener es como la siguiente (ejemplificando cómo sería un CSV que almacenararía los resultados de 3 muestras de 1000 simulaciones del juego completo):

Donde en "muestra" el número 1 hace referencia a las primeras 1000 simulaciones, 2 hace referencia a las segundas 1000 simulaciones y así sucesivamente. Donde "ronda" hace referencia al número de ronda dentro del juego. Donde "jugador" hace referencia al número de jugador.
Nótese que en este caso se incluyen los parámetros b, x y m en la tabla, y que los números en las columnas "Senalx" hacen referencia a las veces que cada señal ha sido elegida en cada ronda.
Es una configuración del orden de los datos diferente a la que teníamos, pero que facilitaría la comparación estadística. ¿Alguna mano amiga con esto?

A: He estado viendo las preguntas anteriores y en base a esto te dejo una aproximación usando POO. De esta forma el código se reduce y se hace escalable fácilmente ya que permite usar un número indeterminado de señales, de jugadores y de rondas. Algunas aclaraciones:

*

*He eliminado la variable round ya que, según creo, solo usas la lista para numerar la ronda en la que estás, es decir siempre es de la forma:
round= [0,1,2,3,...,n]

Si no es de esta forma se puede modificar fácilmente para que el constructor acepte la lista como variable.

*El funcionamiento del método generar_senales() es:

*

*En la ronda 1 las señales de cada participante vienen determinadas por el orden de los parámetros jugadores y senales que le pasamos al constructor. Por ejemplo:
jugadores = [1,2,3,4]
senales = ['a', 'b', 'r', 'n']

En la primera ronda el jugador 1 muestra la señal 'a', el 2 la señal 'b', el 3 la señal 'r' y el 4 la señal 'n'.

*En la segunda ronda y posteriores usa las señales de la primera ronda para generar cada señal aleatoriamente y de acuerdo a las probabilidades para cada jugador y señal (usando las funciones with_b y choise).
El método generar_senales() es un generador (yield) y retorna un diccionario con la señal aleatoria de cada jugador, de la forma:
{1: 'S8', 2: 'S6', 3: 'S5', 4: 'S1', 5: 'S3', 6: 'S7'}

Este mismo diccionario es el que se usa para crear la fila correspondiente del csv

*Las variales s1, s2, s3, s4 las paso dentro de una lista llamada s, de esta forma podemos definir cualquier número de jugadores y señales.

*La forma de pasar los emparejamientos también la he modificado, ahora cada ronda es una lista que contiene dentro los emparejamientos. De esta forma queda más intuitivo. No obstante se podría seguir usando tu forma con algunas modificaciones.

*El csv tiene como cabecera (primera fila) los nombres de los jugadores. El resto de filas son las rondas (señal mostrada por cada jugador).
Como muestra en la siguiente ejecución simulamos un juego de 4 rondas con 6 jugadores:
from random import random, sample
from bisect import bisect
import csv

class Partida():
    def __init__(self, jugadores, emparejamientos, senales, s, b, x, m):
        self.emparejamientos = emparejamientos
        self.senales = senales
        self.s = s
        self.b = b
        self.x = x
        self.m = m
        self.jugadores = {nombre: Partida.Jugador(senales)
                            for pareja in emparejamientos[0]
                                for nombre in pareja}
        self.memoria = list()

    def generar_senales(self):

        def with_b(muestra, observa, s, r):
            if not (muestra == observa == 0):
                result = ((0.98) * (1.0 - self.b) * (1.0 - self.x) * muestra/r) + ((0.98) * (1.0 - self.b) * (self.x) * observa/r) + ((0.98) * self.b * s) + ((self.m / 8))
            else:
                result = ((0.98) * (1.0 - 0) * (1.0 - self.x) * muestra/r) + ((0.98) * (1.0 - 0) * (self.x) * observa/r) + ((0.98) * 0 * s) + ((self.m / 8))
            return result

        def choice(opciones, probs):
            probAcumuladas = list()
            aux = 0
            for p in probs:
                aux += p
                probAcumuladas.append(aux)
            r = random() * probAcumuladas[-1]
            op = bisect(probAcumuladas, r)
            return opciones[op]

        yield dict(zip(self.jugadores.keys(), self.senales))

        r = 1
        while True:
            eleccs = dict.fromkeys(self.jugadores.keys())
            for nombre, inst in self.jugadores.items():
                probs = [with_b(inst.mem_mostradas[op], inst.men_observadas[op], self.s[indx], r)
                            for indx, op in enumerate(self.senales)]
                eleccs[nombre] = choice(self.senales, probs)
            r += 1
            yield eleccs

    def jugar(self):
        gen_sens =  self.generar_senales()
        for n, ronda in enumerate(self.emparejamientos):
            senales = next(gen_sens)
            self.memoria.append(senales)

            for jugador1, jugador2 in ronda:
                self.jugadores[jugador1].men_observadas[senales[jugador2]] += 1
                self.jugadores[jugador2].men_observadas[senales[jugador1]] += 1
                self.jugadores[jugador1].mem_mostradas[senales[jugador1]] += 1
                self.jugadores[jugador2].mem_mostradas[senales[jugador2]] += 1

    class Jugador():
        def __init__(self, senales):
            self.mem_mostradas = {senal: 0 for senal in senales}
            self.men_observadas = {senal: 0 for senal in senales}

def main():
    jugadores = [1, 2, 3, 4, 5, 6]
    senales = ['S1', 'S2', 'S3', 'S4', 'S5', 'S6']
    emparejamientos = [[(1,2),(3,4),(5,6)],
                       [(1,5),(2,4),(3,6)],
                       [(1,6),(2,3),(4,5)],
                       [(1,3),(4,6),(2,5)]]

    s=[1,0,0,0,0,0]
    b=0.5
    x=0.5
    m=0.02

    with open('salida.csv', 'wb') as csvfile:
        writer = csv.DictWriter(csvfile,fieldnames = jugadores, delimiter=',',
                        quotechar='"', quoting=csv.QUOTE_MINIMAL)
        writer.writeheader()

        for _ in range(1000):
            juego = Partida(jugadores, emparejamientos, senales, s, b, x, m)
            juego.jugar()
            for ronda in juego.memoria:
                writer.writerow(ronda)

if __name__ == '__main__':
    main()

Esto nos genera un csv que abierto con LibreOffice (para ver más visualmente como quedan los datos) queda:

En este caso el csv tiene 6 columnas (1 por jugador) y 4001 filas (la primera es la cabecera y las otras 4000 corresponde a las mil simulaciones del juego de 4 rondas). Para adaptarlo a otros parámetrso solo tienes que modificarlos en la función main()
Hay muchas formas de hacer esto, en este caso yo lo que hago es que guardo en una lista de diccionarios (self.memoria) las elecciones de cada ronda y lugo la uso para ir creando el csv. Para manejar el csv en sí uso la librería estándar csv de Python.
Edición:
Si deseas obtener las frecuencias con que cada jugador a mostrado cada señal a partir del csv puedes hacer algo así:
import collections
import csv
import itertools

with open('salida.csv', 'rb') as csvfile:
    reader = csv.reader(csvfile, delimiter=',')
    header = reader.next()
    transpuesta = itertools.izip(*reader)

    print 'Estadisticas:'

    for n, jugador in enumerate(transpuesta):
        print '    Jugador {0}:'.format(header[n])
        t = len(jugador)*1.0
        for (k,v) in collections.Counter(jugador).iteritems():
            print "        Senal {0} mostrada {1} veces. Frecuencia: {2}%".format(k, v, v/t*100)

csv.reader crea un generador que itera sobre las filas del csv, si lo que quiereses obtener las columnas, una solución es tratarlo como una matriz y usar su transpuesta (descartando la primera fila que es la cabecera con los nombres), para ello podemos usar itertools.izip. Para contar las frecuencias es muy útil collections.Counter.
Este código lo puedes usar dentro de la función main anterior, para ello mueve los import al inicio del módulo. Unas salida ejemplo sería:

Estadisticas:
   Jugador 1:
    Senal S3 mostrada 626 veces. Frecuencia: 15.65%
    Senal S2 mostrada 626 veces. Frecuencia: 15.65%
    Senal S1 mostrada 739 veces. Frecuencia: 18.475%
    Senal S6 mostrada 663 veces. Frecuencia: 16.575%
    Senal S5 mostrada 683 veces. Frecuencia: 17.075%
    Senal S4 mostrada 663 veces. Frecuencia: 16.575%
   Jugador 2:
    Senal S3 mostrada 692 veces. Frecuencia: 17.3%
    Senal S2 mostrada 701 veces. Frecuencia: 17.525%
    Senal S1 mostrada 693 veces. Frecuencia: 17.325%
    Senal S6 mostrada 572 veces. Frecuencia: 14.3%
    Senal S5 mostrada 687 veces. Frecuencia: 17.175%
    Senal S4 mostrada 655 veces. Frecuencia: 16.375%
   Jugador 3:
    Senal S3 mostrada 708 veces. Frecuencia: 17.7%
    Senal S2 mostrada 730 veces. Frecuencia: 18.25%
    Senal S1 mostrada 658 veces. Frecuencia: 16.45%
    Senal S6 mostrada 652 veces. Frecuencia: 16.3%
    Senal S5 mostrada 647 veces. Frecuencia: 16.175%
    Senal S4 mostrada 605 veces. Frecuencia: 15.125%
   Jugador 4:
    Senal S3 mostrada 696 veces. Frecuencia: 17.4%
    Senal S2 mostrada 648 veces. Frecuencia: 16.2%
    Senal S1 mostrada 685 veces. Frecuencia: 17.125%
    Senal S6 mostrada 694 veces. Frecuencia: 17.35%
    Senal S5 mostrada 639 veces. Frecuencia: 15.975%
    Senal S4 mostrada 638 veces. Frecuencia: 15.95%
   Jugador 5:
    Senal S3 mostrada 659 veces. Frecuencia: 16.475%
    Senal S2 mostrada 594 veces. Frecuencia: 14.85%
    Senal S1 mostrada 643 veces. Frecuencia: 16.075%
    Senal S6 mostrada 686 veces. Frecuencia: 17.15%
    Senal S5 mostrada 663 veces. Frecuencia: 16.575%
    Senal S4 mostrada 755 veces. Frecuencia: 18.875%
   Jugador 6:
    Senal S3 mostrada 553 veces. Frecuencia: 13.825%
    Senal S2 mostrada 659 veces. Frecuencia: 16.475%
    Senal S1 mostrada 672 veces. Frecuencia: 16.8%
    Senal S6 mostrada 721 veces. Frecuencia: 18.025%
    Senal S5 mostrada 681 veces. Frecuencia: 17.025%
    Senal S4 mostrada 714 veces. Frecuencia: 17.85%

Si vas a trabajar mucho con archivos csv y datos te recomiendo que te mires pandas
Edición 2:
Te dejo el código con la funcion main modificada para que genere el csv que deseas de acuerdo a la edición de tu pregunta.
from random import random, sample
from bisect import bisect
import csv

class Partida():
    def __init__(self, jugadores, emparejamientos, senales, s, b, x, m):
        self.emparejamientos = emparejamientos
        self.senales = senales
        self.s = s
        self.b = b
        self.x = x
        self.m = m
        self.jugadores = {nombre: Partida.Jugador(senales)
                            for pareja in emparejamientos[0]
                                for nombre in pareja}
        self.memoria = list()

    def generar_senales(self):

        def with_b(muestra, observa, s, r):
            if not (muestra == observa == 0):
                result = ((0.98) * (1.0 - self.b) * (1.0 - self.x) * muestra/r) + ((0.98) * (1.0 - self.b) * (self.x) * observa/r) + ((0.98) * self.b * s) + ((self.m / 8))
            else:
                result = ((0.98) * (1.0 - 0) * (1.0 - self.x) * muestra/r) + ((0.98) * (1.0 - 0) * (self.x) * observa/r) + ((0.98) * 0 * s) + ((self.m / 8))
            return result

        def choice(opciones, probs):
            probAcumuladas = list()
            aux = 0
            for p in probs:
                aux += p
                probAcumuladas.append(aux)
            r = random() * probAcumuladas[-1]
            op = bisect(probAcumuladas, r)
            return opciones[op]

        yield dict(zip(self.jugadores.keys(), self.senales))

        r = 1
        while True:
            eleccs = dict.fromkeys(self.jugadores.keys())
            for nombre, inst in self.jugadores.items():
                probs = [with_b(inst.mem_mostradas[op], inst.men_observadas[op], self.s[indx], r)
                            for indx, op in enumerate(self.senales)]
                eleccs[nombre] = choice(self.senales, probs)
            r += 1
            yield eleccs

    def jugar(self):
        gen_sens =  self.generar_senales()
        for n, ronda in enumerate(self.emparejamientos):
            senales = next(gen_sens)
            self.memoria.append(senales)

            for jugador1, jugador2 in ronda:
                self.jugadores[jugador1].men_observadas[senales[jugador2]] += 1
                self.jugadores[jugador2].men_observadas[senales[jugador1]] += 1
                self.jugadores[jugador1].mem_mostradas[senales[jugador1]] += 1
                self.jugadores[jugador2].mem_mostradas[senales[jugador2]] += 1

    class Jugador():
        def __init__(self, senales):
            self.mem_mostradas = {senal: 0 for senal in senales}
            self.men_observadas = {senal: 0 for senal in senales}

def main():
    jugadores = [1, 2, 3, 4]
    senales = ['S1', 'S2', 'S3', 'S4', ]
    emparejamientos = [[(1,2),(3,4)],
                       [(1,3),(2,4)],
                       [(1,4),(2,3)]]
    s=[1,0,0,0]
    b=0.5
    x=0.5
    m=0.02

    rondas = ['RONDA' + str(n+1) for n in range(len(emparejamientos))]
    estadisticas = {jugador:{senal:[0 for ronda in rondas]
                        for senal in senales}
                            for jugador in jugadores}

    for _ in range(1000):
        juego = Partida(jugadores, emparejamientos, senales, s, b, x, m)
        juego.jugar()
        for n, ronda in enumerate(juego.memoria):
            for jugador, senal in ronda.items():
                estadisticas[jugador][senal][n] += 1

    with open('salida.csv', 'wb') as csvfile:
        writer =csv.writer(csvfile, delimiter=',',
                    quotechar='"', quoting=csv.QUOTE_MINIMAL)
        writer.writerow(['JUGADOR', 'SENAL'] + rondas)

        for jugador in jugadores:
            for senal in senales:
                writer.writerow([jugador, senal]+estadisticas[jugador][senal])

if __name__ == '__main__':
    main()

Simulando tu ejemplo obtenemos un csv como el siguiente:

A: Como te han indicado en un comentario, puedes, simplemente, envolver la parte del juego en un bucle e ir guardando la información que necesitas de la forma en que la necesites. Por ejemplo, podría ser así:
from random import random
from bisect import bisect
##### Variables ######
emparejamientos= ([[1,2],[3,4],  #ronda 1 (participante 1 juega con 2 y 3 con 4)
                   [1,3],[2,4],  #ronda 2 (1 con 3 y 2 con 4)
                   [1,4],[2,3]]) #ronda 3 (1 con 4 y 2 con 3)

#Parejas de cada participante en cada ronda (empezando por la ronda 1).
pareja_part1= [2,3,4]
pareja_part2= [1,4,3]
pareja_part3= [4,1,2]
pareja_part4= [3,2,1]

#Parametros del modelo
s1=1
s2=0
s3=0
s4=0
b=0.5
x=0.5
m=0.02
round=[0,1,2,3,4,5,6] #rounds

#Senales
S1="S1"
S2="S2"
S3="S3"
S4="S4"
opciones = [S1, S2, S3, S4]

#Diccionarios de memoria
Muestra_part1 = {"S1":0,"S2":0,"S3":0,"S4":0}
Observa_part1 = {"S1":0,"S2":0,"S3":0,"S4":0}
Muestra_part2 = {"S1":0,"S2":0,"S3":0,"S4":0}
Observa_part2 = {"S1":0,"S2":0,"S3":0,"S4":0}
Muestra_part3 = {"S1":0,"S2":0,"S3":0,"S4":0}
Observa_part3 = {"S1":0,"S2":0,"S3":0,"S4":0}
Muestra_part4 = {"S1":0,"S2":0,"S3":0,"S4":0}
Observa_part4 = {"S1":0,"S2":0,"S3":0,"S4":0}

##### Funciones #####
#Almacen de senales mostradas en el diccionario de memoria Muestra_partx
def mem_mostradas(e, memoria):
    if e == S1:
        memoria[S1] +=1
    if e == S2:
        memoria[S2] +=1
    if e == S3:
        memoria[S3] +=1
    if e == S4:
        memoria[S4] +=1
    return memoria

#Almacen de senales observadas en el diccionario de memoria Observa_partx
def mem_observadas(pareja_part, memoria):
    if pareja_part == 1:
         memoria[eleccion1] +=1
    if pareja_part == 2:
         memoria[eleccion2] +=1
    if pareja_part == 3:
         memoria[eleccion3] +=1
    if pareja_part == 4:
         memoria[eleccion4] +=1
    return memoria

#Probabilidad para cada participante de mostrar una senal determinada en una ronda
def with_b(muestra, observa, s, r):
    result = ((0.98) * (1.0 - 0) * (1.0 - x) * muestra/r) + ((0.98) * (1.0 - 0) * (x) * observa/r) + ((0.98) * 0 * s) + ((m / 8))
    if not (muestra == observa == 0):
        result = ((0.98) * (1.0 - b) * (1.0 - x) * muestra/r) + ((0.98) * (1.0 - b) * (x) * observa/r) + ((0.98) * b * s) + ((m / 8))
    return result

#Funcion que arroja la opcion que cada participante elige para mostrar
def choice(opciones, probs):
    probAcumuladas=[]
    aux = 0
    for p in probs:
        aux += p
        probAcumuladas.append(aux)
    r = random() * probAcumuladas[-1]
    op = bisect(probAcumuladas, r)
    return opciones[op]

with open('resultados.csv', 'w') as fichero: ##################################
    fichero.write('Generación,Jugador01,Jugador02,Jugador03,Jugador04\n') #####
    output = "{0:>10},{1:>9},{2:>9},{3:>9},{4:>9}\n" ##########################
    for i in range(1000): #####################################################
        ##### Juego #####

        #Senales mostradas por cada participante en ronda 1
        eleccion1=S1
        eleccion2=S2
        eleccion3=S3
        eleccion4=S4
        if i == 0: ############################################################
            fichero.write(output.format(i, S1, S2, S3, S4)) ###################

        #Almacen de senales mostradas en el diccionario (memoria de senales mostradas)
        Muestra_part1=mem_mostradas(eleccion1,Muestra_part1)
        Muestra_part2=mem_mostradas(eleccion2,Muestra_part2)
        Muestra_part3=mem_mostradas(eleccion3,Muestra_part3)
        Muestra_part4=mem_mostradas(eleccion4,Muestra_part4)

        #Almacen de senales observadas en el diccionario (memoria de senales observadas)
        Observa_part1=mem_observadas(pareja_part1[0], Observa_part1)
        Observa_part2=mem_observadas(pareja_part2[0], Observa_part2)
        Observa_part3=mem_observadas(pareja_part3[0], Observa_part3)
        Observa_part4=mem_observadas(pareja_part4[0], Observa_part4)

        #RONDA 2
        #Probabilidad para cada participante de mostrar una senal determinada en 2a ronda
        Prob_S1_part1 = with_b(Muestra_part1[S1], Observa_part1[S1], s1, round[1])
        Prob_S2_part1 = with_b(Muestra_part1[S2], Observa_part1[S2], s2, round[1])
        Prob_S3_part1 = with_b(Muestra_part1[S3], Observa_part1[S3], s3, round[1])
        Prob_S4_part1 = with_b(Muestra_part1[S4], Observa_part1[S4], s4, round[1])

        Prob_S1_part2 = with_b(Muestra_part2[S1], Observa_part2[S1], s1, round[1])
        Prob_S2_part2 = with_b(Muestra_part2[S2], Observa_part2[S2], s2, round[1])
        Prob_S3_part2 = with_b(Muestra_part2[S3], Observa_part2[S3], s3, round[1])
        Prob_S4_part2 = with_b(Muestra_part2[S4], Observa_part2[S4], s4, round[1])

        Prob_S1_part3 = with_b(Muestra_part3[S1], Observa_part3[S1], s1, round[1])
        Prob_S2_part3 = with_b(Muestra_part3[S2], Observa_part3[S2], s2, round[1])
        Prob_S3_part3 = with_b(Muestra_part3[S3], Observa_part3[S3], s3, round[1])
        Prob_S4_part3 = with_b(Muestra_part3[S4], Observa_part3[S4], s4, round[1])

        Prob_S1_part4 = with_b(Muestra_part4[S1], Observa_part4[S1], s1, round[1])
        Prob_S2_part4 = with_b(Muestra_part4[S2], Observa_part4[S2], s2, round[1])
        Prob_S3_part4 = with_b(Muestra_part4[S3], Observa_part4[S3], s3, round[1])
        Prob_S4_part4 = with_b(Muestra_part4[S4], Observa_part4[S4], s4, round[1])

        probabilidades1 = [Prob_S1_part1, Prob_S2_part1, Prob_S3_part1, Prob_S4_part1]
        probabilidades2 = [Prob_S1_part2, Prob_S2_part2, Prob_S3_part2, Prob_S4_part2]
        probabilidades3 = [Prob_S1_part3, Prob_S2_part3, Prob_S3_part3, Prob_S4_part3]
        probabilidades4 = [Prob_S1_part4, Prob_S2_part4, Prob_S3_part4, Prob_S4_part4]

        #Senales que muestran los participantes en la RONDA 2. Asignadas segun las probabilidades dadas por la ecuacion de memorias
        eleccion1 = choice(opciones, probabilidades1) #senal mostrada por participante 1 en ronda 2
        eleccion2 = choice(opciones, probabilidades2) #senal mostrada por participante 2 en ronda 2
        eleccion3 = choice(opciones, probabilidades3) #senal mostrada por participante 3 en ronda 2
        eleccion4 = choice(opciones, probabilidades4) #senal mostrada por participante 4 en ronda 2

        fichero.write(output.format(i, ########################################
                                    eleccion1, ################################
                                    eleccion2, ################################
                                    eleccion3, ################################
                                    eleccion4)) ###############################

He movido los imports al principio del programa y he eliminado partes innecesarias. Las líneas que hacen el trabajo que pides son las líneas que acaban con almohadillas, ejemplo:
linea_que_hace(cosas) #########################################################


text:
Q: How to include an image from a website? I'm using the wallpaper package to insert a jpg image in the background of a page. Specifically, I'm doing something like this:
\usepackage{wallpaper}
\begin{document}
\ThisULCornerWallPaper{1}{summary-analysis-bg.jpg}
\end{document}

The image is in the same folder as the .tex file.
What if I wanted to compile the pdf but, instead of using an image from the same folder, use an image from a web address? The naive approach (replacing the file name/location with some image's web address) doesn't work.
Is there some approach that works?


text:
Q: How can I add each new dataframe to the csv that is created? My problem is that only the most recent url request is saved. How can I save all the responses? I tried using df.to_csv('complete.csv', 'a') but that creates a jumbled file.
# imports
import requests
from bs4 import BeautifulSoup
import pandas as pd

# main code
with open('list.txt', 'r') as f_in:
    for line in map(str.strip, f_in):
        if not line:
            continue

        response = requests.get(line)
        data = response.text
        soup = BeautifulSoup(data, 'html.parser')

        linecodes = []
        partnos = []

        for tbody in soup.select('tbody[id^="listingcontainer"]'):
            tmp = tbody.find('span', class_='listing-final-manufacturer')
            linecodes.append(tmp.text if tmp else '-')

            tmp = tbody.find('span', class_='listing-final-partnumber as-link-if-js buyers-guide-color')
            partnos.append(tmp.text if tmp else '-')

        # create dataframe
        df = pd.DataFrame(zip(linecodes,partnos), columns=['linecode', 'partno'])

        # save to csv
        df.to_csv('complete.csv')

        print(df)

list.txt
https://www.rockauto.com/en/catalog/ford,2010,f-150,6.2l+v8,1447337,brake+&+wheel+hub,brake+pad,1684
https://www.rockauto.com/en/catalog/ford,2015,f-150,5.0l+v8,3308775,brake+&+wheel+hub,brake+pad,1684

A: You are saving the dataframe after each iterations, which is just overwriting the previous save. So you need to append the dataframes after each iterations. after it completes the loop, then save that final dataframe. So something like:
# imports
import requests
from bs4 import BeautifulSoup
import pandas as pd

# main code
with open('list.txt', 'r') as f_in:
    final_df = pd.DataFrame()
    for line in map(str.strip, f_in):
        if not line:
            continue

        response = requests.get(line)
        data = response.text
        soup = BeautifulSoup(data, 'html.parser')

        linecodes = []
        partnos = []

        for tbody in soup.select('tbody[id^="listingcontainer"]'):
            tmp = tbody.find('span', class_='listing-final-manufacturer')
            linecodes.append(tmp.text if tmp else '-')

            tmp = tbody.find('span', class_='listing-final-partnumber as-link-if-js buyers-guide-color')
            partnos.append(tmp.text if tmp else '-')

        # create dataframe
        df = pd.DataFrame(zip(linecodes,partnos), columns=['linecode', 'partno'])
        print(df)
        final_df = final_df.append(df, sort=False).reset_index(drop=True)

    # save to csv
    final_df.to_csv('complete.csv')

    print(final_df)


text:
Q: Merge two JSONs to JSONObject instead of JSONArray I need to find a way how to merge two (or more) JSON objects into a single JSON object without JSON arrays.
There's code example:
public static void mergeJSONs() {
    JSONObject jsonObject1 = new JSONObject("{\"1level1\":{\"1level2\":{\"1label1\":\"1value1\"}}}");
    JSONObject jsonObject2 = new JSONObject("{\"1level1\":{\"1level2\":{\"1label2\":\"1value2\"}}}");
    JSONObject jsonObject3 = new JSONObject("{\"2level1\":{\"2level2\":{\"2level3\":{\"2label1\":\"2value1\"}}}}");
    JSONObject jsonObject4 = new JSONObject("{\"2level1\":{\"2level2\":{\"2label2\":\"2value2\"}}}");

    JSONObject combined = new JSONObject();
    combined.put("strings", jsonObject1);
    combined.put("strings", jsonObject2);
    combined.put("strings", jsonObject3);
    combined.put("strings", jsonObject4);

    System.out.println(combined.toString());
}

Output for this code:
{"strings":{"2level1":{"2level2":{"2label2":"2value2"}}}}

Expected output:
{
   "strings":{
      "1level1":{
         "1level2":{
            "1label1":"1value1",
            "1label2":"1value2"
         }
      },
      "2level1":{
         "2level2":{
            "2level3":{
               "2label1":"2value1"
            },
            "2label2":"2value2"
         }
      }
   }
}

or in one line:
{"strings":{"1level1":{"1level2":{"1label1":"1value1","1label2":"1value2"}},"2level1":{"2level2":{"2level3":{"2label1":"2value1"},"2label2":"2value2"}}}}

The thing is that I will never know the names of the JSON objects and how deep will this JSON be in the end as this will be used to convert files, so I am not able to create POJO for this.
Currently I'm using org.json library for this but if there is an easy way how to do that with other libraries - it works for me as well.
Library:
<dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20180813</version>
</dependency>

UPDATE #1:
Those objects are provided just for example, in reality JSONs will be larger and deeper. Problem is that I will never know how deep and which keys matches in JSON. So here recursive method is needed which would go through both object until there is any key that matches and one of object doesn't contain that key then all the nested objects should be merged to that one.
UPDATE #2:
Updated sample code and expected output to make image more clear

A: I prefer and recommend use Gson from Google:
The last release is 2.8.6 from Oct of 2019:
<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.8.6</version>
</dependency>

Always check last version on Maven Central Repository:

*

*https://mvnrepository.com/artifact/com.google.code.gson/gson

Example:
public static void mergeJSONs() {
  String JSON1 = "{\"1level1\":{\"1level2\":{\"1label1\":\"1value1\"}}}";
  String JSON2 = "{\"1level1\":{\"1level2\":{\"1label2\":\"1value2\"}}}";
  String JSON3 = "{\"2level1\":{\"2level2\":{\"2level3\":{\"2label1\":\"2value1\"}}}}";
  String JSON4 = "{\"2level1\":{\"2level2\":{\"2label2\":\"2value2\"}}}";
  String finalJson = organizeJson(JSON1, JSON2, JSON3, JSON4);
  System.out.println(finalJson);
}

The method can receive a list of json payloads, add a root element and merge:
public String organizeJson(String... jsonList) throws Exception {
    JsonObject jsonObj = null;
    Gson gson = new GsonBuilder().setPrettyPrinting().create();
    for (String json : jsonList) {
        if (jsonObj != null) {
            jsonObj = jsonMerge(jsonObj, gson.fromJson(json, JsonObject.class));
        } else {
            jsonObj = gson.fromJson(json, JsonObject.class);
        }
    }
    JsonObject jsonStringsRoot = new JsonObject();
    /* Add "strings" as root element */
    jsonStringsRoot.add("strings", jsonObj);
    return gson.toJson(jsonStringsRoot);
}

Method using recursive call to find the last level on nested objects (deep merge):
public static JsonObject jsonMerge(JsonObject jsonA, JsonObject jsonB) throws Exception {
    for (Map.Entry<String, JsonElement> sourceEntry : jsonA.entrySet()) {
        String key = sourceEntry.getKey();
        JsonElement value = sourceEntry.getValue();
        if (!jsonB.has(key)) {
            if (!value.isJsonNull()) {
                jsonB.add(key, value);
            }
        } else {
            if (!value.isJsonNull()) {
                if (value.isJsonObject()) {
                    jsonMerge(value.getAsJsonObject(), jsonB.get(key).getAsJsonObject());
                } else {
                    jsonB.add(key, value);
                }
            } else {
                jsonB.remove(key);
            }
        }
    }
    return jsonB;
}

Reference:

*

*https://stackoverflow.com/a/38757661/5626568


text:
Q: Change tmux status bar if process is running I was wondering if it's possible to change text in the tmux status bar (or BASH shell prompt as an alternative) if a specific process is running. I would specifically like an indicator to appear if the script command is running (which logs commands for a terminal session).

A: Have a look at this post
Outcome of following the post when htop is running in second window the indicator changes to red.

It shows how when an other window in tmux has activity the window section can change to show that activity.
Quick notes: To create a new widow in tmux ctrl+b c and to switch between windows ctrl+b n


text:
Q: Why is directory /home/david/workspace/ not present? I installed Ubuntu Server 12.04.2 LTS from CD on a new box, and ran the following commands:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ubuntu-desktop

This created a directory /home/david/workspace/
I later made an error and wanted to start over, so I reinstalled Ubuntu Server 12.04.2 once again from CD, formatting the whole drive, and again ran the three above apt-get commands.
Now there is no directory /home/david/workspace/
How could the first time create this directory, but the second time not?

A: Sorry but "workspace" is not a default directory in the home directory.
The directories that re automatically added if /etc/xdg/user-dirs.conf has enabled=True (or for a per user configuration in ~/.config/user-dirs.conf) are found in /etc/xdg/user-dirs.defaults. By default these are...

# Default settings for user directories
#
# The values are relative pathnames from the home directory and
# will be translated on a per-path-element basis into the users locale
DESKTOP=Desktop
DOWNLOAD=Downloads
TEMPLATES=Templates
PUBLICSHARE=Public
DOCUMENTS=Documents
MUSIC=Music
PICTURES=Pictures
VIDEOS=Videos
# Another alternative is:
#MUSIC=Documents/Music
#PICTURES=Documents/Pictures
#VIDEOS=Documents/Videos

No, I do not believe Ubuntu did this from the default software.
"Workspace" I generally relate to 2 things:

*

*workspaces/viewports switching. Is default for Ubuntu but has no relation to directories and/or /home/$USER/;

*code editors. This does have a relation to your user since this is about editing multiple files in a project like setup.

Regarding the last option: software like Eclipse, Aptana can make a workspace directory but some do not do this in /home/$USER/ by default. Aptana creates it based on an INI file that has "osgi.instance.area.default=@user.home/Aptana 3 Workspace" in it. Eclipse uses "osgi.instance.area.default=@user.home/some_workspace".
Where you create this is probably a 1 time question when you start that editor the 1st time (and a setting that allows you to have it ask everytime on startup).
To me it seems logical you also included some other software (and my bet would be a code editor like Eclipse) and omitted this the 2nd time.


text:
Q: Tkinter layout Issues I'm having trouble making the layout the way I want it to be. I'm relatively new to this module and it doesn't feel very flexible, unless I'm just using these functions wrong. I've tried using frames with pack, frames with grid, grids without frames, and pack without frames. Packing felt very similar to float in CSS  but at the same time it didn't.
root = Tk()
root.title("Derivative Calculator GUI")

input = Entry(bg="white")
input.grid(row=0, column=0)
derivbutton = Button(text="Derive This")
derivbutton.grid(row=0, column=1)
secondderiv = Button(text="Second Derivative")
secondderiv.grid(row=1, column=1)
AnswerLabel = Label(text="Answer")
AnswerLabel.grid(row=2, column=0)
StepsLabel = Label(text="Step-by-Step:")
StepsLabel.grid(row=3, column=0)

WhiteBoard = Canvas(width=525, height=400, bg="white")
drawFunction = WhiteBoard.bind("<B1-Motion>", hold)
drawFunction2 = WhiteBoard.bind("<ButtonRelease-1>", release)
WhiteBoard.grid(row=3, column=2)
ClearButton = Button(width=75, height=3, text="Clear All", bg="white", command=clear_all)
ClearButton.grid(row=4, column=2)
ToolBar1 = Frame()
PencilButton = Button(text="Pencil", bg="grey", width=2, height=2)
PencilButton.grid()
ToolBar1.grid(row=0,column=2)
ToolBar2 = Frame()
ToolBar2.grid(row=1, column=2)

root.mainloop()

What I want it to look like:
MS Paint representation of my GUI
What it actually looks like:
Actual GUI

A: Don't put everything in the root window, and don't try to solve all of your problems only with grid or only with pack. Be methodical.
For example, your GUI looks like it's divided into two sections: an area on the left with an equation, some buttons, and the "Answer:" and "Steps" sectons. The area on the right has some buttons and a canvas or text widget. So, start by creating two frames, and use pack to put them side by side.
Next, tackle the left frame. It appears to be made of three sections: the equation and some buttons, an answer section, and a steps section. These areas are arranged top-to-bottom. You can either create three frames and arrange them with pack, or you could try to arrange them all with grid. Either should work, though I would probably make a frame at least for the top section.
Finally, solve the problem on the right. Again, it appears to be made of three sections so three frames would make the job easier: one for the buttons at the top, one for the stuff in the middle, and one for the button on the bottom.
Don't try to lay this all out at once. Just do one section at a time. Give each frame a unique color initially so you can see where one frame ends and the next begins.


text:
Q:  in vue.js is not getting modified value when it is tried to save The steps to reproduce is as follows -

*

*A row is dynamically generated with  as an input field.

*Set previously saved values and working fine.

*Modified the value and changed event is being fired.

Problem: The changed value is not received and an undefined value is being retrieved always.
How can I resolve it?

A: I am not sure what issue you are facing but it is working fine in the below code snippet.
By using @change event on <b-form-input>

new Vue({
  el: '#app',
  data: {
    inputText: 'Alpha',
  },
  methods: {
    getUpdatedValue() {
      console.log(this.inputText);
    }
  }
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<script src="https://unpkg.com/bootstrap-vue@2.21.2/dist/bootstrap-vue.js"></script>
<link rel="stylesheet" href="https://unpkg.com/bootstrap-vue@2.21.2/dist/bootstrap-vue.css"/>
<div id="app">
  <b-form-input v-model="inputText" @change="getUpdatedValue"></b-form-input>
</div>


text:
Q: Differentiable atlas for infinite Mobius strip I want to construct a differentiable atlas for the abstract Mobius strip $M:=X/\sim$ equipped with the quotient topology, where $X:=[0,1]\times\mathbb{R}\subset\mathbb{R}^2$ is a subset equipped with the subspace topology and $\sim$ is the equivalence relation, that identifies any $x\in X^\circ$ with itself and any $x\in\partial X$ with itself and its reflection $\bar{x}=\overline{(x_1,x_2)}:=(1-x_1,-x_2)$. I have already shown that $M$ is a Hausdorff space. It is obvious, that it is a non-empty topological space.

1.) Is there any way to show that $M$ is second-countable? My initial idea was to show that $M$ has a global chart. A global chart is a homeomorphism $M\cong U\subset\mathbb{R}^n$. Because second-countability is a topological invariant this would mean that $M$ is second-countable because $U\subset\mathbb{R}^n$ with the subset topology is itself second-countable. But finding such a global chart seems to be impossible.

Let $\pi:X\rightarrow M, x\mapsto [x]$ be the quotient map. Given $\Box:=[0,1]\times (0,1)\subset X$ and
$$\Phi:\pi(\Box)\rightarrow\Psi\circ\pi(\Box),\quad(\varphi,r)\mapsto(x,y,z),$$
where $$
x:=\cos 2\pi\varphi\left(1+\frac{r}{2}\cos\pi\varphi\right),\\
y:=\sin 2\pi\varphi\left(1+\frac{r}{2}\cos\pi\varphi\right),\\
z:=\frac{r}{2}\sin\pi\varphi,$$
I want to show that $\Phi$ is a chart of $\pi(\Box)\subset M$.
That means I have to show that $\Phi$ is a continuous bijection with an inverse map $\Phi^{-1}$ that is also continuous.
My thoughts on this are the following. To show that $\Phi$ is continuous I want to use that compositions of continuous maps are continuous themselves. However, there is my second problem.

2.) Since we are dealing with topological spaces, it only makes sense to speak of continuity with regards to the topologies at hand. Does this mean I have to check continuity for all elemental functions contained in $\Phi$?

I have found the following candidate as an inverse function:
$$g: \Phi\circ\pi(\Box)\rightarrow\pi(\Box),\quad(x,y,z)\mapsto(\varphi,r),$$
where $$r:=2\gamma, \quad\varphi:=\frac{1}{\pi}\arccos\frac{R-1}{\gamma},\\
R:=\sqrt{x^2+y^2}, \quad\gamma:=\sqrt{z^2+\left(R-1\right)^2}.$$

3.) Now, to show that, in fact, $g=\Phi^{-1}$, I must show that $\Phi\circ g=id_{\Phi\circ\pi(\Box)}$ and $g\circ\Phi=id_{\pi(\Box)}$. However, upon trying to compute both equalities I never reobtain the input. Is there maybe another way to show that $g=\Phi^{-1}$?

After having shown that $\Psi$ is actually a chart for $\pi(\Box)\subset M$, I want to look at shifted segments $\Box_k:=[0,1]\times(\frac{k}{2},1+\frac{k}{2})$ for $k\in\mathbb{Z}$. Then we obviously have $\Box=\Box_0$ and each adjacent box intersects: $\Box_k\cap\Box_{k+1}=[0,1]\times[\frac{k+1}{2},1+\frac{k}{2}]\neq\emptyset$. It also obviously follows that $\bigcup_{k\in\mathbb{Z}}\Box_k=X$.

4.) The next step would be to define analogous charts
$$\Phi_k:\pi(\Box_k)\rightarrow\Psi\circ\pi(\Box_k),\quad(\varphi,r)\mapsto(x,y,z)$$
for each neighbourhood $\pi(\Box_k)$. And prove that the transition $\tau_{k,k+1}:=\Phi_{k+1}\circ\Phi^{-1}_k$ is differentiable. Since each $\Phi_k$ is differentiable as a composition of differentiable maps,  $\tau_{k,k+1}$ is itself differentiable.
But how do I argue that $\Phi^{-1}_k$ is differentiable?

Given all of the steps above I would then argue that we have an atlas $A_0:=\{(\pi(\Box_k),\Phi_k)|k\in\mathbb{Z}\}$ and therefore a differentiable structure $A=[A_0]$ on $M$. Hence, it is a differentiable manifold.
I am sorry to ask so many questions at once. They all belong to that one exercise that I have been pondering about for the past five days and while I cannot spend much more time pondering so intensely about it, because I have new exercises waiting to be solved, maybe someone can give me some hints, tips or even propose a solution to one of the questions. I find this exercise really good since it involves really revising the definitions and putting the theorems to work.

A: You are working too hard. Since $M$ is given as a quotient of a nice, rectangular subset of of the plane, we don't need to introduce trigonometric functions. Think of charts as ways of flattening subsets of manifolds. It is intuitively clear that we only need two charts to flatten the whole Möbius strip: cut across the strip in two places, and you are left with two rectangular pieces which you can lay down on the plane. Formally, let $U = \pi(X \setminus \partial X)$, and let $V = \pi(X \setminus \{ x  = 1/2 \})$. Define a chart $\phi:U \to \mathbb R^2$ via $$\phi([x,y]) = (x,y),$$ and a chart $\psi:V \to \mathbb R^2$ via $$\psi([x,y]) = \begin{cases} (x,y) &\text{if } x < 1/2  \\ (x-1,-y) &\text{if } x > 1/2 \end{cases}.$$
You can check that these are well-defined homeomorphisms onto their images, with $\phi^{-1}(x,y) = [x,y]$ and $\psi^{-1}(x,y) = [x,y]$. Moreover, $$\phi \psi^{-1}(x,y) = \phi([x,y]) = (x,y)$$ wherever it is defined and $$\psi \phi^{-1}(x,y) = \psi([x,y]) = \begin{cases} (x,y) &\text{if } 0 < x < 1/2  \\ (x-1,-y) &\text{if } 1 > x > 1/2 \end{cases}; $$ both of these maps are obviously smooth on their respective domains.

Regarding second-countability, we can take open balls or rectangles around points $[x,y] \in M$ with rational $x,y$ as a countable base.


text:
Q: SKSpriteNode becomes nill after assign position I am using xCode, when I run my game it crashes and I get the following error:

Terminating app due uncaught exception 'Attempted to add nil node' reason: Attempted to add nil node to parent:  ...'

When I ran the debugger I found that in my GameScene class playButton is a SKSpriteNode. After the following line, playButton becomes nil suddenly:
self.playButton.position=CGPointMake(CGRectGetMidX(self.frame),CGRectGetMidY(self.frame))

and then the game crashes because I write:
self.addChild(playButton)

EDIT: FULL CODE:
GameScene Code:
import SpriteKit

class GameScene: SKScene {

    var playButton = SKSpriteNode(fileNamed: "button")

    override func didMoveToView(view: SKView) {
        /* Setup your scene here */
       self.playButton.position=CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame))
       self.addChild(self.playButton)
    }

    override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
        /* Called when a touch begins */

        for touch: AnyObject in touches {
            let location = touch.locationInNode(self)
            if self.nodeAtPoint(location) == playButton {
                var scene = PlayScene(size: self.size)
                let skView = self.view  as SKView
                skView.ignoresSiblingOrder=true
                scene.scaleMode = SKSceneScaleMode.ResizeFill
                skView.presentScene(scene)

            }
        }
    }

    override func update(currentTime: CFTimeInterval) {
        /* Called before each frame is rendered */
    }
}

The error:
2014-07-31 15:02:13.709 Numbers[363:2966] *** Terminating app due to uncaught exception 'Attemped to add nil node', reason: 'Attemped to add nil node to parent: <SKScene> name:'(null)' frame:{{0, 0}, {768, 1024}}'
*** First throw call stack:
(
    0   CoreFoundation                      0x004b0646 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x01fd38bf objc_exception_throw + 44
    2   CoreFoundation                      0x004b056d +[NSException raise:format:] + 141
    3   SpriteKit                           0x00ced119 -[SKNode addChild:] + 172
    4   Numbers                             0x0002a5a5 _TFC7Numbers9GameScene13didMoveToViewfS0_FCSo6SKViewT_ + 197
    5   Numbers                             0x0002a623 _TToFC7Numbers9GameScene13didMoveToViewfS0_FCSo6SKViewT_ + 67
    6   SpriteKit                           0x00cc139b -[SKScene _didMoveToView:] + 97
    7   SpriteKit                           0x00cdbc46 -[SKView presentScene:] + 283
    8   Numbers                             0x0002dabd _TFC7Numbers18GameViewController11viewDidLoadfS0_FT_T_ + 1581
    9   Numbers                             0x0002db42 _TToFC7Numbers18GameViewController11viewDidLoadfS0_FT_T_ + 34
    10  UIKit                               0x00fb7dac -[UIViewController loadViewIfRequired] + 771
    11  UIKit                               0x00fb809d -[UIViewController view] + 35
    12  UIKit                               0x00ebf786 -[UIWindow handleStatusBarChangeFromHeight:toHeight:] + 879
    13  UIKit                               0x00ec257d +[UIWindow _noteStatusBarHeightChanged:oldHeight:forAutolayoutRootViewsOnly:] + 273
    14  UIKit                               0x00e66060 __79-[UIApplication _setStatusBarHidden:animationParameters:changeApplicationFlag:]_block_invoke + 163
    15  UIKit                               0x00ee5846 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 494
    16  UIKit                               0x00ee5c81 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:animations:completion:] + 115
    17  UIKit                               0x00e65f2d -[UIApplication _setStatusBarHidden:animationParameters:changeApplicationFlag:] + 509
    18  UIKit                               0x00e656e8 -[UIApplication _updateCurrentStatusBarViewControllerAppearance] + 286
    19  UIKit                               0x00eb141b -[UIWindow _updateContextOrderingAndSetLayerHidden:] + 548
    20  UIKit                               0x00eb237e -[UIWindow _setHidden:forced:] + 257
    21  UIKit                               0x00eb2634 -[UIWindow _orderFrontWithoutMakingKey] + 49
    22  UIKit                               0x00ec1670 -[UIWindow makeKeyAndVisible] + 80
    23  UIKit                               0x00e5e395 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3168
    24  UIKit                               0x00e6173b -[UIApplication _runWithMainScene:transitionContext:completion:] + 1507
    25  UIKit                               0x00e7a3bb __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59
    26  UIKit                               0x00e603c1 -[UIApplication workspaceDidEndTransaction:] + 155
    27  FrontBoardServices                  0x0745705e __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
    28  FrontBoardServices                  0x07456ca4 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
    29  FrontBoardServices                  0x074686e5 __31-[FBSSerialQueue performAsync:]_block_invoke + 26
    30  CoreFoundation                      0x003d4450 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
    31  CoreFoundation                      0x003c96f3 __CFRunLoopDoBlocks + 195
    32  CoreFoundation                      0x003c954b __CFRunLoopRun + 2715
    33  CoreFoundation                      0x003c87eb CFRunLoopRunSpecific + 443
    34  CoreFoundation                      0x003c861b CFRunLoopRunInMode + 123
    35  UIKit                               0x00e5fdd0 -[UIApplication _run] + 571
    36  UIKit                               0x00e633d6 UIApplicationMain + 1526
    37  Numbers                             0x0002f3a1 top_level_code + 97
    38  Numbers                             0x0002f3db main + 43
    39  libdyld.dylib                       0x0252fac9 start + 1
    40  ???                                 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

A: Initializer for SKSpriteNode is init(imageNamed:). Change your code to:
var playButton = SKSpriteNode(imageNamed:"button")

override func didMoveToView(view: SKView) {
    /* Setup your scene here */
    self.playButton.position = CGPoint(x:CGRectGetMidX(self.frame), y:CGRectGetMidY(self.frame));

    self.addChild(self.playButton)
}


text:
Q: Include Path - Relative path PHP-programmers!
I've got a problem with the Include-function in PHP.
I have a website which contains a left column-bar, and that column contains dynamic content which I get with the Include-function with a relative path, because absolute paths isn't available in the Include-function.
When I navigate to other files in other folders I get the error: include(folder/fileToBeIncluded.php) [function.include]: failed to open stream: No such file or directory in /home/mywebsite/public_html/thissite/folder/subfolder/leftcolumn.php on line 3
How am I going to deal with that? I am totally lost, and I've been searching for Google and StackOverflow for about 10 minutes now.
Thank you!

A: Absolute paths are can be used with the include statement.
Try:
include $_SERVER['DOCUMENT_ROOT'] . '/folder/fileToBeIncluded.php';
// or
include dirname(__FILE__) . '/../fileToBeIncluded.php'; // relative to the path of the file doing the include

At the very least, you can hardcode the path to be absolutely sure (until you move your site elsewhere):
include '/home/yoursite/public_html/folder/fileToInclude.php';

Please see include documentation.

A: May I suggest creating a dedicated "includes" folder? Something like:
/home/mywebsite/includes
in php.ini, you'd need to add:
include_path = "/home/mywebsite/includes/"
That way, all calls to include check from /home/mywebsite/includes for the file you need before looking for it relative to the location of the current page being process.


text:
Q: Angularjs unit testing resolving promises I'm probably doing this wrong but I can't figure out how to fix it.
I want to test a controller that uses a resource (ngResource) and I want to use a Spy as a test double for the resource so it doesn't actually do the http call. In the code below I just want to test the search function in the controller.
Controller:
controllers = angular.module('app.controllers');
controllers.controller('landingCtrl', ['$scope', '$q', 'categoryResource', function ($scope, $q, categoryResource) {

    $scope.search = function (text) {
        console.log('searching for: ' + text);
        var deferred = $q.defer();
        categoryResource.query({ searchTerm: text }, function (result) {
            if (result.length == 0) {
                deferred.resolve(['No results found']);
            } else {
                deferred.resolve(result);
            }
        });
        return deferred.promise;
    }
}]);

Service:
var services = angular.module('app.services');
services.factory('categoryResource', ['$resource', function ($resource) {
    var resource = $resource('/api/category');
    return resource;
}]);

Spec for landingCtrl:
describe('Controller: landingCtrl ', function () {

    var $q,
        $rootScope,
        $scope;

    beforeEach(module('ngResource'));
    beforeEach(module('app.services'));
    beforeEach(module('app.controllers'));

    beforeEach(inject(function (_$rootScope_, _$q_) {
        $q = _$q_;
        $rootScope = _$rootScope_;
    }));

    // mock any depencencies, like scope. $resource or $http
    beforeEach(inject(function ($controller, $injector, categoryResource) {
        $scope = $rootScope.$new();

        spyOn(categoryResource, 'query').andCallFake(function (searchText) {
            console.log('query fake being called');
            var deferred = $q.defer();
            deferred.resolve(['Test', 'Testing', 'Protester']);
            return deferred.promise;
        });

        landingCtrl = $controller('landingCtrl', {
            '$scope': $scope,
            '$q': $q,
            'categoryResource': categoryResource
        });
    }));

    afterEach(inject(function ($rootScope) {
        $rootScope.$apply();
    }));

    it('should return words with "test" in them"', function () {
        $scope.search('test').then(function (results) {
            console.log(results);
            expect(results).toContain('Test');
        });
        $scope.$apply();
    });
});

The test executes without errors but it passes without ever resolving the promise so my code inside the "then" function never gets called. What am I doing wrong?
I've created a plunker with the above and a test that should fail:
http://plnkr.co/edit/adE6fTajgbDoM33rtbZS?p=preview

A: Your spec is mocking categoryResource.query() so it returns a promise, but your controller isn't expecting that. It calls query() and passes a callback, and within that callback it does its thing. In other words, your spec isn't testing what your controller does.
Here's your fixed spec:
spyOn(categoryResource, 'query').andCallFake(function (searchText, callback) {
    console.log('query fake being called');
    callback(['Test', 'Testing', 'Protester']);
});

...

it('should return words with "test" in them"', function () {
    var results;

    $scope.search('test').then(function (_results_) {
        console.log(results);
        results = _results_;
    });
    $scope.$apply();

    expect(results).toContain('Test');
});

Working Plunker
Notice that I have moved the expectation outside the then() callback, so your test breaks if the promise isn't resolved.


text:
Q: primitives of $f(x)=\frac{1}{2\sqrt{x-x^{2}}}$ I have this function $f:(0,1)\rightarrow \mathbb{R},f(x)=\frac{1}{2\sqrt{x-x^{2}}}$   and I need to find the primitives of $f(x)$
So I calculated $\int \frac{1}{2\sqrt{x-x^{2}}}\,dx$ and I got $\frac{1}{2}\arcsin(2x-1)+C$ but the right answer is $\arcsin\sqrt{x}+C$ .Where's my mistake?How to start?

A: If $\theta=\arcsin \sqrt{x}$, then $\sin\theta=\sqrt{x}$, so $\sin^2\theta=x$.
Since $\sin^2\theta=\frac{1-\cos(2\theta)}{2}$, we get
$$\frac{1-\cos(2\theta)}{2}=x$$
We deduce $-\cos(2\theta)=2x-1$.
Then, $\sin(2\theta-\pi/2)=2x-1$.
So, (maybe up to a constant) we have $\arcsin(2x-1)=2\theta-\pi/2$.
Which means that $\theta=\frac{1}{2}\arcsin(2x-1)+\pi/4$. So you have that $\arcsin \sqrt{x}$ and $\frac{1}{2}\arcsin(2x-1)$ differ by a constant. So, both results are okay.

A: The derivative of
$$
f(x)=\frac{1}{2}\arcsin(2x-1)
$$
is
$$
f'(x)=\frac{1}{2}\frac{1}{\sqrt{1-(2x-1)^2}}\cdot2
$$
The square root is
$$
\sqrt{1-4x^2+4x-1}=2\sqrt{x-x^2}
$$
so your result is correct.
Quite likely, the book used the substitution $t=\sqrt{x}$, so the integral becomes
$$
\int\frac{1}{2\sqrt{t^2-t^4}}\cdot2t\,dt=\int\frac{1}{1-t^2}\,dt=\arcsin t+C
$$
There is no problem if you instead complete the square observing that
$$
2\sqrt{x-x^2}=\sqrt{4x-4x^2}=\sqrt{1-(2x-1)^2}
$$
as you probably did.
Just by completeness, we can conclude that, over $(0,1)$,
$$
\frac{1}{2}\arcsin(2x-1)=\arcsin\sqrt{x}+c
$$
for a constant $c$. Evaluating at $x=0$ (it is possible, because the two functions can be extended by continuity to $[0,1]$) we find
$$
-\frac{\pi}{4}=c
$$

A: Hint:
$$\int\frac{dx}{2\sqrt{x-x^{2}}}=\int\frac{dx}{2\sqrt x\sqrt{1-x}}=\int\frac{d\sqrt x}{\sqrt{1-(\sqrt x)^2}}.$$


text:
Q: Stopping immediate right button up in Mint 13 (Cinnamon) actioning first menu choice In Windows, a single right click (i.e., with release) displays a context menu on the screen, allowing you to select the appropriate choice with a further click from either button.
In Mint 13, Cinnamon, it's hold down the right button, drag, then release on the appropriate menu choice.
Both methods are fine, but constantly using both OSs regularly, I'm doing the Windows procedure in Mint by mistake all the time. This makes the single right click and release bring up the context menu and immediately action the first menu choice.
Is there any mechanism to ignore right-button-up if a substantial dragging action or time period hasn't occurred, and have Mint looking for a further click to select?

A: I've solved this problem by changing string  "-GtkMenu-vertical-padding: 0;" on "-GtkMenu-vertical-padding: 1px;" in "/usr/share/themes/Mint-X/gtk-3.0/gtk-widgets.css" file.
This made a padding for top-most item in popup menu for "Mint-X" theme.
So, when I reload system and switch my theme to "Mint-X" , it is not possible to accidentally activate any menu item because there is such a padding for menu item :-)
But better way is to make your own theme, of course.


text:
Q: How can I change view mode from view to edit on row click? I want to be able to switch a row to edit mode when user clicks on it
I had tried to use the event userRowSelect, on my.component.html:
<ng2-smart-table
  class="class-content"
  [settings]="settings"
  [source]="source"
  (deleteConfirm)="onDeleteConfirm($event)"
  (editConfirm)="onSaveConfirm($event)"
  (createConfirm)="onCreateConfirm($event)"
  (rowSelect)="onRowSelect($event)"
  (userRowSelect)="onUserRowSelect($event)"
>
</ng2-smart-table>

then in my.component.ts:
onUserRowSelect(e) {
    console.log('onUserRowSelect', e);
}

with no success

A: I had a similar problem and finally I found a solution :
From the documentation https://akveo.github.io/ng2-smart-table/#/documentation , there are two events for you : rowSelect or userRowSelect
We first set a name to our table, then catch the userRowSelect action :
<ng2-smart-table #table [settings]="settings" [source]="source" (userRowSelect)="switchToEdit($event)">
</ng2-smart-table>

In our component :
import {ViewChild} from '@angular/core';

...

@ViewChild('table') table: Ng2SmartTableComponent;

...

switchToEdit(event) {
  this.table.grid.getSelectedRows().forEach((row) => {
    this.table.grid.edit(row);
  });
}


text:
Q: extJS Chart auto width/height I have the following extJs window which has two tabs in it. One of the tab has got a column chart and the other one has a grid. Everything is working fine but what i want to accomplish here is that if i maximize the window the tabs size+ the charts size in the tabs should too. How can i accomplish it. I also have two calendar fields in the window above the tabs..
var win = Ext.create('Ext.Window', {
    width: eachWindowWidth,
    height: eachWindowHeight,
    hidden: false,
    maximizable: true,
    title: 'Registered Hosts',
    renderTo: Ext.getBody(),
    items: [
        {
            xtype: 'datefield',
            name: 'time',
            fieldLabel: 'From',
            anchor: '90%'
        },
        {
            xtype: 'datefield',
            name: 'time',
            fieldLabel: 'To',
            anchor: '90%'
        },
        {
            xtype: "label",
            fieldLabel: text,
            name: 'txt',
            text: text
        },
        {
            xtype: 'tabpanel',
            activeTab: 0,
            width: eachTabWidth,
            height: eachTabHeight,
            plain: true,
            defaults: {
                autoScroll: true,
                bodyPadding: 10
            },
            items: [
                {
                    title: 'Normal Tab',
                    items: [
                        {
                            id: 'chartCmp',
                            xtype: 'chart',
                            height: 300,
                            width: 300,
                            style: 'background:#fff',
                            animate: true,
                            shadow: true,
                            store: store1,
                            axes: [
                                {
                                    type: 'Numeric',
                                    position: 'left',
                                    fields: ['data1'],
                                    label: {
                                        renderer: Ext.util.Format.numberRenderer('0,0')
                                    },
                                    grid: true,
                                    minimum: 0
                                },
                                {
                                    type: 'Category',
                                    position: 'bottom',
                                    grid: true,
                                    fields: ['name']
                                }
                            ],
                            series: [
                                {
                                    type: 'column',
                                    axis: 'left',
                                    highlight: true,
                                    tips: {
                                        trackMouse: true,
                                        width: 140,
                                        height: 28,
                                        renderer: function(storeItem, item) {
                                            this.setTitle(storeItem.get('name') + ': ' + storeItem.get('data1') + ' $');
                                        }
                                    },
                                    label: {
                                        display: 'insideEnd',
                                        'text-anchor': 'middle',
                                        field: 'data1',
                                        renderer: Ext.util.Format.numberRenderer('0'),
                                        orientation: 'vertical',
                                        color: '#333'
                                    },
                                    xField: 'name',
                                    yField: 'data1'
                                }
                            ]
                        }
                    ]
                },
                {
                    title: 'Table View',
                    xtype: 'grid',
                    width: 200,
                    height: 200,
                    collapsible: false,
                    store: store1,
                    multiSelect: true,
                    viewConfig: {
                        emptyText: 'No information to display'
                    },
                    columns: [
                        {
                            text: 'Devices',
                            flex: 50,
                            dataIndex: 'name'
                        },
                        {
                            text: 'Pass',
                            flex: 50,
                            dataIndex: 'data1'
                        }
                    ]
                }
            ]
        }
    ]
});

A: On resize event of window, change width of tabs size and the charts size however you want. Write a function which will execute on window resize event, In function you can access your fields like below :

var tab = Ext.getCmp('tabId');
var chart = Ext.getCmp('chartId');

change lengths of tab and chart according to your requirement.
Check out window resize event here.


text:
Q: SQL to get first date and amount per account I want to get back the date and amount of the first transaction per account in a transaction table. The table (GiftHeader) looks like this:
EntityID           Date                        Amount
1                 1/1/2027  00:00:00:00        1.00
1                 2/1/2027  00:00:00:00        2.00
2                 2/1/2027  00:00:00:00        4.00
2                 3/1/2027  00:00:00:00        2.00

In this case, I would expect the following:
EntityID          BatchDate                    Amount
1                 1/1/2027  00:00:00:00        1.00
2                 2/1/2027  00:00:00:00        4.00

Here's the SQL I'm using which isn't working.
select DISTINCT entityid, min(BatchDate) as FirstGiftDate
from GiftHeader
group by EntityId,BatchDate
order by EntityId

Any help would be appreciated.
Regards,
Joshua Goodwin

A: You can use top 1 with ties as below
Select top 1 with ties * from GiftHeader
    order by row_number() over (partition by entityid order by [BatchDate])

Other traditional approach is
Select * from (
   Select *, RowN = row_number() over (partition by entityid order by BatchDate) from GiftHeader  ) a
Where a.RowN = 1

Output:
+----------+-------------------------+--------+
| EntityId |        BatchDate        | Amount |
+----------+-------------------------+--------+
|        1 | 2027-01-01 00:00:00.000 |      1 |
|        2 | 2027-02-01 00:00:00.000 |      4 |
+----------+-------------------------+--------+

A: You can use ROW_NUMBER as follow
SELECT EntityID,
       Date,
       Amount
FROM   (SELECT ROW_NUMBER()
                 OVER (
                   PARTITION BY EntityID
                   ORDER BY Date) AS RN,
               *
        FROM   GiftHeader) a
WHERE  a.RN = 1


text:
Q: Where to ask this question: 'For any given English writing, what is the probability that an author studied some Latin?' I tried already on History and then ELU, but both sites deemed my question 'off-topic'.
Also, please feel free to suggest improvements to make on-topic my question, as follows:

Premise 1: This question is restricted to (at least average) writing in only English, by which I mean writing by someone who at least graduated from high school. I lament, but know, that the uneducated would not have learned Latin.
By the 1960s, Latin education had already been reduced and superseded
  (per this answer).
  So authors born after 1959 probably did not study Latin as a mandatory
  subject, unless they attended a Latin
  school (eg Boston Latin
  Academy in the US).
So suppose that you are given any writing satisfying premise 1 above,
  and you know its year of publication. For all (documented) years,
  what's the rough probability of some study of Latin by the author (but
  whose proficiency may still < 100%)? I assume:
2.  the lack of an explicit answer from research or biographies,
3. the unknownness of the author's identity (eg an editorial or an
  advertisement).


text:
Q: Show $\sum_{n=-\infty}^{\infty} \frac{1}{(n+\alpha)^2} = \frac{\pi^2}{(\sin\pi\alpha)^2}$ The function in question is $f(x)= \frac{\pi}{\sin\pi\alpha}e^{i(\pi-x)\alpha}$ where $\alpha$ is not an integer.
With a bit of elbow grease, one can find that the Fourier series for $f$ is  $\sum_{n=-\infty}^{\infty} \frac{e^{inx}}{n+\alpha}$, so we apply Parseval's and try to work out $||f||^2$ to get the identity.
So
$$||f||^2 = \frac{1}{2\pi}\int_{0}^{2\pi}\frac{\pi^2}{\sin^2\pi\alpha}e^{2i(\pi-x)\alpha} dx$$
And some more elbow grease, I got to
$$||f||^2=\frac{\pi^2 \sin2\pi\alpha}{2\pi\alpha\sin^2\pi\alpha}$$
Which seems really close as there seems to be something close to a squeeze theorem going on, but alas there are no limits to make the excess junk go away. How can I simplify further to get the desired $||f||^2=\frac{\pi^2}{sin^2\pi\alpha}$? Or perhaps I missed something along the way?

A: You just need to take the square modulus of $f$, not the square. Indeed,
\begin{equation}
\vert f(x)\vert^2=\frac{\pi^2}{(\sin \pi\alpha)^2} \vert e^{i(\pi-x)\alpha}\vert^2=\frac{\pi^2}{(\sin \pi\alpha)^2},
\end{equation}
so integrating with the correct normalization gives the desired formula for $\|f\|^2$.

A: You could do it without integration.
Let
$$S_p=\sum_{n=-p}^{p} \frac{1}{(n+\alpha)^2}$$ $$S_p =-\frac{1}{\alpha ^2}+\psi ^{(1)}(-\alpha )+\psi ^{(1)}(\alpha )-\psi
   ^{(1)}(p-\alpha +1)-\psi ^{(1)}(p+\alpha +1)$$ Using the reflection formula of the polygamma function
$$\psi ^{(1)}(-\alpha )+\psi ^{(1)}(\alpha )=\frac{1}{\alpha ^2}+\pi ^2 \csc ^2(\pi  \alpha )$$ which makes
$$S_p=\pi ^2 \csc ^2(\pi  \alpha )-\psi
   ^{(1)}(p-\alpha +1)-\psi ^{(1)}(p+\alpha +1)$$ Now, using the asymptotics
$$\psi ^{(1)}(q)=\frac{1}{q}+\frac{1}{2 q^2}+\frac{1}{6
   q^3}+O\left(\frac{1}{q^5}\right)$$ apply it twice an continue with Taylor series to get
$$S_p=\pi ^2 \csc ^2(\pi  \alpha )-\left(\frac 2{p}+\frac 1{p^2}+\frac{6 \alpha ^2+1}{3 p^3}+O\left(\frac{1}{p^4}\right) \right)$$


text:
Q: Find vector and parametric equation of plane in $\Bbb R^{3}$ that passes through origin and is orthogonal to vector v. $v=(4,0,-5)$ and I am given the hint:
Construct two nonparallel vectors orthogonal to $v$ in $\Bbb R^3$.
I've looked at this post Find the equation of the plane passing through a point and a vector orthogonal but I don't see how that relates to the hint.
I am able to solve the question if it is a line in $\Bbb R^2$ that passes through the origin and orthogonal to a vector $v$. An example:
if $v=(-2,3)$
then a vector orthogonal to $v$ is $v_0=(-3,-2)$, the point at origin is $P_0=(0,0)$ so then $(x,y)=(0,0)+t(-3,-2)$ is the vector equation.

A: $$ (1) \ \textbf{w} = (5,0,4), \ \textbf{x} = \textbf{v} \times \textbf{w} $$
$$ (2) \ \textbf{w} = (5,0,4), \ \textbf{x} \cdot w =0, \textbf{x} \cdot v =0$$
$\cdot$ The above gives two ways to determine your normal. I started by getting a vector orthogonal to the one we started with. In the first and second case once we have $\textbf{x}$ will be your normal and now to get the equation of the plane we do: $$\textbf{x} \cdot (X -v) = 0, \ \text{where}\  X = (x_1,x_2,x_3)$$

A: If you know how to find an orthogonal vector to a given one in $\Bbb R^2$, you can do the same in $\Bbb R^3$ usually swapping two non-zero coordinates, switching one of the signs, and making the last coordinate zero. Surely you must be sure that other geometric aspects of the problem won't conflict with this zero we'll force.
Now, to your specific problem. Given the vector $v = (4,0,-5)$, some choices are: $(5,0,-4), (0,1,0)$. Also, any linear combination of these two guys will do the job (can you prove it?)

A: If
$v = (4, 0 , -5) \tag{1}$
then clearly
$w_1 = (0, 1, 0) \tag{2}$
is orthogonal to $v$; so is
$w_2 = (5, 0, 4), \tag{3}$
so $w_1$ and $w_2$ must span the plane normal to $v$; I found $w_1$ and $w_2$ by simple inspection, that is, intelligent (I hope!) guesswork!  The parametric equation of the plane is then
$(x, y, z) = sw_1 + tw_2 = s(0, 1, 0) + t(5, 0, 4) = (5t, s, 4t). \tag{4}$
We might also observe that $w_1$ is normal to $w_2$, so if we normalize $w_2$ to
$w_2' = (\dfrac{5}{\sqrt{41}}, 0, \dfrac{4}{\sqrt{41}}) \tag{5}$
we can express the plane in terms of the orthonormal pair $w_1$, $w_2'$:
$(x, y, z) = sw_1 + tw_2' = (\dfrac{5}{\sqrt{41}}t, s, \dfrac{4}{\sqrt{41}}t); \tag{6}$
and finally, we can always use the non-parametric vector form
$0 = v \cdot (x, y, z) = 4x - 5z. \tag{7}$
The vector $v$ given by (1) may be normalized to
$v' = (\dfrac{4}{\sqrt{41}}, 0, -\dfrac{5}{\sqrt{41}}) \tag{8}$
if so desired; then (7) becomes
$0 = v' \cdot (x, y, z) = \dfrac{4}{\sqrt{41}}x - \dfrac{5}{\sqrt{41}}z. \tag{9}$
Note that in the above I have been able to neglect inclusion of the point $P_0$ since here, as in the OP's $2$-dimensional example, $P_0 = 0$, the zero vector.
Hope this helps.  Cheers,
and as always,
Fiat Lux!!!

A: A plane is determined by 2 vectors and a point; and 2 vectors form the inclination of the plane (analogy: the slope of a line), or in other words, they determine the direction of the plane.
Therefore, you need to construct 2 non-parallel vectors to span the whole plane; if they are parallel, they can only span a line.
To obtain them, $(x,y,z)\cdot(4,0,-5)=0\Rightarrow4x-5z=0$, where you can choose any vectors that satisfy the conditions.


text:
Q: Drawing suspended while processing async NSURLConnection receive data I'm loading data from a server and processing the response asynchronously. Using NSURLConnection. Each call to the delegate, connection:didReceiveData: is processing that chunk.
However, right before a big chunk of data is received, I requested a text view to scroll to a new line, ie [textView scrollRangeToVisible:].
The problem is that often, the textView does not scroll until all the data have been received. This can be a while and makes the UI look hung.
To attempt to work around it, I was thinking the main thread is locked up processing the data, so I should break it up into smaller chunks.
So I changed to code to break up the data received in connection:didReceiveData to perform smaller operations, and queued them up using
[self performSelectorOnMainThread:withObject:smallerChunk waitUntilDone:FALSE]

The thinking being that it puts a bunch of events on the runloop and would handle the scrollRangeToVisible as it could.
However this isn't working. At least not reliably.
What am I missing?

A: "However this isn't working. At least not reliably." is a pretty vague error description. However, I would suggest that you process the data received from the connection in a background thread so that it will not block the main thread.
You can for example create a serial dispatch queue:
dispatch_queue_t myQueue = dispatch_queue_create("myQueue", DISPATCH_QUEUE_SERIAL);

and in connection:didReceiveData: submit the processing of the data to that queue:
dispatch_async(myQueue, ^{
    /* process data */
});


text: Q: Cut the "#div" part in the visible url I have a onepage block website. Main menu is a group of links leading to specific divs on the page. I would like the adress to stay the same. Links are like "mywebsite.com/#div1" etc., but after clicking it I would like the adress to stay in "mywebsite.com" form. Can you help me?


text:
Q: LUKS encrypted disk with pop_os installed booting into initramfs I've purchased a new SSD and created partitions for root, home, swap and boot.
I've encrypted root, home and swap using LUKS following the directions at https://www.ibm.com/docs/en/order-management-sw/10.0?topic=considerations-encrypting-data-partitions-using-luks.
Upon going through all the steps, I've installed pop_os on the partitioned SSD using the partitions I created earlier for /, /home, swap and /boot respectively.
I go to reboot and now the machine boots up with the gray pop_os background but no.login prompt. Hitting enter a few times drops me into an 'initramfs' shell.
I suspect the OS isn't booting because it is encrypted. I've scoured the internet looking for a solution but to no avail.
If what is happening makes sense to you, can you please assist because it is not obvious what I should be doing to boot up my LUKS encrypted OS install.


text:
Q: No of goals in a game of soccer using Poisson Suppose on average the number of goals in a soccer game follows a Poisson process with $\lambda = 4$ goals per game. In particular the distribution of the numbers of goals $X$ in one random game has density function
$$f_X(x) = P(X = x) = e^{-4}\frac{4^x}{x!}, \ \ x = 0, 1, 2,...$$ What is the probability of no goals in two games?
If it was the probability of no goals in one game, I would just sub in $0$ for the $x$'s for the answer. But how do you take account of the fact that it is over 2 games.

A: We are expected to assume that if $X$ is the number of goals in Game A and $Y$ is the number of goals in Game B, then $X$ and $Y$ are independent.
Thus the probability that $X=0$ and $Y=0$ is the product of $\Pr(X=0)$ and $\Pr(Y=0)$.

A: Andre's solution is great and I do not mean to step on any toes by extending this discussion further however I am a fan of the Poisson distribution and I think the following could be useful if you are going to be solving a lot of Poisson problems.
Another way of solving this problem (and others like it involving the Poisson distribution) is to write $Y = X_1 + X_2$ for the sum of the number of goals in games $1$ and $2$.  It turns out that the distribution of $Y$ is also Poisson with parameter $ \lambda_1 + \lambda_2$ where $\lambda_i$ is the parameter of $X_i's$ distribution.  In this case we see that the answer is $e^{-8}$ which agrees with Andre's solution.  This might not seem like a quicker way to solve the problem, but in general for: $$Y_n = \sum_{i=1}^{n}X_i \quad \ \quad X_i \sim Poisson(\lambda_i) \ , X_i \perp  X_j \ ;i \neq j$$ We get that: $$Y_n \sim Poisson(\sum_{i=1}^{n} \lambda_i)$$
You may immediately see the usefulness to this if you were instead asked: What is the probability that the same player above scores 15 goals in their first 10 games of the season?  Using the above technique you would need to calculate: $$\sum_{g_1 +\cdots +g_{10}=15}Pr(X_1=g_1)\cdots Pr(X_{10}=g_{10})$$
However with the knowledge of $Y_{10}'s$ distribution we can rattle off the answer quickly as: $$\frac{40^{15}e^{-40}}{15!} \approx 3.48\times 10^{-6}$$
We can also find all moments, cumulative probabilities, etc. very easily now as well.


text:
Q: jQuery Mobile: Trying to get an icon to display in the middle of some text I'm trying to get the icon to display in the middle of the words 'some text'.
Could anyone advise?
http://jsfiddle.net/LZxxB/50/

some

text

A: Here is one way to do it. You basically make an icon button that is not a button.
The HTML:

some

text

The CSS:
.nonbuttonicon .ui-btn {
    background: transparent;
    cursor: default;
    border: 0;
    margin: 0;
}
.nonbuttonicon .ui-btn:hover{
    background: inherit;
}

DEMO

UPDATE:
Here is a way without using jQM buttons and a single span:

some

text

.inlineIcon  {
    display: inline-block;
    position: relative;
    vertical-align: middle;
}
.inlineIcon:after{
    background-color: transparent;
}

Updated DEMO

An if you like the white icon on top of the round disk, the CSS becomes even simpler:

.inlineIcon  {
    display: inline-block;
    position: relative;
    vertical-align: middle;
}

DEMO

A: These lines of code will reset the jquery mobile css that is displaying it differently. You might need to tweak it a little bit to fit your needs.
div span.ui-icon-arrow-u-l:after {position:relative;}
div span.ui-icon-arrow-u-l {display:inline-block;height:30px;margin-top:0;width:16px;}

Hope this helps.


text:
Q: iphone - didSelectRowAtIndexPath: only being called after long press on custom cell I am creating one table view based application.  I have created a custom table cell for table, that contains 2 labels, 1 image and 1 button. The table view Data source method is working properly. I am using xib for both custom cell and view controller class and i connect delegate and data source to the file's owner. But the problem is when i select the table row, didSelectRowAtIndexPath is not getting fire. As mentioned the only way to fire it is to hold down on the cell for about 3-4 seconds. Does anyone have any idea why this is happening?
Thanks for any pointers...
Here is my table view methods..
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [finalAddonsArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    NewCustomCell *cell = (NewCustomCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        NSArray *nib=[[NSBundle mainBundle]loadNibNamed:@"NewCustomCell" owner:self options:nil];
        cell=[nib objectAtIndex:0];
    }

    Addons *addons1=[[Addons alloc]init];
    addons1= [finalAddonsArray objectAtIndex:indexPath.row];

    if (addons1.data == nil) {
        cell.ivCategory.image = [UIImage imageNamed:@"blogo.jpg"];
    }
    else
    {
        cell.ivCategory.image=[UIImage imageWithData:addons1.data];
    }

    cell.lblTitle.text = addons1.name;
    if (addons1.price == nil) {
        cell.lblPrice.text = nil;
    }
    else{
        cell.lblPrice.text = [NSString stringWithFormat:@"%@ rs",addons1.price];
    }
    [cell.button addTarget:self
                    action:@selector(editButtonPressed:)
          forControlEvents:UIControlEventTouchUpInside];

    cell.button.tag=indexPath.row;
    index = indexPath;
    cell.selectionStyle = UITableViewCellSelectionStyleGray;

    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"sjcjksbcjksbcfkebscf1234567890");
}

One more thing i am getting that if i am using default UITableViewCell instead of custom cell then also my problem is same, delegate method is not getting fire.
Custom cell properties:

A: I was faced with a similar issue:
For me, the problem was because my UITableView was added to an UIScrollView and more specifically to its contentView.
It appears that inside the contentView, I had to stay press 2-3 sec to fire the didSelectRowAtIndexPath method.
I moved my TableView to self.view instead of contentView and it solved the problem!

A: Maybe you will call the method
[tableView deselectRowAtIndexPath:indexPath animated:NO];

before Push ViewController or Other Operation. Like
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    // 1. manual call this method to deSelect Other Cell
    [tableView deselectRowAtIndexPath:indexPath animated:NO];

    // 2. than do other operation
    PushViewController Or Some Animation ....
}

that`s solve my problem .

A: As others suggested, [tap setCancelsTouchesInView:NO]; does the trick.
However, I want to make one thing clear:
If you think that you did not implement tapgesture and are curious about why you had to add your view into the protected views, check out your class because most probably you have inherited some class and that class includes tap gesture recognizer in it.
In my case, I did the following:
- (NSMutableArray *)tapProtectedViews
{
    NSMutableArray *views = [super tapProtectedViews];
    [views addObject:self.mTableView];
    return views;
}

Edit for Swift 4+
Assuming you have a UITapGestureRecognizer instance named tapGesture:
func disableTapGesture(){
    tapGesture.cancelsTouchesInView = false
}

Or you can:
if self.view.gestureRecognizers?.isEmpty == false{
    for recognizer in self.view.gestureRecognizers!{
        self.view.removeGestureRecognizer(recognizer)
    }
 }

A: same problem happened with me because I have added a tap gesture recogniser over it.
If you have used any gesture recognizer try removing it and check if it causing the problem.
EDIT: Solution as commented by the Ali:
If you have used tap gesture you can use [tap setCancelsTouchesInView:NO];

A: Dear i faced the same problem. When i tapped the cell but didselectrowatindexpath was not called than it was suddenly called when i released the button after pressing it for few seconds.
If you are facing the same issue there must be a
 1. UITapGestureRecognizer that is creating problem for you
                     or
 2. a scroll view in which you placed you table view.
Thus you should remove the gesture or the super scroll view in which your table view is placed

A: If you have custom gesture object on your view, check override func gestureRecognizerShouldBegin(_ gesture: UIGestureRecognizer) -> Bool delegate. Compare custom gesture with sender gesture, If its not custom gesture object, pass it to the the super. So system gestures/taps won't get blocked.

A: I'm not sure about this, but Delays Content Touches might have something to do with it.


text:
Q: Angular - Is it possible to calculate the age of someone directly in template? I'm doing {{today.getTime() - employee?.birthDate.getTime()}}, today being a Date instance with the date of today and employee?.birthDate being an instance of Date with the birthDate of the employee.
Thanks for your time :)