Posts by PerduGames • 371 points
24 posts
-
1
votes1
answer488
viewsA: OPTIONS request not reaching the server
I finally found the problem, and it was the "Content-Type" header that I’m adding to the client’s request. It is not necessary to include it, the browser will do the job for you, they were being the…
-
1
votes1
answer488
viewsQ: OPTIONS request not reaching the server
I am making POST requests by sending and receiving JSON in my PHP API. When I’m on the localhost it works as expected, but when I’m in production I get the error below on Chromium: OPTIONS…
-
0
votes0
answers53
viewsQ: Ways to type check in javascript
I am studying Javascript, and I came across a question, which I present below, I found several ways to solve the same case in Javascript, and I show you what I chose. I wonder if you know other…
javascriptasked PerduGames 371 -
0
votes1
answer229
viewsA: Composition of objects in javascript
I was studying until now, and I found the way to write and solve the problem that I find most pleasing to me: const Sprite = (x=0, y=0) => ({ x: x, y: y }); const Shape2D = (x=0, y=0, width=0,…
-
1
votes1
answer229
viewsQ: Composition of objects in javascript
I’m studying a little more javascript here and I’ve come to a problem: I have an object called player: let Player = function () { this.name = 'player'; } Player.prototype = new Sprite();…
-
1
votes1
answer142
viewsQ: How to instantiate objects using literal object syntax?
I have a question maybe a little stupid, but come on, in Javascript, I can create an instance of an object declaring like this, let’s go in an example of a game, where I have to instate bullets to…
-
0
votes1
answer1272
viewsQ: How to search and update data with Mongoose?
I’m using mongodb with Mongoose in nodejs, I have my schema like this: const UserSchema = new mongoose.Schema({ username: { type: String, unique: true, require: true }, balances: { dolar: {…
-
2
votes2
answers891
viewsQ: Assign the return of a function that returns from a Promise
I am exporting a function to another file that is as a Webpack-simple + Vuejs component. That’s the function of the file api-user.js: export function getUsers () { axios.post('/api/get_list',{})…
-
4
votes1
answer4066
viewsQ: jwt authentication with vuejs
I’m a little confused with the authentication using jwt token, I have an application in vuejs + Vue-router, I don’t want to use vuex until I learn to do it without it (I don’t like to use what I…
-
0
votes2
answers350
viewsA: How do I set apache to ignore the directory in the url?
After hours of trying I got it. Just do so on your . htaccess, I will explain: RewriteEngine On RewriteCond %{REQUEST_URI} !/mydir/ RewriteRule "^(.+\.html)$" "/mydir/$1" Rewriteengine On Activates…
-
0
votes2
answers350
viewsQ: How do I set apache to ignore the directory in the url?
I have a directory inside my root folder called "mydir" where there are several files, currently I access these files so: http://mysite.com/mydir/myarchive.html My question is I have how to…
-
0
votes1
answer415
viewsQ: "Uncaught Syntaxerror: Missing ) after argument list" in . append Jquery
I am receiving "Uncaught Syntaxerror: Missing ) after argument list" which accuses the line of the last closed parenthesis, that inside the callback of a jquery post. I tried to close every possible…
-
0
votes2
answers271
viewsQ: Undefined when trying to use the received valid JSON
I’m having a hard time finding the error, I’ve been looking here for hours. I am receiving a PHP JSON using Jquery, I can visualize it as can see below the result of the answer "date": { "sucesso":…
-
0
votes0
answers100
viewsQ: Why does PHP return zero by subtracting elements from an object?
I noticed a behavior of PHP that I did not know, is the following: to exemplify I am taking an XML and using the function simplexml_load_string(). See below(ignore the lack of checks, it’s just an…
phpasked PerduGames 371 -
0
votes1
answer55
viewsQ: Search table field with query result from a different table?
I asked a question recently: Find lines of the last 24 hours that repeat the most (Mysql) And it was answered, now I have another question. I do the following to seek from and to of the most…
-
0
votes2
answers322
viewsQ: Find lines of the last 24 hours that repeat the most (Mysql)
'SELECT `from`, `to`, count(*) AS num_clicks FROM my_rank WHERE my_rank_data BETWEEN "'.$yesterday.'" AND "'.$today.'" ORDER BY num_clicks DESC LIMIT 0,20'; Above I am trying to take the fields…
-
0
votes1
answer336
viewsQ: Listen to messages with multiple customers(pub/sub)
If I want to be able to have multiple users and channels, do I need to have each user create a client in redis (or whatever the pub/sub used) to subscribe to the channel? And how would you get the…
-
6
votes1
answer2325
viewsQ: Explanation about sub pub(redis)
I researched about sub pub and I didn’t find anything in Portuguese, so I decided to ask here, I wanted to understand how the pub and sub especially to be applied with the redis, I read something…
redisasked PerduGames 371 -
1
votes2
answers3232
viewsQ: Assign one class to another in C++
There is a class as below: class vetor { protected: int x, y; public: //Construtor vetor(int _x=0, int _y=0); }; and another: class pos : public vetor { public: //Construtor pos();…
-
1
votes2
answers94
viewsQ: How to omit char matrix size in the function?
I have a question now, I have a function implemented this way: mostrarMensagem(char msg[10]) { //aqui faço algo com a variável "msg". } however I do not know the size I will receive as real…
-
1
votes1
answer875
viewsA: Creating a Makefile
Code link on Github: https://github.com/PerduGames/Makefile ######################################## ###Script by PerguGames ###GitHub:https://github.com/PerduGames…
-
3
votes2
answers1038
viewsQ: How to omit parameters in the actual parameter passage?
I have a C++ function called minhaFuncao() thus declared: minhaFuncao(int x, int y, float a); and thus implemented: minhaFuncao(int x, int y, float a=0){ ... } What I’m trying to say is, when you…
-
0
votes1
answer367
viewsQ: Grab file names and put in char array
As I take the filenames of a directory and place them in a multidimensional char array? #include <stdio.h> #include <dirent.h> int main() { char arrayNomes[10][50]; char dirn[50]; DIR…
-
3
votes1
answer875
viewsQ: Creating a Makefile
I’m needing to write a Makefile, I was able to configure something by searching, but I tried to improve more for what I need, and I’m not getting it. What I’m trying to do: 1 - Check all files . c…