Facing difficulty in initialize i18next react component with fetch response data?

I am using i18next to do the internalization.

Default fetch request used to get a data from server and the language information available in response data. Based on language info the page has to be loaded with corresponding language

import i18n from 'i18next'; import { reactI18nextModule } from 'react-i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; import translationEN from './locales/en/translation.json'; import translationDE from './locales/de/translation.json';  // the translations let language; function sendRequest(resources) {   console.log('resources', resources);   i18n     .use(reactI18nextModule) // passes i18n down to react-i18next     .init(       {         resources,         lng: language,         fallbackLng: 'en',         keySeparator: false, // we do not use keys in form messages.welcome          interpolation: {           escapeValue: false // react already safes from xss         }       },       function() {         fetch('http://localhost:3100/getLang')           .then(data => data.json())           .then(res => {             console.log(res);             language = res.lang;             i18n.changeLanguage(language, (err, t) => {               if (err)                 return console.log(                   'something went wrong loading the language',                   err                 );             });           });       }     );   return i18n; } function i18() {   const resources = {     en: {       translation: translationEN     },     de: {       translation: translationDE     }   };   return sendRequest(resources); } export default i18(); 

Language variable is undefined initially. For the very first time i18n init method setup with “fallbackLng” variable instead of “lng”. After that fetch request goes in callback of init method. That will have the response of language need to used. Then i18n changeLanguage method will help to change language.

I am just wondering how can i execute fetch request prior to i18n initialization. I don’t like the approach of initialize the i18next with some default language first and then moved to different language. When i tried to initialize i18n in then part of fetch request doesn’t works for me.

Is there any alternative way available to execute fetch request first and then setup i18n before exporting the component?

Thanks in advance for any suggestion!

I’m having difficulty getting my players to do stuff in a sandbox campaign

Okay so I’m not a newbie GM, I’ve been a GM, for about three years now. I’ve been GMing for this group for almost two years next month. So I have an issue with motivating my players to take action, it’s a sandbox campaign and they’re currently going after BBEG’s old lairs to get clues on who he is and how he was defeated so they can defeat him. The players have somehow got it in their heads that BBEG is out to kill them, this is not the case because if it was BBEG would just kill them and there wouldn’t really be anything they could do about it, hence the fact that they’re searching old lairs for ways to defeat him.

So I have tried laying out sidequests where they get to be heroes, which is something the group has told me they wanted to be, to help them power up and gain experience, they even have mythic ranks. However whenever I present something to them that isn’t just a straight up monster hunt or a murder mystery, they go “No way are we getting involved, it isn’t our problem.” The only way I’ve managed to get them to do anything heroic so far is to use the paladin’s code to get the paladin to try and help people and save lives. On top of that I create villains and bad guys for the party to go up against, setting them up for awesome, and they retreat thinking its too dangerous, and once again, it isn’t their problem. I have tried using money to pay them, I have tried using their character motivations, but they seem dead set on ignoring everything in the world outside of the “main quest”, in a sandbox campaign due to something that has not come up once since its introduction and there has been no in game reinforcement of.

If it helps, the party is level 5 mythic rank 2.

TL;DR: What method can I employ to get my heroic minded, but not heroically inclined, group of players to explore more of the side content so they don’t get wrecked at the fight with the BBEG.

How is “Tier” difficulty calculated?

After reading through the Core Rulebook, I have noticed something about the Tier system the game uses. From my understanding, this works similarly to the “Challenge Rating” system in D&D. The Tiers go from 1 to 5, which affect everything from playable classes, stats, enemy and task difficulty, usable equipment, etc.

However, once I reached the Bestiary, having a look at some of the monsters, the Tier is suggested that “Elite” monsters scale at Tier 5+. I have only seen the Tier lists go up to 5.

There is a table listed as “Escalation Tiers” (Core Rulebook p.57), which might suggest that you add more to the dice pool and “difficulty” of the monster: I.e. a Tier 6 monster would be Tier 5 (+8) plus Tier 1 (+4) – meaning the “difficulty” of the monster would be +12?

Or, since the Tier escalation goes up by 1 for each Tier, a Tier 5 monster would be +8, and a Tier 6 would be +9?

So how are challenges, monsters, etc calculated above Tier 5?

How to decrease target difficulty in bitcoin source (v0.8)

I have followed this video series ( https://www.youtube.com/watch?v=mDGxGYvkDEE ) to create an alt-coin by forking Litecoin v0.8, which i followed the videos and successfully created an altcoin.

Now i am trying to do the same with bitcoin (v0.8). I selected Bitcoin v0.8, because the source code is very similar to the Litecoin v0.8. Everything is working the same as in litecoin fork, except the part where i have to mine genesis block.

In Litecoin fork, it took about two minutes to mine the genesis block. But for bitcoin, its been about three days and still i haven’t found the hash.

Some research that i did:

  1. Litecoin uses SCRYPT while bitcoin uses SHA-256.
  2. The difficulty can be lowered by changing block.nBits in genesis block creation code.
  3. For Bitcoin block.nBits = 0x1d00ffff; and for litecoin block.nBits = 0x1e0ffff0. From this i assume that the greater the value the lower is target.

When i change block.nBits value in bitcoin source i am able to mine genesis block quicker, but after injecting the mined genesis hash to source code, when i try to run bitcoind, it gives me an error saying, Invalid Chain, Rebuild database. In debug logs it says that Required Minimum amount of Proof of Work is not performed.

How can i adjust this check in bitcoin source, v0.8.

The genesis mining algorithm provided in video series is not working in bitcoin source because of SCRYPT. So i have added very simple code to mine the block.

    printf("Searching for genesis block...\n");     // This will figure out a valid hash and Nonce if you're     // creating a diffrent genesis block:      uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();     block.nNonce = 0;     uint256 minHash = block.GetHash();      printf("Hash Target= %s\n", hashTarget.ToString().c_str());      while(true) {         hash = block.GetHash();         if(hash <= hashTarget) {             break;         }         if(hash < minHash) {             minHash = hash;                      printf("Nonce = %d, Hash=%s\n", block.nNonce, minHash.ToString().c_str());         }         block.nNonce++;     }       hash = block.GetHash();     printf("Nonce = %d, Hash=%s\n", block.nNonce, hash.ToString().c_str()); 

Mining Difficulty and Leading Zeros

I understand that the Bitcoin mining problem is to find a string s (hash of previous block + Merkle Tree Hash + nonce) such that sha256(s) has n leading zeros, where n determines the mining difficulty.

Minng Difficulty

According to Blockchain.Info, The Current Difficulty is 63,93,02,37,17,201.

enter image description here

The output of sha256() is a 16 bit hex value.

Question 1 The above image indicates that if N=4, there are 4 zeroes in the 16bit hex value. So if N=16 is the entire string is expected to have only zeroes? Please explain difficulty using this example. So if N=6393023717201 How do I expect 63,93,02,37,17,201 number of zeroes in 16bit length string? Please explain the significance of this huge number of zeroes in this context.

Question 2 Why is difficulty decreases at some point in time?

How do I assess the difficulty of brute-forcing combinations of some public information?

I’m designing a piece of software whose information will be public, but I’m wondering how resistant this information might be to external analysis, without using any specific security mechanisms to protect the information.

The question tries to assess the difficulty of brute-forcing combinations of separate pieces of information, which is meaningful when combined, but not meaningful when viewed individually.

  • A piece of software has a number of users. The number of users is increasing over time but can be considered a “fixed snapshot” at any one time.

  • Each user can be assigned one or more items in a list of 30,000 items in the software.

  • Each user cannot be assigned an item twice (for their own use), but all other users are free to be assigned items from the same set of 30,000 items under the same conditions i.e. no duplicates.

  • Users are not logically connected in any way (their IDs are blokchain style addresses) so each can be considered either independent in one respect but if they form group, each address can only be in one group at a time.

  • When Users join an entity the number of members of that entity is private and unknown outside of the entity itself. The entity only consists of users addresses and no other type of member, so the theoretical maximum number of entities is the max nr of users.

  • Many entities can exist, and therefore many, but not all of the users, will be associated with one entity.

  • Members of the entity may have be assigned the same items.

  • It is also possible that they have been assigned unique items when viewed as a set of items.

  • There is no information that indicates that any two members are in the same entity.

  • All of the items and all of the users are publicly known.

  • All of the items assigned to any one user are publicly known as being associated to that user.

The adversary’s task is to discover which users are part of the same entity, and hence which items have been assigned to them. I’m presuming this can be brute-forced by just going through the combinations.

Assuming that the number of users and entities is growing, at what point does it become computationally infeasible to attempt to brute-force this task? In other words, how many users, how many entities is enough?

Difficulty shooting in high ISO with my Canon 5D Mark II

While trying to shooting at 2500 ISO in a dark music jam, when I push the shutter it just stays open, the plus/minus exposure dial through the lens flips to far left, and I have to change the setting to make the shutter finish.. then no shot… do I have wrong settings somewhere that is causing this.? I have a 35mm 1:1.4 lens attached…Canon

What stops miners from no longer submitting failed hashes to the network, to reduce the difficulty and block time?

As I understand it, the difficulty adjusts based on the hashrate to keep the block times at 10 minute intervals. But if Alice and Bob are the only ones mining on the network, what’s to stop Alice from only broadcasting the correct hash that she finds, effectively reducing the seen hashrate by 2 and making blocks 5 minutes instead?