Skylark
Skylark
KPCKevin Powell - Community
Created by Force2brw on 2/2/2024 in #back-end
building a mobile app
Do you have any specific things you want help with?
2 replies
KPCKevin Powell - Community
Created by Waddah on 1/31/2024 in #back-end
Newbie in back end
Figured I'd make those 9 changes. This code is untested. Just be aware I removed first and last names and replace it with name and username, additionally added a check to make sure usernames were unique
22 replies
KPCKevin Powell - Community
Created by Waddah on 1/31/2024 in #back-end
Newbie in back end
8 more things: 1. Line 22 of your php file you should not include internal error messages. Just return a status 500 and "Internal server error" and then log that error to a file. 2. Salt your passwords. 3. It's possible for profile picture images to fail uploading. 4. Use HttpOnly for your cookies. 5. Don't use first and last names, just ask for a name. You almost never need to know which part is which, and not everyone wants to give you their last name. You can ask for a name, if you are handling shipping that will be done seperately and again you'd just ask for name. Around the world a lot of naming conventions exist that don't fit first and last, such as East Asian countries having the family name first, and Dutch with things like "van der" between names that don't neatly split up. 6. Consider un-nesting your code, you have 4 levels of indentation and a lot of things happening. 7. Avoid long lines, it's harder to read 8. Expand your variable names, there's no point doing fname when you can do the much clearer first_name
22 replies
KPCKevin Powell - Community
Created by Waddah on 1/31/2024 in #back-end
Newbie in back end
You are missing this from your php file, and I've never actually returned JSON without that header to know what the behaviour is. I can't imagine it would then insert doctype but it could
header('Content-Type: application/json; charset=utf-8');
header('Content-Type: application/json; charset=utf-8');
22 replies
KPCKevin Powell - Community
Created by Waddah on 1/31/2024 in #back-end
Newbie in back end
Hmm I see
22 replies
KPCKevin Powell - Community
Created by Dan on 1/30/2024 in #front-end
overlflow-x mobile
Isn’t the need to hide overflow usually a problem with structure? Just remove what is causing the overflow
57 replies
KPCKevin Powell - Community
Created by Waddah on 1/31/2024 in #back-end
Newbie in back end
If that error is happening in the browser, which I think it is, you’re using JSON.parse() on the PHP file, you said that you’re passing it to JS to style. You just want to handle it as plain text not JSON. In the event that that error is occurring in XAMPP you’re using json_decode() on the HTML file
22 replies
KPCKevin Powell - Community
Created by Brightie on 1/27/2024 in #back-end
Deploying...
If it doesn’t need a build step you can skip
7 replies
KPCKevin Powell - Community
Created by Brightie on 1/27/2024 in #back-end
Deploying...
You’re supplying the run command to where it’s asking for a build command. You want to use npm build or whatever you have specified in your package.json
7 replies
KPCKevin Powell - Community
Created by Brightie on 1/27/2024 in #back-end
Deploying...
They can host it
7 replies
KPCKevin Powell - Community
Created by ZomaTheMasterOfDisaster on 1/26/2024 in #back-end
Setting up a php developer environment using Docker
(I use k3s for development, I make a lot of microservices (I love microservice architecture and I would never tell anyone hiring me for the work that you almost never need microservices [containerisation is different and necessary]) and I can host all of my microservices on my Raspberry Pi cluster and I could absolutely just use it through command line but may as well use a GUI for it. You almost never need to use solely command line, GUIs make the whole process easier. Also as a Docker vs Kubernetes thing, use Docker, it's easier)
17 replies
KPCKevin Powell - Community
Created by ZomaTheMasterOfDisaster on 1/26/2024 in #back-end
Setting up a php developer environment using Docker
I would really recommend using Docker Desktop just so it’s visual and it’s easier to see everything going on. Containerisation becomes a lot easier to understand when you can see all of your containers
17 replies
KPCKevin Powell - Community
Created by ZomaTheMasterOfDisaster on 1/26/2024 in #back-end
Setting up a php developer environment using Docker
Or k8s/k3s
17 replies
KPCKevin Powell - Community
Created by ZomaTheMasterOfDisaster on 1/26/2024 in #back-end
Setting up a php developer environment using Docker
Not at all, Docker handles it for you
17 replies
KPCKevin Powell - Community
Created by ZomaTheMasterOfDisaster on 1/26/2024 in #back-end
Setting up a php developer environment using Docker
So your PHP container doesn’t have to worry about the databases and the node.js
17 replies
KPCKevin Powell - Community
Created by ZomaTheMasterOfDisaster on 1/26/2024 in #back-end
Setting up a php developer environment using Docker
You will probably want to run each of the parts in different containers anyway
17 replies
KPCKevin Powell - Community
Created by ZomaTheMasterOfDisaster on 1/26/2024 in #back-end
Setting up a php developer environment using Docker
17 replies
KPCKevin Powell - Community
Created by ZomaTheMasterOfDisaster on 1/26/2024 in #back-end
Setting up a php developer environment using Docker
For instance https://hub.docker.com/_/php and https://hub.docker.com/_/redis they have readmes on what to do. I would recommend using Docker Desktop https://www.docker.com/products/docker-desktop/ as its much easier being able to point and click and visually see that things are working
17 replies
KPCKevin Powell - Community
Created by ZomaTheMasterOfDisaster on 1/26/2024 in #back-end
Setting up a php developer environment using Docker
https://hub.docker.com/ here you can search for php and the databases you want, simply add them and run
17 replies
KPCKevin Powell - Community
Created by Moataz on 1/23/2024 in #front-end
what is wrong here
I was going to suggest a checkout but I thought of a reason why it would just be better to not do it like that. I know that you then have to set it up again if the checkout fails but that wasn’t the big issue. It’ll come to me You could have something like
const once_resettable = (fn) => {
let has_run = false;
return [
() => {
if(has_run) return;
has_run = true;
return fn();
},
() => {
has_run = false;
}
];
};

const [log_five_once, reset_log_five] = once_resettable(() => console.log(5));
log_five_once(); // logs 5
log_five_once(); // nothing
reset_log_five();
log_five_once(); // logs 5
const once_resettable = (fn) => {
let has_run = false;
return [
() => {
if(has_run) return;
has_run = true;
return fn();
},
() => {
has_run = false;
}
];
};

const [log_five_once, reset_log_five] = once_resettable(() => console.log(5));
log_five_once(); // logs 5
log_five_once(); // nothing
reset_log_five();
log_five_once(); // logs 5
So it makes it easier to allow the user to submit again after there has been an error and the error has been checked, just run the reset function. Also return the result of fn() rather than just run it, and I moved the hasRun check into a non-negated guard clause. Additionally you can memoise the result and return that, or return a default value rather than undefined
9 replies