Which libraries are recommended for JWT validation?

I would like to use access token to secure API calls, but I do not know which library to use for the JWT token validation? What are the recommended libraries? I am developing in Java ee.

magento2 – Magento 2 validation exception message not translated

At checkout page, when I click place order without accepting the terms and conditions the validation error it’s showed in english instead of spanish. However, the store shows the interface in spanish and the translation line of that exact message is in the csv translation file

ANGULAR 11 | Can’t execute function inside custom form validation.. why?

I have a Reactive Form in Angular 11 and I’m trying to execute a date parsing function inside the custom validator of my form but, I get an error on my browser terminal that says that the function is not defined.. It seems that the validator runs before the function definition.. but why? is there a solution to this?

My app works, I just repeated the code of the function inside the custom validator and everything is good.. but I shouldn’t have to repeat code…

the constructor of my .ts:

constructor(private navbarService: NavbarService) {
this.placeholderDate = new Date;

this.searchForm = new FormGroup({
  fechaDesde: new FormControl('', (
  fechaHasta: new FormControl('', (
}, (this.dateValidators))


My date parsing function in the same .ts file:

 parseToDateFormat(date: string): Date {

const destructurDate = date.split('-');
if (destructurDate(0).length === 1) destructurDate(0) = '0' + destructurDate(0);
if (destructurDate(1).length === 1) destructurDate(1) = '0' + destructurDate(1);
let parsedDate = destructurDate.join('-');
const result = new Date(parsedDate.replace(/(d{2})-(d{2})-(d{4})/, "$2/$1/$3"));
return result;


My dateValidaors() function (all in the same components ts:

dateValidators(form: FormGroup) {
let fechaFrom = form.get('fechaDesde').value;
let fechaTo = form.get('fechaHasta').value;
fechaFrom = this.parseToDateFormat(fechaFrom);
fechaTo = this.parseToDateFormat(fechaTo);
if (fechaFrom <= fechaTo) return null;


the error is :

ERROR Error: Uncaught (in promise): TypeError: can’t access property “parseToDateFormat”, this is undefined

Again, my solution was to just copy paste the logic of my parsing funtion inside the validator, but repeating code…

can someone explain please?


How to deal with browser navigation in multi step form with validation

I am not a designer nor UX person. I am implementing an application which has multi-step form. Imagine that in this form some steps (screens) need to be validated before person can proceed to next step.

The application has also its own prev/next buttons with progress (dots), showing the person remaining amount of steps needed to be taken.

I am having issue with how to deal with browser navigation. Ideally I want each step of the form to have its own URL. This means URL would control what is rendered (some data for the form is cached in the browser and prefilled for the user). But what happens when user uses browser navigation to visit an URL that should not be allowed?

Imagine following scenario:

I have screen 1 containing a form and screen 2 containing some content. User needs to fill the form in screen 1 to proceed to screen 2. Let’s say user fills the form and is redirected to screen 2. Now the user decides to go back, either by using application navigation or browser navigation (both is possible). The scenario which I’m trying to figure out is when user clears the form and uses browser back button. At this point the application is in invalid state.

How to deal with this? I don’t know what is the right approach. Maybe I should not let user go to URL that should not be visible to him and instead redirect him to screen 1? But that could be problematic as user would not get any indication.

google sheets – jump to cell using dropdown list data validation

I’m trying to create a data validation/dropdown list to jump to a specific cell.

I have a large spreadsheet that I need to navigate around, and it is client facing. I’d love to have a dropdown list based off a data validation that could jump to a specific cell so that navigation is a little more straightforward.

I know you can type do “help/go to range” and jump to a specific cell,

But I’m hoping to create a dropdown menu that isn’t hyperlink based. Something that says the content of the cell not just its name.

For instance, I want to jump to cell A9, but would like it to say the text of B9 which in this example is “shot001_001”

So the data validation would be a list of Shot_001_001, Shot_001_002, Shot_001_003 etc. (names will change later) But the function would be the same as “go to range”

is that even possible?

webforms – Regular expressions in validation

I’m trying to make sense of the application of regular expression validation.

In my particular case, I want to block any use of “href” from a textarea field. The existence of a regular expression pattern field would suggest that I supply something typical like /^((?!href).)*$/, but that winds up having the unexpected effect of rejecting pretty much any text.

I looked at where the pattern is applied, and found this at line 296 of TextBase.php of Webform 8.5.23:

$pattern = '{^(?:' . $pcre_pattern . ')$}u';

…which means that the preg_match pattern is being converted to {^(?:/^((?!href).)*$/$}u, which obviously isn’t very helpful.

So, what are appropriate pattern formats for entering into the regular expression field of a validation? And as an aside, why does the pattern concantenator shown lack / delimiters?

c++ – Simple username validation

Instead of the loop, we can use std::all_of() (or std::any_of() with the opposite condition).

And we have std::isalnum(), which is likely implemented as a lookup table like this (with the caveat that we need to be careful about signed char). It’s more portable, too – the code we have will be wrong if there are non-alphabetic characters between A and Z, as there are on EBCDIC systems, for example.

We could change the interface to just return the error string, with a null pointer indicating success, to avoid the “out” parameter.

#include <algorithm>
#include <cctype>
#include <string>
// return a null pointer if valid, else a pointer to the error message
const char *check_username_valid(const std::string& str)
    if (str.length() < MinUsernameLen) { return "Username Too Short"; }
    if (str.length() > MaxUsernameLen) { return "Username Too Long"; }
    auto const char_permitted
        = ()(unsigned char c){ return c == '_' || std::isalnum(c); };

    if (std::all_of(str.begin(), str.end(), char_permitted)) {
        return nullptr;

    return "Invalid Character in Username";

If we’ll be adding more permitted username characters, we might want to use the lookup-table approach – but we don’t need a new type, and this static const can be built at compilation time:

#include <array>
#include <climits>

bool legal_username_char(unsigned char c)
    static auto const table
        = (){
              std::array<bool,UCHAR_MAX+1> a;
              for (unsigned char i = 0;  i++ < UCHAR_MAX; ) {
                  a(i) = std::isalnum(i);
              // additional non-alnum chars allowed
              a('_') = true;
              return a;
    return table(c);

That idiom is an immediately-invoked lambda, and it’s very handy for creating complex constants like this. Note also the use of UCHAR_MAX rather than making assumptions about the size of the type.

Minor: no need for cast to int when indexing (a(int(((unsigned char)(x))))). An unsigned char is perfectly fine as array index.

node.js – React native IAP (Android) Validation receive Problem

I added react-native-iap library( https://github.com/dooboolab/react-native-iap ) for using subscriptions.

Work well on IOS but I have some issues on Android.

On Android side perfectly working subscription person. I need to check expired date for block expired users. For IOS side I use RNIap.validateReceiptIos(receiptBody, false) this give me expired date and expired_ms. I used these but on Android side I use

const result = await RNIap.validateReceiptAndroid(

//below token comes from RNIap.getPurchaseHistory() -> purchaseToken

//below token comes from localhost node.js backend (nodejs Code *)
          true, // for subscriptions should pass "true"
        ).catch((err) => {
            console.log('err', JSON.stringify(err));

nodejs Code *:

const open = require("open");
const { google } = require("googleapis");
const account = require("./service-account.json");
const express = require("express");

const app = express();

const JWTClient = new google.auth.JWT(

app.get("/", (req, res) => {
  JWTClient.getAccessToken((err, token) => {
    if (err) {
      return res.status(404).send("get access token failed");

    return res.status(200).send(token);



the code returns {“statusCode”:401,”line”:126336,”column”:53,”sourceURL”:””}

This problem is from me or from library. Thank you for your response.

I have a google form that feeds into a google sheet. I need to pipe that information into another tab/cell in a dynamic way based on a data validation

Lets see if I can explain this well enough…

I have a spreadsheet “Main_page” that is dynamically pulling information from a secondary sheet, “All_shots”. I also have 2 google forms that are activated via buttons on “Main_page”.

The google forms ask questions which pipe into two response pages.

What I’m trying to figure out is a way to do a vlookup that can interpret the data in a dynamic way.

The “Main Page” has dynamic information tied to cell C2. C2 is a data validation drop down that has a list of shot names. These shots names are pulled from column A2-A76 in “All_Shots”

So what I need to happen, and I cannot seem to wrap my head around how to do this….

I need a series of checks to happen and then a result to occur based on those checks.

On “Main_page” I need a script or a formula to look at “Main_page!C2” if that result is (for example) “FO_VFX_010” then I need it to look at my two form response pages to pull data

Form response page one: “Shot_version”. “Shot_version” needs to pull information from all of its cells in each row.

For instance. “Shot_version!B2” should be the thing to match to in “Main_page!C2” that’s the first part. once the script/formula has matched those two entries it needs to look at the next cell to the right which is “version_number” this will be a list of numbers in the format of v001, v002.v003 etc.

Somehow, and here’s where I’m stuck, I need to have either a “countif” or a “vlookup” to make the determination where that info is piped.

I want user input via a google form, to answer the following questions and then pipe the answers into “Main_page” but those answers will change to match whatever is in “Main_page!C2”

So the google form asks:

Shot Number (dropdown with list)
Version number (dropdown with list)
Artist’s notes (paragraph)
Date submitted (calendar)
Shot Status (drop down list)

On the “Main_page!H11” I want to dynamically take the contents of “Shot_version!B2 & “_” & C2″
So in this example “Main_page!H11” would read as “FO_VFX_010_v001”

Then M11 would have the date pulled from “Shot_version!E2”

The major hurdle I’m having is if all of that is piped in, and I change the dropdown in “Main_page!C2” going from “FO_VFX_010” to “FO_VFX_020” I need the contents of “Main_page!H11” to update to match the google form entry for that shot. so “Main_page!H11” would then read “FO_VFX_020_v001”

I have records under “Main_page!H11” that need to do the same thing. so “Main_page!H11” is v001
“Main_page!H13” is v002 (some merged cells in there) “Main_page!H15” is v003 etc.

To add insult to injury I have the same issue with my second google form.

“Main_page!O11” needs to reference “Client_notes!D2” but only if it first matches “Client_notes!B2” I need some way for the version number to be the thing that drives which cell gets which information.. and it has to dynamically switch whenever I change “Main_page!C2”

Everything is tied to “Main_page!C2”. It’s driving a bunch of other stuff using vlookup and a few other kitchen sink things. But I can’t seem to make that work for these cells. not sure what I’m doing wrong.

For instance I currently have:

=vlookup(C2,Shot_version!$B$2:$C$79,1,0) & "_" & vlookup(C2,Shot_version!$B$2:$C$79,2,0)

This does return the correct information as long as I’m on “Main_page!C2” with the dropdown set to “FO_VFX_010”

If I change it to “FO_VFX_020”, ALL of my “Main_page!H” cells change to the same answer of “FO_VFX_020_v001” I can’t figure out what I’m missing!

Oh and bonus points, I’d like the status in “Main_page!G5” to match whatever the most recent entry is on the “Shot_version!G2:G” column is. So if it’s ready for review on v001, but it’s rendering on v002, status would update to “rendering”

Here’s what Main_page looks like with the name set to “FO_VFX_010”

Here’s what Main_page looks like with the name set to “FO_VFX_020”

This is what the google form results look like for “Client_notes”

This is what the google form results look like for “Shot_version”

sharepoint online – Validation IF Column

I am stuck on a validation column, I need Date Effective From mandatory if Approval Status is equal to Approved and vice versa I need Approval Status mandatory if Date Effective From is not blank.
I have the below code which works if status is approved and no date is entered.

=IF((Approval Status)="Approved",AND((Date Effective From)<>""),TRUE)

How do I go adding also the condition vice versa that if the users enters the date the status must be changed to Approved?