My program is going in infinite loop and does not print required output please help anyone
dimanche 21 novembre 2021
samedi 20 novembre 2021
What are the pros and cons of using TTL vs actively sending a request to invalidate a key to invalidate a key in a cache?
Are there any best practices around key invalidation for caches like Redis? Should I let the key fall out after the TTL expires or should I call a delete on the key in question to remove that key from cache?
Would the actively calling a delete operation put more load and hurt the throughput of my cache?
pls explain the compiler error in my pattern making code
#include<iostream>
using namespace std;
int main () {
int rows;
int columns;
cout << "Pls enter the number of rows for pattern: ";
cin >> rows;
cout << "Pls enter the number of columns for pattern: ";
cin >> columns;
for (int i=1; i <= rows; i++) {
for (int j=1; j <= columns; j++){
cout << "*";
}
cout << endl;
}
char yn;
cout << "Is the program working as intended? (y/n)";
cin >> yn;
while (true) {
if (yn == 'y' || yn == 'Y') {
cout << "Thank You, for your response :)" << endl;
}
else if (yn == 'n' || yn == 'N') {
cout << "We will try to improve ;)" << endl;
}
return 0; }
}
At the end of this code the output tab of this terminal shows a message as:- c:/mingw/bin/…/lib/gcc/mingw32/6.3.0/…/…/…/…/mingw32/bin/ld.exe: cannot open output file pattern.exe: Permission denied collect2.exe: error: ld returned 1 exit status
terminal shows :- The term ‘./pattern’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was include d, verify that the path is correct and try again. At line:1 char:10
./pattern <<<< CategoryInfo : ObjectNotFound: (./pattern:String) , CommandNotFoundException FullyQualifiedErrorId : CommandNotFoundException
when i open this file as an applcation in .exe format (even though i saved it with a a name —> pattern.cpp), it :- it asks for number of rows and columns but no pattern is made, instead of making a pattern of ‘*’ it staright away asks if the program runs properly. :frowning:
What is wrong with my code? im a beginner who needs help.
vendredi 19 novembre 2021
How to return out of command pattern in controller so that application stops running (Java)?
I am designing a controller using the command pattern. The controller has a while loop inside that is scanning for user input. If user input matches a specific String, then a command class is executed. Here is a code snippit:
public Controller(Readable in, Appendable out) {
this.out = out;
this.scan = new Scanner(in);
this.commandMap = this.generateCommands();
}
public void go(Model m) {
while (scan.hasNext()) {
String input = scan.next();
Command command = this.commandMap.get(input);
command.do(m);
}
}
I usually use return to stop the application. However, when I use return inside one of the Command classes, the application keeps running. I think it just goes back to this upper loop. By the way, all my commands are public void.
Is there a way to exit/close the application from within the command classes? Like a "super" return? Or do I need to no longer make them void and if/else the return in the controller.
what polynomial global basis function mean
I tried to search the exact meaning and I don't find what I need ,I know a small change in x will affect to the whole basis function but how? can anyone explain it in an easier way?
What pattern or architecture should I implement by Laravel to structure this project?
The project is simple, and it has to do with formula 1 statistics. The UI looks a lot like a game menu. Going from "option" to "option" in the UI you end up in an "endpoint" page where the user can see the statistics of his like. It's tree structure where every "option" is a separate view on my project.
The user click "Race standings" to load a page. The user click a year on a form to see next page. The user click a race of that year then redirects to "race result" page. The logic for doing this is to create a nice UI so the user would like to spend time on the site and navigate through the pages.
I POST data from my view's forms to a controller's function. This function fetch the data from the database using my models and the post parameters, do the logic and return('thatView', compact('array' , 'array2', 'etc). php and javascript on the views manipulates the organized arrays fitting them into html. Arrays contains text data, for example array 1 could be the data of a race-result table.
The way my project is structure is very amateur. No patterns, no architecture, no anything good. Using directly the raceresult domain on the browser will result error. The needed parameters are missing as they cannot be set from the domain, it needs the previous page to post the data.
How could i structure my project better? What patterns could i use?
Which design pattern is best for using several REST APIs? [closed]
I'm using 4 or 5 APIs that are all slightly different from one another, but they accomplish the same things. The client's LMS decides which API will be used. I'm wondering which design pattern would suit me best to bring them all together.
