text:
Q: uib-pagination NOT working Angularjs EDIT!
added more code snippets and plunker updated (AGAIN)
Still pretty new to Angular and coding in general.
I've tried and tried to instantiate the UI Pagination from the Angular Directives website. I've scoured Stack Overflow and codeProject and various other sites. I can not for the life of me get my pagination to work.
I don't know what else to try. I'm pretty sure I've called enough properties
<uib-pagination
    items-per-page="itemsPerPage"
    ng-model="currentPage"
    max-size="maxSize"
    class="pagination-sm"
    next-text="»"
    previous-text="«"
    boundary-links="false" >
</uib-pagination>

and running the controller:
app.controller('PaginationControl',function ($scope,  $window) {
    // Pagination variables
    $scope.totalItems = 100; //this needs to be changed to represent the total of filtered parks after a search is done and NOT a static number.
    $scope.currentPage = 1;
    $scope.maxSize = 8;
    $scope.itemsPerPage = 10;

});
What I don't understand is how to change the pagination properties from static numbers hard coded in the controller to dynamic numbers based off the results of my search.
Here's a Plunker which has everything but the pagination working.
Much obliged

A: There were a couple of problems with your plunk.  You referenced the bootstrap.js files instead of the bootstrap.css file.  You referenced the angular core library for version 1.4.5 and the angular animate library for version 1.4.7.  You reference jQueryUI but not jQuery.  You did not set the total-items attribute on the pagination directive.  Here is an updated plunk with the pagination displaying.  Updated reference block:
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<script src="https://code.angularjs.org/1.4.7/angular-animate.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-filter/0.5.8/angular-filter.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap-tpls.min.js"></script>
<script src="script.js"></script>


text:
Q: Uncaught ReferenceError: Cannot access 'allNewDice' before initialization.... reactjs useState Hi friends:::: Need Help:::
im trying to write code but i got a message ::::::
Uncaught ReferenceError: Cannot access 'allNewDice' before initialization.... anyone can help me to solve this....please
import "./Main.css";
import Dices from "../Dices/Dices";
import React from "react";
const Main = () => {
  const [dice, setDice] = React.useState(allNewDice());

  const allNewDice = () => {
    const newDice = [];
    for (let index = 0; index < 10; index++) {
      const randomNumber = Math.ceil(Math.random() * 6);
      newDice.push(randomNumber);
    }
    return newDice;
  };

  const rollDice = () => {
     setDice(allNewDice());
  }
  const diceElement = dice.map((die) => {
    <Dices value={die} />;
  });

  return (

{diceElement}

      <button onClick={rollDice}>Roll</button>

  );
};

export default Main;

.....................

import "./Dices.css";

const Dices = (props) => {
  return
 {props.value}
;
};

export default Dices;

A: The error tells you: Cannot access 'allNewDice' before initialization.
You need to initialize and declare the allNewDice function before calling it.

// * Initializing allNewDice
const allNewDice = () => {
  const newDice = [];
  for (let index = 0; index < 10; index++) {
    const randomNumber = Math.ceil(Math.random() * 6);
    newDice.push(randomNumber);
  }
  return newDice;
};

// * Calling allNewDice()
const [dice, setDice] = React.useState(allNewDice());

A: The allNewDice function is defined after it is called in the initial value for the dice state.
To fix this error, you can call the function inside the expression that is passed as the initial value for the state:
const [dice, setDice] = React.useState((() => allNewDice())());

Hope this helps.

redpajama_set_name: RedPajamaStackExchange


text:
Q: section in infopath form I ve created a SharePoint List with my columns, and i clicked on customize form to create an infopath form from my list. one of the columns on my sharePoint list is of type choice, which is a dropdowlist on infopath form. This dropdown has option1 and option2. the requirement is that when you select option1, textBox1, textBox2 and textBox3 should be visible on the infopath form, but if option2 is selected then textBox1, textBox2 and textBox3 should be hidden.
all these feilds are contained on one table in the form, so for me to be able to hide and show these fields based on the options selected i've broken this table into two tables. with table1 having the options dropdown, and the table2 containing textBox1, textBox2 and textBox3.
Ive added a section which contains table2 so that it can be easier for me to hide and show the fields in table2 by just hiding the section based n the option selected. Now my problem is that i am not able to rename or use section on my conditional formating. if I go to section properties the section name is disabled.
Please advise if there is another better way to accomplish this.

A: The Infopath forms of type/compatibility  Sharepoint List Form have unmodifiable and locked schema. In other words, take it or leave (i.e. use or abandon) it as it is.
Also I do not see how you could have possibly used the name of a section in infopath list form.
On the other hand, what you described is nothing more than enabling a user to hide or unhide a section which is already provided by in-built functionality in section properties:

*

*Allow users to insert the section

*Show insert button and hint text:

And running it:


text:
Q: Creating a shapefile for footprint of raster's valid data areas with GDAL I would like to show the borders of the areas of a given ASCII DTM file for which there is data. This problem has been discussed here previously but the recommended solution, the Image Boundary plugin for QGIS, is now considered deprecated. Furthermore, I need to be able to script it, so using the GDAL tools from the command line is probably a better plan for me.
I also have an additional restriction: I need to be able to serve this file on GeoServer, and ultimately display it using Leaflet, so a shapefile or GeoJSON could be good choices for the file format of the final output.
What command should I use?

A: I have a GRASS/R workflow below that involves GDAL. Its a lot more involved and messy than I recall, but it works so whatever. Blog post here with extra commentary, plain instructions for a Windows environment with OSGeo4W64, R 3.3.1 and GRASS 7.0.5 below.
1: Get all your target rasters into one folder. Make sure that:

*

*files are named in a logical sequence that does not start with a number.

*files are all in the same projection

*files should be spatially aligned; i.e. the pixels should be all on the same overarching grid system.

2: Go to System > Advanced System Settings > Environment Variables and set the following (adjust as necessary if you installed elsewhere or have an older copy of GRASS):

*

*GDAL_DATA: C:\OSGeo4W64\share\gdal

*GISBASE: C:\OSGeo4W64\apps\grass\grass-7.0.5

*GISRC: C:\Users\YOUR LOGON HERE\AppData\Roaming\GRASS7\rc

*GRASS_PYTHON: C:\OSGeo4W64\bin\pythonw.exe

*PROJ_LIB: C:\OSGeo4W64\share\proj

*PYTHONPATH: C:\OSGeo4W64\apps\grass\grass-7.0.5\etc\python

*PATH: add the following paths, in the same order as below

*

*C:\OSGeo4W64\bin

*C:\OSGeo4W64\apps\grass\grass-7.0.5\bin

*C:\OSGeo4W64\apps\grass\grass-7.0.5\lib

*C:\OSGeo4W64\apps\qgis

*C:\OSGeo4W64\apps\Python27

*Remove GRASS_ADDON_BASE.
3: Set up GRASS location
Open GRASS and establish a new location with the same CRS as your target rasters. Don't worry about region settings for now, and there's no need to create any extra mapsets beyond 'PERMANENT'. Open the PERMANENT mapset in your new location, and then just exit GRASS. This will update the file that GISRC points to.
R code:
Load libraries and list your target files
library(sp)
library(raster)
library(rgdal)
library(XML)
library(rgrass7)

setwd('C:/footprint_test')
rasters <- list.files(getwd(), pattern = '\\.tif$', full.names = T)

Import data
grassnames_list <- list()
for (item in rasters) {
  grass_name <- substr(basename(item), 1, nchar(basename(item)) - 4)
  execGRASS('r.in.gdal',
            flags = 'overwrite',
            parameters = list(input  = item,
                              output = grass_name))
  grassnames_list[[item]] <- grass_name
}

extend region to cover imported data
execGRASS('g.region', parameters= list(raster=paste(grassnames_list, collapse=",")))

write an instruction file for r.mapcalc
exp_list <- list()
fpname_list <- list()
for (item in rasters) {
  grassname <- substr(basename(item), 1, nchar(basename(item)) -4)
  fp_name   <- paste0(grassname, '_foot')
  exp       <- paste0(fp_name, ' = if(isnull(', grassname, '), null() , 1)')

  exp_list[[item]]    <- exp
  fpname_list[[item]] <- fp_name
}

write(c(paste(exp_list, collapse = '\n'), 'end'),
      file = paste0(getwd(), '/rmc_instructions.txt'),
      ncolumns = 1)

use the instruction file to make data presence/absence footprint rasters
rmc   <- 'C:/OSGeo4W64/apps/grass/grass-7.0.5/bin/r.mapcalc.exe'
calcs <- 'C:/footprint_test/rmc_instructions.txt'
system2(rmc, paste0('file=', calcs, ' --overwrite'))

vectorise the footprints
vname_list <- list()
for (fp in fpname_list) {
  v_name <- paste0(fp, '_v')
  execGRASS('r.to.vect',
            flags = 'overwrite',
            parameters = list(input  = fp,
                              output = v_name,
                              type   = 'area'))
 vname_list[[fp]] <- v_name
}

write the footprints to file (JSON is also supported)
outname_list <- list()
for (vn in vname_list) {
  out_name <- paste0(getwd(), '/', vn, '.shp')
  execGRASS('v.out.ogr',
            flags = 'overwrite',
            parameters = list(input  = vn,
                              output = out_name,
                              format = 'ESRI_Shapefile'))
  outname_list[[vn]] <- out_name
}

If you want multipart polygons
dissname_list <- list()
for (vn in vname_list) {
  diss_name <- paste0(vn, '_sp')
  execGRASS('v.dissolve',
            flags = 'overwrite',
            parameters = list(input  = vn,
                              column = 'value',
                              output = diss_name))
  dissname_list[[vn]] <- diss_name
}

outname_list2 <- list()
for (dn in dissname_list) {
  out_name2 <- paste0(getwd(), '/', dn, '.shp')
  execGRASS('v.out.ogr',
            flags = c('m', 'overwrite'),
            parameters = list(input  = dn,
                              output = out_name2,
                              format = 'ESRI_Shapefile'))
  outname_list2[[dn]] <- out_name2
}

Let me know how you go with that.


text:
Q: Html Agility Pack: DescendantsOrSelf() not returning HTML element I have some HTML, eg:
<%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="ContentManagedTargetPage.aspx.cs" Inherits="xxx.ContentManagedTargetPage" %>
<%@ Register TagPrefix="CxCMS" Namespace="xxx.ContentManagement.ASPNET.UI" Assembly="xxx.ContentManagement.ASPNET" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

        Content Managed

        Put content here.
        [<CxCMS:ContentManagedPlaceHolder Key="keyThingy" runat="server" />]

</asp:Content>

And I want to find all the instances of the CxCMS:ContentManagedPlaceHolder element.
I'm using HTML Agility Pack, which seems the best fit.
However, despite looking at the [meagre] documentation, I can't get my code to work.
I would expect the following to work:
string searchForElement = "CxCMS:ContentManagedPlaceHolder";
IEnumerable<HtmlNode> contentPlaceHolderHtmlNodes = HtmlDocument.DocumentNode.Descendants(searchForElement);
int count = contentPlaceHolderHtmlNodes.Count();

But I get nothing back.
If I change to DescendantsOrSelf, I get the document node back, "#document" - which is incorrect:
string searchForElement = "CxCMS:ContentManagedPlaceHolder";
IEnumerable<HtmlNode> contentPlaceHolderHtmlNodes = HtmlDocument.DocumentNode.DescendantsOrSelf(searchForElement);
int count = contentPlaceHolderHtmlNodes.Count();

I also tried using LINQ:
string searchForElement = "CxCMS:ContentManagedPlaceHolder";
IEnumerable<HtmlNode> contentPlaceHolderHtmlNodes = HtmlDocument.DocumentNode.DescendantsOrSelf().Where(q=>q.Name==searchForElement);
int count = contentPlaceHolderHtmlNodes.Count();

As neither of these methods work, I moved onto using SelectNodes, instead:
string searchForElement = "CxCMS:ContentManagedPlaceHolder";
string xPath="//"+searchForElement // "//CxCMS:ContentManagedPlaceHolder"
var nodes= HtmlDocument.DocumentNode.SelectNodes(xPath);

This just throws the exception: "Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.". I can't find any way of adding namespace management to the HtmlDocument object.
What am I missing, here? The DescendantsOrSelf() method works if using a "standard" HTML tag, such as "p", but not the one I have. Surely it should work? (It needs to!)

A: As usual I spend an hour or so playing, I ask the question, and I figure it out seconds after.
When searching using DescendantsOrSelf(), the node name must be in lower case.

A: Your example is actually ASPX. If you're parsing the ouput of that page, it's doubtful that <CxCMS:ContentManagedPlaceHolder Key="keyThingy" runat="server" /> actually renders as that on the client side. Look at the html source on the client, find the output tags that correspond to the <CxCMS:ContentManagedPlaceHolder Key="keyThingy" runat="server" />, and then use those in HtmlDocument.DocumentNode.Descendants.
On the other hand, if you're parsing the ASPX source, you may need to tweak your input to HtmlDocument.DocumentNode.Descendants so that the HtmlAgilityPack recognizes it, however keep in mind that ASPX != html and I don't think the HtmlAgilityPack is built to parse it.
Edit: Looking through HtmlNode.cs in the HtmlAgilityPack source code, it looks like you're right about it needing to be lowercase due to the following two sections:
    ///
    /// Gets or sets this node's name.
    ///
    public string Name
    {
        get
        {
            if (_name == null)
            {
                Name = _ownerdocument._text
                                     .Substring(_namestartindex, _namelength);
            }
            return _name != null ? _name.ToLower() : string.Empty;
        }
        set { _name = value; }
    }

and
    ///
    /// Get all descendant nodes with matching name
    ///
    /// <param name="name"></param>
    /// <returns></returns>
    public IEnumerable<HtmlNode> Descendants(string name)
    {
        foreach (HtmlNode node in Descendants())
            if (node.Name == name)
                yield return node;
    }

Note the _name.ToLower() in the getter for Name, and the case-sensitive if (node.Name == name) in the Decendants method. This is the same check used the the DescendantsAndSelf, Element and Elements methods.


text:
Q: What does '[Objectives 2012-13 Dave April13.xlsx]BU_Item1 i'!N5 mean in Excel Just got an excel spreadsheet with this in an if statement. N5 is a true or false value. I know this is probably stupid, but it's really hard to google and nothing else is coming up on here. Full if:
=IF(D28>0,'[Objectives 2012-13 Dave April13.xlsx]BU_Item1 i'!N5,0)
I know it is something to do with updating the values. But where are these values coming from (Because I can not see them in [Objectives 2012-13 Dave April13.xlsx] anywhere.

A: Excel is referencing to a workbook called Objectives 2012-13 Dave April13.xlsx, in the sheet  named BU_Item1 i and the cell N5.
If there's a warning about data connections and you enable them when you open the workbook, and this formula gives #N/A, it means that Excel cannot find that workbook either.
If you obtained the workbook from someone else, that person might know what is this file. Otherwise, not enabling the connection will allow you to see the value of that formula before excel actually traces the workbook being referenced.


text:
Q: Given two even numbers, find the sum of the squares of all even numbers between them My task is to create a program that will prompt the user for two even ints, finput and sinput. After that, it should output the sum of the squares of all even numbers from finput to sinput, inclusive.
Here is my code which attempts to accomplish this:
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int finput, sinput;
    int evens, d;

    cout << "Please enter an EVEN number for your first input.(Make sure your first input is less than your second): " << endl;
    cin >> finput;
    cout << "Please enter an EVEN number for your second input.(Make sure your first input is less than your second): " << endl;
    cin >> sinput;
    cout << "Results: " << endl << "---------------------------------------------------" << endl;

    if (finput % 2 == 0 && sinput % 2 == 0) {
        if (finput < sinput) {
            while (finput < sinput) {
                evens = pow(2, finput);
                finput += 2;
            }
        }
    }
    else {
        cout << "These numbers are not even. try again.";
        cout << endl << "Please enter two EVEN numbers. Your first input should be less than your second input (ex. 3  9; 50  100): " << endl;
        while (finput % 2 != 0 && sinput % 2 != 0) {
            cin >> finput >> sinput;
        }
    }
}

I believe that I have to somehow store each increment of the loop so I can add it to the running total, but I have no idea how to do this. Can somebody tell me how to complete the task?

A: You can use a for-loop to loop through all numbers from finput to sinput. Make sure to increment by 2 each time to get all the even numbers from finput to sinput.
int sum = 0;
for(int i = finput; i <= sinput; i += 2){
    sum += i*i;
}

There is also a O(1) way to get the sum of all even squares between finput and sinput. You can achieve this using the formula 1^2 + 2^2 + ... + n^2 = (n)(n+1)(2n+1)/6:
int sum = 4*(sinput/2)*(sinput/2+1)*(sinput+1)/6
        - 4*(finput/2)*(finput/2+1)*(finput+1)/6 + finput*finput;

A: There are a couple of issues here:
evens = pow(2, finput);

First, you are not adding the square to the final result. Second, you are computing 2^finput instead of finput^2. So that should be:
evens += pow(finput, 2);

or
evens += finput * finput;

Also, you need to initialize the accumulator to 0:
int evens = 0;


text:
Q: Seemingly Simple Probability Problem There are $n > 1$ distinct playing cards face-down in front of me. I know what the identities of all the face-down cards are, but I do not know what order they are in. I assign a "guess" as to the identity of each card, making a different guess for each card. Given a number $k <= n$, what is the probability of $X=k$, where the random variable $X$ is the number of cards that I guess correctly?
I thought about this for a while, and every attempt I have made to solve this problem has led to a dead end. Any ideas?
A few observations I have made (which are somewhat obvious): $X$ cannot take on the value $n - 1$, and there is exactly one way to assign the cards such that $X = n$. Despite having this insight, I cannot think of a mathematical statement to succinctly describe this probability.


text:
Q: When an app crashes in ios, does it create a core dump anywhere? Are core dumps available for ios apps? I've got some nasty bugs and checking out the runtime state would be pretty helpful.

A: No, I've never heard of core dump's being done on iOS.  Crash logs with stack trace are saved.


text:
Q: Move all specified files in all subfolders to a specified destination I made this command to move specified files in all subfolders to a specified destination and then delete all empty subfolders.
Copying all PDF-files in subfolders into current dir
for /f "tokens=*" %d in ('dir *.pdf /b/s') do move /y "%d" .\

and then deleting all empty folders
for /f "tokens=*" %d in ('dir /ad/b/s ^| sort /R') do rd "%d"

The commands looks work well when I copy it and paste it into a command line, but not when I run it inside a batch file. What am I forgetting? And can I trust this command in all conditions?

A: When for is used inside a batch script, you need to double the %.

C:\>for /?
(...)

To use the FOR command in a batch program, specify %%variable instead
of %variable.  Variable names are case sensitive, so %i is different
from %I.

(...)

A: The working directory when you run this script from the command line is %HOMEPATH% (or the directory you browsed to), running it from a script file uses the directory where the script is located as a home path. so the output won't be the same.


text:
Q: Why does rsync read .bashrc and not .profile? rsync is a non-interactive program that logs into other machines. It shouldn't need the init file for an interactive shell session, and it should absolutely need the init file for a login shell. Or so I would think.
Yet .bashrc gets read and .profile does not (unless I make .bashrc itself read .profile). Why?

A: rsync itself does not read your ~/.bashrc. But it calls ssh targethost rsync ..., which will connect to an sshd, which in turn will start your shell (bash).
Why that bash now reads your ~/.bashrc is explained in Why does my .bashrc get read when I run noninteractive commands over ssh


text:
Q: Shortest Path Between Origin to Any Point On the Graph I haven't been able to figure this problem out in a long time. Let's say that we have a 2D plane with a predefined root which is always at the origin of (0,0). This 2D plane will not have a restriction on how large it can be.
Let's also say that a user can input however many finite number of points on this graph (and each point can lie ANYWHERE on this plane). These points are defined as S0, S1,... Sn and the user also gives the respective X,Y coordinate location of these points.
I want to find the shortest path length from the root point to every point on the graph.
What do I mean by this?: Well, let's say that the shortest path has been determined to be 6. What this means is that the path length from the root point to a point S0 is 6, the path length from root to S1 is 6, the path length from root to Sn is 6.
WHAT I HAVE DONE TO TRY TO SOLVE THIS PROBLEM:
See my diagram:
DISCLAIMER: The purpose of my diagram is to show you my thought process. It is NOT representative of how I want to approach this problem.

In this example that I have created, assume that all points are evenly spaced apart. What I tried to do was keep finding the midpoints between points. For example, midpoint between S0 and S1 is A. Midpoint between S2 and S3 is B. And midpoint between A and B is C. Root heads on over to C, and can travel an equal distance to any point on the graph. The shortest path length from root to ANY point on the graph is 4, in this example. In other words, I want the shortest way to get from root to S0 that is equivalent to the shortest way to get from root to S1 that is equivalent to the shortest way to get from root to S2 that is equivalent to the shortest way to get from root to S3
The problem is that this method will not work ALL the time, especially when you have odd number of nonroot points that are randomly scattered across the plane. I am not able to find an algorithm. Does anyone have any pointers/tips for me?

A:
The shortest path length from root to ANY point on the graph is 4, in this example. In other words, I want the shortest way to get from root to S0 that is equivalent to the shortest way to get from root to S1 that is equivalent to the shortest way to get from root to S2 that is equivalent to the shortest way to get from root to S3.

and

They don't need to be 90 degrees.

So what you're really saying is:

I want to create lines that start at each user entered point and end at the root that are all equidistant.

Find the furthest point from the root and calculate the distance (X).  To all points that are the same distance to the root as X, the line is a straight line.  To all other points create an arbitrary curved line who's distance is X.
Example (lines are not perfectly to scaled distance, just an example).

A: I tend to agree with Erik Philips that the connection from the origin to the furthest point should be a straight line. If multiple points share the honor of furthest, then they all get straight lines. For any remaining points, it's just a matter of where to connect into the existing straight lines.
Apply this technique to your sample problem and the distance from the origin to each point is √10 ≈ 3.16

A: Here is the formula to determine distance between two points. Just calculate the distance from root for all user-given points (s0, s1...sN) and get the minimum value from result set.


text:
Q: Encrypted ID to 3rd party application I would like to ask you a questions that arose these days with GDPR new rules.
What I have is a payments service which use BrainTree to make the payments. In my side I store some information including the ID of the user. The problem is that I should not send the original User ID to Braintree directly and I need an ID alias instead.
What do you think that is the best way to do it?
To encrypt is somehow or generate a second ID in my database?

A: Just generate a second ID, ideally based on an existing approach like UUIDs. Encryption or hashing is not suitable if the original IDs have any structure, such as being small sequential integers.
Note that generating a second ID might be irrelevant to any GDPR compliance effort. This ID is still personal data as long as it can be connected to an individual, e.g. because it is paired with credit card numbers or email addresses. However, pseudonymisation through additional IDs might be part of a compliance strategy (compare Art. 25(1)). In any case, it is more important to sign a processing agreement in which the data processor agrees to not use the data you provide in any way except as specifically instructed (compare Art. 28(3)(a) and Art. 29).


text:
Q: jQuery: add class on current element I am trying to add class on my li element.I want to add class on click. when I click  on button its add css class on current li . Like when I click first time then it's active first time. after second click it's active on second li,
<!DOCTYPE html>

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

<button>Add a class name to the first p element</button>

A: Count the click event and apply with eq() .And li length is 8 .so apply condition after 7 reach ,count reset to 0

var c = 0;
$(document).ready(function() {
  $("button").click(function() {
    if (c > 7) {
      c = 0;
    }
    $("li").removeClass('intro')
    $("li").eq(c).addClass("intro");
    c++;

  });
});
.intro {
  font-size: 150%;
  color: red;
}

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

  <button>Add a class name to the first p element</button>

Updated answer with prev and next for slide

var c = 0;
$(document).ready(function() {
  $("button").click(function() {
    $(this).attr('data') == 'next' ? c++ : c--;
    if (c > 7) {
      c = 0;
    }
    $("li").removeClass('intro')
    $("li").eq(c).addClass("intro");

  });
});
.intro {
  font-size: 150%;
  color: red;
}

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading

  <button data="next">next</button>
  <button data="prev">prev</button>

A: Maybe you could do it like this:
$(document).ready(function(){

    $("button").click(function(){
       //Find the li with the active class and add your other class
       $("li.active").addClass("your-class");
    });
})

Here is a demo snippet

$(document).ready(function(){

  $("button").click(function(){
    $("li.active").addClass('foo-class')

  })
})
.foo-class{
  color:red;
}

Active

 Non active

<button>Click me</button>

A: Find the li with the active class and add your other class
$(document).ready(function(){
    $("button").click(function(){
       // Find li and add other class
       var l=$("body").find("li:first-child");
       $(l).addClass("your-class");
    });
})


text:
Q: Render NSImageNameComputer in Electron According to this Apple documentation, you can use NSImageNameComputer in Swift to get an icon showing the current Mac. Is there any way to use this icon in my Electron app front end?

A: The solution is to import nativeImage from Electron, then you can do:
nativeImage.createFromNamedImage("NSComputer")

Then you can use other nativeImage methods to get the picture into a format you can use.
The issue with this, however, is that it's really low-res (32x32) which I haven't been able to fix.


text:
Q: XNA 4.0 thick triangle strip to fix aliasing issues upon rotation My triangle strip based lines are disappearing intermittently when I rotate my camera around the X axis.
I was advised that this is due to aliasing issues and that "At a certain angle when its edge is facing the camera your strip will disappear." So, I was told to give the strip some thickness.
Can someone tell me the best way to do this? Would it be to draw two strips directly on top of each other? This doesn't seem to solve the problem but perhaps I am doing it wrong.
Thanks for any help you can provide!

A: The triangle strip you are using is infinitely thin (like a piece of paper) so when you look at it side-on it will be invisible.  It is a 2D object in a 3D world.
Drawing only two strips will not solve the issue as you will just end up with 2 2D objects.
You need to make it a volume rather than an area - like creating a cube rather than a square.  So you would need six triangle strips.
You should be able to stitch the six triangle strips together to make one long triangle strip which will make it more efficient to render.


text:
Q: RentFaster Scalable Map View connected to a database I want to implement a custom map scaling connected to a database. Similar to the map view on the Rentfaster website. Also, the RentFaster website uses Google Maps, however, I will be implementing this on Bing Maps
Where would be the best place to start off? And what would is the technical name of such a custom feature?

A: From the screenshots, it looks like the feature you're looking for is pushpin clustering, and can be seen in the interactive SDK here: https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk/clusteringmeanaverage
If you need hosting of your spatial data, check out the spatial data services module on the same page.


text:
Q: How to set up OAuth for managing Dialogflow user entities I have a Dialogflow fulfillment written in PHP. It was using v1 of the Dialogflow API and I'm migrating to v2.
I don't need users to authenticate when using the app, but I used User Entities in v1 and under v2 these require authentication using OAuth.
I'm working through the documentation here and having trouble with Step 1: Configure the client object.
Since I am halfway through executing PHP code in order to fulfill a request from the user, how should I set $client->setRedirectUri?  I need to get authorisation for the next line of code to then make a call via the Dialogflow projects.agent.sessions.entityTypes.patch API call so not sure where I would be 'redirecting' when the authorisation response comes back.

A: I had the same problem using Dialogflow library on NodeJs, here is what I did to solve the problem:

*

*Go to 'Settings' of the chatbot in Dialogflow.

*On General page, click on the link of Service Account (it redirects you to the Cloud Service Accounts).

*Add a new credential, with a name (you can type what you want). In permissions, search Dialogflow API Client and mark the option of JSON credential.

*

*Accept and a JSON file will be downloaded.

*Add the route of that file to your server in a .env variable with the name GOOGLE_APPLICATION_CREDENTIALS.

And thats all!

A: The authorization required here isn't authorization from the user to set a Session Entity - it is authorization of your server to make sure it is allowed to access the API at all. You will typically do this with a service account and keep the auth info tightly controlled. This is similar to the "API keys" that were used with V1, but is using a more standard auth method.


text:
Q: MSSQL and KAFKA integration I am new to kafka. I am trying to import data from MSSQL to Hive using kafka (real-time data) with incremental and updated data. I saw github's confluent platform for mysql to hdfs data transfer, but I didn't find for MSSQL. Anybody is working on this please suggest me how to integrate MSSQL and kafka?

A: I've heard Striim offers MSSQL change capture support.
Another option is to use the JDBC source connector (also on Confluent's github)


text:
Q: Can constant symbols (or functions) be introduced in standard translation of modal logic? When translating modal logic to first-order logic, I notice that the translated structure in first-order logic does not have constant symbols. I am thinking about whether it is possible that the translated structure in first-order logic has some constant symbols.
Because the constant symbols can be equivalently replaced with a unary predicate, if the translated structure has a constant $c$, that constant can be replaced with a unary predicate $P(x,c)=:(x=c)$. Then the corresponding modal logic has an extra proposition $c$ and valuation $V(w) = \{ c \}$.
I want to know if what I think for constant symbols is correct or not. And if there is a function in a translated structure, does there exist a corresponding modal logic?

A: I think that replacing constants with predicates is a bit more involved than you present. See, for example, here is first-order logic with constants equally expressive as first-order logic without constants?
Regarding the standard translation, your approach with equality is actually a part of standard translation of hybrid logic into a fragment of FOL with equality (without functions and constants).
There are some translations that have functions in their image. See, for example, first-order intensional modal logic http://cachescan.bcub.ro/e-book/V/580527_07.pdf


text:
Q: Excel c# add cells to range Is it possible to add cells to a range? Because the cells i need, aren't next to each other.
Example:
I need to add the cells with x in one range
x 0 x x
x 0 x x
x 0 x x
Is this possible? and if so, how?
Thanks

A: Try this
VBA:
Range("B26,B19,B13").Select

C#
Excel.Range excelCell = (Excel.Range)excelWorksheet.get_Range("B26,B19,B13", Type.Missing);

A: I couldn't find a way around it so I ended up having to create new series for those columns.
Excel.SeriesCollection series =  chartPage[1].SeriesCollection();
        Excel.Series TSeries1 = series.NewSeries();
        TSeries1.XValues = xlWorkSheet.Range[xlWorkSheet.Cells[2, 1], xlWorkSheet.Cells[chart1.Series[0].Points.Count + 1, 1]];
        TSeries1.Values = xlWorkSheet.Range[xlWorkSheet.Cells[2, 5], xlWorkSheet.Cells[chart1.Series[0].Points.Count + 1, 5]];
        TSeries1.Name = "Setpoint Value";
        Excel.Series TSeries2 = series.NewSeries();
        TSeries2.XValues = xlWorkSheet.Range[xlWorkSheet.Cells[2, 1], xlWorkSheet.Cells[chart1.Series[0].Points.Count + 1, 1]];
        TSeries2.Values = xlWorkSheet.Range[xlWorkSheet.Cells[2, 6], xlWorkSheet.Cells[chart1.Series[0].Points.Count + 1, 6]];
        TSeries2.Name = "Process Value";

A: VBA
Option Explicit

Sub ShowAreaUse()

    Dim oRange As Range
    Dim oArea As Range

    'create range with four cells
    Set oRange = Range("C9,E22,F15,I6")

    Debug.Print "Range with four area ranges"
    Debug.Print oRange.Address

    For Each oArea In oRange.Areas
        Debug.Print "    " + oArea.Address
    Next

    'add more cells
    Set oRange = Range(oRange.Address + ",A1:B10")

    Debug.Print "Range with added cells"
    Debug.Print oRange.Address

    For Each oArea In oRange.Areas
        Debug.Print "    " + oArea.Address
    Next

    Debug.Print "Dump Range Cells"

    For Each oArea In oRange
        Debug.Print "    " + oArea.Address
    Next

End Sub

A: ignore this, my suggestion didn't work properly


text:
Q: After usage is correct or not? After traveling for a number of days, their dry rations run out.
After traveling for a number of days, the fourth youths run out their dry rations.
Which sentence is correct? Please.

A: The first sentence is grammatically correct if the verb "ran" is used. It means that after travelling for a number of days, they ran out of their dry rations.

A: Both are wrong because you need to use ran instead of run. Also, you have to add "of" after "out" in the second sentence and change fourth to four.


text:
Q: How to iterate over several objects passed by reference? Let's say we have this function, where vec1 and vec2 store the same kind of data:
int myFunc(vector<int>& vec1, vector<int>& vec2) {
    for (auto const& elem : vec1) {
        // do something
    }
    for (auto const& elem : vec2) {
        // do the same thing
    }
}

Clearly, duplicating code is not great. However, the following is not a solution:
int myFunc(vector<int>& vec1, vector<int>& vec2) {
    for (auto const& vec : {vec1, vec2}) {
        for (auto const& elem : vec) {
            // do something
        }
    }
}

Doing so would result in a deep copy of vec1 and vec2, which is not what we want. I don't see a way to use pointers here as the vectors are passed in by reference (let's assume we can't change the function signature).
So how do we do the same thing to vec1 and vec2 without duplicating code?

A: One solution would be to write a small lambda that "does something", and then you don't have to repeat that code multiple times:
int myFunc(vector<int>& vec1, vector<int>& vec2)
{
   auto do_something = [&](auto const & elem) {
        // do something
   }

   for (auto const& elem : vec1) {
        do_something(elem);
   }

   for (auto const& elem : vec2) {
        do_something(elem);
   }
}

If you can use the range-v3 library, you can write it like this:
int myFunc(vector<int>& vec1, vector<int>& vec2)
{
   for (auto const& elem : ranges::views::concat(vec1, vec2)) {
        // dosomething
   }
}

A: It's fairly simple to use std::reference_wrapper to avoid making a deep copy, and pretty much do the same thing what you wanted to do originally:
#include <iostream>
#include <functional>
#include <vector>

int myFunc(std::vector<int>& vec1, std::vector<int>& vec2) {
    for (auto const& vec : {std::ref(vec1), std::ref(vec2)}) {
        auto const &real_vec=vec.get();

        for (auto const& elem : real_vec) {
        }
    }
    return 0;
}

int main()
{
    std::vector<int> vec1, vec2;

    myFunc(vec1, vec2);
    return 0;
}

No deep copies.

A: Here are a number of different solutions:

*

*Iterate over a std::initializer_list of pointers, or std::reference_wrappers.

*Write a lambda, containing either the body of the loop, or the whole loop. Call it twice manually.

*Write foreach_arg(lambda, args...).  Use it, passing a lambda that loops over the passed in vector.

*Write the one-vector version as an independent function.  Call it twice.

*Write a variadic version.  Put the loop in a lambda and comma-fold execute it.

*Wrap each vector in a std::span, then make a std::initializer_list of two spans, and go to town.

*Write a ref-array class, wrap the two vectors in it, and go to town.

*Use range-v3 to lazily concatenate the vectors and iterate over the concatenation.


text:
Q: Anomaly in Curl Computation Suppose computing the 3D curl of a vector field involves finding this determinant:
$$
\mathrm{det} \begin{bmatrix}
\mathbf{\hat{i}} & \frac{\partial}{\partial x}   & 7y^3z^2 \\
\mathbf{\hat{j}} & \frac{\partial}{\partial y}  & xyz \\
\mathbf{\hat{k}} & \frac{\partial}{\partial z}  & -3x-z
\end{bmatrix}
$$
Using cofactor expansion, we should be able to break this into the subdeterminants obtained by excluding any row or column of our choice.  However, if we choose the right column, the determinant will incorrectly appear as $(7y^3z^2 - xyz + (-3x - z))\mathbf{0} = \mathbf{0}$, the zero vector.
This is because the unit vectors have nothing but constant entries, thus their partial derivatives will always equal $\mathbf{0}$.  Choosing the left column is the sane route, while choosing the middle column appears to work, but choosing the right column leads to a different result.  How is this consistent with the typical rules of determinants?

A: If you're going to use this method, you have to be careful to preserve the order of the terms at all times, because the "multiplication" is not commutative in this context! You must have a unit vector, followed by a partial derivative, followed by one of the polynomials in the right column. The partial derivative applies only to the polynomial, not to the unit vector. The unit vector just comes along for the ride. In particular, the following is incorrect:

This is because the unit vectors have nothing but constant entries, thus their partial derivatives will always equal the 0 vector.

Let's say we exclude the right column, as you did. Then, for the $7x^2y^2$ term, the correct computation is:
$$j \frac{\partial}{\partial z} 7x^2y^2 - k \frac{\partial}{\partial y} 7x^2y^2$$
which equals $-k (14x^2y)$.
Now repeat for the other two factors in the third column.


text:
Q: Writing to ADLS from Synapse Notebook with account key I am trying to write a file from an Azure Synapse Notebook to ADLS Gen2 while authenticating with the account key.
When I use python and the DataLakeServiceClient, I can authenticate via key and write a file without a problem. If I try to authenticate with the same key for Spark, I get java.nio.file.AccessDeniedException: Operation failed: "This request is not authorized to perform this operation using this permission.", 403, PUT,.
With PySpark and authorization with the account key [NOT WORKING]:
myaccountname = ""
account_key = ""
spark.conf.set(f"fs.azure.account.key.{myaccountname}.dfs.core.windows.net", account_key)

dest_container = "container_name"
dest_storage_name = "storage_name"
destination_storage = f"abfss://{dest_container }@{dest_storage_name }.dfs.core.windows.net"

df.write.mode("append").parquet(destination_storage + "/raw/myfile.parquet")

But I can write a file with Python and the DataLakeServiceClient and also authorization with the account key [WORKING]:
from azure.storage.filedatalake import DataLakeServiceClient

# DAP ADLS configurations
storage_name = ""
account_key = ""
container_name = ""

service_client = DataLakeServiceClient(account_url=f"https://{storage_name}.dfs.core.windows.net", credential=account_key)
file_system_client = service_client.get_file_system_client(container_name)

dir_client = file_system_client.get_directory_client(directory_name)
dir_client.create_directory()
file_client = dir_client.get_file_client(file_name)
file_client.create_file()
file_client.append_data(file_content, offset=0, length=len(file_content))
file_client.flush_data(len(file_content))

What am I doing wrong? I was under the impression using spark.conf.set for a URL-key is enough?

A: I finally solved it by using a LinkedService. In the LinkedService I used the AccountKey (retrieved from a KeyVault).
For some the direct reason the authentication with the account key in the code did not work in the Synapse Notebook, despite the User having all required permissions.
UPDATE: According to Microsoft's third level tech support, authentication with an account key from within Synapse is not possible (!!!) You HAVE to use their LinkedServices.
If anyone else needs to authenticate:
linkedServiceName_var = "my_linked_service_name"
spark.conf.set("fs.azure.account.auth.type", "SAS")
spark.conf.set("fs.azure.sas.token.provider.type", "com.microsoft.azure.synapse.tokenlibrary.LinkedServiceBasedSASProvider")
spark.conf.set("spark.storage.synapse.linkedServiceName", linkedServiceName_var)

raw_container_name = "my_container"
raw_storageaccount_name = "my_storage_account"
CONNECTION_STR = f"abfs://{raw_container_name}@{raw_storageaccount_name}.dfs.core.windows.net"

my_df = spark.read.parquet(CONNECTION_STR+ "/" + filepath)

A: --Update
Can you double check if you or the user running this has ADLSGen2 access and right permissions (contributer role on subscription or Storage Blob Data Owner at the storage account level or Blob Storage Contributor Role to the service principal in the scope of the Data Lake Storage Gen2 storage account. ) depending on your setup.
Make sure you have the valid account key copied from the Azure portal.
Just in case....

To enable other users to use the storage account after you create your
workspace, you will have to perform below tasks:

*

*Assign other users to the Contributor role on workspace

*Assign other users to a Workspace, SQL, or Spark admin role using Synapse Studio

*Assign yourself and other users to the  Storage Blob Data Contributor  role on the storage account

Also, if you are using MSI for synapse workspace, make sure the you as a user have same permission level in the notebook.

Going through the official MS docs on Azure Synapse connecting to Azure storage account

In case you have set up an account key and secret for the storage
account, you can set forwardSparkAzureStorageCredentials to true,
in which case Azure Synapse connector automatically discovers the
account access key set in the notebook session configuration or the
global Hadoop configuration and forwards the storage account access
key to the connected Azure Synapse instance by creating a temporary
Azure database scoped
credential.

Just add this option while df.write
.option("forwardSparkAzureStorageCredentials", "true")


text:
Q: How to save changes of a table with pagination? I have a modal that contains a data table.This table has pagination.I want to be able to modify rows from different pages and at the end press a "Save" button that would send the modified rows to the api and update the DB.
So if my table looks like this:
  Page 0      Page 1  ...... Page n
  row0        row0
  row1      **row1**
**row2**      row2

If i have edited the row2 from Page0 and row1 from Page1 ...and etc ...what would be a good option to save the progress?Should i traverse at the end all rows and check if they are modified or add the rows in a list the moment they are changed and send them when pressing Save?
This is my html so far:

            <ng2-smart-table class="activitiesTable" [settings]="settings" [source]="data" #activitiesTable></ng2-smart-table>

            <button type="button" class="btn btn-default" (click)="Save($event)">Save</button>

The source is the data of the table.

A: According to my experience, I would suggest to let the users change whatever he wants, then at the end take all rows as json, angular will allow you to do so, then in your api convert it to your model and bulk import results in the database, then re bind the grid.


text:
Q: VB for MS Access not working when using INNER JOIN The code isn't working properly, getting a Syntax error in INSERT INTO statement error.  Trying to insert data with an inner join from an MS Access form where the user types in responses and selects a button to add the detail to a new table.  Based on the information provided I want it to insert the data into another table where it is joined by a table to get the fiscal data.
    stSQL = "INSERT INTO PO_Information " & _
        "(Partner, PO_Number, PO_Title, Cost_Center, Description, Line_1_Amt, Line_2_Amt, Date_Added, Month_Added, Year_Added, FY, Qtr, FY_Qtr, FW, FWeek)" & _
        "Select New_PO_Information.Partner, " & _
        "New_PO_Information.PO_Number, " & _
        "New_PO_Information.PO_Title, " & _
        "New_PO_Information.Cost_Center, " & _
        "New_PO_Information.Description, " & _
        "New_PO_Information.Line_1_Amt, " & _
        "New_PO_Information.Line_2_Amt, " & _
        "New_PO_Information.Date_Added, " & _
        "New_PO_Information.Month_Added, " & _
        "New_PO_Information.Year_Added, " & _
        "Fiscal_Calendar.FY, " & _
        "Fiscal_Calendar.Qtr, " & _
        "Fiscal_Calendar.FY_Qtr, " & _
        "Fiscal_Calendar.FW, " & _
        "Fiscal_Calendar.FWeek, " & _
        "From New_PO_Information INNER JOIN Fiscal_Calendar " & _
        "ON New_PO_Information.Date_Added = Fiscal_Calendar.Calendar"

    stSQL = stSQL & _
        "From New_PO_Information " & _
        "Where ((New_PO_Information.Partner)<>'') " & _
        "AND ((New_PO_Information.PO_Number)<>'') " & _
        "AND ((New_PO_Information.PO_Title)<>'') " & _
        "AND ((New_PO_Information.Cost_Center)<>'') " & _
        "AND ((New_PO_Information.Description)<>'');"

Can someone tell me where I went wrong and correct the code, please?

A: It's probably this comma here: "Fiscal_Calendar.FWeek, " & _
There shouldn't be a comma before the FROM statement. And make sure you only have one FROM statement:
 stSQL = "INSERT INTO PO_Information " & _
    "(Partner, PO_Number, PO_Title, Cost_Center, Description, Line_1_Amt, Line_2_Amt, Date_Added, Month_Added, Year_Added, FY, Qtr, FY_Qtr, FW, FWeek)" & _
    "Select New_PO_Information.Partner, " & _
    "New_PO_Information.PO_Number, " & _
    "New_PO_Information.PO_Title, " & _
    "New_PO_Information.Cost_Center, " & _
    "New_PO_Information.Description, " & _
    "New_PO_Information.Line_1_Amt, " & _
    "New_PO_Information.Line_2_Amt, " & _
    "New_PO_Information.Date_Added, " & _
    "New_PO_Information.Month_Added, " & _
    "New_PO_Information.Year_Added, " & _
    "Fiscal_Calendar.FY, " & _
    "Fiscal_Calendar.Qtr, " & _
    "Fiscal_Calendar.FY_Qtr, " & _
    "Fiscal_Calendar.FW, " & _
    "Fiscal_Calendar.FWeek " & _
    "FROM New_PO_Information INNER JOIN Fiscal_Calendar " & _
    "ON New_PO_Information.Date_Added = Fiscal_Calendar.Calendar"

stSQL = stSQL & _
    " Where ((New_PO_Information.Partner)<>'') " & _
    "AND ((New_PO_Information.PO_Number)<>'') " & _
    "AND ((New_PO_Information.PO_Title)<>'') " & _
    "AND ((New_PO_Information.Cost_Center)<>'') " & _
    "AND ((New_PO_Information.Description)<>'');"

A: If I created an append query, here is the code.  Just trying to convert this into my SQL statement that I posted earlier.
INSERT INTO PO_Information ( Partner, PO_Number, PO_TItle, Cost_Center, Description, Line_1_Amt, Line_2_Amt, Date_Added, Month_Added, Year_Added, FY, Qtr, FY_Qtr, FW, FWeek )
SELECT New_PO_Information.Partner, New_PO_Information.PO_Number, New_PO_Information.PO_TItle, New_PO_Information.Cost_Center, New_PO_Information.Description, New_PO_Information.Line_1_Amt, New_PO_Information.Line_2_Amt, New_PO_Information.Date_Added, New_PO_Information.Month_Added, New_PO_Information.Year_Added, Fiscal_Calendar.FY, Fiscal_Calendar.Qtr, Fiscal_Calendar.FY_Qtr, Fiscal_Calendar.FW, Fiscal_Calendar.FWeek
FROM New_PO_Information INNER JOIN Fiscal_Calendar ON New_PO_Information.Date_Added = Fiscal_Calendar.Calendar;


text:
Q: ffmpeg / avconv Unrecognized option 'target=vcd' I get following error
Unrecognized option 'target=vcd'.
Error splitting the argument list: Option not found

running
ffmpeg -i input.ts -target=vcd output.mpg

or
avconv -i input.ts -target=vcd output.mpg

(or any other target like "pal-dvd", like stated in the man-file)
version info ffmpeg:

ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 7 (SUSE Linux)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --enable-version3 --disable-openssl --enable-avresample --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcelt --enable-libcdio --enable-libdav1d --enable-libdc1394 --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libzvbi --enable-libmfx --enable-vaapi --enable-vdpau --enable-version3 --enable-libfdk-aac-dlopen --enable-nonfree --enable-libvo-amrwbenc --enable-libx264 --enable-libx265 --enable-librtmp --enable-libxvid
libavutil      56. 70.100 / 56. 70.100
libavcodec     58.134.100 / 58.134.100
libavformat    58. 76.100 / 58. 76.100
libavdevice    58. 13.100 / 58. 13.100
libavfilter     7.110.100 /  7.110.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  9.100 /  5.  9.100
libswresample   3.  9.100 /  3.  9.100
libpostproc    55.  9.100 / 55.  9.100

version info avconv

avconv version 12.3, Copyright (c) 2000-2018 the Libav developers
built on Mar 26 2018 12:39 with gcc 7 (SUSE Linux)   configuration:
--prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --incdir=/usr/include/libav --enable-pic --disable-yasm   WARNING: library configuration mismatch   avutil      configuration:
--prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libzimg --enable-libzvbi --enable-vaapi --enable-vdpau --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libx264 --enable-libx265 --enable-libxvid   avcodec     configuration: --prefix=/usr --libdir=/usr/lib64
--shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libzimg --enable-libzvbi --enable-vaapi --enable-vdpau --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libx264 --enable-libx265 --enable-libxvid   avformat    configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libzimg --enable-libzvbi --enable-vaapi --enable-vdpau --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libx264 --enable-libx265 --enable-libxvid   avdevice    configuration: --prefix=/usr --libdir=/usr/lib64
--shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libzimg --enable-libzvbi --enable-vaapi --enable-vdpau --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libx264 --enable-libx265 --enable-libxvid   avfilter    configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libzimg --enable-libzvbi --enable-vaapi --enable-vdpau --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libx264 --enable-libx265 --enable-libxvid   avresample  configuration: --prefix=/usr --libdir=/usr/lib64
--shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libzimg --enable-libzvbi --enable-vaapi --enable-vdpau --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libx264 --enable-libx265 --enable-libxvid   swscale     configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libzimg --enable-libzvbi --enable-vaapi --enable-vdpau --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libx264 --enable-libx265 --enable-libxvid   libavutil     55. 78.100 / 55. 78.100   libavcodec    57.107.100 /
57.107.100   libavformat   57. 83.100 / 57. 83.100   libavdevice   57. 10.100 / 57. 10.100   libavfilter    6.107.100 /  6.107.100   libavresample  3.  7. 0 /  3.  7. 0   libswscale     4.  8.100 /  4.
8.100

despite solving the problem, I'd be happy with any other solution to compress video to pal-dvd or pal-vcd standard
I tried re-encoding a mpeg-2 video using avconv and/or ffmpeg to target pal-dvd or pal-vcd or even just vcd or dvd.
manpage states option -target as main option:

    -target type (output)

Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50"). type may be prefixed with "pal-", "ntsc-" or "film-" to use the corresponding standard. All the format options
(bitrate, codecs, buffer sizes) are then set automatically. You can just type:
avconv -i myfile.avi -target vcd /tmp/vcd.mpg
Nevertheless you can specify additional options as long as you know they do not conflict with the standard, as in:
avconv -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg


text:
Q: Batch file for bioinformatic analysis Background:
I'm part of a group project at the university where the task is to build a server based web application integrated with a database. We're using Apache, PHP and MySQL and it's going great. However, we're at the part where the user is to press a button Do Analysis and a batch file (.bat) is supposed to be activated, go through some programs and then give a result.
Here's the idea of the batch file, but it doesn't work:
@ECHO OFF
CD "C:\Path\To\Directory\With\All\Programs"
START "" program1.pl [specific in parameters for program1] [infile for program1] /B /WAIT
START "" program2.exe [specific in parameters for program2] [infile for program2] /B /WAIT
START "" program3 [specific in parameters for program3] [infile for program3] /B /WAIT
@EXIT

Problem:
Some programs are in reality packages of perl scripts or .exe files and require both in parameters and infiles.
On Linux a typical command in the terminal for Program1 would be ./mugsy seq_1.fsa seq_2.fsa seq_N.fsa, where mugsy is a big perl script and the files .fsa are the infiles for mugsy.
Program2 would be: ./FastTree -gtr -nt alignment_file > tree_file, where -gtr and -nt are necessary in parameters for the program FastTree, alignment_file is the infile used by FastTree, and tree_file is the name of the output file.
Program3 would be something like: figtree < infile.tre > outfile.jpg, where figtree is the program using the infile and outputs a jpg.
Question:
How can I write a batch file for the above situation? Is it possible?
START /? gives examples of different parameter settings for start, but not how to put parameters for the actual program starting.
When executing START "" FastTree.exe & infile.fasta /B /WAIT they are opening separately and I can't find any way of opening infile.fasta with FastTree.exe.

A: In your example, instead of ./mugsy seq_1.fsa seq_2.fsa seq_N.fsa, you could do perl mugsy seq_1.fsa seq_2.fsa seq_N.fsa. So if I try the following (incorporating the suggestions from @wolfrevokcats), it works for me on Win 7:
START "program1" /B /WAIT perl program1.pl arg1 arg2 arg3

As for general design, having a PHP script run a Windows batch file which in turn spawns off other processes using START doesn't seem like the best solution to me, e.g. I'm not sure if your system is supposed to later support multiple users? However, not being a PHP expert, and without knowing more about the system you're building, I can't tell you what the better way to spawn processes from PHP is, just that you might want to look into that ☺


text:
Q: TypeError: Cannot read property 'filter' of undefined I am working on angular 5 and onSubmit() of form I am getting below error:

ERROR TypeError: Cannot read property 'filter' of undefined

Below is onSubmit() of login.component.ts file:
onSubmit() {
        this.valid = true;
        const name = this.login.userName;
        sessionStorage.setItem('username', this.login.userName);
        const password = this.login.password;
        console.log(name);
        const user = this.users.filter(currUser => currUser.userName === name && currUser.password === password)[0]; // here I am getting an error!
        if (user) {
            this.isLoggedIn = 'true';
            sessionStorage.setItem('isLoggedIn', this.isLoggedIn);
            // this.router.navigate(['/products']);
        } else {
            this.isLoggedIn = 'false';
            sessionStorage.setItem('isLoggedIn', this.isLoggedIn);
            this.valid = false;
        }
    }

A: this.users

Is undefined, make sure you are assigning it elsewhere in the component


text:
Q: 'Are there' and 'How many' I'm confused about questions with 'Are there' and 'How many'.
First:
I have two questions and two answers during the interview from my textbook.

'Are there many offices?' - There's one head office and there are four other offices in the UK.
'How many offices are there?' - 'There are three in Britain and two in the United States.'

The questions are different but the answers are almoust the same! Why?
Second situation:

'How many offices are there?' - 'There are three in Britain and two in the United States.'
'How many sites are there in the UK?' - 'There's the head office, the other offices, the store branches and our warehouse.'

The answers are different but the questions are the same! Why?

A: Firstly, it is the case of interview so the answers provided are superfluous! Just to give more (or say better) information. The answers, if you see from a grammarian's view, could be much shorter and precise.

'Are there many offices?' - No, not many.   How many officers are there? - There are five officers.

But then, when you reply No, not many. the obvious question will be Okay, how many? and you'll have to reply five. And since the scene is of the interview, every information is important and thus, where are those five officers is also mentioned with their location, I think.
Same with scene two:

How many offices are there?' - There are five offices   How many sites are there in the UK? - There are [number] sites in the UK. I'd also upvote for the answer given there for this question. Since 'sites' also refer to 'type' of offices/premises, it's better to answer that way than giving the number.

Again, it's an interview and the obvious questions respectively will be where are those offices and where are those sites and to avoid multiple questions, I guess, all the information is included in one smart answer.
Now take the answers given and let's guess their questions

How many offices are there in the UK? - There's one head office and there are four other offices in the UK.   How many offices are there worldwide? - There are three in Britain and two in the United States.


text:
Q: React v18 crypto module not found Breaking Change: webpack < 5 I've looked at about a dozen supposed solutions that didn't work for this problem.
My react application was working fine a couple of hours ago, and now this error keeps appearing, even when I make another react app.
I've looked at going to the webpack.config.js that's located in node_modules > react-scripts > config, but really baffled by where to add this supposed line of code:
resolve: {
    fallback: { crypto: false },
},

I personally think React version 18 is broken.
Anyone know how I can resolve this? Thanks in advance.
Compiled with problems:

ERROR in ../node_modules/cookie-signature/index.js 4:13-30

Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Micha\OneDrive\Desktop\APPS\REACT\HOLISTIC\DEVELOPER\v2\api\node_modules\cookie-signature'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
    - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "crypto": false }

PS. I've done npm i crypto crypto-browserify cookie-signature
Tried modifying the webpack.config.js. No luck, hence I'm stuck.
I created a new webpack.config.js in the client folder.
The client folder was created using the terminal command npx create-react-app client.
In the file, I added.
module.exports = {
    resolve: {
        fallback: {
          "crypto": require.resolve("crypto-browserify")
        }
      }
  };

Also, did npm i crypto-browserify, and restarted my react app. Still have the same error.
package.json file
{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@reduxjs/toolkit": "^1.8.5",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "axios": "^0.27.2",
    "cookie-signature": "^1.2.0",
    "crypto": "^1.0.1",
    "crypto-browserify": "^3.12.0",
    "crypto-js": "^4.1.1",
    "firebase": "^9.9.4",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-persist": "^1.0.2",
    "react-redux": "^8.0.2",
    "react-router-dom": "^6.3.0",
    "react-scripts": "5.0.1",
    "redux-persist": "^6.0.0",
    "uuid": "^9.0.0",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}


text:
Q: Windows HTTP Proxy for programs that don't use system proxy settings? At work, I have to use an HTTP proxy to access the Internet. The proxy is set through a proxy autoconfiguration script. On top of that, I sometimes have to run a VPN to access part of our network. When I'm running the VPN, I have to go through a different HTTP proxy (and in fact use a different autoconfiguration script).
This all works fine for programs like IE which honor the windows system proxy setting. But I use some programs, maven for example, that have their own private proxy settings. It's a hassle to have to change the proxy settings for these programs depending on whether the VPN is up or not.
What I'd like to do is to run a proxy program on my PC, which relays requests based on the current system proxy settings. Programs like maven would be set to use this proxy. I've played around with Fiddler, and it can be configured to operate this way. But it's a little heavyweight for my needs.
Does anyone know of a more lightweight HTTP proxy for windows that can relay requests based on the system proxy settings?


text:
Q: Laravel 5.4 Sentinel session does not persist <?php
Route::group(['middleware' => ['web'],'namespace' => 'App\Modules\Ministries\Http\Controllers'], function () {

    Route::get('ny/ministries/index', array('uses' => 'MinistriesController@getIndex', 'as' => 'admin.ministries.index'));
    Route::get('ny/ministries/data', array('uses' => 'MinistriesController@getData', 'as' => 'admin.ministries.data'));
    Route::get('ny/ministries/show/{id}', array('uses' => 'MinistriesController@getView', 'as' => 'admin.ministries.view'));
    Route::post('ny/ministries/store/', array('uses' => 'MinistriesController@postNew', 'as' => 'admin.ministries.new'));
    Route::post('ny/ministries/bulk/', array('uses' => 'MinistriesController@postBulkUpload', 'as' => 'admin.ministries.post'));
});

Authentication works fine however when I try Sentinel::check(); the value returned for the currently logged in user is null

A: Add this to the protected middleware array Kernel.php in the Http Folder

\Illuminate\Session\Middleware\StartSession::class

and then comment out below since you are not using laravels default auth function

\Illuminate\Session\Middleware\AuthenticateSession::class


text:
Q: How to update Oracle JDK on Debian I am planning to install the oracle JDK7 on my Debian Wheezy machine.
To do so I am using java-package to install the jdk as a .deb package under Debian, as described here.
My question is: Can anybody describe the procedure to update the jdk when installed this way?
Is it simply to repeat the installation steps with a newer jdk binary? Do I need to remove the old one?

A: you should just be able to repeat the steps, yes, and the files installed by the old .deb will be replaced by the new .deb (assuming the .deb has been created properly).
as a relevant aside, however, you might consider using the repository described here.  i've been using it for a while now with great success.  it's much easier this way!


text:
Q: c# regex replace I am creating a tool that will allow me to shift numbers by values. it has the following:
1 textbox to hold all values
3 textboxes for the entries of the modified values (X,Y,Z)
1 button to initiate the process.
when I click on the button, it first finds the regex matches:
string regex = @"((E6POS [\w]*={)X\s([\d.-]*)\s*,*Y\s*([-.\d]*)\s*,Z\s*([-\d.]*))";
Regex r = new Regex(regex, RegexOptions.IgnoreCase);

then I get the matches:
Match m = r.Match(txt.Text);
// once this is finished I parse through the matches and take the values and parse them.

while (m.Success)
{
    this.Cursor = Cursors.WaitCursor;

    try
    {
        xf = Convert.ToDecimal(m.Groups[3].ToString()) + Convert.ToDecimal(shiftX.Text);
        yf = Convert.ToDecimal(m.Groups[4].ToString()) + Convert.ToDecimal(shiftY.Text);
        zf = Convert.ToDecimal(m.Groups[5].ToString()) + Convert.ToDecimal(shiftZ.Text);

        txt.ReplaceAll(m.Groups[0].ToString(), string.Format("{0} X {1},Y {2}, Z {3}", m.Groups[2].ToString(), xf.ToString(), yf.ToString(), zf.ToString()));
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.ToString());
    }
    finally
    {
        m = m.NextMatch();
    }
}
this.Cursor = Cursors.Default;

is there a faster way that i can do this? it is taking up to 30 seconds to perform this task.
Sample input text would be
DECL E6POS XJV_MOVE_3={X 3887.44,Y 0.00,Z 2594.00, A 0.00, B 90.00, C 180.00,S 22,T 18,E1 2654.30,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0 }
DECL E6POS XAX749_55_2654_3155075={X 4016.8440,Y -774.9973,Z 1437.1283, A 90.0000, B -45.0000, C -90.0000,S 22,T 26,E1 2654.3000,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0 }
DECL E6POS XAX755_55_2654_3155075={X 4016.8440,Y -810.9183,Z 1473.0493, A 90.0000, B -45.0000, C -90.0000,S 22,T 26,E1 2654.3000,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0 }
DECL FDAT FAX755_55_2654_3155075={TOOL_NO 1, BASE_NO 0, IPO_FRAME #BASE, POINT2[] "  "}
DECL LDAT LAX755_55_2654_3155075={ VEL 2.0,ACC 88.0, APO_DIST 100.0, APO_FAC 50.0, ORI_TYP #VAR}
;FOLD From Line 1411

A: I guess those three textboxes hold the values for shiftX, shiftY and shiftZ. In that case move the "Convert.ToDecimal" of those fixed values (fixed as in: does not change within the loop) ouside the loop. That will save some processing.
Also: try holding the new value in a temporary variable, instead of in that result textbox. That may save some time rendering a value that will be changed anyway.

A: I think your problem is elsewhere. How do you measure?
Since I don't know what your ReplaceAll is, I changed it to string.Replace. Then I ran your code. It took 1ms. Below is what I ran. You can compile and run this code yourself and measure how long it executes on your machine.
using System;
using System.Diagnostics;
using System.Text.RegularExpressions;

namespace SO6329015
{
    class Program
    {
        static void Main()
        {
            string input = @"DECL E6POS XJV_MOVE_3={X 3887.44,Y 0.00,Z 2594.00, A 0.00, B 90.00, C 180.00,S 22,T 18,E1 2654.30,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0 } DECL E6POS XAX749_55_2654_3155075={X 4016.8440,Y -774.9973,Z 1437.1283, A 90.0000, B -45.0000, C -90.0000,S 22,T 26,E1 2654.3000,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0 } DECL E6POS XAX755_55_2654_3155075={X 4016.8440,Y -810.9183,Z 1473.0493, A 90.0000, B -45.0000, C -90.0000,S 22,T 26,E1 2654.3000,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0 } DECL FDAT FAX755_55_2654_3155075={TOOL_NO 1, BASE_NO 0, IPO_FRAME #BASE, POINT2[] "" ""} DECL LDAT LAX755_55_2654_3155075={ VEL 2.0,ACC 88.0, APO_DIST 100.0, APO_FAC 50.0, ORI_TYP #VAR} ;FOLD From Line 1411";
            const string regex = @"((E6POS [\w]*={)X\s([\d.-]*)\s*,*Y\s*([-.\d]*)\s*,Z\s*([-\d.]*))";

            const string shiftX = "7777";
            const string shiftY = "8888";
            const string shiftZ = "9999";

            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();

            Regex r = new Regex(regex, RegexOptions.IgnoreCase);

            Match m = r.Match(input);

            while (m.Success)
            {
                try
                {
                    var xf = Convert.ToDecimal(m.Groups[3].ToString()) + Convert.ToDecimal(shiftX);
                    var yf = Convert.ToDecimal(m.Groups[4].ToString()) + Convert.ToDecimal(shiftY);
                    var zf = Convert.ToDecimal(m.Groups[5].ToString()) + Convert.ToDecimal(shiftZ);

                    input = input.Replace(m.Groups[0].ToString(), string.Format("{0} X {1},Y {2}, Z {3}", m.Groups[2], xf, yf, zf));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
                finally
                {
                    m = m.NextMatch();
                }
            }

            stopwatch.Stop();
            Console.WriteLine("{0}ms", stopwatch.ElapsedMilliseconds);
            Console.WriteLine(input);

        }
    }
}


text:
Q: Failed assertion: line 1252 pos 12: 'widget.items!.where((DropdownMenuItem item) => item.value == widget.value).length == 1': is not true I am getting this error in the console when I am trying to use flutter DropdownButton Widget.

package:flutter/src/material/dropdown.dart': Failed assertion: line 1252 pos 12: 'widget.items!.where((DropdownMenuItem item) => item.value == widget.value).length == 1': is not true.

There is  a long traceback...
Here I am adding small code sample that will reproduce this error... Anyone can simply copy paste in main.dart file

// flutter import
 import 'package:flutter/material.dart';

void main() {
  runApp(const BugReportApp());
}

class BugReportApp extends StatefulWidget {
  const BugReportApp({Key? key}) : super(key: key);

  @override
  State<BugReportApp> createState() => _BugReportAppState();
}

class _BugReportAppState extends State<BugReportApp> {
  final TextEditingController _dropdownController = TextEditingController();
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Bug Report',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Flex(direction: Axis.vertical, children:[
                        DropdownButton<String>(
            value: _dropdownController.text == ""
                ? null
                : _dropdownController.text,
            items: ["hello, world", "how are you", "goodbye"]
                .map((_value) => DropdownMenuItem<String>(
                        child: Text(
                      _value,
                    )))
                .toList(),
            onChanged: (_value) {
              setState(() {
                _dropdownController.text = _value ?? _dropdownController.text;
              });
            },
          ),
      ],),
    );
  }
}

I was expecting dropown to work normally but,  I don't know why it didn't.

A: You are missing value on DropdownMenuItem.
.map((_value) => DropdownMenuItem<String>(
        value: _value, // this
        child: Text(
          _value,
        )))

Also make sure to  use Scaffold on home.

A: Try this code, also added some explanation in the code:
class _MyHomePageState extends State<MyHomePage> {

  final TextEditingController _dropdownController = TextEditingController();

  String? dropDownValue = 'hello, world'; // add one value as the defaul one which must exists in the dropdown value

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: Column(
          children: [

            Flex(direction: Axis.vertical, children:[
              DropdownButton<String>(
                value: dropDownValue, // this place should not have a controller but a variable
                onChanged: (_value) {
                  setState(() {
                    dropDownValue = _value;
                  });
                },
                items: ["hello, world", "how are you", "goodbye"]
                    .map<DropdownMenuItem<String>>((String _value) => DropdownMenuItem<String>(
                    value: _value, // add this property an pass the _value to it
                    child: Text(_value,)
                )).toList(),
              ),
            ])

          ],
        ),

    );
  }

}

A: please add the VALUE field in both DropdownMenuItem and DropdownButton  to prevent error


text:
Q: LifeCycleContext vs FacesContext I know all information pertinent to a request is stored in the FacesContext class and it is trashed at the end of request. So how is the LifeCycleContext class different from the FacesContext class? How long does it live? Is it GC'ed at the end of an Http request?

A: Based on the Java doc and http://docs.oracle.com/cd/E15051_01/web.1111/b31974/adf_lifecycle.htm.
I seems the LifeCycleContext is responsible for grouping the contexts ADF puts in place. FacesContext on the other hand is a Faces construct for holding faces request specifics. The LifeCycleContext adds to what the FacesContext provides. Remember ADF is build upon (and add to) Trinidad, and Trinidad is build upon (and adds to) Faces.
It should be released the end of the request. When it is garbage collected is up to the JVM.


text:
Q: Is Copy trait about bit copying only from stack? The Rust doc defines Copy marked types as

Types whose values can be duplicated simply by copying bits

I wonder whether this definition means copying a variable value from only the stack or it includes copying heap resources too? In other words, is Copy just a sign for the compilier with a notice like "If you're going to create another variable of this type with the same value as one has, just copy all concerned with the first variable from the stack. That's sufficient to do."?
What if I have a type whose objects allocate a resource in a heap and I'm sure no dreadful thing would be coming up in the case of bit copying of this resource by means of memcpy or something. Can't I still denote the type with Copy (in due to Rust does only stack copying)?

A:
I wonder whether this definition means copying a variable value from only the stack or it includes copying heap resources too?

It's the former. It refers to copying a value by performing a naive and shallow byte-by-byte copy of its data.
More precisely, Copy means "it is safe to bitwise-copy the value and keep using the original value". All Rust objects are bitwise-copied in principle, be it by assignment or passing to functions, etc. The difference when the object is not Copy is that the object is said to be moved, and the compiler doesn't allow you to access the object that was the source of the copy. (The compiler will also not drop the original object if it implements Drop because it will be dropped by the new owner.)

In other words, is Copy just a sign for the compilier with a notice like "If you're going to create another variable of this type with the same value as one has, just copy all concerned with the first variable from the stack. That's sufficient to do."?

Yes.

What if I have a type whose objects allocate a resource in a heap and I'm sure no dreadful thing would be coming up in the case of bit copying of this resource by means of memcpy or something. Can't I still denote the type with Copy (in due to Rust does only stack copying)?

There is no way (and will likely never be a way) to denote such a type as Copy. If you want to allow copying such objects, you have to make them Clone and require the user to type .clone() explicitly. That's one of the things meant by claims that Rust "makes allocations explicit".
Note that none of this requires either the source or the destination of the copy to be allocated on the stack. They could as well be sub-fields of heap-allocated objects, and the same principles would apply equally. The "stack" is irrelevant: what matters is whether the byte-by-byte value transfer is considered a "copy" or "move", and that will depend on whether the type is Copy.


text:
Q: Run ant exec task from different folder I want to run my "exec grails" task into my grails project. I set grail path in exec task like
 <exec executable="${grails}"

How can I say , that exec should start from my project folder?

A: From the exec Ant task documentation:

Attribute    Description
dir          the directory in which the command should be executed.

<exec executable="${grails}" dir="${my.project.dir}">


text:
Q: way to rewrite LDAP field name before getting to client? We have access to an LDAP server that has a field we need the information from.  Its structure cannot be changed.  We have a client application that requires the field to a certain name.  How can we change the field name to match what we need before it gets to the application?

A: One alternative to deploy a device that can do transformations on attribute names, for example, a Directory Proxy Server or Synchronization Server. Alternatively, if your directory server supports plugins, one could write such a plugin to do the job.


text:
Q: Restful way to perform a data changing action I'm trying to stay Resftful, and follow protocols. I have an "Organisation" domain object, and have the usual POST/GET/PUT/DELETE operations:
POST https://www.example.com/api/organisation saves a new org.
GET https://www.example.com/api/organisation/{id} gets an org by it's ID
etc
Something a user can do from the client side (Website, mobile, etc) is set their default organisation. On the database side, we're just setting a default flag against the org they want to be defaulted.
But the API side, I'm not sure how to do, and keep it within good practice. At the moment, I have a method in my code:
        [HttpPost]
        public async Task<IActionResult> SetDefaultOrganisation()

I am not sure how to expose that to the API.
https://www.example.com/api/organisation/setdefault/{id}
That doesn't seem right. I don't want to do a PATCH, as.. the api must describe whats happening. It's not an any-item-can-change.
Is https://www.example.com/api/organisation/{id}/setdefault a more acceptable option?

A: One important point in restful endpoints is to be resource centric and not process centric.
That's mean if you have a verb (an action, like save or add) in you endpoint, you have a problem in your design.
In your question you wrote

Something a user can do from the client side (Website, mobile, etc) is set their default organisation

So from a resource point of view, the main resource here is the user.
With this point the endpoint can be like this (a POST or PUT)
/api/user/{userId}/orgranizations/default
And the body:
{ orgID : 1234}

A:
Restful way to perform a data changing action

In REST, the way we pass information to the web server is by editing the website.
This is normally done in one of two ways

*

*We GET a representation of the resource, make edits to our copy, and then deliver the revised representation to the server

*We fill in form, and deliver the representation of the form data to the server.

From the perspective of REST, these two patterns are the same ones that you use for editing any resource (that's the uniform interface constraint at work: our general purpose tools don't need to know anything about the meaning of the edits we are making).
Therefore, the design problem is to identify which resource (document) includes the representation of the information you want, and what representation (schema) you will use to communicate that change of information.
From the perspective of general purpose REST components, we don't care what the document is -- that's the server's problem; we only care about the string literal used to identify the document.
General purpose components also don't care about spelling conventions; /a472a51b-7e36-404b-a985-1fc79d1b7464 is a perfectly satisfactory identifier.  What this degree of freedom means is that you can choose identifiers that are easy for human beings to understand, and identifiers that are easy for your implementation to route.
/api/organisation/{id}/setdefault
From the point of view of a general purpose components, this is fine.  Human beings, however, a likely to object -- because this looks like it identifies an action, and what we really want is an identifier that tells us what the document is.
So that might be /api/organization/{id}, if somewhere in the document that describes the organization we have a list of users for whom this is the default organization.
But I think it would be more common to have something like /api/profiles/{userId}, where the profile document includes information about what the default organization is for each user.
If you needed a fine grain resource, then it might instead be something like /api/profiles/{userId}/defaultOrganization or even /api/defaultOrganizations/{userId}
(The ordering of path segments is something you decide upon based on how you want to take advantage of the relative references, as defined by RFC 3986).


text:
Q: My volume keeps reseting I'm using Ubuntu 22.04.1 LTS.
I have very little knowledge of linux and ubuntu, just downloaded few days ago, and my volume for some reason keep reseting to either 74% or mute every few seconds. I volume down and then few second after its randomly back at 74% or muting itself.
I've been googling around for the past 4 hours and i've never been more frustrated with a tech issue before.
Only thing I noticed is that whenever it happens, pulseaudio -v returns the following:
I: [pulseaudio] module-device-restore.c: Synced.
I: [pulseaudio] alsa-sink.c: Successfully enabled deferred volume.
I: [pulseaudio] alsa-sink.c: Hardware volume ranges from -179.00 dB to 0.00 dB.
I: [pulseaudio] alsa-sink.c: Fixing base volume to 0.00 dB
I: [pulseaudio] alsa-sink.c: Using hardware volume control. Hardware dB scale supported.
I: [pulseaudio] alsa-sink.c: Using hardware mute control.
I: [pulseaudio] sink.c: Changed port of sink 0 "alsa_output.pci-0000_00_1b.0.analog-stereo" to analog-output-headphones
I: [pulseaudio] module-device-restore.c: Restoring volume for sink alsa_output.pci-0000_00_1b.0.analog-stereo.
I: [pulseaudio] module-device-restore.c: Restoring mute state for sink alsa_output.pci-0000_00_1b.0.analog-stereo.
I: [pulseaudio] module-device-restore.c: Storing volume/mute for device+port sink:alsa_output.pci-0000_00_1b.0.analog-stereo:analog-output-headphones.

Let me know if more details are required. And if you have anyhting to add that can get me closer to solving it, please do, I am completely clueless and frustrated.


text:
Q: Run app on device starts with no default settings and params I'm testing my app and it all works fine in different emulators, but when I connect my Galaxy A50, it doesn't install fresh version of app.
My app has 2 ArrayLists that are empty on first install and some default settings in SettingsActivity. When I uninstall the app from my A50, and then "run app" from android studio, on same A50, ArrayLists are no longer empty, they contain some dummy objects I created days before and also settings are no longer set on default, they are changed like I set them. But that shouldn't be happening, I should get fresh empty default version of that app.
Is there some cache I need to clean???
EDIT: I just installed new AS 3.5 and I still have the problem only now I get different dataset, the same dataset as I had on the phone before I uninstalled my app and build it again from AS

A: From Samsung

From Settings, swipe to and touch Apps. Swipe to and touch the app you
  want to clear. Touch Storage, and then touch Clear cache.


text: Q: is the function $f=\lambda A\in P(N).A\ \Delta B $ when B is a constant group a bijection?(ne-to-one correspondence) is the function $$f=\lambda A\in P(N).A\ \Delta B $$ when $B \subseteq N$ is a constant group a bijection?(ne-to-one correspondence)


text:
Q: A mixture of beta distribution in R I was given a function (a mixture of beta distribution):
f(x) = beta(1,6)/3 + beta(3,6)/3 + beta(10,6)/3

My task is to plot the density of f(x).
Here is my code:
par(mfrow=c(1,1))

x <- seq(0,1,0.001)

plot(x,dbeta(x, shape1 = 1, shape2 = 6)/3 + dbeta(x, shape1 = 3, shape2 = 6)/3 + dbeta(x, shape1 = 10, shape2 = 6)/3,col="blue",lwd=2)

Just wondering if this is the right way to go about it? How can I use density function to do this? Thanks!

A: You can do it in ggplot2 like this:
#FIRST WE CREATE THE VECTOR
x <- seq(0, 1, by = 0.001)

#THEN EACH OF OUR BETAS DISTR

beta1 <- dbeta(x, shape1 = 1, shape2 = 6)/3
beta2 <- dbeta(x, shape1 = 3, shape2 = 6)/3
beta3 <- dbeta(x, shape1 = 10, shape2 = 6)/3

#MIXTURE
fx <- beta1 + beta2 + beta3

#USE ggplot2 TO PLOT
library(ggplot2)
mixture <- ggplot()+
              geom_line(aes(x, beta1, color = "fx1"),
                        size = 1.2,
                        linetype = "dotdash")+
              geom_line(aes(x, beta2, color = "fx2"),
                        size = 1.2,
                        linetype = "dotdash")+
              geom_line(aes(x, beta3, color = "fx3"),
                        size = 1.2,
                        linetype = "dotdash")+
              geom_line(aes(x, fx, color = "mixture"),
                        size = 1.5)+
              labs(title = "Mixture of 3 Betas",
                   x = "Sequence",
                   y = "Beta",
                   colour = "Beta Distr",
                   caption = "Data generated with dbeta()")

mixture

Good luck!


text:
Q: CSS Issue in IE6 Can anyone help me with this? http://173.199.158.105/about-our-company.html shows just fine in Firefox and newer IE versions. But when previewing it in IE6 using Adobe's Browserlab the left sidebar words are cut off. The word customer service is messed up. You can only see "stomer Service". I have no idea what's wrong. Anyone have any insight on this?

A: It sounds like the IE 6 double-margin bug.
http://www.positioniseverything.net/explorer/doubled-margin.html
I also like to add this to my sites...
http://ie6update.com/

A: One possible solution, although not a nice one is to use conditional comments for IE6, so loading a separate CSS depending on the users' browser after declaring the normal CSS. Might be more work in the end to maintain but it does solve the bug mentioned by Sparky672.
So something like this:
<link rel="stylesheet" href="http://www.mydomain.com/index.css"/>
<!--[if IE 6]>
<link rel="stylesheet" href="http://www.mydomain.com/indexIE6.css"/>
<!--<![endif]-->

See link: http://www.quirksmode.org/css/condcom.html