These are chat archives for FreeCodeCamp/Help

14th
Sep 2017
Naveen B
@naveen62
Sep 14 2017 01:17
{
_id: 3424324243,
poll: 'test',
option: [
{
text: a,
vote: 0
},
{
text: 'b',
vote: 0
}
]
how can i increment value specified vote using mongoose
Kyle Holm
@thekholm80
Sep 14 2017 01:17
switch to mongo and it's easy lol
but sorry, i never used mongoose
Naveen B
@naveen62
Sep 14 2017 01:18
how can i do it with mongo @thekholm80
Kyle Holm
@thekholm80
Sep 14 2017 01:18
@naveen62 https://gitter.im/FreeCodeCamp/HelpBackEnd there are folks there that use mongoose
in mongo i'd use collection.findOneAndUpdate() along with $inc if i remember right
Albert Cardona II
@daddycardona
Sep 14 2017 02:18
function uniteUnique(arr) {
return Array.prototype.concat.apply([], arguments)
.reduce((a, e, i, arr) => {
if(arr.indexOf(e) === i) a.push(e);
return a;
}, []);
}
@korzo That confuses me even more you added concat and apply and a a array that was like what?
korzo
@korzo
Sep 14 2017 02:22
@daddycardona It's shorter version of your code. It concat all arguments in new array
Albert Cardona II
@daddycardona
Sep 14 2017 02:22
I have to break it down lol because I never used return Array.prototype before
Gersho
@Gersho
Sep 14 2017 02:23
it only means it's an array
Albert Cardona II
@daddycardona
Sep 14 2017 02:24
I don't even know about .apply()yet I think it is time I start paying for treehouse because I need an indept course fcc don't give me enough and these mdn sections are like you should know something or understand enough to get this but I am like what?
Gersho
@Gersho
Sep 14 2017 02:24
but yeah chained stuff like that can get hard to read (concat reduce filter apply map etc...)
if i remember correctly you have zeal ?
Albert Cardona II
@daddycardona
Sep 14 2017 02:25
tell me about it, @Gersho and yes I do
that is what I am opening now but zeal is basically all the mdn sites in an app
Gersho
@Gersho
Sep 14 2017 02:25
well search for javascript:array. (don't forget the dot at the end) and you'll see a nice list of every array. function
an app with instant keyword search, it's way better
Albert Cardona II
@daddycardona
Sep 14 2017 02:27
ok
korzo
@korzo
Sep 14 2017 02:29
@daddycardona I use apply because it take array of parameters
so instead of concat(a, b, c) you can use Array.prototype.concat.apply and pass arguments object (array of arrays) to concat
Albert Cardona II
@daddycardona
Sep 14 2017 02:31
so that basically did the what I did for the arguments vs going through them all with a loop?
Gersho
@Gersho
Sep 14 2017 02:32
concat and reduce itterate too, so depending on your semantics you could call that loops too
korzo
@korzo
Sep 14 2017 02:33
@daddycardona yes, it's substitute for looping arguments object and pushing values to new array as you did
Albert Cardona II
@daddycardona
Sep 14 2017 02:33
so basically I could of used
var sum = Array.prototype.concat.apply([], arguments);
Gersho
@Gersho
Sep 14 2017 02:34
btw the way you use the arguments variable to set your apply, wouldn't that break your code if a second argument is passed along with arr ?
korzo
@korzo
Sep 14 2017 02:34
@daddycardona Yes
Albert Cardona II
@daddycardona
Sep 14 2017 02:34
son of a gun I don't know how you remember all this I forget half of this, I did this bullshit loop for nothing lol
Gersho
@Gersho
Sep 14 2017 02:35
there's many methods to achieve a result
korzo
@korzo
Sep 14 2017 02:35
And you can chain reduce or filter and dont have to assign to sum
Albert Cardona II
@daddycardona
Sep 14 2017 02:36
Yeah I see but I like assigning to something so I can console.log() it and see if I have acheived the result I was looking for lol
korzo
@korzo
Sep 14 2017 02:36
@daddycardona you don't have to remember it. It's important to understand concept
Albert Cardona II
@daddycardona
Sep 14 2017 02:38
I do but sometimes the concept confused me, like for real, I would have never understood this concept of checking this with reduce because that was like a chinese version of javascript to me or even the filter method I found. It was not even for this project but I saw it and used it and it worked for this project and I was like wow I can really search for stuff I don't quite understand
Gersho
@Gersho
Sep 14 2017 02:38
...codewar just refreshed on me, sending my work to oblivion
Albert Cardona II
@daddycardona
Sep 14 2017 02:39
If I was to used this with a loop I would have never achieved what I was trying to get @korzo and @Gersho
korzo
@korzo
Sep 14 2017 02:40
@daddycardona that's how I learned to code. I was reading others people code and tried to understand every line of it.
It took me like month to go trough first script as I knew nothing about javascript :)
Albert Cardona II
@daddycardona
Sep 14 2017 02:40
this is why I think I should use treehouse because I need something and someone to help me understand these reduce and filtered functions better I start to get it and then the condcept is like okay I get it but not for this type of project
@korzo that was how i started to learn Java but then I have not used it since class like 5 years ago
@Gersho I hate that, it happened to me many times on fcc and that is why I save most the projects now
I just do it on my computer
Gersho
@Gersho
Sep 14 2017 02:42
i spend most of my time on zeal, rechecking stuff 75 times, i know how to use stuff, but i'll still need to check syntax almost everytime
@daddycardona i often do that too, but for the codewars one it's annoying to setup
Albert Cardona II
@daddycardona
Sep 14 2017 02:43
mine is not the syntax its the concept and how to use reduce or a method to achieve what I want to achieve it to do. I start getting it then I am like wth did i just try doing because i failed lol
Gersho
@Gersho
Sep 14 2017 02:43
i'm lazy
korzo
@korzo
Sep 14 2017 02:43
@Gersho That's why I use IDE :)
I don't remember exact function names or parameters for PHP
Albert Cardona II
@daddycardona
Sep 14 2017 02:43
LOL
PHP another pain in my behind lol
this is what I do for javascript I make a folder for one copy and past it change the name of it and then the code on the inside so I always have a main.js and a index.html in a folder on my desktop :)
Gersho
@Gersho
Sep 14 2017 02:44
@korzo i use atom, it autocomplete a bit but not all, for exemple if i use filter it will autocomplete filter() but not the arguments
Albert Cardona II
@daddycardona
Sep 14 2017 02:45
I use vs code I like it more than sublime becaue I don't get the annoying do you want to purchase it becaues it is 100% free :)
Gersho
@Gersho
Sep 14 2017 02:45
@daddycardona i'll try that
Albert Cardona II
@daddycardona
Sep 14 2017 02:45
yeah you don't have anything to really setup I was lazy at first too but was like dammit dammit lol
Gersho
@Gersho
Sep 14 2017 02:45
i installed vs but didn't really use it (i planned to use it for C# but i dropped that)
Albert Cardona II
@daddycardona
Sep 14 2017 02:46
oh vs code is the lightweight version of vs
korzo
@korzo
Sep 14 2017 02:46
@Gersho I use Vim for tinkering and PHPStorm for bigger thinks
I tried Atom and VS Code and it has acceptable autosuggestion with hep of some plugins.
Albert Cardona II
@daddycardona
Sep 14 2017 02:46
I had vs but I have a small hard drive so I was like no thank you :)
Gersho
@Gersho
Sep 14 2017 02:47
i already have a folder with a copy of the mid/adv algo so i could look at it when people discuss them ^^ guess i'll do that in that folder
Albert Cardona II
@daddycardona
Sep 14 2017 02:47
You have a mac @korzo and @Gersho
Gersho
@Gersho
Sep 14 2017 02:47
linux
korzo
@korzo
Sep 14 2017 02:47
Windows
Albert Cardona II
@daddycardona
Sep 14 2017 02:48
Oh I don't know why I can't stand apple or linux win 10 just gets better
korzo
@korzo
Sep 14 2017 02:48
I like Linux, but I'm to lazy to switch :)
Albert Cardona II
@daddycardona
Sep 14 2017 02:48
I have had my computer for almost 2 years and only had one bad build that needed to get kicked off but have not factory restore it yet so I am good :)
Gersho
@Gersho
Sep 14 2017 02:49
i had windows, before, i was waiting for 10 (since it was supposed to be the good one, following the rule of 2)
Albert Cardona II
@daddycardona
Sep 14 2017 02:49
my microsoft nokia phone was one of the best phones I have ever had except I couldn't play COC on it lol
Gersho
@Gersho
Sep 14 2017 02:50
but i want control of my computer, so no thanks win10
Albert Cardona II
@daddycardona
Sep 14 2017 02:50
what do you mean by control of your computer?
Gersho
@Gersho
Sep 14 2017 02:50
it does too much stuff without asking you
like installing itself for starters
Albert Cardona II
@daddycardona
Sep 14 2017 02:50
I turned off a lot of things
Gersho
@Gersho
Sep 14 2017 02:50
you shouldn't HAVE TO turn off things
Albert Cardona II
@daddycardona
Sep 14 2017 02:50
I don't mind updates
Gersho
@Gersho
Sep 14 2017 02:51
but i have to admit part of my win10 hate is older than that, it's more of a last drop
Albert Cardona II
@daddycardona
Sep 14 2017 02:51
I don't mind because I really do love it I beta tested it and besides the 3rd build I think it was I have not had a problem LOL
korzo
@korzo
Sep 14 2017 02:52
@Gersho I have win7 installed in 2011 and a lot of apps, so I can't imagine to reinstall it all :)
If it crash, I will go with Linux then
Gersho
@Gersho
Sep 14 2017 02:53
i dual boot win7 actually, only for games (it's offline)
Albert Cardona II
@daddycardona
Sep 14 2017 02:53
let me rephrased that, the only problem i have is that sometimes my blutooth mouse does not work for it but that might be because I have dropped the couple of times thanks the kids
Gersho
@Gersho
Sep 14 2017 02:53
yeah sure blame the kids :P
Albert Cardona II
@daddycardona
Sep 14 2017 02:54
LOL the first time was my fault lol
Gersho
@Gersho
Sep 14 2017 02:54
i prefer wired (both mouse and kb)
korzo
@korzo
Sep 14 2017 02:54
I will go also With dual boot as some apps have no alternative on Linux
But I'm to afraid to start in now
Albert Cardona II
@daddycardona
Sep 14 2017 02:54
me too but since my monitor is my 55 inch screen wireless works better lol
Gersho
@Gersho
Sep 14 2017 02:55
depends on your usage i guess, browsing and usual media stuff is out of the box
i dual screen a 4/3 (12801024) and the laptop's actual screen (16/9 1920 1080)
oh right markdown
the 4/3 one is my main btw
Albert Cardona II
@daddycardona
Sep 14 2017 02:56
nope i have 4k tv lol
my laptop I use when I go to starbucks or the library
Kyle Holm
@thekholm80
Sep 14 2017 02:57
you so fancy
:P
Gersho
@Gersho
Sep 14 2017 02:57

I will go also With dual boot as some apps have no alternative on Linux
But I'm to afraid to start in now

start by making a list of what has no alternative (mostly games and pro specific tools)

Albert Cardona II
@daddycardona
Sep 14 2017 02:58
but it is connected to the tv 99% of the time
I Love microsoft office over all the alternatives out there especially google docs
Kyle Holm
@thekholm80
Sep 14 2017 02:59
lol
Albert Cardona II
@daddycardona
Sep 14 2017 02:59
lmao no I sit on my bed and relax and this is exactly why I don't have a deske like that lol
Albert Cardona II
@daddycardona
Sep 14 2017 03:04
LOL thats you lol
when you had hair lmao
Gersho
@Gersho
Sep 14 2017 03:05
hackerman
korzo
@korzo
Sep 14 2017 03:05
@thekholm80 Lol, that's how I started with Atari 800
Kyle Holm
@thekholm80
Sep 14 2017 03:05
mine was a commodore 64
Albert Cardona II
@daddycardona
Sep 14 2017 03:05
2600 baby :)
Kyle Holm
@thekholm80
Sep 14 2017 03:05
but that looks like a vic 20
Albert Cardona II
@daddycardona
Sep 14 2017 03:05
LOL
no printscreen lmao
Gersho
@Gersho
Sep 14 2017 03:06
i didn't really use it much, but we had one of those amstrad with the floppy reader in the keyboard
Kyle Holm
@thekholm80
Sep 14 2017 03:06
oh, snazzy
Gersho
@Gersho
Sep 14 2017 03:07
for a mock photo it sure capture the spirit of back then
Gersho
@Gersho
Sep 14 2017 03:23

@daddycardona to your little setup, i added

var logcount = 0;
function consolelog(info,data){
  $("#output").append(logcount+" "+info +": "+ data);
  logcount +=1;
}

so that i can "console log" in big text in the main body of a webpage instead of the console window

Albert Cardona II
@daddycardona
Sep 14 2017 03:24
Nice the only reason i do console.log() is because it shows the errors
and the line codes so I try not to do that LOL
:wink:
Or I got tired of trying to do that I mean @Gersho
Gersho
@Gersho
Sep 14 2017 03:26
oh yeah, the errors
it remind me of the fairy in the n64 zelda
syntax error, expected a ;, syntax error, syntax error
Albert Cardona II
@daddycardona
Sep 14 2017 03:28
lmao
that is my favorite game ever and BOTW is like equally there ;)
Gersho
@Gersho
Sep 14 2017 03:34

oh, we were talking about apply earlier, i have an issue

  function validSolution(board){
    blockTest.apply(undefined,board);

    function blockTest(arr){
      consolelog("arr",arr);


    }//end blockTest
  }//end validSolution

board is a 2D array, but blockTest() is called only once, for board[0]

Albert Cardona II
@daddycardona
Sep 14 2017 03:36
oh wow that is cool what is this for?
I like how you put end blocktest I got out of doing that
Albert Cardona II
@daddycardona
Sep 14 2017 03:37
dam your cood :)
good:)
Gersho
@Gersho
Sep 14 2017 03:38
i don't have any code so far ^^
Albert Cardona II
@daddycardona
Sep 14 2017 03:39
well I see what you are trying to do there now it makes some sense to me but I don't think like this wish I was at that level already
Gersho
@Gersho
Sep 14 2017 03:39
i love sudoku
Albert Cardona II
@daddycardona
Sep 14 2017 03:40
I use to have the app on my iphone 4 :)
Gersho
@Gersho
Sep 14 2017 03:40
i stay away from challenges that are too math related, because i'm more often stuck on the math issue rather than a code one
Albert Cardona II
@daddycardona
Sep 14 2017 03:43
I don't worry about math issues because I know the concepts of them and know it is like putting it in the right order lol
Gersho
@Gersho
Sep 14 2017 03:44
my brain stopped liking math when it stopped making sense
Ellyria
@Ellyria
Sep 14 2017 03:46
Someone shared this silly video with me the other day that will make you appreciate math even more: https://www.destroyallsoftware.com/talks/wat
Albert Cardona II
@daddycardona
Sep 14 2017 03:47
gn
Gersho
@Gersho
Sep 14 2017 03:47
gn
Darren
@DarrenfJ
Sep 14 2017 04:27
evening fCC
Gersho
@Gersho
Sep 14 2017 04:30
hi ^^
i'm trying to solve a 4kyu JS kata
Darren
@DarrenfJ
Sep 14 2017 04:34
cooool
i did a bunch (only 7 and 6's) was thinking of plunking away at 1 0r 2 of 'em tonight
also thanks @Ellyria for the wat... say that when i first started but it's actually weirder now to listen to it again
CamperBot
@camperbot
Sep 14 2017 04:35
darrenfj sends brownie points to @ellyria :sparkles: :thumbsup: :sparkles:
:cookie: 508 | @ellyria |http://www.freecodecamp.com/ellyria
Gersho
@Gersho
Sep 14 2017 04:36
the video was cool, but the laughts are really awkward
Darren
@DarrenfJ
Sep 14 2017 04:36
i love it when people laugh a bit awkwardly :D
Gersho
@Gersho
Sep 14 2017 04:37
you must love american funny shows then
Darren
@DarrenfJ
Sep 14 2017 04:37
weirdly enough i'm more of a fan of British humour tbh
Gersho
@Gersho
Sep 14 2017 04:38
i don't know much of it apart from mr bean
monthy python is english right ?
Kyle Holm
@thekholm80
Sep 14 2017 04:39
my favorite british show is The IT Crowd
so funny
Darren
@DarrenfJ
Sep 14 2017 04:40
yah Python is english
the Office (the BBC original)
extras (also by gervais)
Kyle Holm
@thekholm80
Sep 14 2017 04:41
Coupling was hilarious too
Darren
@DarrenfJ
Sep 14 2017 04:41
i haven't seen that one i don't think
Kyle Holm
@thekholm80
Sep 14 2017 04:43
I think it's a bit older, maybe from the late 90s or early 2000s
so freaking funny though
Darren
@DarrenfJ
Sep 14 2017 04:48
gotta check it out... the gf's parents are from england so there's usually something they recommend...
Kyle Holm
@thekholm80
Sep 14 2017 04:49
I think Coupling and The IT Crowd are both in my top-5 most favorite shows ever
Gersho
@Gersho
Sep 14 2017 04:50
@DarrenfJ as long as they don't recommend food
Darren
@DarrenfJ
Sep 14 2017 04:51
ha!
Gersho
@Gersho
Sep 14 2017 04:57

In Heaven: the cooks are French,
the policemen are English,
the mechanics are German,
the lovers are Italian
and the bankers are Swiss.

In Hell: the cooks are English,
the policemen are German,
the mechanics are French,
the lovers are Swiss
and the bankers are Italian.

Darren
@DarrenfJ
Sep 14 2017 04:57
:D
Kyle Kinzalow
@KyleKinz
Sep 14 2017 05:21
anyone here familiar with flexbox? I need to take a 4 item row and turn it into 2 rows of 2 items each
Darren
@DarrenfJ
Sep 14 2017 05:21
@KyleKinz not enough, no.. took a tutorial on it a few months back then have done nothing with it since
Darren
@DarrenfJ
Sep 14 2017 05:35
@Gersho hows the kyu coming along?
i'm in a 6...
Gersho
@Gersho
Sep 14 2017 05:40
funny you ask that, i finished it a minute ago
i'm refactoring and removing the 417 console.log
i spent more time trying to get the data how i wanted it
Darren
@DarrenfJ
Sep 14 2017 05:42
isn't that always the way :)
Gersho
@Gersho
Sep 14 2017 05:44
\o/ 5kyu lvl up
Darren
@DarrenfJ
Sep 14 2017 05:44
schweet
:D
Gersho
@Gersho
Sep 14 2017 05:44
Overall:5 kyu / 1%
JavaScript:6 kyu / 42%
Python:6 kyu / 12%
https://www.codewars.com/kata/sudoku-solution-validator
that's the one i made, the part that gave me trouble is checking the 3*3 squares
Manish Giri
@Manish-Giri
Sep 14 2017 05:50
@DarrenfJ :wave:
Darren
@DarrenfJ
Sep 14 2017 05:51
@Manish-Giri :D
@Gersho will have to check it out
brb puppies are licking my toes aka walk time
Jill Lee
@jill-lee
Sep 14 2017 06:24
@DarrenfJ And sometimes we just need to rest hahaha
BTW I need help with github so I need to link a page on git to make the other menu work on the nav bar. Do I need to create a new repo for that or I can add on the existing repo?
Darren
@DarrenfJ
Sep 14 2017 06:25
i def need to rest lol! I'm stuck on what should be a pretty easy algo...
are you hosting on GitHub? if so I think any repo can have subfolders and appear like a local set of pages, img's etc.. (I'm assuming github allows you to store img's as well, but if not you can still external link them)
Jill Lee
@jill-lee
Sep 14 2017 06:29
@DarrenfJ ok I'll try that thanks :)
CamperBot
@camperbot
Sep 14 2017 06:29
phoenix-burn sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2022 | @darrenfj |http://www.freecodecamp.com/darrenfj
Gersho
@Gersho
Sep 14 2017 06:31
@DarrenfJ i went for "a last easy one" before sleeping, and now i'm knee deep in the python doc
but i produce my best code between 21h00 and 3h00
Darren
@DarrenfJ
Sep 14 2017 06:34
i would say same here 'cept lately...
heh
Gersho
@Gersho
Sep 14 2017 06:36
i try to 50/50 js and python, but i don't know nearly enough function
Darren
@DarrenfJ
Sep 14 2017 06:36
i was going to do same with ruby but the 8th and 7th kyu in Ruby are so like js that i haven't bothered..
Gersho
@Gersho
Sep 14 2017 06:37
oh that's why i skipped 7-8 kyu, they're just boring, reading the doc is more usefull
lol, i'm looking at the others answer, and while in js i'm surprised at their logic and elegance, for python i'm like "oh, such a thing was possible ?"
mine
digits[i]+digits[i+1]+digits[i+2]+digits[i+3]+digits[i+4]
theirs
digits[i:i+5]
Darren
@DarrenfJ
Sep 14 2017 06:40
yah.. i need to learn to push for 1 liners ;)
but for me i'm trying the easy and seeing how quickly i can cobble together a solution...
Gersho
@Gersho
Sep 14 2017 06:41
i pulled some decent one on some of the kata, but most of the time my code is more "human readable"
Darren
@DarrenfJ
Sep 14 2017 06:41
i use way too many really obvious and slow for loops
Gersho
@Gersho
Sep 14 2017 06:41
and since i code while thinking what i would do as a human with a pen and paper, yeah i have that kind of code too :p
Gersho
@Gersho
Sep 14 2017 06:50
i was trying to have a look at the solution you've done for the kata we both did, but at this point i'm just staring at the screen, guess i'll go sleep :D gn
Darren
@DarrenfJ
Sep 14 2017 06:52
oh gawd don't take a look.. it's sad ;)
Jake
@JakeDVirus
Sep 14 2017 06:53
it is correct to use this statement $(cloneList).appendTo() where cloneList is an array of elements. isn't it?
Darren
@DarrenfJ
Sep 14 2017 06:53
thanks @Gersho and @thekholm80 @Manish-Giri for hanging
CamperBot
@camperbot
Sep 14 2017 06:53
darrenfj sends brownie points to @gersho and @thekholm80 and @manish-giri :sparkles: :thumbsup: :sparkles:
:cookie: 426 | @gersho |http://www.freecodecamp.com/gersho
:star2: 1465 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 6536 | @manish-giri |http://www.freecodecamp.com/manish-giri
Darren
@DarrenfJ
Sep 14 2017 06:53
i'm probably off for bed too
Saber I.
@icybears
Sep 14 2017 08:34
to format ur code wrap it around ```
no
wrap it around 3 `
not one
Like this
not like this
``` in the beginning
and ``` in the end
Naveen B
@naveen62
Sep 14 2017 08:39
tried not working
Saber I.
@icybears
Sep 14 2017 08:40
yup because u need to have those ``` in their own line
Naveen B
@naveen62
Sep 14 2017 08:44
app.post('/polls/:id', function(req, res) {
Poll.findOne({_id: req.params.id}, function(err, polls) {
if(err) {
console.log(err)
} else {
var option = polls.option
for(var i=0; i<(polls.option).length; i++) {
if(polls.option[i].text === req.body.choice) {
console.log("testing ", option[i].text);
polls.update({$inc: {
"option[i].vote": 1
}})
console.log('testing 2', option[i].vote)
}
}
polls.save();
console.log(polls)
res.redirect('/')
}
})
})
console =
server started
testing vue
testing 2 0
{ _id: 59b9a5b3b15d47113ef5f3e4,
poll: 'best js framework',
__v: 0,
option:
[ { text: 'react', vote: 0, _id: 59b9a5b3b15d47113ef5f3e7 },
{ text: 'vue', vote: 0, _id: 59b9a5b3b15d47113ef5f3e6 },
{ text: 'angular', vote: 0, _id: 59b9a5b3b15d47113ef5f3e5 } ] }
Why is vote not incremented where text is vue
worked @icybears
Stephen James
@sjames1958gm
Sep 14 2017 10:22
@naveen62 Your update call has the hardcoded string of i and wont use the variable i
Naveen B
@naveen62
Sep 14 2017 10:24
So how can I do this @sjames1958gm
irfanmayo0786
@irfanmayo0786
Sep 14 2017 10:25
@naveen62 it's node.js code?
Stephen James
@sjames1958gm
Sep 14 2017 10:25
@naveen62 you can do a template string
`option[${i}].vote`
Naveen B
@naveen62
Sep 14 2017 10:25
Yep @irfanmayo0786
Why I need to use $
Stephen James
@sjames1958gm
Sep 14 2017 10:29
That is how template strings work the ${} identifies the embedded code
Naveen B
@naveen62
Sep 14 2017 10:44
@sjames1958gm getting error Unexpected template string
Pethaf
@Pethaf
Sep 14 2017 10:50
Ok. I feel like a bastard.
I just signed up for a week of free udacity front end web developer nanodegree.
I used a gift visa card number.
Saber I.
@icybears
Sep 14 2017 12:15
how does these nanodegrees work ?
I haven't used udaity/edx stuff yet
is it even worth it ?
plus if you have a tight schedule, how does it work ? @Pethaf
Michael Oliver
@Michael3353
Sep 14 2017 12:17

Hi all. A request, that at moment is above my ability. But id appreciate the help. Its for my website. cagefs/tmp is killing my webspace or drive space, What I need is a script made to delete the tmp files periodically. Is there anyone around who would know how to do this? Ive had a look around my self, but the job looks too complicated for me at this present time. Im still on basic JS. php obviously different lang. So. cronjob. script made, to periodically (1x per 24hrs)or something, to maximise webdisk space.

Is this asking much or?

Pethaf
@Pethaf
Sep 14 2017 12:18
@icybears I took two courses on coursera.
For the price, they were very worth it.
Saber I.
@icybears
Sep 14 2017 12:18
but how lengthy ?
Pethaf
@Pethaf
Sep 14 2017 12:18
I spent maybe a week on each.
But I guess it all varies depending on the course.
Saber I.
@icybears
Sep 14 2017 12:18
plus I don't get those 2hours a week in 3 weeks type of courses
rscales02
@rscales02
Sep 14 2017 12:19
function dataHandler () {
            for (var i = 0; i < data[0].length; i++) {
                $('#output').html('<div class=\"container\"><a href=\"' + data[2][i]+ '\">' + data[0][i] '</a><p>' + data[1][i] + '</p></div>');
            }
        }
is there a better way to handle this function? or actually make this function work?
Pethaf
@Pethaf
Sep 14 2017 12:22
What is the problem?
rscales02
@rscales02
Sep 14 2017 12:29
It does not add in the html. My understanding is that this for loop will add a new div class for each piece of info in data[0][i]
it also gives me a missing ")" syntax error
it also loads my onclick event and catches the error before any such clicking
Moisés Man
@moigithub
Sep 14 2017 12:41
html method overrites #output content everytime ur loops iterates
missing a +
rscales02
@rscales02
Sep 14 2017 12:47
ok, then I should use append maybe? also where am I missing a +?
got the + thanks @moigithub
CamperBot
@camperbot
Sep 14 2017 12:48
rscales02 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3632 | @moigithub |http://www.freecodecamp.com/moigithub
1LifeLess
@1LifeLess
Sep 14 2017 13:14
image.png
what did i do wrong?
Fazil
@faizilfanie
Sep 14 2017 13:26

Hey guys I need help with this: function switchOfStuff(val) {
var answer = "";
// Only change code below this line
switch (case){
case'a':
"apple";
break;
case'b';
"bird";
break;
case'c';
"cat";
break;
default:
"stuff";
}
// Only change code above this line
return answer;
}

// Change this value to test
switchOfStuff(1);

Kyle Holm
@thekholm80
Sep 14 2017 13:27
@faizilfanie you're not assigning any value to answer
case'a':
"apple";
this will not make answer = "apple"
Fazil
@faizilfanie
Sep 14 2017 13:29
@thekholm80 I just tried putting apple it's not working
Kyle Holm
@thekholm80
Sep 14 2017 13:32
that was just an example ...
Fazil
@faizilfanie
Sep 14 2017 13:33
@thekholm80 I think I see what you mean redoing it
Kyle Holm
@thekholm80
Sep 14 2017 13:34
var myVar = '';
switch (something) {
  case 1:
    myVar = "An assigned value";
    break;
  case 2:
    myVar = "A different value";
    break;
  default:
    myVar = "Another value";
    break;
}
Johnny
@JohnnyBizzel
Sep 14 2017 13:37
@BuntyBru You could just trust everyone not to hack into your systems :suspect:
rscales02
@rscales02
Sep 14 2017 13:40
@faizilfanie when you put code in make sure to include " ``` " on a separate line before and after the code, gives you the pretty black code box with colorcoded code
jdj
Fazil
@faizilfanie
Sep 14 2017 13:42
Here goes "'''"
CamperBot
@camperbot
Sep 14 2017 13:42
:bulb: to format code use backticks! ``` more info
Fazil
@faizilfanie
Sep 14 2017 13:42

function switchOfStuff(val) {
var answer = "";
// Only change code below this line
switch (num) {
case a:
answer = "apple";
break;
case b:
answer = "bird";
break;
case c:
answer = "cat";
break;
default :
answer = "stuff";
}

// Only change code above this line
return answer;
}

// Change this value to test
switchOfStuff(1);

Kyle Holm
@thekholm80
Sep 14 2017 13:43
don't you want switch(val) instead of switch(num)?
since that's what is passed into your function?
the rest looks good though
Fazil
@faizilfanie
Sep 14 2017 13:44
@thekholm80 this is my lesson:

Adding a default option in Switch statements
In a switch statement you may not be able to specify all possible values as case statements. Instead, you can add the default statement which will be executed if no matching case statements are found. Think of it like the final else statement in an if/else chain.

A default statement should be the last case.

switch (num) {
case value1:
statement1;
break;
case value2:
statement2;
break;
...
default:
defaultStatement;
}

Kyle Holm
@thekholm80
Sep 14 2017 13:44
that doesn't change what i wrote above
Fazil
@faizilfanie
Sep 14 2017 13:45
@thekholm80 still not working though, I hope it's not to do with punctuation?
Moisés Man
@moigithub
Sep 14 2017 13:46
do u know about function parameters / arguments
Fazil
@faizilfanie
Sep 14 2017 13:46
@thekholm80 I've tried num and val both are not working
korzo
@korzo
Sep 14 2017 13:46
@faizilfanie shouldn't a, b, c next to case be in quotes? case 'a':
Kyle Holm
@thekholm80
Sep 14 2017 13:46
^
sorry i missed that
your first try had them in quotes but now you've removed them
Fazil
@faizilfanie
Sep 14 2017 13:48
@korzo thanks that did the trick @thekholm80 thanks there, I usually get puntuation wrong for some reason
CamperBot
@camperbot
Sep 14 2017 13:48
faizilfanie sends brownie points to @korzo and @thekholm80 :sparkles: :thumbsup: :sparkles:
:cookie: 485 | @korzo |http://www.freecodecamp.com/korzo
:star2: 1466 | @thekholm80 |http://www.freecodecamp.com/thekholm80
John Wilfred
@ewojjowe
Sep 14 2017 14:44
Hello all
does anyone here have used Osmosis on scraping websites?
Darren
@DarrenfJ
Sep 14 2017 14:51
morning fCC
John Wilfred
@ewojjowe
Sep 14 2017 14:52
@DarrenfJ can you answer my question? :)
Darren
@DarrenfJ
Sep 14 2017 14:53
@Gersho figured out the algo.. had to leave it alone for a bit and let my unconscious mind figure it out.. as usual it was a simple stoopid mistake.. a return nested in the wrong for loop or something like that
@ewojjowe sorry, I do not use Osmosis.....
John Wilfred
@ewojjowe
Sep 14 2017 14:54
@DarrenfJ libxmljs-dom are you familiar with that?
Darren
@DarrenfJ
Sep 14 2017 14:54
there's usually more people in the main chat with more varied interests and skillsets if you want to ask there
John Wilfred
@ewojjowe
Sep 14 2017 14:54
okay thanks @DarrenfJ
CamperBot
@camperbot
Sep 14 2017 14:54
ewojjowe sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2023 | @darrenfj |http://www.freecodecamp.com/darrenfj
Dean
@SupernaturalDean
Sep 14 2017 15:16
blob
blob
artbohr
@artbohr
Sep 14 2017 15:18
@SupernaturalDean in the last else if you are missing a bracket at the end
@SupernaturalDean
else if () { <-
Dean
@SupernaturalDean
Sep 14 2017 15:22
@artbohr thanks
CamperBot
@camperbot
Sep 14 2017 15:22
supernaturaldean sends brownie points to @artbohr :sparkles: :thumbsup: :sparkles:
:cookie: 308 | @artbohr |http://www.freecodecamp.com/artbohr
Dean
@SupernaturalDean
Sep 14 2017 15:25
But I can not pass The logical relationship is wrong
i am confused
Subhankar paul
@Decoder-Paul
Sep 14 2017 15:26
Hey any body can help me on a issue related to random quote machine ?
this is my pen
upon clicking tweet button its binding old quote or previous quote
hi
piteto
@piteto
Sep 14 2017 15:37
@Decoder-Paul Move your code for updating the tweet url to your ajax success function. That part of your code runs last, so with your current code, your twitter url is getting updated before you get quote text back from the API
Subhankar paul
@Decoder-Paul
Sep 14 2017 15:44
@piteto can you please provide the code snippet to alter, it'll be easier to refer the problem.. thanks
CamperBot
@camperbot
Sep 14 2017 15:44
decoder-paul sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 105 | @piteto |http://www.freecodecamp.com/piteto
Subhankar paul
@Decoder-Paul
Sep 14 2017 15:47
@piteto I think you are asking me to put tweet part inside the success function?
artbohr
@artbohr
Sep 14 2017 15:52
@SupernaturalDean also u have a comma in the first else if you shoul separate ur logic statements with AND (&&) or OR (||)
piteto
@piteto
Sep 14 2017 15:53
@Decoder-Paul Yes, put the tweet part inside the success function
Sandeep Chary
@dsandeepchary
Sep 14 2017 16:16
Yo People.
quickspeedy
@quickspeedy
Sep 14 2017 16:40

Why does this function in the console result in calculating larger numbers than the min and the max, but I still passed the exercise?
function randomRange(myMin, myMax) {
console.log("Answer: " + Math.floor(Math.random() * (myMax - myMin + 1)) + myMin);
}

// Change these values to test your function
var myRandom = randomRange(5, 15);

The exercise is Generate Random Whole Numbers within a Range

Stephen James
@sjames1958gm
Sep 14 2017 16:47
@quickspeedy Are all the numbers ending in 5 ?
"Answer: " + Math.floor(Math.random() * (myMax - myMin + 1)) this part appends the random number to the string then + myMin appends the value of myMin to the string.
Try this, adding () around the math, to force the math to happen before the string concatenation.
console.log("Answer: " + (Math.floor(Math.random() * (myMax - myMin + 1)) + myMin));
quickspeedy
@quickspeedy
Sep 14 2017 16:48
@sjames1958gm No, I noticed the console in the freecodecamp works properly between 5 and 15 for the min and max, but in the browser console. The number resulted larger than the max. I was wondering how it happened.
Stephen James
@sjames1958gm
Sep 14 2017 16:49
The browser console has all numbers ending in 5 or more specifically ending in myMin
quickspeedy
@quickspeedy
Sep 14 2017 16:50
I see, and the one you suggested works. Thanks! @sjames1958gm
CamperBot
@camperbot
Sep 14 2017 16:50
quickspeedy sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8463 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Sep 14 2017 16:51
@quickspeedy :+1:
Pethaf
@Pethaf
Sep 14 2017 18:15
How nice.
My first two projects in the udacity front-end web developer passed.
Wonder what will happen if I manage to pass the entire front-end web developer nanodegree during the free trial.
Nahuel Ovejero
@NahuelOvejero
Sep 14 2017 18:24
lol, you can use the freetrial to get the degree?
Pethaf
@Pethaf
Sep 14 2017 18:30
Yes.
If you are good enough.
I applied for a scholarship (they waive tuition).
I wonder what will happen if I have already obtained the degree before the scholarships are awarded.
Kyle Holm
@thekholm80
Sep 14 2017 18:31
maybe they'll mail you a check
Pethaf
@Pethaf
Sep 14 2017 18:31
Maybe I beat the final boss.
I get a phone call from Larry and Sergei, asking me to come work with google.
Kyle Holm
@thekholm80
Sep 14 2017 18:32
sadly, with programming, there is no final boss
Pethaf
@Pethaf
Sep 14 2017 18:32
That would be so nice.
I remember having a discussion with some people I went to school with.
We were to gather again and see who had the coolest job.
"See the globe on my pass card MF?"
Nahuel Ovejero
@NahuelOvejero
Sep 14 2017 18:53
The ultimate boss is yourself
Pethaf
@Pethaf
Sep 14 2017 19:02
:)
Engjell Bislimi
@Engjell00
Sep 14 2017 21:38
Could someone tell me why my text is following the opacity of the background color I set? https://codepen.io/EngjellBislimi/pen/RLPWdp
Tiago Correia
@tiagocorreiaalmeida
Sep 14 2017 21:53
@Engjell00 what do you mean?everything looks normal
oh ok nm
this wont work this way as the knowledge I have the easier way its work with rgba
you know how it works?
Tiago Correia
@tiagocorreiaalmeida
Sep 14 2017 21:59
@Engjell00
background-color: rgba(255,0,0,0.5);
Engjell Bislimi
@Engjell00
Sep 14 2017 22:00
@tiagocorreiaalmeida thank you!
Tiago Correia
@tiagocorreiaalmeida
Sep 14 2017 22:00
color placed as rgb the last value 0.5 is the opacity to be applied
CamperBot
@camperbot
Sep 14 2017 22:00
engjell00 sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 348 | @tiagocorreiaalmeida |http://www.freecodecamp.com/tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Sep 14 2017 22:00
if you find yourself with problems in design
Engjell Bislimi
@Engjell00
Sep 14 2017 22:00
Also @tiagocorreiaalmeida http://www.csszengarden.com/ if you see the text it's all align in the same line I dont know if you understand
Tiago Correia
@tiagocorreiaalmeida
Sep 14 2017 22:01
use https://flatuicolors.com/ and https://coolors.co/ will helpp you alot
can give it a look sec
look at mine my text isnt line up on the side
@tiagocorreiaalmeida thanks for these website wow
CamperBot
@camperbot
Sep 14 2017 22:01
engjell00 sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
api offline
Engjell Bislimi
@Engjell00
Sep 14 2017 22:02
would text-align: justify; work?
Tiago Correia
@tiagocorreiaalmeida
Sep 14 2017 22:03
you want to place that div with 65 width on the center its that it?
Engjell Bislimi
@Engjell00
Sep 14 2017 22:05
I want to understand how come the text is center and all push down
and not width like mine
Tiago Correia
@tiagocorreiaalmeida
Sep 14 2017 22:05
@Engjell00 if you wanna center the div add to the header margin: auto; its the same of setting the margin of the remain width liek tyou have 65% width defined the remaining is 35%, 35% /2 = 17,5, what margin auto does is just set it equal to both sides
Im not getting what you wanna do I think
@Engjell00 and to define font size you have to write font-size mate
Engjell Bislimi
@Engjell00
Sep 14 2017 22:09
@tiagocorreiaalmeida thank you! I think I understood I just need to play in the width of the text and sizes
CamperBot
@camperbot
Sep 14 2017 22:09
engjell00 sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
api offline
Tiago Correia
@tiagocorreiaalmeida
Sep 14 2017 22:10
np
Engjell Bislimi
@Engjell00
Sep 14 2017 22:11
last thing if my text is outside because my font is too big how can I push it up if there is empty white space at the top of the container
Tiago Correia
@tiagocorreiaalmeida
Sep 14 2017 22:12
show me the exact tag
Engjell Bislimi
@Engjell00
Sep 14 2017 22:16
actually my question is look my header isnt center as the other one! https://codepen.io/EngjellBislimi/pen/RLPWdp
Tiago Correia
@tiagocorreiaalmeida
Sep 14 2017 22:18
you are telling that the p tag has less width than the h1 tag
width: 70%;
to solve this easly
remove the width from the pag tag
if you wanna really center to the middle of the page the headr I allready explained but can explain again how to achieve it
you can just aswell add margin:auto to the p tag without removing the width
will work
Engjell Bislimi
@Engjell00
Sep 14 2017 22:20
ohh
Engjell Bislimi
@Engjell00
Sep 14 2017 22:51
my UL list isn't inline with my text on the white container? why? https://codepen.io/EngjellBislimi/pen/RLPWdp
Engjell Bislimi
@Engjell00
Sep 14 2017 23:49
@just1witness thank you
CamperBot
@camperbot
Sep 14 2017 23:49
engjell00 sends brownie points to @just1witness :sparkles: :thumbsup: :sparkles:
:cookie: 348 | @just1witness |http://www.freecodecamp.com/just1witness
Engjell Bislimi
@Engjell00
Sep 14 2017 23:49
Any one know's how to size icons?
<i class="material-icons md-48">fingerprint</i> then in css I do .material-icons md-48{ font-size: 48px;} but nothing changes
just1witness
@just1witness
Sep 14 2017 23:53
Where are you getting the icons from?
@Engjell00
Engjell Bislimi
@Engjell00
Sep 14 2017 23:54
from google then I put this in my <head> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
the icon appears but when I seem to size them I put a border on them to see what happen the border enlarges but the icons stays the same