## Difficulty understanding the purpose of ViewComponents in MVC

I’ve thrown some of these into my new MVC project for pages where I need ‘widgets’ on the screen that are on multiple pages. But I’m thinking of scrapping them and using RenderAction instead.

All my components use ajax to populate themselves, either upon loading or if they’re like a mini search box using things like autocomplete or even an ajax query to show some search results.

As a result I have to create an extra controller, so I have ViewComponents->MySearchComponent.cs which has the Invoke method returning a View, but then I have to create another controller called `MySearchComponentController` to put the relevant ajax methods on for doing the searches. This also means duplicating a lot of dependency injection code and setup. Also I have to create a new folder with a single file, a poorly named ‘Default.cshtml’ for every single component which makes navigating around files in VS a pain when you have 5 Default.cshtmls open (I appreciate you can rename it but why should you have to?).

I am tempted to just put everything into a controller and have a Shared->Components folder for all the views. It will make the codebase MUCH nicer and I can’t really see a disadvantage using RenderAction.

Specific questions:

• Am I missing something, such as a piece of functionality I don’t know about, that solves my problems (naming convention, having to create an extra controller for any ajax methods, having to create an extra folder for every component)

• Is the reason for my confusion that they have another use case, and I am using the incorrect technology to solve my problem?

## Do I include animal companions when calculating difficulty of an encounter?

I have a player who is playing a beast master ranger and I was wondering: do I calculate the level of the animal companion when making encounters?

## General level of difficulty of porting an application to windows

One of my project managers gave me the impression that porting our C++17 application from Linux to Windows should be a piece of cake and take no time at all.

The project is a medium sized project with the following specs:

• ~200 source files
• several major libraries (ffmpeg, open-gl/glew/glm, curl, a gui-framework, and zip management library)
• “using namespace std” is everywhere, including source files.

During development no special care was taken to make the codebase cross-platform so I’ve had to spend a good amount of time modifying some of the codebase for compatibility along with getting the libraries to work on our applications.

I’ve never developed on windows so it took me a couple of days (~3 days) to get accustomed and get the base functionality of the application to function and there are still a few things missing. There are still bugs and I get the impression that my job evaluation is suffering because of this delay. My question is, what is a good estimate for the amount of time to port a project of such size?

## Difficulty in usa immigration

Due to we born our son in usa 2 yrs ago my wife got limited stay visa for 30 days and she came back in time so is there any problem in future me and my wife have visitor visa for usa we are Indian citizens

## How to raise the difficulty and have players love it? [on hold]

I’m having a little discrepancy with my usual gaming group regarding a topic I don’t see much, difficulty, or how challenging the games actually are.

My perception is that players like playing it safe, and that’s okay but whenever I tried to pose a challenge that forced them to take risks they got into a block and start arguing how I was not being fair. I’m not talking about situations where characters die because the DM lost control of the situation, I’m talking about usual narrative tools, like ambushes, or situations where the protagonists have to flee rather than fight, or someone gets taken as hostage, or even die because the plot demanded so. They like to be in control constantly, and even though I would give them just that I begun to find games really boring, so I jumped back in the pack and switched to play instead of DMing. Thing is… From the player perspective I still find the game is absurdly easy, we’re so in control it’s imposible for us to lose, I find no thrills in this style of play.

I’ve talked with the DM plenty and though we both agree on this, he’s as scared as I was to actually go ham on the team because everyone is going to tilt the moment things go downhill.

How do I make a good case to prove that losing, or facing a real risk of defeat is actually fun?

## When update mining difficulty, Is the timespan of the past 2016 blocks approximated value?

I know how to calculate difficulty, and I know it is increased or decreased by checking the timespan of the past 2016 blocks.

and I found actual code for calculating timespan: https://github.com/bitcoin/bitcoin/blob/master/src/pow.cpp#L55

``actual_timespan = last_block->get_timestamp() - first_block->get_timestamp() ``

But, as I know timestamp in block is not the exact time of the mining: https://en.bitcoin.it/wiki/Block_timestamp

So, the timespan which is used to calculate the next difficulty is not the exact timespan but approximate value. Am I right?

## DnD 5e Enemy Difficulty Levels [on hold]

So, I’m making my first campaign ever, and I’m having fun making it, but the biggest problem I’m having is that since I haven’t run any campaigns before, and all of the characters in my campaign are starting at level 20 (They fight some things, get some loot, and then they have to kill each other), and I don’t know how to accurately gauge difficulty levels for my various encounters. Where can I find information about how enemy levels correspond to player levels and how to balance encounters?

## How does the Litecoin difficulty get calculated?

Bitcoin creates 2016 blocks, and if the average time of 2016 blocks is less than 10 minutes, the difficulty increases. If it is more than 10 minutes, the difficulty decreases.

How does the Litecoin mining difficulty get adjusted?

## Difficulty understanding the solution of heap problem in CLRS book?

I am reading the solution of this problem in CLRS:

Show that there are at most $$\lceil {n/2^{n+1}} \rceil$$ nodes of height $$h$$ in any $$n$$-element heap.

But I don’t understand the how to come up with the fact that $$(k-1)2^h + k(2^{h-1} + 1)$$ is less than the number of leaves. Thank you very much.

## 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!