text:
Q: Visualizing the difference between two points with ggplot2 I want to visualize the difference between two points with a line/bar in ggplot2.
Suppose we have some data on income and spending as a time series.
We would like to visualize not only them, but the balance (=income - spending) as well.
Furthermore, we would like to indicate whether the balance was positive (=surplus) or negative (=deficit).
I have tried several approaches, but none of them produced a satisfying result. Here we go with a reproducible example.
# Load libraries and create LONG data example data.frame
library(dplyr)
library(ggplot2)
library(tidyr)

df <- data.frame(year  = rep(2000:2009, times=3),
                 var   = rep(c("income","spending","balance"), each=10),
                 value = c(0:9, 9:0, rep(c("deficit","surplus"), each=5)))
df

1.Approach with LONG data
Unsurprisingly, it doesn't work with LONG data,
because the geom_linerange arguments ymin and ymax cannot be specified correctly. ymin=value, ymax=value is definately the wrong way to go  (expected behaviour). ymin=income, ymax=spending is obviously wrong, too (expected behaviour).
df %>%
ggplot() +
  geom_point(aes(x=year, y=value, colour=var)) +
  geom_linerange(aes(x=year, ymin=value, ymax=value, colour=net))

#>Error in function_list[[i]](value) : could not find function "spread"

2.Approach with WIDE data
I almost got it working with WIDE data.
The plot looks good, but the legend for the geom_point(s) is missing (expected behaviour).
Simply adding show.legend = TRUE to the two geom_point(s) doesn't solve the problem as it overprints the geom_linerange legend. Besides, I would rather have the geom_point lines of code combined in one (see 1.Approach).
df %>%
  spread(var, value) %>%
ggplot() +
  geom_linerange(aes(x=year, ymin=spending, ymax=income, colour=balance)) +
  geom_point(aes(x=year, y=spending), colour="red", size=3) +
  geom_point(aes(x=year, y=income), colour="green", size=3) +
  ggtitle("income (green) - spending (red) = balance")

3.Approach using LONG and WIDE data
Combining the 1.Approach with the 2.Approach results in yet another unsatisfying plot. The legend does not differentiate between balance and var (=expected behaviour).
ggplot() +
  geom_point(data=(df %>% filter(var=="income" | var=="spending")),
             aes(x=year, y=value, colour=var)) +
  geom_linerange(data=(df %>% spread(var, value)),
                 aes(x=year, ymin=spending, ymax=income, colour=balance))

*

*Any (elegant) way out of this dilemma?

*Should I use some other geom instead of geom_linerange?

*Is my data in the right format?

A: Try
ggplot(df[df$var != "balance", ]) +
  geom_point(
    aes(x = year, y = value, fill = var),
        size=3, pch = 21, colour = alpha("white", 0)) +
  geom_linerange(
    aes(x = year, ymin = income, ymax = spending, colour = balance),
        data = spread(df, var, value)) +
  scale_fill_manual(values = c("green", "red"))

Output:

The main idea is that we use two different types of aesthetics for colours (fill for the points, with the appropriate pch, and colour for the lines) so that we get separate legends for each.


text:
Q: test $x,%dil vs. test $x,%edi I want to test a bit in a register, namely the second lowest one in %rdi.
Naively I would write test $2, %edi (or and $2, %edi -- I don't know if anding would be better -- the rest of the register is irrelevant at this point).
I checked what clang and gcc generate (for a dummy void TEST(long X){ if(X&2) abort(); }), and while they seem similarly split on test vs and, they both surprised me by both agreeing to address the register via %dil, not %edi.
What might be the reason for this?

A: Both ways have equal performance except for code-size; reading a low-8-bit partial register never has any penalty, unlike test $2, %bh for example; reading high-8 registers has extra latency on Haswell and later but still saves code-size and doesn't hurt front-end throughput.
There is no test $sign_extended_imm8, r/m32, so it saves code-size to use 8-bit operand-size, even though it requires a REX prefix to encode DIL. (https://www.felixcloutier.com/x86/test)
Since the value of x isn't needed after the test, you actually could use and $imm8, %edi (3 bytes) to save code-size, but and/jnz can't macro-fuse on AMD CPUs, or Intel before Sandybridge, so compilers prefer to only write FLAGS.  I suspect nobody's implement the peephole optimization of using and instead of test with -mtune=sandybridge when the register isn't needed later.
   0:   f7 c7 02 00 00 00       test   edi,0x2    # imm32 = 2
   6:   40 f6 c7 02             test   dil,0x2    # REX prefix with no bits set
   a:   f6 c7 02                test   bh,0x2     # same byte without REX

   d:   83 e7 02                and    edi,0x2
  10:   40 80 e7 02             and    dil,0x2
  14:   80 e7 02                and    bh,0x2

  17:   0f ba e7 02             bt     edi,0x2    # can't macro-fuse with JCC

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to create geometry with geometry functions? I see there are functions in QGIS that supposed to generate geometry, like geom_from_wkt. How do I actually display it?
When I create a new field (in a field calculator) with a formula, say
bounds(make_line(make_point($x-1,$y-1),make_point($x+1,$y+1)))

its value becomes NULL no matter what type I select.
And If I say Update existing field" and choose <geometry> in the dropdown -- nothing changes, I still do not see rectangles.

A: That expression returns an object of type geometry.
Therefore it is not possible to save its value (as written) in any columns of the attribute table.
However, the expression can be used:

*

*In the Geometry by Expression tool, from the Processing Toolbox.

*In the Geometry Generator applied to the Symbology tab in the Layer Properties.

*In the creation of Virtual Layers.

About your expression:
It is assumed that you are applying that expression to a single-part point geometries layer.
If they are not points, it returns NULL. If they are multi-part points, it returns a square of 2 units side, only for the first part of the collection.
Although you cannot use it as it is in the attribute table, you could modify it a bit so that it returns a text string that describes the generated geometry, known as Well-Known Text (WKT):
geom_to_wkt( bounds( make_line(
  make_point( $x-1, $y-1),
  make_point( $x+1, $y+1))))

Test it in a Text(String) with Output field length of 500.


text:
Q: Meaningless output from LibSVM I am working on a Support Vector Machine in C++ for my University using LibSVM.
For that I want to be able to parse .csv files filled with documents and labels.
This works so far pretty well but as output I get
C = nan
obj = nan, rho = nan
nSV = 0, nBSV = 0
Total nSV = 0

and this does not look like good data was generated.
I bet I am making a beginner's mistake but can simply not figure out what is going wrong. The following shows how I create the nodes, as well as the Document class I use, which is supposed to be analysed.
class Document {
public:
    double docID;
    double label;
    std::string text;
    Document(double docID, double label, std::string aText);
}

...
std::vector<Feature> features = getFeatures();
documents = getDocuments();

int documentCount = documents.size();
int featureCount = features.size();
svm_node** nodesList = new svm_node*[documentCount];
double* labelList = new double[documentCount];

for (int j = 0; j < documentCount; j++){
        nodesList[j] = new svm_node[featureCount];
        Document currentDocument = documents[j];
        for (int i = 0; i < featureCount; i++) {
            svm_node node;
            node.index = i + 1;
            node.value = features[i].analyse(currentDocument.docID);
            nodesList[j][i] = node;
        }
        labelList[j] = currentDocument.label;
    }

problem->l = documentCount;
problem->x = nodesList;
problem->y = labelList;

param->svm_type = NU_SVC;
param->kernel_type = LINEAR;
param->degree = 3;
param->gamma = 0.0625;
param->coef0 = 0;
param->nu = 0.25;
param->cache_size = 100;
param->C = 1;
param->eps = 1e-3;
param->p = 0.1;
param->shrinking = 1;
param->probability = 0;
param->nr_weight = 0;
param->weight = new double[2];
param->weight_label = new int[2];
param->weight[0] = 1;
param->weight_label[0] = 1;
param->weight[1] = 1;
param->weight_label[1] = 1;

svm_check_parameter(problem, param);
model = svm_train(problem, param);

Does somebody know where the reason could lie for the meaninglessness of the output?
Thank you in advance!

A: *

*Check your feature files, is everything in order ? no nan's, inf's or very large numbers?

*Is your training data skewed ? i.e. you have a lots of values for one class, but hardly any for the other class.


text:
Q: Flutter url_launcher blocked popup I want to redirect user from flutter web app to another url.
I use url_launcher with the following code:
if(await canLaunch(link)){
            await launch(link);
          }else{
            print('faild to load url');
          }

this code is working fine in other pages of my application. but not working in one of the pages and i get popup window blocked in my browser.
the code is working fine on chrome(desktop and mobile). but the problem occurs on safari.
update: in the page where the problem is occuring I have a http request and then launch the url.
var url = Uri.parse(Api.completeOrder);
      var response = await http.post(url, body: {
        'token': token,
      });

      if (response.statusCode == 200) {
          if(await canLaunch(link)){
            await launch(link);
          }else{
            print('faild to load url');
          }
}


text:
Q: Create upgrade setup using installshield 2010 primier I want to create an upgrade setup. I have an old setup with for example version 1.0.1.43 and my new setup will has version of 1.0.1.45
I have created a new basic MSI project in installshield. I set version to 1.0.1.45 I copied both product code and upgrade code of old setup into upgrade setup. I also added all of new files in setup that should be replaced with files of old setup. I selected all files and then right clicked on them and in properties checked always overwrite option. then in Media section I added a major upgrade with upgrade code of my old setup. then I build the setup.
when I run this setup it shows me that you have installed this application do you want to upgrade it or not? then I choose yes to upgrade. after installing this setup I figured it out that in add/or remove programs version of my application has changed to 1.0.1.45, that means it has been upgraded. but when I check files I see that none of new files has been replaced with new one.
Where am I wrong that this setup ignore all of my new files to replace? I want this setup find old path of old setup and after removing all files, add new files to that path?
thanks

A: As you are saying, you have created new MSI installer for upgrade. So in this case the component ID of components in which your files are present, got change. So you need to set values of Component ID with the component IDs of your installer 1.0.1.45. Or you need to create different components with the same target path.
Also you can validate your upgrade build 1.0.1.46 with the main build 1.0.1.45 with following steps.

Build Menu -> Validate -> Upgrade Validation Wizard

Then give path of your main installer (msi/exe) and your upgrade installer (msi/exe). And check what differences both builds are having.


text:
Q: How to authenticate users on a React.JS app using j_security_check I am working on an application that uses ReactJS. I will be running the application on a TomCat server and deploying using Maven.  For past applications I have used j_security_check to authenticate users and would like to authenticate users in the React app the same way.
My problem arises in that I am not sure how to set up my web.xml file to restrict access and prompt for a login.  Since React only has one html file, and one js file, how do I restrict access and redirect to a different component?  Do I need to have a separate html page for my login?
If this is something that has to be done programmatically, how would I go about setting up a HttpRequest to do this that would be secure? I have tried the following code, but am getting a 404 error when I try to login.
handleSub(fields) {
  var xhttp = new XMLHttpRequest();
  xhttp.open("POST", "j_security_check", true);
  xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xhttp.send("j_username=fields.username&j_password=fields.password");}

A: For others that are having this issue, below is how we got it to authenticate correctly.
On loading the website we load up a login page automatically.
On componentDidMount, we call a function that sends an XMLHttpRequest to a get a file located in the websites server.  The file path is restricted in the websites web.xml causing it to try to authenticate using j_security_check. url's have been removed for security purposes.
callSecuredFile(){
var secure = new XMLHttpRequest();
var url = "/website_name/private/filename.txt";
secure.onreadystatechange = function(){
  if(secure.readyState === 4 && secure.status ===200){
    try{
      var verificationJSON = JSON.parse(secure.responseText);
      if(verificationJSON.loggedIn === true){
        ReactDOM.render( this.renderSite(document.getElementById('MainPage'));
      }
    }
    catch(e){
      console.log(e);
    }
  }
}.bind(this);
secure.open('GET', url, true);
secure.send();

}
Should the user already be authenticated and have an active session the login page will be removed and the main website will then be rendered.
Otherwise the user will login with their credentials, creating an active session and loading the main page.


text:
Q: sql - delete rows which are less than a value using rank and groupby In a table I have flows and runs
for every flow i have to keep the row with max runs delete remaining all. This has to be done of all flows.
Using single statement.
I tried to use cte, rank but getting error.
I tried to group by flows and then apply rank for the group and then delete rows which are > 1.

WITH cte AS

( SELECT flow, RANK() OVER

       (PARTITION BY flow ORDER BY runs)

AS rank FROM TEST_RESULTS_TABLE GROUP BY flow )

DELETE FROM cte WHERE rank >1 ;

this is giving :

ORA-00928: missing SELECT keyword
00928. 00000 -  "missing SELECT keyword"
*Cause:
*Action:
Error at Line: 25 Column: 153

A: Oracle does not support updatable CTEs.  Instead, you can do:
delete from test_results_table trt
    where runs > (select min(trt2.runs)
                  from test_results_table trt2
                  where trt2.flow = trt.flow
                 )

A: You can use your RANK() query (without the GROUP BY) and correlate it with the DELETE statement using the ROWID pseudo-column:
DELETE FROM test_results_table
WHERE ROWID IN (
  SELECT ROWID
  FROM   (
    SELECT RANK() OVER ( PARTITION BY flow ORDER BY runs ASC ) AS rnk
    FROM   test_results_table
  )
  WHERE rnk > 1
)

db<>fiddle here


text:
Q: How to get Google Cloud Speech (voice-to-text) to recognize letters and sounds Is there a way to get the Google Cloud Speech API to recognize letters and letter sounds?
As an example use case, if I wanted to build a spelling game where a voice would say, "Spell restaurant" and the recognizer would listen for each letter and recognize them as they come through.
Similarly, is there a way to identify specific letter sounds like: "oo", "ew", "k" (as in cat) or "s" (as in circle).

A: It seems to already do a reasonable job at least in some cases.  E.g., when I spell out "cee ay tee" it recognizes "c a t".  It is also possible to provide "word hints" as described in this post:
Google Cloud Speech API word Hints
Supplying a list of single-letter "words" as hints, i.e.
phrases = ['a', 'b', 'c', 'd' ... ]

appears to give improved results in this area.


text:
Q: Were there any DeLoreans remaining after the end of BTTF3? We saw that there were two DeLoreans in BTTF. One got destroyed by lightning (which was found in the shaft by Marty and repaired by 1955 Doc, but permanently destroyed later) but the other one was never seen since the end of BTTF1. What happened to the other DeLorean?

A: Only one time machine DeLorean exists in the movie trilogy. Your confusion likely stems from the overlapping time traveling, creating a big ball of wibbly-wobbly timey-whimy stuff. For example, at one point in 1955 that one car exists as four time-copies of itself at the same time:

*

*Marty's copy, as seen in the first movie

*Biff's copy, as seen in the second movie when he steals it to give his younger self the sports almanac

*Doc and Marty's copy, as seen in the second movie when the Doc and Marty return to 1955 to try to prevent Biff from giving himself the almanac

*Doc's copy, as seen in the third movie when 1885 Doc stored the DeLorean in the cave for his 1955 counterpart

All of this wibbly-wobbliness is resolved at the end of the third movie when the DeLorean is destroyed by the train.

A: The question is a seriously false premise.   The flying DeLorean of the trilogy is a future tech upgrade of the original. This is supported by the flying upgrades offered for sale in the future for any car.
However I feel it is worth pointing out the semicanon videogame sequel is based on the premise that the lightning strike created a time clone DeLorean.  The cinematic scenes from the game have been edited into films on YouTube.
https://en.m.wikipedia.org/wiki/Back_to_the_Future:_The_Game
Additionally in another semicanon continuity - the animated series features a new DeLorean time machine. Which truly is a second DeLorean and is much more advanced.
https://en.m.wikipedia.org/wiki/Back_to_the_Future_(TV_series)
And per the question- both of these are after BTTF 3.


text:
Q: Merging within lists and then across lists in R by Date I have some lists which look like:
$SPA
           Date Formación bruta de capital fijo (real, índice) Consumo privado (real, índice) IRS 1Y
1Q80 1980-03-30                                             NA                             NA     NA
2Q80 1980-06-30                                             NA                             NA     NA
3Q80 1980-09-30                                             NA                             NA     NA
4Q80 1980-12-30                                             NA                             NA     NA
1Q81 1981-03-30                                             NA                             NA     NA
2Q81 1981-06-30                                             NA                             NA     NA
     Renta bruta disponible familias (nominal)
1Q80                                        NA
2Q80                                        NA
3Q80                                        NA
4Q80                                        NA
1Q81                                        NA
2Q81                                        NA

$GER
           Date IRS 1Y
1Q80 1980-03-30     NA
2Q80 1980-06-30     NA
3Q80 1980-09-30     NA
4Q80 1980-12-30     NA
1Q81 1981-03-30     NA
2Q81 1981-06-30     NA

$OTH
           Date Brent oil price (USD/barrel)
1Q80 1980-03-30                        38.25
2Q80 1980-06-30                           38
3Q80 1980-09-30                         33.4
4Q80 1980-12-30                        40.15
1Q81 1981-03-30                        38.35
2Q81 1981-06-30                        33.25

And also:
$FRA
        Date GDP....yoy. GDP....qoq.
1 1980-03-30        3.01        0.97
2 1980-06-30        1.81       -0.72
3 1980-09-30        0.70        0.15
4 1980-12-30        0.20       -0.20
5 1981-03-30       -0.45        0.32
6 1981-06-30        0.98        0.70

$GER
        Date GDP....yoy. GDP....qoq.
1 1980-03-30          NA          NA
2 1980-06-30          NA          NA
3 1980-09-30          NA          NA
4 1980-12-30          NA          NA
5 1981-03-30          NA          NA
6 1981-06-30          NA          NA

$ITA
        Date GDP....yoy. GDP....qoq.
1 1980-03-30          NA          NA
2 1980-06-30          NA          NA
3 1980-09-30          NA          NA
4 1980-12-30          NA          NA
5 1981-03-30          NA          NA
6 1981-06-30          NA          NA

$NOR
        Date GDP....yoy. GDP....qoq.
1 1980-03-30        3.75        1.31
2 1980-06-30        2.52       -1.16
3 1980-09-30        1.74        0.27
4 1980-12-30        0.81        0.40
5 1981-03-30        1.26        1.76
6 1981-06-30        2.21       -0.23

$SPA
        Date GDP....yoy. GDP....qoq.
1 1980-03-30          NA          NA
2 1980-06-30          NA          NA
3 1980-09-30          NA          NA
4 1980-12-30          NA          NA
5 1981-03-30          NA          NA
6 1981-06-30          NA          NA

I want to do 2 things:

*

*In lst1 I want to merge the OTH list with the SPA and GER list by Date. (This will eliminate the OTH list.

*Merge list1 and list2, again by Date but also not by their list names - i.e. so only SPA and GER will be merged since they are the only countries which appear in both lists.
Output: A single list consisting of just SPA and GER with OTH merged (in list1) and then both SPA and GER merged from list1 and list2.
Expected output GER (first 2 rows):
           Date IRS 1Y                  Date        Brent oil price (USD/barrel)       Date           GDP....yoy. GDP....qoq.
1Q80 1980-03-30     NA                  1Q80 1980-03-30      NA                    1 1980-03-30          NA          NA
2Q80 1980-06-30     NA                  1Q80 1980-03-30      38.25                 2 1980-06-30          NA          NA

Data:
lst1 = list(SPA = structure(list(Date = structure(c(3741, 3833, 3925,
4016, 4106, 4198), class = "Date"), `Formación bruta de capital fijo (real, índice)` = c("NA",
"NA", "NA", "NA", "NA", "NA"), `Consumo privado (real, índice)` = c("NA",
"NA", "NA", "NA", "NA", "NA"), `IRS 1Y` = c("NA", "NA", "NA",
"NA", "NA", "NA"), `Renta bruta disponible familias (nominal)` = c("NA",
"NA", "NA", "NA", "NA", "NA")), row.names = c("1Q80", "2Q80",
"3Q80", "4Q80", "1Q81", "2Q81"), class = "data.frame"), GER = structure(list(
    Date = structure(c(3741, 3833, 3925, 4016, 4106, 4198), class = "Date"),
    `IRS 1Y` = c("NA", "NA", "NA", "NA", "NA", "NA")), row.names = c("1Q80",
"2Q80", "3Q80", "4Q80", "1Q81", "2Q81"), class = "data.frame"),
    OTH = structure(list(Date = structure(c(3741, 3833, 3925,
    4016, 4106, 4198), class = "Date"), `Brent oil price (USD/barrel)` = c("38.25",
    "38", "33.4", "40.15", "38.35", "33.25")), row.names = c("1Q80",
    "2Q80", "3Q80", "4Q80", "1Q81", "2Q81"), class = "data.frame"))

lst2 = list(FRA = structure(list(Date = structure(c(3741, 3833, 3925,
4016, 4106, 4198), class = "Date"), GDP....yoy. = c(3.01, 1.81,
0.7, 0.2, -0.45, 0.98), GDP....qoq. = c(0.97, -0.72, 0.15, -0.2,
0.32, 0.7)), row.names = c(NA, 6L), class = "data.frame"), GER = structure(list(
    Date = structure(c(3741, 3833, 3925, 4016, 4106, 4198), class = "Date"),
    GDP....yoy. = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
    NA_real_), GDP....qoq. = c(NA_real_, NA_real_, NA_real_,
    NA_real_, NA_real_, NA_real_)), row.names = c(NA, 6L), class = "data.frame"),
    ITA = structure(list(Date = structure(c(3741, 3833, 3925,
    4016, 4106, 4198), class = "Date"), GDP....yoy. = c(NA_real_,
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), GDP....qoq. = c(NA_real_,
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_)), row.names = c(NA,
    6L), class = "data.frame"), NOR = structure(list(Date = structure(c(3741,
    3833, 3925, 4016, 4106, 4198), class = "Date"), GDP....yoy. = c(3.75,
    2.52, 1.74, 0.81, 1.26, 2.21), GDP....qoq. = c(1.31, -1.16,
    0.27, 0.4, 1.76, -0.23)), row.names = c(NA, 6L), class = "data.frame"),
    SPA = structure(list(Date = structure(c(3741, 3833, 3925,
    4016, 4106, 4198), class = "Date"), GDP....yoy. = c(NA_real_,
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), GDP....qoq. = c(NA_real_,
    NA_real_, NA_real_, NA_real_, NA_real_, NA_real_)), row.names = c(NA,
    6L), class = "data.frame"))

A: Not sure if this is the best solution, but the following code works. It uses the function left_join from the package dplyr.
Side note: Like user onyambu mentioned, having multiple date columns is not necessary. So my solution does have the dates only as rownames.
library(dplyr)
merge_oth <- function(element_to_merge, lst){
  short_lst = lst[-which(names(lst) == element_to_merge)]
  single_elem = lst1[[element_to_merge]]
  fin_lst = lapply(short_lst, function(x){
    dplyr::left_join(x, single_elem, by = "Date")
  })
  return(fin_lst)
}
merged_list <- merge_oth(element_to_merge = "OTH", lst = lst1)

merge_by_name <- function(list_1, list_2){
  keys = intersect(names(list_1), names(list_2))
  fin_lst = setNames(lapply(keys, function(key) {
    l1 = list_1[[key]]
    l2 = list_2[[key]]
    dplyr::left_join(l1, l2, by = "Date")
  }),  keys)
}
final <- merge_by_name(list_1 = merged_list, list_2 = lst2)

The resulting list contains the merged lists for SPA and GER and following your example the output for GER looks like this:
$GER
        Date IRS 1Y Brent oil price (USD/barrel) GDP....yoy. GDP....qoq.
1 1980-03-30     NA                        38.25          NA          NA
2 1980-06-30     NA                           38          NA          NA
3 1980-09-30     NA                         33.4          NA          NA
4 1980-12-30     NA                        40.15          NA          NA
5 1981-03-30     NA                        38.35          NA          NA
6 1981-06-30     NA                        33.25          NA          NA

I hope this helps. I took inspiration from here.

A: lst1_join <- lapply(lst1[-which(names(lst1) == "OTH")], \(x) merge(x, lst1$OTH, by = "Date"))

countries <- intersect(names(lst1_join), names(lst2))

final <- lapply(countries, \(x) merge(lst1_join[[x]], lst2[[x]], by = "Date"))
names(final) <- countries


text:
Q: How to create a date range in jquery UI datepicker without calling datepicker again inside the main datepicker function? I have a weird problem with jquery UI datepicker when choosing range. Before the question, I am working on code written by lots of other people. They have included jquery Tools and UI in optimized order so all the functions work. All except jquery UI. The reason I mentioned is, I cant update the versions or switch around the order of the libraries because it breaks all the other codes :( (But I did make sure jquery, js, jquery UI is not included twice anywhere)
That said, the problem is this - I want to have two dates where the 'to' date should be later than the 'from' date. This should be easy with the following code from jquery site:
$(function() {
    $( "#from" ).datepicker({
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 3,
        onClose: function( selectedDate ) {
            $( "#to" ).datepicker( "option", "minDate", selectedDate ); //BREAKS!
        }
    });
    $( "#to" ).datepicker({
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 3,
        onClose: function( selectedDate ) {
            $( "#from" ).datepicker( "option", "maxDate", selectedDate ); //BREAKS!
        }
    });
});

The issue is the code breaks when I choose the date at the lines where I have commented as 'BREAKS!'. It is simply not detecting the 2nd datepicker inside the main datepicker function and giving me error -
    SCRIPT438: Object doesn't support property or method 'datepicker'
So I read the following post and decided to do stuff the following way. This works but obviously I dont have the range functionality now.
$(document).ready(function(){

$('#from').datepicker({
            changeMonth: true,
            changeYear: true,
            numberOfMonths: 1,
            showButtonPanel: true,
    onSelect: function(dateText, inst) {
    $('[name=wmFrom]').val(dateText); //need this part for the search filters
    }

});
 $('#to').datepicker({
            changeMonth: true,
            changeYear: true,
            numberOfMonths: 1,
            showButtonPanel: true,
    onSelect: function(dateText, inst){
    $('[name=wmTo]').val(dateText); //need this part for the search filters
    }
});
});

Ok now, I am still learning js and jquery. Can any one help me implement a range functionality for this without calling/initializing datepicker inside datepicker. I know this problem probably means there is probably some issue with versions or compatibility of the libraries. But like I said I am really cant get rid of them or change much in this. Any idea/help will be very much appreciated..

MORE INFO-
This is frustrating because someone who worked before me have done things this way and any change I make break different functions. This is an internal application so cant give a link :(.
This is what I am talking about - First there is a header php which is included in the top of the problem file I am working on. This header has the link to jquery library. After including the header.php there are links to queryLoader.js, jquery.easing.1.3.js. Then There is a bunch of code which has scripts and the body html (this is where the html inputs associated with the datepicker are). Then they link /full/jquery.tools.min.js , jquery.effects.core.js, jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.datepicker, query.ui.tooltip.js , jquery-ui.css. After this, there are more scripts which use functions like $.tools.validator.fn and serializeObject().
If I assume its loading jquery lib twice and change the /full/jquery.tools.min.js to /tiny/jquery.tools.min.js or /all/jquery.tools.min.js I get the following error:
Object doesn't support this property or method
on lines with functions such as serializeObject(). I get this when the page loads itself.
If I add the /jquery.tools.min.js after all the UI class links, I get:
Object doesn't support property or method 'datepicker'
at the point of datepicker initialization on the input. I get this when the page loads itself.
Who should I do :(

A: I try to help you after 4+ years :)
$(document).ready(function(){
  //datapickerer creation... $('#to').datepicker({...

  $("#to").on( "change", function() {
            $("#from").datepicker("option", "maxDate", getDate( this ));
  });
  $("#from").on( "change", function() {
            $("#to").datepicker("option", "minDate", getDate( this ));
  });
});

A: A common headache with jQuery tools is they have versions that include full jQuery.js in their plugin file. This can cause problems if jQuery tools gets loaded after other plugins. It is a terrible practice for a plugin to include full jQuery library in their file... but the jQuery tools team thinks it's great. Check the version you are using as a start.
Essentially the problem can boil down to user not realizing jQuery is being loaded twice. Loading jQuery on top of another versio that already has plugins registered will wipe out those plugins.
Use a browser console to check for errors thrown to help you troubleshoot


text:
Q: Why "while" loop does not end when condition is met? I have an apparently easy issue but I just cannot get what am I doing wrong.
   I've got a code which will test a 60 character entered text in console and if in that text the "terrorist" word appears it will prompt the message "suspect text" and when that word does not appear it would show "nothing suspect".
   The text entering "mode" should finish when the word "done" is entered. This seems to be my problem because my while loop just does not want to end.
Any hints?
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>

int start_with (char *sir1, char *sir2)
{
    int i,j,k;
    int len_sir2=strlen(sir2);
    char sir3[60]="";
    for (i=0;i<=len_sir2;i++)
    {
        sir3[i]=sir1[i];
    }
    k=(strcmp(sir2,sir3)) ? 0:1;
    return k;
}

int main()
{
    char *txt1;
    char sir1[60]="", sir2[60]="terorist", sir_test[60]="done";
    int i,j,lensir1, contor=0,buf_de_la=0, buf_la;

    while (sir1!=sir_test)
    {
        printf("Enter desired text and press ENTER \n");
        gets(sir1);
        printf("\n");
        buf_la=strlen(sir1);
        char *txt1="Nothing suspect";
        while (buf_de_la<buf_la-7)
        {
            char sirbuf[60]="";
            j=buf_de_la;
            for (i=0;i<=7;i++)
            {
                sirbuf[i]=sir1[j];
                j=j+1;
            }

            if (start_with(sirbuf,sir2)==1)
            {
                txt1="SUSPECT text entered!";
                break;
            }

            buf_de_la=buf_de_la+1;

        }
        printf("%s\n",txt1);
        getch();
        system("cls");
    }

    return 0;

}

A: Instead of while (sir1!=sir_test), try this: while (strcmp(sir1,sir_test)). strcmp, strcmpi etc. are the proper functions to be used for string comparisons. They are declared under the string.h header file.

A: The issue is with your comparison while (sir1!=sir_test) which is wrong. It actually compares the addresses of the two strings. You can use strcmp or various other forms of the same function for comparing strings.
A small change which could make your code working is shown below..
do{
        printf("Enter desired text and press ENTER \n");
        .
        .
        .
        system("cls");
}
while (strcmp(sir1,sir_test));

A: You should compare C-style strings by using strcmp, like this
while (strcmp(sir1, sir_test) != 0)

This happens because when you do sir1!=sir_test, what you are actually testing is if both character arrays are pointing to the same address in memory, which is not true, since they are two different character arrays located at two different memory addresses.
Instead, what you want to do is compare the characters contained in each variables memory space, and that's what strcmp does: it compares character by character until a null terminating character is found.


text:
Q: Oracle table partitioning options I have a transactions table in oracle db with up to 20 million records/day across multiple accounts, with accounts growing to ~100.
In order to make my queries as fast as possible, I was considering:

*

*A range partition on date field over 1 day interval

*A hash partition on account number field, so each account has it own set daily set of transactions

I guess oracle will treat the the table as a logical table, and create a physical table per partition?
Any recommendations on the 2 different partitions (range and hash)? And any special considerations on purging data in a partitioned table.
Thanks

A:
I guess oracle will treat the the table as a logical table, and create a physical table per partition?

Physical segment per partition(or subpartition in case of subpartitioning)

Any recommendations on the 2 different partitions (range and hash)? And any special considerations on purging data in a partitioned table.

It's difficult to suggest anything without knowing your data and data processing, but you can also consider a composite partitioning: range partitioning by date and hash subpartitioning by account. In case of partitioning by date you can drop partitions by date (ALTER TABLE ... DROP PARTITION FOR(...))


text:
Q: CSS transitions for Single Page App section contents I am developing a single page app using js/handlebars/phonegap. In the beginning the architecture was multiple pages using jquery mobile to do slide or flip effects using the standard data-transition="slide" attribute on  tags. Pretty standard stuff. Since then i have switched over to handlebars and the architecture has become single pages with content loading into a container div.

My page content is injected into the "container" div using append or innerHTML commands.
What i want is to have transitions between content loads where it looks like a slide effect. But since i only have one container that i am changing the inner content of then i am sure i would need something like a second container ?
I have been following this post http://coenraets.org/blog/phonegap-tutorial/ but i am not sure how it plays out with my content being loaded in a specific div.
Basically i want to show a slide effect on the content that is loaded in the "container" div.
Can someone help me digest the link above and apply to my architecture.
thanks in advance.


text:
Q: Executing a PHP Script From A Bash Script I am trying to execute a simple PHP script from a simple BASH script. The answers on this website don't answer my issue.
Here is my BASH script
#!/bin/sh
railmove="/usr/bin/php -q /home/username/subfolder"
php "$railmove"/$shelltest.php

Here is my PHP script
#!/usr/bin/php
<html>
<head>
</head><body>

<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
require('connect_db.php');
$timer="222222";
$railinfo2=$mysql_link->prepare('INSERT INTO stillrunning(timer) VALUES(:timer)');
$railinfo2->execute(array(':timer'=>$timer));
$mysql_link=null;
?>
</body>
</html>

I get the following error when I run my BASH script from the command line.
Could not open input file: /usr/bin/php -q /home/username/subfolder/.php

I have tried typing /usr/bin/php -q /home/username/subfolder/durable2.sh and that works fine. ie it runs

A: You already include /usr/bin/php in the $railmove string.  You don't need to specify php again as a new command.  Also, $shelltest doesn't appear to be defined.
So:
#!/bin/sh
railmove="/usr/bin/php -q /home/username/subfolder"
$railmove/your-php-script.php

might work.


text:
Q: Cannot use object of type stdClass as array laravel I know is simple but i don't know at this moment
In my controller i use
$result = DB::select("SELECT name FROM account_name WHERE name='".$name."'");

I can't get the data out from that array
dd($result) show me:
array:1 [
  0 => {#232
    +"name": "John"
  }
]

How to get that John out????
I have tried $result[0]["name"] but no success and give me that error

A: $result = DB::table('account_name')->select('name')->where('name', $name)->first();

Then:
$result->name; // John

Or you can do:
$result = DB::table('account_name')->where('name', $name)->value('name');

Then:
$result; // John

A: You can cast object to array like that (array) $object.
You can also check if it's an object : if(is_object($variable)) $variable = (array) $variable


text:
Q: Display the value from laravel relationship? I am using laravel 5.1 with mongodb, I need to display users list on a blade, i am using Laravel relationship method(hasMany), i tried but i got
error(Undefined property: Illuminate\Database\Eloquent\Collection::$roles)

Table structure:
users-> userid, username,email, roleid.
user_roles->roleid,rolename;

my question is simple, i want userdetails from user table with rolename, i have attached my query result image.any suggesstion please?
Controller:
$users =User::with('roles')->get();
return view('Manage_users', compact('users'));

User Model:
class User extends Eloquent
{
  protected $collection = 'users';

  public function roles()
    {
        return $this->hasMany('App\User_role','roleid','roleid');
    }

}

User_roles Model:
class User_role extends Eloquent
{
  protected $collection = 'user_roles';

  public function user()
    {
        return $this->belongsTo('App\User','roleid','rolename');
    }
}

My query result image
My view page result

A: in controller update your code to this
$users = User::with('roles')->whereHas('roles', function ($query) {
                                   $query->where('roleid', '>', 0);
                                })->get();
return view('Manage_users', compact('users'));

A: You are wrong with eloquent, and relationship.
A user belongs to a role, a role has many users.
from user Model:
public function role()
{
   return $this->belongsTo('App\User_role','roleid','id');
}

from user_roles model:
public function users()
{
    return $this->hasMany('App\User','roleid','id');
}

A: you can use following code  in your view.

        User Name
        Role

    @foreach($users as $user)

            {{ $user->username }}
            {{ $user->roles->rolename }}

    @endforeach

Above  code will create the table with username and it's role.
Hope it helps you!

A: Its working after i change my blade like this, Thanks for all
@foreach($users as $user)

        {{ $user->username }}

            @if ($user->roles)
                {{ $user->roles->rolename }}
            @endif

@endforeach


text:
Q: How can I filter rows in a JTable? I have a JTable with many strings in it. I have created a textbox for user entry, above the table. I want a row filter which can remove the rows having strings entered by the user in the text box. Please help me out for this.

A: This few line solution seems to work:
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt)
{
    TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(((DefaultTableModel) jTable1.getModel()));
    sorter.setRowFilter(RowFilter.regexFilter(jTextField1.getText()));

    jTable1.setRowSorter(sorter);
}

A: You can use JTable.setAutoCreateRowSorter which will use the default row sorter/filter of the JTable

A: from here:
sorting and filtering

In the following example code, you
  explicitly create a sorter object so
  you can later use it to specify a
  filter:
MyTableModel model = new MyTableModel();
sorter = new TableRowSorter<MyTableModel>(model);
table = new JTable(model);
table.setRowSorter(sorter);

Then you filter based on the current
  value of a text field:
private void newFilter() {
    RowFilter<MyTableModel, Object> rf = null;
    //If current expression doesn't parse, don't update.
    try {
        rf = RowFilter.regexFilter(filterText.getText(),0);
    } catch (java.util.regex.PatternSyntaxException e) {
        return;
    }
    sorter.setRowFilter(rf);
}

A: To pick up the comment from kd304, you could use GlazedLists. There you'll use a FilterList as the input for your JTable, and the FilterList will take care of the rest.


text:
Q: How can I reveal my site's sub-menu for mobile? I am trying to reveal my sub-menu using jQuery. It is a  rewrite of the code in the image using jQuery.
https://github.com/alwayswantedtocode/xpress-cars-web-dev-
Code I am trying to rewrite using jQuery:

$(document).on("click", ".navigation", function(event) {

  const target = $(event.target),
    mediaSize = 991;
  homeSubList = $(event.target.parentElement),
    revealSubMenu = $(homeSubList).add('.sub-menu');

  if ($(target).attr("data-toggle") && (window.innerWidth <= mediaSize)) {
    $(homeSubList).toggleClass("active");

    $(revealSubMenu.height()) = $(revealSubMenu).prop('scrollHeight') + 'px';
  };
});

A: Here it is:
$(document).on("click",".navigation", function(event){
  const mediaSize = 991;
  if ($(event.target).attr('data-toggle') !== undefined && window.innerWidth <= mediaSize) {
    const menuItemHasChildren = $(event.target).parent();

    $(menuItemHasChildren).addClass('active');
    const subMenu = $(menuItemHasChildren).find('.sub-menu');
    $(subMenu).css('maxHeight', $(subMenu).prop('scrollHeight'));
  }
});


text:
Q: LocationClient seems to stop getting updates I have an application which requires frequent updates to the user's location, and location changes are relevant from a number of Activities within the app. As such, I created a LocationManager class that manages the LocationClient object, listens for updates, and broadcasts the location changes so that any Activity can handle updates as they need to.
However, I'm running into a problem where the updates seem to stop when I change Activities. I noticed the following message(s) appearing when changing Activities:
09-26 11:19:14.854: D/LocationManagerService(735): Location requesting stopped by an application
09-26 11:19:14.854: I/LocationManagerService(735): remove gps (pid 1332), disabled
After that point, it seems that my LocationClient stops getting any further updates. I can call removeLocationUpdates() and then requestLocationUpdates() to restart the request, but my original request no longer functions.
My only idea is that because the main Activity uses a MapFragment (SupportMapFragment, to be precise) which displays the user's location, when I switch Activities that MapFragment likely makes a call to suspend location updates. But that shouldn't affect my requests.
Does anybody have any insight?


text:
Q: Get Relationship Field Value Inside on Repeater going to Another Posts <?php

$related_articles = get_posts(array(
    'post_type' => 'book',
    'meta_query' => array(
        array(
            'key' => 'related_articles', // name of custom field
            'value' => '"' . get_the_ID() . '"',
            'compare' => 'LIKE'
        )
    )
));

if( have_rows('related_articles_repeater') ): // i added this line im not sure about this
    while( have_rows('related_articles_repeater') ) : the_row();

    if( $related_articles ):
        foreach( $related_articles as $article ):

        // Do something to display the articles. Each article is a WP_Post object.
        // Example:

        echo $article->post_title;  // The post title
        echo $article->post_excerpt;  // The excerpt
        echo get_the_post_thumbnail( $article->ID );  // The thumbnail

        endforeach;
    endif;

endwhile;
endif;

?>

Hi guys! Whats wrong did i make? the code work well without repeater. I Wanted to work it with repeater so that i coded but is not working thougt.......................


text:
Q: Spanning of vector space Suppose we have $\beta^\prime=\{\cosh x,\sinh x\}$ and we want to show that this spans the solution vector space of some ODE given by $V=\{e^x,e^{-x}\}$ provided that we know the ODE whose solutions are in $V$, would it be valid to conclude that if the values in $\beta^\prime$ also satisfy the ODE then $\beta^\prime$ spans $V$?

A: The solution space is the set of functions that can be expressed as $Ae^{t} + Be^{-t}$
$Ae^{t} + Be^{-t} = (A+B)\cosh t + (A-B)\sinh t$
Every function in the solution space can be expressed as a vector in the alternate basis.


text:
Q: no such file to load -- action_controller/integration - NoMethodError for Rails 3 and Webrat I'm getting the following failure during RSpec tests..
no such file to load -- action_controller/integration
..using Rails 3, RSpec 2 and Webrat, if I include the Webrat helpers in the following way (the idea was to use Webrat for the have_tag and have_selector methods instead of assert_select).
RSpec.configure do |config|
  ..
  config.include Webrat::HaveTagMatcher
end

Yet apparently Webrat and Rails 3 are not compatible yet. One solution is to avoid the Webrat gem and to use assert_select instead. Has anyone a better solution? How do you avoid the error?

A: I have not found a solution for this problem, only a work around. You can use the have_selector method of Capybara instead of Webrat, at least in RSpec request tests. There are certain difficulties with RSpec2 and Capybara (page.should have_selector only works if you use Capybara's 'visit' method, and not the RSpec method get '/some/path'), but basically it works.


text:
Q: Categorizing multiple entries in QGIS? I am trying to categorize a polygon layer with several buildings, by the number of floors.
I want to aggregate by classes like this way:
1 floor = 1 to 2 floors;
2 floors = 1 to 2 floors;
3 floors = 3 to 4 floors;
4 floors = 3 to 4 floors;
5 floors = 5 to 6 floors;
6 floors = 5 to 6 floors

But by just simply entering the classification/legend I want (by hand) I get this result, which as you can see it duplicates the results:

Do I have to use "Ruled-based" and if so... how?

A: You should use a Rule-based renderer. Following your data, something like that:

Click on the + button for adding a rule and then insert the custom expression (as indicated in the red box above).
Remember also to click on the Apply button for applying the style.


text:
Q: How to ask esper to call update when there's no result in ON-SELECT query, or other clause I want to have a callback whether there are results or not.
The code below aims to find all points in a range.
ON QueryEvent e
SELECT w, e FROM DataRecordWindow w
WHERE w.value>e.begin AND w.value<e.end // between-and
ORDER BY w.value;

If there is no result, there would be no callback to invoke UpdateListener, I hope esper to invoke update with parameter null.
I tried InnerJoin, but the result is same:
SELECT w, e FROM DataRecordWindow w, QueryEvent e UNIDIRECTIONAL
WHERE w.value>e.begin AND w.value<e.end // between-and
ORDER BY w.value;

My third try is:
ON QueryEvent e
SELECT WINDOW(w), WINDOW(e) FROM DataRecordWindow w
WHERE w.value>e.begin AND w.value<e.end // between-and
ORDER BY w.value;

Good, if there are results, return two array, else return two null. Finally, at least, it callback even though there no result.
But i hope it returns me my origin e.

A: Use an outer join or a unidirectional outer join.
SELECT w, e
FROM DataRecordWindow w
  full outer join
  QueryEvent e UNIDIRECTIONAL
WHERE w.value>e.begin AND w.value<e.end // between-and
ORDER BY w.value;


text:
Q: Update remembered value using arguments I have a Composable in which a remembered value (an offset) needs to be updated both by the Composable itself and also from the calling side (using the Composable's arguments) -- how can I achieve this?
In particular, I have the following piece of code. The value I'm talking about is the offset in NavigableBox: I need to both be able to control it by dragging the box and by setting it manually using the value from OffsetInputField which is passed as an argument.
class MainActivity : ComponentActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContent {
            Surface {
                Box {
                    var boxOffset by remember { mutableStateOf(Offset.Zero) }

                    NavigableBox(boxOffset)
                    OffsetInputField { offset ->
                        offset.toFloat().let { boxOffset = Offset(it, it) }
                    }
                }
            }
        }
    }
}

@Composable
fun OffsetInputField(onInput: (String) -> Unit) {
    var value by remember { mutableStateOf("") }

    TextField(
        value = value,
        onValueChange = { value = it },
        keyboardOptions = KeyboardOptions(imeAction = ImeAction.Go),
        keyboardActions = KeyboardActions(onGo = { onInput(value) })
    )
}

@Composable
fun NavigableBox(initOffset: Offset) {
    var offset by remember(initOffset) { mutableStateOf(initOffset) }

    Box(
        modifier = Modifier
            .fillMaxSize()
            .pointerInput(Unit) { detectTransformGestures { _, pan, _, _ -> offset += pan } }
    ) {
        Box(modifier = Modifier
            .size(100.dp)
            .offset { IntOffset(offset.x.roundToInt(), offset.y.roundToInt()) }
            .background(Color.Blue)
        )
    }
}

In the current implementation the dragging works fine until a new value is passed as OffsetInputField's input -- then the box stops responding to dragging. I assume it is because the MutableState object containing the offset changes when gets recalculated and the box doesn't observe it anymore.
I already tried using unidirectional data flow in NavigableBox (passing offset value and onOffsetChange lambda to it, but then dragging doesn't work as expected: the box just jiggles around its initial position, returning back to it when the gesture stops.
In case anyone interested, I'm developing an app where the draggable box is a map, and the text field is used for searching objects on it: the map is moved to be centered on an object entered.

A: pointerInput captures all the state variables used inside. With new initOffset you're creating a new mutable state, but pointerInput keeps updating the old reference.
You need to restart it by passing the same value(s) to key:
pointerInput(initOffset) { /*...*/ }


text:
Q: JSON Decode Error in python while using Requests module base_url = "https://github.com/statsbomb/open-data/tree/master/data/"

comp_url =  base_url + "matches/{}/{}.json"
match_url = base_url + "events/{}.json"

This is the link containing the data.
I've used a function to parse different types of data in it
def parsing_data(comp_id,season_id):
    matches = requests.get(url= comp_url.format(comp_id,season_id)).json()
    match_ids =  [m['match_id'] for m in matches]

    for id in match_ids:
        events = requests.get(url= match_url.format(id)).json()
        shots = [x for x in events if x['type']['name'] == 'Shot']

        all_events = []
        for s in shots:
            attribute = {
               'Match_ID' : id,
               'Team' : s['possession_team']['name'],
               'Player': s['player']['name'],
               'Minute': s['minute'],
               'X_shot': s['location'][0],
               'Y_shot': s['location'][1],
               'Shot_with': s['body_part']['name'],
               'Outcome': s['outcome']['name']
            }
            all_events.append(attribute)

    return pd.DataFrame(all_events)

But i get an JSONDecodeError: Expecting value: line 6 column 1 (char 5) lie this when i call the function,
comp_id = 43
season_id = 3

df = parsing_data(comp_id,season_id)

Can anyone help me with this ?

A: The base_url needs to be changed to get the raw Json content, also there were two errors in Shot_with and Outcome.
This script:
import requests
import pandas as pd

# changed the base_url to get raw content:
base_url = "https://raw.githubusercontent.com/statsbomb/open-data/master/data/"

comp_url =  base_url + "matches/{}/{}.json"
match_url = base_url + "events/{}.json"

def parsing_data(comp_id,season_id):
    url = comp_url.format(comp_id,season_id)
    matches = requests.get(url=url).json()
    match_ids =  [m['match_id'] for m in matches]

    for id in match_ids:
        events = requests.get(url= match_url.format(id)).json()
        shots = [x for x in events if x['type']['name'] == 'Shot']

        all_events = []
        for s in shots:
            attribute = {
               'Match_ID' : id,
               'Team' : s['possession_team']['name'],
               'Player': s['player']['name'],
               'Minute': s['minute'],
               'X_shot': s['location'][0],
               'Y_shot': s['location'][1],
               'Shot_with': s['shot']['body_part']['name'], # <-- added 'shot'
               'Outcome': s['shot']['outcome']['name']      # <-- added 'shot'
            }
            all_events.append(attribute)

    return pd.DataFrame(all_events)

comp_id = 43
season_id = 3

df = parsing_data(comp_id,season_id)
print(df)

Prints:
    Match_ID     Team                     Player  Minute  X_shot  Y_shot   Shot_with  Outcome
0       8656  England            Kieran Trippier       4    96.0    43.0  Right Foot     Goal
1       8656  England              Harry Maguire      13   111.0    37.0        Head    Off T
2       8656  Croatia               Ivan Perišić      18    94.0    20.0  Right Foot    Off T
3       8656  Croatia                 Ante Rebić      20    98.0    41.0   Left Foot  Blocked
4       8656  Croatia               Ivan Perišić      22    87.0    26.0  Right Foot    Off T
5       8656  Croatia                 Ante Rebić      31   101.0    50.0   Left Foot    Saved
6       8656  England              Jesse Lingard      35   102.0    41.0  Right Foot    Off T
7       8656  England  Raheem Shaquille Sterling      36   104.0    52.0   Left Foot  Blocked
8       8656  Croatia              Šime Vrsaljko      42    88.0    51.0  Right Foot    Off T
9       8656  England              Jesse Lingard      55    96.0    45.0   Left Foot  Blocked
10      8656  Croatia               Ivan Rakitić      60    97.0    34.0   Left Foot    Off T
11      8656  Croatia               Ivan Perišić      64   103.0    41.0  Right Foot  Blocked
12      8656  England                 Harry Kane      66   118.0    56.0  Right Foot    Off T
13      8656  Croatia               Ivan Perišić      67   114.0    40.0   Left Foot     Goal
14      8656  Croatia               Ivan Perišić      71   112.0    30.0   Left Foot     Post
15      8656  Croatia                 Ante Rebić      71   111.0    44.0   Left Foot    Saved
16      8656  Croatia           Marcelo Brozović      72    98.0    48.0  Right Foot    Off T
17      8656  England              Jesse Lingard      76   115.0    55.0  Right Foot  Wayward
18      8656  England     Jordan Brian Henderson      77    95.0    45.0  Right Foot    Off T
19      8656  Croatia            Mario Mandžukić      82   113.0    52.0  Right Foot    Saved
20      8656  Croatia               Ivan Perišić      83   113.0    24.0  Right Foot    Off T
21      8656  Croatia               Dejan Lovren      89    89.0    57.0  Right Foot    Off T
22      8656  England                 Harry Kane      91   113.0    33.0        Head    Off T
23      8656  England                  Eric Dier      97    92.0    51.0  Right Foot  Blocked
24      8656  England                John Stones      98   113.0    49.0        Head  Blocked
25      8656  Croatia            Andrej Kramarić     101   106.0    58.0   Left Foot  Blocked
26      8656  Croatia            Andrej Kramarić     105   101.0    34.0   Left Foot  Blocked
27      8656  Croatia            Mario Mandžukić     106   114.0    39.0  Right Foot    Saved
28      8656  Croatia           Marcelo Brozović     107   111.0    27.0   Left Foot    Off T
29      8656  Croatia            Mario Mandžukić     108   114.0    33.0   Left Foot     Goal
30      8656  Croatia               Ivan Perišić     113   107.0    32.0   Left Foot  Blocked
31      8656  Croatia           Marcelo Brozović     115    97.0    22.0  Right Foot    Saved
32      8656  Croatia            Andrej Kramarić     119   109.0    52.0  Right Foot    Off T

A: You have taken the GitHub link, you have to take the link of GitHub file raw data like

https://raw.githubusercontent.com/statsbomb/open-data/master/data/

And another thing is, you have to use requests.get(url="").content to retrieve the data.
And one more is the data body_part & outcome are in shot.
It can be converted to JSON object by using json.loads(string)

Then you can write the code as
import requests
import pandas as pd
import json

base_url = "https://raw.githubusercontent.com/statsbomb/open-data/master/data/"

comp_url =  base_url + "matches/{}/{}.json"
match_url = base_url + "events/{}.json"

def parsing_data(comp_id,season_id):
    matches = json.loads(requests.get(url=comp_url.format(comp_id,season_id)).content)
    match_ids =  [m['match_id'] for m in matches]

    for id in match_ids:
        events = requests.get(url= match_url.format(id)).json()
        shots = [x for x in events if x['type']['name'] == 'Shot']

        all_events = []
        for s in shots:
            attribute = {
               'Match_ID' : id,
               'Team' : s['possession_team']['name'],
               'Player': s['player']['name'],
               'Minute': s['minute'],
               'X_shot': s['location'][0],
               'Y_shot': s['location'][1],
               'Shot_with': s['body_part']['name'],
               'Outcome': s['outcome']['name']
            }
            all_events.append(attribute)

    # return pd.DataFrame(all_events)

comp_id = 43
season_id = 3

df = parsing_data(comp_id,season_id)

Thank you


text:
Q: Get output of external console app to RichTextBox I used the VB.Net Shell() command to start a console app that I haven't created. I want to get the lines from that console to a RichTextBox in my form. It should be possible because I have seen many apps that do this. Please provide some information or any program that might help me. I tried to see if the external app creates log files, but it does not.
Here's how I started. What should I add, and where, to return the output?
Try
        writer.WriteLine(RichTextBox1.Text)
        writer.Close()
        Shell(CurDir() & "\yelloeye.exe .\new.demo")
Catch ex As Exception
        MsgBox(ex.Message)
End Try

A: Here's an example using the RedirectStandardOutput property as mentioned by @Plutonix which will ping SO and display the results in a RichTextBox. Just replace the .exe name and arguments (if any) to suit your needs.
Private Sub ShellToRTB()
    Dim p As New Process()
    p.StartInfo.FileName = "ping.exe"
    p.StartInfo.Arguments = "www.stackoverflow.com"
    p.StartInfo.UseShellExecute = False
    p.StartInfo.RedirectStandardOutput = True
    p.Start()
    RichTextBox1.Text = p.StandardOutput.ReadToEnd()
    p.WaitForExit()
End Sub

Result:


text:
Q: ios5 - "EXC_BAD_ACCESS" when clicking button I am a total beginner to Objective C.
Currently I try to display a view in my main window. This view contains a button. For some reason by clicking this button xcode throws an error.
Hopefully you can help me to understand what I am doing wrong.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];

    BtnView *btn = [[BtnView alloc] init];
    [self.window addSubview:btn.view];
    [self.window makeKeyAndVisible];

    return YES;
}

The viewController of my button view has an action for recognizing a  touch up event
h file:
- (IBAction)touched:(id)sender;

and in the m file
- (IBAction)touched:(id)sender {
    //actions ...
}

By touching the button I get the following error:

Whats wrong?
m file:

h file:

A: I assume you have ARC enabled for this project.
When you return from didFinishLaunchingWithOptions: the object assigned to btn will be released since you assign it to a local variable that is only defined within that method.  Make BtnView *btn a strong property of your class and it should stay around to handle the button presses.  (Remember to use self.btn in references to it.)
(But, I'm curious, why not just put the button on your main view in the first place and then not worry about an extra controller and subviews?)

A: - (IBAction)touched

try without using sender

A: In .xib file, you can hook up the button to file's owner.
1) Right Click on button. Then one window will be appeared. You can see Touch Up Inside in that window and click on small circle and drag to file's owner and connect to touched. I think it will be helpful to you.

A: Is there any specific reason why do you need the whole UIViewController to be a button? The conventional way to do this would be to have the UIViewController as a controller and than put a UIButton as a subview to its view in the viewDidLoad method, hook it up to the desired methods and even have it across the whole screen if you need. In case you need to customize the appearance, you can do that with UIButton too.


text:
Q: Rebuilding a MySQL database after reinstalling XAMPP EDIT: Nbk suggested stackoverflow.com/a/46970116/5193536 which looked pretty good if I had not accidentally deleted one of the relevant files!
=========================================================================
I am on day 2 after my main notebook died. Installed XAMPP on a spare machine and all working until suddenly XAMPP refused to run MySQL. Tried various things then admitted defeat and installed new version XAMPP.
I found this migrating MySQL guide and thought it might work but copying over the  ib_logfile 0 or  ibdata1 caused the start up to fail.
I still have the folder of my database available but these control files will not gel.
Is there any way of rebuilding from just the folder in the mysql\data directory? I expect not.
If not it was a pretty small DB so should take less than 90 mins to rebuild. But, having spent well over 4 hours reinstalling reconfiguring and trying to repair I would just like to see if I can fix the bloomin thing!


text:
Q: how to get all building names within a range from a given gps coordinates in postGIS? im making a panorama viewer, connected to a postgres db, I need to download building names, street names, interest points within a given range.
I really appreciate if you could shed some light on this matter.
Regards,

A: As you did not give us some table specifications, an artificial example will have to do.
WITH yourpoint AS (
    SELECT
        st_transform(st_setsrid(st_makepoint(yourlon, yourlat), 4326), yourgeomsrid) AS point
)
SELECT
    building.name
FROM
    building, yourpoint
WHERE
    ST_Dwithin(building.the_geom, yourpoint.point, 400)

Now, let's have a look at the interesting parts. At first we need a geometry to accomodate your given point in the correct coordinate system. I created a substatement (CTE) that generates such a point. Maybe the point is within your database, though.
Important: For calculating distances, the point you specify and the geometries have to be in the same coordinate system. Thus, I encapsulated the st_makepoint with st_setsrid, which adds coordinate system information to the point. GPS usually is in WGS84 which has SRID 4326. Now, we have to transform that point to the coordinate system of your point data - the SRID therefore you have to know.
All the magic for finding the buildings close by happens in the WHERE clause. ST_Dwithin looks up all geometries that have a distance of less than 400 (measured in the unit of your coordinate system) to each other.
See the postgis manual for details.

EDIT
If your coordinates are in WGS84, you should use the geography datatype:
WITH yourpoint AS (
    SELECT
        geography(st_setsrid(st_makepoint(yourlon, yourlat), 4326)) AS point
)
SELECT
    building.name
FROM
    building, yourpoint
WHERE
    ST_Dwithin(Geography(building.the_geom), yourpoint.point, 400)

A: Try
select * FROM
    LayerName
WHERE
    ST_Dwithin(LayerName.the_geom,
    GeomFromText('POINT(x,y)',-1)
    , radius)

layerName is your layer,
x,y from GPS,
-1 is your srid,
radius is radius of your buffer(double)


text:
Q: Can't find variable: Button - React Native I am trying to create a simple app with a button in react native, but so far every time I run my code, it gives me an error saying "Can't find variable: Button". I would like to end up with my title at the top (Already done) and a button in the center of the screen, which gives an alert when touched.
I have run through several online tutorials and cannot find a solution.
Here is my code:
        /**
     * Sample React Native App
     * https://github.com/facebook/react-native
     * @flow
     */

    import React, { Component } from 'react';
    import {
      AppRegistry,
      StyleSheet,
      Text,
      View
    } from 'react-native';

    class Project extends Component {
      render() {
        return (
          <View style={styles.container}>
           <Text style={styles.Title}>
             Lucas's App
            </Text>
           <View style={styles.buttonContainer}>
             <Button
               onPress={() => { Alert.alert('You tapped the button!')}}
               title="Press Me"
             />
            </View>
          </View>
        );
      }
    }

    const styles = StyleSheet.create({
      container: {
        flex: 1,
        backgroundColor: '#F5FCFF',
        },
      Title: {
        color: '#000000',
        marginTop: 13,
        paddingLeft:100,
        paddingRight:100,
        fontFamily: 'Avenir',
        fontSize: 30,
      },
        buttonContainer: {
        margin: 20
      },

    });

    AppRegistry.registerComponent('Project', () => Project);

Thanks in advance.

A: You need to make sure to import the button.
You can do this by adding 'button' to your import list:
     import {
      AppRegistry,
      StyleSheet,
      Text,
      View,
      Alert
      Button,

    } from 'react-native';


text:
Q: Where are the Visual Studio 2013 keybindings kept They should be in currentsettings.vssettings and if I do an export settings they should be in the exported file but all I see in the vssettings file to with the keyboard is this -
<KeyboardShortcuts Version="8.0">
    <ShortcutsScheme>Visual C++ 6</ShortcutsScheme>
</KeyboardShortcuts>

Am I looking in the wrong place? Is it because I happened to start with the VC6 settings that it's decided not to store them here? They're certainly stored somewhere.

A: Did you use the links provided by Google to see if you looked in the right place?

By default, your shortcuts are saved in a file in the %USERPROFILE%\Documents\Visual Studio 2013\Settings folder. The name of the file reflects the date when you exported the settings, and the extension is .vssettings.

That was quoted from the article (referenced below), which also teaches you how to export keyboard shortcuts under "Sharing Custom Keyboard Shortcuts"
Reference link: MSDN
Here's what I have in my VSSettings that are related to shortcuts:

<KeyboardShortcuts>
            <DefaultShortcuts/>
            <ScopeDefinitions>
                <Scope Name="VC Dialog Editor" ID="{543E0C02-8C85-4E43-933A-5EF320E3431F}"/>
                <Scope Name="UML Class Diagram" ID="{FE170F05-DE3A-4067-A3ED-08AE56B31DB3}"/>
                <Scope Name="Data Generator" ID="{D3936010-2B3A-4B8E-82D1-F4DCE3B5F898}"/>
                <!--Other shortcuts -->
            </ScopeDefinitions>
            <ShortcutsScheme/>
            <UserShortcuts/>
        </KeyboardShortcuts>

Also, welcome to SO!


text:
Q: When extending the natural numbers to the integers when is it legal to set a natural number equal to an integer. My source BBFSK
I need to add that natural numbers in this context are defined as starting with 1.  I didn't think that would impact the answer, but apparently it does. $n-0$ provides a "bridge" between the integers and the natural numbers.
This question pertains to the extension of the natural numbers to the integers.  The expression $a-\bar{a}$ is not yet called subtraction.
Given the arbitrary natural numbers $a$ and $\bar{a},$ the expression
$a-\bar{a}$ is defined to be the solution of the equation
$$
a=x+\bar{a}, \tag{1}
$$
and is called an integer. In the case where $a>\bar{a},$ we could
just as well say that $x$ is a natural number.  We were able to do that before contemplating integers.  It was the case where $a<\bar{a}$ that induced us to extend the domain of numbers.
Our goal is to show that certain integers are equal to natural numbers.
To this end we define equality between integers and natural numbers
by setting
\begin{equation}
\left(c+\bar{a}\right)-\bar{a}=c\text{, and }c=\left(c+\bar{a}\right)-\bar{a}, \tag{2}
\end{equation}
with the stipulation that these and only these equations are to hold
between natural numbers and integers. Reflexivity remains unaffected
by this definition, but to show comparability, that is
$$
\alpha=\gamma\land\beta=\gamma\implies\alpha=\beta,
$$
we must show it holds for all cases of $\alpha,\beta,\gamma$ as integers
or natural numbers. In total there are eight such cases. The two cases
in which all three variables are of the same kind have already been
dispensed with. Due to the defined symmetry of (2) we need not treat
the two cases which arise from another by substituting $\alpha$ with
$\beta$.
The first of the remaining four cases is
$$
\alpha=a\in\mathbb{N},\beta=b-\bar{b},\gamma=c-\bar{c}\in\mathbb{Z}.
$$
This is where things get a bit murky for me.
First we treat $\alpha=\gamma,$ which written explicitly is $a=c-\bar{c}.$
But we are required to somehow relate this to (2). So, perhaps we
should write $a=\left(a+\bar{c}\right)-\bar{c}.$ Here I'm not sure
what is legal. It seems that since we have asserted $a$ to be a natural
number, we should be free to set
$$
\left(a+\bar{c}\right)-\bar{c}=c-\bar{c}.
$$
Since both sides are known to be natural numbers dressed up like integers.
Is that permissible?
Also, since $a=c-\bar{c}$ is defined to be the solution of the equation
$c=a+\bar{c},$ and $a$ is a natural number, it follows from the
definition of $>$ for natural numbers that $c>\bar{c}.$ It therefore
seems reasonable that we could immediately conclude that $a=c-\bar{c}\in\mathbb{N}\implies c=a+\bar{c}$
without explicitly appealing to (2). But that feels like cheating.
Is it cheating?
The gist of my question seems  to boil down to: given the definition (from the book) of equivalence between an integer and a natural number:
$$\left(c+\bar{a}\right)-\bar{a}=c\text{, and }c=\left(c+\bar{a}\right)-\bar{a},$$
how does the result (from the book) $a=c+\bar{a}$ follow?
Notice that $a$ does not appear in the above definition.  The only clue I have as to where $a$ comes from is that every prior appearance of $\bar{a}$ is in the pair $\left(a,\bar{a}\right)$ used in the mapping $\left(a,\bar{a}\right)\to{a-\bar{a}}.$  Apparently I am expected to look at $\left(c+\bar{a}\right)$ and see $a$.
The nature of BBFSK is that such conclusions are often left to the reader.

A: EDIT: The issue with $0$ is trivial. If we don't want to consider $0$ as a natural number, just replace $(n,0)$ with $(n+1, 1)$ everywhere below. $0$ provides a convenient, but inessential, bridge from $\mathbb{N}$ to $\mathbb{Z}$, and we can easily do without it.
(In my opinion we shouldn't omit $0$ - in particular I don't think history always matches up with the ideal, and this is a case in point: although $0$ was a relatively late introduction, I think it definitely should be included in the naturals - but this doesn't matter mathematically.)

Aside: I'm going to phrase things in terms of reflexivity-symmetry-transitivity rather than reflexivity-comparativity, since that's the more common language in my experience.
I think this is made more mysterious than it needs to be due to the phrasing of the definitions. Ultimately you're overloading the symbol "$=$," and this leads to a sense of slipperiness.
Instead, the right approach in my opinion is (something like) the following:

*

*First, we define a pre-integer to be a pair $(a,b)\in\mathbb{N}$. Intuitively my $(a,b)$ is your $a-b$, and my pre-integers are your integers, but $(i)$ using ordered pairs avoids suggestive (and worrying) notation and $(ii)$ I'm going to reserve "integer" for the resulting equivalence classes (see next point).

*Second, we define an equivalence relation between pre-integers as follows: $$(a,b)\sim (a',b')\iff a+b'=b+a'.$$ This avoids overloading "$=$," and puts everything in terms of already-understood operations on naturals (so no mixing naturals and integers as such). We now say that integers are $\sim$-classes of preintegers.

*

*... Of course, that presupposes that $\sim$ is in fact an equivalence class, but that's easy to prove:

*

*Reflexivity: If $a=a'$ and $b=b'$ then $a+b'=a+b=a'+b$.

*Symmetry: If $a+b'=a'+b$ then $a'+b=a+b'$.

*Transitivity (the only nontrivial one, and a large part of what you're asking): Suppose $(a,b)\sim(a',b')$ and $(a',b')\sim (a'',b'')$; we want to show $(a,b)\sim (a'', b'')$, which amounts to showing that $a''+b=a+b''$. To do this, consider the (trivially true) equation $$a+a'+a''+b+b'+b''=a+a'+a''+b+b'+b''.$$ This converts to $$(a+b')+(a'+b'')+(a''+b)=a+a'+a''+b+b'+b'',$$ and we can simplify the left hand side using our assumptions to get $$(a'+b)+(a''+b')+(a''+b)=a+a'+a''+b+b'+b''$$ or better yet $$[a'+a''+b+b']+(a''+b)=[a'+a''+b+b']+(a+b'').$$ Now cancelling appropriately - remembering that cancellativity is a property of natural numbers which we already know, despite its "subtraction-y" flavor - we get $$a''+b=a+b'',$$ which is what we wanted. (Also note that I've used associativity of addition of naturals a couple times above; again, this is fine since associativity of addition of naturals is something we've presumably already established.)

*Finally, again avoiding overloading "$=$" we say that a natural $n$ is equivalent to the integer $[(a,b)_\sim]$ if and only if $(a,b)\sim(n,0)$ (technically I need to show that this definition is well-defined, but that's trivial). The point is that your eight cases don't emerge since we've defined the embedding of naturals into integers after establishing the integers "on their own."

*And the approach above also makes it completely straightforward to compare operations on integers with the corresponding operations on naturals. For example, we define addition of pre-integers as $(a,b)\underline{\oplus} (c,d)=(a+c,b+d)$. We can show quite easily that if $(a,b)\sim (a',b')$ and $(c,d)\sim(c',d')$ then $(a,b)\underline{\oplus}(c,d)\sim(a',b')\underline{\oplus}(c',d')$, and so $\underline{\oplus}$ extends to a well-defined binary operation $\oplus$ on integers. Basic properties of $\oplus$ are now easy to establish, e.g. commutativity comes from the "mod $\sim$" version of the trivial pre-integer identity $$(a,b)\underline{\oplus}(c,d)=(a+c,b+d)=(c+a,d+b)=(c,d)\underline{\oplus}(a,b).$$

A: I think this is the correct answer.
In order to keep track of what is certainly a natural number and what may or may not be a natural number I use a Roman font for the unknown in $a=\mathrm{c}+\bar{a},$ where the relative order of $a$ and $\bar{a}$ is unspecified. We have defined the solution to be $\mathrm{c}\equiv a-\bar{a},$ which is an element of our extended domain.
We assert that our commutative, associative and cancellation laws of addition developed in $\mathbb{N}$ are valid in the extended domain. Applying these to a bit of minor algebraic acrobatics give the following
$$a=\mathrm{c}+\bar{a}=\left(a-\bar{a}\right)+\bar{a}\text{, and}$$
$$\mathrm{c}=\left(\mathrm{c}+\bar{a}\right)-\bar{a}=a-\bar{a}.$$
Which includes the form used in the definition of equality between integers and natural numbers. But in the case where $c$ is a natural number, we don't use the Roman font. In this case all of the variables are natural numbers. Beginning with the definition and working backwards
$$c=\left(c+\bar{a}\right)-\bar{a}=a-\bar{a}\text{, and}$$
$$a=c+\bar{a}\text{. So}$$
$$c=\left(c+\bar{a}\right)-\bar{a}\iff c=a-\bar{a}\iff a=c+\bar{a}.$$


text:
Q: Angularjs Large File (~800MB) Download : $http post resolves 200 OK, but does not show download dialog until response is downloaded I have a large file to download (~800MB) from my Server, a jersey REST API which returns a 'response' object on POST method.
I have the code working on client (browser/javascript) to download the file using Angularjs $http service to invoke the POST method on the API.
However, what I see is that the download dialog on the browser (firefox) shows up only after the response is completely downloaded. It does not show the download dialog at the beginning of the file download and I keep the user waiting for almost 3-4 mins for the dialog to turn up :( which is not intended
Here is my Jersey API Response,
        @POST
        @Path("downloadFile")
        @Consumes(MediaType.APPLICATION_JSON)
        public Response downloadFile(StorageInputs storageInputs) {
            StorageHelper storageHelper=new StorageHelper(storageInputs);
            String file = (String) storageInputs.getAdditionalProperties().get("storage_file");
            return storageHelper.downloadFile(file);
        }

My View has the below

My Javascript has,
                $scope.downloadFile = function (file) {
                var server = "http://localhost:8080/myserver/myapi";
                var fileName = file.split("/").pop();
                var body = { "storage_file": file};

                $http({
                        method: 'POST',
                        url: server + "/downloadFile",
                        headers: {'Content-Type': 'application/json'},
                        data: body,
                        responseType: 'blob'
                    })
                    .then(function successCallback(response) {
                    var contentType = response.headers('content-type');
                    console.log("Headers Content-Type=" + contentType);
                    console.log("Headers Content-Length=" + response.headers('Content-Length'));
                    console.log("Headers ETag=" + response.headers('ETag'));

                    var blob = new Blob([response.data], {type: contentType});
                    FileSaver.saveAs(blob, fileName);

                }, function errorCallback(response) {
                    console.log("Error Status = " + response.status);
                    console.log("Error = " + response.data);

                });
            };

On the Browser Developer Tools, I see,
POST call shows 200OK but waits for the response to be downloaded for 3 mins, and then shows the download dialog for the user asking for "Save or Open" the file.
Also, the console.log above for the headers in the response are printed at the end after the response is downloaded and before the download dialog is shown.
Is there a way I can ensure the download dialog ("save or Open") can be shown before the response is downloaded?


text:
Q: GitHub Pages Deployment Failure with my DocC project I'm trying to push DocC to my GitHub Pages, I'm following tutorials on DocC documentation.
What I'm done till now is in my SPM directory I'm using these commands in terminal:

*

*xcodebuild docbuild -scheme (schema-name) -derivedDataPath (doccarchive-file)
-destination 'platform=iOS Simulator,name=(simulator name)'

*$(xcrun --find docc) process-archive transform-for-static-hosting (doccarchive-file)
--output-path (docs-directory in my project) \
--hosting-base-path (https://rezamagnet.github.io/RKBreadCrumb here I just using RKBreadCrumb)

and source of GitHub Pages is main branch and docs directory.
so everything works with these commands and I get my doccarchive and pushing it to my repository but GitHub gives me a failure, when I click on failure message it shows me this:

here is my GitHub repository link

A: I follow up the failure reason in this path:
Jobs -> build from Actions tab  on my GitHub repository
I noticed I'd added a Dependency but after that I removed that, but don't removed git cache that cause my problem.
I check this command on my terminal:
git submodule status

I notice there is an error in there, so I clear cache in my worktree:
git rm -r --cached .
then push again, and everything works well.


text:
Q: How to solve VBA error Subscript out of range I tried to find which rows have cell value in Column A matches one of the cell values in another column in the same worksheet.
I got error

Subscript out of range

and don't know why this occurs.
Here is the code:
Sub test()
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim FoundCell As Range
    Set wb = ActiveWorkbook
    Set ws = ActiveSheet
    Dim colA As Variant, rowArr() As Variant, ub As Long, Counter As Long, j As Long, i As Long, Num As Variant
    colA = ws.UsedRange.Columns("A").Value2
    ub = UBound(colA)

    j = 1
    For Counter = 1 To ub
        Num = ws.Cells(Counter, 1).Value
        If Not IsError(Application.Match(Num, ws.Columns(6), 0)) Then
            rowArr(j) = Counter
            j = j + 1
        End If
    Next Counter

    ReDim Preserve rowArr(1 To j - 1)

    For i = 1 To j
        With ws.Range("A" & rowArr(i) & ":B" & rowArr(i))
            .Font.Size = 12
            .Font.Shadow = True
        End With
    Next
End Sub

The error occurs in the line rowArr(j) = Counter. Anyone knows what's the problem?
Thanks in advance!

A: You need to redim your array before you populate values:
j = 1
For Counter = 1 To ub
    Num = ws.Cells(Counter, 1).Value
    If Not IsError(Application.Match(Num, ws.Columns(6), 0)) Then
        ReDim Preserve rowArr(1 To j)
        rowArr(j) = Counter
        j = j + 1
    End If
Next Counter


text:
Q: Can i change the position of an item in an object.(Javascript) I have an object as
const details = {
  firstName: "Priya",
  age: 26,
  class: 12,
  Address: "UP",
  lastName: "Kumari"
}

Can I position the "lastName" key just after the "firstName" so that the new created object is :
const updated = {
  firstName: "Priya",
  lastName: "Kumari",
  age: 26,
  class: 12,
  Address: "UP"
}

I tried few methods but read that positioning of object items is not possible

A: Try converting the object to an array and then use the splice() function

A: You can create a new object, say newDetails based on the properties of the details object. We can use destructuring to get the firstName, lastName and all other properties. We'd then create the new object from these.
It's worth noting that we shouldn't rely too much on the order of object properties, since this can change.

const details = { firstName: "Priya", age: 26, class: 12, Address: "UP", lastName: "Kumari"};

const { firstName, lastName, ...otherDetails} = details;

const newDetails = { firstName, lastName, ...otherDetails };

console.log('New details:', newDetails)
.as-console-wrapper { max-height: 100% !important; }


text:
Q: Git, incorrect path (missing /'s) to bare repo that was cloned I am trying to determine the best practice for creating a bare repo on a local shared drive and pushing to that repo from local users.  This is surprisingly not well documented or I have a bug.
The OS is Win10 and I've installed git2.23.0-64. The simplest and most reliable way I have found is to create a repo, add some file, and commit. Then convert it to a bare repo and clone it. This works smoothly every time. When I try to start with a a bare repo I run into problems.
You get the warning that you have cloned a bare repo which I have read I am to ignore. I can add a file to the remote and commit but when I try to push it back to the bare repo the path is incorrect.  For some reason it is stripping out the path separators and I get the following message:
fatal: 'C:UsersLocalUserDocumentsGITBARE' does not appear to be a git repository.
fatal: Could not read from remote repository

When I specify an arbitrary path it works.C:\Users\LocalUser\Documents\GIT\BARE
Is this a known windows bug or did I do something wrong?  Originally I thought this was a Git Gui problem but it happens in the command line as well.  In the config file I noticed the URL is missing the path separators so I added / and that seems to have fixed it.  I've spent way to much time on this so any advice is appreciated.

A: After more fiddling I determined the problem is with Git Gui because I can get it to work in Git Bash with either of the two following path formats:
git clone C:/Users/SomeUser/Documents/GIT/REPOS/BARE
git clone /c/Users/SomeUser/Documents/GIT/REPOS/BARE

But even in Git Bash this format causes problems.
git clone C:\Users\SomeUser\Documents\GIT\REPOS\BARE


text:
Q: SELECT LAST_INSERT_ID() works in Direct MySQL Query but not intermittently PHP QUERY (Baring in mind when I wrote this it works for a MSSQL database no problems, and now I'm writing the same thing for MySQL using SELECT LAST_INSERT_ID() instead of @SCOPE_IDENTITY)
I have a piece of code that enters a company and then the client details for that company. The first SELECT LAST_INSERT_ID() works fine for inserting the company_id from the companies table to the clients table but then throws an error to retrieve the client_id.
Here's the code:
    //// Set initial SQLs
$SQLINSERTCOMPANY = "insert into companies(company_name,is_organisation,company_regno,company_url,is_active,entry_date)
            VALUES ('$company_name',$is_organisation,'$company_regno','$company_url',1,'$entry_date');";

$SQLINSERTCOMPANYDETAILS = "insert into clients (client_name,client_tel,client_mobile,client_email,client_usern,client_pwdx,mailing_list,savedsession,salt,company_id)
            VALUES ('$client_name','$client_tel','$client_mobile','$client_email','$client_email','$psw',$sign_up,'$PHPSESSIONID','$salt'";

$SQLUPDATECOMPANY = "update clients
        set company_name = '$company_name',
        is_organisation = $is_organisation,
        company_regno = '$company_regno',
        company_url = '$company_url',
        is_active = 1,
        entry_date = '$entry_date' ";

$SQLUPDATECOMPANYDETAILS = "update clients
            set client_name = '$client_name',
            client_tel = '$client_tel',
            client_mobile = '$client_mobile',
            client_email = '$client_email',
            client_usern = '$client_email',
            client_pwdx = '$psw',
            mailing_list = $sign_up,
            savedsession = '$PHPSESSIONID' ";

////get the cart for later use if the cart has items
$cart = $_SESSION['cart'];
if($cart){
    $strSQL = "select *
        from category_items
        where category_item_id IN ($cart) order by category_items.item_code;";
    $query_get_value = mysql_query($strSQL) or die ('query failed ' . mysql_error());
}

///// add a new client here
if($_POST['action'] == "add"){

    ////// Insert new company or just update the details
    if($no_of_client_entry == 0) {

        ////// update clients
        $strSQL1 = $SQLINSERTCOMPANY;

        ////// Insert Client Details
        $strSQL2 = $SQLINSERTCOMPANYDETAILS . ",(SELECT LAST_INSERT_ID())); SELECT LAST_INSERT_ID() as NEWID;";

        $sent_to = $client_email;
        $headers = "MIME-Version: 1.0" . "\r\n";
        $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
        $headers .= "FROM: TheImageLounge<no-reply>";
        $subject = "Welcome to The Image Lounge";
        $message = "<title>Error Report</title>";
        $message .= "";
        $message .= "";

        $message .= "
Welcome to Website... TBC/p>";
        $message .= "
Your Details Are:
";
        $message .= "
Your username: $client_email
";
        $message .= "
Your password: " . $_SESSION['client_psw'] . "
";
        $message .= "
We hope that you will enjoy using our website.
";
        $message .= "
Thank You and best regards,
";
        $message .= "
The Website.
";
        $message .= "";

        $sentOK = mail($sent_to,$subject,$message,$headers);

    } else { ///// just update the client details

        $client_id = $clients_rows['client_id'];

        ////// update clients
        $strSQL1 = $SQLUPDATECOMPANY . " where client_id = $client_id;";

        ////// Insert Client Details
        $strSQL2 = $SQLUPDATECOMPANYDETAILS . " where client_id = $client_id; SELECT client_id as NEWID from clients where client_id = $client_id;";

    } ///// End if
    ///echo $strSQL2;
    ///// Run transactions

    echo $strSQL1 . "
";
    echo $strSQL2;

    $query_insert_client = mysql_query($strSQL1) or die('' . mysql_error());
    $query_insert_clients = mysql_query($strSQL2) or die('' . mysql_error());

    $last_client = mysql_fetch_assoc($query_insert_clients);
    $client_id =  $last_client['NEWID'];
    mysql_free_result($query_insert_clients);

Now when I output the SQL it looks like this:
insert into companies(company_name,is_organisation,company_regno,company_url,is_active,entry_date) VALUES ('Individual',0,'','',1,'2011-06-08 14:16:33');

insert into clients (client_name,client_tel,client_mobile,client_email,client_usern,client_pwdx,mailing_list,savedsession,salt,company_id) VALUES ('Andis','0777','','andrew@com','andrew@com','6be86ab8355979352cdd28bbe7026be71a196936fc1ab0c315629f68c0d5f9162acd20b201a27d0ced0cfd53a8e880a1e8bf3714833ed9c4cbe6d0fe3bf15ca0',0,'8730dfec5ce01b315e1a31007185c486','SALTYDOG',(SELECT LAST_INSERT_ID())); SELECT LAST_INSERT_ID() as NEWID;

But then I get this error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; SELECT LAST_INSERT_ID() as NEWID' at line 2

If I copy and paste the outputted SQL into MySQL it works fine. So I am not sure what why this fails on the second query. This works fine when working with MSSQL database.
Any help would be grateful.
thanks
andi

A: you are trying to send multiple queries in one go. from the docs:
mysql_query() sends a unique query (multiple queries are not supported)
you might also want to consider using the mysql_insert_id function instead of issuing a manual query: http://www.php.net/manual/en/function.mysql-insert-id.php

A: error:

 1. u did not close the insert tag

just do simple change
$addorder = "INSERT INTO table_name ()
                        VALUES  ()";
$id = "SELECT LAST_INSERT_ID() as new_id";
mysql_query($addorder) or die("not added in to the orders db:
".mysql_error()."
".$addorder."
");
echo($id);

A: You can not run 2 queries at the same time with mysql_query()
You can however do it with PDO.
To achieve your goal you could completely drop SELECT LAST_INSERT_ID() as NEWID and use mysql_insert_id()

A: SELECT LAST_INSERT_ID() is a query that runs in mysql, but php only allows you to run one query at a time, thus running the SELECT LAST_INSERT_ID() within your query does not work.
my suggestion is to assign a variable to the value of the SELECT LAST_INSERT_ID() and insert the variable in your query.

A: It's not the SELECT statement that's wrong, it's the fact that you're doing two statements in one go, which is not allowed by the MySQL library of PHP. Just do two distinct queries to solve the issue.