text:
Q: How to utilise the space below a navlistPanel in shiny? I'm looking at how I can utilise the space below a navlistPanel().
Dummy code:
library(shiny)

ui <-  fluidPage(
    titlePanel("Navlist panel example"),

    navlistPanel(
      "Header",
      tabPanel("First",
               h3("This is the first panel")),
      tabPanel("Second",
               h3("This is the second panel")),
      tabPanel("Third",
               h3("This is the third panel"))
    )
  )

server <- function(input, output) {
}

shinyApp(ui, server)

Would produce something like below. I want to be able to insert text or other features in the highlighted area in red. I suppose this question could also apply if navlistPanel() was sidebarPanel(), but I know it's possible to be able to put more things inside the actual sidebar panel itself, compared to the navlistPanel() which only takes tabPanel()s or plain text elements.

Edit:
library(shiny)

ui <- fluidPage(
  titlePanel("Navlist panel example"),
  div(navlistPanel(
    "Header",
    tabPanel("First",
             h3("This is the first panel"),
             plotOutput("myPlot")),
    tabPanel("Second",
             h3("This is the second panel")),
    tabPanel("Third",
             h3("This is the third panel"))
  ),
  column(4, "foobarbaz"))
)

server <- function(input, output) {
  output$myPlot <- renderPlot(plot(1:10))
}

shinyApp(ui, server)

A: You can simply place the additional content outside of the navlistPanel call or wrap it in a div-tag:
library(shiny)
ui <- fluidPage(
  titlePanel("Navlist panel example"),
  navlistPanel(
    "Header",
    tabPanel("First",
             h3("This is the first panel")),
    tabPanel("Second",
             h3("This is the second panel")),
    tabPanel("Third",
             h3("This is the third panel"))
  ),
  column(4, plotOutput("myPlot"))
  )

server <- function(input, output) {
  output$myPlot <- renderPlot(plot(1:10))
}

shinyApp(ui, server)

# div-tag -----------------------------------------------------------------

library(shiny)

ui <- fluidPage(
  titlePanel("Navlist panel example"),
  div(navlistPanel(
    "Header",
    tabPanel("First",
             h3("This is the first panel")),
    tabPanel("Second",
             h3("This is the second panel")),
    tabPanel("Third",
             h3("This is the third panel"))
  ),
  column(4, plotOutput("myPlot")))
  )

server <- function(input, output) {
  output$myPlot <- renderPlot(plot(1:10))
}

shinyApp(ui, server)

After @Nautica's edit:
library(shiny)

ui <- fluidPage(
  titlePanel("Navlist panel example"),
  navlistPanel(
    "Header",
    tabPanel("First",
             h3("This is the first panel"),
             plotOutput("myPlot")),
    tabPanel("Second",
             h3("This is the second panel")),
    tabPanel("Third",
             h3("This is the third panel"))
  ),
  column(4, "foobarbaz", style = "margin-top: -220px;")
)

server <- function(input, output) {
  output$myPlot <- renderPlot(plot(1:10))
}

shinyApp(ui, server)


text:
Q: Can I manipulate a directory stream obtained with opendir()? The function opendir() returns a pointer to a directory stream DIR *, which apparently is an opaque data type. The implementation is hidden.
The libc manual states that you should not allocate a DIR object yourself and let the directory functions handle the allocation.
Is there any way to manipulate a directory stream after obtaining it with opendir() and before passing it to, for example, readdir()?
I basically want to overload  opendir() with LD_PRELOAD to return a manipulated directory stream, which is used by readdir().

A: It might help to look at what the LD_PRELOAD sortdir  does as it sorts the directory entries before giving them to the program although what you might want to do might be something other than sorting.
sortdir replaces opendir, readdir, readdir64, and closedir and being only 197 lines of code, it would serve you well to look at it.

A: I don't believe this is possible, or at least not possible in any sort of portable fashion.  As you said the DIR* type is an opaque pointer.  The DIR file is defined in an implementation specific fashion in a file you don't have access to.
In order to manipulate the returned DIR value you'd have to create a struct of similar structure which contains the manipulated values.  Implementations are free to vary the definition of DIR or change it without warning (it is opaque after all).  So any implementation you added would be fragile at best.

A: If I get you right you want to manipulate the directory entries, e.g. change file names or add dummy entries. You can do it like that.
Overload opendir(), within it really open the directory with "real" opendir(), immediately read all directory entries, with "real" readdir(), modify what's necessary, store the modified version in a global variable and return unmodified DIR *. Then in the overloaded readdir() you treat passed DIR * as your own opaque value (e.g. key in a map) and simply sequentially return previously prepared entries.
Here's a nasty proof of concept (nasty because I skipped the boring part like error checking, resource closing, memory freeing, thread safety, etc.):
opendir_wrap.cpp -> opendir_wrap.so:
#include <sys/types.h>
#include <dirent.h>
#include <dlfcn.h>
#include <stdio.h>
#include <map>
#include <list>

extern "C" {

static std::map<DIR *, std::list<struct dirent*> > MAP;

typedef DIR *(*OPEN_T)(const char *name);
typedef struct dirent *(*READ_T)(DIR *dirp);
static OPEN_T real_opendir = NULL;
static READ_T real_readdir = NULL;

DIR *opendir(const char *name)
{
    void *handle = dlopen("/lib/libc.so.6", RTLD_LAZY);
    if (!real_opendir) real_opendir = (OPEN_T) dlsym(handle, "opendir");
    if (!real_readdir) real_readdir = (READ_T) dlsym(handle, "readdir");

    DIR *dirp = real_opendir(name);
    struct dirent *entry = NULL;
    while (entry = real_readdir(dirp))
    {
        MAP[dirp].push_back(entry);
    }
    MAP[dirp].push_back(NULL);

    // your modifications here
    struct dirent *joke = new struct dirent;
    sprintf(joke->d_name, "JOKE!");
    MAP[dirp].push_front(joke);

    return dirp;
}

struct dirent *readdir(DIR *dirp)
{
    struct dirent *entry = MAP[dirp].front();
    MAP[dirp].pop_front();
    return entry;
}

} // extern "C"

opedir_use.c -> opendir_use:
#include <sys/types.h>
#include <dirent.h>
#include <dlfcn.h>
#include <stdio.h>

int main()
{
    struct dirent *entry = NULL;
    DIR *dirp = opendir(".");
    printf("dirp = %p\n", dirp);
    while (entry = readdir(dirp))
    {
        printf("entry->d_name = %s\n", entry->d_name);
    }
}

Now compile:
$ gcc -fpic -shared -ldl -lstdc++ -o ./opendir_wrap.so ./opendir_wrap.cpp
$ gcc opendir_use.c -o opendir_use

Run normally:
$ ./opendir_use
dirp = 0x9fd3008
entry->d_name = opendir_wrap.so
entry->d_name = opendir_use
entry->d_name = opendir_use.c
entry->d_name = opendir_wrap.cpp
entry->d_name = ..
entry->d_name = .

Run with the wrapper:
$ LD_PRELOAD=`pwd`/opendir_wrap.so ./opendir_use
dirp = 0x95374b8
entry->d_name = JOKE!
entry->d_name = opendir_wrap.so
entry->d_name = opendir_use
entry->d_name = opendir_use.c
entry->d_name = opendir_wrap.cpp
entry->d_name = ..
entry->d_name = .

redpajama_set_name: RedPajamaStackExchange


text:
Q: Where can I request Google Apps Script code to be built? Where can I hire freelance Google Apps Script coders?

A: Bruce McPhersons site hosts a list of GAS developers that do work for hire. I'm not sure where the google plus group moved to but if you can figure that out, they should be able to point you in the right direction.
Keep in mind that at least for free accounts there are certain kinds of processing limits in GAS as well.


text:
Q: нейронная сеть с++ не обучается на данных с MNISЕ я писал свою нейросеть на с++, используя датасет MNIST с цифрами. но что-то идет не так, и нейросеть просто не обучается, выдавая рандомные значения на выходе. на вход же я подаю массив нейронов на 784 штуки(28Х28 пикселей в картинках MNIST). затем у меня есть 2 промежуточных слоя на 128 и 16 элементов. как функцию активации я использую RELU, только немного модифицированную(пробовал также с сигмоидой, ничего не вышло). помогите найти ошибку
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <math.h>
#include <cstdlib>

#define _AMOUNT_OF_LAYERS 4
#define _PATH_OF_IMAGES "train-images.idx3-ubyte"
#define _PATH_OF_LABELS "train-labels.idx1-ubyte"
#define _BATCH = 100
#define _SIZES_OF_LAYERS {784,128,16,10};
using namespace std;

struct Layer {
    vector<long double>neurons;
    vector<long double>biases;
    vector<vector<long double>>weights;
};

int fromBigToLittleEndian(int i)
{
    unsigned char ch1, ch2, ch3, ch4;
    ch1 = i & 255;
    ch2 = (i >> 8) & 255;
    ch3 = (i >> 16) & 255;
    ch4 = (i >> 24) & 255;
    return ((int)ch1 << 24) + ((int)ch2 << 16) + ((int)ch3 << 8) + ch4;
}

void readImages(vector<vector<long double> >& Images) {
    ifstream file;
    file.open(_PATH_OF_IMAGES, ios::binary);
    if (file.is_open())
    {
        int magicNumber = 0;
        int numOfImages = 0;
        int Rows = 0;
        int Cols = 0;
        file.read((char*)&magicNumber, sizeof(magicNumber));
        magicNumber = fromBigToLittleEndian(magicNumber);
        file.read((char*)&numOfImages, sizeof(numOfImages));
        numOfImages = fromBigToLittleEndian(numOfImages);
        file.read((char*)&Rows, sizeof(Rows));
        Rows = fromBigToLittleEndian(Rows);
        file.read((char*)&Cols, sizeof(Cols));
        Cols = fromBigToLittleEndian(Cols);
        for (int i = 0; i < numOfImages; i++)
        {
            Images.push_back({});
            for (int r = 0; r < (Rows * Cols); r++)
            {
                unsigned char pixel = 0;
                file.read((char*)&pixel, sizeof(pixel));
                Images[i].push_back(pixel/255.0);
            }
        }
    }

}

void readLabels(vector<long double>& Labels) {
    ifstream file;
    file.open(_PATH_OF_LABELS, ios::binary);
    if (file.is_open())
    {
        int magicNumber = 0;
        int numOfLabels = 0;
        file.read((char*)&magicNumber, sizeof(magicNumber));
        magicNumber = fromBigToLittleEndian(magicNumber);
        file.read((char*)&numOfLabels, sizeof(numOfLabels));
        numOfLabels = fromBigToLittleEndian(numOfLabels);
        for (int i = 0; i < numOfLabels; i++)
        {
            unsigned char label = 0;
            file.read((char*)&label, sizeof(label));;
            Labels.push_back(label);
        }
        cout << magicNumber << endl << numOfLabels << endl;
    }
}

long double sigmoid(long double x) {
    return (1.0 / (1 + exp(-x)));
}

long double modRelu(long double x) {
    if (x < 0) return 0.01 * x;
    if (x >= 0 and x <= 1) return x;
    if (x > 1) return 1 + 0.01 * (x - 1);
}

long double derivative(long double x) {
    if (x < 0) return 0.01;
    if (x >= 0 and x <= 1) return 1;
    if (x > 1) return 0.01;
}

void DoLayers(vector<Layer>& layers, vector<int> sizes) {
    for (int i = 0; i < sizes.size(); i++) {
        int nextsize = 0;
        if (i < sizes.size() - 1) nextsize = sizes[i + 1];
        layers[i].neurons.resize(sizes[i]);
        layers[i].biases.resize(sizes[i]);
        layers[i].weights.resize(sizes[i]);
        for (int q = 0; q < sizes[i]; q++) {
            layers[i].weights[q].resize(nextsize);
        }
        for (int j = 0; j < sizes[i]; j++) {
            if(rand()%2==0)
                layers[i].biases[j] = (rand()%100)/100.0;
            else
                layers[i].biases[j] = -(rand() % 100)/100.0;
            for (int k = 0; k < nextsize; k++) {
                if (rand() % 2 == 0)
                    layers[i].weights[j][k] = (rand() % 100)/100.0;
                else layers[i].weights[j][k] = -(rand() % 100) / 100.0;
            }
        }
    }
}

void forwardFeeding(vector<long double>input, vector<Layer>& layers) {
    for (int j = 0; j < input.size(); j++) {
        layers[0].neurons[j] = (input[j]);
    }
    for (int i = 1; i < layers.size(); i++) {
        Layer l = layers[i - 1];
        Layer l1 = layers[i];
        for (int j = 0; j < l1.neurons.size(); j++) {
            l1.neurons[j] = 0;
            for (int k = 0; k < l.neurons.size(); k++) {
                layers[i].neurons[j] += layers[i - 1].neurons[k] * layers[i - 1].weights[k][j];
            }
            layers[i].neurons[j] += layers[i].biases[j];
            layers[i].neurons[j] = modRelu(layers[i].neurons[j]);
        }
    }

}

void backPropagation(int predict, vector<Layer>& layers, double learningRate) {
    vector<long double>errors;
    errors.resize(10);
    for (int i = 0; i < 10; i++) {
        if (i == predict) errors[i] = (1.0 - layers[3].neurons[i])*derivative(1.0 - layers[3].neurons[i]);
        else errors[i] = (0.0 - layers[3].neurons[i])*derivative(0.0 - layers[3].neurons[i]);
    }
    for (int k = 2; k >= 0; k--) {
        vector<long double>errsNext;
        vector<long double>gradients;
        errsNext.resize(layers[k].neurons.size());
        gradients.resize(layers[k + 1].neurons.size());
        for (int i = 0; i < layers[k + 1].neurons.size(); i++) {
            gradients[i] = errors[i] * derivative(layers[k + 1].neurons[i]);
            gradients[i] *= learningRate;
        }
        vector<vector<long double> > delta;
        delta.resize(layers[k + 1].neurons.size());
        for (int i = 0; i < layers[k + 1].neurons.size(); i++) {
            delta[i].resize(layers[k].neurons.size());
        }
        for (int i = 0; i < layers[k + 1].neurons.size(); i++) {
            for (int j = 0; j < layers[k].neurons.size(); j++) {
                delta[i][j] = gradients[i] * layers[k].neurons[j];
            }
        }
        for (int i = 0; i < layers[k].neurons.size(); i++) {
            errsNext[i] = 0;
            for (int j = 0; j < layers[k + 1].neurons.size(); j++) {
                errsNext[i] += layers[k].weights[i][j] * errors[j];
            }
        }
        errors.resize(0);
        errors.resize(layers[k].neurons.size());
        for (int i = 0; i < layers[k].neurons.size(); i++) {
            errors[i] = errsNext[i];
        }
        vector<vector<long double> > newWeights;
        newWeights.resize(layers[k].neurons.size());
        for (int i = 0; i < newWeights.size(); i++) {
            newWeights[i].resize(layers[k+1].neurons.size());
        }
        for (int i = 0; i < layers[k+1].neurons.size(); i++) {
            for (int j = 0; j < layers[k].neurons.size(); j++) {
                newWeights[j][i] = (layers[k].weights[j][i] + delta[i][j]);
            }
        }
        for (int i = 0; i < layers[k].weights.size(); i++) {
            for (int j = 0; j < layers[k].weights[i].size(); j++) {
                layers[k].weights[i][j] = newWeights[i][j];
            }
        }
        for (int i = 0; i < layers[k + 1].biases.size(); i++) {
            layers[k + 1].biases[i] += gradients[i];
        }

    }

}

int predict(vector<Layer>& layers) {
    long double maxWeight = 0;
    int digit = 0;
    for (int i = 0; i < 10; i++) {
        if (layers[layers.size() - 1].neurons[i] > maxWeight) {
            maxWeight = layers[layers.size() - 1].neurons[i];
            digit = i;
        }
    }
    return digit;
}

int main() {

    vector<vector<long double> >arrayOfImages;
    vector<long double>arrayOfLabels;
    vector<int> sizes = _SIZES_OF_LAYERS;
    vector<Layer> layers;

    readImages(arrayOfImages);
    readLabels(arrayOfLabels);

    layers.resize(_AMOUNT_OF_LAYERS);

    int batch = 100;

    int count = 0;

    int epochs = 60;

    int indexOfImg = 0;
    DoLayers(layers, sizes);
    for (int i = 0; i < epochs; i++) {

        int count = 0;
        long double errSum = 0;
        for (int j = 0; j < batch; j++) {
            int rightDigit = arrayOfLabels[indexOfImg];
            forwardFeeding(arrayOfImages[indexOfImg], layers);
            int predictedDigit = predict(layers);
            if (predictedDigit == rightDigit) count++;

            for (int i = 0; i < 10; i++) {
                if (i == rightDigit) errSum += pow(1.0 - layers[3].neurons[i], 2);
                else errSum += pow(0.0 - layers[3].neurons[i], 2);
            }
            backPropagation(predictedDigit, layers, 0.001);
            indexOfImg++;
        }
        cout << "epoch: " << i << " right: " << count << "/100 " << "error: " << errSum << endl;
    }
}

A: Всё, я нашел ошибку, не работало из-за того, что в функцию backPropagate не передавал ошибки с полседнего слоя.


text:
Q: Read specific part of line I need to get only a part of a line
I can read from the file but I can't read apart from a line.
now I just read the name and the score.
it comes out like this

Niels Score: 9786

just because I want to make sure people understand what the numbers mean.
please help me.
Now I am using visual basic
Public Class Form17
    Dim up As Integer = 0
    Dim ms As Integer
    Dim ts As Integer
    Dim speed As Integer = 3
    Dim picturebox(7) As PictureBox
    Dim player As Boolean
    Dim jk As Integer
    Dim snelheid As Integer = 2
    Dim punten As Integer = 0
    Dim punts As String
    Dim check As Integer
    Dim playername As String
    Dim highscores As Integer = 0
    Private Sub Form17_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
        If e.KeyValue = Keys.Escape Then
            Me.Close()
            Form3.Show()
        End If
        If PictureBox4.Top >= 90 Then
            If e.KeyValue = Keys.Space Or Keys.Up Then
                speed = 3
                up = True
                Walk.Enabled = False
                PictureBox4.Image = My.Resources.dino_spring
            End If
        End If
        If PictureBox4.Top <= 76 Then
            If e.KeyValue = Keys.Down Then
                smooth_jump.Enabled = False
                speed = 5
            End If
        End If
    End Sub
    Private Sub Form17_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim sr As New System.IO.StreamReader("test.txt")
        Dim sr2 As New System.IO.StreamReader("test.txt")
        Dim i As Integer = 0
        Dim curline As Integer = 0
        Dim ran As Integer = 0
        Dim rnd As Integer = 1

        'komt een woord uit
        Do Until sr.EndOfStream = True
                sr.ReadLine()
                i += 1
            Loop
            sr.Dispose()
        sr.Close()
        rnd = 1
        ran = rnd * i
        highscore.Text = "Best score: " & sr2.ReadLine()
        punts = sr2.ReadLine()
        i += 1
        namelabel.Text = "Best player" & sr2.ReadLine()
        playername = sr2.ReadLine()
        'woord opslaan
        TextBox1.Size = Me.Size
        PictureBox1.Location = New Point(839, 140)
        startplace()
        Label2.Visible = False
        Label3.Visible = False
        Label4.Visible = False
        Label5.Visible = False
        Label6.Visible = False
        Best_Score.Enabled = False
        Spelers.Enabled = False
        Cactus_plaatsen.Enabled = False
        Grond_bewegen.Enabled = False
        Punten_en_snelheid.Enabled = False
        Walk.Enabled = False
        smooth_jump.Enabled = False
    End Sub
    Private Sub Cactus_plaatsen_Tick(sender As Object, e As EventArgs) Handles Cactus_plaatsen.Tick
        gameover()
        movecactus()
    End Sub
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Grond_bewegen.Tick
        checkcactus()
        PictureBox1.Left -= snelheid
        PictureBox2.Left -= snelheid
        PictureBox3.Left -= snelheid
        If PictureBox3.Left <= -530 Then
            PictureBox3.Left = 845
        End If
        If PictureBox1.Left <= -530 Then
            PictureBox1.Left = 845
        End If
        If PictureBox2.Left <= -315 Then
            PictureBox2.Left = 1060
        End If
    End Sub
    Private Sub Spelers_Tick(sender As Object, e As EventArgs) Handles Spelers.Tick
        If up = False Then
            ts += 1
            PictureBox4.Top += speed
            If ts = 35 Then
                up = Nothing
            End If
        End If
        If up = True Then
            ms += 1
            If ms = 35 Then
                ms = 0
                up = False
            End If
        End If
        If up = True Then
            PictureBox4.Top -= speed

        End If
        If up = Nothing Then

        End If
        If PictureBox4.Top >= 92 Then
            speed = 0
            PictureBox4.Top = 92
            Walk.Enabled = True
        End If
        If speed = 0 Then
            smooth_jump.Enabled = True
        End If
    End Sub
    Private Sub createarray()
        picturebox(0) = PictureBox5
        picturebox(1) = PictureBox6
        picturebox(2) = PictureBox7
        picturebox(3) = PictureBox8
        picturebox(4) = PictureBox9
    End Sub
    Private Sub gameover()

        For i = 0 To 7
            If PictureBox4.Bounds.IntersectsWith(Label2.Bounds) Then
                tried()
                Label2.Left = -10
            End If
            If PictureBox4.Bounds.IntersectsWith(Label3.Bounds) Then
                tried()
                Label3.Left = -10
            End If
            If PictureBox4.Bounds.IntersectsWith(Label4.Bounds) Then
                tried()
                Label4.Left = -10
            End If
            If PictureBox4.Bounds.IntersectsWith(Label5.Bounds) Then
                tried()
                Label5.Left = -10
            End If
            If PictureBox4.Bounds.IntersectsWith(Label6.Bounds) Then
                tried()
                Label6.Left = -10
            End If
        Next
    End Sub
    Private Sub deadmsg()
        Spelers.Enabled = False
        Cactus_plaatsen.Enabled = False
        Grond_bewegen.Enabled = False
        Punten_en_snelheid.Enabled = False
        Walk.Enabled = False
        MsgBox("GAME OVER")
        Form3.Show()
        Me.Close()

    End Sub
    Private Sub tekstt()
        Dim name As String = TextBox1.Text
        Dim score As String = Label1.Text
        Using objreader As New System.IO.StreamWriter("test.txt", True)
            objreader.WriteLine(name)
            objreader.WriteLine(score)
        End Using
    End Sub
    Private Sub movecactus()
        PictureBox5.Left -= snelheid
        PictureBox6.Left -= snelheid
        PictureBox7.Left -= snelheid
        PictureBox8.Left -= snelheid
        PictureBox9.Left -= snelheid
        Label2.Left -= snelheid
        Label3.Left -= snelheid
        Label4.Left -= snelheid
        Label5.Left -= snelheid
        Label6.Left -= snelheid
    End Sub
    Private Sub checkcactus()
        For i = 2 To 6
            If snelheid = i Then
                If PictureBox5.Left <= -100 Then
                    PictureBox5.Left= 2100
                    Label2.Left= PictureBox5.Left + 10
                End If
                If PictureBox6.Left <= -100 Then
                    PictureBox6.Left = 2100
                    Label3.Left = PictureBox6.Left + 10
                End If
                If PictureBox7.Left <= -100 Then
                    PictureBox7.Left = 2100
                    Label4.Left = PictureBox7.Left + 10
                End If
                If PictureBox8.Left <= -100 Then
                    PictureBox8.Left = 2100
                    Label5.Left = PictureBox8.Left + 10
                End If
                If PictureBox9.Left <= -100 Then
                    PictureBox9.Left = 2100
                    Label6.Left = PictureBox9.Left + 10
                End If
            End If
        Next
    End Sub
    Private Sub startplace()
        PictureBox5.Location = New Point(1750, 112)
        PictureBox6.Location = New Point(350, 112)
        PictureBox7.Location = New Point(700, 112)
        PictureBox8.Location = New Point(1050, 112)
        PictureBox9.Location = New Point(1400, 112)
        Label2.Location = New Point(1760, 118)
        Label3.Location = New Point(360, 118)
        Label4.Location = New Point(710, 118)
        Label5.Location = New Point(1060, 118)
        Label6.Location = New Point(1410, 118)
    End Sub
    Private Sub Walk_Tick(sender As Object, e As EventArgs) Handles Walk.Tick
        jk += 1
        If jk = 5 Then
            PictureBox4.Image = My.Resources.dino_links
        End If
        If jk = 10 Then
            PictureBox4.Image = My.Resources.dino_rechts
            jk = 0
        End If
    End Sub
    Private Sub Punten_en_snelheid_Tick(sender As Object, e As EventArgs) Handles Punten_en_snelheid.Tick
        punten += 1
        If punten = 5 Then
            punten = 0
            punts += 1
            check += 1
            Label1.Text = "Score: " & punts
        End If
        If check = 200 Then
            check = 0
            snelheid += 1
            If snelheid = 5 Then
                snelheid = 4
            End If
        End If
    End Sub

    Private Sub Smooth_jump_Tick(sender As Object, e As EventArgs) Handles smooth_jump.Tick
        If PictureBox4.Top <= 50 Then
            speed = 3
        End If
        If PictureBox4.Top <= 20 Then
            speed = 1
        End If
    End Sub

    Private Sub tried()
        Dim top As String = TextBox1.Text
        If punts > highscores Then

            Using My.Computer.FileSystem.OpenTextFileWriter("test.txt", False)
            End Using
            tekstt()
            deadmsg()
        End If
    End Sub

    Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
        If Asc(e.KeyChar) = 13 Then
            TextBox1.Hide()
            TextBox1.Visible = False
            Spelers.Enabled = True
            Cactus_plaatsen.Enabled = True
            Grond_bewegen.Enabled = True
            Punten_en_snelheid.Enabled = True
            Walk.Enabled = True
            smooth_jump.Enabled = True
        End If
        If Asc(e.KeyChar) = 27 Then
            TextBox1.Text = ""
        End If
    End Sub

    Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyValue = Keys.Escape Then
            Me.Close()
            Form3.Show()
        End If
        If PictureBox4.Top >= 90 Then
            If e.KeyValue = Keys.Space Or Keys.Up Then
                speed = 3
                up = True
                Walk.Enabled = False
                PictureBox4.Image = My.Resources.dino_spring
            End If
        End If
        If PictureBox4.Top <= 76 Then
            If e.KeyValue = Keys.Down Then
                smooth_jump.Enabled = False
                speed = 5
            End If
        End If
    End Sub
End Class


text:
Q: Export specific CSV filename (eg: abc*.csv) from list of folders within a folder using python through looping method How to iterate through multiple folders within a folder and export specific  CSV filename that begins for example-  "abc*.csv" and export them into a new folder directory.
Trying to search similar example in Stack overflow but most examples were reading multiple CSV files within a folder and combine them to one data frame. Thanks.

A: import os
import shutil

files = []
source_dir = ['./files/']
dest_dir = './export/'

# List all files from all directories within the path
while len(source_dir) > 0:
    for (dirpath, dirnames, filenames) in os.walk(source_dir.pop()):
        source_dir.extend(dirnames)
        files.extend(map(lambda n: os.path.join(
            *n), zip([dirpath] * len(filenames), filenames)))

# Loop thru files to copy/move the matching CSVs
for file in files:
    if file.startswith('abc') and file.endswith('.csv'):
        shutil.copy(file, dest_dir)
        # shutil.move(file, dest_dir)  # Use .move to move the file instead

If you have this file structure:
files
├── dir1
│   ├── abc789.csv
│   └── abc789.txt
├── dir2
│   ├── abc098.csv
│   └── abc098.txt
└── dir3
    ├── abc456.csv
    └── subdir3
        ├── abc123.csv
        └── abc123.txt

Only the matching files will be exported:
$ ls export/
abc098.csv abc123.csv abc456.csv abc789.csv


text:
Q: ga.js to analytics.js - Event Function Checking for _gaq I'm migrating our system from ga.js to analytics.js and I have a function that submits an event. The function is:
function _fireGoogleEvent() {
    if (_gaq) {
        _gaq.push(['_setAccount', 'UA-XXXXX-1']);
        _gaq.push(['_trackEvent', 'EventCategory', 'Submitted']);

        _gaq.push(['_setAccount', 'UA-XXXXX-2']);
        _gaq.push(['_trackEvent', 'EventCatergory', 'Submitted']);
    }
}

When migrating to analtyics.js, will I need to check if ga exists like they are checking to see if _gaq exists? I know ga.js checks to see if it exists in the normal snippet with var _gaq = _gaq || []; but they didn't try to set it as an array here even if it didn't exist so I can't really think of a reason why else they'd be checking for it. There isn't any other points in the code where they submit another event either, so the only other thing they could be checking for would be if the tracker exists when the created a page view. I can't really see any reason for them to be checking for _gaq, unless they were semi trying to replicate the var _gaq = _gaq || [];, or is this just attempting to see if the tracker already exists, and if so, send this event? I don't believe it's the later though, because I don't see any attempt to create a tracker otherwise.

A: You can just replace _gaq with ga in this condition and adapt the tracking lines.
When you do:
_gaq = _gaq || []

you are creating an array to push these events to if it doesn't already exist. If analytics is added to the page after this code has already run,.(i.e. by an asynchronous script) then it will find and push these tracking events after it loads.
When you do:
if (_gaq)

you are simply not doing the task if _gaq is not present. This also prevents the code from having an exception when an analytics snippet is unexpectedly missing, but wont store these events in case an analytics snippet is added to the page after this code has already run.


text:
Q: Get Product Details based on Product Id in WCS I am new to WCS. new to Stackoverflow too...
Could someone please help me how to get Color and Size attributes based on product Id in Shopping Cart Page?
when clicking on the link in Shopping cart page, it will redirect to Quickview page. i dont want that. user should be able to select the size and color in shopping cart page itself...
Please let me know if you need anything else...

A: All the logic you need are in OrderItemDetail.jso and ProductDescription_Data.jspf .
you need to make sure of :

*

*only itemBeans are added to shopping cart

*when you loop them , you need to get the parent product for that itemBean , and then go over all the SKUs and combine their defining attributes in lists to show them .

*also please note that sometime , itemBeans can be the only SKU of the product , in other word that product have one single SKU .. so there will be no options to select
and sometimes that itemBean can be categorized under category without parent product .. called category item bean .. this will have NO parent product and you need just to show that SKU options .

a snippet to retrieve CatEntry form Solr would be like:
<wcf:getData type="com.ibm.commerce.catalog.facade.datatypes.CatalogNavigationViewType" var="allCatEntryInOrder" expressionBuilder="getCatalogEntryViewParentInfoByIDNoEntitlementCheck">

    <wcf:param name="UniqueID" value="${orderItem0.catalogEntryIdentifier.uniqueID}"/>
    <wcf:contextData name="storeId" data="${WCParam.storeId}" />
    <wcf:contextData name="catalogId" data="${WCParam.catalogId}" />
</wcf:getData>

then to get the Parent CatentryId you need to call solr again same as above but with
<wcf:param name="UniqueID" value="${aCatEntry.parentCatalogEntryID}"/>

please read about expressionBuilder and SearchProfiles because there are many of them , each one have it is own usage depending of the data you intended to return from solr.
hope this is give you idea where to look and do your solution.
Thanks
Abed


text:
Q: How to put a log in username and password script inside a csh script? How to put a log in username and password script inside a csh script?
I have a script that collects data and dumps it on a file
The problem is: I need to first log-in as su before I could successfully execute the script..
What if I need to call it through a crontab?
I wanted to atleast include in my csh script something that would log-in as SU with password.
Could you guys help me here? I was wasting a lot of time searching but still cant find it... Thanks in advance.
Here is my script:
#!/bin/csh

foreach i (./MACHINE/logs/*/*machinedump010113.log.gz)
zcat $i | sed 's,^,'$i' ,' | awk '{gsub("_"," ",$2)}1' | awk  '{gsub("./dummy/", "");print}' | awk '{gsub("/MACHINE_TS.log.gz_", " ");print}' | awk '{gsub(",", "/");print}' |  awk '{gsub("/", "");print}' | awk 'BEGIN { OFS = "\t"; } {print $1", "$2", "$3", "$4", "$6", "$7", " substr($0, index($0,$8))}' | awk  '{gsub(".TESTLOG", "");print}'  >> /DUMP/TEST.csv
end

exit

A: You could use sudo for this. Add something like this to your /etc/sudoers
youruser ALL = (root) NOPASSWORD: /path/to/yourscript.csh
Then call the script via cron or by hand like this:
sudo /path/to/yourscript.csh
And it should be executed as root without the need for a password.


text:
Q: html5 seek issue in chrome An application that plays back video stream in a browser pop up window does not allow seeking in chrome but works in firefox and edge.
This issue has been brought up a few times here and I found that the following response more fits my situation:
html 5 seek issue
Here the OP mentions the relation of the jetty server and its lack of support for http code 206 partial content retrieval. My question is whether a simple upgrade to the latest jetty version will fix this? Or has someone found a workaround to resolve this as we are restricted to the use of chrome for this application.

A: I resolved my situation by ensuring the response had the proper range headers and that the actual content-length was specified for playback.
Accept-Ranges: bytes
Content-Range: bytes 0-1025/905357
Content-Length: 905357

EDIT: this works so far for short videos and audio files but fails with jetty.EofException on large files


text: Q: Data structure complementary of BloomFilters Are there any (probabilistic) data structures for set membership test that might produce false negative but not false positives? I'm looking for something similar to BloomFilters but with complementary behavior: If the answer to 'mightContain' is 'yes' then the set is guaranteed to contain the element; if the answer is 'no' then the set might still contain the element.


text:
Q: Create a Custom Spring Cloud Netflix Ribbon Client I am using Spring Cloud Netflix Ribbon in combination with Eureka in a Cloud Foundry environment.
The use case I am trying to implement is the following:

*

*I have a running CF application named address-service with several instances spawned.

*The instances are registering to Eureka by the service name address-service

*I have added custom metadata to service instances using
eureka.instance.metadata-map.applicationId: ${vcap.application.application_id}

*I want to use the information in Eureka's InstanceInfo (in particular the metadata and how many service instances are available) for setting a CF HTTP header "X-CF-APP-INSTANCE" as described here.

*The idea is to send a Header like "X-CF-APP-INSTANCE":"appIdFromMetadata:instanceIndexCalculatedFromNoOfServiceInstances" and thus "overrule" CF's Go-Router when it comes to load balancing as described at the bottom of this issue.
I believe to set headers, I need to create a custom RibbonClient implementation - i.e. in plain Netflix terms a subclass of AbstractLoadBalancerAwareClient as described here - and override the execute() methods.
However, this does not work, as Spring Cloud Netflix Ribbon won't read the class name of my CustomRibbonClient from application.yml. It also seems Spring Cloud Netflix wraps quite a bit of classes around the plain Netflix stuff.
I tried implementing a subclass of RetryableRibbonLoadBalancingHttpClient and RibbonLoadBalancingHttpClient which are Spring classes. I tried giving their class names in application.yml using ribbon.ClientClassName but that does not work. I tried to override beans defined in Spring Cloud's HttpClientRibbonConfiguration but I cannot get it to work.
So I have two questions:

*

*is my assumption correct that I need to create a custom Ribbon Client  and that the beans defined here and here won't do the trick?

*How to do it properly?
Any ideas are greatly appreciated, so thanks in advance!
Update-1
I have dug into this some more and found RibbonAutoConfiguration.
This creates a SpringClientFactory which provides a getClient() method that is only used in RibbonClientHttpRequestFactory (also declared in RibbonAutoConfiguration).
Unfortunately, RibbonClientHttpRequestFactory hard-codes the client to Netflix RestClient. And it does not seem possible to override either SpringClientFactory nor RibbonClientHttpRequestFactory beans.
I wonder if this is possible at all.

A: Ok, I'll answer this question myself, in case someone else may need that in the future.
Actually, I finally managed to implement it.
TLDR - the solution is here: https://github.com/TheFonz2017/Spring-Cloud-Netflix-Ribbon-CF-Routing
The solution:

*

*Allows to use Ribbon on Cloud Foundry, overriding Go-Router's load balancing.

*Adds a custom routing header to Ribbon load balancing requests (including retries) to instruct CF's Go-Router to route requests to the service instance selected by Ribbon (rather than by its own load balancer).

*Shows how to intercept load balancing requests

The key to understanding this, is that Spring Cloud has its own LoadBalancer framework, for which Ribbon is just one possible implementation. It is also important to understand, that Ribbon is only used as a load balancer not as an HTTP client. In other words, Ribbon's ILoadBalancer instance is only used to select the service instance from the server list. Requests to the selected server instances are done by an implementation of Spring Cloud's AbstractLoadBalancingClient. When using Ribbon, these are sub-classes of RibbonLoadBalancingHttpClient and RetryableRibbonLoadBalancingHttpClient.
So, my initial approach to add an HTTP header to the requests sent by Ribbon's HTTP client did not succeed, since Ribbon's HTTP / Rest client is actually not used by Spring Cloud at all.
The solution is to implement a Spring Cloud LoadBalancerRequestTransformer which (contrary to its name) is a request interceptor.
My solution uses the following implementation:
public class CFLoadBalancerRequestTransformer implements LoadBalancerRequestTransformer {
    public static final String CF_APP_GUID = "cfAppGuid";
    public static final String CF_INSTANCE_INDEX = "cfInstanceIndex";
    public static final String ROUTING_HEADER = "X-CF-APP-INSTANCE";

    @Override
    public HttpRequest transformRequest(HttpRequest request, ServiceInstance instance) {

        System.out.println("Transforming Request from LoadBalancer Ribbon).");

        // First: Get the service instance information from the lower Ribbon layer.
        //        This will include the actual service instance information as returned by Eureka.
        RibbonLoadBalancerClient.RibbonServer serviceInstanceFromRibbonLoadBalancer = (RibbonLoadBalancerClient.RibbonServer) instance;

        // Second: Get the the service instance from Eureka, which is encapsulated inside the Ribbon service instance wrapper.
        DiscoveryEnabledServer serviceInstanceFromEurekaClient = (DiscoveryEnabledServer) serviceInstanceFromRibbonLoadBalancer.getServer();

        // Finally: Get access to all the cool information that Eureka provides about the service instance (including metadata and much more).
        //          All of this is available for transforming the request now, if necessary.
        InstanceInfo instanceInfo = serviceInstanceFromEurekaClient.getInstanceInfo();

        // If it's only the instance metadata you are interested in, you can also get it without explicitly down-casting as shown above.
        Map<String, String> metadata = instance.getMetadata();
        System.out.println("Instance: " + instance);

        dumpServiceInstanceInformation(metadata, instanceInfo);

        if (metadata.containsKey(CF_APP_GUID) && metadata.containsKey(CF_INSTANCE_INDEX)) {
            final String headerValue = String.format("%s:%s", metadata.get(CF_APP_GUID), metadata.get(CF_INSTANCE_INDEX));

            System.out.println("Returning Request with Special Routing Header");
            System.out.println("Header Value: " + headerValue);

            // request.getHeaders might be immutable, so we return a wrapper that pretends to be the original request.
            // and that injects an extra header.
            return new CFLoadBalancerHttpRequestWrapper(request, headerValue);
        }

        return request;
    }

    /**
     * Dumps metadata and InstanceInfo as JSON objects on the console.
     * @param metadata the metadata (directly) retrieved from 'ServiceInstance'
     * @param instanceInfo the instance info received from the (downcast) 'DiscoveryEnabledServer'
     */
    private void dumpServiceInstanceInformation(Map<String, String> metadata, InstanceInfo instanceInfo) {
        ObjectMapper mapper = new ObjectMapper();
        String json;
        try {
            json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(metadata);
            System.err.println("-- Metadata: " );
            System.err.println(json);

            json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(instanceInfo);
            System.err.println("-- InstanceInfo: " );
            System.err.println(json);
        } catch (JsonProcessingException e) {
            System.err.println(e);
        }
    }

    /**
     * Wrapper class for an HttpRequest which may only return an
     * immutable list of headers. The wrapper immitates the original
     * request and will return the original headers including a custom one
     * added when getHeaders() is called.
     */
    private class CFLoadBalancerHttpRequestWrapper implements HttpRequest {

        private HttpRequest request;
        private String headerValue;

        CFLoadBalancerHttpRequestWrapper(HttpRequest request, String headerValue) {
            this.request = request;
            this.headerValue = headerValue;
        }

        @Override
        public HttpHeaders getHeaders() {
            HttpHeaders headers = new HttpHeaders();
            headers.putAll(request.getHeaders());
            headers.add(ROUTING_HEADER, headerValue);
            return headers;
        }

        @Override
        public String getMethodValue() {
            return request.getMethodValue();
        }

        @Override
        public URI getURI() {
            return request.getURI();
        }
    }
}

The class is looking for the information required for setting the CF App Instance Routing header in the service instance metadata returned by Eureka.
That information is

*

*The GUID of the CF application that implements the service and of which several instances exist for load balancing.

*The index of the service / application instance that the request should be routed to.

You need to provide that in the application.yml of your service like so:
eureka:
  instance:
    hostname: ${vcap.application.uris[0]:localhost}
    metadata-map:
      # Adding information about the application GUID and app instance index to
      # each instance metadata. This will be used for setting the X-CF-APP-INSTANCE header
      # to instruct Go-Router where to route.
      cfAppGuid:       ${vcap.application.application_id}
      cfInstanceIndex: ${INSTANCE_INDEX}

  client:
    serviceUrl:
      defaultZone: https://eureka-server.<your cf domain>/eureka

Finally, you need to register the LoadBalancerRequestTransformer implementation in the Spring configuration of your service consumers (which use Ribbon under the hood):
@Bean
public LoadBalancerRequestTransformer customRequestTransformer() {
  return new CFLoadBalancerRequestTransformer();
}

As a result, if you use a @LoadBalanced RestTemplate in your service consumer, the template will call Ribbon to make a choice on the service instance to send the request to, will send the request and the interceptor will inject the routing header. Go-Router will route the request to the exact instance that was specified in the routing header and not perform any additional load balancing that would interfere with Ribbon's choice.
In case a retry were necessary (against the same or one or more next instances), the interceptor would again inject the according routing header - this time for a potentially different service instance selected by Ribbon.
This allows you to use Ribbon effectively as the load balancer and de-facto disable load balancing of Go-Router, demoting it to a mere proxy. The benefit being that Ribbon is something you can influence (programmatically) whereas you have little to no influence over Go-Router.
Note: this was tested for @LoadBalanced RestTemplate's and works.
However, for @FeignClients it does not work this way.
The closest I have come to solving this for Feign is described in this post, however, the solution described there uses an interceptor that does not get access to the (Ribbon-)selected service instance, thus not allowing access to the required metadata.
Haven't found a solution so far for FeignClient.


text:
Q: Is it possible to have a element transparent and see through his parent opaque background Hi I'm designing a form (HTML / CSS / JS) that pop's over the content when the user wants to subscribe or to login. The whole form background is solid opaque color but I want the inputs to have a transparent background so we can see the content behind the form through it. I don't have any problem setting the inputs transparent but I have no idea of how I can make them "pass through" their parent background color. I begin to think that is impossible with only CSS. I can share code but it's more like a generic question. Thanks

A: You can cheat by making your input appear to be a cutout, using a few more elements and a little creativity...
Working Example

$('.wrap').draggable();// demo only, used to show off cutout effect. Not necessary
.wrap {
    position:absolute;
}
.top, .bottom {
    background:grey;
}
input, .top, .bottom {
    width: 100%;
    border: 30px solid grey;
}
input {
    background: transparent;
    color: red;
    border: 29px solid grey;
    outline: none;
}

This may be cheating, but it works...

    <input type="text" placeholder="testing"/>

Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead. Cum horribilem walking dead resurgere de crazed sepulcris creaturis, zombie sicut de grave feeding iride et serpens. Pestilentia, shaun ofthe dead scythe animated corpses ipsa screams. Pestilentia est plague haec decaying ambulabat mortuos. Sicut zeder apathetic malus voodoo. Aenean a dolor plan et terror soulless vulnerum contagium accedunt, mortui iam vivam unlife. Qui tardius moveri, brid eof reanimator sed in magna copia sint terribiles undeath legionis. Alii missing oculis aliorum sicut serpere crabs nostram. Putridi braindead odores kill and infect, aere implent left four dead. Lucio fulci tremor est dark vivos magna. Expansis creepy arm yof darkness ulnis witchcraft missing carnem armis Kirkman Moore and Adlard caeruleum in locis. Romero morbo Congress amarus in auras. Nihil horum sagittis tincidunt, zombie slack-jawed gelida survival portenta. The unleashed virus est, et iam zombie mortui ambulabunt super terram. Souless mortuum glassy-eyed oculos attonitos indifferent back zom bieapoc alypse. An hoc dead snow braaaiiiins sociopathic incipere Clairvius Narcisse, an ante? Is bello mundi z?

A: A completely different solution would be to use an <svg>, or even a .png (though that would be an extra http request).

    <svg>
        # I am the same size as the background and have transparent parts where required
        # Indeed, I could be a div, with a .png background, if you needed to support older browsers
    </svg>
    <input class='input-one' />
    <input class='input-two' />

Then use css to set:

*

*position: absolute; on everything within the background div

*the svg to be top: 0; left: 0; so it covers the container exactly

*the inputs to be positioned over the transparent parts in the SVG

*the backgrounds of the inputs to be transparent

This way everything under the inputs will be transparent and whatever the background is will shine though.
Support for svgs is also excellent, you have to go back to IE8 for there to be a problem.

A: Yes you can, you can use mask
Support is not perfect, but the fallback is just no transparency, so it degrades nicely. This will also improve with time.
This will allow whatever is behind the element to shine through, flat colour, texture, gradient, multiple elements, images or even video.
Plus, it keeps the style in the css (and images) where it belongs.
I've made a JSFiddle to demonstrate - it's pretty simple really:

The markup is there, the background contains the element to be masked. The mask itself is an image made of of black areas of any level of transparency (including fully transparent). Here it is:

The two letter box shapes are the transparent bits which are where the background burns through to the foreground. The bar at the bottom is 50% transparent and serves to demonstrate how alpha values can be used.
The css is here:
.background {
    background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#959595), color-stop(46%,#0d0d0d), color-stop(50%,#010101), color-stop(53%,#0a0a0a), color-stop(76%,#4e4e4e), color-stop(87%,#383838), color-stop(100%,#1b1b1b));
    width: 250px;
    height: 250px;
    float:left;
}
.masked {
    background: #fff;
    width: 200px;
    margin: 25px;
    height: 200px;
    background-color: #4f6;
    -webkit-mask-image: url(http://stackoverflowimages.excitedstatelaboratory.com/mask-example-image-2.png);
}

You can see some demo specific positioning and size stuff, but what matters is the -webkit-mask-image which works like a background image to find the required png.
We can break the mask image by making it property invalid, which simulates what happens if a browser doesn't understand the property.
Once final point, anything you put in the slots would then have to have it's own background set to transparent in order for the stuff coming through the slots to be visible, but this is easy.

A: Take a look at this solution, https://jsfiddle.net/bnnp2pvj/1/
var color = $('.container').css('background-color');
color = color.replace(')', ', 0.2)').replace('rgb', 'rgba');
$('.background-match').css({"background-color":color});


text:
Q: How do I merge two lxml.objectify elements? I am parsing some XML configuration to use the settings therein. I am not going to write out the XML again, so my interest here is only in extraction.
I have two lxml.objectify elements: On the one hand an element containing default global settings, on the other one containing instance-specific settings. Each element is similarly structured (e.g. root.global_settings.lights holds the same kind of settings as root.instance_settings.lights) but there can be intersections as well as set differences. The elements contain some children text nodes but also nodes containing other nodes.
What I want: A single element containing all settings from both elements. Instance-specific settings override global ones.
The best solution I currently have is looping over the instance children and overwriting/adding to the global ones (at all levels where there are text nodes). I was thinking maybe there would be something more like dict.update?
EDIT: Just to give an example
<global>
    <birthday>Unknown</birthday>
    <wishes>
        <cake>Chocolate</cake>
        <gift>Book</gift>
    </wishes>
</global>

<instance>
    <name>Mike</name>
    <birthday>06-06-1974</birthday>
    <wishes>
        <notes>Hates flowers</notes>
    </wishes>
<instance>

would yield the same as if I had run objectify.parse on
<global>
    <name>Mike</name>
    <birthday>06-06-1974</birthday>
    <wishes>
        <cake>Chocolate</cake>
        <gift>Book</gift>
        <notes>Hates flowers</notes>
    </wishes>
</global>

A: I didn't find any 'native' lxml solutions. Objectify elements have traits from  both dictionaries (you can access their values like a dict) and lists (you can extend and append an element with other elements). Update, however, does not work at all and extend has severe limitations, including the lack of recursiveness.
So I put together this recursive function that updates one element using another. The specific context here is using user settings to override default settings, leaving defaults in place where there are no user settings.
In essence the function distinguishes between four kinds of nodes defined by two characteristics:
1) Is the node absent in the default settings? If so we can just copy over (append) the user one.
2) If the node is also found in the default settings, we need to make a further distinction: Is it a DataElement - i.e. a node with a direct data value, e.g. <name>Mike</name> - or more of a 'structural' node without a direct data value, e.g. <wishes>...</wishes> in the example above. In the first case we replace the default node (and value) with the user one. In the second, we need to go one level deeper and repeat the whole procedure.
def merge(user_el, default_el):
    '''Updating one lxml objectify elements with another'''
    for child in user_el.iterchildren():
        default_child = default_el.find(child.tag)
        if default_child is None:
            default_el.append(child)
            continue
        if isinstance(child, objectify.ObjectifiedDataElement):
            default_el.replace(default_child, child)
        elif isinstance(child, objectify.ObjectifiedElement):
            merge(child, default_child)

EDIT: Testing the above made me realise that if a structural user element that also existed in the defaults, e.g. as an empty node, had multiple child nodes with the same tag name, they would gradually replace each other's data child nodes. To avoid that I created a version that edits a copy of the default settings. That way we continue to check against the empty placeholder element rather than the element we're gradually filling.
new_xml = copy.deepcopy(DEFAULT_XML)
merge(user_xml, new_xml, DEFAULT_XML)

def merge(user_el, new_el, default_el):
   '''Updating one lxml objectify elements with another'''
   for child in user_el.iterchildren():
       new_child = new_el.find(child.tag)
       default_child = default_el.find(child.tag)
       if default_child is None:
           new_el.append(child)
           continue
       if isinstance(child, objectify.ObjectifiedDataElement):
           new_el.replace(new_child, child)
       elif isinstance(child, objectify.ObjectifiedElement):
           merge(child, new_child, default_child)


text:
Q: Bootstrap 3 navbar change dynamically Using the basic navbar in bootstrap, what is the best way to show the username and login status, after the user logs in?  In other words, how do I dynamically update the navbar menu, after the user logs in, to show that they are logged in ?

A: Well, you can put whatever you like inside your navbar.
Personally, I wouldn't update its structure on the client after login is performed (are you implementing AJAX login?). The easiest way is to simply submit login information, check the login status with your serverside language and fill the navbar accordingly in your template.
In the weird case you really want to update it directly on the client, you can go for a simple js callback (after the AJAX login is performed), assign a specific ID to the navbar section you would like to update and change its content (with jQuery it would be something as simple as $("#YOUR-ID").text("Whatever User Data");).


text:
Q: Is it possible to disable mysql subquery? Is it possible to configure mysql not to use subquery?
Such as select id from table where no=(select no from...)
If it is possible  how?
Thank you in advance

A: You can't disable subqueries.
What you can do is use joins instead of subqueries.
Using joins is faster and easier to maintain.

*

*how to rewrite your queries using joins

*Visual explanation of joins


text:
Q: Changing target Firebase ID using firebase-tools CLI At the command line...
When I run firebase deploy, I get the following error:

Error: The entered credentials were incorrect.

When I run firebase deploy --debug, I get the following (more detailed) error (and log) shown when you click here. (firebase-debug.log)
When I run firebase deploy --project good-project-id, I get the expected deployment behavior.
When I rerun firebase deploy and firebase deploy --debug I get the same errors already described.
How do I make the proper changes to eliminate the errors when running firebase deploy?
Notes:

*

*I am running Mac OS/X Yosemite v10.10.5

*I just ran the NPM installation procedure (via Homebrew) described here.

A: Look at the contents of your .firebaserc file in your project directory. You likely have a "default" project alias specified. Run firebase list and see if that project id shows up there as well (note it should be the project id, not the instance/subdomain name).
If it doesn't match, that's likely your issue. Another thing you can try is deleting the .firebaserc file and then running firebase use --add to create a new project alias.


text:
Q: Unit test Laravel query builder class, mock problem I'm trying to mock out the actual database operations in my Laravel application for the purposes of effective unit testing.  But I am having difficulty in getting the mocked method to be called, rather than the real method.
I have about 200 Models in app/Models which were generated using artisan make:model.  I'm in the process of creating query builder classes which extend Illuminate\Database\Eloquent\Builder for each of the models.  Likewise, there will be a PHPUnit test class for each of these query builders.
I've spent the last 2 days with the Laravel docs, the Mockery docs, Stack Overflow, Google and lots of debugging trying to get my unit test to work correctly, to no avail.  What's the trick to making this work with Laravel's intricate internals?
Example Model, stripped down:
<?php
namespace App\Models;
use App\Domain\Example\QueryBuilders\ExampleQueryBuilder;
use Illuminate\Database\Eloquent\Model;
/**
 * @property int $id
 * @property string $foo
 * @property string $bar
 * @property string $baz
 */
class Example extends Model
{
    public $timestamps = false;
    protected $table = 'my_table';
    protected $fillable = ['foo', 'bar', 'baz',];
    protected $dateFormat = 'U';
    protected $connection = 'mysql';
    public function newEloquentBuilder($query): ExampleQueryBuilder {
        return new ExampleQueryBuilder($query);
    }
}

Example query builder, stripped down:
<?php
namespace App\Domain\Example\QueryBuilders;
use App\Models\Example;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
final class ExampleQueryBuilder extends Builder
{
    protected $model;
    protected $onDelete;
    protected $query;

    public function findActive(string $foo): ?Model {
        $conditions = ['foo' => "$foo", 'bar' => 1,];
        $example = Example::firstWhere($conditions);
        if ($example instanceof Example) {return $example;}
        return null;
    }

Example unit test:
<?php
namespace Tests\Domain\Example\QueryBuilders;
use App\Models\Example;
use Tests\TestCase;

class ExampleQueryBuilderTest extends TestCase
{
    /** @test */
    public function it_handles_missing_example_correctly(): void {
        // I've tried endless variations on this, mocking the Model "Example",
        // mocking "Model", even "Process" at one crazy point.  Debugging proves
        // without a doubt that the `Builder::firstWhere` method IS being called
        // instead of my mocked method.
        $mock = $this->partialMock(Builder::class, function (MockInterface $mock) {
            $mock->shouldReceive('firstWhere')->once();
        });
        $this->app->instance(Builder::class, $mock);

        $example = Example::findActive('');
        self::assertNull($example);
    }
}

When this test is run, I get this output:

Method firstWhere() from Mockery_0_Illuminate_Database_Eloquent_Builder should be called
exactly 1 times but called 0 times.

So clearly the method I need to mock out is not getting mocked somehow.  What am I overlooking or missing?
My environment:  Laravel 8, Mockery 1.4, PHPUnit 9, PHP 7.4/8.0, macOS/Linux


text:
Q: window.onload function not running I'm facing a weird issue. The console.log() outside the onload function works, but the console.log() inside doesn't work... Would it mean that my page never fully loads ? I had a look at the developer tools of Chrome and it shows me that the page is loaded, so I don't really understand... (here is a screen of the devtool)
Here is my code:
console.log("hello1");

window.onload = function()
{
    console.log("hello2");
};

(I'm using this in a WordPress website, but I don't think it changes anything)
Thanks in advance,
ArbreMojo.

A: Some other code is probably assigning another function value to the window.onload method, so it basically overrides your assignment.
Instead of window.onload = function you can do:
window.addEventListener('load', function() {
  console.log('loaded')
})

which allows attaching an arbitrary number of handlers for that event. This ensures nothing can override your callback function.
See: EventTarget.addEventListener for more info.


text:
Q: change original payload with wso2 esb I saved the following structure on a property du wso2:
<ELEMENT>
   <ELEMENT_2>
   <ELEMENT_3>
   <ID> 173993 </ID>
   </ELEMENT_3>
   </ELEMENT_2>
   </ELEMENT>

I want to bring TEMP only to children:
<TEMP>
            <NAME>GEORGE</NAME>
            <COGNOME>MENDEZ</COGNOME>
            <BUSINESSNAME/>
            <CHANNEL>X091</CHANNEL>

   </TEMP>

I want to add them right after the <ELEMENT_2>
FINAL RESULTS:
 <ELEMENT>
   <ELEMENT_2>
   <NAME>GEORGE</NAME>
   <COGNOME>MENDEZ</COGNOME>
   <BUSINESSNAME/>
   <CHANNEL>X091</CHANNEL>
   <ELEMENT_3>
   <ID> 173993 </ID>
   </ELEMENT_3>
   </ELEMENT_2>
   </ELEMENT>

Thanks

A: Can you check if your requirement is achieved with the following proxy configuration.
    <?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="enrichProxy"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <property name="initial_payload" scope="default">
            <ELEMENT xmlns="">
               <ELEMENT_2>
                  <ELEMENT_3>
                     <ID>173993</ID>
                  </ELEMENT_3>
               </ELEMENT_2>
            </ELEMENT>
         </property>
         <call>
            <endpoint>
               <http uri-template="http://run.mocky.io/v3/7c578a1d-5427-4325-9f00-4ad7bb80dd04"/>
            </endpoint>
         </call>
         <log level="custom">
            <property expression="$body//TEMP/*" name="******"/>
         </log>
         <respond/>
      </inSequence>
   </target>
   <description/>
</proxy>

Remove external tag with xpath wso2
update
Here I have enriched the second property (..) back to the body using a enrich mediator.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="enrichProxy"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <property name="initial_payload" scope="default">
            <ELEMENT xmlns="">
               <ELEMENT_2>
                  <ELEMENT_3>
                     <ID>173993</ID>
                  </ELEMENT_3>
               </ELEMENT_2>
            </ELEMENT>
         </property>
         <property name="second_payload" scope="default">
            <TEMP xmlns="">
               <NAME>GEORGE</NAME>
               <COGNOME>MENDEZ</COGNOME>
               <BUSINESSNAME/>
               <CHANNEL>X091</CHANNEL>
            </TEMP>
         </property>
         <enrich>
            <source clone="true" property="second_payload" type="property"/>
            <target type="body"/>
         </enrich>
         <enrich>
            <source clone="true" xpath="$body//TEMP/*"/>
            <target action="child" xpath="$ctx:initial_payload//ELEMENT_2"/>
         </enrich>
         <log level="custom">
            <property expression="$ctx:initial_payload" name="******"/>
         </log>
         <respond/>
      </inSequence>
   </target>
   <description/>
</proxy>


text:
Q: Type Mismatch with InStrRev Thanks for reading my question, I keep getting a type mismatch with my function. I read the MS site on InStrRev and it states that it rets an integer. My function is set to return an integer so I'm not sure what I did wrong?
Function gSearch(str As String, find As String, Optional dir As String) As Integer
Select Case dir
    Case "L", "l", "left", "Left"
        gSearch = InStrRev(str, find)
    Case "R", "r", "right", "Right"
        gSearch = InStrRev(Len(str), str, find)
    Case Else
        gSearch = InStrRev(str, find)
End Select

End Function

A: You are getting your error in the second case of:
 Case "R", "r", "right", "Right"
    gSearch = InStrRev(Len(str), str, find)

Your first parameter of the InStrRev is Len(str).
Len(str) result is a number; The InStrRev first parameter needs to be a String.


text:
Q: Example of ODE $x' = f(x)$ for $f : \mathbb{R}^3 \to \mathbb{R}^3$ such that solution is bounded but not periodic On the last page of these notes:
http://www.cds.caltech.edu/archive/help/uploads/wiki/files/179/lecture5Bs.pdf
the author says that "for $n \geq 3$ trajectories may wander around a bounded region without settle down to a fixed point or a closed orbit."  I've been trying to think of an IVP in which this scenario happens but can't come up with anything.  Is there some classic example someone can point me to?
More specifically, could you give me an example of an ODE $x' = f(x)$ for some $f : \mathbb{R}^3 \to \mathbb{R}^3$ such that a solution is bounded but is neither an equilibrium nor a periodic orbit?

A: In the case $n>2$ the Poincaré-Bendixson theorem doesn's hold and the system can be chaotic (it can have strange attractors). A classic example you can easily find is the Lorenz system. It present, for the proper values of the parameters, the famous butterfly-like attractor.


text:
Q: Rewrite query string to path I'm having a hard time trying to write regex for redirecting a query string to a path using rewrite rules like so:
add_action('init', 'wp_j_url_rewrite');
function wp_j_url_rewrite() {
    add_rewrite_rule('(.*)\/jobs\/\?(.*)', '/job/$matches[2]', 'top');
}

Essentially I'd want the result to be that a url:
https://test.com/jobs/?test would be redirected to https://test.com/job/test
I've also tried using $matches[1]\/job\/$matches[2] as the second argument of the add_rewrite_rule function without any luck. This does work as regex on this example:
https://regex101.com/r/TdmhL4/2


text:
Q: How draw a matrix with coordinates using tikz - Latex? I would like to draw a matrix of one line et multiples columns with specifics coordinates (3.75, 0.5). Here my figure with tikz :

Here, the result I'm trying to get, but forget the colors:

I tried this, but it doesn't work:
\begin{figure}[h!]
  \begin{tikzpicture}
    \matrix (m1) at (3.75, 0.5) { \node{Cpt: & 0 & 1 & 2 & 1 & 0}; \\ };
  \end{tikzpicture}
\end{figure}

Thanks in advance !


text:
Q: jQuery click works only once I want to create a circle everytime I click the button but the once I click it, it creates a circle but when i click it again nothing happen.

$(document).ready(function() {
  var circle = $("

");
  $(".t-testbody").on("click", "#clickMe", function() {
    $(".t-testbody").append(circle);
  });
});
.t-testbody {
  margin-top: 100px;
  margin-left: 50px;
}
.circleClass {
  width: 50px;
  height: 50px;
  border-radius: 100%;
  background-color: blue;
  display: inline-block;
}

  <button id="clickMe">Button</button>

A: Currently you have created the element and appended it to the div. so second append statement has not effect as the element already exist in the div.
Instead of element use HTML string
var circle = "

";
$(".t-testbody").on("click", "#clickMe", function () {
    $(".t-testbody").append(circle);
});

DEMO

You can use .clone()
var circle = $("

");
$(".t-testbody").on("click", "#clickMe", function () {
    $(".t-testbody").append(circle.clone());
});

DEMO

A: You are defining your HTML element only once, so instead of this
$(document).ready(function() {
  var circle = $("

"); // Move this into event handler callback
  $(".t-testbody").on("click", "#clickMe", function() {
    $(".t-testbody").append(circle);
  });
});

Do this:
$(document).ready(function() {
  $(".t-testbody").on("click", "#clickMe", function() {
    var circle = $("

"); // Move this here
    $(".t-testbody").append(circle);
  });
});

What's happening is that jQuery creates the HTML element, then on click it moves that element to the div. When you click it again, it moves that same element into where it just was, giving the illusion that it did nothing, but it just moved it into the position it already was.
When you move the variable declaration into the callback, it will generate a new html element every time you click that element, therefore jQuery will be appending a newly defined element to the div.

A: circle holds the reference of element being appended. So it has no difference after first click.
You can create circle inside the callback function like this :

$(document).ready(function(){
    $(".t-testbody").on("click","#clickMe",function(){
        var circle = $("

");
        $(".t-testbody").append(circle);
    });
});
.t-testbody {
  margin-top: 100px;
  margin-left: 50px;
}
.circleClass {
  width: 50px;
  height: 50px;
  border-radius: 100%;
  background-color: blue;
  display: inline-block;
}

  <button id="clickMe">Button</button>

Demo : http://jsfiddle.net/vikashvverma/ou52j2xn/


text:
Q: R: Select names of a data.frame using levels() function I have two data.frames input and filelist which are subset with the code below
input <- structure(list(NAME = structure(c(3L, 3L, 7L, 6L, 4L, 2L, 5L, 5L, 5L, 1L), .Label = c("Example2", "Example7", "Test", "Test2","Test3", "Test6", "Test77"), class = "factor"), REFERENCE = structure(c(2L,2L, 3L, 1L, 1L, 4L, 2L, 2L, 2L, 1L), .Label = c("EXAMPLE5", "REGION1", "REGION2", "REGION77"), class = "factor"), VALUE = structure(c(1L,1L, 2L, 3L, 4L, 6L, 5L, 5L, 5L, 7L), .Label = c("120", "13", "14", "65", "89", "B", "C"), class = "factor")), .Names = c("NAME", "REFERENCE", "VALUE"), class = "data.frame", row.names = c(NA,-10L))

filelist <- structure(list(NAME = structure(c(3L, 5L, 1L, 6L, 4L, 2L), .Label = c("","Example2", "Test", "Test2", "Test3", "Test6"), class = "factor"), REFERENCE = structure(c(3L, 3L, 1L, 2L, 2L, 2L), .Label = c("",  "EXAMPLE5", "REGION1"), class = "factor")), .Names = c("NAME","REFERENCE"), class = "data.frame", row.names = c(NA, -6L))

library(dplyr)
ana <- filelist %>% left_join(., input)

     NAME REFERENCE VALUE
1     Test   REGION1   120
2    Test3   REGION1    89
3                     <NA>
4    Test6  EXAMPLE5    14
5    Test2  EXAMPLE5    65
6 Example2  EXAMPLE5     C

and then written into different data.frames:
list2env(split(ana, f = ana$REFERENCE )[-1], .GlobalEnv)

This all works fine, but what I am trying to do in a next step is to access the NAMES for the group REGION1 (the result will later be part of a legend where I dont want all the different items in, only those selected). I am trying to do this with the levels() command
NAMES_REGION1 <- levels(REGION1$NAME)

but my output is the following:
[1] ""         "Example2" "Test"     "Test2"    "Test3"    "Test6"

what I would like to have as output is only "Test" and "Test3" because only they are part of the group REGION1 .
Any ideas why this is happening?

A: Since REGION1 was produced from a larger data set, you'll want to drop the excess levels carried over after the subset.  You can use droplevels
REGION1$NAME <- droplevels(REGION1$NAME)
levels(REGION1$NAME)
# [1] "Test"  "Test3"

Notice that the REFERENCE column also has levels that were carried over.  You can remove the extra levels in both columns at once with
REGION1[-3] <- lapply(REGION1[-3], droplevels)

Now we can see that all extra levels are gone
lapply(REGION1[-3], levels)
# $NAME
# [1] "Test"  "Test3"
#
# $REFERENCE
# [1] "REGION1"


text:
Q: DB2 Merge and effect of simultaneous inserts to the table on ROWCOUNT I have to update the table in batches. I first select records in dataset , process them and send the xml constructed from dataset to stored proc.
I have a stored procedure which has xml as input parameter. It updates the table using merge query as below
CREATE PROCEDURE SP_UPDATE(IN RECORDS XML, OUT ROWSUPDATED INTEGER)
BEGIN
DECLARE RCOUNT INTEGER;
MERGE INTO TARGET_TABLE AS T
USING (SELECT X.* FROM
XMLTABLE('$d/Root/Record' passing RECORDS as "d"
COLUMNS
        "A" VARCHAR(10) PATH 'a',
        "B" VARCHAR(10) PATH 'b',
        "C" VARCHAR(10) PATH 'c',
        "D" VARCHAR(10) PATH 'd',
        "E" VARCHAR(10) PATH 'e',
        "F" VARCHAR(10) PATH 'f'
) AS X) AS S
ON T.FCOL=S."F"
WHEN MATCHED AND T.ACOL=0 THEN
UPDATE
SET
T.ACOL=1,
T.BCOL=XT."B",
T.COL=XT."C"
GET DIAGNOSTICS RCOUNT=ROWCOUNT;
SET ROWSUPDATED=RCOUNT;
END

This procedure is being called until all the records get updated. New records get inserted to the target table at the same time by other applications.I have to update both old and newely inserted records as above by setting some column value to 1.
The problem is ROWSUPDATED value is not correct. Suppose I'had sent 10 xml records for update, ROWSUPDATED values would be less than 10. Why the ROWCOUNT variable is not giving me proper count? Is my stored proc failing to update records in presence of continuous inserts or it's just false value by ROWCOUNT?..Is ROWCOUNT safest way to get the count of rows updated by merge query in presence of inserts in the same table?


text:
Q: JavaFX-8: limit number of characters in a textfield I'm trying to limit the number of characters which can be inserted in a JavaFX-8 TextField: when the limit is reached endLineReached() method is called.
I would like to set the maximum number of chars basing on size (the visible part on GUI) of the textfield. So the code I'm using is
textfield.textProperty().addListener((ov, oldValue, newValue) -> {
            onEndLine(textfield.getText(), textfield.getPrefColumnCount());
        });

public void onEndLine(String text, int prefColumnCount) {
    if (text.length() > prefColumnCount) {
        endLineReached();
    }
}

The problem is that textfield.getPrefColumnCount() not work properly. Furthermore I'm not able to set prefColumnCount value programmatically because the textfield width could change every time the program is re-started (not during execution). The textfield is child of a JavaFX HBox.

A: If you want to limit the length of the text based solely on the visual width of the text field, that's a little tricky as it depends on many factors (the font, the width of the text field, the padding applied to the text field, in the case of a variable-width font the actual text that has been entered, etc).
Note this seems a strange thing to do (imo), because the user will be able to enter relatively long text if it happens to use narrow characters, but relatively short text if it happens to use wide characters (in this example below I can enter 26 "l"s but only 8 "m"s). Really the text the user is allowed to enter should be based on logical considerations (i.e. business rules), not visual ones. But maybe you have some unusual use-case for this.
You can use a text formatter on the text field to veto the addition of text. To check the width, create a new Text object with the new text, set the font to the same font as the text field, and then check its width. You need to account for padding in the text field as well. Note this is a little fragile, as you don't really know the implementation of the layout of the text field, but this appears to work ok, at least with the JDK version I have.
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.scene.control.TextFormatter;
import javafx.scene.control.TextInputControl;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class TextFieldNoScroll extends Application {

    @Override
    public void start(Stage primaryStage) {
        TextField textField = new TextField();
        textField.setTextFormatter(new TextFormatter<String>(change -> {

            if (change.isAdded()) {
                Insets textFieldInsets = change.getControl().getPadding();
                double horizPadding = textFieldInsets.getLeft() + textFieldInsets.getRight() ;

                Text newText = new Text(change.getControlNewText());
                newText.setFont(((TextInputControl)change.getControl()).getFont());
                double newTextWidth = newText.getBoundsInLocal().getWidth();
                if (newTextWidth + horizPadding > change.getControl().getWidth()) {
                    return null ;
                }
            }

            return change ;
        }));

        VBox root = new VBox(textField);
        root.setAlignment(Pos.CENTER);
        Scene scene = new Scene(root, 120, 120);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}


text:
Q: airconsole simulator isn't showing my updated code when refreshed I'm trying to test my game on the site using the simulator page. however I'm running into a problem. no mater what it seems like my page updates are not changing on the simulator. I've tested locally on the pages, and they work fine.
anyone know? i haven't seen anything in documentation

A: At least for me when I'm testing the controllers for the Unity project, or another HTML / Javascript project I need to clear the cache once in a while to make it work.
For Firefox; Options (top right corner) - Privacy & Security (left menu) - Clear data (button on the right)
(I untick the "Cookies and Site Data" because it does not affect to this problem.)
And just to make it clear, it's not an AirConsole problem. If you have ever tried to create a local website and you are testing stuff this might happen as well. Also, you don't have to do this everytime something changes.

A: Just found out that if you add something a question mark after the address and put something random after it, it will refresh well again (a bit like what is done in web with images to avoid caching sometimes).
Example:
Original url: http://www.airconsole.com/#http://192.168.1.2/game
Url after 1st change: http://www.airconsole.com/#http://192.168.1.2/game?1
Url after 2nd change: Url after change: http://www.airconsole.com/#http://192.168.1.2/game?2
etc...
UPDATE
I've also found that the following works:

*

*Original url: http://www.airconsole.com/#http://192.168.1.2/game

*Open a tab with http://192.168.1.2/game/screen.html

*Do CMD + Shift + R on OSX or Ctrl + F5 on Windows when using Chrome

*Switch to the original airconsole URL tab and do the previous step

*Your game is now refreshed


text:
Q: c# datagridview valuetype with range hi in c# i can do the following...
 dataGridView1.Columns["Column2"].ValueType = typeof(double);

is it possible also to provide the range for those double values entered on that column rows... for example i want user to enter only values between 0.0-100.0...? thanks a lot!

A: You can't do that by setting a property, but you can handle the CellValidating event and do the validation yourself.
You can then set the ErrorText property to an appropriate error message at the corresponding cell or row. You'll then have to set the ErrorText property to an empty string on the CellValidated event.


text:
Q: Facebook Insights API to asp.net (not an App) We are trying to help a customer of ours to get their company page FB Insights data out of FB and shown on an Admin website we have for the client. So instead of having to log into FB to see the insights they will be able to see the data (that we put into reports) from the analytics webiste we already have for them.
we just can't figure out how to use the FB API to pull data for an individual fan page in an asp.net application using VB as the programming language.

A: Did you try to use Facebook C# SDK and try to access insight object:
https://developers.facebook.com/docs/reference/api/insights/
You have to be admin of App/Page to be able to get this to work.


text:
Q: how to fix a java.lang.NumberFormatException error where the desire input is string? i'm using Jframe as my front-end for an inventory system i have developed. I'm getting a "java.lang.NumberFormatException: For input string:"6seater"" but the variable is declared as a string so i'm a bit confused as to why this error is coming up
private String Eng_num, Chasis_num, make, model, year_of_car,capacity,description;
private Integer status,Sup_id;

public void actionPerformed(ActionEvent e)
{
    Insert I = new Insert();

    try
    {
        Chasis_num = textField_1.getText();
        Eng_num = textField_9.getText();
        year_of_car = textField_10.getText();
        model = textField_11.getText();
        make = textField_12.getText();
        capacity = textField_14.getText();//error is at this line
        description = textField_16.getText();
        Sup_id = Integer.parseInt(""+textField_13.getText().toString());
        status = Integer.parseInt(""+textField_15.getText().toString());

        I.insertVehicle(Eng_num, Chasis_num, make, model, year_of_car, capacity, Sup_id, status, description);
    }

I even try to put .toString and still getting the same error

A: capacity = textField_14.getText();

I don't think this is the cause of your exception.
java.lang.NumberFormatExceptionOnly occur when you try to parse String into any kind of Number.
So, i'm guessing, this exception was thrown somewhere you try to convert 6seater to Int or some other number format.

A:
I'm getting a "java.lang.NumberFormatException: For input string:"6seater"" but the variable is declared as a string so i'm a bit confused as to why this error is coming up.

The error is happening because you have tried to parse the characters 6seater as an integer.  It isn't an integer.  An integer consists of the characters 0 through 9, possibly with a - character at the front.  Any other character, and the value will be rejected ...
(The problem is nothing to do with the type that getText() returns.  The problem is the value that you are giving to the parseInt method.  It is not clear where the parseInt call is.  A stacktrace would answer that ... but you didn't provide one.)

Also, you say:
    capacity = textField_14.getText();//error is at this line

Actually, it isn't.  That line cannot possibly throw a NumberFormatException.  In reality, the error could be happening at one of these lines:
    Sup_id = Integer.parseInt(""+textField_13.getText().toString());
    status = Integer.parseInt(""+textField_15.getText().toString());

or it could be happening within the the insertVehicle method that you are calling here:
    I.insertVehicle(Eng_num, Chasis_num, make, model,
                    year_of_car, capacity, Sup_id, status, description);

I should also point out that you have made some egregious Java style errors in your code:

*

*Java class, method or variable names should never contain _ as a separator.  Use "camel case".

*A Java variable name should never start with an uppercase letter.
(If you instructor doesn't deduct "style" marks for this, he/she should.  If your code reviewers don't pick this up, they are not doing their job properly.  If this code was intended to be delivered to a paying customer, they would have reason to complain about the code quality ...)


text:
Q: Linter complaining when instance variable of subclass is another subclass instance, which can have different instance variables This is a bit confusing, and I tried to explain it in simple English but it's hard to follow. Instead, I have written the following toy code to illustrate the problem. This code runs fine and prints the expected output, however my linter complains on the lines shown.

*

*Is this an issue with the linter?

*Or can I do something to stop the linter complaining about this?

*Or is this bad practice/design and I should fix it somehow?

from abc import ABC

class SuperClassVariable(ABC):
    def __init__(self, shared_value: str):
        self.shared_value = shared_value

class SubClassVariable1(SuperClassVariable):
    def __init__(self, shared_value: str, sub_class_value_1: str):
        super().__init__(shared_value=shared_value)
        self.sub_class_value_1 = sub_class_value_1

class SubClassVariable2(SuperClassVariable):
    def __init__(self, shared_value: str, sub_class_value_2: str):
        super().__init__(shared_value=shared_value)
        self.sub_class_value_2 = sub_class_value_2

class SuperClass(ABC):
    def __init__(self, sub_class_variable: SuperClassVariable):
        self.sub_class_variable = sub_class_variable

class SubClass1(SuperClass):
    def __init__(self, sub_class_variable: SubClassVariable1):
        super().__init__(sub_class_variable=sub_class_variable)

class SubClass2(SuperClass):
    def __init__(self, sub_class_variable: SubClassVariable2):
        super().__init__(sub_class_variable=sub_class_variable)

sub_class_variable_1 = SubClassVariable1(
    shared_value="shared_value",
    sub_class_value_1="sub_class_variable_1"
)
sub_class_variable_2 = SubClassVariable2(
    shared_value="shared_value",
    sub_class_value_2="sub_class_variable_2"
)

sub_class_1 = SubClass1(sub_class_variable=sub_class_variable_1)
sub_class_2 = SubClass2(sub_class_variable=sub_class_variable_2)

print(sub_class_1.sub_class_variable.shared_value)      # OK
print(sub_class_1.sub_class_variable.sub_class_value_1) # Cannot access member "sub_class_value_1" for type "SuperClassVariable"
print(sub_class_2.sub_class_variable.shared_value)      # OK
print(sub_class_2.sub_class_variable.sub_class_value_2) # Cannot access member "sub_class_value_1" for type "SuperClassVariable"

Output:
shared_value
sub_class_variable_1
shared_value
sub_class_variable_2

A: I was able to solve it as shown. Not sure if this is the best/correct way for this. I believe using typing. Generic may be a more accepted way to fix this issue, but I prefer to show the superclass name as the type hint rather than a generic type.
from abc import ABC

class SuperClassVariable(ABC):
    def __init__(self, shared_value: str):
        self.shared_value = shared_value

class SubClassVariable1(SuperClassVariable):
    def __init__(self, shared_value: str, sub_class_value_1: str):
        super().__init__(shared_value=shared_value)
        self.sub_class_value_1 = sub_class_value_1

class SubClassVariable2(SuperClassVariable):
    def __init__(self, shared_value: str, sub_class_value_2: str):
        super().__init__(shared_value=shared_value)
        self.sub_class_value_2 = sub_class_value_2

class SuperClass(ABC):
    def __init__(self, sub_class_variable: SuperClassVariable):
        self.sub_class_variable = sub_class_variable

class SubClass1(SuperClass):
    sub_class_variable: SubClassVariable1

    def __init__(self, sub_class_variable: SubClassVariable1):
        super().__init__(sub_class_variable=sub_class_variable)

class SubClass2(SuperClass):
    sub_class_variable: SubClassVariable2

    def __init__(self, sub_class_variable: SubClassVariable2):
        super().__init__(sub_class_variable=sub_class_variable)

sub_class_variable_1 = SubClassVariable1(
    shared_value="shared_value",
    sub_class_value_1="sub_class_variable_1"
)
sub_class_variable_2 = SubClassVariable2(
    shared_value="shared_value",
    sub_class_value_2="sub_class_variable_2"
)

sub_class_1 = SubClass1(sub_class_variable=sub_class_variable_1)
sub_class_2 = SubClass2(sub_class_variable=sub_class_variable_2)

print(sub_class_1.sub_class_variable.shared_value)      # OK
print(sub_class_1.sub_class_variable.sub_class_value_1) # OK
print(sub_class_2.sub_class_variable.shared_value)      # OK
print(sub_class_2.sub_class_variable.sub_class_value_2) # OK


text:
Q: Can `tmutil restore` recursively override files? I ran the following commands:
cd /Users/user/
mkdir back_me_up
touch back_me_up/touched_file
tmutil startbackup --block
rm back_me_up/touched_file
tmutil restore /Volumes/BackupParition/MyMac/Latest/MainPartition/Users/user/* /Users/user/

And got:
/Users/user/Desktop: File exists (error 17)
/Users/user/Documents: File exists (error 17)
/Users/user/Downloads: File exists (error 17)
/Users/user/Library: File exists (error 17)
/Users/user/Movies: File exists (error 17)
/Users/user/Music: File exists (error 17)
/Users/user/Pictures: File exists (error 17)
/Users/user/Public: File exists (error 17)
/Users/user/back_me_up: File exists (error 17)

So back_me_up/touched_file was not recovered.
Is there a way to recursively override existing files with the tmutil restore command?

A: Personally, I didn't find any way to make 'tmutil restore' automatically override files and directories. Looks like the answer is no.
However, you can easily script this behavior, using 'tmutil compare'. It outputs the differences between your current files and a specific backup in a nicely formatted, easily parsed format. You could do something like:
pathList = parseCompareResult('tmutil compare')
for path in pathList:
    rm -rf path
    tmutil restore path


text:
Q: Are the real and imaginary parts of the complex number $(-1/2)^{(-1/2)^{(-1/2)}}$ irrational? Transcendental?
Question: Are the real and imaginary parts of the complex number $(-1/2)^{(-1/2)^{(-1/2)}}$ irrational? Transcendental ?

Background and motivation: I became curious about numbers writable as $$\Bigg |(-1/n)^{(-1/n)^{(-1/n)}} \Bigg|$$ This was motivated by me trying to write $e^{\pi\sqrt{2}}.$ Now Gelfond-Schneider tells us that $e^{\pi\sqrt{2}}$ is irrational and transcendental. On the other hand I know that $(-1/n)^{(-1/n)^{(-1/n)}}$ is a complex number in particular there exist real numbers $z_0$ and $z_1$ such that $$(-1/n)^{(-1/n)^{(-1/n)}}=z_0+iz_1 $$ For example if $n$ is equal to $2$: $$(-1/2)^{(-1/2)^{(-1/2)}}= \color{blue}{47.339658423\ldots}+i\color{blue}{70.6208560994\ldots}$$ I do not believe Gelfond-Schneider shows $47.339658423\ldots$ and $70.6208560994\ldots$ to be irrational or transcendental.


text:
Q: Add JPA repository in reactive JHipster project I have a JHipster project which is configured as a reactive project. I need to add JPA repository.
I changed this:
@Repository
public interface ActivePairsRepository extends R2dbcRepository<ActivePairs, Long>, ActivePairsRepositoryInternal {
    ....
}

to this:
@Repository
public interface ActivePairsRepository extends JpaRepository<ActivePairs, Long>, JpaSpecificationExecutor<ActivePairs> {
   ......
}

and I added:
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

But when I start the project I get:
{"timestamp":"2021-12-17 13:32:22.171","level":"WARN","message":"Registering converter from class java.util.BitSet to class java.lang.Boolean as reading converter although it doesn't convert from a store-supported type! You might want to check your annotation setup at the converter implementation.","service":"Unknown","version":"Unknown","requestID":"Unknown","host":"test","data":{}}
{"timestamp":"2021-12-17 13:32:22.637","level":"WARN","message":"Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'activePairsService' defined in file [/Users/git/push/admin-console/target/classes/admin/console/service/ActivePairsService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'io.nexo.repository.ActivePairsRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}","service":"Unknown","version":"Unknown","requestID":"Unknown","host":"test","data":{}}
{"timestamp":"2021-12-17 13:32:22.688","level":"ERROR","message":"\n\n***************************\nAPPLICATION FAILED TO START\n***************************\n\nDescription:\n\nParameter 0 of constructor in io.console.service.ActivePairsService required a bean of type 'io.nexo.repository.ActivePairsRepository' that could not be found.\n\n\nAction:\n\nConsider defining a bean of type 'io.console.repository.ActivePairsRepository' in your configuration.\n","service":"Unknown","version":"Unknown","requestID":"Unknown","host":"test","data":{}}

Do you know how I can fix this issue?
I tried to add @EnableJpaRepositories but it's not working.


text:
Q: How can I convert an ionic http GET request from @angular\Http to @ion-native\Http? I'm looking to convert this request, which is using angular/http, so that I can get results on a physical device:
import { Http } from '@angular/http'; //old way
import { HTTP } from '@ionic-native/http'; //new way

The angular/http request
function getWeather() {
     return this.http.get(this.url + '/' + latitude + ',' + longitude)
         .map(res => res.json());
   }

The method that is making the call, using 'subscribe'
this.weatherProvider.getWeather(latitude, longitude).subscribe(results => {
   console.log(results);
});

I am wanting to convert this to native/http, available as a plugin in Ionic
It might look something like this:
function getWeather() {
     return this.httpNative.get(this.url + '/' + latitude + ',' + longitude, {}, {})
        .then(data => {
            console.log(data.data);

        })
        .catch(error => {
            console.log(error.error);
        });
    }

However, I am having some issues receiving the data in this method, as I can no longer subscribe to the result and it is not being mapped... I receive null results
this.weatherProvider.getWeather(latitude, longitude).subscribe(results => {
   console.log(results);
});

A: As per documentation, get returns a promise... but for "subscribe" (in order to use this.weatherProvider.getWeather(latitude, longitude).subscribe())... you need to return an observable from Promise
This should be able to get you what you're looking for...


text:
Q: Excel VBA code to fetch value/maltiple value from web site I am trying to fetch data from http://www.dsebd.org/displayCompany.php?name=LINDEBD by using VBA code in excell.
trying to get the follwing data from this links
Total No. of Outstanding Securities
Sector
Company Name
am trying with,
    Sub GetData()
Set IE = CreateObject("InternetExplorer.Application")
my_url = "http://www.dsebd.org/displayCompany.php?name=LINDEBD"

With IE
    .Visible = True
    .navigate my_url
    .Top = 50
    .Left = 530
    .Height = 400
    .Width = 400

Do Until Not IE.Busy And IE.readyState = 4
    DoEvents
Loop

End With

Application.Wait (Now() + TimeValue("00:00:016")) ' For internal page refresh or loading

Set Results = IE.document.getElementsByTagName("table")
For Each itm In Results
    If itm.classname = "lgn" Then
        dd = itm.getAttribute("href")
        Exit For
    End If
    Next
' if you wnat to click the link
    itm.Click
' otherwise
    'Range("a1").Value = dd
    MsgBox dd
End Sub

Is it possible to collect data from this site

A: First, you have to iterate the table(table), then you iterate the rows(tr), then within that you iterate the cells(td).  These are not links on this page.
Note: The following will get you the value you seek, but this code will be subject to constant change if the website changes.
Sub GetData()
    Set IE = CreateObject("InternetExplorer.Application")
    my_url = "http://www.dsebd.org/displayCompany.php?name=LINDEBD"

    With IE
        .Visible = True
        .navigate my_url
        .Top = 50
        .Left = 530
        .Height = 400
        .Width = 400

    Do Until Not IE.Busy And IE.readyState = 4
        DoEvents
    Loop

    End With

    Application.Wait (Now() + TimeValue("00:00:016")) ' For internal page refresh or loading

    Set Results = IE.document.getElementsByTagName("table")
    For Each itm In Results
        Set rowAlt = IE.document.getElementsByClassName("alt")
        For Each itmTR In rowAlt
            Set tdValues = itmTR.getElementsByTagName("td")
            If tdValues.Item(0).innerText = "Total No. of Outstanding Securities" Then
                MsgBox tdValues.Item(1).innerText 'the value you seek
                Exit Sub 'don't continue this loop
            End If
        Next
    Next
End Sub


text:
Q: Does a collection which is retrieved from map.values() method preserve insertion order? I have an instance of LinkedHashMap. LinkedHashMap preserves the insertion order. I need to get the values of this map and I need them to be in the same order. So if I call values() method on this LinkedHashMap,
the Collection that I retrieve from values() method will guarantee the insertion order?

A: Yes, in the source code of LinkedHashMap resides an inner class LinkedValues which remains the order. An object of this class is returned by values().