text:
Q: How to add null terminator to char pointer, when using strcpy I have a program that's attempting to use the strcpy() function. I know that when one uses a char array such as: char array[10] the null terminator can be set by: array[0] = '\0'; However, how would I go about setting the null terminator(s) when using char pointers?
EDIT: The program compiles, but gives garbage as output
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void)
{
    char *target;
    char *src = "Test";

    target = malloc(sizeof(char));
    src = malloc(sizeof(char));

     strcpy(target,src);
     printf("%c\n",target);

    return 0;
}

A: In your code
strcpy(target,src);

src is not null-terminated. This invokes undefined behaviour.
Also, by using malloc(sizeof(char)); you're allocating memory for ony a single char element. which is probably you don't want.
Next, as per the man page of strcpy(),  (emphasis mine)

The strcpy() function copies the string pointed to by src, including the terminating null byte ('\0') to the buffer pointed to by dest. The strings may not overlap, and the destination string dest must be large enough to receive the copy.

so, as long as

*

*your source is a proper null-terminated char array (string)

*destination is having enough memory to hold the containts of source

you're good to go. So, you've to

*

*null-terminate the src array.

*allocate enough memory to target so that it can hold the contains of src.

Lastly, to mention, once you've used a string, you're supposed to use the %s format specifier with printf() to print the string.

A: You don't need to. Second argument of strcpy() needs to be nul terminated, and the first needs to fit the number of characters in source + the nul terminator.
The problems in your code are:

*

*You are using sizeof operator in wrong way and you are overwriting the src pointer by allocating memory again to it.
To get the length of a string you need strlen() and you don't need to call malloc() on every pointer.
You are getting garbage value because you are copying from uninitialized data since src points to a newly allocated space, because of
src = malloc(sizeof(char));

you should not do that.

*sizeof(char) == 1 by definition, so you are allocating space for just 1 byte, which if it was to be a valid C string, has to be '\0' because there is room for just 1 character.

*The correct printf() specifier for a string is "%s", you are using "%c" which is for a character.
The correct way to do it is
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void)
{
    char       *target;
    const char *src;

    src    = "Test"; /* point to a static string literal */
    target = malloc(1 + strlen(src)); /* allocate space for the copy of the string */
    if (target == NULL) /* check that nothing special happened to prevent tragedy  */
        return -1;

    strcpy(target, src);
    printf("%s\n", target);
    /* don't forget to free the malloced pointer */
    free(target);

    return 0;
}

A: target = malloc(10);

Have memory to accommodate the string and a nul terminator. I don't get why you are allocating memory for src as I see you are using a string literal. Just allocate enough memory for destination and do strcpy() make sure you are not writing to array out of bound.
The right way would be to
target = malloc((strlen(src) + 1));

Make a note that when you do
char *src = "Test";

The string "Test" is stored in a read-only location and the address of this location is returned to src. So your string is already in memory and no need to allocate memory for this again which you are trying to do and doing it wrongly. So get rid of malloc() for src

A: man strcpy

DESCRIPTION
  The  strcpy()  function copies the string pointed to by src, including the terminating null byte ('\0'), to the buffer pointed to by dest.

So you don't have to add null-terminate byte if src has it already.

BUGS
  If the destination string of a strcpy() is not large enough, then  anything  might  happen.

So :
char *src = "Test"; //  4 chars + '\0'
target = malloc(sizeof(char)); // Space for 1 char
 strcpy(target,src); // Woops !

A: Answers thus far have addressed the flaws in your code and your apparent misunderstanding rather than your question. Pointers to memory can be indexed just like arrays, so given:
char *target = malloc( 10 ) ;

One can set elements thus:
target[0] = '\0' ;

A: Sourav Ghosh's answer is correct, but for this specific case you should use strdup() as it handles both memory allocation and copying for you:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void)
{
    const char *src = "Test";   // You should make this const
    char *target = strdup(src); // Duplicate
    if (target == NULL) {       // Check
        return EXIT_FAILURE;
    }
    printf("%s\n", target);
    return EXIT_SUCCESS;
}


text:
Q: R--Filter Dynamically for 10 Quarters I'd like to filter the following dataset for 10 quarters starting at Q1 2021:
structure(list(Year = c(2002, 2002, 2002, 2002, 2002, 2002, 2002,
2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002,
2002, 2002, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003,
2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003,
2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004,
2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2005, 2005,
2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005,
2005, 2005, 2005, 2005, 2005, 2005, 2005, 2006, 2006, 2006, 2006,
2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006,
2006, 2006, 2006, 2006, 2006, 2007, 2007, 2007, 2007, 2007, 2007,
2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007,
2007, 2007, 2007, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008,
2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008,
2008, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009,
2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2010,
2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010,
2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2011, 2011, 2011,
2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011, 2011,
2011, 2011, 2011, 2011, 2011, 2011, 2012, 2012, 2012, 2012, 2012,
2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012,
2012, 2012, 2012, 2012, 2013, 2013, 2013, 2013, 2013, 2013, 2013,
2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2013,
2013, 2013, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014,
2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014,
2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015,
2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2016, 2016,
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2017, 2017, 2017, 2017,
2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
2017, 2017, 2017, 2017, 2017, 2018, 2018, 2018, 2018, 2018, 2018,
2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018,
2018, 2018, 2018, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019,
2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019,
2019, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020,
2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020,
2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2021, 2021,
2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021,
2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021,
2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021,
2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2022,
2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
2022, 2022, 2022, 2022, 2022, 2022, 2023, 2023, 2023, 2023, 2023,
2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023,
2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023,
2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023,
2023, 2023, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024,
2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024), Quarter = c(1,
1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1,
1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1,
1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1,
1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2,
2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2,
2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3,
3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3,
3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3,
3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3,
3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4,
4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4,
4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4,
4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
2, 2, 2, 2, 2, 2, 2), Name = c("Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_4", "Name_5", "Name_1",
"Name_2", "Name_3", "Name_4", "Name_5",
"Name_1", "Name_2", "Name_3",
"Name_4", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_5", "Name_1", "Name_2",
"Name_3", "Name_5"), Interest = c(47998744,
212537486, 64814280, 37572307, 109034562, 49556524, 216656962,
67422378, 36462961, 109164006, 51507223, 223656450, 69358647,
36788852, 108511260, 52623907, 227577079, 69263733, 35549413,
106889709, 50295319, 229185571, 67091600, 34344915, 102522629,
49971127, 225826369, 66495405, 33535801, 97460593, 50274064,
226202834, 67190263, 32864610, 96632152, 47551747, 227438418,
69107153, 33197895, 98853009, 47453558, 228391530, 69060457,
33177927, 100324962, 48794328, 230840882, 70831022, 34994359,
102252595, 52438823, 234118523, 74822023, 39033041, 107501508,
55637302, 238558134, 79151465, 41176714, 110639481, 56838457,
241091961, 82827744, 42764095, 112471888, 59896375, 249465650,
86522724, 45693800, 118124916, 64424080, 264794055, 92730606,
47813490, 126504673, 69621133, 276596719, 99449241, 53535772,
132391845, 72625569, 289197793, 104812463, 56042668, 136252107,
78624737, 310106248, 111466739, 61412122, 141782095, 84700269,
336264984, 121214593, 68733885, 148840778, 91162214, 390085351,
127134416, 74268369, 152103378, 93241404, 371995994, 129980452,
76582659, 152821426, 97429725, 397721755, 138700731, 80481391,
155849329, 103178535, 433151976, 150828708, 83984431, 161570721,
106680012, 548728287, 157751362, 85890641, 165503764, 107059280,
507568721, 161144237, 85209212, 164820263, 106560673, 525164898,
164692016, 83126116, 161238801, 110270377, 541545719, 172978580,
82493141, 178355555, 109313348, 532993455, 178379372, 82320780,
182809646, 105357214, 537594410, 177219066, 75627303, 182059782,
105367952, 535560462, 180519003, 71966173, 177554530, 99747003,
546456050, 182817902, 69973109, 177555524, 100715828, 547184844,
182940718, 69789453, 178012144, 95956574, 549336925, 173509891,
66534437, 160354331, 96190771, 543232004, 169483267, 64884308,
160881737, 95134642, 546463420, 168842248, 62749109, 161903566,
92749555, 551732301, 166355764, 60010334, 157190919, 89533742,
544960916, 160594132, 58165245, 143482598, 87158613, 545410994,
161260757, 57144888, 159214245, 87648238, 546060788, 159496467,
57265616, 164614674, 86697821, 547763698, 156585801, 56590640,
164179764, 85003197, 546144679, 150163953, 56684250, 163324519,
83624129, 550320919, 145741132, 56114920, 161319060, 84163890,
560860777, 142068134, 55822533, 161524303, 83239461, 585336903,
141165446, 54914806, 161632246, 79744782, 582252621, 132130313,
53225913, 161417403, 82403949, 590039449, 129564763, 52776014,
162661393, 81562433, 617692070, 130694750, 53956405, 166072140,
82588700, 643354560, 132674028, 55234558, 169936271, 81707450,
655269505, 132345649, 55488142, 173090418, 82045816, 677897278,
136925462, 56317096, 178501279, 83916966, 716102802, 143639461,
58760485, 185896142, 86874529, 748760759, 145622820, 61046304,
191893202, 87392290, 766689144, 142172063, 61964297, 195009870,
89140238, 798531675, 143142507, 62500892, 199339368, 92075059,
838676574, 150617311, 64686207, 206231765, 95540407, 860373206,
154030578, 66809360, 212321830, 97194055, 885988466, 156253436,
68624143, 214676929, 96694854, 904886941, 160716741, 69409108,
217874049, 102181929, 944422431, 166327020, 71992965, 224043376,
104722463, 970520293, 173068148, 73286680, 229298476, 107043192,
997946123, 181255627, 74891148, 233062712, 112248704, 1027741773,
193133252, 78176911, 238941791, 118250258, 1085842722, 201636182,
82731718, 248285391, 122401490, 1127438539, 202227834, 85984563,
253962329, 126410678, 1156040869, 208064951, 88510665, 258676271,
131236379, 1195206293, 214386947, 92425388, 264956579, 133919705,
1270131528, 224782680, 99110667, 273186639, 145402910, 1317693906,
230569868, 104595945, 279817998, 148602044, 1358739813, 232185680,
107810710, 286191496, 153122947, 1399286409, 234690849, 111956925,
293194461, 159946667, 1454752604, 239544457, 116886300, 301794643,
159270183, 1476517177, 243117648, 120249984, 305060190, 158312179,
1497511830, 250034915, 142187491, 305642292, 146456219, 1465748312,
239411402, 134415282, 292374098, 139703152, 1443930398, 237160902,
130707028, 300831349, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134551883,
1357118303, 240093771, 127742162, 299126264, 125634812, 1422191515,
230671670, 121656245, 293007695, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0)), row.names = c(NA, -533L), class = c("tbl_df", "tbl",
"data.frame"))

A: Three ways come to mind.

*

*Simply filter.
library(dplyr)
filtered_data <- filter(zz, Year %in% 2021:2022 | (Year == 2023 & Quarter %in% 1:2))

Demonstration that it limited to just 10 rows:
filtered_data <- dplyr::filter(zz, Year %in% 2021:2022 | (Year == 2023 & Quarter %in% 1:2))
count(filtered_data, Year, Quarter)
# # A tibble: 10 x 3
#     Year Quarter     n
#    <dbl>   <dbl> <int>
#  1  2021       1    15
#  2  2021       2    10
#  3  2021       3    10
#  4  2021       4    10
#  5  2022       1    10
#  6  2022       2    10
#  7  2022       3    10
#  8  2022       4    10
#  9  2023       1    10
# 10  2023       2    10

*Left-join with a frame that includes just the years/quarters you want. This method works better than above if you have non-continuous filtering requirements.
I_need <- tibble(Year=c(rep(2021,4),rep(2022,4),rep(2023,2)), Quarter=c(1:4,1:4,1:2))
I_need
# # A tibble: 10 x 2
#     Year Quarter
#    <dbl>   <int>
#  1  2021       1
#  2  2021       2
#  3  2021       3
#  4  2021       4
#  5  2022       1
#  6  2022       2
#  7  2022       3
#  8  2022       4
#  9  2023       1
# 10  2023       2
filtered_data2 <- left_join(I_need, zz, by = c("Year", "Quarter"))

*Math wizardry, prone to all sorts of problems/mistakes/missed-assumptions.
filtered_data2 <- filter(zz, between(Year + (Quarter-1)/4, 2021, 2023.25))

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why does `count_over_time` increase without matching raw data? ... or "How does count_over_time work?"
Given the following vector and value:
kube_job_created{
  app="prometheus",
  chart="prometheus-7.1.0",
  component="kube-state-metrics",
  heritage="Tiller",
  instance="100.96.2.23:8080",
  job="kubernetes-service-endpoints",
  job_name="foobar-24150",
  kubernetes_name="prometheus-kube-state-metrics",
  kubernetes_namespace="devops",
  namespace="devops",
  nodename="ip-1-1-1-1.ap-southeast-2.compute.internal",
  release="prometheus"
} 1538008393

Count over the entire vector returns 1:
count(kube_job_created{app="prometheus",chart="prometheus-7.1.0",component="kube-state-metrics",heritage="Tiller",instance="100.96.2.23:8080",job="kubernetes-service-endpoints",job_name="braze-user-attribute-sync-24150",kubernetes_name="prometheus-kube-state-metrics",kubernetes_namespace="devops",namespace="devops",nodename="ip-10-10-4-112.ap-southeast-2.compute.internal",release="prometheus"})

Result:
{} 1

Now, with count_over_time it's different depending on the range vector selector:
1m:
count_over_time(kube_job_created{app="prometheus",chart="prometheus-7.1.0",component="kube-state-metrics",heritage="Tiller",instance="100.96.2.23:8080",job="kubernetes-service-endpoints",job_name="braze-user-attribute-sync-24150",kubernetes_name="prometheus-kube-state-metrics",kubernetes_namespace="devops",namespace="devops",nodename="ip-10-10-4-112.ap-southeast-2.compute.internal",release="prometheus"}[1m])

Result is "2":
{app="prometheus",chart="prometheus-7.1.0",component="kube-state-metrics",heritage="Tiller",instance="100.96.2.23:8080",job="kubernetes-service-endpoints",job_name="braze-user-attribute-sync-24150",kubernetes_name="prometheus-kube-state-metrics",kubernetes_namespace="devops",namespace="devops",nodename="ip-10-10-4-112.ap-southeast-2.compute.internal",release="prometheus"} 2

*

*1h returns 120

*24h returns 2880

What exactly is it counting over time?

A: count_over_time counts the number of samples in the range, for each time series. Like all _over_time functions it works across all the samples of one time series at a time.
If you wanted the number of time series in an instant vector, then the count aggregator will tell you that.


text:
Q: Extending Error in Javascript with ES6 syntax & Babel I am trying to extend Error with ES6 and Babel. It isn't working out.
class MyError extends Error {
  constructor(m) {
    super(m);
  }
}

var error = new Error("ll");
var myerror = new MyError("ll");
console.log(error.message) //shows up correctly
console.log(myerror.message) //shows empty string

The Error object never get the right message set.
Try in Babel REPL.
Now I have seen a few solutions on SO (for example here), but they all seem very un-ES6-y. How to do it in a nice, ES6 way? (That is working in Babel)

A: Quoting
class MyError extends Error {
  constructor(message) {
    super(message);
    this.message = message;
    this.name = 'MyError';
  }
}

There is no need for this.stack = (new Error()).stack; trick thanks to super() call.

Although the above codes cannot output the stack trace unless this.stack = (new Error()).stack; or Error.captureStackTrace(this, this.constructor.name); is invoked in Babel. IMO, it maybe one issue in here.
Actually, the stack trace can be output under Chrome console and Node.js v4.2.1 with this code snippets.
class MyError extends Error{
        constructor(msg) {
                super(msg);
                this.message = msg;
                this.name = 'MyError';
        }
};

var myerr = new MyError("test");
console.log(myerr.stack);
console.log(myerr);

Output of Chrome console.
MyError: test
    at MyError (<anonymous>:3:28)
    at <anonymous>:12:19
    at Object.InjectedScript._evaluateOn (<anonymous>:875:140)
    at Object.InjectedScript._evaluateAndWrap (<anonymous>:808:34)
    at Object.InjectedScript.evaluate (<anonymous>:664:21)

Output of Node.js
MyError: test
    at MyError (/home/bsadmin/test/test.js:5:8)
    at Object.<anonymous> (/home/bsadmin/test/test.js:11:13)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:134:18)
    at node.js:961:3

A: Combining this answer, this answer and this code, I have made this small "helper" class, that seems to work fine.
class ExtendableError extends Error {
  constructor(message) {
    super();
    this.message = message;
    this.stack = (new Error()).stack;
    this.name = this.constructor.name;
  }
}

// now I can extend

class MyError extends ExtendableError {
  constructor(m) {
    super(m);
  }
}

var myerror = new MyError("ll");
console.log(myerror.message);
console.log(myerror instanceof Error);
console.log(myerror.name);
console.log(myerror.stack);

Try in REPL

A: In addition to @zangw answer, you can define your errors like this:
'use strict';

class UserError extends Error {
  constructor(msg) {
    super(msg);
    this.name = this.constructor.name;
  }
}

// define errors
class MyError extends UserError {}
class MyOtherError extends UserError {}

console.log(new MyError instanceof Error); // true

throw new MyError('My message');

which will throws correct name, message and stacktrace:
MyError: My message
    at UserError (/Users/honzicek/Projects/api/temp.js:5:10)
    at MyError (/Users/honzicek/Projects/api/temp.js:10:1)
    at Object.<anonymous> (/Users/honzicek/Projects/api/temp.js:14:7)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:475:10)
    at startup (node.js:117:18)
    at node.js:951:3

A: I prefer more strong syntax than described above. Additional methods at error type will help you to create pretty console.log or something else.
export class CustomError extends Error {
    /**
     * @param {string} message
     * @param {number} [code = 0]
     */
    constructor(message, code = 0) {
        super();

        /**
         * @type {string}
         * @readonly
         */
        this.message = message;

        /**
         * @type {number}
         * @readonly
         */
        this.code = code;

        /**
         * @type {string}
         * @readonly
         */
        this.name = this.constructor.name;

        /**
         * @type {string}
         * @readonly
         */
        this.stack = CustomError.createStack(this);
    }

    /**
     * @return {string}
     */
    toString() {
        return this.getPrettyMessage();
    }

    /**
     * @return {string}
     */
    getPrettyMessage() {
        return `${this.message} Code: ${this.code}.`;
    }

    /**
     * @param {CustomError} error
     * @return {string}
     * @private
     */
    static createStack(error) {
        return typeof Error.captureStackTrace === 'function'
            ? Error.captureStackTrace(error, error.constructor)
            : (new Error()).stack;
    }
}

To test this code you can run something similar:
try {
    throw new CustomError('Custom error was thrown!');
} catch (e) {
    const message = e.getPrettyMessage();

    console.warn(message);
}

Extending of CustomError type are welcome. It is possible to add some specific functionality to the extended type or override existing. For example.
export class RequestError extends CustomError {
    /**
     * @param {string} message
     * @param {string} requestUrl
     * @param {number} [code = 0]
     */
    constructor(message, requestUrl, code = 0) {
        super(message, code);

        /**
         * @type {string}
         * @readonly
         */
        this.requestUrl = requestUrl;
    }

    /**
     * @return {string}
     */
    getPrettyMessage() {
        const base = super.getPrettyMessage();

        return `${base} Request URL: ${this.requestUrl}.`;
    }
}

A: To finally put this to rest. In Babel 6 it is explicit that the developers do not support extending from built in. Although this trick will not help with things like Map, Set, etc. it does work for Error. This is important as one of the core ideas of a language that can throw an exception is to allow custom Errors. This is doubly important as Promises become more useful since they to are designed to reject an Error.
The sad truth is you still need to perform this the old way in ES2015.
Example in Babel REPL
Custom Error pattern
class MyError {
  constructor(message) {
    this.name = 'MyError';
    this.message = message;
    this.stack = new Error().stack; // Optional
  }
}
MyError.prototype = Object.create(Error.prototype);

On the other hand there is a plugin for Babel 6 to allow this.
https://www.npmjs.com/package/babel-plugin-transform-builtin-extend
Update: (as of 2016-09-29) After some testing it appears that babel.io does not properly account for all the asserts (extending from a custom extended Error). But in Ember.JS extending Error works as expected: https://ember-twiddle.com/d88555a6f408174df0a4c8e0fd6b27ce

A: Based on Karel Bílek's answer, I'd make a small change to the constructor:
class ExtendableError extends Error {
  constructor(message) {
    super(message);
    this.name = this.constructor.name;
    if (typeof Error.captureStackTrace === 'function') {
      Error.captureStackTrace(this, this.constructor);
    } else {
      this.stack = (new Error(message)).stack;
    }
  }
}

// now I can extend

class MyError extends ExtendableError {}

var myerror = new MyError("ll");
console.log(myerror.message);
console.log(myerror instanceof Error);
console.log(myerror.name);
console.log(myerror.stack);

This will print MyError in the stack, and not the generic Error.
It will also add the error message to the stack trace - which was missing from Karel's example.
It will also use captureStackTrace if it's available.
With Babel 6, you need transform-builtin-extend (npm) for this to work.

A:
I am trying to extend Error with ES6

That class MyError extends Error {…} syntax is correct.
Notice that transpilers still do have problems with inheriting from builtin objects. In your case,
var err = super(m);
Object.assign(this, err);

seems to fix the problem.

A: Given this the accepted answer no longer works you could always use a factory as an alternative (repl):

function ErrorFactory(name) {
   return class AppError extends Error {
    constructor(message) {
      super(message);
      this.name = name;
      this.message = message;
      if (typeof Error.captureStackTrace === 'function') {
        Error.captureStackTrace(this, this.constructor);
      } else {
        this.stack = (new Error(message)).stack;
      }
    }
  }
}

// now I can extend
const MyError = ErrorFactory("MyError");

var myerror = new MyError("ll");
console.log(myerror.message);
console.log(myerror instanceof Error);
console.log(myerror.name);
console.log(myerror.stack);

A: Edit: Breaking changes in Typescript 2.1

Extending built-ins like Error, Array, and Map may no longer work.
As a recommendation, you can manually adjust the prototype immediately after any super(...) calls.

Editing Lee Benson original answer a little bit works for me. This also adds stack and additional methods of ExtendableError class to the instance.
class ExtendableError extends Error {
   constructor(message) {
       super(message);
       Object.setPrototypeOf(this, ExtendableError.prototype);
       this.name = this.constructor.name;
   }

   dump() {
       return { message: this.message, stack: this.stack }
   }
 }

class MyError extends ExtendableError {
    constructor(message) {
        super(message);
        Object.setPrototypeOf(this, MyError.prototype);
    }
}

var myerror = new MyError("ll");
console.log(myerror.message);
console.log(myerror.dump());
console.log(myerror instanceof Error);
console.log(myerror.name);
console.log(myerror.stack);

A: With the latest changes in babel 6, I find transform-builtin-extend no longer working. I ended up using this mixed approach:
export default class MyError {
    constructor (message) {
        this.name = this.constructor.name;
        this.message = message;
        this.stack = (new Error(message)).stack;
    }
}

MyError.prototype = Object.create(Error.prototype);
MyError.prototype.constructor = MyError;

and
import MyError from './MyError';

export default class MyChildError extends MyError {
    constructor (message) {
        super(message);
    }
}

As a result all these tests pass:
const sut = new MyError('error message');
expect(sut.message).toBe('error message');
expect(sut).toBeInstanceOf(Error);
expect(sut).toBeInstanceOf(MyError);
expect(sut.name).toBe('MyError');
expect(typeof sut.stack).toBe('string');

const sut = new MyChildError('error message');
expect(sut.message).toBe('error message');
expect(sut).toBeInstanceOf(Error);
expect(sut).toBeInstanceOf(MyError);
expect(sut).toBeInstanceOf(MyChildError);
expect(sut.name).toBe('MyChildError');
expect(typeof sut.stack).toBe('string');

A: As @sukima mentions, you cannot extend native JS. The OP's question cannot be answered.
Similar to Melbourne2991's answer, I did used a factory rather, but followed MDN's recommendation for customer error types.
function extendError(className){
  function CustomError(message){
    this.name = className;
    this.message = message;
    this.stack = new Error().stack; // Optional
  }
  CustomError.prototype = Object.create(Error.prototype);
  CustomError.prototype.constructor = CustomError;
  return CustomError;
}

A: This works for me:
/**
 * @class AuthorizationError
 * @extends {Error}
 */
export class AuthorizationError extends Error {
    message = 'UNAUTHORIZED';
    name = 'AuthorizationError';
}

A: Not using Babel, but in plain ES6, the following seems to work fine for me:
class CustomError extends Error {
    constructor(...args) {
        super(...args);
        this.name = this.constructor.name;
    }
}

Testing from REPL:
> const ce = new CustomError('foobar');
> ce.name
'CustomError'
> ce.message
'foobar'
> ce instanceof CustomError
true
> ce.stack
'CustomError: foobar\n    at CustomError (repl:3:1)\n ...'

As you can see, the stack contains both the error name and message. I'm not sure if I'm missing something, but all the other answers seem to over-complicate things.

A: I improved a little the solution of @Lee Benson this way:
extendableError.js
class ExtendableError extends Error {
    constructor(message, errorCode) {
        super(message);
        this.name = this.constructor.name;
        this.errorCode = errorCode
        if (typeof Error.captureStackTrace === 'function') {
            Error.captureStackTrace(this, this.constructor);
        } else {
            this.stack = (new Error(message)).stack;
        }
    }

}

export default ExtendableError

an example of an error
import ExtendableError from './ExtendableError'

const AuthorizationErrors = {
    NOT_AUTHORIZED: 401,
    BAD_PROFILE_TYPE: 402,
    ROLE_NOT_ATTRIBUTED: 403
}

class AuthorizationError extends ExtendableError {
    static errors = AuthorizationErrors
}

export default AuthorizationError

Then you are able to group errors while having option specifiers to decide what to do differently in some of your application specific situations
new AuthorizationError ("The user must be a seller to be able to do a discount", AuthorizationError.errors.BAD_PROFILE_TYPE )


text:
Q: Internet is not getting connected in android I have created an app in android and it requires some data to be transfered over internet. I have written the codes but I don't see any data transfer on my device. Am I missing any point? Any suggestion will be appreciated.

A: You need to add permissions in the android Manifest file in order to have internet connection. Did you add these codes in android manifest file?
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>


text:
Q: Cakephp2 pagination links with routing I have a problem with routing cakephp.
Here is my code :
Router::connect(
    '/find-job/*',
    array('controller'=>'TblJobs','action'=>'findJob'),
    array('pass' => array( 'id'))
);
Router::connect(
    '/*',
    array('controller'=>'tbl_jobs', 'action'=>'index'),
    array('pass' => array( 'id'))
);

On the first line, it's working normal(localhost/find-job/page:2). but on the second line, i have a problem with it.
when i run it, i have some pages: page1 , page2, page3 but the link like : localhost/tbl_jobs/index/page:2
but the link i need : localhost/page:2
I'm sorry because my english is so bad.
Thanks !

A: Try:
Router::connect(
'/:page',
array('controller'=>'tbl_jobs', 'action'=>'index')
);


text:
Q: Outlook 07,10 Buttons padding issues Email I'm Litmus-testing a very simple email. Looks good in all email clients except Outlook 2007 and 2017. Apparently, in these two specific browsers it overlaps the buttons and completely removes and spaces that were there:
Please see image attached and see my Fiddle / Snippet for full code, thank you for your help in advance.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>Request a quote today.</title>

Lorem ipsom dolor corjs hrnnmeo.

Insurance that's not just … Insurance

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla.

                                                REQUEST A QUOTE

                     – OR –

                                                CALL NOW

<custom name="opencounter" type="tracking">

jsfiddle.net/8u7x9cdu/

A: I noticed two things on reviewing your code.

*

*There are some unclosed tags and unbalanced
s. Be careful about closing a
 without first closing its .

*It's safer to space things out by putting everything in it's own  for Outlook. Using a
 doesn't always put an element on it's own line, but putting it in a new
 does. I've updated the part of the code with the buttons to look more like this:

                            REQUEST A QUOTE

                     – OR –

                                CALL NOW

You may need to fiddle around with the padding and line height, but something like this will display the layout you're looking for in all the annoying Windows desktop Outlooks.

A: Clay, I have a fix for your button issues. I should point out you also have an issue with gmail. You could determine this yourself if you looked in Litmus. I don't believe that you're really paying attention to Litmus because I just ran your code myself before this reply.
You're also having issues with Yahoo, outlook.com, gmail, iPhones, Android, Windows 10 Mail.
I also remember that I tried to help you last week on identical issues. In previous email issues you posted (check Clay's Reputation panel) people keep giving you solid advice and you never followed it, gave us feedback on how it worked or showed any appreciation. The reason I say this is that you keep posting the same problems over and over and your code shows the same issues over and over.

*

*Outlook 07/10/13 Issues

*My Email Design Isn't Responding to Mobile Devices
Stack Overflow gives you what you put in. If you're just going to blow off our suggestions, what is the motivation to help you?
I'd be happy to let you flop around and fail. The way I learned is that I looked up problems on Stack Overflow and blowing you off hurts others that might treat email development seriously. So as an additional reminder, Outlook does not work with padding and margins:

*

*https://litmus.com/help/email-clients/outlookcom-margins/
This means that if you're setting your padding for the button height, it's not going to work in Outlook.
Outlook does not work with line-height values with only numbers. So line-height: 1.1 is going to be ignored because it doesn't understand. line-height: 40px; will be read and work. An additional tag you can use to help force Outlook to obey a line height it to place this directly in front of line-height: mso-line-height-rule: exactly; Read more:

*

*https://www.campaignmonitor.com/blog/email-marketing/2011/04/should-i-use-em-or-px-when-coding-for-html-email/
Good luck.


text:
Q: ASP.NET Redirection I'm currently redirecting a page using
Response.Redirect("URL");

this works great, however it changes the url too. For example:
http://localhost/index.aspx

Redirected to: test.aspx will change the url to:
http://localhost/test.aspx

Is it possbile to redirect the content without changing the URL?... so the Url will be:
http://localhost/test.aspx

BUT the content would of been redirected to
test.aspx

Thank you.

A: Try to use  Server.Transfer(URL);  to avoid changing the url.
More info here.
And also check the differences at this post and this one.
Make sure that this solution meets your needs.

A: Use Server.Transfer
This will show the content of default.aspx page, but it will not change the url
Server.Transfer("Default.aspx");


text:
Q: TYPO3 queryBuilder, how to let PhpStorm recognise methods? For example
        $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
        $queryBuilder = $connectionPool->getQueryBuilderForTable($table);

        $statement = $queryBuilder
            ->select('uid')
            ->from($table)
            ->orderBy('start_date', 'DESC')
            ->where(
                $queryBuilder->expr()->lte('start_date', $queryBuilder->createNamedParameter($startDate, \PDO::PARAM_INT)),
                $queryBuilder->expr()->neq('uid', $queryBuilder->createNamedParameter($currentUid, \PDO::PARAM_INT))
            )
            ->setMaxResults(1)
            ->execute();
        while ($row = $statement->fetch()) {
            $prevs[] = $row;
        }

How can one let PhpStorm recognise the methods select, expr, createNamedParameter, fetch etc.

A: PhpStorm doesn't automatically know what class $connectionPool is and so can't know what class everything derived from that is. You can tell PhpStorm what class $connectionPool is by adding an annotation:
/** @var ConnectionPool $connectionPool */
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);

A: If you use the TYPO3 Plugin for PhpStorm, it's able to get the correct information from makeInstance() (and many more features).
https://plugins.jetbrains.com/plugin/9496-typo3-cms-plugin

A: You can do 2 steps to help PhpStorm recognise functions outside of your project:
Annotate the variables with their respective namespace:
/** @var $queryBuilder \TYPO3\CMS\Core\Database\Query\QueryBuilder **/
$queryBuilder = $connectionPool->getQueryBuilderForTable($table);

You can shorten the above when used multiple time with declaring:
use \TYPO3\CMS\Core\Database\Query\QueryBuilder;

at the top of your file, the you would just need
/** @var $queryBuilder QueryBuilder **/

As a second step include the Typo3 sources to your project (if they are not inclued in your project files already) so PhpStorm will be able to index them

A: I find that adding annotations for the variable type is unnecessary and just clutters up the source code.
In general, for PhpStorm to find the classes, methods etc. you have to include the TYPO3 source in your project.

*

*You can create a PHP project which includes your entire web root (typically "public" folder), but excludes directories like filadmin, uploads, typo3temp etc. It is important to exclude these directories so PhpStorm does not unnecessarily scan them. (In particular if you run the core functional tests this is very much recommended.) I find this is the most practical approach and also useful for debugging and core development

*You can create a PhpStorm project for your extension and include your TYPO3 source as well. Don't know about this off the top of my head, but should be possible.

Once you do this and PhpStorm scanned your files, it should be possible to do any of the following:

*

*Auto-expand class and function names

*Add use statements automatically (see PhpStorm help for more)

*etc.

See also DynamicReturnType plugin and other plugins recommended for TYPO3 core development. The DynamicReturnType plugin along with the file dynamicReturnTypeMeta.json shipped with the core should give PhpStorm enough information for return type of classes instantiated with makeInstance for example.


text:
Q: firebase react cloud messaging push notification I was working on a project using Firebase cloud messaging react. I was sending this to my server but it doesn't work surely have tried but don't know what's wrong again
Below are the codes
here sends post request to firebase and should send notification to the user
    async function sendNotification(id,userMessage){
            const headers = {
                  'Authorization': `key=${code}`,
                  'Content-Type': 'application/json'
            }
            const message = {
                  'to': `${id}`,
                  'content_available': true,
                  'apns_priority': 5,
                  'notification':{
                  body: `${userMessage}`
            },
            const url = 'https://fcm.googleapis.com/fcm/send'
            //console.log(code)

            await axios.post(url,message,{
                headers:headers
            })

    }
    const sendMessageToServer = async (e) => {
        //e.preventDefault();
        toggle()
        const docRe = doc(database, "help", mailer);
        const data = {
            email: user.email,
            user: newMessage,
        }
        //console.log(data,'not clear')
        setNewMessage('')
        //console.log(data,newMessage,'cleared')
        setShow(false)
        if(newMessage === ''){

        }else{
            const docRef = doc(database, "users", mailer);
            await updateDoc(docRe, {
                msg: arrayUnion(data)
            })
            .then(()=>{
                async function p(){
                    const id = await getDoc(docRef)
                    //console.log(id.data())
                    sendNotification(id.data().notice,`Admin : ${data.user}`)
                }

                p()

            })
      }

Sometimes it send to my localhost because I tested there, but it doesn't work on my netlify app, secondly I noticed that it keeps generation same token for each user but that's not the issue but if you can help in both i would be greatful
export default function Dashboard() {
async function callToken(){
    await getToken(messaging, {vapidKey: process.env.NOTIFICATION})
    .then((code)=> {
        //console.log(code)

        async function docRef(){
            const dc = doc(database, "users", auth.currentUser.email);
            await updateDoc(dc, {
                notice: code
            });
        }
        docRef()
    })
}

async function requestPermission() {
    await Notification.requestPermission()
    .then((permission) => {
        if (permission === 'granted') {
            console.log('Notification permission granted.')
            callToken()

        }
    })
  }

const goTo = useNavigate();
useEffect(() => {
    onAuthStateChanged(auth, (data) =>{

        if(!data){
            goTo('/login')
        }else{
            currentBalance();

            requestPermission()
        }
    })

})

}
did some necessary setups but yet code doesn't work


text:
Q: Mvc4 model base om JSON I am writing an mVC4 application and i would like to create a model to generate the following JSON file:
{
"area": {
       "areaid": "1",
       "venueid": "41",
       "fnames": "12",
          "s": [{"Id":1,"V":"0,1,2,2,1,1,1,0B-001,0,0,0,"},
                {"Id":2,"V":"2,1,2,2,1,1,1,0B-001,0,0,0,"},
                {"Id":3,"V":"3,1,2,2,1,1,1,0B-001,0,0,0,"}]
         }
 }

Something like that?
public class Area
{
    [Key]
    public int areaid { get; set; }
    public int venueid { get; set; }
    public int fnames { get; set; }
    [ForeignKey("Id")]
    public List<Book> s { get; set; }

}

public class Book
{
    [Key]
    public int Id { get; set; }
    public string V { get; set; }
}

A: I think that should work. Here's the result from using Visual Studio 2013's Paste JSON as Classes feature...
public class Rootobject
{
    public Area area { get; set; }
}

public class Area
{
    public string areaid { get; set; }
    public string venueid { get; set; }
    public string fnames { get; set; }
    public List<Book> s { get; set; }
}

public class Book
{
    public int Id { get; set; }
    public string V { get; set; }
}


text:
Q: Matrix Conversion From Child to Parent with non Uniform Scale I have following 3D nodes structure in Scenekit IOS
ROOT NODE (MAIN)
--->  CONTAINER NODE  (some transformation with scale XYZ is  0.2,0.4,0.2)
---> --->> CHILD NODE (some transformation)
Expected Result :-
I need CHILD node to be added in ROOT NODE exactly the same
Please check attached GIF

*

*If I use worldTransform (DOC ) on scale value (0.2,0.4,0.2) it is not at the correct Position

*If  CONTAINER NODE  scale is equal from all side XYZ like (0.2,0.2,0.2) - Result is Correct

What I have tried :

*

*I have tried to convert with matrix Multiplication ( result is same as worldTransform` )

*I have tried convertTransform method in built in Scenekit ( result is same as worldTransform` )

Question : -
So How can I convert the child to root node when we have non uniform scale in container node , Because I can't change the scale of container node
Please help me with I am stuck in for some days now -


text:
Q: TypeError: Cannot assign to read only property 'now' of object '#' I just upgraded node to the latest version v16.13.1
I attempted  to run an existing project but it crashed with this error:
performance.now = present;
                ^
TypeError: Cannot assign to read only property 'now' of object '#<Performance>'
    at Function.present.conflict (/Project_Path/node_modules/mstime/dist/cjs/present.js:39:19)
    at Object.<anonymous> (/Project_Path/node_modules/mstime/dist/cjs/present.js:41:9)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Object.require.extensions.<computed> [as .js] (/Project_Path/node_modules/ts-node/src/index.ts:485:14)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Project_Path/node_modules/mstime/dist/cjs/index.js:5:16)

Can someone explain to me this error and how to resolve it?

A: I just had this issue in some of my Jest unit tests after upgrading from node v14 to v16.
In my tests, I was spying on the now() method of performance to mock its implementation, but I was getting the same error message:
jest.spyOn(performance, "now")
  .mockImplementationOnce(() => 1000)
  .mockImplementationOnce(() => 2000);

// TypeError: Cannot assign to read only property 'now' of object '#<Performance>'

As it suggests, the now property is readonly and cannot be reassigned. As a workaround, I used Object.defineProperty to make it writable. The mock implementations worked fine afterwards.
// redefining readonly property of the performance object
Object.defineProperty(performance, "now", {
  value: jest.fn(),
  configurable: true,
  writable: true
});

// mocking an execution delta of 1000ms
jest.spyOn(performance, "now")
  .mockImplementationOnce(() => 1000)
  .mockImplementationOnce(() => 2000);

// ok now


text:
Q: LESS / SASS I never seen this syntax before So my buddy asked me what is this, we know it is a type of css but never seen this syntax. We could only guess what it is doing, but I have a one question what is it actually doing? I did not see the whole site just this snippet here
input#{:id}.simple-typeahead-input{
      @apply for-text-input;
// never saw input#{:id} like this then connected to the actual class
}

is this common practice with LESS or is it wrong? I have know idea I just started learning SCSS. What does this snippet even do. I can only guess but I would like to know exactly what it does if anyone knows. :)


text:
Q: Multiple sort algorithm (sorting within a sorted field) in Java ArrayList data example:
BJM 300 AC4507 TOM_JONES, BDM 290 DC4058 ALAN_FIELD, ADG 350 BA3240 JON_THORN
I need to sort the ArrayList above into ascending sequence of the third column within the second column within the third column?
 public static ArrayList sortLoad1(ArrayList<WorkLoad> loads){
    String s1, s2;
    WorkLoad temp;                                     //Some local variables
    for(int i = 0 ; i < loads.size(); i++){            //Loop forward
        for(int j = loads.size()-1; j>i  ;j--){        //Loop backward
            s1 = loads.get(j-1).getDeptCode();         //Extract 1st
            s2 = loads.get(j).getDeptCode();           //Extract 2nd
            if(i+1<loads.size()&&s1.compareTo(s2)>-1){ //Compare them lexicographically
                temp = loads.get(j-1);
                //If s1 follows s2 then switch both
                loads.set(j-1, loads.get(j));
                loads.set(j, temp);
            }//endif
        }//end loop 2
    }//end loop 1
    return loads;
}

Above is the code I have ATM. This sorts the first column (BJM, BDM & ADG columns) but what would I have to do to sort within the sorted data as I mentioned above?? I thought sorting 3 times, but that's not going to work is it?
I've tried the nested sort (see below) mentioned below but no joy:
    public static ArrayList sortLoad1(ArrayList<TeachingLoad> loads){
    String s1, s2;
    TeachingLoad temp;                                   //Some local variables
    for(int i = 0 ; i < loads.size(); i++){              //Loop throuth
        for(int j = loads.size()-1; j>i  ;j--){          //Loop through
            s1 = loads.get(j-1).getLecturerID();        //Extract 1st
            s2 = loads.get(j).getLecturerID();          //Extract 2nd
                if(i+1<loads.size()&&s1.compareTo(s2)>-1){  //Compare them lexicographically
                    temp = loads.get(j-1);
                    //If s1 follows s2 then switch both
                    loads.set(j-1, loads.get(j));
                    loads.set(j, temp);
                }
                else{
                    for(int k = 0 ; k < loads.size(); k++){
                        for(int l = loads.size()-1; l>i  ;l--){
                            s1 = loads.get(l-1).getDepartmentNumber();
                            s2 = loads.get(l).getDepartmentNumber();
                            if(k+1<loads.size()&&s1.compareTo(s2)>-1){
                                temp = loads.get(l-1);
                                loads.set(l-1, loads.get(l));
                                loads.set(l, temp);
                            }
                            else{
                                for(int m = 0 ; m < loads.size(); m++){
                                    for(int n = loads.size()-1; n>i  ;n--){
                                        s1 = loads.get(n-1).getSchoolCode();
                                        s2 = loads.get(n).getSchoolCode();
                                        if(m+1<loads.size()&&s1.compareTo(s2)>-1){
                                            temp = loads.get(n-1);
                                            loads.set(n-1, loads.get(n));
                                            loads.set(n, temp);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
        }//end loop 2
    }//end loop 1
    return loads;
}

A: You need to nest the sorts.
Essentially do the first comparison. If the result is not 0 then use that result.
If result is 0 then do the next comparison. Again if result is not 0 then use it.
You can continue this process for as many nested comparisons as you require.
The neatest way to implement it is as a custom comparator though. Then you can just do Collections.sort(list, comparitor) and it will efficiently and quickly sort the list using an appropriate algorithm for the list.
For example if you have:
class X {
   int a, b, c;
}

Comparator<X> comparator = new Comparator<X>() {
     public int compare(X one, X two) {
         int result = one.a-two.a;
         if (result == 0) {
             result = one.b-two.b;
             if (result == 0) {
                  result = one.c-two.c;
             }
         }
         return result;
     }
}

That will sort a list of X first by a, then by b, then by c.
To use it just do:
 Collections.sort(list, comparator);


text:
Q: Pass order by clause from Java in Jasper Report I am using latest version of Jasper soft studio to design Jasper reports. I want to pass order by clause to jasper report based on certain criteria from Java. Can you please guide as how to append parameter(containing order by clause from Java) in the report query?
Query
with tmp as (
select d.gl_code, nvl(sum(d.debit),0)- nvl(sum(d.credit),0) as simple
          from gl_forms g,gl_voucher_detail d,financial_year f
          where g.voucher_no = d.voucher_no
      and f.fid = $P{P_FID}
        and g.voucher_date >= to_date('01-07-'+f.start_year,'dd-MM-yyyy')      and g.voucher_date < $P{P_FROM}
      and g.post=1
      group by d.gl_code)
select g.voucher_no,
       g.voucher_date,
       g.voucher_type,
       g.remarks remarks,
       d.sr_no,
       c.account_name,
       d.debit,
       d.credit,
       d.narration narration,
       c.account_code,
       c.account_name || ' - ' || c.account_code Account,
       (select name from company) name,
       nvl((o.debit-o.credit),0) + nvl(tmp.simple,0) opening
from gl_voucher_detail d
   join gl_forms g
      on g.voucher_no = d.voucher_no
      and g.post=1
      and g.voucher_date between $P{P_FROM} and $P{P_TO}
   left outer join opening_balances o
      on d.gl_code = o.account_code
      and o.fid = $P{P_FID}
   right outer join chart_of_account c
      on c.account_code = d.gl_code
   left outer join tmp
      on c.account_code = tmp.gl_code
where c.account_level=4
and c.active=1
and c.account_code = CASEWHEN($P{P_ACCOUNT}='%',c.account_code,$P{P_ACCOUNT})

Order by clause shall be one among these below two based on front fields selection:

*

*order by c.account_name, g.voucher_date,g.voucher_no,d.sr_no

*order by c.debit+c.credit desc


text:
Q: Rejection Email to the contributor or author from admin I have created one custom form in admin post editor, to send email templates to authors. I'm facing problem during ajax call that isn't redirecting to the page which I need and getting message post updated when selected template and click on send option

    <form>

          Template Name
           <?php

            // The Query
            $the_query = new WP_Query( array(
                'post_type' => 'email-templates',
                'posts_per_page' => -1,
            ));
            if ( $the_query->have_posts() ) { ?>
                <select style="display: block;width: 100%;margin: 10px 0;" name="_reject_email" class="form-control" id="reject_email_template">
                    <?php
                    while ( $the_query->have_posts() ) {
                        $the_query->the_post();
                        echo '<option value="'.get_the_ID().'">' . get_the_title() . '</option>';
                    } ?>
                </select>
                    <?php
                    wp_reset_postdata();
                } else {
                    // no posts found
                }
            ?>

        <button type="submit" class="reject-email-btn btn btn-primary" style="border:none; padding: 6px 1rem;color: #fff; background: #0085ba;text-decoration: none;">Send</button>
    </form>

save posts in custom fields database
 add_action('admin_init','event_meta_init');
 function event_meta_init(){

foreach (array('post') as $type){
    add_meta_box('my_all_meta', 'Reject Email', 'my_meta_setup', $type, 'normal', 'high');
}

add_action('save_post','my_meta_save');}

function my_meta_setup(){
global $post;
// using an underscore, prevents the meta variable
// from showing up in the custom fields section
$meta = get_post_meta($post->ID,'_post',TRUE);
// instead of writing HTML here, lets do an include
include(MY_THEME_FOLDER . '/metafields/events-fields.php');
// create a custom nonce for submit verification later
  echo '<input type="hidden" name="my_meta_noncename" value="' .    wp_create_nonce(__FILE__) . '" />';
 }

function my_meta_save($post_id){
   // authentication checks
   // make sure data came from our meta box
 if (!wp_verify_nonce($_POST['my_meta_noncename'],__FILE__)) return    $post_id;
// check user permissions
if ($_POST['post_type'] == 'page'){
    if (!current_user_can('edit_page', $post_id)) return $post_id;
}else{
    if (!current_user_can('edit_post', $post_id)) return $post_id;
}

$current_data = get_post_meta($post_id, '_post', TRUE);

$new_data = $_POST['_post'];

my_meta_clean($new_data);

if ($current_data){
    if (is_null($new_data)) delete_post_meta($post_id,'_post');
    else update_post_meta($post_id,'_post',$new_data);
}elseif (!is_null($new_data)){
    add_post_meta($post_id,'_post',$new_data,TRUE);
}

  return $post_id;
}
function my_meta_clean(&$arr){
   if (is_array($arr))  {
       foreach ($arr as $i => $v){

       if (is_array($arr[$i])){
            my_meta_clean($arr[$i]);
            if (!count($arr[$i])){
                unset($arr[$i]);
            }
        }else{
            if (trim($arr[$i]) == ''){
                unset($arr[$i]);

            }
        }
    }

    if (!count($arr)){
        $arr = NULL;
    }
}
}

My ajax script is
jQuery.noConflict();
(function( $ ) {
    function rejection_email(){
        $.ajax({
            url: "/rejection-email/",
            data : {eid:$('#reject_email_template').val()},
            success: function(data) {
                var result = data
                $('#fromPartsTable').html(result);

            },
            error: function() {
                alert('Error occured');
            }
        });
    }
    $('.reject-email-btn').click(function(e) {
        rejection_email();
    });
})(jQuery);


text:
Q: rotate camera in three.js not working properly i have the following code to rotate my camera around the x-axis in a three.js scene:
var cameraOrginX = 0, cameraOrginY = 0, cameraOrginZ = 0;
var cameraEndX = 0, cameraEndY = 0, cameraEndZ = 1000;
var angle = 0;

function init(){
     camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 10000 );
     camera.position.set(0,0,1000);

     //ROTATE THE CAMERA
     var radians = angle * Math.PI / 180.0;

     cameraEndY = Math.cos(radians) * (cameraEndY-cameraOrginY) - Math.sin(radians) * (cameraEndZ-cameraOrginZ) + cameraOrginY;
     cameraEndZ = Math.sin(radians) * (cameraEndY-cameraOrginY) + Math.cos(radians) * (cameraEndZ-cameraOrginZ) + cameraOrginZ;
     //

     //CAMERA NEW POS
     camera.position.x = cameraOrginX + cameraEndX;
     camera.position.y = cameraOrginY + cameraEndY;
     camera.position.z = cameraOrginZ + cameraEndZ;
     console.log(camera.position.y + "   " + camera.position.z);
}

when i set the angle variable to 0 my camera position is at x=0, y=0, z=1000; this is what expect and is good.
but when i change the angle to 90 degrees for example my position gets changed to x=0 y= -1000 z=-999,99999; while you would expect the position to be x =0, y=-1000, z =0;
why is this happening? could someone explain to me what i am doing wrong :)
all the angles with the exception of 0 give me weird positions :(
if there is any need for more code or a jsfidle just ask me :)

A: cameraEndY = Math.cos(radians) * (cameraEndY-cameraOrginY) - Math.sin(radians) * (cameraEndZ-cameraOrginZ) + cameraOrginY;
cameraEndZ = Math.sin(radians) * (cameraEndY-cameraOrginY) + Math.cos(radians) * (cameraEndZ-cameraOrginZ) + cameraOrginZ;

You cant use cameraEndY in cameraEndZ calculation since it has been already updated. You are supposed to use old y and z coordinate in this rotation calculation, not the updated ones. Use the following instead -
var cosTheta = Math.cos(radians);
var sinTheta = Math.sin(radians);

var a = cosTheta * (cameraEndY-cameraOrginY);
var b = sinTheta * (cameraEndZ-cameraOrginZ);
var c = sinTheta * (cameraEndY-cameraOrginY);
var d = cosTheta * (cameraEndZ-cameraOrginZ);

cameraEndY = a - b + cameraOrginY;
cameraEndZ = c + d + cameraOrginZ;


text:
Q: Sunspot - RSolr::Error::Http - 404 Not Found Hi I recently got a hold of a Rails 3.2.0 project that makes use of sunspot
I've been running into an error below:
RSolr::Error::Http - 404 Not Found
Error:     Not Found

URI: http://localhost:8982/solr/select?wt=ruby
Request Headers: {"Content-Type"=>"application/x-www-form-urlencoded; charset=UTF-8"}
Request Data: "fq=type%3APost&fq=-kind_s%3A%28event+OR+contest+OR+job+OR+review%29&fq=-category_im%3A%28%29&fq=exclude_from_explore_b%3Afalse&fq=-destroyed_at_d%3A%5B*+TO+*%5D&fq=published_at_ds%3A%5B*+TO+2016%5C-04%5C-26T12%5C%3A07%5C%3A29Z%5D&fq=published_at_ds%3A%5B*+TO+*%5D&fq=verified_author_b%3Atrue&sort=published_at_ds+desc&start=0&rows=24&q=*%3A*"

Backtrace: /home/revrun/.rvm/gems/ruby-2.1.2/gems/rsolr-1.0.13/lib/rsolr/client.rb:284:in `adapt_response'
/home/revrun/.rvm/gems/ruby-2.1.2/gems/rsolr-1.0.13/lib/rsolr/client.rb:190:in `execute'
/home/revrun/.rvm/gems/ruby-2.1.2/gems/rsolr-1.0.13/lib/rsolr/client.rb:176:in `send_and_receive'
(eval):2:in `post'
/home/revrun/.rvm/gems/ruby-2.1.2/gems/sunspot-1.3.3/lib/sunspot/search/abstract_search.rb:38:in `execute'
/home/revrun/.rvm/gems/ruby-2.1.2/gems/sunspot_rails-1.3.3/lib/sunspot/rails/searchable.rb:329:in `solr_execute_search'
/home/revrun/.rvm/gems/ruby-2.1.2/gems/sunspot_rails-1.3.3/lib/sunspot/rails/searchable.rb:153:in `solr_search'
/home/revrun/Code/saf/safarious/app/controllers/explore/posts_controller.rb:76:in `post_search'
/home/revrun/Code/saf/safarious/app/controllers/explore/posts_controller.rb:15:in `category'
/home/revrun/.rvm/gems/ruby-2.1.2/gems/actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/home/revrun/.rvm/gems/ruby-2.1.2/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:167:in `process_action'

My installed gems are as follows:
*** LOCAL GEMS ***

actionmailer (4.2.6, 4.1.0, 3.2.13)
actionpack (4.2.6, 4.1.0, 3.2.13)
actionview (4.2.6, 4.1.0)
activejob (4.2.6)
activemodel (4.2.6, 4.1.0, 3.2.13)
activerecord (4.2.6, 4.1.0, 3.2.13)
activeresource (3.2.13)
activesupport (4.2.6, 4.1.0, 3.2.13)
acts-as-taggable-on (2.3.3)
acts_as_votable (0.8.0)
addressable (2.4.0, 2.3.6, 2.3.2)
afm (0.2.0)
annotate (2.5.0)
arel (6.0.3, 5.0.1.20140414130214, 3.0.2)
Ascii85 (1.0.2)
authlogic (3.2.0)
autoprefixer-rails (6.3.6)
awesome_print (1.6.1, 1.1.0)
base58 (0.1.0)
bcrypt (3.1.7)
bcrypt-ruby (3.0.1)
bigdecimal (1.2.4)
binding_of_caller (0.7.2)
bootstrap (4.0.0.alpha3)
bootstrap-sass (3.1.1.1, 3.1.1.0)
bourbon (3.0.1)
braintree (2.22.0)
browser (0.1.6)
bson (3.2.6)
builder (3.2.2, 3.0.4)
bundler (1.8.3)
bundler-unload (1.0.2)
byebug (8.2.2)
callsite (0.0.11)
cancan (1.6.10)
capistrano (3.2.1)
capistrano-bundler (1.1.2)
capistrano-rails (1.1.1)
capistrano-rvm (0.1.1)
capybara (2.3.0, 2.0.2)
carmen (0.2.13)
carrierwave (0.8.0)
carrierwave_backgrounder (0.1.3)
childprocess (0.5.3, 0.3.6)
chronic (0.10.2)
client_side_validations (3.2.1)
client_side_validations-simple_form (2.0.1)
coderay (1.1.1)
coffee-rails (4.1.1, 4.0.0, 3.2.2)
coffee-script (2.4.1, 2.3.0)
coffee-script-source (1.10.0, 1.8.0)
colorize (0.7.3)
commonjs (0.2.7)
concurrent-ruby (1.0.1)
connection_pool (2.2.0)
cookiejar (0.3.0)
crack (0.4.2, 0.3.2)
daemons (1.2.3, 1.1.9)
dante-editor (0.0.14)
database_cleaner (1.3.0, 0.9.1)
debug_inspector (0.0.2)
declarative_authorization (0.5.7)
delayed_job (4.1.1, 3.0.4)
delayed_job_active_record (0.3.3)
delayed_job_mongoid (2.2.0)
diff-lcs (1.2.5, 1.1.3)
domain_name (0.5.20160309)
dotenv (0.9.0)
dotenv-rails (0.9.0)
em-http-request (1.1.3)
em-socksify (0.3.1)
email_validator (1.4.0)
erubis (2.7.0)
eventmachine (1.2.0.1, 1.0.3)
exceptional (2.0.33)
excon (0.49.0, 0.16.10)
execjs (2.6.0, 2.2.1, 1.4.0)
executable-hooks (1.3.2)
factory_girl (4.4.0, 4.1.0)
factory_girl_rails (4.4.1, 4.1.0)
fakeredis (0.4.1)
faraday (0.9.2, 0.9.0, 0.8.11, 0.7.6)
faraday_middleware (0.10.0, 0.9.0)
fattr (2.2.1)
faye (1.1.2)
faye-websocket (0.10.3)
ffi (1.9.3, 1.3.1)
filepicker-rails (0.1)
fog (1.9.0)
foreman (0.78.0)
formatador (0.2.4)
garb (0.9.1)
gem-wrappers (1.2.7)
globalid (0.3.6)
god (0.13.7)
haml (4.0.7)
haml-rails (0.9.0)
handlebars_assets (0.19.1)
hashdiff (0.3.0)
hashery (2.1.0)
hashie (3.4.3, 1.2.0)
heroku (3.43.0)
heroku-api (0.4.2)
highline (1.7.8, 1.6.15)
hike (1.2.3, 1.2.2)
hiredis (0.4.5)
html2haml (2.0.0)
htmlentities (4.3.1)
http-cookie (1.0.2)
http_parser.rb (0.6.0)
httpauth (0.2.0)
i18n (0.7.0, 0.6.11, 0.6.1)
io-console (0.4.2)
jbuilder (2.4.1, 1.5.3)
journey (1.0.4)
jquery-rails (4.1.1, 3.1.0, 2.2.0)
jquery-ui-rails (4.2.1)
json (1.8.3, 1.8.1, 1.8.0)
jwt (1.5.1, 1.0.0)
launchy (2.4.3, 2.1.2)
less (2.6.0)
less-rails (2.7.1)
letter_opener (1.0.0)
libv8 (3.16.14.13 x86-linux)
linkedin (0.3.7)
lograge (0.2.0)
loofah (2.0.3)
mail (2.6.3, 2.5.4, 2.5.3)
mail_view (1.0.3)
medium-editor-rails (2.2.0)
meta_request (0.2.5)
method_source (0.8.2)
mime-types (2.99.1, 1.25.1, 1.21)
mini_magick (3.4)
mini_portile (0.6.0)
mini_portile2 (2.0.0)
minitest (5.8.4, 5.3.5, 4.7.5)
mongo (2.1.2)
mongoid (5.1.1)
mongoid-compatibility (0.3.1)
mono_logger (1.1.0)
multi_json (1.11.2, 1.10.1, 1.7.3)
multi_xml (0.5.5)
multipart-post (2.0.0, 1.2.0, 1.1.5)
nesty (1.0.2)
net-scp (1.2.1, 1.0.4)
net-ssh (2.9.2, 2.9.1, 2.6.3)
net-ssh-gateway (1.2.0)
netrc (0.11.0, 0.10.3)
newrelic_rpm (3.6.4.122)
nokogiri (1.6.7.2, 1.6.2.1, 1.5.5)
oauth (0.5.1, 0.4.7)
oauth2 (1.1.0, 0.9.4, 0.6.1)
omniauth (1.3.1, 1.1.1)
omniauth-facebook (3.0.0, 1.4.0)
omniauth-linkedin (0.0.8)
omniauth-oauth (1.0.1)
omniauth-oauth2 (1.4.0, 1.0.2)
omniauth-twitter (0.0.14)
optionable (0.2.0)
options (2.3.2, 2.3.0)
origin (2.2.0)
panda (1.6.0)
pdf-inspector (1.1.0)
pdf-reader (1.3.2)
pg (0.17.1)
polyglot (0.3.5, 0.3.3)
pr_geohash (1.0.0)
prawn (0.12.0)
prawn-qrcode (0.2.0)
prawn_rails (0.0.11)
progress_bar (1.0.5, 0.4.0)
pry (0.10.3)
pry-byebug (3.3.0)
psych (2.0.5)
public_activity (1.5.0)
quiet_assets (1.1.0, 1.0.2)
rack (1.6.4, 1.5.2, 1.4.7, 1.4.5)
rack-cache (1.2)
rack-contrib (1.1.0)
rack-protection (1.5.3)
rack-ssl (1.3.3)
rack-test (0.6.3, 0.6.2)
rails (4.2.6, 4.1.0, 3.2.13)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.7)
rails-html-sanitizer (1.0.3)
rails-sanitize-js (1.0.0)
rails_autolink (1.1.0)
rails_config (0.4.2)
railties (4.2.6, 4.1.0, 3.2.13)
rake (11.1.1, 10.3.2, 10.1.0, 10.0.4)
rdoc (4.1.2, 4.1.0, 3.12.2)
recaptcha (0.3.5)
redis (3.2.2, 3.1.0, 3.0.4)
redis-actionpack (3.2.3)
redis-activesupport (3.2.3)
redis-namespace (1.5.1)
redis-rack (1.4.2)
redis-rails (3.2.3)
redis-store (1.1.4)
ref (2.0.0)
resque (1.25.2)
rest-client (1.8.0, 1.6.9, 1.6.8)
rest-client-components (1.4.0)
rqrcode (0.4.2)
rsolr (1.1.1, 1.0.13, 1.0.10)
rspec-core (2.14.8, 2.12.2)
rspec-expectations (2.14.5, 2.12.1)
rspec-mocks (2.14.6, 2.12.1)
rspec-rails (2.14.0, 2.12.2)
ruby-hmac (0.4.0)
ruby-oembed (0.8.8)
ruby-prof (0.12.1)
ruby-rc4 (0.1.5)
ruby_parser (3.8.1)
rubygems-bundler (1.4.4)
rubyzip (1.1.7, 1.1.6, 0.9.9)
rvm (1.11.3.9)
safe_yaml (1.0.3)
sass (3.4.22, 3.4.21, 3.2.19, 3.2.5)
sass-rails (5.0.4, 4.0.2, 3.2.6)
sdoc (0.4.1)
selenium-webdriver (2.42.0, 2.29.0)
sequel (3.20.0)
sexp_processor (4.7.0)
simple_form (2.0.4)
sinatra (1.4.5, 1.0)
sitemap_generator (4.0.1)
slop (3.6.0)
sorcery (0.8.6)
spring (1.6.4)
sprockets (3.5.2, 2.11.0, 2.2.2)
sprockets-rails (3.0.4, 2.0.1)
sqlite3 (1.3.9)
sshkit (1.5.1)
state_machine (1.1.2)
subexec (0.2.2)
sunspot (1.3.3)
sunspot_rails (1.3.3)
sunspot_solr (2.2.5)
taps (0.3.24)
test-unit (2.1.2.0)
test_after_commit (0.2.0)
therubyracer (0.12.2)
thin (1.6.4, 1.5.1)
thor (0.19.1, 0.18.1)
thread_safe (0.3.5, 0.3.4)
tilt (2.0.2, 1.4.1)
treetop (1.4.15, 1.4.12)
ttfunk (1.0.3)
turbolinks (2.2.3)
typhoeus (0.2.4)
tzinfo (1.2.2, 0.3.37)
uglifier (2.7.2, 1.3.0)
underscore-rails (1.8.3)
unf (0.1.4)
unf_ext (0.0.7.2)
vegas (0.1.11)
web-console (2.3.0)
webmock (1.18.0)
websocket (1.0.7, 1.0.6)
websocket-driver (0.6.3)
websocket-extensions (0.1.2)
whenever (0.9.4)
will_paginate (3.0.4)
xpath (2.0.0, 1.0.0)
yaml_db (0.2.3)

And my sunspot.yml:
production:
  solr:
    hostname: localhost
    port: 8983
    log_level: WARNING

development:
  solr:
    hostname: localhost
    port: 8982
    log_level: INFO

test:
  solr:
    hostname: localhost
    port: 8981
    log_level: WARNING

I've tried numerous other suggestions on SO but nothing seems to be fixing the issue. I have no experience with sunspot so indepth answers are most welcome :-D
Thanks.

A: start the solr server by using the below command:
rake sunspot:solr:start

After starting check whether it is started or not by opening the http://localhost:8982 in your browser

A: You should provider path in the sunspot.yml file:
development:
  solr:
    hostname: localhost
    port: 8982
    log_level: INFO
    path: /solr/your_collection

Notice that path is used in Solr's requests like this:
http://localhost:8982/solr/#/your_collection
Also, if you use predefined Solr you should start it via an rake task:
bundle exec rake sunspot:solr:start

A: Just had the same problem. In my case there was a stale sunspot process running. What I did was:

*

*Open the Activity Monitor

*Search for 'java'

*Kill 'java ' processes

*Started Sunspot ( rake sunspot:solr:start )

*Reindex Sunspot ( rake sunspot:solr:reindex )


text:
Q: How can I prevent an onclick JavaScript from running on page load? I'm trying to attach a PHP script to a button so when someone clicks on it, I'm sent what page they're on.  I have the PHP script written and I'm trying to attach it to a JavaScript onclick call.  Here's what I have so far:
<button id="location">Click to reveal the page you're on</button>

<script>
    function send_sms() {
        var result  = '<?php locate_me(); ?>';
        console.log('send_sms');
    }
    document.getElementById('location').addEventListener('click', send_sms, false);
</script>

However, the JavaScript gets called when the page loads - not when the button is clicked - or maybe it's just the PHP that gets run.   The console.log command does not get written on page load, but the PHP script is run.  Very strange - at least to me.
I'm not proficient with JavaScript, but I thought the addEventListener() would prevent that from happening.  What am I doing wrong?
Thanks,
Frank

A: I'm not sure about what you mean by "revealing what page the user is on", but I'm thinking that's not relevant to the question, you're asking. I'm not too kean on running php scripts on the same file, I'm running my js on. As nice_dev suggested, I would make an ajax call to a seperate php file, in order to get live updates and not having your php variables pre-loaded.
So I would write my code like this:
Your main file:
<?php // Result from your second php file ?>

<script>
                            // Ajax call
            $(document).ready(function(){
            $("#location").click(function(){
               var result  = '<?php echo $variable; ?>';
                        $.ajax({
                url: "somepage.php",
                type: "POST",
                data:  {result:result},
                success: function(result){alert(result }});
                });
                });
</script>
<html>

    <body>
        <button id="location">Click to reveal the page you're on</button>
    </body>
</html>

Your second file, which will handle your ajax request:
<?php
$yourvariable = $POST['result'];

if isset($yourvariable){
// The php code you want to execute
}
?>

I hope this makes sense. Otherwise, I would be happy to elaborate.
In summary, I would try to run your code on 2 files in a circular process.


text:
Q: Control edge with neato layout with processmapR I'm using the bupaR process mining suite and processmapR to plot my log as a process map but when I try to set a custom position (which force the graph to use a neato layout) the edge become almost staight and the edge value hard to read:
Default graph with no custom position:

With custom position:

I tried to use
positions <- data.frame(act = c("node1","node2","node 3","node 4","node 5","Start", "End"),
                        y = c(5,4,3,2,1,6,0),
                        x = c(1,2,3,4,5,0,6),
                        stringsAsFactors = F)
graph = process_map(log, fixed_node_pos = positions, render = F)
map = add_global_graph_attrs(graph,
                             attr = "splines",
                             value = "true",
                             attr_type = "graph")
render_graph(map)

But I could not find any attribute to change the way edge are displayed, like adding more curve to them
How can I fix this problem ?
Thanks

A: Try the following:
map = add_global_graph_attrs(graph,
                             attr = "splines",
                             value = "curved",
                             attr_type = "graph")


text:
Q: How to convert a list of Open Street Maps (OSM) IDs to geojson to plot on folium? I have searched for my region counties manually and I have now a list of OSM IDs. Example:
https://www.openstreetmap.org/relation/4791885 - ID is in this case 4791885.
I would like to plot this shape in folium (to do later on a choropleth map of the population density). I tried downloading manually the xml and then using this library osm2geojson but it did not work (`multipolygon member not handled")
import folium
boulder_coords = [41.3874, 2.1686]
#Create the map
my_map = folium.Map(location = boulder_coords, zoom_start = 7.5)
geojson = "MY MISSING FILE"
folium.GeoJson(geojson, name="moianes").add_to(my_map)
folium.LayerControl().add_to(my_map)
my_map

As mentioned I have a list of IDs e.g. 2417889, 2822130 up to 42 in total so if the solution can handle it efficiently (less manual work) would be great.

A: I think to download the xml directly from your link will not provide the geometries data of your selected region. My last answer is failed to show the data. However, if you just need to show geojson data from OSM, you can do it. But, you need to store the geojson data in a folder (I put them in "geojson" folder, name the geojson according to the id or something that you preferred)
#Create the map
import folium
import codecs
ids=[4791885,2417889] #This will be a place for your ID's list
boulder_coords = [41.3874, 2.1686]
my_map = folium.Map(location = boulder_coords, zoom_start = 7.5)
for id in ids:
    name=str(id)
    with codecs.open('./geojson/'+name+'.geojson', 'r', encoding='utf-8') as data:
        geojson= data.read()
    folium.GeoJson(geojson, name=name).add_to(my_map)
folium.LayerControl().add_to(my_map)
my_map.save('index.html')

For retrieving geojson data from OSM, I still do them manually by using Overpass Turbo OSM. Here is what I got:
the Folium result

A: Looping through the OSM ID
I think first you can download the xml data according to your ID's list (save it on folder named "xml")
# Download the data
import requests
link='https://www.openstreetmap.org/api/0.6/relation/'
ids=[479188,2417889,2822130] #This will be a place for your ID's list
for id in ids:
   url=link+str(id)
   r = requests.get(url, allow_redirects=True)
   open('/content/xml/'+str(id)+'.xml', 'wb').write(r.content)

Create the Map
Then, you can read the xml file to geojson using osm2geojson by looping through the ID again to read xml file. Add it as layers on your map.
#Create the map
import folium
import codecs
import osm2geojson
boulder_coords = [41.3874, 2.1686]
my_map = folium.Map(location = boulder_coords, zoom_start = 7.5)
for id in ids:
    name=str(id)
    with codecs.open('/content/xml/'+name+'.xml', 'r', encoding='utf-8') as data:
        xml = data.read()
        geojson=osm2geojson.xml2geojson(xml, filter_used_refs=False, log_level='INFO')
        folium.GeoJson(geojson, name=name).add_to(my_map)
folium.LayerControl().add_to(my_map)
my_map


text:
Q: exited, floating point exception soy nuevo en esto de la programacion , y estaba haciendo un programa en c , que genererá numeros aleatorios entre 1 y 100 y los guardara en una matriz de 8x8.
También quería que si esos numeros generados eran primos se quedaran en la matriz , en caso contrario guardas un 0.Al intentar compilar el programa me da el error del titulo , ¿alguien sabe que puede estar fallando?.Se que no es un codigo bonito , pero no se me ocurre otra manera de hacerlo.Tengo incluicas las librerias necesarias.
 ``
  #include <stdio.h>
  #include <stdlib.h>
  #include <time.h>
  void rellenar(int m[8][8]);
  int primos(int a);

int main(){
  int m[8][8];
  rellenar(m);
  return 0;
}

void rellenar(int m[8][8]){
  int i,j;
  int num;
  srand("NULL");

   for(i=0;i<8;i++){
      for(j=0;j<8;j++){
          num=(rand() % 100)+1;
          m[i][j]=num;

           if(primos(num)==1){
               m[i][j]=num;
            }else{
               m[i][j]=0;
            }
         }
   }

     for(i=0;i<8;i++){
       for(j=0;j<8;j++){
          printf("%d\t",m[i][j]);
      }
       printf("\n");
  }

}
  int primos(int a){
    int i,cont=0;

     for(i=0;i<a;i++){
          if(a%i==0){
             cont++;
           }
       }

     if(cont==2){
        return 1;
        }else{
    return 0;
   }
}

A: Floating point exception ocurre cuando intentas hacer una operación cuyo resultado debería ser un número en coma flotante (un float) pero que es imposible de realizar para el procesador, por ejemplo un división por cero.
Míarte la línea donde tienes:
for(i=0;i<a;i++){
          if(a%i==0){
             cont++;
           }
       }


text:
Q: Getting GIS experience if no companies hire entry level I graduated with a BS in Geography with a Business/GIS Minor, ever since I graduated I wanted to get into GIS. The GIS classes I took in college really interested me, but after 2 years of applying to GIS jobs and not getting one interview I am starting to think I may just have to work for $10 an hour and live with mom and dad the rest of my life.
It's incredibly frustrating working dead end jobs because I can't get my foot in the door with the career that I want. Every application is the same story, not enough experience.....how in the world am I supposed to get experience if no companies hire entry level?
I have tried to do my own work at home but I can't afford to just buy esris software.

A: I got my current job as a summer student for a municipality - check out those local to you.
It's not the most interesting and stimulating but it'll help you get experience and your foot in the door!
Maybe build a GIS portfolio online, see if you can take additional classes and get a certification - that counts as experience.


text:
Q: Question: Why do some people preface a question with "question"? Is it acceptable in the English language to do so? If so, what part of English would the first "question" be called...a conjunction?

A: Saying "Question" before actually saying your question would be an interjection.


text:
Q: Why doesn't node recognize this imported function? I define this function a file like this, and immediately export it.
const watchMongo = () => {
        console.log("foo")
    };

module.exports = { watchMongo };

Then I import it and run it the main app, as shown here.
const watchMongo = require('./controllers/path');

watchMongo();

However, I get this error when ran. "watchMongo is not a function".
When I console log 'watchMongo' instead of running it, I'm told "{ watchMongo: [Function: watchMongo] }"
So Node sees and recognizes the function? Until the function needs to be ran? What??

A: You can do one of 2 things. You are defining watchMongo as a named export. You can either do:
const { watchMongo } = require('./controllers/path');

or on your declaration file export like:
module.exports = watchMongo;


text:
Q: iPhone/iPad Flipboard Page Turn Animation? I want to make an animation that is exactly the same as the Flipboard's one. I have tested  Leaves and EPGLTransitionView on github, however, Leaves gives me the hand gesture but doesn't implement the page turn animation (its animation is like the iBook's one), and EPGLTransitionView doesn't implement the hand gestures.
Could anyone help me? Thanks in advance.
Sincerely,
Kai.

A: This github project might be what you are looking for: https://github.com/Dillion/iOS-Flip-Transform.


text:
Q: South ignores ManyToManyField in my model My model:
class Article(models.Model):
    user    = models.ForeignKey(User)
    categories = models.ManyToManyField(AuditGroup)
    topic   = models.ManyToManyField(Topic)
    title   = models.CharField(max_length=255)
    short_desc = models.TextField(blank=True)

The migration created:
class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'Article'
        db.create_table('certification_article', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
            ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('short_desc', self.gf('django.db.models.fields.TextField')(blank=True)),
        ))

None of the two many-to-many relationships are being produced! What am I missing?
Note: there's a strange thing in my model (took over the project): There is a class ProgramOverview in my model.py. But all code in this class is lowercase! In fact running --auto on schemamigration produces errors about ProgramOverview. Removing it, south wants to delete this class (turns out this is a view in the DB which is needed!) --> This seems to have been put there for some "hacky-ish" reason...So I produced the migration with:
./manage.py schemamigration certification --add-model Article

EDIT: This is the real problem. Somehow my editor messed up the ProgramOverview code. After restoring the code, I was able to run ./manage.py schemamigration certification --auto which produced all the needed tables!
END EDIT
I need the many-to-many though.

A: You wouldn't see an M2M in that declaration. What you see is correct.
An M2M "field" is an abstraction for a new table. There is no database level field in the 'Article' model.
Scan down the page to see the relevant M2M table creation code.


text:
Q: how to access specific ActiveStorage image in multiple images I am using ActiveStorage for Ruby on Rails project. A post has many images and I want to use the one of images with headline. I am wondering how to access specific image in multiple images.
Current code is like this. I create hash(key: post ID, value: image) and access hash data in view. I can show the image but is there another better way to access specific image?
@posts.each do |p|
  if p.post_images.present? && p.headline_image_id.present?
    @headline_image_id.store(p.id, p.post_images.select {|image| image.blob_id == p.headline_image_id})
  end
end


text:
Q: Xcode 4.4.1 CPU hog after simulation stopped Something seems to happen with my Xcode.
When running the project for the first time it goes good but when I stop the execution, 100% of CPU keeps being eaten by Xcode, if I try to run the project again the CPU escalates to eat almost 200% of the CPU then freezes Xcode.
If a kill Xcode then start it again the process repeats, only the first run goes well and when stopped the CPU gets hogged at 100%.
While searching for answers I noted that after waiting like 15 minutes or so with the memory hogged at 100% suddenly Xcode release it.
Tried restarting Xcode and computer with no luck.
Any suggestions please?

A: At the risk of sounding like the "Repair Disk Permission" panacea, you may want to try deleting the DerivedData folder for your project. It's at ~/Library/Developer/Xcode/DerivedData. There have been multiple reports (some from people I trust) that Xcode frequently gets confused due to corrupted data in that folder.

A: it seems Xcode 4.5 solved the issue.


text:
Q: Google Guava getTopLevelClassesRecursive not finding classes when running, only during test I am using OpenJDK 17 and Guava 31.1-Jre.  I am also using Spring Boot.
I have the line:
ImmutableSet<ClassPath.ClassInfo> classSet = ClassPath.from(ClassLoader.getSystemClassLoader())
                    .getTopLevelClassesRecursive(config.getFunctionPackage());

Whenever i run "mvn test", it finds the appropriate classes.  But when i run it using "java -jar ...", it does not find a any classes.  And i verified that "config.getFunctionPackage()" returns the same value both times.
Is a different class loader being used, or is something else going on?
thank you.


text:
Q: How to scale images with transform scale inside box, using css I am trying to make set of pictures( with border radius) to scale on hover. but to stay inside a box and make it look like it is only zooming inside that box not actualy getting bigger on site. I have already tried few thing none of them worked. I ill be really thankful for any advice.
https://imgur.com/xmRjIeM

     .foto{
       overflow: hidden;
       max-width: 100%;
       border-radius: 25px;

    }
    .popis{
       position: absolute;
       bottom: 5px;
       left: 50px;
    }
    .popis h3{
      font-weight: 600;
      color: white;
    }
    main img{
       filter: brightness(60%);
       width: 100%;
       overflow: hidden;
       border-radius: 25px;
       -webkit-transform: scale(0.9);
       -ms-transform: scale(0.9);
       transform: scale(0.9);
       transition: transform 0.5s, opacity 0.5s;
    }
    main img:hover{
       opacity: 1;
       -webkit-transform: scale(1);
       -ms-transform: scale(1);
       transform: scale(1);
       transition: transform 0.5s, opacity 0.5s;
    }

Lorem ipsum

Hagendaz

Hagendaz

Hagendaz

Hagendaz

Text

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus porttitor turpis ac leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Fusce nibh. Aenean vel massa quis mauris vehicula lacinia. Nulla quis diam. Etiam quis

Hagendaz

Hagendaz

Hagendaz

A: Ok, think this should do the trick
Just take away the difference from the margin of you image, whenever user hovers over it. This should make it appear centered when zooming.

<!DOCTYPE html>

    <title>Test</title>

A: You were close, see the comments.

.foto{
       overflow: hidden;
       max-width: 60%; /* Changed for visibility */
       border-radius: 25px;
       width: 20rem;
       padding: 1rem
    }
    .popis{
       position: absolute;
       bottom: 5px;
       left: 50px;
    }
    .popis h3{
      font-weight: 600;
      color: white;
    }
    main img{
       filter: brightness(60%);
       width: 100%;
       overflow: hidden;
       border-radius: 25px;
       transform: scale(1.1); /* Reset */
       transition: transform 0.5s, opacity 0.5s;
    }
    main img:hover{
       opacity: 1;
       transform: scale(1.2, 1.2); /* Transform X * 1.4 and Y * 1.4 */
       transform-origin: center center; /* Transform from X-center and Y-center */
       transition: transform 0.5s, opacity 0.5s;
    }

Lorem ipsum

Hagendaz

Hagendaz

Text

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus porttitor turpis ac leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Fusce nibh. Aenean vel massa quis mauris vehicula lacinia. Nulla quis diam. Etiam quis


text:
Q: apptainer/singularity multi-stage build with different registries I'm building an apptainer/singularity multi-stage recipe in a gitlab CI environment.
The first step of the recipe is built from an image hosted in a private registry, whereas the second built from an image hosted on dockerhub. Something like this:
# First stage
BootStrap: docker
Registry: <my_private_registry>
From: <my_image>
Stage: base
%files
    ...
%post
    ...

# Second stage
BootStrap: docker
Registry: index.docker.io
From: continuumio/miniconda3
Stage: final

%files from base
    ...
%post
    ...

Since the first registry is private, in the gitlab CI instance I'm setting the variables APPTAINER_DOCKER_USERNAME and APPTAINER_DOCKER_PASSWORD, as suggested here for CI/CD workflow.
This allows to build the first stage of the recipe succesfully.
Unfortunately, when the build of the second stage starts, it fails with:
> FATAL:   While performing build: conveyor failed to get: unable to retrieve auth token: invalid username/password: unauthorized: incorrect username or password

I think because the credentials for my private registry are passed to dockerhub in the second stage.
How can I login to different registries in multi-stage builds?
Any idea about how to deal with this problem?

A: I found a way to accomplish what I wanted. The fact was that environment variables overrides other login modes.
So I deleted the APPTAINER_DOCKER_USERNAME and APPTAINER_DOCKER_PASSWORD environment variables and, using this method, I added the following before_script field to my .gitlab-ci.yaml:
apptainer:
  stage: deploy
  image:
    name: kaczmarj/apptainer:1.1.3
    entrypoint: [""]
  tags:
  - privileged
  before_script:
    - echo "$DOCKER_REGISTRY_TOKEN" | apptainer remote login --username <my_username> --password-stdin docker://$CI_REGISTRY

This way, both the private registry (stored in $CI_REGISTRY) and the public
one (dockerhub) are available.


text:
Q: How to pass array as parameter in java method? Code:
Object[] a={ myObject};
someMethod(Object ...arg);

when I try:
someMethod ( {myObject} );

I receive error in Eclipse.
but when:
someMethod ( a );

all ok.
Why this difference?
Thanks.

A: someMethod(new Object[] { "" });

Should do the trick!

A: Because the { myObject } syntax is special syntactic sugar which only applies when you're initialising an array variable.  This is because on its own the assignment lacks type information; but in the special case of assignment the type is fully inferred from the variable.
In the first example, the compiler knows you're assigning to a (which is an Object[]), so this syntax is allowed.  In the latter you aren't initialising a variable (and due to a weakness in Java's type inference, it won't even fully work out the context of the parameter assignment either).  So it wouldn't know what type the array should be, even if it could unambiguously determine that that's what you're trying to do (as opposed to e.g. declaring a block).
Calling
someMethod ( new Object[] { myObject } )

would work if you want to define the array in-place without using a variable.

While the above answers your question as asked, I notice that the method you're calling is varargs rather than explicitly requiring an array paramter.  So in this case you could simply call
someMethod(myObject);