问:
Finding bandwidth for geographically weighted regression
I'm trying to find the optimum bandwidth for local regression (GWR), but I get an error which I don't understand how to fix. All my code runs fine until I ask for the optimum one. Any suggestions and/or explanations please? The purpose is to do spatial weighting, OLS, GWR and MGWR models, eventually though visualizing them with various maps.</p>
```<code># Get GWR model information
gwr_data.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 3340 entries, 0 to 3339
Data columns (total 24 columns):
 #   Column             Non-Null Count  Dtype
---  ------             --------------  -----
 0   Neighbourhood      3340 non-null   object
 1   PopDenKM           3340 non-null   int64
 2   AvInc              3340 non-null   int64
 3   NonImmPer          3340 non-null   float64
 4   ImmPer             3340 non-null   float64
 5   NoEduPer           3340 non-null   float64
 6   BacDegPer          3340 non-null   float64
 7   EmploymentRate     3340 non-null   float64
 8   UnemploymentRate   3340 non-null   float64
 9   TheftRate2016      3340 non-null   float64
 10  X                  3340 non-null   object
 11  Y                  3340 non-null   object
 12  NeighbourhoodName  3340 non-null   object
 13  Location_Type      3340 non-null   object
 14  Premises_Type      3340 non-null   object
 15  Bike_Make          3340 non-null   object
 16  Bike_Speed         3340 non-null   int64
 17  Bike_Colour        3340 non-null   object
 18  Cost_of_Bike       3340 non-null   float64
 19  Recovered          3340 non-null   int64
 20  Stolen             3340 non-null   int64
 21  Status             3340 non-null   object
 22  Longitude          3340 non-null   object
 23  Latitude           3340 non-null   object
dtypes: float64(8), int64(5), object(11)
memory usage: 652.3+ KB

#Prepare dataset inputs
g_y = gwr_data['TheftRate2016'].values.reshape((-1,1))
g_X = gwr_data[['AvInc','NoEduPer','Cost_of_Bike', 'UnemploymentRate']].values
u = gwr_data['X']
v = gwr_data['Y']
g_coords = list(zip(u,v))

# Standardised our data to have mean of 0 and standard deviation of 1
g_X = (g_X - g_X.mean(axis=0)) / g_X.std(axis=0)

g_y = g_y.reshape((-1,1))

g_y = (g_y - g_y.mean(axis=0)) / g_y.std(axis=0)

# Select bandwidth for kernel
bw = mgwr.sel_bw.Sel_BW(g_coords,
                  g_y, # Independent variable
                  g_X, # Dependent variable
                  fixed=False, # True for fixed bandwidth and false for adaptive bandwidth
                  spherical=True) # Spherical coordinates (long-lat) or projected coordinates

# Calculate the optimum bandwidth for our local regression?
bw.search()
---------------------------------------------------------------------------
TypingError                               Traceback (most recent call last)
Input In [201], in <cell line: 2>()
      1 # Calculate the optimum bandwidth for our local regression?
----> 2 bw.search()

File /opt/conda/lib/python3.9/site-packages/mgwr/sel_bw.py:319, in Sel_BW.search(self, search_method, criterion, bw_min, bw_max, interval, tol, max_iter, init_multi, tol_multi, rss_score, max_iter_multi, multi_bw_min, multi_bw_max, bws_same_times, pool, verbose)
    316     self.bw_init = self.bw[
    317         -1]  #scalar, optimal bw from initial gwr model
    318 else:
--> 319     self._bw()
    320     self.sel_hist = self.bw[-1]
    322 self.pool = None

File /opt/conda/lib/python3.9/site-packages/mgwr/sel_bw.py:337, in Sel_BW._bw(self)
    334     a, c = self._init_section(self.X_glob, self.X_loc, self.coords,
    335                               self.constant)
    336     delta = 0.38197  #1 - (np.sqrt(5.0)-1.0)/2.0
--> 337     self.bw = golden_section(a, c, delta, gwr_func, self.tol,
    338                              self.max_iter, self.int_score,
    339                              self.verbose)
    340 elif self.search_method == 'interval':
    341     self.bw = equal_interval(self.bw_min, self.bw_max, self.interval,
    342                              gwr_func, self.int_score, self.verbose)

File /opt/conda/lib/python3.9/site-packages/mgwr/search.py:62, in golden_section(a, c, delta, function, tol, max_iter, int_score, verbose)
     60     score_b = dict[b]
     61 else:
---> 62     score_b = function(b)
     63     dict[b] = score_b
     64     if verbose:

File /opt/conda/lib/python3.9/site-packages/mgwr/sel_bw.py:326, in Sel_BW._bw.<locals>.<lambda>(bw)
    325 def _bw(self):
--> 326     gwr_func = lambda bw: getDiag[self.criterion](GWR(
    327         self.coords, self.y, self.X_loc, bw, family=self.family, kernel=
    328         self.kernel, fixed=self.fixed, constant=self.constant, offset=self.
    329         offset, spherical=self.spherical).fit(lite=True, pool=self.pool))
    331     self._optimized_function = gwr_func
    333     if self.search_method == 'golden_section':

File /opt/conda/lib/python3.9/site-packages/mgwr/gwr.py:335, in GWR.fit(self, ini_params, tol, max_iter, solve, lite, pool)
    332 else:
    333     rslt = map(self._local_fit, range(m))  #sequential
--> 335 rslt_list = list(zip(*rslt))
    336 influ = np.array(rslt_list[0]).reshape(-1, 1)
    337 resid = np.array(rslt_list[1]).reshape(-1, 1)

File /opt/conda/lib/python3.9/site-packages/mgwr/gwr.py:248, in GWR._local_fit(self, i)
    244 def _local_fit(self, i):
    245     """
    246     Local fitting at location i.
    247     """
--> 248     wi = self._build_wi(i, self.bw).reshape(-1, 1)  #local spatial weights
    250     if isinstance(self.family, Gaussian):
    251         betas, inv_xtx_xt = _compute_betas_gwr(self.y, self.X, wi)

File /opt/conda/lib/python3.9/site-packages/mgwr/gwr.py:236, in GWR._build_wi(self, i, bw)
    233 def _build_wi(self, i, bw):
    235     try:
--> 236         wi = Kernel(i, self.coords, bw, fixed=self.fixed,
    237                     function=self.kernel, points=self.points,
    238                     spherical=self.spherical).kernel
    239     except BaseException:
    240         raise  # TypeError('Unsupported kernel function  ', kernel)

File /opt/conda/lib/python3.9/site-packages/mgwr/kernels.py:47, in Kernel.__init__(self, i, data, bw, fixed, function, eps, ids, points, spherical)
     43 def __init__(self, i, data, bw=None, fixed=True, function='triangular',
     44              eps=1.0000001, ids=None, points=None, spherical=False):
     46     if points is None:
---> 47         self.dvec = local_cdist(data[i], data, spherical).reshape(-1)
     48     else:
     49         self.dvec = local_cdist(points[i], data, spherical).reshape(-1)

File /opt/conda/lib/python3.9/site-packages/numba/core/dispatcher.py:468, in _DispatcherBase._compile_for_args(self, *args, **kws)
    464         msg = (f"{str(e).rstrip()} \n\nThis error may have been caused "
    465                f"by the following argument(s):\n{args_str}\n")
    466         e.patch_message(msg)
--> 468     error_rewrite(e, 'typing')
    469 except errors.UnsupportedError as e:
    470     # Something unsupported is present in the user code, add help info
    471     error_rewrite(e, 'unsupported_error')

File /opt/conda/lib/python3.9/site-packages/numba/core/dispatcher.py:409, in _DispatcherBase._compile_for_args.<locals>.error_rewrite(e, issue_type)
    407     raise e
    408 else:
--> 409     raise e.with_traceback(None)

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<built-in function sub>) found for signature:

 >>> sub(array([unichr x 16], 1d, A), [unichr x 16])

There are 12 candidate implementations:
    - Of which 10 did not match due to:
    Overload of function 'sub': File: <numerous>: Line N/A.
      With argument(s): '(array([unichr x 16], 1d, A), [unichr x 16])':
     No match.
    - Of which 2 did not match due to:
    Operator Overload in function 'sub': File: unknown: Line unknown.
      With argument(s): '(array([unichr x 16], 1d, A), [unichr x 16])':
     No match for registered cases:
      * (int64, int64) -> int64
      * (int64, uint64) -> int64
      * (uint64, int64) -> int64
      * (uint64, uint64) -> uint64
      * (float32, float32) -> float32
      * (float64, float64) -> float64
      * (complex64, complex64) -> complex64
      * (complex128, complex128) -> complex128

During: typing of intrinsic-call at /opt/conda/lib/python3.9/site-packages/mgwr/kernels.py (24)

File "../../opt/conda/lib/python3.9/site-packages/mgwr/kernels.py", line 24:
def local_cdist(coords_i, coords, spherical):
    <source elided>
    if spherical:
        dLat = np.radians(coords[:, 1] - coords_i[1])
        ^
</code>```

Body:
I'm trying to find the optimum bandwidth for local regression (GWR), but I get an error which I don't understand how to fix. All my code runs fine until I ask for the optimum one. Any suggestions and/or explanations please? The purpose is to do spatial weighting, OLS, GWR and MGWR models, eventually though visualizing them with various maps.

# Get GWR model information
gwr_data.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 3340 entries, 0 to 3339
Data columns (total 24 columns):
 #   Column             Non-Null Count  Dtype
---  ------             --------------  -----
 0   Neighbourhood      3340 non-null   object
 1   PopDenKM           3340 non-null   int64
 2   AvInc              3340 non-null   int64
 3   NonImmPer          3340 non-null   float64
 4   ImmPer             3340 non-null   float64
 5   NoEduPer           3340 non-null   float64
 6   BacDegPer          3340 non-null   float64
 7   EmploymentRate     3340 non-null   float64
 8   UnemploymentRate   3340 non-null   float64
 9   TheftRate2016      3340 non-null   float64
 10  X                  3340 non-null   object
 11  Y                  3340 non-null   object
 12  NeighbourhoodName  3340 non-null   object
 13  Location_Type      3340 non-null   object
 14  Premises_Type      3340 non-null   object
 15  Bike_Make          3340 non-null   object
 16  Bike_Speed         3340 non-null   int64
 17  Bike_Colour        3340 non-null   object
 18  Cost_of_Bike       3340 non-null   float64
 19  Recovered          3340 non-null   int64
 20  Stolen             3340 non-null   int64
 21  Status             3340 non-null   object
 22  Longitude          3340 non-null   object
 23  Latitude           3340 non-null   object
dtypes: float64(8), int64(5), object(11)
memory usage: 652.3+ KB

#Prepare dataset inputs
g_y = gwr_data['TheftRate2016'].values.reshape((-1,1))
g_X = gwr_data[['AvInc','NoEduPer','Cost_of_Bike', 'UnemploymentRate']].values
u = gwr_data['X']
v = gwr_data['Y']
g_coords = list(zip(u,v))

# Standardised our data to have mean of 0 and standard deviation of 1
g_X = (g_X - g_X.mean(axis=0)) / g_X.std(axis=0)

g_y = g_y.reshape((-1,1))

g_y = (g_y - g_y.mean(axis=0)) / g_y.std(axis=0)

# Select bandwidth for kernel
bw = mgwr.sel_bw.Sel_BW(g_coords,
                  g_y, # Independent variable
                  g_X, # Dependent variable
                  fixed=False, # True for fixed bandwidth and false for adaptive bandwidth
                  spherical=True) # Spherical coordinates (long-lat) or projected coordinates

# Calculate the optimum bandwidth for our local regression?
bw.search()
---------------------------------------------------------------------------
TypingError                               Traceback (most recent call last)
Input In [201], in <cell line: 2>()
      1 # Calculate the optimum bandwidth for our local regression?
----> 2 bw.search()

File /opt/conda/lib/python3.9/site-packages/mgwr/sel_bw.py:319, in Sel_BW.search(self, search_method, criterion, bw_min, bw_max, interval, tol, max_iter, init_multi, tol_multi, rss_score, max_iter_multi, multi_bw_min, multi_bw_max, bws_same_times, pool, verbose)
    316     self.bw_init = self.bw[
    317         -1]  #scalar, optimal bw from initial gwr model
    318 else:
--> 319     self._bw()
    320     self.sel_hist = self.bw[-1]
    322 self.pool = None

File /opt/conda/lib/python3.9/site-packages/mgwr/sel_bw.py:337, in Sel_BW._bw(self)
    334     a, c = self._init_section(self.X_glob, self.X_loc, self.coords,
    335                               self.constant)
    336     delta = 0.38197  #1 - (np.sqrt(5.0)-1.0)/2.0
--> 337     self.bw = golden_section(a, c, delta, gwr_func, self.tol,
    338                              self.max_iter, self.int_score,
    339                              self.verbose)
    340 elif self.search_method == 'interval':
    341     self.bw = equal_interval(self.bw_min, self.bw_max, self.interval,
    342                              gwr_func, self.int_score, self.verbose)

File /opt/conda/lib/python3.9/site-packages/mgwr/search.py:62, in golden_section(a, c, delta, function, tol, max_iter, int_score, verbose)
     60     score_b = dict[b]
     61 else:
---> 62     score_b = function(b)
     63     dict[b] = score_b
     64     if verbose:

File /opt/conda/lib/python3.9/site-packages/mgwr/sel_bw.py:326, in Sel_BW._bw.<locals>.<lambda>(bw)
    325 def _bw(self):
--> 326     gwr_func = lambda bw: getDiag[self.criterion](GWR(
    327         self.coords, self.y, self.X_loc, bw, family=self.family, kernel=
    328         self.kernel, fixed=self.fixed, constant=self.constant, offset=self.
    329         offset, spherical=self.spherical).fit(lite=True, pool=self.pool))
    331     self._optimized_function = gwr_func
    333     if self.search_method == 'golden_section':

File /opt/conda/lib/python3.9/site-packages/mgwr/gwr.py:335, in GWR.fit(self, ini_params, tol, max_iter, solve, lite, pool)
    332 else:
    333     rslt = map(self._local_fit, range(m))  #sequential
--> 335 rslt_list = list(zip(*rslt))
    336 influ = np.array(rslt_list[0]).reshape(-1, 1)
    337 resid = np.array(rslt_list[1]).reshape(-1, 1)

File /opt/conda/lib/python3.9/site-packages/mgwr/gwr.py:248, in GWR._local_fit(self, i)
    244 def _local_fit(self, i):
    245     """
    246     Local fitting at location i.
    247     """
--> 248     wi = self._build_wi(i, self.bw).reshape(-1, 1)  #local spatial weights
    250     if isinstance(self.family, Gaussian):
    251         betas, inv_xtx_xt = _compute_betas_gwr(self.y, self.X, wi)

File /opt/conda/lib/python3.9/site-packages/mgwr/gwr.py:236, in GWR._build_wi(self, i, bw)
    233 def _build_wi(self, i, bw):
    235     try:
--> 236         wi = Kernel(i, self.coords, bw, fixed=self.fixed,
    237                     function=self.kernel, points=self.points,
    238                     spherical=self.spherical).kernel
    239     except BaseException:
    240         raise  # TypeError('Unsupported kernel function  ', kernel)

File /opt/conda/lib/python3.9/site-packages/mgwr/kernels.py:47, in Kernel.__init__(self, i, data, bw, fixed, function, eps, ids, points, spherical)
     43 def __init__(self, i, data, bw=None, fixed=True, function='triangular',
     44              eps=1.0000001, ids=None, points=None, spherical=False):
     46     if points is None:
---> 47         self.dvec = local_cdist(data[i], data, spherical).reshape(-1)
     48     else:
     49         self.dvec = local_cdist(points[i], data, spherical).reshape(-1)

File /opt/conda/lib/python3.9/site-packages/numba/core/dispatcher.py:468, in _DispatcherBase._compile_for_args(self, *args, **kws)
    464         msg = (f"{str(e).rstrip()} \n\nThis error may have been caused "
    465                f"by the following argument(s):\n{args_str}\n")
    466         e.patch_message(msg)
--> 468     error_rewrite(e, 'typing')
    469 except errors.UnsupportedError as e:
    470     # Something unsupported is present in the user code, add help info
    471     error_rewrite(e, 'unsupported_error')

File /opt/conda/lib/python3.9/site-packages/numba/core/dispatcher.py:409, in _DispatcherBase._compile_for_args.<locals>.error_rewrite(e, issue_type)
    407     raise e
    408 else:
--> 409     raise e.with_traceback(None)

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<built-in function sub>) found for signature:

 >>> sub(array([unichr x 16], 1d, A), [unichr x 16])

There are 12 candidate implementations:
    - Of which 10 did not match due to:
    Overload of function 'sub': File: <numerous>: Line N/A.
      With argument(s): '(array([unichr x 16], 1d, A), [unichr x 16])':
     No match.
    - Of which 2 did not match due to:
    Operator Overload in function 'sub': File: unknown: Line unknown.
      With argument(s): '(array([unichr x 16], 1d, A), [unichr x 16])':
     No match for registered cases:
      * (int64, int64) -> int64
      * (int64, uint64) -> int64
      * (uint64, int64) -> int64
      * (uint64, uint64) -> uint64
      * (float32, float32) -> float32
      * (float64, float64) -> float64
      * (complex64, complex64) -> complex64
      * (complex128, complex128) -> complex128

During: typing of intrinsic-call at /opt/conda/lib/python3.9/site-packages/mgwr/kernels.py (24)

File "../../opt/conda/lib/python3.9/site-packages/mgwr/kernels.py", line 24:
def local_cdist(coords_i, coords, spherical):
    <source elided>
    if spherical:
        dLat = np.radians(coords[:, 1] - coords_i[1])
        ^


来源: stackexchange

问:
Could not load file or assembly. When multiple project is running. (MVC)
Suddenly I start having: Could not load file or assembly if I run another project on IIS on the same dev machine.

If I rebuild it gets good again, but as soon as I visit the other project, the trubble is back.

I have not seen this before.

For now it is:

Could not load file or assembly 'Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5' or one of its dependencies. The system cannot find the file specified.

But it seems it can also be another Assembly, like the project looses access as soon as the other project start to do something .

Any good ideas here ?

I use MVC (not core)

Best regards and thanks.

ContentLicense: CC BY-SA 4.0


问:
Regarding visibility over AWS Cost Explosion
we are running AWS Infra with various services. We have configured Alarm for Daily budget as well as cost anomalies, but it seems all those comes based on 24 hrs frequency. We have ran into strange problem lost month. It seems there was a bug in our deployment that caused rapid spike in DYNAMODB utilization where the cost spiked thousands of dollar in one or two hours we only come to know at the end of the day where it burns extra thousands of dollars before we actually come to know the bug.

What we are having

we have configured alarms on cost explorer and also tried to check the cost usage based on Granularity with HOURLY but it seems the cost explorer API only keep updates once in every 6 hrs or even more, this was confirmed by AWS support.

Expected solution:

It would be nice we could have visibility over the cost utilization on hourly basis or at least in the interval of 2-3 hrs. I believe AWS cost explore or any service would help here. It would be great if some one could help us directing to the tool that will help us to achieve our use case or any recommendation to tackle this would be much appreciated.


问:
Flowchart for Number of Days Past task
Pretty new to programming. I've got the program to work but struggling to construct the flowchart

Task Instructions

Number of Days Task

Instructions

Create a program that will ask the user for a day, month and year and calculate how many days in that year have passed. For example, if the user
enters 3rd February 2021 (3, 2, 2021), then that is the 34th day of the year. (31 days in January, plus 3 in February).

The program should store the number of days in each month in an appropriate data structure. The number of days is as follows:

January         31 days
February    28 days
March           31 days
April       30 days
May     31 days
June        30 days
July        31 days
August          31 days
September   30 days
October         31 days
November    30 days
December    31 days
January     31 days

Important:

• solve the task by creating a flowchart before coding.
•The program should include, at least, one function with parameters passing in/out
• You may not use any Python date modules/library’s functions
• You must use least one list (days in each month).
• You must make use of at least one function.
• You must make use of good Python variables and naming conventions.
• Leap years must be considered

Constraints:

• Only valid dates – for example 29 February 2021 is an invalid date

I've got the program to work but struggling to construct the flowchart. The program works I'm just struggling with the flowchart part.

`

```<code>class Date:
    def __init__(self, d, m, y):
        self.d = d
        self.m = m
        self.y = y

# store number of days in all months from
# January to Dec.
monthDays = [31, 28, 31, 30, 31, 30,
            31, 31, 30, 31, 30, 31]

# counts number of leap years
# before the given date

def countLeapYears(d):

    years = d.y

    # Check if the current year needs to be considered
    # for the count of leap years or not
    if (d.m <= 2):
        years -= 1

    # An year is a leap year if it is a multiple of 4,
    # multiple of 400 and not a multiple of 100.
    return int(years / 4) - int(years / 100) + int(years / 400)

# number of days between two
# given dates
def getDifference(dt1, dt2):

    # count using years and day
    n1 = dt1.y * 365 + dt1.d

    # Add days for months in given date
    for i in range(0, dt1.m - 1):
        n1 += monthDays[i]

    # leap year is of 366 days,
    # Add a day for every leap year
    n1 += countLeapYears(dt1)

    n2 = dt2.y * 365 + dt2.d
    for i in range(0, dt2.m - 1):
        n2 += monthDays[i]
    n2 += countLeapYears(dt2)

    return (n2 - n1)

dt2 = Date(0, 0, 0)
dt2.y = int(input("input first dates year\n: "))
dt2.m = int(input("input first dates month\n: "))
dt2.d = int(input("input first dates day\n: "))

dt1 = Date(1,1,dt2.y)
print(getDifference(dt1, dt2)+1, "days")`
</code>```

Title: Flowchart for Number of Days Past task

Body:
Pretty new to programming. I've got the program to work but struggling to construct the flowchart

Task Instructions

Number of Days Task

Instructions

Create a program that will ask the user for a day, month and year and calculate how many days in that year have passed. For example, if the user
enters 3rd February 2021 (3, 2, 2021), then that is the 34th day of the year. (31 days in January, plus 3 in February).

The program should store the number of days in each month in an appropriate data structure. The number of days is as follows:

January         31 days
February    28 days
March           31 days
April       30 days
May     31 days
June        30 days
July        31 days
August          31 days
September   30 days
October         31 days
November    30 days
December    31 days
January     31 days

Important:

• solve the task by creating a flowchart before coding.
•The program should include, at least, one function with parameters passing in/out
• You may not use any Python date modules/library’s functions
• You must use least one list (days in each month).
• You must make use of at least one function.
• You must make use of good Python variables and naming conventions.
• Leap years must be considered

Constraints:

• Only valid dates – for example 29 February 2021 is an invalid date

I've got the program to work but struggling to construct the flowchart. The program works I'm just struggling with the flowchart part.

`

class Date:
    def __init__(self, d, m, y):
        self.d = d
        self.m = m
        self.y = y

# store number of days in all months from
# January to Dec.
monthDays = [31, 28, 31, 30, 31, 30,
            31, 31, 30, 31, 30, 31]

# counts number of leap years
# before the given date

def countLeapYears(d):

    years = d.y

    # Check if the current year needs to be considered
    # for the count of leap years or not
    if (d.m <= 2):
        years -= 1

    # An year is a leap year if it is a multiple of 4,
    # multiple of 400 and not a multiple of 100.
    return int(years / 4) - int(years / 100) + int(years / 400)

# number of days between two
# given dates
def getDifference(dt1, dt2):

    # count using years and day
    n1 = dt1.y * 365 + dt1.d

    # Add days for months in given date
    for i in range(0, dt1.m - 1):
        n1 += monthDays[i]

    # leap year is of 366 days,
    # Add a day for every leap year
    n1 += countLeapYears(dt1)

    n2 = dt2.y * 365 + dt2.d
    for i in range(0, dt2.m - 1):
        n2 += monthDays[i]
    n2 += countLeapYears(dt2)

    return (n2 - n1)

dt2 = Date(0, 0, 0)
dt2.y = int(input("input first dates year\n: "))
dt2.m = int(input("input first dates month\n: "))
dt2.d = int(input("input first dates day\n: "))

dt1 = Date(1,1,dt2.y)
print(getDifference(dt1, dt2)+1, "days")`


问:
Artifactory generates 0 byte package json for NPM artifact
I am facing an odd situation where the initial npm publication went fine. But when moving/promoting the artifact to another local npm repository, which does not contain an artifact yet for this   artifact; artifactory succesfully moves the artifact. But fails with creating the corresponding package.json.

In the artifactory-service.log we see the following message:

2023-01-12T09:11:52.521Z [jfrt ] [INFO ] [c8198335dc788640] [.NpmPackageMetadataIndexer:402] [art-exec-24 ] - Preparing to write npm package metadata for repo 'npm_releases' on path '.npm/@<group>/<artifactid>/package.json' 2023-01-12T09:11:52.540Z [jfrt ] [ERROR] [494934d19384b919] [j.r.n.PackageMetadataStream:68] [art-fixed-$s ] - Failed write java.lang.RuntimeException: Failed precondition. List argument metadata must not be empty at org.jfrog.repomd.npm.util.NpmUtils.updateAndGetLatest(NpmUtils.java:107) at org.jfrog.repomd.npm.util.NpmUtils.updateAndGetLatest(NpmUtils.java:100) at org.jfrog.repomd.npm.PackageMetadataStream.calculateLatest(PackageMetadataStream.java:128) at org.jfrog.repomd.npm.PackageMetadataStream.buildGroupMetadata(PackageMetadataStream.java:99) at org.jfrog.repomd.npm.PackageMetadataStream.writeInternal(PackageMetadataStream.java:77) at org.jfrog.repomd.npm.PackageMetadataStream.write(PackageMetadataStream.java:66) at org.iostreams.streams.in.OutputToInputStream$1.call(OutputToInputStream.java:140) at org.iostreams.streams.in.OutputToInputStream$1.call(OutputToInputStream.java:136) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.artifactory.opentracing.TraceableRunnableDecorator.run(TraceableRunnableDecorator.java:40) at org.artifactory.concurrent.ArtifactoryRunnable.run(ArtifactoryRunnable.java:53) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) 2023-01-12T09:11:52.565Z [jfrt ] [INFO ] [c8198335dc788640] [.NpmPackageMetadataIndexer:412] [art-exec-24 ] - Finished writing npm package metadata for repo 'npm_releases' on path '.npm/@<group>/<artifactid>/package.json

I do not see how this relates to the uploaded artifact. As the generation of the package.json for the initial publication went fine. Next to this stacktrace I could not find anything in the log which relates to this.

I am able to reproduce this problem with artifactory version: 7.46.11 and 7.49.5

Could someone help explaining in what Failed precondition. List argument metadata must not be empty at means? And how to mitigate this situation?

I tried moving this artifact to other local npm repositories with same result. For unclear reasons in a populated repository as in a local npm repository(lets say the original repository which worked) which contains 3 artifacts with a different version number, but same group and artifactid a valid package.json was generated. This should work for this single artifact as well, but it doesn't.


问:
Smart contract works as intended when deployed in Remix VM but not in Goerli Testnet
I'm working on this Ethernaut challenge
My plan is as follows.
1-Deploy an exploit contract:

```<code>contract Exploit {

  // stores a timestamp
  uint public a;
  uint public b;
  address public storedTime;

  function setTime(uint _time) public {
    storedTime = tx.origin;
  }
}
</code>```

When sending a delegatecall to the setTime function, the third state variable of the calling contract should be set to tx.origin.

2- Call the setFirstTime function of the Preservation contract while passing it the address of the deployed Exploit contract, converted to decimals.
3- Call the setFirstTime function again, this time the called contract is the Exploit contract that will set the third state variable of the calling contract (owner) to tx.origin.

It works just fine when deploying the contracts in Remix VM, but when deploying to Goerli, the timezone1Library variable is effectively changed to the exploit contract address, but the owner variable won't budge. No idea why.

Body:
I'm working on this Ethernaut challenge
My plan is as follows.
1-Deploy an exploit contract:

contract Exploit {

  // stores a timestamp
  uint public a;
  uint public b;
  address public storedTime;

  function setTime(uint _time) public {
    storedTime = tx.origin;
  }
}

When sending a delegatecall to the setTime function, the third state variable of the calling contract should be set to tx.origin.

2- Call the setFirstTime function of the Preservation contract while passing it the address of the deployed Exploit contract, converted to decimals.
3- Call the setFirstTime function again, this time the called contract is the Exploit contract that will set the third state variable of the calling contract (owner) to tx.origin.

It works just fine when deploying the contracts in Remix VM, but when deploying to Goerli, the timezone1Library variable is effectively changed to the exploit contract address, but the owner variable won't budge. No idea why.


问:
How can I send email with Oauth 2.0 using Java for Office 365?
I found this code but it didn't help me much.
I want to generate an Oauth 2.0 token and send an email using javax.mail</p>
```<code>public String getAuthToken(String tanantId,String clientId,String client_secret) throws ClientProtocolException, IOException {
        CloseableHttpClient client = HttpClients.createDefault();
        HttpPost loginPost = new HttpPost("https://login.microsoftonline.com/" + tanantId + "/oauth2/v2.0/token");
        String scopes = "https://outlook.office365.com/.default";
        String encodedBody = "client_id=" + clientId + "&scope=" + scopes + "&client_secret=" + client_secret
                + "&grant_type=client_credentials";
        loginPost.setEntity(new StringEntity(encodedBody, ContentType.APPLICATION_FORM_URLENCODED));
        loginPost.addHeader(new BasicHeader("cache-control", "no-cache"));
        CloseableHttpResponse loginResponse = client.execute(loginPost);
        InputStream inputStream = loginResponse.getEntity().getContent();
        byte[] response = readAllBytes(inputStream);
        ObjectMapper objectMapper = new ObjectMapper();
        JavaType type = objectMapper.constructType(
                objectMapper.getTypeFactory().constructParametricType(Map.class, String.class, String.class));
        Map<String, String> parsed = new ObjectMapper().readValue(response, type);
        return parsed.get("access_token");
  }```
</code>```

Body:
I found this code but it didn't help me much.
I want to generate an Oauth 2.0 token and send an email using javax.mail

public String getAuthToken(String tanantId,String clientId,String client_secret) throws ClientProtocolException, IOException {
        CloseableHttpClient client = HttpClients.createDefault();
        HttpPost loginPost = new HttpPost("https://login.microsoftonline.com/" + tanantId + "/oauth2/v2.0/token");
        String scopes = "https://outlook.office365.com/.default";
        String encodedBody = "client_id=" + clientId + "&scope=" + scopes + "&client_secret=" + client_secret
                + "&grant_type=client_credentials";
        loginPost.setEntity(new StringEntity(encodedBody, ContentType.APPLICATION_FORM_URLENCODED));
        loginPost.addHeader(new BasicHeader("cache-control", "no-cache"));
        CloseableHttpResponse loginResponse = client.execute(loginPost);
        InputStream inputStream = loginResponse.getEntity().getContent();
        byte[] response = readAllBytes(inputStream);
        ObjectMapper objectMapper = new ObjectMapper();
        JavaType type = objectMapper.constructType(
                objectMapper.getTypeFactory().constructParametricType(Map.class, String.class, String.class));
        Map<String, String> parsed = new ObjectMapper().readValue(response, type);
        return parsed.get("access_token");
  }```


问:
Radio button keeps loading
I am trying to create a product builder and I have found a template on codyhouse that looks like it will do the job. The only issue is that the button to select just stays on loading and doesn't progress.

This is the link to the website. https://codyhouse.co/demo/product-builder/index.html

Once the radio button is selected, it keeps loading. Any help would be greatly appreciated as I am out of my depth. I suspect this is an issue with JS but I am not sure.

```<code>jQuery(document).ready(function($){
    function ProductBuilder( element ) {
        this.element = element;
        this.stepsWrapper = this.element.children('.cd-builder-steps');
        this.steps = this.element.find('.builder-step');
        //store some specific bulider steps
        this.models = this.element.find('[data-selection="models"]');
        this.summary;
        this.optionsLists = this.element.find('.options-list');
        //bottom summary
        this.fixedSummary = this.element.find('.cd-builder-footer');
        this.modelPreview = this.element.find('.selected-product').find('img');
        this.totPriceWrapper = this.element.find('.tot-price').find('b');
        //builder navigations
        this.mainNavigation = this.element.find('.cd-builder-main-nav');
        this.secondaryNavigation = this.element.find('.cd-builder-secondary-nav');
        //used to check if the builder content has been loaded properly
        this.loaded = true;

        // bind builder events
        this.bindEvents();
    }

    ProductBuilder.prototype.bindEvents = function() {
        var self = this;

        //detect click on the left navigation
        this.mainNavigation.on('click', 'li:not(.active)', function(event){
            event.preventDefault();
            self.loaded && self.newContentSelected($(this).index());
        });

        //detect click on bottom fixed navigation
        this.secondaryNavigation.on('click', '.nav-item li:not(.buy)', function(event){
            event.preventDefault();
            var stepNumber = ( $(this).parents('.next').length > 0 ) ? $(this).index() + 1 : $(this).index() - 1;
            self.loaded && self.newContentSelected(stepNumber);
        });
        //detect click on one element in an options list (e.g, models, accessories)
        this.optionsLists.on('click', '.js-option', function(event){
            self.updateListOptions($(this));
        });
        //detect clicks on customizer controls (e.g., colors ...)
        this.stepsWrapper.on('click', '.cd-product-customizer a', function(event){
            event.preventDefault();
            self.customizeModel($(this));
        });
    };

    ProductBuilder.prototype.newContentSelected = function(nextStep) {
        //first - check if a model has been selected - user can navigate through the builder
        if( this.fixedSummary.hasClass('disabled') ) {
            //no model has been selected - show alert
            this.fixedSummary.addClass('show-alert');
        } else {
            //model has been selected so show new content
            //first check if the color step has been completed - in this case update the product bottom preview
            if( this.steps.filter('.active').is('[data-selection="colors"]') ) {
                //in this case, color has been changed - update the preview image
                var imageSelected = this.steps.filter('.active').find('.cd-product-previews').children('.selected').children('img').attr('src');
                this.modelPreview.attr('src', imageSelected);
            }
            //if Summary is the selected step (new step to be revealed) -> update summary content
            if( nextStep + 1 >= this.steps.length ) {
                this.createSummary();
            }

            this.showNewContent(nextStep);
            this.updatePrimaryNav(nextStep);
            this.updateSecondaryNav(nextStep);
        }
    }

    ProductBuilder.prototype.showNewContent = function(nextStep) {
        var actualStep = this.steps.filter('.active').index() + 1;
        if( actualStep < nextStep + 1 ) {
            //go to next section
            this.steps.eq(actualStep-1).removeClass('active back').addClass('move-left');
            this.steps.eq(nextStep).addClass('active').removeClass('move-left back');
        } else {
            //go to previous section
            this.steps.eq(actualStep-1).removeClass('active back move-left');
            this.steps.eq(nextStep).addClass('active back').removeClass('move-left');
        }
    }

    ProductBuilder.prototype.updatePrimaryNav = function(nextStep) {
        this.mainNavigation.find('li').eq(nextStep).addClass('active').siblings('.active').removeClass('active');
    }

    ProductBuilder.prototype.updateSecondaryNav = function(nextStep) {
        ( nextStep == 0 ) ? this.fixedSummary.addClass('step-1') : this.fixedSummary.removeClass('step-1');

        this.secondaryNavigation.find('.nav-item.next').find('li').eq(nextStep).addClass('visible').removeClass('visited').prevAll().removeClass('visited').addClass('visited').end().nextAll().removeClass('visible visited');
        this.secondaryNavigation.find('.nav-item.prev').find('li').eq(nextStep).addClass('visible').removeClass('visited').prevAll().removeClass('visited').addClass('visited').end().nextAll().removeClass('visible visited');
    }

    ProductBuilder.prototype.createSummary = function() {
        var self = this;
        this.steps.each(function(){
            //this function may need to be updated according to your builder steps and summary
            var step = $(this);
            if( $(this).data('selection') == 'colors' ) {
                //create the Color summary
                var colorSelected = $(this).find('.cd-product-customizer').find('.selected'),
                    color = colorSelected.children('a').data('color'),
                    colorName = colorSelected.data('content'),
                    imageSelected = $(this).find('.cd-product-previews').find('.selected img').attr('src');

                self.summary.find('.summary-color').find('.color-label').text(colorName).siblings('.color-swatch').attr('data-color', color);
                self.summary.find('.product-preview').attr('src', imageSelected);
            } else if( $(this).data('selection') == 'accessories' ) {
                var selectedOptions = $(this).find('.js-option.selected'),
                    optionsContent = '';

                if( selectedOptions.length == 0 ) {
                    optionsContent = '<li><p>No Accessories selected;</p></li>';
                } else {
                    selectedOptions.each(function(){
                        optionsContent +='<li><p>'+$(this).find('p').text()+'</p></li>';
                    });
                }

                self.summary.find('.summary-accessories').children('li').remove().end().append($(optionsContent));
            }
        });
    }

    ProductBuilder.prototype.updateListOptions = function(listItem) {
        var self = this;

        if( listItem.hasClass('js-radio') ) {
            //this means only one option can be selected (e.g., models) - so check if there's another option selected and deselect it
            var alreadySelectedOption = listItem.siblings('.selected'),
                price = (alreadySelectedOption.length > 0 ) ? -Number(alreadySelectedOption.data('price')) : 0;

            //if the option was already selected and you are deselecting it - price is the price of the option just clicked
            ( listItem.hasClass('selected') )
                ? price = -Number(listItem.data('price'))
                : price = Number(listItem.data('price')) + price;

            //now deselect all the other options
            alreadySelectedOption.removeClass('selected');
            //toggle the option just selected
            listItem.toggleClass('selected');
            //update totalPrice - only if the step is not the Models step
            (listItem.parents('[data-selection="models"]').length == 0) && self.updatePrice(price);
        } else {
            //more than one options can be selected - just need to add/remove the one just clicked
            var price = ( listItem.hasClass('selected') ) ? -Number(listItem.data('price')) : Number(listItem.data('price'));
            //toggle the option just selected
            listItem.toggleClass('selected');
            //update totalPrice
            self.updatePrice(price);
        }

        if( listItem.parents('[data-selection="models"]').length > 0 ) {
            //since a model has been selected/deselected, you need to update the builder content
            self.updateModelContent(listItem);
        }
    };

    ProductBuilder.prototype.updateModelContent = function(model) {
        var self = this;
        if( model.hasClass('selected') ) {
            var modelType = model.data('model'),
                modelImage = model.find('img').attr('src');

            //need to update the product image in the bottom fixed navigation
            this.modelPreview.attr('src', modelImage);

            //need to update the content of the builder according to the selected product
            //first - remove the contet which refers to a different model
            this.models.siblings('li').remove();
            //second - load the new content
            $.ajax({
                type       : "GET",
                dataType   : "html",
                url        : modelType+".html",
                beforeSend : function(){
                    self.loaded = false;
                    model.siblings().removeClass('loaded');
                },
                success    : function(data){
                    self.models.after(data);
                    self.loaded = true;
                    model.addClass('loaded');
                    //activate top and bottom navigations
                    self.fixedSummary.add(self.mainNavigation).removeClass('disabled show-alert');
                    //update properties of the object
                    self.steps = self.element.find('.builder-step');
                    self.summary = self.element.find('[data-selection="summary"]');
                    //detect click on one element in an options list
                    self.optionsLists.off('click', '.js-option');
                    self.optionsLists = self.element.find('.options-list');
                    self.optionsLists.on('click', '.js-option', function(event){
                        self.updateListOptions($(this));
                    });

                    //this is used not to load the animation the first time new content is loaded
                    self.element.find('.first-load').removeClass('first-load');
                },
                error     : function(jqXHR, textStatus, errorThrown) {
                    //you may want to show an error message here
                }
            });

            //update price (no adding/removing)
            this.totPriceWrapper.text(model.data('price'));
        } else {
            //no model has been selected
            this.fixedSummary.add(this.mainNavigation).addClass('disabled');
            //update price
            this.totPriceWrapper.text('0');

            this.models.find('.loaded').removeClass('loaded');
        }
    };

    ProductBuilder.prototype.customizeModel = function(target) {
        var parent = target.parent('li')
            index = parent.index();

        //update final price
        var price = ( parent.hasClass('selected') )
            ? 0
            : Number(parent.data('price')) - parent.siblings('.selected').data('price');

        this.updatePrice(price);
        target.parent('li').addClass('selected').siblings().removeClass('selected').parents('.cd-product-customizer').siblings('.cd-product-previews').children('.selected').removeClass('selected').end().children('li').eq(index).addClass('selected');
    };

    ProductBuilder.prototype.updatePrice = function(price) {
        var actualPrice = Number(this.totPriceWrapper.text()) + price;
        this.totPriceWrapper.text(actualPrice);
    };

    if( $('.cd-product-builder').length > 0 ) {
        $('.cd-product-builder').each(function(){
            //create a productBuilder object for each .cd-product-builder
            new ProductBuilder($(this));
        });
    }
});
</code>```

Changing the JS/Css, but no luck.

Title: Radio button keeps loading

Body:
I am trying to create a product builder and I have found a template on codyhouse that looks like it will do the job. The only issue is that the button to select just stays on loading and doesn't progress.

This is the link to the website. https://codyhouse.co/demo/product-builder/index.html

Once the radio button is selected, it keeps loading. Any help would be greatly appreciated as I am out of my depth. I suspect this is an issue with JS but I am not sure.

jQuery(document).ready(function($){
    function ProductBuilder( element ) {
        this.element = element;
        this.stepsWrapper = this.element.children('.cd-builder-steps');
        this.steps = this.element.find('.builder-step');
        //store some specific bulider steps
        this.models = this.element.find('[data-selection="models"]');
        this.summary;
        this.optionsLists = this.element.find('.options-list');
        //bottom summary
        this.fixedSummary = this.element.find('.cd-builder-footer');
        this.modelPreview = this.element.find('.selected-product').find('img');
        this.totPriceWrapper = this.element.find('.tot-price').find('b');
        //builder navigations
        this.mainNavigation = this.element.find('.cd-builder-main-nav');
        this.secondaryNavigation = this.element.find('.cd-builder-secondary-nav');
        //used to check if the builder content has been loaded properly
        this.loaded = true;

        // bind builder events
        this.bindEvents();
    }

    ProductBuilder.prototype.bindEvents = function() {
        var self = this;

        //detect click on the left navigation
        this.mainNavigation.on('click', 'li:not(.active)', function(event){
            event.preventDefault();
            self.loaded && self.newContentSelected($(this).index());
        });

        //detect click on bottom fixed navigation
        this.secondaryNavigation.on('click', '.nav-item li:not(.buy)', function(event){
            event.preventDefault();
            var stepNumber = ( $(this).parents('.next').length > 0 ) ? $(this).index() + 1 : $(this).index() - 1;
            self.loaded && self.newContentSelected(stepNumber);
        });
        //detect click on one element in an options list (e.g, models, accessories)
        this.optionsLists.on('click', '.js-option', function(event){
            self.updateListOptions($(this));
        });
        //detect clicks on customizer controls (e.g., colors ...)
        this.stepsWrapper.on('click', '.cd-product-customizer a', function(event){
            event.preventDefault();
            self.customizeModel($(this));
        });
    };

    ProductBuilder.prototype.newContentSelected = function(nextStep) {
        //first - check if a model has been selected - user can navigate through the builder
        if( this.fixedSummary.hasClass('disabled') ) {
            //no model has been selected - show alert
            this.fixedSummary.addClass('show-alert');
        } else {
            //model has been selected so show new content
            //first check if the color step has been completed - in this case update the product bottom preview
            if( this.steps.filter('.active').is('[data-selection="colors"]') ) {
                //in this case, color has been changed - update the preview image
                var imageSelected = this.steps.filter('.active').find('.cd-product-previews').children('.selected').children('img').attr('src');
                this.modelPreview.attr('src', imageSelected);
            }
            //if Summary is the selected step (new step to be revealed) -> update summary content
            if( nextStep + 1 >= this.steps.length ) {
                this.createSummary();
            }

            this.showNewContent(nextStep);
            this.updatePrimaryNav(nextStep);
            this.updateSecondaryNav(nextStep);
        }
    }

    ProductBuilder.prototype.showNewContent = function(nextStep) {
        var actualStep = this.steps.filter('.active').index() + 1;
        if( actualStep < nextStep + 1 ) {
            //go to next section
            this.steps.eq(actualStep-1).removeClass('active back').addClass('move-left');
            this.steps.eq(nextStep).addClass('active').removeClass('move-left back');
        } else {
            //go to previous section
            this.steps.eq(actualStep-1).removeClass('active back move-left');
            this.steps.eq(nextStep).addClass('active back').removeClass('move-left');
        }
    }

    ProductBuilder.prototype.updatePrimaryNav = function(nextStep) {
        this.mainNavigation.find('li').eq(nextStep).addClass('active').siblings('.active').removeClass('active');
    }

    ProductBuilder.prototype.updateSecondaryNav = function(nextStep) {
        ( nextStep == 0 ) ? this.fixedSummary.addClass('step-1') : this.fixedSummary.removeClass('step-1');

        this.secondaryNavigation.find('.nav-item.next').find('li').eq(nextStep).addClass('visible').removeClass('visited').prevAll().removeClass('visited').addClass('visited').end().nextAll().removeClass('visible visited');
        this.secondaryNavigation.find('.nav-item.prev').find('li').eq(nextStep).addClass('visible').removeClass('visited').prevAll().removeClass('visited').addClass('visited').end().nextAll().removeClass('visible visited');
    }

    ProductBuilder.prototype.createSummary = function() {
        var self = this;
        this.steps.each(function(){
            //this function may need to be updated according to your builder steps and summary
            var step = $(this);
            if( $(this).data('selection') == 'colors' ) {
                //create the Color summary
                var colorSelected = $(this).find('.cd-product-customizer').find('.selected'),
                    color = colorSelected.children('a').data('color'),
                    colorName = colorSelected.data('content'),
                    imageSelected = $(this).find('.cd-product-previews').find('.selected img').attr('src');

                self.summary.find('.summary-color').find('.color-label').text(colorName).siblings('.color-swatch').attr('data-color', color);
                self.summary.find('.product-preview').attr('src', imageSelected);
            } else if( $(this).data('selection') == 'accessories' ) {
                var selectedOptions = $(this).find('.js-option.selected'),
                    optionsContent = '';

                if( selectedOptions.length == 0 ) {
                    optionsContent = '

No Accessories selected;

';
                } else {
                    selectedOptions.each(function(){
                        optionsContent +='

'+$(this).find('p').text()+'

';
                    });
                }

                self.summary.find('.summary-accessories').children('li').remove().end().append($(optionsContent));
            }
        });
    }

    ProductBuilder.prototype.updateListOptions = function(listItem) {
        var self = this;

        if( listItem.hasClass('js-radio') ) {
            //this means only one option can be selected (e.g., models) - so check if there's another option selected and deselect it
            var alreadySelectedOption = listItem.siblings('.selected'),
                price = (alreadySelectedOption.length > 0 ) ? -Number(alreadySelectedOption.data('price')) : 0;

            //if the option was already selected and you are deselecting it - price is the price of the option just clicked
            ( listItem.hasClass('selected') )
                ? price = -Number(listItem.data('price'))
                : price = Number(listItem.data('price')) + price;

            //now deselect all the other options
            alreadySelectedOption.removeClass('selected');
            //toggle the option just selected
            listItem.toggleClass('selected');
            //update totalPrice - only if the step is not the Models step
            (listItem.parents('[data-selection="models"]').length == 0) && self.updatePrice(price);
        } else {
            //more than one options can be selected - just need to add/remove the one just clicked
            var price = ( listItem.hasClass('selected') ) ? -Number(listItem.data('price')) : Number(listItem.data('price'));
            //toggle the option just selected
            listItem.toggleClass('selected');
            //update totalPrice
            self.updatePrice(price);
        }

        if( listItem.parents('[data-selection="models"]').length > 0 ) {
            //since a model has been selected/deselected, you need to update the builder content
            self.updateModelContent(listItem);
        }
    };

    ProductBuilder.prototype.updateModelContent = function(model) {
        var self = this;
        if( model.hasClass('selected') ) {
            var modelType = model.data('model'),
                modelImage = model.find('img').attr('src');

            //need to update the product image in the bottom fixed navigation
            this.modelPreview.attr('src', modelImage);

            //need to update the content of the builder according to the selected product
            //first - remove the contet which refers to a different model
            this.models.siblings('li').remove();
            //second - load the new content
            $.ajax({
                type       : "GET",
                dataType   : "html",
                url        : modelType+".html",
                beforeSend : function(){
                    self.loaded = false;
                    model.siblings().removeClass('loaded');
                },
                success    : function(data){
                    self.models.after(data);
                    self.loaded = true;
                    model.addClass('loaded');
                    //activate top and bottom navigations
                    self.fixedSummary.add(self.mainNavigation).removeClass('disabled show-alert');
                    //update properties of the object
                    self.steps = self.element.find('.builder-step');
                    self.summary = self.element.find('[data-selection="summary"]');
                    //detect click on one element in an options list
                    self.optionsLists.off('click', '.js-option');
                    self.optionsLists = self.element.find('.options-list');
                    self.optionsLists.on('click', '.js-option', function(event){
                        self.updateListOptions($(this));
                    });

                    //this is used not to load the animation the first time new content is loaded
                    self.element.find('.first-load').removeClass('first-load');
                },
                error     : function(jqXHR, textStatus, errorThrown) {
                    //you may want to show an error message here
                }
            });

            //update price (no adding/removing)
            this.totPriceWrapper.text(model.data('price'));
        } else {
            //no model has been selected
            this.fixedSummary.add(this.mainNavigation).addClass('disabled');
            //update price
            this.totPriceWrapper.text('0');

            this.models.find('.loaded').removeClass('loaded');
        }
    };

    ProductBuilder.prototype.customizeModel = function(target) {
        var parent = target.parent('li')
            index = parent.index();

        //update final price
        var price = ( parent.hasClass('selected') )
            ? 0
            : Number(parent.data('price')) - parent.siblings('.selected').data('price');

        this.updatePrice(price);
        target.parent('li').addClass('selected').siblings().removeClass('selected').parents('.cd-product-customizer').siblings('.cd-product-previews').children('.selected').removeClass('selected').end().children('li').eq(index).addClass('selected');
    };

    ProductBuilder.prototype.updatePrice = function(price) {
        var actualPrice = Number(this.totPriceWrapper.text()) + price;
        this.totPriceWrapper.text(actualPrice);
    };

    if( $('.cd-product-builder').length > 0 ) {
        $('.cd-product-builder').each(function(){
            //create a productBuilder object for each .cd-product-builder
            new ProductBuilder($(this));
        });
    }
});

Changing the JS/Css, but no luck.


问:
How to extend multiple objects at one time in QGIS?
I am currently trying to extend a series of parallel lines to 2 perpendicular lines in QGIS (https://i.stack.imgur.com/aQN7v.png). I have found two ways of doing this.

Use the extend tool within the QAD plugin, selecting the outer lines first and then selecting each parallel line separately to extend it to the outer line.

Use the trim/extend tool in the advanced digitising panel to do the same thing

However each parallel line has to be clicked individually for both of these solutions which in my case (100s of lines) takes a very long time. Does anyone know how to extend multiple lines at once?

It would also work if I could just specify the line length of multiple lines at once


问:
How to create a method inside a provider class
I want to be clear and precise. I have a database with 260 variables, I have a data model class and a SQLiteHelper class. I'm using a provider and I have all the CRUD inside.

The problem comes because I have scrolleable page in which I want to be able to change all variables. Around 240 variables are int? and each one will have a button which do the same, convert it to zero if it is null or add 1 if it is an integer. I'm not using a normal callback because in that scrolleable page I use different reusable buttons and I want to know the value of the variable in child and parent widget. In the reusable buttons for change color and text, and in the parent widget(scrolleable page) to save them in SQlite at the end of the page with a save button.

This is my provider class

```<code>class DBProvider with ChangeNotifier {
  final SQLiteHelper0 _db = SQLiteHelper0();

  List<DB> _items = [];

  Future<void> loadDB() async {
    List<Map<String, dynamic>> data = await _db.charDB;
    _items = data.map((DB) {
      return DB(
          id: charDB["id"],
          name: charDB["name"],...// the rest of the CRUD
</code>```

I'm trying something like that

```<code>dynamic increment(index){
  if(_items[index] != int?){

    return _items[index];

  } else if (_items[index]! == null){
    return _items[index]== 0;
  }else { return _items[index] + 1;}
 }
</code>```

an then in the scrolleable page make another function like that

```<code>late DBProvider _dBProvier;

void _increment(index){setState(() {
    _dBProvider.increment(index);
  });}
</code>```

I am having different problems, at times I think that nothing makes sense. But if it is a totally dumb way, please give me some direction to keep trying. This question is related with other question where I focused the problem in a different and wrong way Why this function is null?
Thanks.

Body:
I want to be clear and precise. I have a database with 260 variables, I have a data model class and a SQLiteHelper class. I'm using a provider and I have all the CRUD inside.

The problem comes because I have scrolleable page in which I want to be able to change all variables. Around 240 variables are int? and each one will have a button which do the same, convert it to zero if it is null or add 1 if it is an integer. I'm not using a normal callback because in that scrolleable page I use different reusable buttons and I want to know the value of the variable in child and parent widget. In the reusable buttons for change color and text, and in the parent widget(scrolleable page) to save them in SQlite at the end of the page with a save button.

This is my provider class

class DBProvider with ChangeNotifier {
  final SQLiteHelper0 _db = SQLiteHelper0();

  List<DB> _items = [];

  Future<void> loadDB() async {
    List<Map<String, dynamic>> data = await _db.charDB;
    _items = data.map((DB) {
      return DB(
          id: charDB["id"],
          name: charDB["name"],...// the rest of the CRUD

I'm trying something like that

dynamic increment(index){
  if(_items[index] != int?){

    return _items[index];

  } else if (_items[index]! == null){
    return _items[index]== 0;
  }else { return _items[index] + 1;}
 }

an then in the scrolleable page make another function like that

late DBProvider _dBProvier;

void _increment(index){setState(() {
    _dBProvider.increment(index);
  });}

I am having different problems, at times I think that nothing makes sense. But if it is a totally dumb way, please give me some direction to keep trying. This question is related with other question where I focused the problem in a different and wrong way Why this function is null?
Thanks.


问:
Does no.of columns effect read query performance with projection
Consider that I have a table USERS_1 with 2 columns : id and name
and another table USERS_2 with 3 columns: id, name and age.
I have indexes on id on both tables and both tables contains 20 rows with same date for id and name. Lets consider postgres DB as an example.

Will there be a performance difference between the following queries:

SELECT id, name FROM USERS_1 WHERE id < 10

SELECT id, name FROM USERS_2 WHERE id < 10

Lets say this WHERE clause matches with 5 rows in both tables.

I have heard that since the no.of columns are more in USERS_2, the I/O operations to be done might be more as the DB server has to read the entire row from disk, before projecting. Projection only helps in transferring lesser data to the client. Is that correct?
Ref: https://community.oracle.com/tech/developers/discussion/3764712/does-the-number-of-columns-in-a-table-can-affect-the-performance#:~:text=So%20yes%2C%20250%20columns%20typically,rows%20of%205%20cols%20each.

I do know that the no.of rows and columns are too minimal to observe any performance difference, but the intent is to understand how projection and I/O reads are related.


问:
Entity Framework Translation InvalidOperationException
In my API, I am trying to compare a list of objects passed in from the client with a list of records of the same type in the database, based on multiple properties.

I.e I have a Codes table in the database, with a Code column and a TypeId column. I receive a list of Code objects from the Client application, each with a Code property
and a TypeId property.

Using LINQ/Entity Framework, I want a list of all the database Codes which are in the input/client Codes list. That is, where the Code and TypeId properties
are the same. Like an INTERSECT or JOIN based on multiple properties.

In SQL, one would typically use the following:

```<code>SELECT * FROM @InputCodes ic INNER JOIN Codes c ON ic.Code = c.Code AND ic.TypeId = ic.TypeId
</code>```

How do I do this using Entity Framework? I've tried the following approaches:

```<code>List<Code> codes = new List<Code>() { }; // Assume this is being passed in from Client
codes.Add(new Code() { Code = "1234", TypeId = 1 });
codes.Add(new Code() { Code = "1234", TypeId = 2 });
codes.Add(new Code() { Code = "ABCD", TypeId = 2 });
codes.Add(new Code() { Code = "ZZZZ", TypeId = 3 });
</code>```

var result = await _db.Codes.Where(a => codes.Any(b => a.Code == b.Code && a.TypeId ==
b.TypeId)).ToListAsync();

```<code>  var result = from dbCode in _db.Codes
          join requestCode in codes
          on new { a = dbCode.Code, b = dbCode.TypeId } equals new { a = requestCode.Code,
                   b = requestCode.TypeId }
          select dbCode;
</code>```

Both queries result in the following error:

```<code>System.InvalidOperationException: 'The LINQ expression 'b => EntityShaperExpression:
    MxNode.Common.DB.Models.Codes
    ValueBufferExpression:
        ProjectionBindingExpression: EmptyProjectionMember
    IsNullable: False
.Code == b.Code && (int?)EntityShaperExpression:
    MxNode.Common.DB.Models.Codes
    ValueBufferExpression:
        ProjectionBindingExpression: EmptyProjectionMember
    IsNullable: False
.TypeId == b.TypeId' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.'
</code>```

I need this query to be evaluated server side as there could be thousands of codes and it would not be optimal to load all of them into
memory before comparing/filtering by code and type.

Body:
In my API, I am trying to compare a list of objects passed in from the client with a list of records of the same type in the database, based on multiple properties.

I.e I have a Codes table in the database, with a Code column and a TypeId column. I receive a list of Code objects from the Client application, each with a Code property
and a TypeId property.

Using LINQ/Entity Framework, I want a list of all the database Codes which are in the input/client Codes list. That is, where the Code and TypeId properties
are the same. Like an INTERSECT or JOIN based on multiple properties.

In SQL, one would typically use the following:

SELECT * FROM @InputCodes ic INNER JOIN Codes c ON ic.Code = c.Code AND ic.TypeId = ic.TypeId

How do I do this using Entity Framework? I've tried the following approaches:

List codes = new List() { }; // Assume this is being passed in from Client
codes.Add(new Code() { Code = "1234", TypeId = 1 });
codes.Add(new Code() { Code = "1234", TypeId = 2 });
codes.Add(new Code() { Code = "ABCD", TypeId = 2 });
codes.Add(new Code() { Code = "ZZZZ", TypeId = 3 });

var result = await _db.Codes.Where(a => codes.Any(b => a.Code == b.Code && a.TypeId ==
b.TypeId)).ToListAsync();

  var result = from dbCode in _db.Codes
          join requestCode in codes
          on new { a = dbCode.Code, b = dbCode.TypeId } equals new { a = requestCode.Code,
                   b = requestCode.TypeId }
          select dbCode;

Both queries result in the following error:

System.InvalidOperationException: 'The LINQ expression 'b => EntityShaperExpression:
    MxNode.Common.DB.Models.Codes
    ValueBufferExpression:
        ProjectionBindingExpression: EmptyProjectionMember
    IsNullable: False
.Code == b.Code && (int?)EntityShaperExpression:
    MxNode.Common.DB.Models.Codes
    ValueBufferExpression:
        ProjectionBindingExpression: EmptyProjectionMember
    IsNullable: False
.TypeId == b.TypeId' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.'

I need this query to be evaluated server side as there could be thousands of codes and it would not be optimal to load all of them into
memory before comparing/filtering by code and type.


问:
Combining legends where each individual legend contains only a subset of items on the common legend
I have a series of 16 plots which plot the same two continuous variables. Each individual plot shows only a subset of the entire dataset and I want to colour all the plots with the same colour scale, which shows a third independent, discrete variable. There are 9 values of this variable in total but each plot only contains a subset of these values. So if I use ggarrange and common legend it just plots the legend of the first sub-plot rather than plotting the common legend which encompasses all the different sub-plots. What's the best way to fix this?

```<code>library(ggplot2)

N_B_samples <- ggarrange(
  ggplot(subset(results,mount=="San1"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="San1"),
  ggplot(subset(results,mount=="San2"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="San2"),
  ggplot(subset(results,mount=="122"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="122"),
  ggplot(subset(results,mount=="DC46A"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="DC46A"),
  ggplot(subset(results,mount=="DC46B"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="DC46B"),
  ggplot(subset(results,mount=="DC48B"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="DC48B"),
  ggplot(subset(results,mount=="DR10"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="DR10"),
  ggplot(subset(results,mount=="X1008"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="X1008"),
  ggplot(subset(results,mount=="X1348"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="X1348"),
  ggplot(subset(results,mount=="DR9"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="DR9"),
  ggplot(subset(results,mount=="HA1"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="HA1"),
  ggplot(subset(results,mount=="HA2"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="HA2"),
  ggplot(subset(results,mount=="VI1808"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="VI1808"),
  ggplot(subset(results,mount=="275"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="275"),
  ggplot(subset(results,mount=="C13"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="C13"),
  ggplot(subset(results,mount=="ZS15"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="ZS15"),
  common.legend = TRUE, legend = "right"
)
</code>```

This is what happens without common.legend (showing the individual legends).

And this is what happens with common.legend = TRUE.

I want the colour for each mineral to be consistent across each plot and to only show one legend which covers all minerals.

Body:
I have a series of 16 plots which plot the same two continuous variables. Each individual plot shows only a subset of the entire dataset and I want to colour all the plots with the same colour scale, which shows a third independent, discrete variable. There are 9 values of this variable in total but each plot only contains a subset of these values. So if I use ggarrange and common legend it just plots the legend of the first sub-plot rather than plotting the common legend which encompasses all the different sub-plots. What's the best way to fix this?

library(ggplot2)

N_B_samples <- ggarrange(
  ggplot(subset(results,mount=="San1"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="San1"),
  ggplot(subset(results,mount=="San2"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="San2"),
  ggplot(subset(results,mount=="122"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="122"),
  ggplot(subset(results,mount=="DC46A"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="DC46A"),
  ggplot(subset(results,mount=="DC46B"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="DC46B"),
  ggplot(subset(results,mount=="DC48B"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="DC48B"),
  ggplot(subset(results,mount=="DR10"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="DR10"),
  ggplot(subset(results,mount=="X1008"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="X1008"),
  ggplot(subset(results,mount=="X1348"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="X1348"),
  ggplot(subset(results,mount=="DR9"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="DR9"),
  ggplot(subset(results,mount=="HA1"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="HA1"),
  ggplot(subset(results,mount=="HA2"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="HA2"),
  ggplot(subset(results,mount=="VI1808"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="VI1808"),
  ggplot(subset(results,mount=="275"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="275"),
  ggplot(subset(results,mount=="C13"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="C13"),
  ggplot(subset(results,mount=="ZS15"),aes(B,N,colour=Mineral)) + geom_point() + th + labs(title="ZS15"),
  common.legend = TRUE, legend = "right"
)

This is what happens without common.legend (showing the individual legends).

And this is what happens with common.legend = TRUE.

I want the colour for each mineral to be consistent across each plot and to only show one legend which covers all minerals.


问:
An error occurred while configuring netcdf
I was configuring after installing netcdf to run the wrf model.

However, an error occurred and the execution stopped in the middle.

I've tried a lot of different methods, but it doesn't work out.

gcc and gfortran are all installed.

The downloaded version is netcdf-fortran-4.6.0

```<code>configure: netCDF-Fortran 4.6.0
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking whether to enable maintainer-specific portions of Makefiles... no
configure: checking user options
checking whether make supports the include directive... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/atmos/wrf/netcdf-fortran-4.6.0':
configure: error: C compiler cannot create executables
See `config.log' for more details

</code>```

Body:
I was configuring after installing netcdf to run the wrf model.

However, an error occurred and the execution stopped in the middle.

I've tried a lot of different methods, but it doesn't work out.

gcc and gfortran are all installed.

The downloaded version is netcdf-fortran-4.6.0

configure: netCDF-Fortran 4.6.0
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking whether to enable maintainer-specific portions of Makefiles... no
configure: checking user options
checking whether make supports the include directive... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/atmos/wrf/netcdf-fortran-4.6.0':
configure: error: C compiler cannot create executables
See `config.log' for more details


问:
XSLT 2.0: Template match only if child element's value matches regex
Given this XML

```<code><root>
    <card>
        <k>заада</k>
        <blockquote>заада I</blockquote>
        <blockquote>ир.</blockquote>
        <blockquote>(или жүрөк заада)</blockquote>
    </card>
    ...
</root>
</code>```

I am trying to get only those Cards where any child blockquote element's value matches a regex. The XSL below isn't working, and I know why it doesn't work, I just can't figure out how to make it work.

```<code><xsl:template match="/">
    <xsl:apply-templates select="//card[matches(blockquote, '^\w+-? I:?$')]"/>
</xsl:template>

<xsl:template match="card">
    <xsl:copy-of select="." />
</xsl:template>
</code>```

Body:
Given this XML

<root>
    <card>
        <k>заада</k>

заада I

ир.

(или жүрөк заада)

    </card>
    ...
</root>

I am trying to get only those Cards where any child blockquote element's value matches a regex. The XSL below isn't working, and I know why it doesn't work, I just can't figure out how to make it work.

<xsl:template match="/">
    <xsl:apply-templates select="//card[matches(blockquote, '^\w+-? I:?$')]"/>
</xsl:template>

<xsl:template match="card">
    <xsl:copy-of select="." />
</xsl:template>


问:
n8n node development: "No testing function found for this credential."
I'm busy building my own node that connects to Oracle, and stumbled upon this problem...

I have a credentials file that does not contain any authentication or testing methods, as I am declaring a separate testing function in the node.ts file. When testing my node, it keeps saying that my credentials don't have a corresponding test function.

In my node.ts file I am stating that my credentials be tested by a function called testConnection:

```<code>credentials: [
            {
                name: 'myConnection',
                required: true,
                testedBy: 'testConnection'
            }
        ],
</code>```

which is declared in my node's methods object like so:

```<code>methods = {
        listSearch: {
            searchTables
        },
                //the credential test function is declared here:
        credentialTest: {
            testConnection /** this function is imported from another file */
        }
    };
</code>```

My test function follows the ICredentialsTestFunction interface signature that looks like this:
export declare type ICredentialTestFunction = (this: ICredentialTestFunctions, credential: ICredentialsDecrypted) => Promise<INodeCredentialTestResult>;

I've checked how MySQL and other similar nodes are doing it and I expected my code to work correctly as theirs do, yet it does not recognize the test function.

What am I doing wrong?

Body:
I'm busy building my own node that connects to Oracle, and stumbled upon this problem...

I have a credentials file that does not contain any authentication or testing methods, as I am declaring a separate testing function in the node.ts file. When testing my node, it keeps saying that my credentials don't have a corresponding test function.

In my node.ts file I am stating that my credentials be tested by a function called testConnection:

credentials: [
            {
                name: 'myConnection',
                required: true,
                testedBy: 'testConnection'
            }
        ],

which is declared in my node's methods object like so:

methods = {
        listSearch: {
            searchTables
        },
                //the credential test function is declared here:
        credentialTest: {
            testConnection /** this function is imported from another file */
        }
    };

My test function follows the ICredentialsTestFunction interface signature that looks like this:
export declare type ICredentialTestFunction = (this: ICredentialTestFunctions, credential: ICredentialsDecrypted) => Promise<INodeCredentialTestResult>;

I've checked how MySQL and other similar nodes are doing it and I expected my code to work correctly as theirs do, yet it does not recognize the test function.

What am I doing wrong?


问:
Maximo Anywhere Lookup function filter
hi am new to maximo anywhere and i have a task which is to make the lookup only show the labors that are the same site to the connected user so if the user's defsite = ALN for exmple
the labors with a worksite = ALN are only shown heres the function and thank you</p>
```<code>    ```filterLaborCraftRateForLookup: function(eventContext){
        var laborCraftRateSet =  CommonHandler._getAdditionalResource(eventContext,"additionallaborcraftrate");
        CommonHandler._clearFilterForResource(eventContext, laborCraftRateSet);
        var orgid = CommonHandler._getWorkorderOrgId(eventContext);
        var filter = [];
        filter.push({'orgid':orgid , 'worksite':defsite});
        laborCraftRateSet.lookupFilter = filter;
    },```
</code>```

Title: Maximo Anywhere Lookup function filter

Body:
hi am new to maximo anywhere and i have a task which is to make the lookup only show the labors that are the same site to the connected user so if the user's defsite = ALN for exmple
the labors with a worksite = ALN are only shown heres the function and thank you

    ```filterLaborCraftRateForLookup: function(eventContext){
        var laborCraftRateSet =  CommonHandler._getAdditionalResource(eventContext,"additionallaborcraftrate");
        CommonHandler._clearFilterForResource(eventContext, laborCraftRateSet);
        var orgid = CommonHandler._getWorkorderOrgId(eventContext);
        var filter = [];
        filter.push({'orgid':orgid , 'worksite':defsite});
        laborCraftRateSet.lookupFilter = filter;
    },```


问:
I can't use localization on datagrid headers
This combobox can change my button's content perfectly.

```<code><ComboBox Margin="2 0 0 0" x:Name="languageComboBox" SelectedItem="{Binding SelectedLanguage,Mode=TwoWay}">
                <ComboBoxItem Content="English" Tag="en-US"/>
                <ComboBoxItem Content="Japanese" Tag="jp-JP" />
            </ComboBox>
</code>```

My problem is, i can't change datagrid's column headers.

```<code> </DataGrid>
        <DataGrid AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn HeaderStringFormat="{Binding Id}" Binding="{Binding Id}"/>
                <DataGridTextColumn HeaderStringFormat="{Binding Name}" Binding="{Binding Name}"/>
                <DataGridTextColumn HeaderStringFormat="{Binding Address}" Binding="{Binding Address}"/>

            </DataGrid.Columns>
 </DataGrid>
</code>```

For example, when i bind Id variable to a label's content It works. I tried to many methods to change header contents but they does not work somehow.

Tried this.

```<code> </DataGrid>
        <DataGrid AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn HeaderStringFormat="{Binding Id}" Binding="{Binding Id}"/>
                <DataGridTextColumn HeaderStringFormat="{Binding Name}" Binding="{Binding Name}"/>
                <DataGridTextColumn HeaderStringFormat="{Binding Address}" Binding="{Binding Address}"/>

            </DataGrid.Columns>
 </DataGrid>
</code>```

And this.

```<code> </DataGrid>
        <DataGrid AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn Header="{Binding Id}" Binding="{Binding Id}"/>
                <DataGridTextColumn Header="{Binding Name}" Binding="{Binding Name}"/>
                <DataGridTextColumn Header="{Binding Address}" Binding="{Binding Address}"/>

            </DataGrid.Columns>
 </DataGrid>
</code>```

I get this error for Id variable ->

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement
or FrameworkContentElement for target element.
BindingExpression:Path=Id; DataItem=null; target element is
'DataGridTextColumn' (HashCode=654914); target property is
'HeaderStringFormat' (type 'String')

Body:
This combobox can change my button's content perfectly.

<ComboBox Margin="2 0 0 0" x:Name="languageComboBox" SelectedItem="{Binding SelectedLanguage,Mode=TwoWay}">
                <ComboBoxItem Content="English" Tag="en-US"/>
                <ComboBoxItem Content="Japanese" Tag="jp-JP" />
            </ComboBox>

My problem is, i can't change datagrid's column headers.

 </DataGrid>
        <DataGrid AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn HeaderStringFormat="{Binding Id}" Binding="{Binding Id}"/>
                <DataGridTextColumn HeaderStringFormat="{Binding Name}" Binding="{Binding Name}"/>
                <DataGridTextColumn HeaderStringFormat="{Binding Address}" Binding="{Binding Address}"/>

            </DataGrid.Columns>
 </DataGrid>

For example, when i bind Id variable to a label's content It works. I tried to many methods to change header contents but they does not work somehow.

Tried this.

 </DataGrid>
        <DataGrid AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn HeaderStringFormat="{Binding Id}" Binding="{Binding Id}"/>
                <DataGridTextColumn HeaderStringFormat="{Binding Name}" Binding="{Binding Name}"/>
                <DataGridTextColumn HeaderStringFormat="{Binding Address}" Binding="{Binding Address}"/>

            </DataGrid.Columns>
 </DataGrid>

And this.

 </DataGrid>
        <DataGrid AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn Header="{Binding Id}" Binding="{Binding Id}"/>
                <DataGridTextColumn Header="{Binding Name}" Binding="{Binding Name}"/>
                <DataGridTextColumn Header="{Binding Address}" Binding="{Binding Address}"/>

            </DataGrid.Columns>
 </DataGrid>

I get this error for Id variable ->

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement
or FrameworkContentElement for target element.
BindingExpression:Path=Id; DataItem=null; target element is
'DataGridTextColumn' (HashCode=654914); target property is
'HeaderStringFormat' (type 'String')


问:
How to pass the Authorization Bearer token as header while calling a private websocket hosted on GCP through javascript
I am trying to hit a private WebSocket server through javascript client code. This WebSocket is hosted on GCP as a private cloud-run service. Can you please help me to hit this WebSocket by passing the "Authorization" token as part of the header?

I am currently calling the WebSocket using this approach

```<code>const socket = new WebSocket('wss://web-adaptor-service-lz7ymxgtha-ue.a.run.app');
</code>```

I just need to pass the Authorization bearer token along wiht this url. Please help me with this.

NOTE : I am able to hit the same websocket by passing the required header using postman. I am attaching that snippet herewith for your reference. Please check it out.
I just want to achieve the same using javascript client code

Thanks in advance!!!

I tried to connect the websocket server from javascript client code by passing the headers in the below mentioned ways but all ultimately failed. I am everytime getting 403 error during doing this connectivity.

```<code>const websocketUrl = 'wss://web-adaptor-service-lz7ymxgtha-ue.a.run.app';
const gcp_auth_token = 'eyJhbGciOiJSU**************************';

1.1 socket = new WebSocket(websocketUrl + '?Authorization=Bearer ' + gcp_auth_token);
1.2 socket = new WebSocket(websocketUrl + '?Origin=' + gcp_auth_token);

1.3 socket = new webSocket(websocketUrl, null, {
        headers: {
            ['Authorization']: 'Bearer ' + gcp_auth_token
        }
    });
1.4 socket = new WebSocket(websocketUrl + '?access_token=' + gcp_auth_token);
1.5 socket = new WebSocket("wss://<gcp_auth_token>@<websocketUrl>");
1.6 socket = new WebSocket(websocketUrl , ["access_token", `${gcp_auth_token}']);
1.7 socket = new WebSocket(websocketUrl , [
        "base64url.bearer.authorization.k8s.io.<base64encodedtoken>",
        "base64.binary.k8s.io"
    ]);  //this format is give in this link  => https://github.com/kubernetes/kubernetes/pull/47740 which is also failing
</code>```

Body:
I am trying to hit a private WebSocket server through javascript client code. This WebSocket is hosted on GCP as a private cloud-run service. Can you please help me to hit this WebSocket by passing the "Authorization" token as part of the header?

I am currently calling the WebSocket using this approach

const socket = new WebSocket('wss://web-adaptor-service-lz7ymxgtha-ue.a.run.app');

I just need to pass the Authorization bearer token along wiht this url. Please help me with this.

NOTE : I am able to hit the same websocket by passing the required header using postman. I am attaching that snippet herewith for your reference. Please check it out.
I just want to achieve the same using javascript client code

Thanks in advance!!!

I tried to connect the websocket server from javascript client code by passing the headers in the below mentioned ways but all ultimately failed. I am everytime getting 403 error during doing this connectivity.

const websocketUrl = 'wss://web-adaptor-service-lz7ymxgtha-ue.a.run.app';
const gcp_auth_token = 'eyJhbGciOiJSU**************************';

1.1 socket = new WebSocket(websocketUrl + '?Authorization=Bearer ' + gcp_auth_token);
1.2 socket = new WebSocket(websocketUrl + '?Origin=' + gcp_auth_token);

1.3 socket = new webSocket(websocketUrl, null, {
        headers: {
            ['Authorization']: 'Bearer ' + gcp_auth_token
        }
    });
1.4 socket = new WebSocket(websocketUrl + '?access_token=' + gcp_auth_token);
1.5 socket = new WebSocket("wss://<gcp_auth_token>@<websocketUrl>");
1.6 socket = new WebSocket(websocketUrl , ["access_token", `${gcp_auth_token}']);
1.7 socket = new WebSocket(websocketUrl , [
        "base64url.bearer.authorization.k8s.io.<base64encodedtoken>",
        "base64.binary.k8s.io"
    ]);  //this format is give in this link  => https://github.com/kubernetes/kubernetes/pull/47740 which is also failing


问:
How to code in TradingView Pine Script to Plot an Overlay for Current Session only
I am using a pivot overlay of Previous Session's OHLC. I want to plot it only for current or present session. I don't need it plot for past sessions. How can I do that? Otherwise the code is working just fine and is as follows -</p>
```<code>//@version=5

indicator(title='Previous Session OHLC, shorttitle='Pivots', overlay=true, max_boxes_count=500, max_lines_count=500, max_labels_count = 500, max_bars_back = 5000)

label_size = input.string('small', options=['auto', 'tiny', 'small', 'normal', 'large', 'huge'], title='- size', inline='labels')
display_value = input.bool(false, title='Show Price Values in Labels')

// Rounding levels to min tick
nround(x) =>
    n = math.round(x / syminfo.mintick) * syminfo.mintick
    n

//Previous Session's OHLC
OHLCPlot = input.bool(title = "Plot OHLC?", defval=true)
disp_p_labels = input(true, title="Display Previous Session's OHLC Labels?")
resp = input(title="Resolution", defval="D")
isessp = session.regular
tp = ticker.new(syminfo.prefix, syminfo.ticker, session=isessp)
igapsp = barmerge.gaps_off
yesterdayHighp = request.security(tp,resp,high[1], gaps=igapsp, lookahead=barmerge.lookahead_on)
yesterdayLowp = request.security(tp,resp,low[1], gaps=igapsp, lookahead=barmerge.lookahead_on)
yesterdayOpenp = request.security(tp,resp,open[1], gaps=igapsp, lookahead=barmerge.lookahead_on)
yesterdayClosep = request.security(tp,resp,close[1], gaps=igapsp, lookahead=barmerge.lookahead_on)

//Adding linebreaks daywise for OHLC
PHColour = yesterdayHighp != yesterdayHighp[1] ? na : color.green
PLColour = yesterdayLowp != yesterdayLowp[1] ? na : color.red
POColour = yesterdayOpenp != yesterdayOpenp[1] ? na : color.navy
PCColour = yesterdayClosep != yesterdayClosep[1] ? na : color.blue

// Plot the other time frame's data
a=plot(OHLCPlot ? yesterdayHighp : na, title="PH", color=PHColour, style=plot.style_linebr, linewidth=1)
b=plot(OHLCPlot ? yesterdayLowp : na, title="PL", color=PLColour, style=plot.style_linebr, linewidth=1)
c=plot(OHLCPlot ? yesterdayOpenp : na, title="PO", color=POColour, style=plot.style_linebr, linewidth=1)
d=plot(OHLCPlot ? yesterdayClosep : na, title="PC", color=PCColour, style=plot.style_linebr, linewidth=1)

//Checkbox inputs
l_size = label_size == "auto" ? size.auto : label_size == "tiny" ? size.tiny : label_size == "small" ? size.small : label_size == "normal" ? size.normal : label_size == "large" ? size.large : size.huge

//Label Previous Session's OHLC
label_yesterdayHighp = disp_p_labels ? label.new(time, yesterdayHighp, text=display_value ? ("PrH"  + " " + str.tostring(nround(yesterdayHighp))) : "PrH", xloc=xloc.bar_time, style= label.style_none, textcolor=color.green, size= l_size) : na
label.set_x(id=label_yesterdayHighp, x=label.get_x(id=label_yesterdayHighp) + 8640000)
label.delete(label_yesterdayHighp[1])
label_yesterdayLowp = disp_p_labels ? label.new(time, yesterdayLowp, text=display_value ? ("PrL"  + " " + str.tostring(nround(yesterdayLowp))) : "PrL", xloc=xloc.bar_time, style= label.style_none, textcolor=color.red, size= l_size) : na
label.set_x(id=label_yesterdayLowp, x=label.get_x(id=label_yesterdayLowp) + 8640000)
label.delete(label_yesterdayLowp[1])
label_yesterdayOpenp = disp_p_labels ? label.new(time, yesterdayOpenp, text=display_value ? ("PrO"  + " " + str.tostring(nround(yesterdayOpenp))) : "PrO", xloc=xloc.bar_time, style= label.style_none, textcolor=color.navy, size= l_size) : na
label.set_x(id=label_yesterdayOpenp, x=label.get_x(id=label_yesterdayOpenp) + 8640000)
label.delete(label_yesterdayOpenp[1])
label_yesterdayClosep = disp_p_labels ? label.new(time, yesterdayClosep, text=display_value ? ("PrC"  + " " + str.tostring(nround(yesterdayClosep))) : "PrC", xloc=xloc.bar_time, style= label.style_none, textcolor=color.blue, size= l_size) : na
label.set_x(id=label_yesterdayClosep, x=label.get_x(id=label_yesterdayOpenp) + 8640000)
label.delete(label_yesterdayClosep[1])
</code>```

Body:
I am using a pivot overlay of Previous Session's OHLC. I want to plot it only for current or present session. I don't need it plot for past sessions. How can I do that? Otherwise the code is working just fine and is as follows -

//@version=5

indicator(title='Previous Session OHLC, shorttitle='Pivots', overlay=true, max_boxes_count=500, max_lines_count=500, max_labels_count = 500, max_bars_back = 5000)

label_size = input.string('small', options=['auto', 'tiny', 'small', 'normal', 'large', 'huge'], title='- size', inline='labels')
display_value = input.bool(false, title='Show Price Values in Labels')

// Rounding levels to min tick
nround(x) =>
    n = math.round(x / syminfo.mintick) * syminfo.mintick
    n

//Previous Session's OHLC
OHLCPlot = input.bool(title = "Plot OHLC?", defval=true)
disp_p_labels = input(true, title="Display Previous Session's OHLC Labels?")
resp = input(title="Resolution", defval="D")
isessp = session.regular
tp = ticker.new(syminfo.prefix, syminfo.ticker, session=isessp)
igapsp = barmerge.gaps_off
yesterdayHighp = request.security(tp,resp,high[1], gaps=igapsp, lookahead=barmerge.lookahead_on)
yesterdayLowp = request.security(tp,resp,low[1], gaps=igapsp, lookahead=barmerge.lookahead_on)
yesterdayOpenp = request.security(tp,resp,open[1], gaps=igapsp, lookahead=barmerge.lookahead_on)
yesterdayClosep = request.security(tp,resp,close[1], gaps=igapsp, lookahead=barmerge.lookahead_on)

//Adding linebreaks daywise for OHLC
PHColour = yesterdayHighp != yesterdayHighp[1] ? na : color.green
PLColour = yesterdayLowp != yesterdayLowp[1] ? na : color.red
POColour = yesterdayOpenp != yesterdayOpenp[1] ? na : color.navy
PCColour = yesterdayClosep != yesterdayClosep[1] ? na : color.blue

// Plot the other time frame's data
a=plot(OHLCPlot ? yesterdayHighp : na, title="PH", color=PHColour, style=plot.style_linebr, linewidth=1)
b=plot(OHLCPlot ? yesterdayLowp : na, title="PL", color=PLColour, style=plot.style_linebr, linewidth=1)
c=plot(OHLCPlot ? yesterdayOpenp : na, title="PO", color=POColour, style=plot.style_linebr, linewidth=1)
d=plot(OHLCPlot ? yesterdayClosep : na, title="PC", color=PCColour, style=plot.style_linebr, linewidth=1)

//Checkbox inputs
l_size = label_size == "auto" ? size.auto : label_size == "tiny" ? size.tiny : label_size == "small" ? size.small : label_size == "normal" ? size.normal : label_size == "large" ? size.large : size.huge

//Label Previous Session's OHLC
label_yesterdayHighp = disp_p_labels ? label.new(time, yesterdayHighp, text=display_value ? ("PrH"  + " " + str.tostring(nround(yesterdayHighp))) : "PrH", xloc=xloc.bar_time, style= label.style_none, textcolor=color.green, size= l_size) : na
label.set_x(id=label_yesterdayHighp, x=label.get_x(id=label_yesterdayHighp) + 8640000)
label.delete(label_yesterdayHighp[1])
label_yesterdayLowp = disp_p_labels ? label.new(time, yesterdayLowp, text=display_value ? ("PrL"  + " " + str.tostring(nround(yesterdayLowp))) : "PrL", xloc=xloc.bar_time, style= label.style_none, textcolor=color.red, size= l_size) : na
label.set_x(id=label_yesterdayLowp, x=label.get_x(id=label_yesterdayLowp) + 8640000)
label.delete(label_yesterdayLowp[1])
label_yesterdayOpenp = disp_p_labels ? label.new(time, yesterdayOpenp, text=display_value ? ("PrO"  + " " + str.tostring(nround(yesterdayOpenp))) : "PrO", xloc=xloc.bar_time, style= label.style_none, textcolor=color.navy, size= l_size) : na
label.set_x(id=label_yesterdayOpenp, x=label.get_x(id=label_yesterdayOpenp) + 8640000)
label.delete(label_yesterdayOpenp[1])
label_yesterdayClosep = disp_p_labels ? label.new(time, yesterdayClosep, text=display_value ? ("PrC"  + " " + str.tostring(nround(yesterdayClosep))) : "PrC", xloc=xloc.bar_time, style= label.style_none, textcolor=color.blue, size= l_size) : na
label.set_x(id=label_yesterdayClosep, x=label.get_x(id=label_yesterdayOpenp) + 8640000)
label.delete(label_yesterdayClosep[1])