text:
Q: How do I switch between Chrome windows while in full screen on a Mac? Typically, if I am not in full-screen and the Chrome windows are on the same "virtual window" on my MacBook, I'll use "Cmd + `" which will take me to the next Chrome window open.
Is there a way to do this while in full screen in Chrome? Only change between Chrome windows?

A: Ctrl key + down arrow key

works like a charm for switching between chrome instances on my Macbook Pro.

A: Short answer: not possible.
This is not possible because the way in which Mac Spaces work and the function you're using are incompatible.
Mac Spaces organise content in different Spaces, and when you go fullscreen, that window gets its own Space.
cmd + ` switches between windows of the same application, but this state is not shared between Spaces.

A: Control+→ and Control+← is a default keybinding to switch between full-screen applications on MacOS.
As far as I know, there is not a way to limit it to only Google Chrome.

A: You can switch between tabs with ControlTab or ControlShiftTab.

A: CMD+MAJ+` with a magic keyboard (small)

A: Here is a partial answer that works for my situation, when the full screen mode is for presenting Google Slides (or the rare times I use that Microsoft product that rhymes with "Shower Joint").
What works for me is when going to presentation mode, to use the option for Presenter View. In Google I then close the window with speaker notes, and my slides are in display mode, but it's full in the tab, not window.
For display purposes (projector or say screen sharing from video conference app) it shows like full screen, no window or browser elements visible.
Now I can use Command+`to switch between my slides and another browser window where I am in say my video conference software. I like using this so I can jump from slides back to see the video conference chat.


text:
Q: Word that means make something available to all / to the working classes I am seeking a verb that essentially means 'Bring to the reach of everybody'. For example:

Travel was for the wealthy but the introduction of the package holiday xxxx travel.

Xxx is a word, like 'democratised', but it's not democratised and I can't think what it is! Any thoughts?

A: universalize

bring into universal use; make available for all.
attempts to universalize basic education
Kalam announced that a cess would be proposed on all central taxes to
finance the commitment to universalise access to basic education.
It has been shown through research the world over that there are huge
social benefits from universalizing elementary education.
Suppose you tried to universalize college education - how many people
would actually go for it? Lexico

We humans do tend to aggrandize our planet, but as long as there isn't anyone around to complain, what the hey.
I had to look up cess: (in Scotland, Ireland, and India) a tax or levy. Lexico. Evidently you can tax a tax.

A: In this context, the package holiday "revolutionized" travel.
https://www.thefreedictionary.com/revolutionizing

A: I found it remarkably difficult to come up with a verb that has this kind of specific meaning.
There is no verb form of the adjective available, which would be ideal.

However, in thinking of something that is at first available to only a few, but then becomes something routine or common, one verb is commonize:

[Merriam-Webster]
: to make (something) common, standard, or universal
// Because the book is considered to be so highbrow I wanted to "commonize" it a little bit. I didn't want to fall into the trap of being inaccessible.
— Kari Skogland, quoted in The Calgary (Alberta) Herald, 23 May 2008
// We have to reuse and commonize what has worked and what has been well received by the customers.
— Birgit Behrendt, quoted in Automotive News Europe, 13 June 2005

Ironically, it's not a common verb, but your sentence would become:

Travel was for the wealthy but the introduction of the package holiday commonized travel.

Other less satisfactory verbs I had originally considered included disinhibited, unleashed, derestricted, liberated, unbound, unchained, freed, and unfettered.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Finalizar processo por .bat sempre que o mesmo é iniciado Bom dia!
Sempre que inicio o computador o lindo processo GWX.exe (o famoso processo Instale o Win10) é executado, sendo necessário ir ao Gerenciador de Tarefas e finalizar o mesmo.
Sendo assim criei um .bat com a seguinte linha de comando:
@echo off
TASKKILL /F /IM "GWX.exe"

Porém, ainda é preciso aguardar o processo GWX.exe ser iniciado e então iniciar o .bat para finalizar o processo.

Minha dúvida é, existe algum comando via DOS (nem que seja um .bat chamando outro .bat) que seja algo como:
se processo GWX.exe estiver sendo executado
 então execute .bat
Aguardo retorno, obrigado desde já!

A: Vc pode Criar um comando .bat que da loop até que o GWX.exe seja fechado como
echo off

title Fecha o Arquivo GWX.exe a cada 10 seg

goto main

:main

eche Aguardando 10 Seg Para Fechar o Programa...

choice -c r -t 10 -d r >nul

taskkill -f -im GWX.exe

echo

goto main


text:
Q: vuejs - assigning variable with value as variable name I have some variables
data() {
    return {
      resData: {},
      datData: {},
      .....
    };
},

then I have method that need to assign values to resData and etc.
If name has value of resData then I need to assign value to the variable.
methods:{
  chgValue(name){
      if (name == 'resData') this.resData = 1;
      elseif .....
      else
  }
}

Instead of doing multiple if else statements, I'm trying to do something:
methods:{
  chgValue(name){
      this.window[name] = 1;
  }
}

But I receive error

TypeError: Cannot set property 'resData' of undefined

Any ways that i could achieve the method ?


text:
Q: For loop in R to download map data (raster package) I'm currently trying to plot a map of Africa using the different countries and plotting them together. I use the following code to download and plot a single country, which works perfect:
CMR <- getData('GADM', country='CMR', level=0)
plot(CMR)

I wanted to do this now for all the different countries in Africa. So I've made a charactervector (charafr) containing all these GADM codes and now I want to try to save them all to a seperate vector using a for loop. I'm a bit puzzled on how to assign these to seperate vectors. This is what I have:
for (i in 1:53){
     africancountries[i] <- getData('GADM', country=charafr[i], level=0)
}

This doesn't work and I'm not 100% sure on how to adjust the formatting so all the spatialpolygondataframes will be in a different vector.
Does anybody have an idea?
Thanks in advance.

A: You can do it like this
library(raster)
charafr <- c('RWA', 'BDI', 'UGA')

With a for loop:
ac <- list()
for (i in 1:length(charafr)){
     ac[[i]] <- getData('GADM', country=charafr[i], level=0)
}
allac <- do.call("bind", ac)

plot(allac)

Or, with lapply, more concise, but less readable:
charafr <- c('RWA', 'BDI', 'UGA')
allac2 <- do.call("bind", lapply(charafr, function(x)  getData('GADM', country=x, level=0)))

To save this to disk as a shapefile, you can do
shapefile(allac2, 'allac.shp')

A: I don't have the charafr vector so I'm not totally sure if this will function (I tested with a 2 element vector), but based on your comments above it should work. This will result in a single SpatialPolygonsDataFrame and it can be written out using writeOGR if you want a shapefile. Note this will function the same way as the list, in that if you want a specific country you need to call it using list syntax. However, it does have the spdf class.
uid <- 1

for ( i in 1:53 ) {

  africancountry <- getData( 'GADM', country=charafr[i], level=0 )

  n <- length( slot( africancountry, "polygons" ) )

  africancountry <- spChFIDs( obj = africancountry, x= as.character( uid:( uid+n-1 ) ) )

  uid <- uid + n

  if(i == 1){ africancountries <- africancountry } else { africancountries <- rbind( africancountries,africancountry ) }
}


text:
Q: What does require('express')() return? I am new to Node.js and I am sorry if this is too obvious!
I understand that the basic functionality of 'require' is that it reads a javascript file, executes the file, and then proceeds to return the exports object.
var app = require('express')();

Now, I can do stuff like app.set('view engine', 'html');, app.get() etc?
So, what is app exactly and how does it fit into the big picture of the web application ?

A: app is an object with all functions that the modul provides.
if you want more informations , try
 console.log(app);

A: You are requiring the Express module. It is basically an object with methods that are the Express. These functions can be accessed with app.<function name>, like app.set. You can console.log(app.set) to see the set function as a string.
This code outputs the Express object:
var express = require('express')
var app = express()

console.log(app)

Output:
{ [Function]
  init: [Function],
  defaultConfiguration: [Function],
  lazyrouter: [Function],
  handle: [Function],
  use: [Function: use],
  route: [Function],
  engine: [Function],
  param: [Function],
  set: [Function],
  path: [Function],
  enabled: [Function],
  disabled: [Function],
  enable: [Function],
  disable: [Function],
  get: [Function],
  post: [Function],
  put: [Function],
  head: [Function],
  delete: [Function],
  options: [Function],
  trace: [Function],
  copy: [Function],
  lock: [Function],
  mkcol: [Function],
  move: [Function],
  purge: [Function],
  propfind: [Function],
  proppatch: [Function],
  unlock: [Function],
  report: [Function],
  mkactivity: [Function],
  checkout: [Function],
  merge: [Function],
  'm-search': [Function],
  notify: [Function],
  subscribe: [Function],
  unsubscribe: [Function],
  patch: [Function],
  search: [Function],
  connect: [Function],
  all: [Function],
  del: [Function],
  render: [Function],
  listen: [Function],
  setMaxListeners: [Function: setMaxListeners],
  emit: [Function: emit],
  addListener: [Function: addListener],
  on: [Function: addListener],
  once: [Function: once],
  removeListener: [Function: removeListener],
  removeAllListeners: [Function: removeAllListeners],
  listeners: [Function: listeners],
  request: { app: [Circular] },
  response: { app: [Circular] },
  cache: {},
  settings:
   { 'x-powered-by': true,
     etag: 'weak',
     'etag fn': [Function: wetag],
     env: 'development',
     'query parser': 'extended',
     'query parser fn': [Function],
     'subdomain offset': 2,
     'trust proxy': false,
     'trust proxy fn': [Function: trustNone],
     view: [Function: View],
     views: '<<<<<obfuscated>>>>>>>',
     'jsonp callback name': 'callback' },
  engines: {},
  _events: { mount: [Function] },
  locals:
   { settings:
      { 'x-powered-by': true,
        etag: 'weak',
        'etag fn': [Function: wetag],
        env: 'development',
        'query parser': 'extended',
        'query parser fn': [Function],
        'subdomain offset': 2,
        'trust proxy': false,
        'trust proxy fn': [Function: trustNone],
        view: [Function: View],
        views: '<<<<<obfuscated>>>>>>>',
        'jsonp callback name': 'callback' } },
  mountpath: '/' }


text:
Q: Как в Google maps API задать стартовую позицию для карты из множества адресов? Друзья, очень нужна помощь, всю голову сломал, есть Google карта, с массивом адресов:
var locations = [
['Москва, Россия', 'Москва', 'infowindow 1'],
['Барнаул, Россия', 'Барнаул', 'infowindow 2'],
['Улан-Удэ, Россия', 'Улан-Удэ', 'infowindow 3']
];

Далее из адресов получаем позицию на карте с помощью функции geocode и в цикле расставляем маркеры на карте, и по клику переходим перемещаемся по ним.
Но вот беда, при загрузке карты, центр карты ставится на ПОСЛЕДНИЙ элемент массива, на последний адрес, на последний маркер.  А мне нужно на первый, как это сделать ума не приложу, уже все испробовал :( помогите пожалуйста.
Вот поднял пример https://codepen.io/Cheizer/pen/ZgKPNG
Как видите адрес начальный ставится на Улан-Удэ, а нужно на Москву. Как это сделать?

A: Вот пример моего кода, который реализовывает эту задачу.
    const data = [
    {id: "1", fullname: "FirstName LastName",
    address: "Canada, 1150-206, Lisbon metropolitan area, Lisbon, R. Júlio de
    Andrade 3"
    latitude: 38.719463
    longitude: -9.1410403
},
   {
id: "2",   address: "Panama, 65806-2543, Missouri, Springfield"
    fullname: "Ivan Petrov"
    latitude: 37.2034299
    longitude: -93.2935778
   }]

data.forEach(item => {
        item.coords = new google.maps.LatLng(+item.latitude, +item.longitude);
        this.listPersons.push(item);
      });

const bounds = extendBounds(this.listPersons);
      map.setCenter(bounds.getCenter());
      map.fitBounds(bounds);
      setTimeout(() => {
        setCorrectZoom(map);
      }, 200);

function extendBounds(listCoords) {
      const bounds = new google.maps.LatLngBounds();
      listCoords.forEach(item => {
        bounds.extend(item.coords);
      });
      return bounds;
    };

function setCorrectZoom(map) {
      const currentZoom = map.getZoom();
      if (currentZoom > 15) {
        map.setZoom(15);
      }
    };

A: Решение, в цикле добавить
  for (var i = 0; i < locations.length; i++) {
    //geocodeAddress(locations[i]);
  geocodeAddress(locations[i], i == 0);
}

И в функцию geocodeAddress добавить аргумент isSetToCenterMap, и сделать на него проверку пере установкой центра карты
 if (isSetToCenterMap){
       map.setCenter(results[0].geometry.location);
   }

Осталось одна проблема, иногда подглючивает карта, кликаешь на один город, а показывает предыдущий или следующий, непонятно почему.


text:
Q: Identifying state of tic-tac-toe board from image I'm working on a project where I have to use openCV in java to identify the state of a tic tac toe board. Please see the sample program execution below.
input

Output
X,-,-

-,O,-

X,-,-

I'm trying to solve this by finding contours in the image, but the problem is that the empty unmarked boxes are also being captured and I'm not being able to distinguish between the shapes using contour properties like polygon size and contour area. Below is the code that I have so far.
package finalproject;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfInt;
import org.opencv.core.MatOfPoint;
import org.opencv.core.MatOfPoint2f;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;

public class FinalProject {
    public static void main(String[] args) {

    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    Mat image = Imgcodecs.imread("C://Users//BadarJahan//Desktop//board-
    perfect.jpg");

    Mat binaryImage = preprocess(image);

    List<MatOfPoint> contours = new ArrayList<>();
    Imgproc.findContours(binaryImage, contours,new Mat() ,Imgproc.RETR_CCOMP, Imgproc.CHAIN_APPROX_SIMPLE);
    List<MatOfPoint2f> contoursConvert = new ArrayList<>();

    for(MatOfPoint contour : contours) {
        contoursConvert.add(new MatOfPoint2f(contour.toArray()));
    }

    identifyTicTacToeConfiguration(binaryImage,contoursConvert);

}

    private static Mat preprocess(Mat colorImage) {
//      Imgproc.resize(colorImage, colorImage, new Size(489,0));
        Mat grayImage = new Mat() , binaryImage = new Mat();
        Imgproc.cvtColor(colorImage, grayImage,Imgproc.COLOR_BGR2GRAY);
        binaryImage = grayImage;
        Imgproc.threshold(grayImage, binaryImage, 0, 255, Imgproc.THRESH_BINARY_INV | Imgproc.THRESH_OTSU);
        final Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(5,5));
        Imgproc.morphologyEx(binaryImage, binaryImage, Imgproc.MORPH_CLOSE, kernel);
        return binaryImage;
    }

    private static MatOfPoint2f getApproxPoly(final MatOfPoint2f contour) {
        MatOfPoint2f polyContour = new MatOfPoint2f();
        final double epsillon = Imgproc.arcLength(contour, true) * 0.02;
        final boolean close = true;
        Imgproc.approxPolyDP(contour, polyContour, epsillon, close);
        return polyContour;
    }

    private static void printContourProperties(final MatOfPoint contour) {
        final double contourArea = Imgproc.contourArea(contour);
        MatOfInt convexHull = new MatOfInt();
        Imgproc.convexHull(contour, convexHull);
 //     final double convexHullArea = Imgproc.contourArea(convexHull);
        Rect boundingRect = Imgproc.boundingRect(contour);
        MatOfPoint2f poly =  getApproxPoly(new
        MatOfPoint2f(contour.toArray()));
        System.out.println("Contour area : " + contourArea);
        System.out.println("Aespect Ratio : " +
        boundingRect.width/boundingRect.height);
        System.out.println("Extend: " + contourArea/boundingRect.area());
 //     System.out.println("Solidity : " + contourArea/convexHullArea);
        System.out.println("Poly Size : " + poly.size().area() + ", is
        convex " + Imgproc.isContourConvex(new MatOfPoint(poly.toArray())));
        System.out.println();
    }

    private static void showContourProperties(final Mat input, final List<MatOfPoint> contours) {
        Mat inputCopy = new Mat();
        for(int i = 0; i < contours.size(); i++) {
            input.copyTo(inputCopy);
            Scalar color = new Scalar(255);
            final int thickness = 3;
            Imgproc.drawContours(inputCopy, contours, i, color,thickness);
            printContourProperties(contours.get(i));
            Imgcodecs.imwrite("C://Users//BadarJahan//Desktop//Test-1-check-
            "+i+".jpg", inputCopy);
        }
    }

    private static ContourType recognizeContourType(final MatOfPoint2f contour) {
        final double contourArea = Imgproc.contourArea(contour);
        final MatOfPoint2f poly = getApproxPoly(contour);
        ContourType type = ContourType.Unknown;
        if((poly.elemSize() > 7 && poly.elemSize() < 10) && contourArea < 1000) {
             type = ContourType.OType;
        }else if(contourArea > 10000) {
            type = ContourType.XType;
        }
        return type;
    }

    private static void identifyTicTacToeConfiguration(final Mat input, final List<MatOfPoint2f> contours) {

        for(MatOfPoint2f contour: contours) {
            ContourType type = recognizeContourType(contour);

            if(type == ContourType.XType) {
                System.out.print("X");
            }else if(type == ContourType.OType) {
                System.out.print("O");
            }
        }
    }
}

Any help would be greatly appreciated. Thanks

A: As I looked into this I was having fun, so I got carried away a bit. The result and code is below. I used python, but I'm sure you'll figure it out ;)
To diffenciate between X en O I used solidity. Solidity is the ratio of contour area to its convex hull area. For an O that is close to 1, for an X less than half.
Note: the tiles are randomly numbered, the actual location needs to be determined based on the x/y location. Second, an O will result in 2 circles, both with solidity near 1.

import numpy as np
import cv2

#create a 2d array to hold the gamestate
gamestate = [["-","-","-"],["-","-","-"],["-","-","-"]]

#kernel used for noise removal
kernel =  np.ones((7,7),np.uint8)
# Load a color image
img = cv2.imread('X_O.jpg')
# get the image width and height
img_width = img.shape[0]
img_height = img.shape[1]

# turn into grayscale
img_g =  cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# turn into thresholded binary
ret,thresh1 = cv2.threshold(img_g,127,255,cv2.THRESH_BINARY)
#remove noise from binary
thresh1 = cv2.morphologyEx(thresh1, cv2.MORPH_OPEN, kernel)

#find and draw contours. RETR_EXTERNAL retrieves only the extreme outer contours
im2, contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(img, contours, -1, (0,255,0), 15)

tileCount = 0
for cnt in contours:
        # ignore small contours that are not tiles
        if cv2.contourArea(cnt) > 200000:
                tileCount = tileCount+1
                # use boundingrect to get coordinates of tile
                x,y,w,h = cv2.boundingRect(cnt)
                # create new image from binary, for further analysis. Trim off the edge that has a line
                tile = thresh1[x+40:x+w-80,y+40:y+h-80]
                # create new image from main image, so we can draw the contours easily
                imgTile = img[x+40:x+w-80,y+40:y+h-80]

                #determine the array indexes of the tile
                tileX = round((x/img_width)*3)
                tileY = round((y/img_height)*3)

                # find contours in the tile image. RETR_TREE retrieves all of the contours and reconstructs a full hierarchy of nested contours.
                im2, c, hierarchy = cv2.findContours(tile, cv2.RETR_TREE , cv2.CHAIN_APPROX_SIMPLE)
                for ct in c:
                        # to prevent the tile finding itself as contour
                        if cv2.contourArea(ct) < 180000:
                                cv2.drawContours(imgTile, [ct], -1, (255,0,0), 15)
                                #calculate the solitity
                                area = cv2.contourArea(ct)
                                hull = cv2.convexHull(ct)
                                hull_area = cv2.contourArea(hull)
                                solidity = float(area)/hull_area

                                # fill the gamestate with the right sign
                                if(solidity > 0.5):
                                        gamestate[tileX][tileY] = "O"
                                else:
                                        gamestate[tileX][tileY] = "X"
                # put a number in the tile
                cv2.putText(img, str(tileCount), (x+200,y+300), cv2.FONT_HERSHEY_SIMPLEX, 10, (0,0,255), 20)

#print the gamestate
print("Gamestate:")
for line in gamestate:
        linetxt = ""
        for cel in line:
                linetxt = linetxt + "|" + cel
        print(linetxt)

# resize final image
res = cv2.resize(img,None,fx=0.2, fy=0.2, interpolation = cv2.INTER_CUBIC)

# display image and release resources when key is pressed
cv2.imshow('image1',res)
cv2.waitKey(0)
cv2.destroyAllWindows()


text: Q: chrome.webRequest equivalent in iOS Safari Webextension Since iOS Safari doesn't support web request is there another way to capture the web requests? I don't want to modify it just wanted to capture some of the intra web requests that the parent page makes


text:
Q: how to repeat a code on user input? I want to repeat the code until the user gets the no. right. How do I do this ?
This is the code:-
function getRandomNumber(min,max){
     return Math.floor(Math.random()*(max - min + 1 ))+min;
 }
 randomNumber=(getRandomNumber(1,10));

 input=prompt("Please enter a no. between 1 and 10:","");
 if(input==randomNumber){
     console.log("Good Work");
 }else{
     console.log("not matched");
 }

A: You could either use a while loop that calls a "break" statement once the user inputs the correct answer, or you could use a function like this:
function getInput(){
 input=prompt("Please enter a no. between 1 and 10:","");
 if(input==randomNumber){
     console.log("Good Work");
 }else{
     consol.log("not matched");
     getInput(); //Gets the user's input again
 }
}

A: Here you go...
Found needs to be set to false before you start, otherwise the function will only run one.  There is little point having the function definition inside the while loop, since it will be created as a global variable.

var found = false;

function getRandomNumber(min,max) { return Math.floor(Math.random()*(max - min + 1 ))+min; }

while ( found != true ) {

  var randomNumber = getRandomNumber(1,10);

 console.log('Random Number is..',randomNumber);

  var input = prompt("Please enter a no. between 1 and 10:","");

  if ( input == randomNumber ) {
      alert('Well Done')
      found = true;
  } else {
      console.log("not matched");
  }
}


text:
Q: Error with urllib3 and the python-telegram-bot API when i try to run my script (my telegram bot) the following appears in terminal:
/usr/local/lib/python3.7/dist-packages/python_telegram_bot-12.4.2-
py3.7.egg/telegram/utils/request.py:47: UserWarning: python-telegram-bot is using upstream urllib3.
This is allowed but not supported by python-telegram-bot maintainers.

what I do?
Thanks a lot

A: Originally, python-telegram-bot only shipped with a vendored version of urllib3 that was created to fix a bug that could not be fixed upstream.
To allow python-telegram-bot to be shipped as part of Linux distributions, the dependency on the vendored urllib3 has been made optional, allowing python-telegram-bot to work with the standard urllib3.
So the message you're seeing is expected behavior if you installed python-telegram-bot through your distribution's packet manager. If your bot works fine, you don't have to change anything.


text:
Q: javascript error: Cannot read properties of undefined (reading 'element') I am trying to run the following code:
WebElement body = driver.findElement(By.xpath("/html/body"));
js.executeScript("var injector = window.angular.element(argument[0]).injector(); var $http = injector.get('$http'); return ($http.pendingRequests.length === 0);",body);

I however get the following error:
org.openqa.selenium.JavascriptException: javascript error: Cannot read properties of undefined (reading 'element')
  (Session info: chrome=103.0.5060.134)
Build info: version: '4.2.2', revision: '683ccb65d6'
System info: host: 'DESKTOP-UPVJF2U', ip: '192.168.0.132', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '18.0.1.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [c6b4ce36aa115d9746065cead6c3271b, executeScript {script=var injector = window.angular.element(argument[0]).injector(); var $http = injector.get('$http'); return ($http.pendingRequests.length === 0);, args=[{ELEMENT=a0c33e06-9db9-49ed-984f-535b6bc72f7a, element-6066-11e4-a52e-4f735466cecf=a0c33e06-9db9-49ed-984f-535b6bc72f7a}]}]
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 103.0.5060.134, chrome: {chromedriverVersion: 103.0.5060.134 (8ec6fce403b..., userDataDir: C:\Users\win10\AppData\Loca...}, goog:chromeOptions: {debuggerAddress: localhost:53279}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: WINDOWS, proxy: Proxy(), se:cdp: ws://localhost:53279/devtoo..., se:cdpVersion: 103.0.5060.134, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: c6b4ce36aa115d9746065cead6c3271b
    at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:200)
    at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:133)
    at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:53)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:184)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:588)
    at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:522)
    at com.vilcart.app.CustomerCreation.testCreation(CustomerCreation.java:118)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
... Removed 28 stack frames

Can you please let me know how i could resolve this issue?

A: Since you want to get arguments list element by index try to replace
argument[0]

with
arguments[0]

A: @suhail shaik You can try the following, assuming you want to check if all the pending $http requests are served by Angular in the background.
  String angularReady = "return angular.element(document).injector().get('$http').pendingRequests.length === 0";

  boolean isAngularReady = (boolean)js.executeScript(angularReady);

A: I have gone through this link which helped me find a solution. This has a way to put wait for angular version 5 which is working for my current angular version 11.
https://www.swtestacademy.com/selenium-wait-javascript-angular-ajax/


text:
Q: Problem with remoted display of java applications I'm trying to remote display Java based development environments, such as NetBeans and IntelliJ, from a linux machine to a windows machine.  When I do this, the right click functionality of the environments does not work, which makes them unusable.
I use the -X option with Putty to tunnel X through SSH.  I've repeated this using Ubuntu and RedHat to my Windows running Xming.   Is there a trick to remote Xing java applications that I'm missing?

A: From this post on the java.net forums it seems that there are "incorrect insets detection when using the Xming".  The fix is to set the AWT_TOOLKIT environment variable.  Explanation for why can be found on Sun's page here.
AWT_TOOLKIT=MToolkit

Setting this environment variable fixed all problems.
Update:
The link containing the original link has changed. See here.

A: I also had errors in our Solaris 11 server to Windows 7 desktop using Xming. We were installing some Oracle (Java) apps on the Solaris 11 server and we had issues with XMing with input field becoming uneditable at random times. We tried so many parameter changes and nothing worked (not even a corporate license of Exceed, but that was another issue). We tried using MobaXterm and that worked well and allowed us to do our Oracle installs without issue.

A: Have you tried this other XServer tool?
http://mobaxterm.mobatek.net/
I used to have issues with XMing, this one is not only faster, but solved some of those issues for me (input field becoming uneditable among them).
I'm using the free 6.2 portable version. Make sure you start your session from inside the GUI, this way you don't even have to export the display.
I hope this helps!

A: I had exactly the same problem with Xming and a remote Java application installer on CentOS 6.9. When I used Xlaunch and selected the "Multiple windows" mode and no access control - I was unable to click on text fields in the UI. The Xming command from the log was:
Xming :0 -multiwindow -clipboard -ac

However I just found that if I used "One window" mode then I was able to click on text fields and edit content :)
Xming :0 -clipboard -ac

I recommend you try this for the problem you faced (unless you have already switched over to mobaxterm). I am happy to have a workaround that works but still curious to know the root cause and if its possible to fix this for multiwindow mode. I did try AWT_TOOLKIT=MToolkit but this made no difference for me in multiwindow mode.


text:
Q: Visual Studio 2015 Publishing Issue I am able to build the solution and run in Debug mode but when I try to publish to my local inetpub directory it fails!?!?!
Here is the build output (showing that all is well)

Then, here is the publish output:

Here is the class and reference in question. This proves and shows that all is legit.

Can you please help me out here.

A: *

*First build your solution in Release mode and check there are no
errors.

*Also make sure that in your BL Project Bin\Release folder,
DAL project DLL is copied.

*Start Publish again.


text:
Q: How can I connect to SQL Server 2008 R2 with django-mssql? I cannot figure out why I cannot get django to connect with sql server 2008 r2. I have administrative privileges on our server and on sql server. I have constructed a virtual windows box with windows server 2008 sp2 because I thought I might have some luck with django-mssql. I've tried both django-pyodbc and django-mssql on the windows box but have not yet succeeded. Here are my db settings:
DATABASES = {
    'default': {
        'ENGINE': 'sqlserver_ado',  # Have also tried sql_server.pyodbc
        'NAME': 'TMSEPLAY',
        'USER': '***', # Omitted for post
        'PASSWORD': '*******', # Omitted for post
        'HOST': '172.16.1.14',
        'PORT': '1434',
        'OPTIONS': {
            'provider': 'SQLCLI10', # Have also tried 'SQLCLI11' and 'SQLOLEDB'
            'extra_params': 'DataTypeCompatibility=80'
            }
    }
}

The error I get:
C:\Python27\CourseData\mysite>manage.py syncdb
Traceback (most recent call last):
  File "C:\Python27\CourseData\mysite\manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
443, in execute_from_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 196,
 in run_from_argv
    self.execute(*args, **options.__dict__)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 232,
 in execute
    output = self.handle(*args, **options)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 371,
 in handle
    return self.handle_noargs(**options)
  File "C:\Python27\lib\site-packages\django\core\management\commands\syncdb.py"
, line 57, in handle_noargs
    cursor = connection.cursor()
  File "C:\Python27\lib\site-packages\django\db\backends\__init__.py", line 306,
 in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "C:\Python27\lib\site-packages\sqlserver_ado\base.py", line 193, in _curs
or
    self.__connect()
  File "C:\Python27\lib\site-packages\sqlserver_ado\base.py", line 168, in __con
nect
    use_transactions=self.use_transactions,
  File "C:\Python27\lib\site-packages\sqlserver_ado\dbapi.py", line 151, in conn
ect
    raise OperationalError(e, "Error opening connection: " + connection_string)
sqlserver_ado.dbapi.OperationalError: (com_error(-2147352567, 'Exception occurre
d.', (0, u'ADODB.Connection', u'Provider cannot be found. It may not be properly
 installed.', u'C:\\Windows\\HELP\\ADO270.CHM', 1240655, -2146824582), None), 'E
rror opening connection: DATA SOURCE=172.16.1.14,1434;Network Library=DBMSSOCN;I
nitial Catalog=TMSEPLAY;UID=***;PWD=********;PROVIDER=SQLCLI10;MARS Connection=Tr
ue;DataTypeCompatibility=80;MARS Connection=True')

I'd appreciate any insight. Thanks.

A: I can see an error message in that log:
$Error opening connection: DATA SOURCE=172.16.1.14 port:1434
So I would see if all instances are running and is accessible on that machine through port 1434.
Also, the following may help:
Setting up django-mssql issues


text:
Q: Transform key points in image
I would like to transform several key points of an image.
As one can see in the example image, only parts of the image are transformed while other parts of the image are left intact. This way only the nose gets thinner.
As far as I know, a Matrix can only transform an entire image, but that is not what I need.
Is there a function in System.Drawing that would allow me to do this easily?


text:
Q: For dinner, $n$ people came and sat at a round table at random. If Ana, Ivan and Mark were among them, how many ways could they sit so ... Problem:

For dinner, $n$ ($n \geq 4$) people came and sat at a round table at random. If Ana, Ivan and Mark were among them, how many ways could they sit so that Ana and Ivan do not sit next to each other and at least one of them sits next to Mark? (Note: the round table implies seating arrangements that differ only in rotation.)

My attempt: If I have $n$ people sitting around circular table, the number of different arrangements are $(n-1)!$.
If I have $2$ people Mark and Ana number of arrangements that they can sit next to each other is $2 \cdot (n-2)!$.
So the number of arrangements that Mark sit next to Ivan is also  $2 \cdot (n-2)!$, and sitting next to Ana also  $2 \cdot (n-2)!$.
That all I know about this problem.

A: Method 1:  Seat Mark.  We will use him as our reference point.
Only Ana sits next to Mark: She can be seated in two ways, to his left or to his right.  That leaves $n - 2$ seats.  Since Ivan cannot sit next to Ana or Mark, he may be seated in $n - 4$ ways.  The remaining $n - 3$ people can be seated in the remaining $n - 3$ seats in $(n - 3)!$ ways as we proceed clockwise around the table relative to Mark.  Hence, there are $2(n - 4)(n - 3)!$ such arrangements.
Only Ivan sits next to Mark:  By symmetry, there are $2(n - 4)(n - 3)!$ such arrangements.
Both Ana and Ivan sit next to Mark:  There are two ways to seat Ana, to Mark's left or to his right.  Ivan must sit on the other side of Mark.  The remaining $n - 3$ people may be seated in the remaining $n - 3$ seats in $(n - 3)!$ ways as we proceed clockwise around the table relative to Mark.  Hence, there are $2(n - 3)!$ such seating arrangements.
Total:  Since the three cases are mutually exclusive and exhaustive, the number of admissible seating arrangements is
\begin{align*}
2(n - 4)(n - 3)! + 2(n - 4)(n - 3)! + 2(n - 3)! &
= [4(n - 4) + 2](n - 3)!\\
& = (4n - 14)(n - 3)!
\end{align*}
Method 2:  Seat Mark.  We will use him as our reference point.
Choose whether Ana or Ivan sits next to him.  Choose on which side of Mark that person sits.  Seat the remaining $n - 2$ people as we proceed clockwise around the circle relative to Mark.  This gives
$$2 \cdot 2 \cdot (n - 2)! = 4(n - 2)!$$
seating arrangements.
From these, we must subtract those arrangements in which Ana and Ivan sit next to each other.  For this to happen, they must both sit on the same side of Mark.  Choose which of them sits next to Mark.  Choose on which side of Mark that person sits.  If that person is Ana, there is only one way to seat Ivan next to her since Mark is on her other side.  Similarly, if Ivan sits next to Mark, there is only one way to seat Ana next to Ivan since Mark is on his other side.  Once those three seats have been filled, seat the remaining $n - 3$ people in the remaining $n - 3$ seats as we proceed clockwise around the table.  There are
$$2 \cdot 2 \cdot (n - 3)! = 4(n - 3)!$$
such seating arrangements.
We must also subtract those seating arrangements in which both Ana and Ivan sit next to Mark since we have counted them twice in our initial count, once when we designated Ana as the person who sits next to Mark and once when we counted Ivan as the person who sits next to Mark.  As we showed above, there are
$$2(n - 3)!$$
seating arrangements in which both Ana and Ivan sit next to Mark.
Hence, the number of admissible seating arrangements is
$$4(n - 2)! - 4(n - 3)! - 2(n - 3)! = [4(n - 2) - 4 - 2](n - 3)! = (4n - 14)(n - 3)!$$

A: First consider just the arrangements of A,M and I.
There are $2$ arrangements for all three to be together since M must be in the middle.
There are $4(n-4)$ arrangements for just two to be together since we choose one of A and I to be on one or other side of M and then place the third of them in one of $n-4$ seats.
We therefore have $4n-14$ arrangements for the named people and for each of these arrangements there are $(n-3)!$ arrangements of the remaining guests; a total of $(4n-14)(n-3)!$ arrangements.

A: The types of possibilities for Ana, Mark, Ivan, and $n-3$ empty chairs can be written as

*

*$AMI-$

*$IMA-$

*$AM-I-$

*$MA-I-$

*$IM-A-$

*$MI-A-$,

where $-$ indicates a row of at least one chair.  Each configuration corresponds to $(n-3)!$ seatings, accounting for the placement of the remaining $n-3$ people in chairs.  1. and 2. are unique configurations (the row of chairs has length $n-3$); the remaining items correspond to $n-4$ configurations each, since the length of the first row of chairs can be $1,2,\ldots,n-4$.  So the total is
$$
(n-3)!\cdot(2 + 4\cdot(n-4)) = (4n-14)(n-3)!
$$

A: Let $A$ represent the number of seating arrangements when either Ana is next to Mark or Ivan is next to Mark, but not both. If $n \ge 5$ it is not difficult to show that
$\tag 1 A = 4 (n-3) (n-4) \,(n-4)!$
The factor of $4 = 2 \times 2$ is obtained by doubling for the Ana/Ivan interchange and the left/right interchange. The remaining $n - 2$ factors result from applying the rule of product while seating the remaining $n - 2$ people (the last person seated corresponds to a factor of $1$). But $A = 0$ when $n = 4$ and so $\text{(1)}$ also supplies the correct count for $n \ge 4$.
Let $B$ represent the number of seating arrangements when both Ana and Ivan are next to Mark. It is not difficult to show that
$\tag 2 B = 2 \,(n-3)!$
The factor of $2$ is obtained by doubling for the Ana/Ivan interchange which also incorporates, at the same time, the left/right interchange. Again, we seat each of the remaining people while using the rule of product.
Employing algebra we compute
$\tag 3 A + B = (4n - 14) \, (n - 3)!$
Compare the above technique to N. F. Taussig's Method 1 (a slight difference).

A: We can also find the answer using recursive techniques.
This problem only has solutions when $n \ge 4$. For $n \ge 4$ define
$\quad A(n) = \text{the number of solutions where Mark IS NOT next to BOTH Ana and Ivan.}$
$\quad B(n) = \text{the number of solutions where Mark ---IS----  next to BOTH Ana and Ivan.}$
We want to find the sum $C(n) = A(n) + B(n)$.
We can insist that our seating counting algorithm is accomplished by seating a single person at a time to the existing multiplicity of seating arrangements as they 'arrive'. Also, the first three people to arrive are  Mark, Ana and Ivan.
So when the fourth person arrives we have
$\quad A(4) = 0 \text{ and } B(4) = 2$
seating arrangements.
Suppose we have a list of all the seating arrangements for $n$ people, and now we have to seat the next $(n+1)^{\text{th}}$ person. Using combinatorial/counting arguments, it can be demonstrated that
$\tag A A(n+1)  = (n-1)A(n) + 4B(n)$
and
$\tag B B(n+1) = (n-2) B(n)$

A fun thing about combinatorial problems is they can often be solved in several ways, and then you can confirm the answer when the different solutions give the same result. The interested reader can work on the following:
Exercise: Using inductin, show that the recursive model discussed here gives the same results as the the seating arrangement methods found in this answer.

It is also possible to derive the closed formula answer starting with this recursion model - see this.


text:
Q: Is it possible to support iPad HD only device while releasing app to Apple AppStore? Update:
iPad HD : iPad Retina (high resolution) (2048x1536)
iPad : Medium resolution (1024x768)
iphone : Low Resolution (below 1024x768)
I'm a c++ developer and mostly develop our apps on cocos2d-x to support cross platform.
Since we are supporting all device resolutions, we need to ship all resource contents (iphone, ipad and ipadhd) in one universal binary for Apple AppStore. The accumulative size is 38MB for our app and its already in the Apple AppStore.
We have been thinking about spliting app to support for iPhone, iPad and iPadHD separately. But in "xcode > Target > Devices", I can see only three options iPhone, iPad and Universal.
What I'm aware of?

*

*If I go to support iPhone and iPad individually, I need two different names like AppName and AppName for iPad.

*We can not use the existing name and bundle id, and continue to support only one of the target devices if it is already a universal binary.

What I want to accomplish?

*

*I want to have three different packages for same app with three different names(or bundle id's) like AppName, AppName for iPad and AppName HD for Apple AppStore.

*Packing only resources required to support the individual target device (I can use python scripting to remove irrelevant resource assets).

*Whenever there is any update, release for individual target devices.

What is the issue?

*

*How to support iPad HD only? I don't want to bundle ipad(12MB) and ipadhd(17MB) resources in one binary. Is it possible to accomplish this task?

*If the above problem has no solution and I choose target device as iPad, Do I need to support iPad and iPad HD both?

Thanks

A: Manish, one solution is to "simply" download the large images after the user purchases the app.  It's common with games that that happens.  First you download the app off the app store, and then it says "Loading dragon costumes!" or whatever and then it downloads a half gig of dragon costumes.
Whatever platform you are using , Unity3D or whatever, there is usually a trivial way to do this (since most games do it).
BTW two points, (a) 38mb is nothing for a game, so forget that. and (b) you are very smart to only target users with modern machines.  Users with old machines are cheap, they don't pay for stuff.  It's all but pointless supporting anything less than iOS7, for example, unless you are the biggest most world-famous games.


text:
Q: Casting varchar as date I think I've read just about every thread on this topic and none of them are solving my problem.
First of all, the database I'm working with has all date fields set to a varchar data type, which drives me insane because I constantly have to cast or convert whenever I'm working with any queries involving dates.
The query I'm working with at the moment is supposed to pull a list of medical patients who all have a certain diagnosis, but that diagnosis has to have been given before a certain date. Here's what I've got.
SELECT DISTINCT
    pd.PatientID,
    pd.PatientName,
    pmh.DateOfOnset
    pmh.DiagnosisCode
FROM PatientDemographic pd JOIN PatientMedicalHistory pmh ON pd.PatientID = pmh.PatientID
WHERE pmh.DiagnosisCode = '401.1'
    AND CAST(pmh.DateOfOnset as Date) > CAST('12/31/2014' as Date)

I'm getting an error that says "Conversion failed when converting date and/or time from character string." It's telling me the error is on Line 1 though (the SELECT DISTINCT line) so that's not really helpful and I'm not sure what I need to fix.
As I mentioned, the DateOfOnset field has a varchar data type, and I need to find any of those dates that came before the end of December, 2014. I've tried to remedy this error by trying different combinations of the CAST statements -- I even tried including a cast on the date field in the SELECT statement, and I'm still getting the same error.
I was working on another query earlier that required me to find all patient appointments from within a certain time frame, and for that query, I had my WHERE clause set up like:
WHERE Cast(VisitDate as Date) BETWEEN CAST('01/01/2014' as Date) AND CAST('12/01/2014' as Date)

...and it worked perfectly fine. Since I've got my current query set up virtually the same way, I'm not sure why I'm getting that conversion error.

A: You  have wrong dateformat:
SET DATEFORMAT dmy;
SELECT CAST('12/31/2014' as Date);
--Conversion failed when converting date and/or time from character string.

You could set it to mdy before executing your query.
SET DATEFORMAT mdy;
SELECT CAST('12/31/2014' as Date);

LiveDemo
or use CONVERT with style 101:
SET DATEFORMAT dmy;
SELECT CONVERT(DATE,'12/31/2014',101)

If you really need to store DATE as VARCHAR use at least culture independent type like ISO-8601.
SET DATEFORMAT dmy;
SELECT CAST('20140201' as Date);
-- 01.02.2014

SET DATEFORMAT mdy;
SELECT CAST('20140201' as Date)
-- 01.02.2014

A: It sounds like SQL is not able to convert the stored strings into dates. This would explain why CAST(pmh.DateOfOnset as Date) fails where Cast(VisitDate as Date) does not--the latter might not have any mis-formatted dates.
Best-case solution is to convert your table columns to the proper datatypes. Second-best case, add columns containing the proper datatypes, and convert the data over; you'd have to fix any existing bad data, as well as convert data on the fly as it's loaded (yuck). Another option, add a calculated column, though you'll have problems with the afore-mentioned invalid dates. (What version of SQL do you have? Later versions have the isdate function, which might help here.)
If modifying tables is not an option, you're probably stuck writing queries that have to assume some of the data is invalid (bad format).


text:
Q: Выборка в sql запросе
В столбце users перечислены id некоторых пользователей. Они могут быть в разном порядке и в любой иерархии. Подскажите пожалуйста запрос к столбцу users если заранее известно только, что придется искать от 2-х пользователей и более.
Пример 1: нужно найти есть ли ячейках пользователи 2 и 3
Пример 2: нужно найти есть ли ячейках пользователи 150, 3, 56

A: find_in_set
никакие регекспы и лайки тут не нужны.
@Ипатьев, скорее прав, чем нет, хотя чересчур категоричен на тему "никогда".
mysql> use temp;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> create table a(id int, t text);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into a values (0, '1,2,3');
Query OK, 1 row affected (0.00 sec)

mysql> select * from a where find_in_set(1,t);
+------+-------+
| id   | t     |
+------+-------+
|    0 | 1,2,3 |
+------+-------+
1 row in set (0.02 sec)

mysql> select * from a where find_in_set(5,t);
Empty set (0.00 sec)

если есть индекс на t, и t не слишком длинный (varchar, например) то вполне быстро будет работать.  like и regexp тут и неправильны и громадные потери по производительности

A: Если необходимо узнать только факт наличия необходимых id пользователей в столбце users, то можно воспользоваться LIKE:
Пример 1:
SELECT id FROM table WHERE users LIKE('%2%3%');

или
SELECT id FROM table WHERE users LIKE('%2%') AND users LIKE('%3%');

Но изменить структуру БД в любом случае стоит.


text:
Q: Ember-Model init issue I concatinate my application code from multiple js files into one js file. Therefore I can't control the order, and to be honest would not want to. To specify a custom adapter with ember-model you need to create an instance of it like so:
App.User.adapter = Ember.CustomAdapter.create();

So if the CustomAdapter's code appears after the above statement I get the [Uncaught TypeError: Cannot call method 'create' of undefined] error.
App.User.adapter = App.CustomAdapter.create();

App.CustomAdapter = Ember.Adapter.extend({
    // custom
});

Is there a way around this?

A: The order of code loading is very, very important.  That's just a fact of life.  You need to either figure out how to make your current tool load things in the order that you want, or you need a new tool.


text:
Q: Block is synchronised only when using unrelated object in Scala I have a function getUniqueId that tries to return a unique ID on every call.
private var uidCount = 0L

def getUniqueId() = uidCount.synchronized {
  uidCount = uidCount + 1
  uidCount
}

It's definition is synchronized on the Long variable uidCount.
We are calling this function using another function startThread.
def startThread() = {
  val t = new Thread {
    override def run() = {
      val uids = for (i <- 0 until 10) yield getUniqueId()
      println(uids)
    }
  }
  t.start
}

So, for every function call, we should ideally see 10 unique IDs printed on our console.
We call for IDs using multiple threads as shown below:
startThread(); startThread(); startThread()
But I get output with duplicate IDs:
Output:
Vector(7, 11, 13, 16, 22, 24, 25, 26, 27, 28)
Vector(2, 6, 8, 9, 12, 14, 17, 19, 21, 23)
Vector(1, 3, 4, 5, 8, 10, 12, 15, 18, 20)

Here we can see that 8 and 12 are duplicated.
Similarly, If I synchronize getUniqueId() on a random object of Class AnyRef.
I.e I change the definition to:
private var uidCount = 0L
private var x = new AnyRef
def getUniqueId() = x.synchronized {
  uidCount = uidCount + 1
  uidCount
}

Then all of a sudden getUniqueId is atomic. The output is always similar to:
Vector(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
Vector(11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
Vector(21, 22, 23, 24, 25, 26, 27, 28, 29, 30)

i.e Without duplicates.
Can someone explain Why can't I use uidCount to make getUniqueId atomic?

A: uidCount is a primitive variable that is changing all the time.
Every time you call getUniqueId, a new wrapper is created around the primitive value. Synchronizing on a new object that is created anew every time you enter the method body does not make any sense: the intrinsic lock associated to this object will always be acquired exactly once, then it will be immediately released, and the wrapper object will be discarded.


text:
Q: How do I get the OS and system modules into py2exe I am trying to create a stand alone application for a windows computer I am trying to use the following modules:

*

*os

*system

*threading

*time

But it is not allowing me to import any of these modules it doesn't give me an error code or anything it just will not load the modules into the file!    from distutils.core import setup
    import py2exe
setup(console=['Evil_unlocker_final.py']
      options={
                "os":{
                        "unbuffered": True,
                        "optimize": 2
                }
                "sys":{
                        "unbuffered": True,
                        "optimize": 2
                }
        }

)

A: You do not have to add the os library nor do you have to add the system library the error is in the setup.py file it is not formatted correctly all you need in your setup.py file
setup(console=['Evil_unlocker_final.py'])

That's it the only time that you would need to add in the options function is when you are importing a module that is not built into python for example if you wanted to add in the flask and jinja2 libraries your file would have to also have to add options and your file would look somewhat like this
setup(console=['Evil_unlocker_final.py']
     options={
               "pip":{
                       "unbuffered": True,
                       "optimize": 2
               }
               "jinja2":{
                       "unbuffered": True,
                       "optimize": 2
               }
       }
)


text:
Q: React Native crashing in RCTNetworkTask.m I'm getting a pretty consistent crash at in RCTNetworkTask.m at [self invalidate]; here:
- (void)cancel
{
  _status = RCTNetworkTaskFinished;
  id token = _requestToken;
  if (token && [_handler respondsToSelector:@selector(cancelRequest:)]) {
    [_handler cancelRequest:token];
  }
  [self invalidate];
}

The inline error shows EXC_BAD_ACCESS (code=EXCI386_GPLFT), if that means anything.
I assume this is being thrown when loading some bad image into an <Image/> component. I have an onError handler on the images, but that doesn't seem to help. I don't have control over most images in my app are supplied by the user.
Is there any way to catch this error before it crashes the app entirely?

A: This looks to be an issue with React Native itself. Fix went into v0.37.


text:
Q: GDB Setting Trap Flag After Popf (possible bug?) Take a look:
    (gdb) x/x $esp
       0xb720a621:  0x00000000
    (gdb) info register eflags
       eflags         0x200286  [ PF SF IF ID ]
    (gdb) x/5i $pc
    => 0x15a965d <tables+11901>:    popf
       0x15a965e <tables+11902>:    mov    $0xd7fb0aa3,%ecx
       0x15a9663 <tables+11907>:    ret    $0x849d
       0x15a9666 <tables+11910>:    xor    (%ebx),%esi
       0x15a9668 <tables+11912>:    aam    $0x78
    (gdb) stepi
       0x015a965e in tables () from /usr/local/apache2/modules/libphp5.so
    (gdb) info register eflags
       eflags         0x202 [ IF ]
    (gdb) stepi
       0x015a9663 in tables () from /usr/local/apache2/modules/libphp5.so
    (gdb) info register eflags
       eflags         0x302 [ TF IF ]

Not sure why TF is set after the next instruction.

A: I believe it is a kernel bug. The kernel has to set TF when single-stepping but user mode also may be modifying TF. To handle this, the kernel tries to maintain who set TF:
    /* Set TF on the kernel stack.. */
    regs->flags |= X86_EFLAGS_TF;

    /*
     * ..but if TF is changed by the instruction we will trace,
     * don't mark it as being "us" that set it, so that we
     * won't clear it by hand later.
     *
     * Note that if we don't actually execute the popf because
     * of a signal arriving right now or suchlike, we will lose
     * track of the fact that it really was "us" that set it.
     */
    if (is_setting_trap_flag(child, regs)) {
            clear_tsk_thread_flag(child, TIF_FORCED_TF);
            return 0;
    }

Note it even admits some corner cases might make it lose track.
What's worse is that is_setting_trap_flag only checks if the instruction will modify TF, it doesn't check if it is actually setting it:
    switch (opcode[i]) {
    /* popf and iret */
    case 0x9d: case 0xcf:
            return 1;

As such it will mark TF as user-set even if it has been cleared. In get_flags it will try to mask TF if it was set by kernel as follows:
    /*
     * If the debugger set TF, hide it from the readout.
     */
    if (test_tsk_thread_flag(task, TIF_FORCED_TF))
            retval &= ~X86_EFLAGS_TF;

Since TIF_FORCED_TF has been erroneously cleared, this condition will not be true, hence the TF that has in fact been set by the kernel for single-stepping will be returned to the debugger.
I think this can be fixed by modifying is_setting_trap_flag so that it checks the stack for the new value of the flags and only returns 1 if TF is actually being set.


text:
Q: select data from mysql using two column ranges I have data like this
sno name    date        time

1   Irona   2016-01-01  10:00:00
2   Meona   2016-01-02  21:00:00
3   Lessa   2016-01-02  8:00:00
4   Airik   2016-01-03  10:00:00

I m trying query like this
SELECT * FROM `appointment` where (date <= '2016-01-02' and time >= '21:00:00') and (date >= '2016-01-03' and time >= '10:00:00')

I want those appointment which are between 2016-01-02 and 2016-01-03 and also between 9 pm to 10 am

A: Try this:
SELECT *
FROM `appointment` A
WHERE STR_TO_DATE(CONCAT(A.date, ' ', A.time), '%Y-%m-%d %H:%i:%s') BETWEEN '2016-01-02 21:00:00' AND '2016-01-03 10:00:00'

A: Query date <= '2016-01-02' and date >= '2016-01-03' returns nothing.
you should change it to date >= '2016-01-02' and date <= '2016-01-03'
SELECT * FROM `appointment`
where date >= '2016-01-02' and date <= '2016-01-03'
and time <= '21:00:00' and time >= '10:00:00'

A: I will do it like this:
...
WHERE
to_char(date, '%Y%m%d') between '20160102' and '20160103'
AND to_char(timedate, '%H') between '10' and '21'


text:
Q: Using a single actor for in and out ports of a Flow I'm starting to explore the akka-stream API and I'm looking to test it out. I have a specific use case I can't seem to find an appropriate streaming API to use.
The idea is similar to the following with a bit of a twist:
Source(1 to 10).mapAsync(num => actorRef ? Request(num)).to(Sink.foreach(println))
In this case the ask will return a single message through the future. I'd like to return more than one message for each request sent to the actor. For example:

*

*ActorRef gets sent Request(2)

*ActorRef sends N messages out of the flow.

*ActorRef gets sent Request(3)

*ActorRef sends M messages out of the flow.

I can add extra logic into the Actor to aggregate/buffer these extra messages into a Iterable of some sort but I'm wondering if I'm missing something in the API to handle a case like this.
The closest I've come while looking through the docs is using a Sink.actorRefWithAck and Source.queue with Flow.fromSinkAndSourceMat and passing the materialized SourceQueue to the actorRef before acking the onInitMessage. This allows control of up and downstream back pressure while handling one-to-many messages through the flow. It seems counter productive in making the Graph easy to follow.

A: I believe you're looking for flatMapConcat.
Source(1 to 10).flatMapConcat(num =>
  // Dummy example - outputs first 5 successors for each incoming element
  Source(num to (num + 5))
).to(Sink.foreach(println))

This way you let Akka lift all the reactive streams weight, and you let no bare actor pollute your pipeline.
Documentation here.

A: Unfortunately what you are looking for doesn't seem to exist.  The ask pattern, e.g. the ? method, can only return 1 value.  Therefore, when you do something like
type Input = ???
type Outupt = ???

def askActorFlow(actorRef : ActorRef) : Flow[Input, Output, NotUsed] =
  Flow[Input] mapAsync { input => (actorRef ? input).mapTo[Output] }

You can only get 1 value at a time back from the ActorRef.
The work around you suggested, e.g. "add extra logic into the Actor to aggregate/buffer these extra messages into a Iterable", is a better solution anyway.  It makes it easier for your Actor users to know they will get only 1 response back for any query.  Otherwise, the user will never truly know if they've gotten the "complete" answer back from the Actor after a query or if more data is forthcoming.


text:
Q: Angular 5 validation error not shown on input change I have a problem with an input control where if I type 501 (not valid value) the mat-error is not shown unless input loses focus. How can I show it when the user types in an invalid value without input losing focus?
This is the html
<div class="col-auto form margin-top-17 margin-left-10" [formGroup]="activationPointsFormGroup">
            <mat-form-field style="width:230px!important">
                <input matInput type="number" placeholder="Range" [formControl]="activationPointsFormControl"
                (keydown.enter)="loadData()">
                <mat-error class="margin-top-1" *ngIf="activationPointsFormControl.errors">
                    Valid values are between -500 and 500 and not 0
                </mat-error>
            </mat-form-field>
 </div>

and the typescript code
  public activationPointsFormGroup: FormGroup;
  public activationPointsFormControl: FormControl;

  private createForm(): void {
        this.activationPointsFormControl = new FormControl(1, [Validators.required, Validators.min(-500), Validators.max(500)]);
        this.activationPointsFormGroup = new FormGroup({
            timeThresholdFormControl: this.activationPointsFormControl,
        });

        this.activationPointsFormControl.valueChanges.subscribe(value => {

            if (value) {
                this.selectedActivationPoints = value;
            }
        });
    }

A: For this, you need an error state matcher, to customize the angular material validation behavior, import ErrorStateMatcher and...
import {ErrorStateMatcher} from '@angular/material/core';

export class MyErrorStateMatcher implements ErrorStateMatcher {
  isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
    return !!(control && control.invalid && control.dirty);
  }
}

This will now show the error message when control is dirty. Declare a an error state matcher in your component...
matcher = new MyErrorStateMatcher();

and then mark it on your input field:
<input matInput [errorStateMatcher]="matcher" ...>

Here's a demo, which will show that email is not valid while user is typing...
StackBlitz


text:
Q: Pytorch Tensor - How to get the index of a tensor given a multidimensional tensor I have a the following tensor lets call it lookup_table:
tensor([266, 103,  84,  12,  32,  34,   1, 523,  22, 136, 268, 432,  53,  63,
        201,  51, 164,  69,  31,  42, 122, 131, 119,  36, 245,  60,  28,  81,
          9, 114, 105,   3,  41,  86, 150,  79, 104, 120,  74, 420,  39, 427,
         40,  59,  24, 126, 202, 222, 145, 429,  43,  30,  38,  55,  10, 141,
         85, 121, 203, 240,  96,   7,  64,  89, 127, 236, 117,  99,  54,  90,
         57,  11,  21,  62,  82,  25, 267,  75, 111, 518,  76,  56,  20,   2,
         61, 516,  80,  78, 555, 246, 133, 497,  33, 421,  58, 107,  92,  68,
         13, 113, 235, 875,  35,  98, 102,  27,  14,  15,  72,  37,  16,  50,
        517, 134, 223, 163,  91,  44,  17, 412,  18,  48,  23,   4,  29,  77,
          6, 110,  67,  45, 161, 254, 112,   8, 106,  19, 498, 101,   5, 157,
         83, 350, 154, 238, 115,  26, 142, 143])

And I have another tensor lets call it data, which looks like this:
tensor([[517, 235, 236,  76,  81,  25, 110,  59, 245,  39],
        [523, 114, 350, 246,  30, 222,  39, 517, 106,   2],
        [ 35, 235, 120,  99, 266,  63, 236, 133, 412,  38],
        [134,   2, 497,  21,  78,  60, 142, 498,  24,  89],
        [ 60, 111, 120, 145,  91, 141, 164,  81, 350,  55]])

Now I want something which looks similar to this:
tensor([112, 100, ..., 40],
       [7, 29, ..., 2],
       ...,          ])

I want to use my data tensor to get the index of the lookup table.
Basically I want to vectorize this:
(lookup_table == data).nonzero()

So that this works for multidimensional arrays.
I have read this, but they are not working for my case:
How Pytorch Tensor get the index of specific value
How Pytorch Tensor get the index of elements?
Pytorch tensor - How to get the indexes by a specific tensor
EDIT:
I am basically searching for an optimized/vectorized version of this:
x_data = torch.stack([(lookuptable == data[0][i]).nonzero(as_tuple=False) for i in range(len(data[0]))]).flatten().unsqueeze(0)
print(x_data.size())
for o in range(1, len(data)):
    x_data = torch.cat((x_data, torch.stack([(lookuptable == data[o][i]).nonzero(as_tuple=False) for i in range(len(data[o]))]).flatten().unsqueeze(0)), dim=0)

EDIT 2 Minimal example:
We have the data tensor:
data = torch.Tensor([
        [523, 114, 350, 246,  30, 222,  39, 517, 106,   2],
        [ 35, 235, 120,  99, 266,  63, 236, 133, 412,  38],
        [555, 104,  14,  81,  55, 497, 222,  64,  57, 131]
])

And we have the lookup_table tensor, see above.
If we apply this code to the 2 tensors:
 # convert champion keys into index notation
x_data = torch.stack([(lookuptable == x[0][i]).nonzero(as_tuple=False) for i in range(len(x[0]))]).flatten().unsqueeze(0)
for o in range(1, len(data) - 1):
    x_data = torch.cat((x_data, torch.stack([(lookuptable == x[o][i]).nonzero(as_tuple=False) for i in range(len(x[o]))]).flatten().unsqueeze(0)), dim=0)

We get an output of this:
tensor([[  7,  29, 141,  89,  51,  47,  40, 112, 134,  83],
        [102, 100,  37,  67,   0,  13,  65,  90, 119,  52],
        [ 88,  36, 106,  27,  53,  91,  47,  62,  70,  21]
       ])

This output is what I want, and like I said above its the index of where each value of the tensor data lies on the tensor lookuptable.
The problem is that this is not vectorized.
And I have no Idea how to vectorize it.

A: Using searchsorted:
Scanning the whole lookup_table array for each input element is quite inefficient. How about sorting the lookup table first (this only needs to be done once)
sorted_lookup_table, indexes = torch.sort(lookup_table)

and then using searchsorted
index_into_sorted = torch.searchsorted(sorted_lookup_table, data)

If you need an index into the original lookup_table, you can get it with
index_into_lookup_table = indexes[index_into_sorted]

A: Another, faster, approach that assumes that all values have a limited range, and are int64 (Here, I also assume that they are non-negative, but this limitation can be worked around):
Prep work:
sorted_lookup_table, indexes = torch.sort(lookup_table)
lut = torch.zeros(size=(sorted_lookup_table[-1]+1,), dtype=torch.int64)
lut[:] = -1 # "not found"
lut[sorted_lookup_table] = indexes

Data processing:
index_into_lookup_table = lut[data]


text:
Q: convert pixel coordinates to lat long I would like to understand how the geo referencing for images works.
Is there some way how to get the real langitude and longitude from this line?
imageBounds = [map.unproject([0, 0], 20), map.unproject([1716,1178], 20)];

Thanks a lot.

A: map.unproject([xy coords]) returns a Latlng object.  Try running the function in the console or wherever and you'll see your lat and lng?


text:
Q: Configuring ssh virtualbox gitlab runner I'm setting up a new VirtulBox Machine Linux Ubuntu on my Windows 10 host for a simple gitlab CI runner.
Here my runner configuration (config.toml)
concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "virtualbox"
  url = "****"
  token = "****"
  executor = "virtualbox"
  [runners.ssh]
    user = "mauro"
    password = "mauro"
  [runners.virtualbox]
    base_name = "ubuntu.dev"
    user = "mauro"
    password = "mauro"
    identity_file = "/home/mauro/.ssh/id_rsa"
    disable_snapshots = false
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]

When I use the runner I have the following output:
Running with gitlab-runner 11.9.0 (692ae235)
  on virtualbox 8W5MbzNs
Using VirtualBox version 6.0.4r128413 executor...
Creating new VM...
ERROR: Preparation failed: ssh: handshake failed: read tcp 127.0.0.1:53370->127.0.0.1:53168: wsarecv: An existing connection was forcibly closed by the remote host.

Thanks for your support

A: Inside the runners.virtualbox section you don't need the user, password, or identity_file.
The identity_file goes into the runners.ssh section.
I had similar issues when trying to just install the gitlab runner.
This gitlab runner worked for me - https://github.com/ayufan/gitlab-ci-multi-runner


text:
Q: Is DataDog tag value converted to lower case with underscores? I push a custom tag to DataDog with key of execute_error and value of "testing DATADOG mApPeR     OK"
However, when I check on the DataDog, it looks like the tag is mapped into "execute_error:testing_datadog_mapper_ok".
I expect a "execute_error:testing DATADOG mApPeR     OK".
Is this a feature by DataDog?
I have read the docs, but can't find relevant info about this.
One thing that I have found is that DataDog maps the tag key as written in Getting Started with Tags (I am still unsure whether they do the same for the tag value).
Thank you.
PS. Sorry I can't attach screenshot due to reputation

A: You are correct that datadog will convert tags to lower case, in the doc you linked there is a note:

Tags are converted to lowercase. Therefore, CamelCase tags are not recommended. Authentication (crawler) based integrations convert camel case tags to underscores, for example TestTag –> test_tag

https://docs.datadoghq.com/getting_started/tagging/
The notes about crawler based integrations is mostly referring to Cloudwatch metrics from AWS with tend to like camelcase, so there's some special logic to convert those tags in datadog.
There is also a note about which characters are valid for making tags:

Tags must start with a letter and after that may contain the characters listed below:

*

*Alphanumerics

*Underscores

*Minuses

*Colons

*Periods

*Slashes

*Other special characters are converted to underscores.

Spaces are not in that list and are considered special characters that get converted to _.
The docs are saying "tags" in both these notes, not just the key, but the full key:value pair.


text:
Q: Invalid Timestamps MPEG-TS - Nexio Server Errors I am trying to copy SAP audio from a 4ch MPEG-TS file to create an 8ch MPEG-TS file to help out a TV station partner that's struggling to do it on their own, but also running into problems.
This pass copies ch 1-4 to 5-8

ffmpeg -i input.ts -map 0:v -c:v copy -map 0:a -c:a copy -map 0:a -c:a copy firstpass.ts

This pass mutes 3-6 (they wanted to "move" ch3-4 to ch7-8 and silence on 3-6):

ffmpeg -i firstpass.ts -map 0:v -c:v copy -map 0:a -filter:a:1 "volume=0" -filter:a:2 "volume=0" -c:a aac -b:a 128k output.ts

The problem is that the Nexio is rejecting it for invalid timestamps, and copyts or flagging to genpts and gendts doesn't seem to work.
It's fine with the source if I don't re-encode audio, and it's fine if I re-encode both video and audio (which we do not want to re-encode the video at all costs).
Anyone got any ideas?
FFmpeg error:

[mpegts @ 0x7fcadd204200] Invalid timestamps stream=0, pts=10714614, dts=10720620, size=3646

Nexio error:

[12:00:13] [33352 M] [XXXXX DISCONTINUITY: currentVideoFrameInfo.start = 631109472, expectedVideoFrameStart = 624238608]
[12:00:13] [33352 M] [XXXXX SMALL DISCONTINUITY.  NOT CORRECTING TIME BASE HERE]
[12:00:13] [33352 M] [Error: PTL Error: discontinuous time stamp is detected. Actual lxf packet start = 630053424 (frame number = 26226). Expected lxf packet start = 623182560 (frame number = 25940)]
[12:00:13] [33352 M] [Error: PTL Error: processing is aborted (AbortImportIfMissingPacket = 1)]

A: I ended up solving it for them by utilizing a separate audio file with silence. That way they can just copy the streams as-is and map silence in the middle.
ffmpeg -fflags +igndts -i input.ts -i 2Hr_4CH_Silence.aac -map 0:v -map 0:a:0 -map 1:a -map 0:a:1 -c:v copy -c:a copy -shortest -y output.ts


text:
Q: Chart.js not rendering unless i set a timeout Well, i have the same issue that this guy: Chart.js not showing in my view , for him it solved to set a timeout but for me that's no even possible to introduce in my web, i don't want to work with timeouts.I'm working to create web-components for chart.js.There's any way to wait the chart to get render without setting a timeout?, that the waiting time is the render time
My code is:
flexygo.ui.wc.flxChart = function () {

    return {
        htmlItem: null,

        moduleId: null,

        refresh: function () {

            this.init();
        },

        init: function () {
            var ctx = this;

            ctx.htmlItem.html('<canvas id="myChart2" height="400" width="800" style="width:800px;height:400px;"></canvas>');

            ctx.render();
        },
        render: function () {
            var ctx = this;

            var data = {
                labels: ["January", "February", "March", "April", "May", "June", "July"],
                datasets: [{
                    label: "My First dataset",
                    fill: false,
                    lineTension: 0.1,
                    backgroundColor: "rgba(75,192,192,0.4)",
                    borderColor: "rgba(75,192,192,1)",
                    borderCapStyle: 'butt',
                    borderDash: [],
                    borderDashOffset: 0.0,
                    borderJoinStyle: 'miter',
                    pointBorderColor: "rgba(75,192,192,1)",
                    pointBackgroundColor: "#fff",
                    pointBorderWidth: 1,
                    pointHoverRadius: 5,
                    pointHoverBackgroundColor: "rgba(75,192,192,1)",
                    pointHoverBorderColor: "rgba(220,220,220,1)",
                    pointHoverBorderWidth: 2,
                    pointRadius: 1,
                    pointHitRadius: 10,
                    data: [65, 59, 80, 81, 56, 55, 40],
                    spanGaps: false,
                }]
            };
            window.onload = function () {
                    var myChart = new Chart(ctx.htmlItem[0].childNodes[0], {
                    type: 'line',
                    data: data,
                    options: {
                        scales: {
                            xAxes: [{
                                display: false
                            }]
                        }
                    }
                });
            }
        },

        translate: function (str) {
            return flexygo.localization.translate(str);
        },
        startLoading: function () {
            this.htmlItem.parents('flx-module').find('.icon-sincronize').addClass('icon-spin txt-outstanding');
        },
        stopLoading: function () {
            this.htmlItem.parents('flx-module').find('.icon-sincronize').removeClass('icon-spin txt-outstanding');
        },

    }

creating the chart we can use either htmlitem[0].childnodes[0] or document.getElementById('myChart2')

A: i solved it adding encapsulating the canvar into a div, so the canva resizes with my page, i changed:
from:
ctx.htmlItem.html('<canvas id="myChart2" height="400" width="800" style="width:800px;height:400px;"></canvas>');

to
ctx.htmlItem.html('
<canvas id="myChart2" height="400" width="800" style="width:800px;height:400px;"></canvas>
');

a now it works


text:
Q: How i can make 2 admins for one entity in Sonata Admin? How i can make 2 admins for one entity in Sonata Admin?
For example - one admin shows a list with "status=1" condition, and other with "status=2".
it would be great if make a new record in first admin automatically sets the "status=1".
Thx.

A: 1) create a one admin class in ADMIN Directory with Your condition status=1
2) create a second admin class in ADMIN Directory with Your condition status=2
3) config that class in sonata_admin.yaml with different name
4) change in second admin $baseRouteName and $baseRoutePattern to different
In which Entity name is same


text:
Q: Won't boot after 12.04 upgrade
Possible Duplicate:
Ubuntu won't boot after 12.04 upgrade

I am new to Ubuntu and I recently upgraded to 12.04. Now when I try to start Ubuntu nothing happens. I get a blank screen, not even a cursor. I am running a dual-boot with Windows 7 which is still working fine. Any ideas?

A: Probably some error during the upgrade or with the grub.
Upgrades are very buggy sometimes, download a fresh 12.04 Live CD and reinstall it.
Before reinstalling you can backup your files using the Live CD and a pendrive or something.


text:
Q: Is http response one element in Observable (Rxjs) stream? I am currently expanding my knowledge of RxJs and trying to get better understanding of streams.
I would like to compare Http response to an Observable made by of().
Can we say that JSON response is treated like element 'a' when comparing it to
of(['a', 'b', 'c']) ?
When we get JSON response it's always like getting only one element?
Is http response one element in Observable stream?
EDIT:
Obviously, I should have compared it to the first emitted value of interval().

A: An HTTP request using Angular HTTP client is in-fact an RxJS observable of type HttpRequest that produces a stream of notifications of type HttpEvent. If you wish to see all the notifications, use the option observe: 'events' in the request. If this option isn't provided (default), only the last notification (the result from the HTTP request) is returned as seen here.
From docs:

When using HttpClient.request() with an HTTP method, configure the
  method with observe: 'events' to see all events, including the
  progress of transfers.

Seeing this, your example of of(['a', 'b', 'c']) isn't similar to a HTTP request since it emits only one notification (the array ['a', 'b', 'c']) and completes. However from(['a', 'b', 'c']) is similar to a HTTP request since it emits each item individually.

Is HTTP response one element in Observable stream?

Yes, it is the last notification in the stream of notifications. It is of type HttpEventType.Response.
Working example: Stackblitz
import { Component, OnInit } from '@angular/core';
import { HttpClient, HttpEvent, HttpEventType } from '@angular/common/http';

@Component({ selector: 'app', templateUrl: 'app.component.html' })
export class AppComponent implements OnInit {
  events = [];

  constructor(private http: HttpClient) { }

  ngOnInit() {
    this.http.get<any>('https://jsonplaceholder.typicode.com/todos/1', {observe: 'events'}).subscribe((event: HttpEvent<any>) => {
      this.events.push(event);
      console.log(event);
    });
  }
}

Console output

type: 0 corresponds to HttpEventType.Sent and type: 4 corresponds to HttpEventType.Response. You could possibly see more events in a more complicated request (eg. a video upload request).


text:
Q: Parse File Migration to AWS Has anyone had any success migrating files from the Parse S3 Bucket to an S3 Bucket of their own? I have an app that contains many files (images) and I have them serving from both my own S3 Bucket and from the Parse Bucket using the S3 File Adapter but would like to migrate the physical files to my own Bucket on AWS where the app will now be hosted.
Thanks in advance!

A: If you've configured your new Parse instance to host files with the S3 file adapter, you could write a PHP script that downloads files from Parse S3 Bucket and upload it to your own. In my example (using Parse-PHP-SDK):

*

*I do a loop through every entry.

*I download the binary of that file (hosted in Parse)

*I upload it as a new ParseFile (if your server is configured for S3, it will be uploaded to S3 bucket of your own).

*Apply that new ParseFile to your entry.

*Voilà
    <?php

                require 'vendor/autoload.php';
                use Parse\ParseObject;
                use Parse\ParseQuery;
                use Parse\ParseACL;
                use Parse\ParsePush;
                use Parse\ParseUser;
                use Parse\ParseInstallation;
                use Parse\ParseException;
                use Parse\ParseAnalytics;
                use Parse\ParseFile;
                use Parse\ParseCloud;
                use Parse\ParseClient;

                $app_id = "AAA";
                $rest_key = "BBB";
                $master_key = "CCC";

                ParseClient::initialize( $app_id, $rest_key, $master_key );
                ParseClient::setServerURL('http://localhost:1338/','parse');

                $query = new ParseQuery("YourClass");
                $query->descending("createdAt"); // just because of my preference
                $count = $query->count();
                for ($i = 0; $i < $count; $i++) {
                        try {
                                $query->skip($i);
                                // get Entry
                                $entryWithFile = $query->first();
                                // get file
                                $parseFile = $entryWithFile->get("file");
                                // filename
                                $fileName = $parseFile->getName();
                                echo "\nFilename #".$i.": ". $fileName;
                                echo "\nObjectId: ".$entryWithFile->getObjectId();
                                // if the file is hosted in Parse, do the job, otherwise continue with the next one
                                if (strpos($fileName, "tfss-") === false) {
                                        echo "\nThis is already an internal file, skipping...";
                                        continue;
                                }

                                $newFileName = str_replace("tfss-", "", $fileName);
                                $binaryFile = file_get_contents($parseFile->getURL());
                                // null by default, you don't need to specify if you don't want to.
                                $fileType = "binary/octet-stream";
                                $newFile = ParseFile::createFromData($binaryFile, $newFileName, $fileType);

                                $entryWithFile->set("file", $newFile);
                                $entryWithFile->save(true);

                                echo "\nFile saved\n";
                        } catch (Exception $e) {
                                // The conection with mongo or the server could be off for some second, let's retry it ;)
                                $i = $i - 1;
                                sleep(10);
                                continue;
                        }
                }

                echo "\n";
                echo "¡FIN!";

    ?>


text:
Q: Keep Footnote Number with Chapter Title I need to have a footnote attached to a word which forms a chapter heading; unfortunately, the footnote number appears lines below the word that needs to be explained.The footnote should be a superscript.
MWE:
\documentclass[paper=9cm:16cm,DIV=15,fontsize=9pt,twocolumn,]{scrbook}
\usepackage{blindtext}

\begin{document}

\chapter{Apay}\footnote{``I arise'' in Guaran\'{i}.
}

\blindtext

\end{document}

A: How about
\documentclass[paper=9cm:16cm,DIV=15,fontsize=9pt,twocolumn,]{scrbook}
\usepackage{blindtext}

\begin{document}

\chapter[Apay]{Apay\footnotemark}
\footnotetext{``I arise'' in Guaran\'{i}.}
\blindtext

\end{document}


text:
Q: Convenient way to wrap long SQL statements in javascript In python, one can use """ to wrap long MySQL statements. For example,
sql = """CREATE TABLE EMPLOYEE (
         FIRST_NAME  CHAR(20) NOT NULL,
         LAST_NAME  CHAR(20),
         AGE INT,
         SEX CHAR(1),
         INCOME FLOAT )"""

However, if I try the same thing in javascript, there will be syntax error.
connection.query("""CREATE TABLE EMPLOYEE (
FIRST_NAME  CHAR(20) NOT NULL,
    LAST_NAME  CHAR(20),
    AGE INT,
    SEX CHAR(1),
    INCOME FLOAT )"""

    , function (err, rows, fields) {
    if (err) throw err;
    res.send(rows);
});

Is there some kind of javascript equivalent for python's """string encapsulation? If no, what are some best practices for encapsulating a long MySQL string statement in javascript?
I am using node.js restify client.

A: This shouldn't be a problem if you are using node.js that support ES6. ES6 javascript now supports multi-line string using syntax below.
sql = `CREATE TABLE EMPLOYEE (
         FIRST_NAME  CHAR(20) NOT NULL,
         LAST_NAME  CHAR(20),
         AGE INT,
         SEX CHAR(1),
         INCOME FLOAT )`

A: You can use a backslash \ at the end of the line to spread the string over more than one line.

var sql = "CREATE TABLE EMPLOYEE ( \
           FIRST_NAME  CHAR(20) NOT NULL, \
           LAST_NAME  CHAR(20), \
           AGE INT, \
           SEX CHAR(1), \
           INCOME FLOAT )";
document.write(sql);

A: Dealing with long strings in JavaScript:
var sql = "CREATE TABLE EMPLOYEE (" +
             " FIRST_NAME  CHAR(20) NOT NULL," +
             " LAST_NAME  CHAR(20)," +
             " AGE INT," +
             " SEX CHAR(1)," +
             " INCOME FLOAT )";

Python's triple quotes are great! Unfortunately, in JavaScript, you have only two options:

*

*+ based concatenation, as above

*\ based continuation, as proposed by @Nina Scholz

Personally, I don't like using \ for line continuation (in any language.) Using + doesn't introduce unnecessary spaces in your string either.
Hope this helps.

A: For the future large SQL statments, one tip is to use functions or procedures in MySQL, and then call it in one line:
var sql = select * from getEmployee(); // function getEmployee returns the query

A: In this answer, I suggest staging your multi-line string via a string array. Then, once the staging is complete you finalize the multi-line string by using join to enforce lines are separated with a newline character.
In Sumukh Barve's answer, the strings were carefully constructed with a whitespace character separator (instead of a newline character). In itself, it's not wrong, however, it could lead to malformed SQL statements. When maintaining such SQL statements, the maintainer could easily overlook the need for the whitespace character and could inadvertently malformed the SQL statement:
"CREATE TABLE" +
"EMPLOYEE (" + //...

Would result in:
"CREATE TABLEEMPLOYEE (" + //...

The use of join can also help ensure that there is a mandatory newline character separating the lines without the need to remember to add it within the text of each line.
[ "CREATE TABLE",
  "EMPLOYEE (" ].join("\n")

Would result in:
CREATE TABLE
EMPLOYEE (

Without a newline character, all errors will be reported on line 1. For example, on PSQL:
CREATE TABLE EMP (ID);

Would report:
ERROR:  syntax error at or near ";"
LINE 1: TABLE EMP(ID);

Regardless of how long the SQL statement is, all errors will be reported against LINE 1.
However, if a new line was added, e.g.
CREATE TABLE EMP (
    ID);

You will get better feedback on which line caused the error:
ERROR:  syntax error at or near ";"
LINE 2: ID);

Also using join with the newline character aids in logging.
Note that there is an implicit newline separator present in @user781486 answer because of the ES6 backtick notation. ES6 backtick notation looks simple. However, it rapidly loses it's simplicity when you decide to mix backtick notation with conditional business rules.
Your mileage may vary.

function buildSQL(includeAge) {
  let arr = [];
  arr.push( "CREATE TABLE EMPLOYEE (" );
  arr.push( "    FIRST_NAME  CHAR(20) NOT NULL," );
  arr.push( "    LAST_NAME   CHAR(20), " );
  if (includeAge) {
      arr.push( "    AGE         INT," );
  }
  arr.push( "    SEX         CHAR(1)," );
  arr.push( "    INCOME      FLOAT " );
  arr.push( "); " );
  let sql = arr.join("\n");
  return sql;
}

function refreshSQL() {
  let includeAge = $("#includeAge").is(':checked');
  let sql = buildSQL(includeAge);
  $("#resultSQL").val(sql);
}

$("#includeAge").on('change', refreshSQL);

refreshSQL();

<input type="checkbox" id="includeAge"/>includeAge

<textarea id="resultSQL" style="width:400px; height:150px">
</textarea>


text:
Q: How to repeat top rows of a table in each page in LaTeX I have a table in LaTeX which spans multiple pages.
I want the top two rows repeated in each page.
How can I do that?

A: From here:

Tables longer than a single page
[...]
Both longtable and supertabular allow definition of head- and footlines for the table; longtable allows distinction of the first and last head and foot.
[...]

A: you've got to use the longtable package. Here is an example of the head (source: http://users.sdsc.edu/~ssmallen/latex/longtable.html)
\begin{center}
\begin{longtable}{|l|l|l|}
\caption[Feasible triples for a highly variable Grid]{Feasible triples for highly variable Grid, MLMMH.} \label{grid_mlmmh} \\

\hline \multicolumn{1}{|c|}{\textbf{Time (s)}} & \multicolumn{1}{c|}{\textbf{Triple chosen}} & \multicolumn{1}{c|}{\textbf{Other feasible triples}} \\ \hline
\endfirsthead

\multicolumn{3}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Time (s)}} &
\multicolumn{1}{c|}{\textbf{Triple chosen}} &
\multicolumn{1}{c|}{\textbf{Other feasible triples}} \\ \hline
\endhead

\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\endfoot

\hline \hline

%here your table content goes

\end{longtable}
\end{center}

\endlastfoot


text:
Q: Java HashMap.get(key) and TreeMap.get(key) usage of equals and compareTo methods I have a map that uses a class I have created as keys. The class overrides both the equals and compareTo methods. Can someone explain specifically how Hashmap.get(key) and TreeMap.get(key) use these methods?

A: Hashmap.get(key) results in calling of hashcode of the key object and after deciding the bucket by using the hashcode then the equals is called on the key to determine the value of the key.
TreeMap is an implementation of SortedMap which means that objects stored as key in the treemap should implement Comparable interace if not then we need to send a Comparator<T> (where T is the key class) object to the constructor of TreeMap. Reason for this is the keys are sorted . To sort JVM needs to know how to compare and hence this restriction If your key class implements Comparable interface then the compareTo method implementation of this interface is called . There is a binding contract here which states that the compareTo and equals method of key class should be compatible which means compareTo should retun 0 and equals should return true for two equal key objects so that your TreeMap key will be unique.
In short,
HashMap.get(key) calls hashCode method of key and then calls equals method of key
TreeMap.get(key) calls the compareTo method of your key class or calls the compare method of the Comparator object that you would have passed to the constructor of TreeMap


text:
Q: How to cancel the pagenumber of content page? I am trying to cancel the pagenumber in content pages. I haved tried command \thispagestyle{empty},but it didn't work! Another way I have tried is as following, but there is always a '2' showing on the first content page,which annoys me so much! Could anyone help me with this problem?
\documentclass[12pt,a4paper,openany,twoside]{book}
\usepackage{fancyhdr}
\begin{document}
\title{Functional Analysis}
\author{333}
\maketitle

\pagestyle{plain}
\pagestyle{empty}
\tableofcontents
\newpage
\pagestyle{fancy}
\setcounter{page}{1}

\chapter{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\chapter{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\chapter{BalaBalaBala}
\section{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\section{BalaBalaBala}
\subsection{BalaBalaBala}
\section{BalaBalaBala}
\chapter{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\section{BalaBalaBala}
\chapter{BalaBalaBala}
\section{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\section{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\section{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\section{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\subsection{BalaBalaBala}
\chapter{BalaBalaBala}
\section{BalaBalaBala}
\subsection{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\section{BalaBalaBala}
\chapter{BalaBalaBala}
\section{BalaBalaBala}
\end{document}

A: You could use
\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}}

in the preamble.
Example:
\documentclass[12pt,a4paper,openany,twoside]{book}
\usepackage{fancyhdr}
\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}}

\usepackage{blindtext}% only for dummy text
\begin{document}
\frontmatter
\pagestyle{empty}
\title{Functional Analysis}
\author{333}
\maketitle
\tableofcontents
\mainmatter
\pagestyle{fancy}
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\end{document}

A: You could load the tocloft package and issue the directive \tocloftpagestyle{empty} in the preamble.
A full MWE (minimum working example):
\documentclass[12pt,a4paper,openany,twoside]{book}
\usepackage{fancyhdr}

\usepackage{tocloft}
\tocloftpagestyle{empty}

\begin{document}
\frontmatter
\title{Functional Analysis}
\author{333}
\maketitle

\pagestyle{empty}
\tableofcontents

\mainmatter
\pagestyle{fancy}

\chapter{BalaBalaBala}
\section{BalaBalaBala}
...
\end{document}


text:
Q: Why does the following code go into an infinite loop? Consider the following code:
const char *s = "a   b    c  d !";
const char *p = s;

top:for(; *p; p++) {
    switch(*p) {
    case 0x20:
    case '\n':
        goto top;
    default:
        putchar(*p);
    }
}

Can someone explain why it enters an infinite loop instead of stopping when *p is NULL? I had in mind the following: when *p is 0x20 or \n go to the beginning of the loop again, since it tests the condition and evaluates the expression p++.  So, I don't see a reason for it to loop infinitely, or I really don't get how the goto statement and labels work in the C programming language.

A: When you goto top, p++ is not executed, because the for loop is started again from the beginning. Then you goto top again. And then again. And then again. And forever.
If you want your increment to work, use continue instead of goto. Or, better yet, do something even clearer:
for(p = s; *p != '\0'; p++) {
    switch(*p) {
    case 0x20:
    case '\n':
        // Do nothing.
        break;

    default:
        putchar(*p);
    }
}

Oh, and by the way, avoid goto statements like the plague. Unless you're generating C code in an automated way and it's not supposed to be human readable, goto is virtually never a good idea.

A: do this
const char *s = "a   b    c  d !";
const char *p = s;

 for(; *p; p++) {
    switch(*p) {
    case 0x20: case '\n': continue;
    default: putchar(*p);
    }
  }

The reason is, your code is not completing even a single iteration and hence the p++ never comes to execution. When you continue instead of using label, it counts to one complete iteration.

A: const char *s = "a   b    c  d !";
const char *p = s;

top:
for(; *p; p++) {
    switch(*p) {
    case 0x20:
    case '\n':
        p ++;
        goto top;
    default:
        putchar(*p);
    }
}

You have to use p ++; before goto top;, because going to top: means you are restarting the loop.


text:
Q: Jquery dropdown menu- on "click" selection, how do I connect it to new XML node, and update the page? XML, JQuery, HTML Dynamic Dropdown Menu Won't Update
How do I get my XML dropdown menu selection to change to the corresponding  XML node and update the content on my HTML page? I think I haven't passed the dogs_id correctly in the links possibly that is part of the problem. Thank you!
XML file
 <?xml version="1.0" encoding="utf-8"?>
   <breeder>
    <boys>
     <dog>
      <dogs_id>0000</dogs_id>
      <dogs_breeding_name> </dogs_breeding_name>
      <dogs_mom> </dogs_mom>
      <dogs_dad> </dogs_dad>

HTML Page
$(document).ready( function() {
     $.ajax({
    type: "GET",
        dataType: "xml",
    url: "../xml/dogs.xml",
    success: xmlParser1
  });
});

function xmlParser1(xml) {
  $(xml).find('boys').each(function () {
    i = $(this);
    allDogs = i.find('dog');

//this gets the names for the dropdown
allDogs.each(function () {
        var liDogName = $(this).find('dogs_breeding_name').html();
        var liDogId = $(this).find('dogs_id').text();

$("#dropMenuHolderMenu").append('
' + liDogName + '' +liDogId+ '

');

 $("#dropMenuHolderMenu li, a href, span").click(function() {
    var clickName = $(this).text();
    var dog = allDogs.find("liDogId").text();

    dogsBreedingName= dog.find('dogs_breeding_name').text();
    dogsMom= dog.find('dogs_mom').text();
    dogsDad= dog.find('dogs_dad').text();

    $("#breedingNameHolder").replaceWith(dogsBreedingName);
    $("#dMomHolder").replaceWith(dogsMom);
    $("#dDadHolder").replaceWith(dogsDad);
    });
   });
  });

A: Wow after way too long working on this question, I developed an solution. I'm sure this was a really dumb question, but I never did come across it on any of the forums. So I thought I would give back and upload my code.
I'm new at jQuery so I hope I haven't broken too many rules, feel free to make suggestions for improvement.
On the Dog Profile HTML page. A user selects a name from the Select a Dog Dropdown (XML). The Dog Profile page is then updated with the new dogs' content without a page refresh. Tested in Firefox, Safari and Chrome.
Sylvia
XML
 <?xml version="1.0" encoding="utf-8"?>
      <breeder>
      <boys>
      <dog>
      <dogs_id></dogs_id>
      <url></url>
      <dogs_breeding_name></dogs_breeding_name>
      <dogs_given_name></dogs_given_name>
     </dog>

HTML
    <!DOCTYPE html>

    <meta charset="UTF-8">

    <link rel="stylesheet" type="text/css"     href="../css/bootstrap.css" >