Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Aug 17 01:43
    @bjorno43 banned @linkin-park
  • Jun 20 21:20
    @bjorno43 banned @shenerd140
  • May 10 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 27 19:47
    @mstellaluna banned @zhonghuacx
  • Apr 25 17:12
    @mstellaluna banned @cmal
  • Jan 08 22:00
    @mstellaluna banned @dertiuss323
  • Dec 15 2018 23:36
    @mstellaluna banned @18835579411
  • Dec 13 2018 23:57
    @mstellaluna banned @brandon6190
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:13
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:58
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:15
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
@kbaig Well thats not a problem if the disk is big enough
But you can have both OS on different drives too
Which drives/Partitions the OS are on doesn't really matter
As long as they are big enough
But in my experience its easier to have them on seperate disks otherwise you need to configure the bootloader so it knows both OS.
When you have them on seperate disks you can just use the disk selection at startup (Usually F8) instead of a bootloader
One OS would then boot normally if you don't use the disk selection and the other boots if you select it by intervention
Kaz Baig
@alpox I wanted to put my ubuntu installation and swap on the same drive as windows but it's only 256 GB
I would rather use bootloader tbh - idk why it feels nicer than going into bios
Well if you want a bootloader you may have to do some more configuration but as you say you'd use ubuntu.. I think that one plays a bit nicer with dual boot
256GB is very small for when one of the OS is a windows
Windows is a bitchy huge biest
Kaz Baig
Yeah I didn't have the intention of putting two operating systems on it originally :laughing:
It's just for booting - had a hard drive for storage besides that and added another ssd for games later
Kris Baillargeon
@alpox no I spent two hours trying to start a server that was already running xD
@krisb1220 I was talking about the terminal
Kris Baillargeon
I must have reinstalled Express 20 times
No I know
I was just changing points :P
I'm gonna try to fix that rn tho
If you guys aren't using GitLens on VS you're missing out bois
It add soooooo many useful features
^^^ by far the best feature tho xD
Jason Luboff
ew var :P
Kris Baillargeon
I mean depends
I usually use let
But that's a global variable
Maybe const would be better
Still, I didn't author this code :P
Jason Luboff
I use const as much as possible, followed by let...haven't used var in quite a while
Kris Baillargeon
I just copied it from the book I'm reading xD
Jason Luboff
Fair enough :)
Hi guys :) , maybe i'm in the wrong channel, but is anyone familiar with Magento 1.x, I have a about the DB-Tabel structure especially about the customer-tabels..
Rizwan Syed
Kent Saeteurn

Hello, I was wondering if someone could help me with a php problem? I realize this is not a freecodecamp/javascript question, so if there is a better chatroom to ask my question, then please let me know.

I'm trying to figure out how to capture form data that exists inside a function, and then use it inside another php function. Here's the general structure for my .php file:

function displayFormData( ) { I want to store the form data inside $variables here }

function form( ) { the form is inside this function }

I've tried using $_POST['input-name'], but that hasn't worked. I read about using sessions, but I don't know how to implement that in my case since I'm using two functions there.

Can anyone help me out? Thanks!

Joshua Whalen
I just put my Node.js authentication boilerplate on Github. Check it out.
Feel free to submit a pull request.

@CloudBranch It looks nice but I have some comments about the code:

  • What you now have in a config.js are things which better go in a .env file or are somehow else injected to your app through environment variables for the sake of easier deployment and keeping passwords and sensible data out of source control (The .env should not be pushed to github)

  • Consider using something like https://www.npmjs.com/package/express-flash-2 for pushing messages to the views

  • You have a lot of nesting going on in your routes - especially in register. This makes it hard to read and is not necessary. Especially for the if/else nesting you can apply "return early":

    if (!email || !password || !password2) 
      return res.redirect("/?message=emptyField");
    if (password !== password2) 
      return res.redirect("/?message=passwordsDoNotMatch");
    if (password.length < 6)
      return res.redirect("/?message=passwordLength");
  • Error handling: You currently just log errors instead of handling them correctly.

    bcrypt.hash(newUser.password, salt, (err, hash) => {
                    if (err) throw err;

    Async errors, to enter express error handlers, should not be thrown but pushed to the middleware chain with next(err) so an error handler middleware can chime in and handle it appropriately (Send HTTP error codes - redirect - flash messages... whatever).

                      .then(user => {
                        req.login(user, function (err) {
                          if (err) {
                            return next(err);
                          return res.redirect("/dashboard");
                      .catch(err => console.log(err));

    Here you pass the error from the callback correctly but add a .catch error handler which only logs errors. The catch will probably never enter as you don't re-throw the error but if it would happen anyway (for example in the redirect), the user would know nothing about an error which is only logged.

  • Avoid nesting promises/callbacks. Promises were designed for avoiding deep nesting through callbacks. If you have functions which only take callbacks and do not return promises - make a function which maps the callback to a promise. bcrypt functions return promises if you do not pass a callback so use those instead of the callback versions to keep the nesting out.

function hashPassword(password) {
  return bcrypt.genSalt(10).then(salt => bcrypt.hash(password, salt));

function login(req, user) {
  return new Promise((res, rej) => {
    req.login(user, err => {
      if (err) rej(err);
      else res();
let user;

  email: email
  .then(foundUser => {
    if (foundUser) throw new Error("alreadyInSystem");
    user = new USER({

    return hashPassword(user.password);
  .then(hash => {
    newUser.password = hash;
    return newUser.save();
  .then(user => login(req, user))
  .then(() => res.redirect("/dashboard"))
  .catch(err => next(err));
Ofc. this is nicer when using async/await which you already did use in one of the methods
There is a small error in the code above (newUser should be user) but I cannot edit anymore :D
Edoardo Luppi
What's the correct HTTP response type if I only return an integer number?
Seems application/json is good too.
Kaz Baig
yeah that works
Richard Sithole

Hi there

I have a 10x4 grid of checkboxes (call it x, y) in an html form - I would like to get the coordinates (x, y values) of the checkbox when a user selects one. What data structure can I use to pluck out those coordinates?

I've tried using a Map like so:

 onCheck(e) {
    const productMap = new Map();

    productMap.set('productId', e.path[2].id.split('-').pop());
    productMap.set('productLevelId', e.path[2].id.split('-').pop());

The checkboxes are generated dynamically, so I use a click event listener and pass in the clicked element..

The backend expects from me, a payload like this:

productId: 4,
productLevelId: 1

The above coordinates represent a checked checkbox within the grid.

Any ideas how I can accomplish this?

Kaz Baig
@Sliqric7053 simplest thing to do would be to give each checkbox a data-x and data-y attribute and read those when they're clicked
Richard Sithole
@kbaig thanks man, lemme give it a go.
Oburusule Dunstan

Hello, am using facebook graph-api to get groups one is a member of

FB.api('/me/groups', function (response) {
                var groupList = document.getElementById('groups');
                response.data.forEach(function (group) {
                    var opt = document.createElement("option");
                    opt.value = group.id;
                    opt.innerHTML = group.name;
            }, {
                scope: 'publish_to_groups,publish_actions'

though i get an empty array returned, where could the problem be