Batch file FOR /f tokens

for /f “tokens=* delims= ” %%f in (myfile) do This reads a file line-by-line, removing leading spaces (thanks, jeb). set line=%%f sets then the line variable to the line just read and call :procesToken calls a subroutine that does something with the line :processToken is the start of the subroutine mentioned above. for /f “tokens=1* … Read more

Twitter API – Reasons for “invalid or expired token”

Check the integrity of an access token at any time by calling the GET account/verify_credentials while using that access token. Its mentioned and by research I came to know that: Your access token will be invalid if a user explicitly rejects your application from their settings or if a Twitter admin suspends your application. If … Read more

Using Devise tokens to log in, is this built in?

My understanding is that you can use the tokens to log in or to hit arbitrary pages that need authentication, even with cURL. If you look in config/initializers/devise.rb, there should be a line that says something like: config.token_authentication_key = :auth_token Whatever the name of the token_authentication_key is should match what you put as the query … Read more

How to create a authentication token using Java

For Java 8 and above the fastest and simplest solution would be: private static final SecureRandom secureRandom = new SecureRandom(); //threadsafe private static final Base64.Encoder base64Encoder = Base64.getUrlEncoder(); //threadsafe public static String generateNewToken() { byte[] randomBytes = new byte[24]; secureRandom.nextBytes(randomBytes); return base64Encoder.encodeToString(randomBytes); } Output example: wrYl_zl_8dLXaZul7GcfpqmDqr7jEnli 7or_zct_ETxJnOa4ddaEzftNXbuvNSB- CkZss7TdsTVHRHfqBMq_HqQUxBGCTgWj 8loHzi27gJTO1xTqTd9SkJGYP8rYlNQn Above code will generate random string … Read more

Split a string into words by multiple delimiters [duplicate]

Assuming one of the delimiters is newline, the following reads the line and further splits it by the delimiters. For this example I’ve chosen the delimiters space, apostrophe, and semi-colon. std::stringstream stringStream(inputString); std::string line; while(std::getline(stringStream, line)) { std::size_t prev = 0, pos; while ((pos = line.find_first_of(” ‘;”, prev)) != std::string::npos) { if (pos > prev) … Read more

How safe is JWT?

Only the server should know the “secret” that is used to generate the JWT. If someone modifies the data contained in the JWT, the server will fail to decode it. So the server can trust any JWT that it can decode. However, if a hacker got access to your computer, they could see the JWT … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)