These are chat archives for FreeCodeCamp/Help

11th
Feb 2019
psyperl
@psyperl
Feb 11 00:07
@diomed oo cat
kibablu
@kibablu
Feb 11 06:09
@diomed am doing on my computer... I don't see an option on gitter to send images.. so I can attach a screenshoot
BuntyBru
@BuntyBru
Feb 11 06:26

hi guys,
one quick question

i am working as a frontend engineer
but i do not have that depth knowledge of javascript
can anyone suggest some resources for javascript in depth
i have heard about "javascript , the good parts"

is it good ?
i have heard about "You dont know JS " too
kibablu
@kibablu
Feb 11 06:29
@kibablu I got after so many days... It worked but my image is huge... some contents are not displayed.. gotta find another image
Victor Popescu
@VicPopescu
Feb 11 06:40
@BuntyBru You dont know JS is good, but mostly for beginners or if you lack basic concepts. If you want in depth knowledge you should head for advanced books. "Javascript the good parts" is nice, "Eloquent JavaScript: A Modern Introduction to Programming" is not really for beginners, "JavaScript Patterns" by Stoyan Stefanov can be usefull, "High Performance JavaScript" by Nicholas C. Zakas is kinda outdated but still usefull, "JavaScript: The Definitive Guide" by David Flanagan is good reference but not for beginners.
You should do a google search or see some reviews on Goodreads or other blogs, because there are a lot of good but outdated books.
BuntyBru
@BuntyBru
Feb 11 07:22
@VicPopescu
thanks mate
Victor Popescu
@VicPopescu
Feb 11 07:30
@BuntyBru np. have a look at "Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript" by David Herman too, it's well rated
Praveen Saraogi
@saraogipraveen
Feb 11 07:37
can anyone help me adding external JS in angular project created with webpack
Altin Rrahmani
@DevKosov
Feb 11 10:28
anyone familiar with snap.svg ?
Oburusule Dunstan
@alsong
Feb 11 13:09
I have a php webapp project n i have been trying to host it on azure but i am having problems with resources not found error because i use a root directory
TIANLINLI
@TIANLINLI
Feb 11 13:53
请问一下确保你已经将所有HTML元素内嵌在 .container-fluid 之中.
在<div class="container-fluid"></div>中如何弄?
May Kittens Devour Your Soul
@diomed
Feb 11 15:32
@Nirajn2311 I divide with 5 by multiplying by 2
Tim
@Randomkid_gitlab
Feb 11 18:05
Hey all, I need to retrieve data from a websocket, the data displayed is an array of 1's &0's (1,0,0,1,0,1,1), I need to code an application on my pi 3 b+ to retrieve this and log it to consol. any help in connecting and what I need to download for it to work? I'm new to coding so any help welcome! :)
Christopher McCormack
@cmccormack
Feb 11 18:06
:yo:
May Kittens Devour Your Soul
@diomed
Feb 11 18:06
:cat:
Christopher McCormack
@cmccormack
Feb 11 18:07
@Randomkid_gitlab so many questions - what are you using to host the array? is the data on the same server as the client? What language are you using for the client?
May Kittens Devour Your Soul
@diomed
Feb 11 18:07
_ A R _ _ _ _ _ _ _
_ R _ _ _ _ F _ R _
Christopher McCormack
@cmccormack
Feb 11 18:08
M
May Kittens Devour Your Soul
@diomed
Feb 11 18:08
_ A R _ _ _ _ M _ _
_ R _ _ _ _ F _ R _
Jason Luboff
@JLuboff
Feb 11 18:08
9
May Kittens Devour Your Soul
@diomed
Feb 11 18:08
hmmm
@JLuboff I'll say no G
Christopher McCormack
@cmccormack
Feb 11 18:09
Hey using numbers is my gag buddy!
Tim
@Randomkid_gitlab
Feb 11 18:09
the array will be sent via websocket outputting text 1,0,0,1,0,1,1, eventually it will be hosted on local network and can match the ports, the array is to output to the Gpio pins on the pi, i need the pi to connect to the socket, interpret the code and turn on and off the led's depending on the data from the socket, coded in Javascript
Christopher McCormack
@cmccormack
Feb 11 18:09
N
Jason Luboff
@JLuboff
Feb 11 18:09
@cmccormack :shrug:
May Kittens Devour Your Soul
@diomed
Feb 11 18:10
noN binary
@cmccormack best nap ever
Christopher McCormack
@cmccormack
Feb 11 18:11
How much have you actually completed @Randomkid_gitlab ?
lol stoopid cat
Y
May Kittens Devour Your Soul
@diomed
Feb 11 18:11
@Nirajn2311 :arrow_up:
noY
Christopher McCormack
@cmccormack
Feb 11 18:12
D is in Django
May Kittens Devour Your Soul
@diomed
Feb 11 18:12
noDs
Tim
@Randomkid_gitlab
Feb 11 18:13
I have the output array setup with the associated pins, I'm still working on the output signals but I can't test the output without connecting to the websocket/having the pi read the data. I have a websocket setup to send a random set of data so just need it to connect and display the data
Christopher McCormack
@cmccormack
Feb 11 18:14
Are you having issues with the client connecting to the websocket?
C as in musCle
Tim
@Randomkid_gitlab
Feb 11 18:16
I don't know how to get it to connect to the socket and read the data, I'm completely new to network and websockets.
I tried youtube videos and some tutorials but they are all for 'chat' apps or the like, nothing for a seperate device to just read the data and consol log it..
May Kittens Devour Your Soul
@diomed
Feb 11 18:16
_ A R _ _ _ _ M _ _
C R _ _ _ _ F _ R _
Aditya
@ezioda004
Feb 11 18:18
@Randomkid_gitlab Websocket works the same way either way. Just have your server "emit" the socket and have the client side "listen" to that socket.
Christopher McCormack
@cmccormack
Feb 11 18:18
yup not very complex at all, you could probably modify the simple chat app pretty easily to make it work for your purposes
B as in suBtle
May Kittens Devour Your Soul
@diomed
Feb 11 18:20
B A R _ _ _ _ M _ _
C R _ _ _ _ F _ R _
Christopher McCormack
@cmccormack
Feb 11 18:22
T as in lisTen
May Kittens Devour Your Soul
@diomed
Feb 11 18:22
B A R T _ _ _ M _ _
C R _ _ T _ F _ R _
Tim
@Randomkid_gitlab
Feb 11 18:23
ok, so just make an app but have the pi listen to the socket on http://localhost:port?
May Kittens Devour Your Soul
@diomed
Feb 11 18:23
@ezioda004
Christopher McCormack
@cmccormack
Feb 11 18:23
@Randomkid_gitlab only if the app is hosted locally
Jason Luboff
@JLuboff
Feb 11 18:24
i?
Christopher McCormack
@cmccormack
Feb 11 18:24
are you using Node?
May Kittens Devour Your Soul
@diomed
Feb 11 18:24
B A R T _ _ _ M _ _
C R I _ T _ F _ R I
Christopher McCormack
@cmccormack
Feb 11 18:24
W as in Wretch
May Kittens Devour Your Soul
@diomed
Feb 11 18:24
no_W
Tim
@Randomkid_gitlab
Feb 11 18:24
the app will be hosted on a local network, I'm coding as node.js files
Christopher McCormack
@cmccormack
Feb 11 18:24
really?
L
Jason Luboff
@JLuboff
Feb 11 18:25
e
May Kittens Devour Your Soul
@diomed
Feb 11 18:25
B A R T _ L _ M E _
C R I S T _ F _ R I
Christopher McCormack
@cmccormack
Feb 11 18:26
S
May Kittens Devour Your Soul
@diomed
Feb 11 18:26
yes
Christopher McCormack
@cmccormack
Feb 11 18:26
gonna guess
May Kittens Devour Your Soul
@diomed
Feb 11 18:26
go ahead
Christopher McCormack
@cmccormack
Feb 11 18:26
BARTOLOMEU CRISTOFORI
May Kittens Devour Your Soul
@diomed
Feb 11 18:27
sorry. no
:smiling_imp:
off by a letter
Christopher McCormack
@cmccormack
Feb 11 18:29
NUTS
O
May Kittens Devour Your Soul
@diomed
Feb 11 18:30
yup
it's all O
:yum:
Christopher McCormack
@cmccormack
Feb 11 18:30
Ooooo
May Kittens Devour Your Soul
@diomed
Feb 11 18:30
coz he was Italian :)
Christopher McCormack
@cmccormack
Feb 11 18:30
BARTOLOMEO CRISTOFORI
I don't know much Italian
May Kittens Devour Your Soul
@diomed
Feb 11 18:30
do you know who he was
why he (in)famous
(un)famous
Christopher McCormack
@cmccormack
Feb 11 18:31
@Randomkid_gitlab I've not coded any websocket stuff yet but if you are hosting it locally then your url looks OK to me, you should start the "server" then try to connect from the client
Did he also sail the ocean, blue?
May Kittens Devour Your Soul
@diomed
Feb 11 18:32
no
Tim
@Randomkid_gitlab
Feb 11 18:33
ok, I'll try that, thanks guys, I'll stick around and let you know how I get on!
May Kittens Devour Your Soul
@diomed
Feb 11 18:33
he made music instruments
Christopher McCormack
@cmccormack
Feb 11 18:33
@Randomkid_gitlab good luck!
Tim
@Randomkid_gitlab
Feb 11 18:34
thanks!
May Kittens Devour Your Soul
@diomed
Feb 11 18:34
creator of first piano
Christopher McCormack
@cmccormack
Feb 11 18:38
@diomed they should call it the Cristofori instead so trivia would be easier
May Kittens Devour Your Soul
@diomed
Feb 11 18:42
lOl
@cmccormack
_ _ _ _ L _ _ _ _ _ _
Jason Luboff
@JLuboff
Feb 11 18:49
Potato?
May Kittens Devour Your Soul
@diomed
Feb 11 18:51
I kinda accidentally messaged author of book Martian on facebook. lol
Christopher McCormack
@cmccormack
Feb 11 18:53
Andy Weir?
awesome
did he respond?
@diomed M as in soleMn
May Kittens Devour Your Soul
@diomed
Feb 11 18:55
noM noM noM
Christopher McCormack
@cmccormack
Feb 11 18:55
C
May Kittens Devour Your Soul
@diomed
Feb 11 18:56
_ _ _ _ L _ C _ _ _ _
Christopher McCormack
@cmccormack
Feb 11 18:57
T
May Kittens Devour Your Soul
@diomed
Feb 11 18:58
_ _ _ _ L _ C _ T _ _
Christopher McCormack
@cmccormack
Feb 11 18:59
R
May Kittens Devour Your Soul
@diomed
Feb 11 18:59
_ _ _ _ L _ C _ T _ R
can guess vowels now [only one normal letter remained]
Christopher McCormack
@cmccormack
Feb 11 19:01
O
May Kittens Devour Your Soul
@diomed
Feb 11 19:01
_ _ _ O L O C _ T O R
{{looks like it aint velociraptor}} :D
Christopher McCormack
@cmccormack
Feb 11 19:03
A
May Kittens Devour Your Soul
@diomed
Feb 11 19:04
_ _ _ O L O C A T O R
Christopher McCormack
@cmccormack
Feb 11 19:05
I?
May Kittens Devour Your Soul
@diomed
Feb 11 19:05
I _ _ O L O C A T O R
Christopher McCormack
@cmccormack
Feb 11 19:06
D?
May Kittens Devour Your Soul
@diomed
Feb 11 19:06
I D _ O L O C A T O R
Christopher McCormack
@cmccormack
Feb 11 19:06
IDEOLOCATOR
May Kittens Devour Your Soul
@diomed
Feb 11 19:07
:congratulations:
correct, indeed :)
Christopher McCormack
@cmccormack
Feb 11 19:07
that's a real thing?
May Kittens Devour Your Soul
@diomed
Feb 11 19:08
The 'you are here' arrow on maps
Christopher McCormack
@cmccormack
Feb 11 19:08
nuh uh
I've never seen that name for those
May Kittens Devour Your Soul
@diomed
Feb 11 19:08
looks like it should have been separated
as in IDEO LOCATOR
Christopher McCormack
@cmccormack
Feb 11 19:08
still though
May Kittens Devour Your Soul
@diomed
Feb 11 19:08
must mosey
Christopher McCormack
@cmccormack
Feb 11 19:08
and I used to play with google maps
well nice job @diomed two stumpers in a row
psyperl
@psyperl
Feb 11 19:16
but i bet you haven't heard what 'ideo locator nuance' is
Christopher McCormack
@cmccormack
Feb 11 19:18
all sounds like latin to me
psyperl
@psyperl
Feb 11 19:18
it's the border color of the 'you are here' arrows on maps ( i just made the term up )
Christopher McCormack
@cmccormack
Feb 11 19:19
I think it's OK to make up words if you are adding on to another word @diomed made up :)
May Kittens Devour Your Soul
@diomed
Feb 11 19:21
@cmccormack I did not make it up
what do you think that thingie is called, then?
psyperl
@psyperl
Feb 11 19:22
wew does it really need a name though lol
May Kittens Devour Your Soul
@diomed
Feb 11 19:23
everything needs a name
how else?
psyperl
@psyperl
Feb 11 19:24
well let's make names for each of the mouse pointer on mac, windows and linux :D
May Kittens Devour Your Soul
@diomed
Feb 11 19:25
pretty sure there already are names for them
Christopher McCormack
@cmccormack
Feb 11 19:38
I would call it a pin
or a marker
Ashraf Patel
@AshrafPatel
Feb 11 19:43
can anyone help me with a code on FCC
// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
  if (value == "") {
    delete collection[id][prop];
  }
  else if (prop != "tracks" && value != "") {
    collection[id][prop] = value;
  }
  else if(prop == "tracks") {
    if (value != "" && collection.hasOwnProperty(prop)) {
      collection[id][prop].push(value);
    }
    else {
      collection[id][prop] = [value];
    }
  }
  return collection;
}

// Alter values below to test your code
 updateRecords(2468, "tracks", "Free");
this is the challenge Basic JavaScript: Record Collection
image.png
Tim
@Randomkid_gitlab
Feb 11 19:52
my code keeps giving me syntex error: unexpected end of input... any ideas?
var app = express();
var socket = require('socket.io');
varserver.app.listen(4295,function(){
consol.log('listening to data on port 4295');

//socket setup
var io = socket(server);//do I need to set up a server to listen to the socket?

io.on('connection', function ()
{ console.log('made connection')
Christopher McCormack
@cmccormack
Feb 11 19:54
@AshrafPatel in your first else if you don't need value != "" as you already have that condition in your if statement, fyi
same with your second else if
Ashraf Patel
@AshrafPatel
Feb 11 19:55
same result though :(
// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
  if (value == "") {
    delete collection[id][prop];
  }
  else if (prop != "tracks") {
    collection[id][prop] = value;
  }
  else if(prop == "tracks") {
    if (collection.hasOwnProperty(prop)) {
      collection[id][prop].push(value);
    }
    else {
      collection[id][prop] = [];
      collection[id][prop].push(value);
    }
  }
  return collection;
}

// Alter values below to test your code
  updateRecords(5439, "artist", "ABBA")
Christopher McCormack
@cmccormack
Feb 11 19:56
@AshrafPatel should if (value != "" && collection.hasOwnProperty(prop)) { be if (value != "" && collection[id].hasOwnProperty(prop)) {?
@AshrafPatel yes I know I was just helping you to remove redundancy
@Randomkid_gitlab backticks go on their own line. You can edit previous posts as well
Ashraf Patel
@AshrafPatel
Feb 11 19:58
I am still stuck it keeps saying the 5th goal is not completed
Christopher McCormack
@cmccormack
Feb 11 19:58
@AshrafPatel can you put your code in a codepen so you can share without filling the channel?
Tim
@Randomkid_gitlab
Feb 11 19:58
backticks? ';'?
Christopher McCormack
@cmccormack
Feb 11 19:59
@Randomkid_gitlab yes like you had it but on their own line
```
code
```
Tim
@Randomkid_gitlab
Feb 11 19:59
oh hahaha NOOB
Christopher McCormack
@cmccormack
Feb 11 20:00
@AshrafPatel :point_up: February 11, 2019 12:56 PM
did you see that?
Niraj Nandish
@Nirajn2311
Feb 11 20:01
shit missed todays hangman
Tim
@Randomkid_gitlab
Feb 11 20:01
I'm not sure on the error as I don't have code on line 15 but its showing unexpected end of input on line 15 and points to ;
Ashraf Patel
@AshrafPatel
Feb 11 20:02
@cmccormack thank you
Christopher McCormack
@cmccormack
Feb 11 20:02
@AshrafPatel :thumbsup:
@Randomkid_gitlab close your function
io.on('connection', function ()
{ console.log('made connection')
This syntax is pretty widely used:
io.on('connection', function() {
    console.log('made connection');
}
opening braces on the next line can lead to errors in some circumstances in JavaScript
Tim
@Randomkid_gitlab
Feb 11 20:08
ok, thanks :)
Tim
@Randomkid_gitlab
Feb 11 20:14
io.on('connection', function () 
    {console.log('made connection');
});
Christopher McCormack
@cmccormack
Feb 11 20:15
ah yes sorry
lots of missing closing braces :)
Tim
@Randomkid_gitlab
Feb 11 20:16
the last line's ; gives me unexpected end of input with or without...
Christopher McCormack
@cmccormack
Feb 11 20:17
@Randomkid_gitlab you also have to close your server block, but what is varserver?
Tim
@Randomkid_gitlab
Feb 11 20:18
if i place it as var server.log then it issues me with a error the . is unexpected..
I think my Pi hates me
Christopher McCormack
@cmccormack
Feb 11 20:20
@Randomkid_gitlab I think you may just not be closing your blocks properly
can you repost what you have? You may want to paste it into something like repl.it or codepen or jsfiddle so you can update and we can refresh and see your changes without spamming this channel
those tools are also pretty good at catching errors so multiple benefits
Tim
@Randomkid_gitlab
Feb 11 20:24
just signing up with codepen so can share the project
Tim
@Randomkid_gitlab
Feb 11 20:29
how do I share the codepen linkO.o
May Kittens Devour Your Soul
@diomed
Feb 11 20:30
copy it from navbar and paste here. lol
make sure u hit save before
oh lol didnt work as I hadnt saved
I've been starring at my screen toooooo long.
on the plus side my websocket is sending the correct data
Christopher McCormack
@cmccormack
Feb 11 20:38
@Randomkid_gitlab you still haven't closed your server block
var server = app.listen(4295, function()    {
  console.log('listening to data on port 4295');
}) // <===
Tim
@Randomkid_gitlab
Feb 11 20:43
ty updated, seems working but now pi is telling me express is not defined?
Christopher McCormack
@cmccormack
Feb 11 20:44
you have to import it, did you ever do an npm init in your project directory?
if not I think just doing npm install -S express should create a new package.json file
Tim
@Randomkid_gitlab
Feb 11 20:45
not init but Installed express in the same dir as the .js file
Christopher McCormack
@cmccormack
Feb 11 20:45
but you definitely need to actually have the packages installed to use them
how did you install it?
oh
you didn't require it
Tim
@Randomkid_gitlab
Feb 11 20:45
npm express install
Christopher McCormack
@cmccormack
Feb 11 20:45
var app = require('express')();
that doesn't look like the proper syntax
try npm install express
Tim
@Randomkid_gitlab
Feb 11 20:48
yep it installed, now giving me issues on the varserver.. must have mistyped somewhere.
just cut the code down, show in link, works fine now but I need it to retieve the information shown..