text:
Q: I can't scroll pass the navigation bar when I fix it to the top of the viewport/webpage in CSS After I fix the navigation bar to the top of the viewport, I can scroll, but I can't scroll past the header.  I don't scroll down through the body.
I can't scroll when I use the codes below in CSS.  When I take it away, I can scroll down through the viewport/webpage again.
#nav-bar {position: fixed;
width: 100%;
top: 0;
margin: 0px auto;
height: 675px;}

or
nav {display: flex;
justify-content: space-between;
align-items: center;
flex-direction: column;
background-color: lightgreen;
font-family: sans-serif;
color: red;
position: fixed;
width: 100%;
top: 0;
margin: 0px auto;
height: 675px;
  }

When I fix the navigation bar to the top of the viewport, I want to srcoll through the whole webpage and not get stuck in the header section.


text:
Q: Installing tcl/tk R package on windows It appears that the cran version has been removed, and I cannot seem to find any info on how to install it with a quick google search. I installed tcltk following the steps here:https://www.tcl.tk/doc/howto/compile.html . Is there a way to get the tcltk package on R after it has been removed from cran? Running install.packages("tcltk") just returns
Warning in install.packages :
  package 'tcltk' is not available (for R version 3.6.2)
Warning in install.packages :
  package 'tcltk' is a base package, and should not be updated

which I presume this is due to tcltk no longer being on cran.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Allure generation history (command line) limits We use Allure to generate reports from test runs. We have a requirement that reports will contain possibly over hundreds of runs (of same test suites). Currently we are only able to see 20 runs in the trend, and I noticed the PR "increase history limit to 20 (via #1059)" which has a hard coded 20 instead of 5. Is there a way to overwrite this limits?
Thanks.
m.

A: I raised a PR with a quick fix for that. Already talked to Allure devs. There's a concern about the best place for the newly added piece of code. They will think about it.
In the meantime, you can build allure binary from the linked branch and just set an ALLURE_RESULTS_LIMIT env variable before calling allure generate command.
Note that it affects not only a history trend but all the other trends as well. You should also realize that new results will appear one by one starting from the most recent number, e.g. if you set ALLURE_RESULTS_LIMIT=100 and the most recent report has only 20 results, the next run will give you 21, not 100 in a moment. It's an incremental process.


text:
Q: Change the order of factor levels in the legend I did the following stacked bar many times by specifying the factor order. Today I've tried it again. The legend respects the ordering manually defined, but the bars appear in the opposite way (from the last level to the first). For example, the legend is as follow : Factor1, Factor2, Factor3. But the first bar on the left is Factor3, then Factor2 and Factor1.
I have completely reinstalled R and RStudio, but nothing changed.
data<-read.table('file.txt', header=TRUE, sep="\t")
data$Genus<-factor(data$Genus, levels=c('Factor1','Factor2','Factor3'))
colors<-c('color1','color2','color3')

c<- ggplot(data_gathered, aes(x=Materiel, y=Log, fill=Genus2))
    c <- c + geom_bar(stat = "identity") +
      theme_classic()+
      theme(legend.text=element_text(face="italic", size=12))+
      theme(legend.title=element_text(face="bold.italic", size=12))+
      theme(strip.background = element_blank())+
      scale_y_continuous(limits=c(0,10))+
      scale_fill_manual(values = colors)  +
      labs(y='axis title', x=element_blank(), fill='Legend') +
      coord_flip()

c

Is it a problem with my software ? What could I do?

A: In order to change the order in the level, you will have to change the order of the factor in the dataset.
just try this
data$Genus<-factor(data$Genus, levels=c('Factor1','Factor2','Factor3'), ordered = TRUE)


text:
Q: arima xreg argument error caused by column name in data frame I'm trying to run the code below and I'm getting the error below.  The code uses auto.arima from the forecast package to determine and fit an arima model to some data.  It's also using regressors in the xreg argument.  I think the names of two of the columns in the xreg might be the issue, but I'm not sure why.  The names of the columns are like "structure.c.NA..NA..211L.."  They're the output of a function.  If I run auto.arima without those columns in the xreg argument it seems to do fine.  Any tips on how to solve this are greatly appreciated.
Code:
auto.arima(df2_comb[1:100,names(df2_comb)=='ECDD'], xreg = df2_comb[,names(df2_comb)!='ECDD'][1:100,names(df2_comb[,!names(df2_comb)%in%c('ECDD','order_dts')])])

Error:
Error in auto.arima(df2_comb[1:100, names(df2_comb) == "ECDD"], xreg = df2_comb[,  :
  xreg should be a numeric matrix or vector

Data:
dput(df2_comb[1:100,])
structure(list(ECDD = c(319.4, 319.4, 319.4, 319.4, 319.4, 319.4,
319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4,
319.4, 319.4, 319.4, 319.4, 198, 142, 254, 178, 97, 113, 116,
109, 127, 102, 99, 107, 109, 89, 101, 106, 319.4, 319.4, 319.4,
319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 257, 169, 191, 115,
121, 121, 108, 110, 105, 93, 103, 93, 107, 99, 113, 319.4, 319.4,
319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 237,
106, 108, 108, 117, 99, 105, 108, 100, 93, 88, 105, 95, 109,
319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 192,
169, 319.4, 136, 108, 163, 136, 114, 116), order_dts = c("2017-12-31 09:00:00",
"2017-12-31 10:00:00", "2017-12-31 11:00:00", "2017-12-31 12:00:00",
"2017-12-31 13:00:00", "2017-12-31 14:00:00", "2017-12-31 15:00:00",
"2017-12-31 16:00:00", "2017-12-31 17:00:00", "2017-12-31 18:00:00",
"2017-12-31 19:00:00", "2017-12-31 20:00:00", "2017-12-31 21:00:00",
"2017-12-31 22:00:00", "2017-12-31 23:00:00", "2018-01-01 00:00:00",
"2018-01-01 01:00:00", "2018-01-01 02:00:00", "2018-01-01 03:00:00",
"2018-01-01 04:00:00", "2018-01-01 05:00:00", "2018-01-01 06:00:00",
"2018-01-01 07:00:00", "2018-01-01 08:00:00", "2018-01-01 09:00:00",
"2018-01-01 10:00:00", "2018-01-01 11:00:00", "2018-01-01 12:00:00",
"2018-01-01 13:00:00", "2018-01-01 14:00:00", "2018-01-01 15:00:00",
"2018-01-01 16:00:00", "2018-01-01 17:00:00", "2018-01-01 18:00:00",
"2018-01-01 19:00:00", "2018-01-01 20:00:00", "2018-01-01 21:00:00",
"2018-01-01 22:00:00", "2018-01-01 23:00:00", "2018-01-02 00:00:00",
"2018-01-02 01:00:00", "2018-01-02 02:00:00", "2018-01-02 03:00:00",
"2018-01-02 04:00:00", "2018-01-02 05:00:00", "2018-01-02 06:00:00",
"2018-01-02 07:00:00", "2018-01-02 08:00:00", "2018-01-02 09:00:00",
"2018-01-02 10:00:00", "2018-01-02 11:00:00", "2018-01-02 12:00:00",
"2018-01-02 13:00:00", "2018-01-02 14:00:00", "2018-01-02 15:00:00",
"2018-01-02 16:00:00", "2018-01-02 17:00:00", "2018-01-02 18:00:00",
"2018-01-02 19:00:00", "2018-01-02 20:00:00", "2018-01-02 21:00:00",
"2018-01-02 22:00:00", "2018-01-02 23:00:00", "2018-01-03 00:00:00",
"2018-01-03 01:00:00", "2018-01-03 02:00:00", "2018-01-03 03:00:00",
"2018-01-03 04:00:00", "2018-01-03 05:00:00", "2018-01-03 06:00:00",
"2018-01-03 07:00:00", "2018-01-03 08:00:00", "2018-01-03 09:00:00",
"2018-01-03 10:00:00", "2018-01-03 11:00:00", "2018-01-03 12:00:00",
"2018-01-03 13:00:00", "2018-01-03 14:00:00", "2018-01-03 15:00:00",
"2018-01-03 16:00:00", "2018-01-03 17:00:00", "2018-01-03 18:00:00",
"2018-01-03 19:00:00", "2018-01-03 20:00:00", "2018-01-03 21:00:00",
"2018-01-03 22:00:00", "2018-01-03 23:00:00", "2018-01-04 00:00:00",
"2018-01-04 01:00:00", "2018-01-04 02:00:00", "2018-01-04 03:00:00",
"2018-01-04 04:00:00", "2018-01-04 05:00:00", "2018-01-04 06:00:00",
"2018-01-04 07:00:00", "2018-01-04 08:00:00", "2018-01-04 09:00:00",
"2018-01-04 10:00:00", "2018-01-04 11:00:00", "2018-01-04 12:00:00"
), structure.c.NA..NA..211L..211L..211L..211L..211L..211L..211L.. = c(0,
0, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
211, 211, 211, 211, 211, 211, 211, 131, 94, 168, 117, 64, 75,
77, 72, 84, 67, 65, 71, 72, 59, 67, 70, 211, 211, 211, 211, 211,
211, 211, 211, 211, 170, 112, 126, 76, 80, 80, 71, 73, 69, 61,
68, 61, 71, 65, 75, 211, 211, 211, 211, 211, 211, 211, 211, 211,
211, 156, 70, 71, 71, 77, 65, 69, 71, 66, 61, 58, 69, 63, 72,
211, 211, 211, 211, 211, 211, 211, 211, 127, 112, 211, 90, 71,
108, 90), structure.c.NA..NA..NA..NA..48L..48L..48L..48L..48L..48L..48L.. = c(0,
0, 0, 0, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 30, 21, 38, 27, 15, 17, 17, 16, 19, 15,
15, 16, 16, 13, 15, 16, 48, 48, 48, 48, 48, 48, 48, 48, 48, 39,
25, 29, 17, 18, 18, 16, 16, 16, 14, 15, 14, 16, 15, 17, 48, 48,
48, 48, 48, 48, 48, 48, 48, 48, 36, 16, 16, 16, 18, 15, 16, 16,
15, 14, 13, 16, 14, 16, 48, 48, 48, 48, 48, 48, 48, 48, 29, 25,
48, 20, 16), S1 = c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0), S2 = c(0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
), S3 = c(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0)), row.names = c(NA,
100L), class = "data.frame")

A: library(forecast)
## it works
auto.arima(df2_comb[1:100,names(df2_comb)=='ECDD'], xreg = as.matrix(df2_comb[,names(df2_comb)!='ECDD'][1:100,names(df2_comb[,!names(df2_comb)%in%c('ECDD','order_dts')])]))
## it fails
colnames(df2_comb)[3]<- "structure_211"
colnames(df2_comb)[4]<- "structure_48"
auto.arima(df2_comb[1:100,names(df2_comb)=='ECDD'], xreg = df2_comb[,names(df2_comb)!='ECDD'][1:100,names(df2_comb[,!names(df2_comb)%in%c('ECDD','order_dts')])])

It is no related with the names, as you can see if you change them, fails in the same fashion.
But is you use xreg as.matrix it should do the trick!


text:
Q: How to use SharedPreferences to save and read from a Class I want to use the SharedPreferences in a Class that has no Activity. I have wrote this code but im still getting an error. Can you help me out please?
package com.example.keypass;

import android.content.Context;
import android.content.SharedPreferences;

public class test {
    SharedPreferences sharedPreferences;

    public void loadInt(){
        sharedPreferences = this.getSharedPreferences("com.example.keypass",Context.MODE_PRIVATE);
        int usrPassword = sharedPreferences.getInt("meinInteger", 0);
    }

}

If I use the same code in a Class with Activity it works. But in this class is not working.

A: Here Maybe this help
Its a good practice making separate class file for shared prefrence
first, create a file(class) name Constants.java
   public class Constants {

        static Constants _instance;

        Context context;
        SharedPreferences sharedPref;
        SharedPreferences.Editor sharedPrefEditor;

        public static Constants instance(Context context) {
            if (_instance == null) {
                _instance = new Constants();
                _instance.configSessionUtils(context);
            }
            return _instance;
        }

    public static Constants instance() {
        return _instance;
    }

    public void configSessionUtils(Context context) {
        this.context = context;
        sharedPref = context.getSharedPreferences("AppPreferences", Activity.MODE_PRIVATE);
        sharedPrefEditor = sharedPref.edit();
    }

    public void storeValueString(String key, String value) {
        sharedPrefEditor.putString(key, value);
        sharedPrefEditor.commit();
    }

    public String fetchValueString(String key) {
        return sharedPref.getString(key, null);
    }
}

The above code will generate an XML file inside your phone with the name AppPreferences
where you can store value in key-value pair
Now go to an activity where you want to access shared preference
Constants.instance(this.getApplicationContext());

Now when you want to store inside shared preference use like that
Constants.instance().storeValueString("companyKey", "Brainwash Inc.");

now when you want to fetch data from shared prefrence
String companyName = (Constants.instance().fetchValueString("companyKey"));

Note Its for Activity if you want to use inside fragments use getactivity() instead of getapplicationcontext()

A: To be able to use shared preference in a class, you have to pass in the context. You can try to add a constructor with the context parameter in it and call this class inside the activity you want.


text:
Q: ucfr: Attempt from package php5-cli to take /etc/php5/cli/php.ini away from package libapache2-mod-php Дистрибутив: Ubuntu 14.04
$ sudo apt-get -f install
Чтение списков пакетов… Готово
Построение дерева зависимостей
Чтение информации о состоянии… Готово
обновлено 0, установлено 0 новых пакетов, для удаления отмечено 0 пакетов, и 22 пакетов не обновлено.
не установлено до конца или удалено 4 пакетов.
После данной операции, объём занятого дискового пространства возрастёт на 0 B.
Настраивается пакет php5-cli (5.5.9+dfsg-1ubuntu4.18) …
ucfr: Attempt from package php5-cli  to take /etc/php5/cli/php.ini away from package libapache2-mod-php5
ucfr: Aborting.
dpkg: ошибка при обработке пакета php5-cli (--configure):
 подпроцесс установлен сценарий post-installation возвратил код ошибки 4
dpkg: зависимости пакетов не позволяют настроить пакет php5-readline:
 php5-readline зависит от php5-cli (= 5.5.9+dfsg-1ubuntu4.18), однако:
  Пакет php5-cli пока не настроен.

dpkg: ошибка при обработке пакета php5-readline (--configure):
 проблемы зависимостей — оставляем не настроенным
dpkg: зависимости пакетов не позволяют настроить пакет php-pear:
 php-pear зависит от php5-cli, однако:
  Пакет php5-cli пока не настроен.

dpkg: ошибка при обработке пакета php-pear (--configure):
 проблемы зависимостей — оставляем не настроенным
dpkg: зависимости пакетов не позволяют настроить пакет pkg-php-tools:
 pkg-php-tools зависит от php5-cli, однако:
  ПакеОтчёты apport не записаны, так как сообщение об ошибке указывает на повторную ошибку от предыдущего отказа.
                                 Отчёты apport не записаны, так как сообщение об ошибке указывает на повторную ошибку от предыдущего отказа.
                                                            Отчёты apport не записаны, так достигнут MaxReports
                               т php5-cli пока не настроен.
 pkg-php-tools зависит от php-pear, однако:
  Пакет php-pear пока не настроен.

dpkg: ошибка при обработке пакета pkg-php-tools (--configure):
 проблемы  зависимостей — оставляем не настроенным
При обработке следующих пакетов произошли ошибки:
 php5-cli
 php5-readline
 php-pear
 pkg-php-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

Как исправить эти ошибки?

A:
ucfr: Attempt from package php5-cli  to take /etc/php5/cli/php.ini away from package libapache2-mod-php5

вероятно, /etc/php5/cli/php.ini в вашей системе — это символическая ссылка, указывающая на файл, принадлежащий пакету libapache2-mod-php5.
уточнить можно, например, так:
$ ls -l /etc/php5/cli/php.ini

удалите или, для надёжности, переименуйте эту символическую ссылку /etc/php5/cli/php.ini, и повторите ту же команду. ни одна из перечисленных в приведённом логе ошибок уже не должна появиться.

аналогичный вопрос на другом сайте: Can't finish php5-cli update


text:
Q: Changing references when running a backup and restore We have a database in production that uses views or other resources from other  databases. When we do a back up and restore into our test environment to look at an issue some of the resources are still pointing to that original database. A good example of this might be
In production
-- Some important stored procedure that returns thee revenue code, not an actual example part of main application database
SELECT RevenueCode FROM ManagementDatabase.dbo.RevenueCodes

When we back it up into test it still have that same refernce
    SELECT RevenueCode FROM ManagementDatabase.dbo.RevenueCodes

However because this is a shared database and backing up and restoring over it might destroy some new work being added to it.
For that reason we created a database 'ManagementDatabase_Prod' in our testing environment. My question is there any way to automatically change the refernces in one database so that any views/procedures or functions will reference the 'ManagementDatabase_Prod' in test rather than the 'ManagementDatabase' (which is right for production)
I did it manually last time, my other thought would be to script these files out and write a small script to replace them if there's not a built in way to do this.


text:
Q: Correlation functions of composite operators I am looking for resources, where there are examples of calculation of correlation functions between composite operators. This is very basic and natural question, but unfortunately, I don't have any sources..
I am interested in any examples, but if to be concrete, I wanna to understand some basic examples:

*

*$\lambda \phi^4$ theory:
$$
\langle \phi^2(x) \phi^2(y)\rangle = ?
$$
$$
\langle T_{\mu\nu}(x) T_{\mu\nu}(y)\rangle = ?
$$

*$\mathcal{N}=4$ SYM:
$$
\langle tr(\phi_i \phi_j) tr(\phi_k \phi_l) \rangle = ?
$$

A: There is a short section in the book devoted to the correlation functions of composite operators https://www.cambridge.org/core/books/gaugegravity-duality/16CCA2E431B24AEF1B51B0F9C5BE755E.
However, as far as I understand, there is not a much information about them, because the renormalization is rather complicated, because instead of simply being multplied by some factor, there arise different operators.


text:
Q: How to do ajax call and php through submit button without form? In my javascript there have treeview with checkboxes which is in kendo grid. Outside of grid, there is one button submit that supposed to fetch id that selected checkboxes into database. Anyone know how to do it in correct way?
Here more clearly: https://dojo.telerik.com/IYEvALiY/6

HTML for button

<button id="primaryTextButton" value="submit" class="k-primary" style="float:right; padding: 5px 20px; border-radius: 4px;">Submit</button>

JAVASCRIPT for Ajax

var grid;

$(document).ready(function() {
  dataSource = new kendo.data.DataSource({
    transport: {
      read: {
        url: "./getTest.php",
        type: "POST",
        data: function() {
          return {
            method: "getTemplate",
            positionTemplateID: document.getElementById('positionTemplateID').value,
            //  hrsPositionID: dropdownlist.value(),
          }
        }
      },

      template: {
        url: "./getTest.php",
        type: "POST",
        data: function() {
          return {
            method: "getTemplate",
            employeeID: document.getElementById('employeeID').value,
            propertyID: document.getElementById('propertyID').value,
          }
        },
        complete: function(e) {
          $('#grid').data('kendoGrid').dataSource.read();
        }
      },
    },
    schema: {
      model: {
        id: "positionTemplateID",
      }
    },

  });

PHP for database that supposed Ajax call it insert into database

function getTemplate() {
global $ehorsObj;
$positionTemplateID = (isset($_POST['positionTemplateID']) ? $_POST['positionTemplateID'] : '');
$hrsPositionID      = (isset($_POST['hrsPositionID']) ? $_POST['hrsPositionID'] : '');
$programID          = (isset($_POST['programID']) ? $_POST['programID'] : '');
$propertyID         = (isset($_POST['propertyID']) ? $_POST['propertyID'] : '');
$employeeID         = (isset($_POST['employeeID']));


text:
Q: BautifulSoup - How to find exact match for div names How do I find exact matches for div names. It seems by default the below returns anything with col in the div name. Thanks
divs = player_soup.find_all( 'div', {'class': 'col'})

A: Exact match = divs = player_soup.select( 'div[class="col"]')


text:
Q: Why npm install fails in ArmV7 docker image when installing package globally? Here is my Dockerfile:
FROM arm32v7/node:8
RUN npm --version
RUN npm install -g yarn

And here is output log:
Sending build context to Docker daemon  65.25MB
Step 1/5 : FROM arm32v7/node:8
 ---> 1e66bc1fab80
Step 2/5 : RUN npm --version
 ---> Running in c62ffb8ecc56
Unknown host QEMU_IFLA type: 40
Unknown host QEMU_IFLA type: 41
Unknown host QEMU_IFLA type: 40
Unknown host QEMU_IFLA type: 41
Unknown QEMU_IFLA_INFO_KIND ipip
Unknown host QEMU_IFLA type: 40
Unknown host QEMU_IFLA type: 41
Unknown QEMU_IFLA_INFO_KIND ip6tnl
Unknown host QEMU_IFLA type: 40
Unknown host QEMU_IFLA type: 41
6.4.1
Removing intermediate container c62ffb8ecc56
 ---> 69f0396a3742
Step 3/5 : RUN npm install -g yarn
 ---> Running in d173b95e284c
Unknown host QEMU_IFLA type: 40
Unknown host QEMU_IFLA type: 41
Unknown host QEMU_IFLA type: 40
Unknown host QEMU_IFLA type: 41
Unknown QEMU_IFLA_INFO_KIND ipip
Unknown host QEMU_IFLA type: 40
Unknown host QEMU_IFLA type: 41
Unknown QEMU_IFLA_INFO_KIND ip6tnl
Unknown host QEMU_IFLA type: 40
Unknown host QEMU_IFLA type: 41
Error: could not get uid/gid
[ 'nobody', 0 ]

    at /usr/local/lib/node_modules/npm/node_modules/uid-number/uid-number.js:37:16
    at ChildProcess.exithandler (child_process.js:283:5)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
TypeError: Cannot read property 'get' of undefined
    at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:78:20
    at cb (/usr/local/lib/node_modules/npm/lib/npm.js:228:22)
    at /usr/local/lib/node_modules/npm/lib/npm.js:266:24
    at /usr/local/lib/node_modules/npm/lib/config/core.js:83:7
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/npm/lib/config/core.js:82:13
    at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
    at afterExtras (/usr/local/lib/node_modules/npm/lib/config/core.js:173:20)
    at Conf.<anonymous> (/usr/local/lib/node_modules/npm/lib/config/core.js:231:22)
/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:205
  if (npm.config.get('json')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
    at emitOne (events.js:116:13)
    at process.emit (events.js:211:7)
    at process._fatalException (bootstrap_node.js:391:26)
The command '/bin/sh -c npm install -g yarn' returned a non-zero code: 7

Any ideas why it's failing? I building image with with commad docker build . -t myimage (I am running docker on Mac OS X).

Please not that it works when installing yarn without "-g" flag.


text:
Q: Image gallery doesn't fit in mobile view I'm using an image gallery and it works fine, except if I'm trying to check it in mobile view.
Here are the pictures:
As you can see, there's a a white line on the right:
https://i.gyazo.com/8e2d4bef588bd5366bf4b2d519938cb5.png
When I scroll down, half of the navbar disappears:
https://i.gyazo.com/6c51c69f85e0d7fca78d2bef86a82509.png
When I scroll up, half of the "jump to the top" button disappears:
https://i.gyazo.com/799a5bb031298e367b3462771d286cba.png
Also, when I click on any image of the gallery, got the same problem with the modal:
https://i.gyazo.com/4928e4204d622070dc0b3b1cf0d6e1e8.mp4

Galéria

                          <button type="button" class="close" data-dismiss="modal">×Close
                          </button>

                          <button type="button" class="btn btn-secondary float-left" id="show-previous-image">
                          </button>

                          <button type="button" id="show-next-image" class="btn btn-secondary float-right">
                          </button>


text:
Q: Can I find the timestamp of the last value change Given a time series, is it possible to find the timestamp of the last value change?
For example, a cron job runs every night. It first runs an rsync job, and later computes the size of the target directory. The actual metric value is not all that significant, but I would like to verify that it actually changes every night.
Is it possible to create a query that return a scalar value with the timestamp of the last value change?

A: The standard way to handle this is to push a metric whose value is the unix timestamp that the batch jobs succeeded at. You can then alert on that value being recent enough.
https://www.robustperception.io/monitoring-batch-jobs-in-python/ has a Python example.

A: No, you can't do that.
For many use cases, there are workarounds. For mine, there isn't.

A: Prometheus provides changes function, which can be used for determining the number of changes for time series samples over the given lookbehind window in square brackets. For example, the following query returns the number of sample value changes for time series with the name metric_name during the last 5 minutes:
changes(metric_name[5m])

Zero changes can be filtered out by adding > 0 to the query. The following query returns non-empty result only if there was at least a single sample value change during the last 5 minutes:
changes(metric_name[5m]) > 0

Unfortunately, Prometheus doesn't provide the functionality for returning the timestamp for the last non-empty value :(
If you still need to get the timestamp for the last value change, then VictoriaMetrics may come to rescue with tlast_over_time function. The following MetricsQL query returns the timestamp of the last value change for metric_name with 1 minute precision if the change was made during the last 24 hours:
tlast_over_time(changes(metric_name[5m])[24h:1m])

This query uses subquery feature.
P.S. VictoriaMetrics provides tlast_change_over_time function starting from v1.77.0. This function returns the timestamp in seconds for the last value change on the given lookbehind window in square brackets. For example, the following query is mostly equivalent to the query above. The only difference is that it returns the exact timestamp for the raw sample with the last change:
tlast_change_over_time(metric_name[24h])


text:
Q: How do you force all insecure assets (CSS and JS) to their https version on Laravel? I'm using Laravel and Twig as template language and "https" all around the site. I'm having trouble getting all our non-https assets to transfer over to their https URL's in production.
Both of these...
{{ html_style('/css/global.css') }}
{{ html_script('/js/global.js') }}

...render this in production:
<link type="text/css" rel="stylesheet" href="http://website.com/css/global.css">
<script src="http://website.com/js/global.js"></script>

...when I want them to render:
<link type="text/css" rel="stylesheet" href="https://website.com/css/global.css">
<script src="https://website.com/js/global.js"></script>

How can I still use relative paths in Laravel and force https on production?
Lastly, I get that this forces https:
{{ html_style('css/modals.css',[], true) }}

...but then it breaks my local machine because it's looking for https locally.

A: if you have setup the environments, then use this....
{{ html_style('css/modals.css',[], !App::isLocal()) }}

though a more elegant solution is self signed certificate locally.


text:
Q: Why doesn't my code change when I ask for user input and append that to a list? I wanna store in a list all user inputs collected over time. I did something like this:
reactions = []
reaction = raw_input("I wanna know your reaction, yo: ")
reactions.append(reaction)

but even after refreshing, my code looks exactly the same, an empty list.

A: Let's just save them to a file
reaction = raw_input('Please React: ')
with open('reactions.txt', 'a') as f: #a is append mode
    f.write(reaction + '\n')

A: When I run your code and print reactions I get whatever I entered. If you want to collect a lot of reactions, you could make a loop, which ends once the user enters "q":

reactions = []
reaction = raw_input("I wanna know your reaction, yo: ")
while reaction != "q":
    reactions.append(reaction)
    reaction = raw_input("I wanna know your reaction, yo: ")
print(reactions)

A: I don't know what you mean by "refreshing". But your code creates a new empty list at the beginning, so if you run it again, it will always append to a new empty list. Try to see your code as a list of instructions that execute one after another in sequence.
maybe add at the end a way to show the contents of the list print(reactions) and a loop to repeat the last two lines multiple times:
reactions = []
while True:
    reaction = raw_input("I wanna know your reaction, yo: ")
    reactions.append(reaction)
    print reactions


text:
Q: Dickey-Fuller test in Python I was trying to figure out exactly what the following expression means:
Perform Dickey-Fuller test:
print 'Results of Dickey-Fuller Test:'
dftest = adfuller(timeseries, autolag='AIC')
dfoutput = pd.Series(dftest[0:4], index=['Test Statistic','p-value','#Lags Used','Number of Observations Used'])
for key,value in dftest[4].items():
    dfoutput['Critical Value (%s)'%key] = value
print dfoutput

More specifically what does this [0:4] represent?

A: im not sure exactly what kind of variable dftest is but ill go through each variable so you might get a better understanding of [0:4]
Suppose you had an array like array = [1,2,3,4,5] and you did print(array[0:2]) this will print [1,2]
On the other hand you could have a string which could be word = "awesomeness" and when you print print(word[2:6]) you will get esom hope this helped!:)


text:
Q: Do not understand source of "copy of slice" warning when doing a filter of columnsto assign a value to another column on pandas I understand this topic is an issue for many people who are pandas beginners but I still can't work it out from past questions.
I'm doing something very simple: Using boolean selection to filter rows in column X in a DF where the values are less than 1 so as to convert the values of column Y to nan.
import pandas as pd
import numpy as np
df1 = pd.read_csv("C:/Users/Administrator/Desktop/df1.csv", index_col="county")

filter = df1["columnX"] < 1

df1.columnY[filter] = np.nan

I got an :2: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame. error.
I tried using loc thinking it might solve the problem but no difference.
df1.loc[:,"columnY"][filter] = np.nan

Have also looked around trying to make a copy of the DF but nothing seems to work.
Any help / explanation would be appreciated. Thanks in advance.

A: Use .loc accessor or .iloc accessor together with boolean select
Let get some data to work with
df=pd.DataFrame({'X':[1,3,67,0,-12],'Y':[12,6,8,-1,-8]})
print(df)

    X   Y
0   1  12
1   3   6
2  67   8
3   0  -1
4 -12  -8

import numpy as np
m=df.X<1
df.loc[m,'Y']=np.nan
print(df)

   X     Y
0   1  12.0
1   3   6.0
2  67   8.0
3   0   NaN
4 -12   NaN


text:
Q: Making a MySQL database relational and updating existing PHP code I have a MySQL database called csftdb and in that database there exists 1 table: articles.
I also have a series of PHP forms that can add, edit, and delete entries to/from the table within the database.
Now, however, I'm attempting to add search functionality and have found that the single-table method is insufficient.
The table is laid out thus:
id - articletitle - articleorganization - articledate - articleurl - articletags

One of the PHP forms is a search form and it works except when the tags come into play, for example:
Say there are 3 articles in the database:
01 - My first article - Article Corp. - 05/28/2010 - www.articlecorp.com/article1 - php, html
02 - My second article - Article Corp. - 08/11/2012 - www.articlecorp.com/article2 - asp, html
03 - My third article - Article Corp. - 12/22/2011 - www.articlecorp.com/article3 - c++, html

And then I have a search form with fields for Title, Organization, Date, URL, and Tag(s). I am able to search "My first article" in the Title field and only retrieve the 1st entry, but I can also search "article" in the Title field and it would retrieve all 3 entries. This is the desired behavior. Further, I can search "article" in the Title field and "Article Corp." in the Organization field and it would only show entries that match that set (so, if there were other organizations that also had the word "article" in their article titles, those organizations would not show up in the results.) This is also desired behavior.
However, if I were to search "Article" in the title field, and then "php, asp, c++" in the Tag(s) field, my search would return no results. This is not the desired behavior. In this case, the "tags" are supposed to allow a more fine level of granularity with the search results.
So I could conceivably have a thousand articles, all with the exact same Title etc. information but with different combinations of tags and I could search for the tags and retrieve all of the articles with just those tags applied.
To that end, I have created 2 new tables in my database and altered the original one such that my tables are now:
articles:
id | articletitle | articleorganization | articledate | articleurl

tags:
id | tags

and
articles_tags:
article_id | tag_id

I also have the following PHP form which is modified from the original form:
        <?php
     function renderForm($articletitle, $articleorganization, $articledate, $articleurl, $articletags )
     {
     ?>
    . . .

          <form id="form" name="form" action="" method="post">

Create a new entry in the database

                <legend>Article details</legend>

                Article Title:

                  <input name="articles.articletitle" type="text" value="<?php echo $articletitle; ?>" size="50"/>

                Article Author:

                  <input name="articleorganization" type="text" value="<?php echo $articles.articleorganization; ?>" size="50"/>

                Access Date:

                  <input name="articles.articledate" type="text" value="MM/DD/YYYY" size="50"/>

                Article URL:

                <input name="articleurl" type="text" value="<?php echo $articles.articleurl; ?>" size="50"/>

                Article Tags:

                <input name="articletags" type="text" value="<?php echo $tags.articletags; ?>" size="50"/>

            <input type="submit" name="submit" value="Add this Article">
            </form>

        . . .

    <?php
     }

     . . .
      if($_SERVER['REQUEST_METHOD'] == 'POST')
      {
        // get form data, making sure it is valid
        $articletitle = mysql_real_escape_string(htmlspecialchars($_POST['articletitle']));
        $articleorganization = mysql_real_escape_string(htmlspecialchars($_POST['articleorganization']));
        $articledate = mysql_real_escape_string(htmlspecialchars($_POST['articledate']));
        $articleurl = mysql_real_escape_string(htmlspecialchars($_POST['articleurl']));

     . . .

     mysql_query("INSERT articles SET articletitle='$articletitle', articleorganization='$articleorganization', articledate='$articledate', articleurl='$articleurl', articletags='$tags.articletags' ")
     or die(mysql_error());

       header("Location:addsuccess.php");
      }
     }
     else

     {
      renderForm('','','','','');
     }
    ?>

However I can't seem to get the information to store into my 2nd table and, thus, I can't get my relations to work.
I've been looking at this all day and can not figure it out.

A: For each submitted tag you need to look if it exists or not, if it does not exists, you need to add it and then you store all the relations.
You should also compare with the original values if one or more tags have been removed and then check each removed tag if it was the only used variant of that tag so you can delete it from the tags and relations table.

A: You'll need to add a couple more INSERT queries to get this to work properly.
if (mysql_query ("INSERT INTO `articles` SET
  `articletitle` = '$articletitle',
  `articleorganization` = '$articleorganization',
  `articledate` = '$articledate',
  `articleurl` = '$articleurl'")) {

  $article_id = mysql_insert_id();
}

$tags = split (' ', $_POST['articletags']);
foreach ($tags as $tag) {
  // check if tag exists in tag table and get id, if not, insert it and get mysql_insert_id()
  // then insert article_id with tag_ids into your articles_tags table
}

This is rough but its the idea.  Also, if I recall correctly "split" is depreciated so you'll want to find another option.


text:
Q: OWIN self-host IAppBuilder map if part of Windows group I have following setup:
Self-host OWIN server (Windows Service). In the OWIN startup class, I configured httpListener to only allow Windows Authentication. This works.
...
HttpListener listener = (HttpListener)app.Properties["System.Net.HttpListener"];
listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication;

this.ConfigureSomeApp();
...

private void ConfigureSomeApp()
{
    app.Map("/someapp", someApp => { //appconfig here, ommitted for brevity };
}

The thing I'm trying to achieve is to ONLY map "someapp" based on some conditions regarding the current user (i.e. if the user is a member of a specified Windows group).
I cannot seem to find how to do this. Is this possible ? Something like:
private void ConfigureSomeApp()
{
    if(currentuser is in windowsgroup) //pseudo example condition I want to achieve
        app.Map("/someapp", someApp => { //appconfig here, ommitted for brevity };
}

If not possible here in the startup class, what are your other suggestions on how to achieve this ?
For info: I do not control the "someapp" implementation, it comes from a NuGet package

A: This is not the correct way to do this
{
    if(currentuser is in windowsgroup) //pseudo example condition I want to achieve
        app.Map("/someapp", someApp => { //appconfig here, ommitted for brevity };
}

because ConfigureSomeApp method is in startup and startup only run once, therefor your if statement won't run for every request.
You have to use app.MapWhen
app.MapWhen(context =>
        {
            // check the logic for user
            //context.Authentication.User

            return true; // return true if you want to map for this request
        }, someapp => /*config someapp*/);


text:
Q: Weird ListView sort I've got following problem:

As you can see on the picture, the CITROEN group header is not above the all Citroen car models, like e.g DACIA.
The weird thing is that there is around 20 Car Brands like BMW,AUDI...and every group header is above its children items, but not the CITROEN.
This listview is populated from the html file, which has the following structure:
<optgroup label="BMW">
<option value="225" >BMW X3 3.0si</option>
    <option value="226" >BMW X5 3.0d A/T</option>
    <option value="227" >BMW X5 4.8i A/T</option>
</optgroup>
<optgroup label="CITROËN">
    <option value="67" >CITROËN C1 1.0i</option>
    <option value="68" >CITROËN C1 1.4 HDi</option>
    <option value="69" >CITROËN C2 1.1i</option>

I'm using custom adapter. Here is the source code of the comparing method:
 @Override
    protected void onPostExecute(Void aVoid) {
        super.onPostExecute(aVoid);
        progressDialog.dismiss();

        adapter = new ModelsAdaper(CarsList.this, generateData());

        /*Should sort the ListView alphabetically*/
        adapter.sort(new Comparator<Model>() {
            @Override
            public int compare(Model lhs, Model rhs) {
                return lhs.getTitle().compareTo(rhs.getTitle());
            }
        });
        setListAdapter(adapter);

The generateData() method:
private ArrayList<Model> generateData() {
    models = new ArrayList<Model>();

    /*This loop adds car brands to the listview*/
    for(String s: brands){
       models.add(new Model(R.drawable.alfa_romeo_icon_52,s));
    }

    /*This loop inserts car models into the listview*/
    int key;
    for(int i = 0; i < hashMap.size(); i++) {
        key = hashMap.keyAt(i);
        models.add(new Model(hashMap.get(key)));
    }
    return models;
}

And finally, the Model class
public class Model {
private String title;
private boolean isGroupHeader = false;
private int icon;

/**
 * This constructor will be used for creating instance od target_item
  * @param title is content of the item
 */
public Model(String title){
     this.title = title;
 }

/**
 * This constructor will be used for group headers
 * @param icon is icon of the group
 * @param title is name of the group
 */
public Model(int icon, String title){
    this.icon = icon;
    this.title = title;
    isGroupHeader = true;
}

EDIT
As requested, here is the HTMLParser class source code. Its constructor is called from CarsList Activity, which extends ListActivity
public class HTMLParser {
private String value;
private InputStream is = null;
private Context context=null;
private org.jsoup.nodes.Document document = null;
SparseArray<String> hashMap =  new SparseArray<String>();
private ArrayList<String> modelsList = new ArrayList<String>();
private ArrayList<String> brandsList = new ArrayList<String>();

/**
 * Constructor is used to pass instance of CarsList Context to get html asset
 * @param context instance of the CarsList activity context
 */
public HTMLParser(Context context) throws IOException {
    this.context = context;
    is = context.getAssets().open("modely aut.html");
    document = Jsoup.parse(is,"UTF-8","http://example.com");
}

/**
 * The purpose of this method is to parse car brands from html asset
 * @return ArrayList of car brands
 */
public ArrayList<String> parseCarBrands(){
    Elements models = document.select("optgroup");
    for (Element e: models){
        brandsList.add(e.attr("label"));
    }
    return brandsList;
}

/**
 * Method parses all car models from html asset. For IO safety operations, it is recommended to call this method
 * after parseCarBrands() method, because parseCarModels() method closes inputStream.
 * @return SparseArray consisting of key: carID and value: car model
 */
public SparseArray<String> parseCarModels(){
    try {
        Elements models = document.select("option");
        for (Element e: models){
            int res = new Scanner(e.toString()).useDelimiter("\\D+").nextInt();
            value = e.html();
            modelsList.add(value);
            hashMap.put(res,value);
        }
    }   finally {
        if(is!=null){
            try {
                is.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    return hashMap;
}

}
EDIT 2 Possible source of the problem
I have made some tests with the same code, but only in simple java project. It looks like some encoding issue.
when using
Elements models2 = doc.select("option");

        for (Element e: models2){
           int key =  Integer.parseInt(e.attr("value"));
            String modelName = e.html();
            modelsList.add(value);
        }

the output from System.out.println(modelName) looks like this:
CITROËN C4 1.6i 16V EP turbo

but when parsing just a brand names using String s = e.attr("label"); the output is as it should be.
Do you have any idea, where the problem can be? I will post other parts of the code, if it will be necessary.
I would like to thank you for all your time and effort you give to my question

A: I've made it, but it's such a stupid thing. I've changed few things in the parseCarModels()
First of all, I've changed the return type to LinkedHashMap<Integer,String>. Parsing the html now seems to be faster.
Then I've changed the value variable from String to CharSequence. This allowed me to use Html.fromHtml(e.html), so the final code looks like this:
public LinkedHashMap<Integer,String> parseCarModels(){
    Elements models = document.select("option");
    int key;
    CharSequence value;
    for(Element e: models){
        key = Integer.parseInt(e.attr("value"));
        value = Html.fromHtml(e.html());
        hashMap.put(key,value.toString());
    }
    if(is!=null){
        try {
            is.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return hashMap;
}

Thank you for all your help. I really appreciate that. I hope that this code isn't very ineffective


text:
Q: How to make stylish pageviews counter using html and css? I want to make stylish pageviews counter for my site using html and css like which is in the given website:http://o2tricks.blogspot.com/,
if you know anything about it then tell me or give me link.

A: here is some link for menu style
http://tympanus.net/Development/CreativeLinkEffects/
http://tympanus.net/Development/CreativeButtons/

A: Here is some links for stat counters for website just signup embed the given code

*

*Amazing Stat Counter

*GoStats

*Stat Counter

*visitor hit counter


text:
Q: compress dir to same size split files,depressed files individual? I need to transfer a 1G folder over the network, and the data formats I send and receive are all under my control. In order to speed up the reception of data, I do this now:

*

*Before transferring, compress the 1G folder and then transfer it.

*after download all,decompress it.
It can reduce some time because the amount of data transferred becomes smaller, but it also requires time for decompression. Is it possible to compress a folder into many files of the same size, download one file and decompress one file, and when all files are decompressed, it will be the initial folder? my question is:

*

*Can this be achieved?

*How can I uncompressing file while downloading it?

*how to reduce the download and uncompress time?

A: *

*Suppose original folder is in the HOME directory. Make a tar archive of the 1G folder using a commands like,
cd;
mkdir tmp;
tar -cvzf tmp/original-folder.tar.gz original-folder

*Split the tar archive into small files like, xaa, xab, ..., using the split command, e.g.,
split --bytes=100000000 original-folder.tar.gz

*Join the pieces at the destination with the cat command,
cat xaa xab xac [...] > transferred-folder.tar.gz

*Untar to get the folder
tar -xvzf transferred-folder.tar.gz


text:
Q: Double anudatta marking using devanagari
Can anyone tell me as to how I will produce the above text using the "devanagari" package. My input is the following:
{\dn\dnveda tat \|{sa}\_{vi}tur-vare.nya.m |}

but I don't get the double || mark over the "re" line. How can i produce it?
\documentclass{revtex4}
\usepackage{devanagari}
\usepackage[width=4.5in, height=7.0in, top=0.3in, papersize={5.5in,8.5in}]{geometry}

\begin{document}
\title{{\dn \huge || sandhyaa-vandanam ||}}
\author{{\dn \large puurvabhaaga.h}}
\maketitle

\section*{{\dn\dnnum \Large aacamanam || 1 ||}}

\begin{flushleft}
\begin{itemize}
\item{{\dn acyutaaya nama.h |}}
\item{{\dn anantaaya nama.h |}}
\item{{\dn govindaaya nama.h ||}}
\end{itemize}
\vspace*{0.4cm}

{\dn ke"sava| naaraaya.na| maadhava| govinda| vi.s.no| madhusuudana| trivikrama| vaamana| "sriidhara| h.r.siike"sa| padmanaabha| daamodara||}

\section*{{\dn\dnnum \Large ga.napati-dhyaanam || 2 ||}}

\begin{verse}
{\dn "suklaambaradhara.m vi.s.nu.m "sa"sivar.na.m caturbhujam | \\ prasannavadana.m dhyaayet sarva-vighnopa"saantaye||}
\end{verse}

\section*{{\dn\dnnum \Large praa.naayaama.h || 3 ||}}
\begin{verse}
{\dn\dnveda\dnsamaveda o.m bhu.h| o.m bhuva.h| o\@suva.h| o.m maha.h| o.m jana.h| o.m tapa.h| o\@\_{sa}tyam|| \\ o.m tat \|{sa}\_{vi}tu\|{rvare.nya}.m bha\|{rgo} \_{de}va\|{sya} dhimahi| \\ dhi\_{yo} yo \|{na}.h pra\_{co}da\|{yaa}t|| \\ omaa\_{po}-jyo\_{ti}-ra\_{so}.am.r\_{ta.m}-bra\_{hma} bhurbhu\_{va}ssu\_{va}rom||}
\end{verse}
\end{document}

This is how i typeset using the devanagari package in LaTeX. then i save this as abc.dn file and then run the devnagari preprocessor to get the output.

A: I don't know if this is the correct way, but it seems to do what you need:
{\dn\dnveda tat \|{sa}\_{vi}tur-va\|{re}\|{\,}\negthinspace.nya.m |}


text:
Q: Enum in Annotations I have an annotation I can't change which expects two String arguments.
I'd like to use it like this:
@RequestMapping( MyUrls.FOO.a, MyUrls.FOO.b )

This is how I imagined implementing it
public enum MyUrls {
    FOO("a", "b"),
    BAR("c", "d");

    public String a, b;
    MyUrls(String a, String b) {
        this.a = a;
        this.b = b;
    }
}

This doesn't work since a or b can't be statically resolved.
What alternatives do I have which are nicer than:
class MyUrls {
    public static String FOO_A = "";
    public static String FOO_B = "";
    // ...
}

A: Although your question does not look like a question but as a declaration, I agree with you.
You cannot use enum members when you are defining annotations. Only "real" constants, i.e. static final fields and constant expressions are applicable. So, there is no good alternative right now.

A: You could use a static inner class to group your strings.
class MyUrls {
    public static final class Foo{
       public static final String A = "";
       public static final String B = "";
       // ...
    }
}
//works as
MyUrls.Foo.A


text:
Q: Fluent Nhibernate One to One mapping with non primary key Not able to figure out the proper mapping for below table.
  Table: ItemSale    {ItemCode, SaleDate, Qty, SaleCode}
         ItemCode and SaleDate are composite key.
         SaleCode is a derived column, generated from the combination of ItemCode and SaleDate column.

  Table: ItemSaleDetail {SaleCode, Agent}
         SaleCode is a primary key and foreign key from ItemSale table for SaleCode column.

Entities and their mappings are given below.
ItemSale
public class ItemSale
{
    public virtual string ItemCode { get; set; }
    public virtual string Date { get; set; }
    public virtual string  SaleCode { get; set; }
    public virtual ItemSaleDetail SaleDetail { get; set; }
}

public class ItemSaleMap : ClassMap<ItemSale>
{
    public ItemSaleMap()
    {
        Table("ItemSale");
        CompositeId()
          .KeyReference(x => x.ItemCode, "ItemCode")
          .KeyProperty(x => x.Date, "SaleDate");
        HasOne(x => x.SaleDetail).Cascade.All();
    }
}

ItemSaleDetail
public class ItemSaleDetail
{
    public virtual string ItemSaleCode { get; set; }
    public virtual string Agent { get; set; }
    public virtual ItemSale SaleParent { get; set; }

}

public class ItemSaleDetailMap : ClassMap<ItemSaleDetail>
{
    public ItemSaleDetailMap()
    {
        Table("ItemSaleDetail");
        Id(x => x.ItemSaleCode).GeneratedBy.Foreign("SaleParent");
        Map(x => x.Agent, "Agent");
        HasOne(x => x.SaleParent).Constrained();
    }
}

I have given above the basic one to one mapping being used in traditional way which I know is wrong in this case.
Please suggest how to provide the proper mapping in this case.
Also if derived column SaleCode to be generated by the application, how can we have this property in my entity. As it is not allowed have multiple mapping for a single column.

A: OK, with assignable ID we can do it like this. Firstly we should be sure, that the ID is assigned, so we can adjust the getter of the <id> ItemSaleCode like this:
public class ItemSaleDetail
{
    string _itemSaleCode;

    public virtual string ItemSaleCode
    {
        get { return _itemSaleCode ?? SaleParent.SaleCode ; }
        set { _itemSaleCode  = value; }
    }

Now, we need mapping like this:

<id name="ItemSaleCode" column="SaleCode" type="String" generator="assigned" />
<one-to-one name="SaleParent" class="ItemSale"
    constrained="true" property-ref="SaleCode" />
...

    ...

Which in Fluent should be like this:
public ItemSaleDetailMap()
{
    ...
    Id(x => x.ItemSaleCode)
        .CustomType<String>()
        .Column("SaleCode")
        .GeneratedBy.Assigned();

    HasOne(x => x.SaleParent)
       .ProeprtyRef("SaleCode")
       .Constrained();
}

public ItemSaleMap()
{
    References(x => x.SaleDetail)
       .Column("SaleCode")
       .Unique()
       .Cascade.All();
    Map(x => x.SaleCode)
       .Column("SaleCode")
       .Not.Update()
       .Not.Insert()
}

But again, Surrogate INT or LONG keys are the way I would go for sure...


text:
Q: The added JPanel only shows up when added from a different method? I am trying to create a program which first adds rows of JPanel. After a JPanel has been added, you can then add squares by clicking "Add Horizontal" and specifying the row index (from 0) to which a square should be added.
I'm trying to add my JPanel with one of these squares already added.
However, this first square does not show up. When I add another square, it's as if the square is there, but is just invisible.
You can see a demonstration of this in the attached image, where the first squares of index 2 and index 3 are simply invisible with no JLabel added.
How can I amend my code so that the first square is shown immediately after the "Add Vertical" JButton is clicked?
import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;
import java.awt.event.*;
public class HistoryEditor extends JFrame{

public static Color randomColor(){
    return new Color((float)Math.random(), (float)Math.random(), (float)Math.random());
}

public HistoryEditor(){

    setLayout(new BorderLayout());

    final JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    JPanel controlPanel = new JPanel(new FlowLayout());
    final JTextField tf = new JTextField(20);
    JButton addVertical = new JButton("Add Vertical");
    JButton addHorizontal = new JButton("Add Horizontal");
    JButton removeVertical = new JButton("Remove Vertical");

    addVertical.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
            JPanel newPanel = new JPanel();
            newPanel.setPreferredSize( new Dimension(getWidth(), 50) );
            newPanel.setMaximumSize( newPanel.getPreferredSize() );
            newPanel.setMinimumSize( newPanel.getPreferredSize() );
            newPanel.setBackground( HistoryEditor.randomColor() );
            newPanel.setLayout( new BoxLayout( newPanel, BoxLayout.X_AXIS ) );

            JPanel eventPanel = new JPanel();
            eventPanel.setBackground( HistoryEditor.randomColor() );
            eventPanel.setMaximumSize( new Dimension(50, newPanel.getHeight() ) );
            eventPanel.setMinimumSize( new Dimension(50, newPanel.getHeight() ) );
            eventPanel.setPreferredSize( new Dimension(50, newPanel.getHeight() ) );
            eventPanel.add( new JLabel( tf.getText() ) );
            eventPanel.revalidate();
            newPanel.add(eventPanel);
            newPanel.revalidate();
            mainPanel.add( newPanel );
            mainPanel.revalidate();
            mainPanel.repaint();
            eventPanel.repaint();

        }
    });

    addHorizontal.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
            try{
                int index = Integer.parseInt(tf.getText());
                JPanel selectedPanel = (JPanel)mainPanel.getComponent( index );

                JPanel eventPanel = new JPanel();
                eventPanel.setBackground( HistoryEditor.randomColor() );
                eventPanel.setMaximumSize(new Dimension(50, selectedPanel.getHeight()));
                eventPanel.setMinimumSize(new Dimension(50, selectedPanel.getHeight()));
                eventPanel.add( new JLabel( tf.getText() ) );
                selectedPanel.add(eventPanel);
                selectedPanel.revalidate();
                selectedPanel.repaint();

            }catch(Exception ex){}
        }
    });

    removeVertical.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
            try{
                int index = Integer.parseInt(tf.getText());
                mainPanel.remove(index);
                mainPanel.revalidate();
                mainPanel.repaint();

            }catch(Exception ex){}
        }
    });

    controlPanel.add(tf);
    controlPanel.add(addVertical);
    controlPanel.add(addHorizontal);
    controlPanel.add(removeVertical);
    add(mainPanel, BorderLayout.CENTER);
    add(controlPanel, BorderLayout.SOUTH);
    setSize(1000, 1000);
    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

public static void main(String[]args){
    HistoryEditor he = new HistoryEditor();
}

}

A: eventPanel.setPreferredSize( new Dimension(50, newPanel.getHeight() ) );

Components have a size of (0, 0) when they are created.
So you are setting the preferred size of your eventPanel to be (50, 0) which means the added component won't be seen because the height of the panel is 0.
You only need the revalidate() and repaint() on the mainPanel. This will cause the layout manager to be invoked and all the child components of the mainPanel will be repainted.
Also, there is no need for the eventPanel. You can just add the label directly to the newPanel. You just need to make sure you use:
label.setOpaque(true);

so the background of the label will be painted.
And when you use the label there will be no need to set the maximum/minimum size since they are equal to the preferred size.


text:
Q: Cors Errors AWS Amplify Serverless Function Rest API Gateway Access to XMLHttpRequest at 'https://***.execute-api.us-east-1.amazonaws.com/dev/users' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
I get the above error for the following code.
const user = await Auth.currentAuthenticatedUser();
    const token = user.signInUserSession.idToken.jwtToken;
    const header = {
        headers: {
            Authorization: token,
        },
    };
    const resp = await API.get("OneRestApi", "/users", header);

But from the postman calling the endpoint https://***.execute-api.us-east-1.amazonaws.com/dev/users results in no error. Postman output:
{
"success": "get call succeed!",
"url": "/users"

}
But when I change to another endpoint "/campaigns"
   const user = await Auth.currentAuthenticatedUser();
    const token = user.signInUserSession.idToken.jwtToken;
    const header = {
        headers: {
            Authorization: token,
        },
    };
    const resp = await API.get("OneRestApi", "/campaigns", header);

The code runs successfully.  From APIGateWay I have enabled the cors.  Here is the lambda code for the "/users" path.
/*
Copyright 2017 - 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at
    http://aws.amazon.com/apache2.0/
or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
*/

var express = require("express");
var bodyParser = require("body-parser");
var awsServerlessExpressMiddleware = require("aws-serverless-express/middleware");

// declare a new express app
var app = express();
app.use(bodyParser.json());
app.use(awsServerlessExpressMiddleware.eventContext());

// Enable CORS for all methods
app.use(function (req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "*");
    next();
});

/**********************
 * Example get method *
 **********************/

app.get("/users", function (req, res) {
    // Add your code here
    res.json({ success: "get call succeed!", url: req.url });
});

app.get("/users/*", function (req, res) {
    // Add your code here
    res.json({ success: "get call succeed!", url: req.url });
});

/****************************
 * Example post method *
 ****************************/

app.post("/users", function (req, res) {
    // Add your code here
    res.json({ success: "post call succeed!", url: req.url, body: req.body });
});

app.post("/users/*", function (req, res) {
    // Add your code here
    res.json({ success: "post call succeed!", url: req.url, body: req.body });
});

/****************************
 * Example put method *
 ****************************/

app.put("/users", function (req, res) {
    // Add your code here
    res.json({ success: "put call succeed!", url: req.url, body: req.body });
});

app.put("/users/*", function (req, res) {
    // Add your code here
    res.json({ success: "put call succeed!", url: req.url, body: req.body });
});

/****************************
 * Example delete method *
 ****************************/

app.delete("/users", function (req, res) {
    // Add your code here
    res.json({ success: "delete call succeed!", url: req.url });
});

app.delete("/users/*", function (req, res) {
    // Add your code here
    res.json({ success: "delete call succeed!", url: req.url });
});

app.listen(3000, function () {
    console.log("App started");
});

// Export the app object. When executing the application local this does nothing. However,
// to port it to AWS Lambda we will create a wrapper around that will load the app from
// this file
module.exports = app;

Interestingly the code worked before I added anoter path to the API.

A: Your have a problem with your preflight request. A preflight request ist only sent by browsers and not by tools like Postman, so that is why the Postman request is still working.
The preflight request is an OPTIONS request, so please check that you have an OPTIONS method in API Gateway for the path your are requesting, and check its configuration  and that you for example aren't sending or expecting credentials with the OPTIONS request. Including credentials in a preflight request ist not allowed according to the Mozilla CORS Documentation.
A reason why the request stops working after adding another path might be that you have made manual changes (perhaps regarding Authentication or CORS) to your API in the API Gateway Console. When you then push the same API with Amplify those changes are often overwitten. Please check that this isn't the case. And try to make all changes through the Amplify API (if you have created the API there) to avoid those problems.


text:
Q: ItemUpdating event on DocumentSet [;]
We have a document-set the event receiver is attached to the ContentType (for Document-Set), the idea is when a new site is created document-Set is created as part of provisioning and the event is attached to the it. We tried attaching event-receiver using (typical) PS script. We can see the event-receiver attached in the SP Manager as well as the (event receiver) count.
The problem is Event receiver (itemupdated) does not trigger when user adds/updates the document within the document-Set.
Eventreceiver triggers when we try to modify documentSet metadata/fields, and when we attach it directly to the list instead of documentSet. The documentSet wraps the class SPFolder so the add/edit document will not trigger the itemUpdated event? Is there any event for when document is added/updated from the documentSet? What am I missing here?
Any pointers will be great help.
regards,
[;]

A: You need to add event handlers for each content type that can be stored in the document set that you want to handle the events for.  For example, if your document set, holds 'Document' content types, you need to add event handlers for the 'Document' content type.
You have attached an event handler to the document set, but not the documents within the document set.


text:
Q: Jquery - Microprocessor seamless command sending fails In Google Chrome while using ajax method with Username, Password in URL it again asks the Username/password popup.
  var lummens_url = 'https://admin:9999@ip/command.htm?language=ie&';

  $.ajax({
    url: lummens_url + 'pen-tilt-zoom=' + embedded_processor_commands,
    type: "GET",
    dataType: 'json',
    xhrFields: {
      withCredentials: true
    }
  });

But same URL when i apply in --incognito address bar it works on every attempt without username/password popup to fill in again.
How can you completely avoid the $.ajax method but use something like $.iframe(submit, onsubmitfinish(){ close iframe }) ;? so that this does not annoy the end-user?


text:
Q: NET 6: ZipArchive can't be opened in Windows I'm trying to write a process that minify's images. The process accepts single images, or a zip file.
If it's a zip file, it extracts the zip and minify's valid files.
The process returns a zip file. However, when opening in windows, it throws an error that the zip can't be opened. If I open in 7zip, it works fine.
Has anyone run into this problem before and have any suggestions:
MemoryStream outputStream = new MemoryStream();
if (ImageMinificationHelpers.ZipTypes.Contains(file.ContentType))
{
    ZipArchive compressedArchive = new ZipArchive(outputStream, ZipArchiveMode.Create);
    using (ZipArchive archive = new ZipArchive(file.OpenReadStream()))
    {
        foreach (ZipArchiveEntry entry in archive.Entries)
        {
            if (ImageMinificationHelpers.ValidFileExtensions.Contains(Path.GetExtension(entry.FullName)))
            {
                ZipArchiveEntry zipArchiveEntry = compressedArchive.CreateEntry(entry.Name);
                using (Stream zipStream = zipArchiveEntry.Open())
                {
                    MemoryStream unzippedEntryStream = await ImageMinificationHelpers.Compress(entry.Open(), width, height, quality, cancellationToken);
                    await unzippedEntryStream.CopyToAsync(zipStream, cancellationToken);
                }
             }
         }
     }
 }
 else
 {
     outputStream = await ImageMinificationHelpers.Compress(file.OpenReadStream(), width, height, quality, cancellationToken);
 }
 outputStream.Seek(0, SeekOrigin.Begin);
 return File(outputStream, "application/zip", file.FileName);

A: This was solved by a previous post: Building a corrupted zip file using ASP.Net core and Angular 6
MemoryStream outputStream = new();
if (ImageMinificationHelpers.ZipTypes.Contains(file.ContentType))
{
    /*
      This is the important difference.
      Put it in a using, and set Keep Open as true.
      This ensures the memory stream doesn't get disposed.
    */
    using (ZipArchive compressedArchive = new(outputStream, ZipArchiveMode.Create, true))
    {
        using (ZipArchive archive = new(file.OpenReadStream()))
        {
            foreach (ZipArchiveEntry entry in archive.Entries)
            {
                if (ImageMinificationHelpers.ValidFileExtensions.Contains(Path.GetExtension(entry.FullName)))
                {
                    ZipArchiveEntry zipArchiveEntry = compressedArchive.CreateEntry(entry.Name);
                    using (Stream zipStream = zipArchiveEntry.Open())
                    {
                        MemoryStream unzippedEntryStream = await ImageMinificationHelpers.Compress(entry.Open(), width, height, quality, cancellationToken);
                        await unzippedEntryStream.CopyToAsync(zipStream, cancellationToken);
                    }
                }
            }
        }
    }
}
else
{
    outputStream = await ImageMinificationHelpers.Compress(file.OpenReadStream(), width, height, quality, cancellationToken);
}
outputStream.Seek(0, SeekOrigin.Begin);
return File(outputStream, file.ContentType, file.FileName);


text:
Q: my login script fails at verifying the hashed password I'am making a login screen for my blog but when it checks if the password you set in the input field is the same as the hashed password in the database he is saying that my password is wrong when it isn't.
I've googled a long time now and asks a couple of class mates but it still doesn't work.
<form id="loginForm" method="post" action="?page=blogInput">

LOGIN

            <input type="text" placeholder="username" name="username" id="username" maxlength="24">

            <input type="password" placeholder="password" name="password" id="password" minlength="8"
                   maxlength="16">

            <input type="submit" value="login" id="submit">
        </form>
  <?php
include_once('resources/db.php');

$username = $_POST['username'];
$password = $_POST['password'];

$query = $dbh->prepare("SELECT username FROM users WHERE username=:username");
$query->execute(array(':username' => $username,));
$saved_password = $query->fetch(PDO::FETCH_ASSOC)['password'];

if (isset($username, $password)){
    if (password_verify($password, $saved_password)){
        if ($query->rowCount() == 1){
            echo "";
        }
        else{
            echo "";
        }
    }else{
        echo "";
    }

}else{
    echo "";
}

?>

It is know edited as the last comment suggested.

A: Your code checks $password twice. First in the query it checks if the password matches. Then, it checks if the hash of the password matches the same value.
Just remove the and password= nonsense from your database query, and finish correcting the parameter inputs as mentioned in comments. You should be fine.

... I just noticed...
SELECT username FROM ...

You aren't selecting the password (hash) from the database!
SELECT `password` FROM ...


text:
Q: Old versions of the OS X Human Interface Guidelines I'm looking to write a paper on how the OS X user interface has evolved from OS X Leopard all the way through to OS X Yosemite and am seeking guidance on where to find older versions of the OS X Human Interface Guidelines documentation.
The following data should aid in the search in the circumstance that navigating the WayBack Machine in the event that that is the only viable option.

*

*OS X 10.5 Leopard Release Date: October 26, 2007

*OS X 10.6 Snow Leopard Release Date: August 28, 2009

*OS X 10.7 Lion Release Date: July 20, 2011

*OS X 10.8 Mountain Lion Release Date: July 25, 2012

*OS X 10.9 Mavericks Release Date: October 22, 2013

*OS X 10.10 Yosemite Release Date: October 16, 2014

Any help in finding these documents would be greatly appreciated.
If there's not a complete link to them, perhaps several answers could point to each or one answer be maintained to point to them all.

A: Introduction (HTML):

Saved 49 times between August 5, 2011 and June 14, 2016.

– and at the time of writing, the earliest capture presents a page with a suggestion of 1,613 captures over a more extensive period, beginning 2010-09-09.
The PDF versions linked from the accepted answer provide a more useful way of comparing versions of the Guidelines at points in time.

Side note: from http://forums.macrumors.com/threads/1979059/ it seems that for a while, captures such as http://web.archive.org/web/20140815012123/https://developer.apple.com/library/mac/documentation/userexperience/conceptual/applehiguidelines/Windows/Windows.html#//apple_ref/doc/uid/20000961-SW13 (OS X Human Interface Guidelines: UI Element Guidelines: Windows) were not available from the Wayback Machine.

A: An addendum to the accepted answer
It seems that Wayback Machine stealthy removed some snapshots.
2008-06-09
https://web.archive.org/web/20081222045913/http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/OSXHIGuidelines.pdf
redirects to
https://web.archive.org/web/20090117202219/http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/OSXHIGuidelines.pdf
2008-01-15
https://web.archive.org/web/20080225084449/http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/OSXHIGuidelines.pdf
redirects to
https://web.archive.org/web/20080512015743/http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/OSXHIGuidelines.pdf - The PDF can't be loaded/opened. Tested with Chrome and Firefox.
2006-10-03
https://web.archive.org/web/20070520203932/http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/OSXHIGuidelines.pdf
redirects to
https://web.archive.org/web/20060612095317/http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/OSXHIGuidelines.pdf - Which is actually 2006-05-23.

A: It wasn't easy, but I think I got all of them.
2006-10-03:
https://web.archive.org/web/20070520203932/http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/OSXHIGuidelines.pdf
2008-01-15:
https://web.archive.org/web/20080225084449/http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/OSXHIGuidelines.pdf
2008-06-09:
https://web.archive.org/web/20081222045913/http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/OSXHIGuidelines.pdf
2009-08-20:
https://web.archive.org/web/20110604173215/http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/OSXHIGuidelines.pdf
2012-07-23:
https://web.archive.org/web/20121004065110/https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/OSXHIGuidelines.pdf
2013-10-22:
https://web.archive.org/web/20140603021344/https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/OSXHIGuidelines.pdf

A: The current OS X HIG is delivered through iBooks for free to the general public. Get it at https://itunes.apple.com/us/book/os-x-human-interface-guidelines/id930571558?mt=11#
If you're not a Mac developer, you might consider joining if that's your best avenue - if not, you might see if a local university or library has a technical research department and can assist you. Your idea to search archive.org might also reveal some gems, since Apple did release significant portions of their developer documentation to the general web and not behind the NDA portal that requires an account.

A: Here are some other versions not in the other answers:
2000-09-08: http://interface.free.fr/Archives/AdoptingAquaInterface.pdf [archive link]
2001-10-01: https://archive.org/details/AquaHumanInterfaceGuidelines-Preliminary
2002-06-11: http://mirror.informatimago.com/next/developer.apple.com/documentation/LegacyTechnologies/Conceptual/AquaHIGuidelines/AquaHIGuidelines.pdf [archive link] [alternate link]
2005-09-08: http://www.multimedialab.be/doc/tech/doc_osx_hi_guidelines.pdf [archive link]
2006-10-03: http://mirror.informatimago.com/next/developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/OSXHIGuidelines.pdf [archive link]
I know this question is asking specifically about OS X guidelines, but I came across it in a search, and it's one of the top links for "old versions of apple human interface guidelines."  Here are some pre-OSX versions I've found:
1987:
https://archive.org/details/applehumaninterf00appl
1992:
Text PDF: https://vintageapple.org/inside_r/pdf/Human_Interface_Guidelines_1992.pdf [archive link]
Scanned PDF: https://vintageapple.org/macprogramming/pdf/Macintosh_Human_Interface_Guidelines_1992.pdf [archive link]
1995: https://apps.hci.rwth-aachen.de/borchers-old/cs377a/handouts/HIGuidelines.pdf [archive link] (and a technical Q&A from that year [archive link])
1997: http://interface.free.fr/Archives/Apple_HIGOS8_Guidelines.pdf [archive link]


text:
Q: After Spring Boot 2 upgade authorization server returns "At least one redirect_uri must be registered with the client." I upgraded our authorization server from Spring Boot 1.5.13.RELEASE to 2.1.3.RELEASE, and now I can authenticate, but I can no longer access the site. Here is the resulting URL and error after the POST to /login.
https://auth-service-test-examle.cfapps.io/oauth/authorize?client_id=proxy-service&redirect_uri=http://test.example.com/login&response_type=code&state=QihbF4

   OAuth Error

   error="invalid_request", error_description="At least one redirect_uri must be registered with the client."

To troubleshoot, I started a fresh project based on the Spring Security 5.1.4.RELEASE sample "oauth2authorizationserver." I layered on the features used in our Spring Boot 1.5.13 authorization server making sure the unit tests passed (except one test class). If I @Ignore the failing tests and deploy the code I get the problem described above.
The problem is reproducible in the AuthenticationTests.loginSucceeds() JUnit test that passed before the upgrade. It expects a 302, but now it gets a 403 because it goes to the root of the authentication server. I published the entire example on GitHub
spring-security-5-upgrade_sso-auth-server
Clone the project and run the unit tests and you will see the failures.
Here are some of the key settings that can be found in the project on GitHub.
  public class AuthServerConfig extends AuthorizationServerConfigurerAdapter {

  private final String privateKey;

  private final String publicKey;

  private final AuthClientDetailsService authClientDetailsService;

  private final AuthenticationManager authenticationManager;

  private final AuthUserDetailsService authUserDetailsService;

  @Autowired
  public AuthServerConfig(
      @Value("${keyPair.privateKey}") final String privateKey,
      @Value("${keyPair.publicKey}") final String publicKey,
      final AuthClientDetailsService authClientDetailsService,
      final AuthUserDetailsService authUserDetailsService,
      final AuthenticationConfiguration authenticationConfiguration) throws Exception {
    this.privateKey = privateKey;
    this.publicKey = publicKey;
    this.authClientDetailsService = authClientDetailsService;
    this.authUserDetailsService = authUserDetailsService;
    this.authenticationManager = authenticationConfiguration.getAuthenticationManager();
  }

  @Override
  public void configure(final ClientDetailsServiceConfigurer clients) throws Exception {
    clients.withClientDetails(authClientDetailsService);
  }

  @Override
  public void configure(final AuthorizationServerEndpointsConfigurer endpoints) {
    endpoints
        .authenticationManager(authenticationManager)
        .accessTokenConverter(accessTokenConverter())
        .userDetailsService(authUserDetailsService)
        .tokenStore(tokenStore());

  }

    @Bean
    public TokenStore tokenStore() {
        return new JwtTokenStore(accessTokenConverter());
    }

  @Bean
  public JwtAccessTokenConverter accessTokenConverter() {
    final JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setSigningKey(privateKey);
    converter.setVerifierKey(publicKey);
    return converter;
  }

}

public class GlobalAuthenticationConfig extends GlobalAuthenticationConfigurerAdapter {

  private final AuthUserDetailsService authUserDetailsService;

  @Autowired
  public GlobalAuthenticationConfig(final AuthUserDetailsService authUserDetailsService) {
    this.authUserDetailsService = authUserDetailsService;
  }

  @Override
  public void init(AuthenticationManagerBuilder auth) throws Exception {
    auth
        .userDetailsService(authUserDetailsService)
        .passwordEncoder(new BCryptPasswordEncoder());
  }
}

  @Configuration
  @Order(-20)
  protected class LoginConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {

      // @formatter:off
      http
          .requestMatchers().antMatchers(LOGIN, "/oauth/authorize", "/oauth/confirm_access")
            .and()
            .logout().permitAll()
            .and()
         .authorizeRequests().anyRequest().authenticated()
            .and()
         .formLogin().loginPage(LOGIN).permitAll();
      // @formatter:on
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
      auth.parentAuthenticationManager(authenticationManager);
    }
  }

public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  private final AuthUserDetailsService authUserDetailsService;

  @Autowired
  public WebSecurityConfig(AuthUserDetailsService authUserDetailsService) {
    this.authUserDetailsService = authUserDetailsService;
  }

  @Override
  public void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth
        .userDetailsService(authUserDetailsService)
        .passwordEncoder(new BCryptPasswordEncoder());
  }

}

What else needs to be done in Spring Boot 2.1.3.RELEASE to redirect the user back to the original webpage?

A: It's important that OAuth 2.0 clients register a redirect_uri with Authorization Servers as an Open Redirector mitigation. As such, Spring Boot 2.1.x has this as its default behavior, which is why you're seeing the error.
You can do one of two things:
Add redirect_uris, one for each client
Ideally, you'd update your clients to each have a registered redirect_uri, which would likely be retrieved in an implementation of ClientDetailsService:
public class MyClientDetailsService implements ClientDetailsService {
    private final MyRespository myRepository;

    public ClientDetails loadClientByClientId(String clientId) {
        return new MyClientDetails(this.myRepository.getMyDomainObject(clientId));
    }

    private static class MyClientDetails extends MyDomainObject implements ClientDetails {
        private final MyDomainObject mine;

        public MyClientDetails(MyDomainObject delegate) {
            this.delegate = delegate;
        }

        // implement ClientDetails methods, delegating to your domain object

        public Set<String> getRegisteredRedirectUri() {
            return this.delegate.getRedirectUris();
        }
    }
}

This setup with the private subclass - while not necessary - is nice because it doesn't tie the domain object directly to Spring Security.
Add a custom RedirectResolver
Or, you can customize the RedirectResolver, though this wouldn't secure against Open Redirects, which was the original reason for the change.
public MyRedirectResolver implements RedirectResolver {
    private final RedirectResolver delegate = new DefaultRedirectResolver();

    public String resolveRedirect(String redirectUri, ClientDetails clientDetails) {
        try {
            return this.delegate.resolveRedirect(redirectUri, clientDetails);
        } catch ( InvalidRequestException ire ) {
            // do custom resolution
        }
    }
}


text:
Q: How would I compress keyboard input, if statements into a for loop? (shooting bullets) so I'm creating an XNA game, that consists of a spaceship, shooting bullets around, at different enemy spaceships that carry around "strings". It's essentially a spelling game, where I have to spell out the word by hitting the spaceships with the right letters.
Anyway, my problem is that, I've currently got two "if" statements in order of shooting a bullet, and it'd be some horrible programming if I did this for the rest of the 25 letter keys on the keyboard. Yes, I do need every single "letter" key on the keyboard, as it will be a spelling game. Here is an example of code I've got for one of the bullets.
What I'm essentially doing here is if "Fired" boolean is false, and the appropriate key is pressed, I am positioning a rectangle in the position of the gun and setting "Fired" to true, to let the bullet loose. An then obviously whenever it hits the top of the screen, I set the fired back to false, in order of a reloading concept.
 if (MyKeys.IsKeyDown(Keys.Q) && OldKeys.IsKeyUp(Keys.Q) && Fired[0] == false)
        {

            CurrentChar = "Q";
            Shot[0].X = SpaceStationGun.X;
            Shot[0].Y = SpaceStationGun.Y;
            Fired[0] = true;
        }

        if (Fired[0] == true)
        {
            Shot[0].Y -= SHOT_SPEED;
            if (Shot[0].Y < 0 - SHOT_HEIGHT)
            {
                Fired[0] = false;
            }
        }

Now the question is, how would I loop this for the rest of the 25 letter keys on the keyboard, and still hold the functionality?

A: Keyboard.GetState().GetPressedKeys() gives you a collection of Keys that were pressed during the duration of its state.
I do not see how your MyKeys and OldKeys are being updated but I will assume you can use the following
var keysPressed = MyKeys.GetPressedKeys()
    .Where(k => !OldKeys.GetPressedKeys().Contains(k));

foreach(var key in keysPressed)
{
    // Do your logic
}

OldKeys = MyKeys;

MyKeys = Keyboard.GetState();


text:
Q: parse XML to Map in java I have XML which i want to parse to Map. but due to lack of java knowledge i am not able to do it.
My XML format is something like this.
<configuration>
<config name="name1" type="main" format="xyz-D" size=1 scale=2 required=no/>
<config name="name2" type="sub" format="xyz-E" size=12 scale=5 required=no/>
<config name="name3" type="last" format="xyz-C" size=2 scale=1 required=no/>
<config name="name4" type="first" format="xyz-S" size=16 scale=3 required=no/>
<config name="name5" type="main" format="xyz-S" size=17 scale=2 required=no/>
<config name="name6" type="main" format="xyz-S" size=18 scale=2 required=no/>
<config name="name7" type="first" format="xyz-S" size=23 scale=4 required=no/>
<config name="name8" type="last" format="xyz-S" size=45 scale=2 required=no/>
<config name="name9" type="sub" format="xyz-s" size=39 scale=15 required=no/>
<configuration/>

how do i convert this to in MAP so i can used it for latter manipulation

A: Below is the code that builds Config objects corresponding to each <config> element. Improvise this to add these objects to a List or Map.
import java.io.StringReader;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;

public class ConfigImporter
{
    private static String cfgXml = "<configuration> <config name='name1' type='main' format='xyz-D' size='1' scale='2' required='no'/> <config name='name2' type='sub' format='xyz-E' size='12' scale='5' required='no'/> <config name='name3' type='last' format='xyz-C' size='2' scale='1' required='no'/> <config name='name4' type='first' format='xyz-S' size='16' scale='3' required='no'/> <config name='name5' type='main' format='xyz-S' size='17' scale='2' required='no'/> <config name='name6' type='main' format='xyz-S' size='18' scale='2' required='no'/> <config name='name7' type='first' format='xyz-S' size='23' scale='4' required='no'/> <config name='name8' type='last' format='xyz-S' size='45' scale='2' required='no'/> <config name='name9' type='sub' format='xyz-s' size='39' scale='15' required='no'/> </configuration>";

    public static void main(String[] args)
    {
        try
        {
            DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
            Document doc = dBuilder.parse(new InputSource(new StringReader(cfgXml)));

            // optional, but recommended
            // read this -
            // http://stackoverflow.com/questions/13786607/normalization-in-dom-parsing-with-java-how-does-it-work
            doc.getDocumentElement().normalize();

            System.out.println("Root element :" + doc.getDocumentElement().getNodeName());

            NodeList nList = doc.getElementsByTagName("config");

            System.out.println("----------------------------");

            for (int temp = 0; temp < nList.getLength(); temp++)
            {

                Node nNode = nList.item(temp);

                System.out.println("\nCurrent Element :" + nNode.getNodeName());

                if (nNode.getNodeType() == Node.ELEMENT_NODE)
                {

                    Element eElement = (Element) nNode;

                    Config c = new Config();

                    c.name = eElement.getAttribute("name");
                    c.type = eElement.getAttribute("type");
                    c.format = eElement.getAttribute("format");
                    c.size = Integer.valueOf(eElement.getAttribute("size"));
                    c.scale = Integer.valueOf(eElement.getAttribute("scale"));
                    String attribute = eElement.getAttribute("required");

                    c.required = Boolean.valueOf("Yes".equalsIgnoreCase(attribute) ? true : false);

                    System.out.println("Imported config : " + c);
                }
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

    public static class Config
    {
        @Override
        public String toString()
        {
            return "Config [name=" + name + ", type=" + type + ", format=" + format + ", size=" + size + ", scale=" + scale + ", required="
                    + required + "]";
        }

        public String name;
        public String type;
        public String format;
        public int size;
        public int scale;
        public boolean required;
    }
}


text:
Q: Compilation renders my home page content blank I want to enable Compilation on our Magento website, but when I enable it, I get blank content for my home page. It stops rendering before outputting the menu. Category and product pages seem to be fine.
We use the Mercado theme, and the home page uses a HomepageGrid block which is a CMS page.
Could anybody provide some insight?
Thanks

A: all you have to do is to check your error log. blank page means php error, and your output configured into error log, not screen. possible places to look:  path_to/magento/var/log/ files system.log and exception.log. or /var/log/ and folders httpd/error_log etc. looks like you have some module like featured products or other custom stuff on front page, check your CMS > Pages > Homepage content. thank you